/* ============ Dashboard page (.pg-dashboard) ============ */

/* Cards laid out by grids must not inherit the stacked-card margin. */
.pg-dashboard .grid > .card { margin-top: 0; }
.pg-dashboard .dash-row { margin-top: 16px; }

/* ---------- hero ---------- */
.pg-dashboard .hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(620px 300px at 92% -50%, var(--hero-glow), transparent 62%),
    radial-gradient(540px 340px at -8% 135%, rgba(108, 74, 182, .55), transparent 60%),
    linear-gradient(135deg, var(--brand-700) 0%, var(--brand-800) 52%, var(--brand-900) 100%);
  color: #fff;
  padding: 26px 28px;
  box-shadow: var(--shadow);
}
/* The column-D sits in the hero as a quiet watermark. */
.pg-dashboard .hero::after {
  content: '';
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  width: 190px; height: 184px; opacity: .10; pointer-events: none;
  background: url('../../brand/mark-white.png') center/contain no-repeat;
}
.pg-dashboard .hero-body { position: relative; z-index: 1; }
.pg-dashboard .hero-date {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--hero-ink);
}
.pg-dashboard .hero-greet { font-size: 26px; font-weight: 800; margin: 6px 0 3px; color: #fff; }
.pg-dashboard .hero-sub { color: rgba(255,255,255,.66); font-size: 13px; font-weight: 600; }
.pg-dashboard .hero-chip {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 15px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28);
  color: #EDEFFF; padding: 6px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
}
.pg-dashboard a.hero-chip:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255,255,255,.45); }
.pg-dashboard .hero-chip svg { width: 15px; height: 15px; flex: none; }
.pg-dashboard .hero-chip.is-quiet {
  background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .18); color: rgba(255,255,255,.66);
}

/* ---------- stat cards ---------- */
.pg-dashboard .stats { margin-top: 16px; }
.pg-dashboard a.stat {
  display: block; color: inherit;
  transition: transform .13s ease, box-shadow .13s ease, border-color .13s ease;
}
.pg-dashboard a.stat:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong);
}
.pg-dashboard .stat-value.val-red { color: var(--danger); }
.pg-dashboard .stat-value.val-gold { color: var(--gold-dark); }
.pg-dashboard .stat-sub .badge { margin-left: 4px; vertical-align: 1px; }

/* ---------- list embellishments ---------- */
.pg-dashboard .row-link { color: inherit; }
.pg-dashboard .row-link:hover { background: var(--fill); }
.pg-dashboard .list-row { border-radius: 8px; padding-left: 8px; padding-right: 8px; }

.pg-dashboard .cls-time {
  display: flex; flex-direction: column; align-items: flex-end;
  min-width: 62px; flex: none; font-size: 12.5px; font-weight: 700; line-height: 1.35;
}
.pg-dashboard .cls-end { font-size: 11px; color: var(--muted); font-weight: 600; }
.pg-dashboard .cls-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.pg-dashboard .ev-date {
  width: 44px; height: 46px; border-radius: 10px; flex: none;
  background: var(--accent-tint); color: var(--indigo-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pg-dashboard .ev-day { font-size: 16px; font-weight: 800; line-height: 1.1; }
.pg-dashboard .ev-mon {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}

.pg-dashboard .pin-ic { color: var(--gold-dark); display: inline-flex; vertical-align: -2px; margin-right: 5px; }
.pg-dashboard .pin-ic svg { width: 13px; height: 13px; }
.pg-dashboard .ann-body { margin-top: 2px; }

.pg-dashboard .card-link {
  font-size: 12.5px; font-weight: 700; color: var(--indigo-3);
  display: inline-flex; align-items: center; gap: 2px; white-space: nowrap;
}
.pg-dashboard .card-link:hover { color: var(--text); }
.pg-dashboard .card-link svg { width: 14px; height: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .pg-dashboard .hero { padding: 20px; }
  .pg-dashboard .hero-greet { font-size: 21px; }
  .pg-dashboard .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pg-dashboard .stat { padding: 13px 14px; }
  .pg-dashboard .stat .stat-value { font-size: 22px; }
  .pg-dashboard .cls-time { min-width: 56px; }
  .pg-dashboard .list-row { padding-left: 4px; padding-right: 4px; }
}

/* ---------- hero: greeting plus the two facts that matter today ---------- */
.pg-dashboard .hero { padding: 24px 28px 22px; }
.pg-dashboard .hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.pg-dashboard .hero-greet { font-size: 27px; letter-spacing: -.028em; }
.pg-dashboard .hero-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .14);
}
.pg-dashboard .hero-fact {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .10);
  text-decoration: none; transition: background var(--t), border-color var(--t), transform .12s var(--ease);
}
.pg-dashboard .hero-fact:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .4); transform: translateY(-1px); }
.pg-dashboard .hf-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--hero-ink);
}
.pg-dashboard .hf-value { font-size: 14.5px; font-weight: 700; color: #fff; line-height: 1.3; }
.pg-dashboard .hf-meta { font-size: 11.5px; color: rgba(255, 255, 255, .62); }

/* ---------- attendance ring ---------- */
.pg-dashboard .stat-ring-card {
  display: flex; align-items: center; gap: 15px; text-decoration: none; color: inherit;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.pg-dashboard .stat-ring-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.pg-dashboard .ring {
  position: relative; width: 66px; height: 66px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--fill-2) 0);
  display: grid; place-items: center;
}
.pg-dashboard .stat-ring-card.is-low .ring { background: conic-gradient(var(--danger) calc(var(--pct) * 1%), var(--fill-2) 0); }
.pg-dashboard .ring::before {
  content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--card);
}
.pg-dashboard .ring span { position: relative; font-size: 15px; font-weight: 780; letter-spacing: -.02em; }
.pg-dashboard .stat-ring-card.is-low .ring span { color: var(--danger); }
.pg-dashboard .ring-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pg-dashboard .ring-meta .stat-sub { margin: 0; }
.pg-dashboard .ring-meta .badge { align-self: flex-start; }

/* ---------- today's classes as a timeline ---------- */
.pg-dashboard .tl { list-style: none; margin: 0; padding: 0; }
.pg-dashboard .tl-item { display: grid; grid-template-columns: 58px 22px 1fr auto; align-items: start; gap: 10px; padding: 9px 0; }
.pg-dashboard .tl-time { text-align: right; display: flex; flex-direction: column; line-height: 1.25; padding-top: 1px; }
.pg-dashboard .tl-time b { font-size: 12.5px; font-weight: 750; }
.pg-dashboard .tl-time span { font-size: 11px; color: var(--text-3); }
.pg-dashboard .tl-rail { position: relative; display: flex; justify-content: center; align-self: stretch; }
.pg-dashboard .tl-rail::before {
  content: ''; position: absolute; top: 0; bottom: -18px; width: 2px; background: var(--line);
}
.pg-dashboard .tl-item:last-child .tl-rail::before { display: none; }
.pg-dashboard .tl-dot {
  position: relative; width: 11px; height: 11px; border-radius: 50%; margin-top: 4px;
  background: var(--cc, var(--accent)); box-shadow: 0 0 0 3px var(--card);
}
.pg-dashboard .tl-title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg-dashboard .tl-sub { font-size: 12px; color: var(--text-2); }
.pg-dashboard .tl-room { align-self: center; }
.pg-dashboard .tl-live {
  font-size: 9.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--g-700); background: var(--g-100); padding: 2px 7px; border-radius: var(--r-pill);
}
.pg-dashboard .tl-item.is-done .tl-time, .pg-dashboard .tl-item.is-done .tl-sub { opacity: .6; }
.pg-dashboard .tl-item.is-done .tl-title { color: var(--text-2); font-weight: 650; }
.pg-dashboard .tl-item.is-done .tl-room { opacity: .6; }
.pg-dashboard .tl-item.is-done .tl-dot { background: var(--n-300); }
.pg-dashboard .tl-item.is-now .tl-dot { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--g-200); }

@media (max-width: 760px) {
  .pg-dashboard .hero { padding: 18px 18px 16px; }
  .pg-dashboard .hero-top { flex-direction: column; gap: 12px; }
  .pg-dashboard .hero-facts { grid-template-columns: 1fr; margin-top: 16px; padding-top: 14px; }
  .pg-dashboard .stat-ring-card { gap: 12px; }
  .pg-dashboard .ring { width: 58px; height: 58px; }
  .pg-dashboard .tl-item { grid-template-columns: 50px 20px 1fr; }
  .pg-dashboard .tl-room { grid-column: 3; justify-self: start; margin-top: 2px; }
}

/* ---------- Denning records: source mark, failure notice, class mode and join ---------- */
.pg-dashboard .card-title h3 .badge { margin-left: 8px; vertical-align: 2px; }
.pg-dashboard .dash-source { background: var(--accent-tint); color: var(--accent); }
.pg-dashboard .stat-ring-card .stat-label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.pg-dashboard .stat-label .dash-source { padding: 1px 6px; font-size: 10px; text-transform: none; letter-spacing: 0; }
.pg-dashboard .dash-notice {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px;
  color: var(--text-2); border-left: 3px solid var(--warning);
}
.pg-dashboard .dash-notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warning); }
.pg-dashboard .tl-mode {
  font-size: 9.5px; font-weight: 750; letter-spacing: .03em; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--fill-2); color: var(--text-2);
}
.pg-dashboard .tl-mode.is-online { background: var(--g-100); color: var(--g-700); }
.pg-dashboard .tl-join { margin-top: 7px; gap: 6px; }
.pg-dashboard .tl-join svg { width: 14px; height: 14px; }
.pg-dashboard .tl-nolink { margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--danger); }
.pg-dashboard .tl-item.is-tbc .tl-time b { font-size: 11.5px; color: var(--text-2); }
.pg-dashboard .tl-item.is-tbc .tl-dot { background: var(--card); box-shadow: 0 0 0 2px var(--cc, var(--accent)) inset, 0 0 0 3px var(--card); }
.pg-dashboard div.row-link[role="button"], .pg-dashboard div.hero-fact[role="button"] { cursor: pointer; }
.pg-dashboard div.row-link[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- attendance tile: no figure, and the category legend ---------- */
.pg-dashboard .stat-ring-card { flex-wrap: wrap; }
.pg-dashboard .ring .ring-none { font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: 0; }
.pg-dashboard .att-legend {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-2);
}
.pg-dashboard .att-legend .lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pg-dashboard .lg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--n-300); }
.pg-dashboard .lg-present { background: var(--success); }
.pg-dashboard .lg-online { background: var(--p-300); }
.pg-dashboard .lg-late { background: var(--gold); }
.pg-dashboard .lg-leave { background: var(--g-200); }
.pg-dashboard .lg-excused { background: var(--n-300); }
.pg-dashboard .lg-absent { background: var(--danger); }
.pg-dashboard .lg-bunk { background: color-mix(in srgb, var(--danger) 55%, var(--card)); }

/* ---------- house tile ---------- */
.pg-dashboard .house-name {
  display: flex; align-items: center; gap: 9px; margin-top: 6px;
  font-size: 18px; font-weight: 780; letter-spacing: -.01em; min-width: 0;
}
.pg-dashboard .house-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-dashboard .house-crest { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--fill); }
.pg-dashboard .house-swatch {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: var(--hc, var(--accent)); box-shadow: 0 0 0 3px var(--fill);
}

/* ---------- a Denning event or notice, opened in a pop-up ---------- */
.pg-dashboard .dash-event-img {
  display: block; width: 100%; max-height: 220px; object-fit: cover;
  border-radius: var(--r-md); margin-bottom: 14px; background: var(--fill);
}
.pg-dashboard .dash-event-tag { font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.pg-dashboard .dash-ev-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; font-weight: 600; }
.pg-dashboard .dash-ev-row svg { width: 16px; height: 16px; flex: none; color: var(--indigo-3); }
.pg-dashboard .dash-event-desc { margin: 12px 0 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.pg-dashboard .dash-event-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 760px) {
  .pg-dashboard .house-name { font-size: 16px; }
  .pg-dashboard .att-legend { gap: 3px 10px; }
}

/* Timetable card: Today | Weekly, as on the Denning app's home screen */
.pg-dashboard .dash-seg { margin: -2px 0 8px; }
.pg-dashboard .dash-week-day + .dash-week-day { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pg-dashboard .dash-week-head { font-size: 11.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.pg-dashboard .dash-week-wait { padding: 14px 0; }

/* Denning events: picture cards in a row that scrolls sideways */
.pg-dashboard .ev-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; margin: 0 -2px 6px; }
.pg-dashboard .ev-tile { flex: 0 0 216px; scroll-snap-align: start; position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); overflow: hidden; cursor: pointer; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.pg-dashboard .ev-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.pg-dashboard .ev-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pg-dashboard .ev-tile-ph { display: block; aspect-ratio: 16 / 9; background: var(--fill); }
.pg-dashboard .ev-tile-img { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.pg-dashboard .ev-tile-body { padding: 9px 12px 11px; }
.pg-dashboard .ev-tile-title { font-weight: 700; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pg-dashboard .ev-tile-sub { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.pg-dashboard .ev-tile.is-past .ev-tile-sub { color: var(--text-3); }
@media (max-width: 560px) { .pg-dashboard .ev-tile { flex-basis: 72%; } }
@media (min-width: 761px) { .pg-dashboard .dash-tt-body[data-tt-body="week"] { max-height: 430px; overflow-y: auto; padding-right: 4px; } }

/* ---------- motion ---------- */
/* The attendance ring fills to its value on arrival (the number counts up with it, App.motion.count).
   Registering --pct lets the browser interpolate the conic gradient. */
@property --pct { syntax: '<number>'; inherits: true; initial-value: 0; }
@media (prefers-reduced-motion: no-preference) {
  .pg-dashboard .ring { animation: ringFill 1.1s var(--ease-out) .12s both; }
}
@keyframes ringFill { from { --pct: 0; } }
/* the hero's facts lift a touch under the pointer; the live "now" row breathes */
.pg-dashboard .hero-fact { transition: background var(--t), border-color var(--t), transform var(--d-ui) var(--ease-out); }
.pg-dashboard a.stat { transition: transform var(--d-ui) var(--ease-out), box-shadow var(--d-ui) var(--ease-out), border-color var(--t); }
.pg-dashboard a.stat:hover { box-shadow: var(--card-hi), var(--shadow-md); }

/* ---------- stat icons ---------- */
.pg-dashboard .stat.has-ic { position: relative; }
.pg-dashboard .stat.has-ic .stat-label { padding-right: 40px; }
.pg-dashboard .stat-ic {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent);
  transition: background var(--t), color var(--t), transform var(--d-ui) var(--ease-out);
}
.pg-dashboard .stat-ic svg { width: 17px; height: 17px; }
.pg-dashboard a.stat:hover .stat-ic { background: var(--accent); color: var(--on-accent); }
@media (max-width: 760px) {
  .pg-dashboard .stat-ic { top: 11px; right: 11px; width: 28px; height: 28px; border-radius: 9px; }
  .pg-dashboard .stat-ic svg { width: 15px; height: 15px; }
  .pg-dashboard .stat.has-ic .stat-label { padding-right: 32px; }
}
