
/* ============================================================================
   DASHBOARD REDESIGN - compact, colour-coded, one screen.

   Appended rather than replacing the existing rules above: the old
   .dash-card / .legend / .dash-panel-title blocks are still used by other
   views, so they are left alone and only extended here.

   Charts are inline SVG generated in C# (see Services/Svg.cs), so there is
   nothing here for JavaScript to draw and nothing to load from a CDN.

   Colour is used to mean something, not for decoration:
     green  = good        amber = attention      red = problem
     slate  = neutral / nothing to report        blue = today's highlight
   ============================================================================ */

:root {
    --kpi-good: #16a34a;
    --kpi-good-bg: #ecfdf5;
    --kpi-warn: #d97706;
    --kpi-warn-bg: #fffbeb;
    --kpi-bad: #dc2626;
    --kpi-bad-bg: #fef2f2;
    --kpi-info: #0284c7;
    --kpi-info-bg: #f0f9ff;
    --kpi-muted: #64748b;
    --kpi-muted-bg: #f8fafc;
}

/* ---------------------------------------------------------------- page head -- */

.dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}

.dash-title {
    font-size: 1.32rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -.01em;
}

.dash-head-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    font-size: .72rem;
    font-weight: 600;
    padding: .22rem .55rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #475569;
    white-space: nowrap;
}

.pill-warn { background: #fef3c7; color: #92400e; }
.pill-danger { background: #fee2e2; color: #991b1b; }

/* ------------------------------------------------------------- KPI strip --- */

/* Five tiles: attendance rate, present, not punched yet, late, early out. */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .6rem;
    margin-bottom: .8rem;
}

.kpi {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .55rem .7rem .5rem;
    overflow: hidden;
    /* The colour bar is a border, not a background, so the tile stays white and
       readable while still reading as coloured at a glance. */
    border-left: 4px solid var(--kpi-muted);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.kpi.kpi-good { border-left-color: var(--kpi-good); }
.kpi.kpi-warn { border-left-color: var(--kpi-warn); }
.kpi.kpi-bad  { border-left-color: var(--kpi-bad); }
.kpi.kpi-info { border-left-color: var(--kpi-info); }
.kpi.kpi-muted{ border-left-color: #cbd5e1; }

/* The late and early-out tiles link to the filtered report, so they must not
   pick up the browser's underline and blue. */
a.kpi { text-decoration: none; color: inherit; }

.kpi-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: .1rem;
}

.kpi.kpi-good .kpi-value { color: var(--kpi-good); }
.kpi.kpi-warn .kpi-value { color: var(--kpi-warn); }
.kpi.kpi-bad  .kpi-value { color: var(--kpi-bad); }
.kpi.kpi-info .kpi-value { color: var(--kpi-info); }

.kpi-unit {
    font-size: .85rem;
    font-weight: 600;
    color: #94a3b8;
}
.kpi-foot {
    font-size: .69rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-spark {
    position: absolute;
    right: .45rem;
    bottom: .35rem;
    opacity: .85;
}

/* -------------------------------------------------------------- main grid ---
   Three columns, and deliberately unequal.

   The right-hand column is reserved for the real-time monitor: it is pinned there explicitly and
   spans both content rows. It gets 1.45fr against the other two at 1fr, because it is the one
   panel whose value grows with both width and height - more of each punch row readable at once -
   and after the pie and "Today's people" cards were removed it had a column to itself and room
   to grow into.

     row 1 | trend (spans c1+c2) |  real-time  |
     row 2 | departments | to-do |  monitor    |

   The trend keeps two columns so its 14-day axis stays legible. It used to be .span2; when the
   class was renamed to .c-trend the span had to be re-stated here or the chart silently halved
   in width. */

/* The dashboard shell: everything else in a main column, the punch monitor in a rail of its
   own. The rail starts level with the KPI strip, so the feed is in view from the top rather
   than below the fold, and stays pinned while the main column scrolls. */
.dash-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(470px, 30vw, 560px);
    gap: .85rem;
    align-items: start;
}

.dash-main { min-width: 0; }

.dash-side {
    position: sticky;
    top: calc(var(--topbar-h) + .8rem);
    min-width: 0;
}

.dash-grid {
    display: grid;
    /* Two columns now that the monitor has left the grid for its own rail. The trend keeps
       both of them; departments and the to-do list share the row beneath. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: min-content;
    gap: .6rem;
    align-items: start;
}

.dash-card.c-trend { grid-column: span 2; }

.dash-card.c-realtime {
    /* Fills the rail. Capped at the viewport so the feed ends where the screen does; the list
       scrolls internally if it ever outgrows that. */
    display: flex;
    flex-direction: column;
    min-height: 320px;
    max-height: calc(100vh - var(--topbar-h) - 1.7rem);
}

.c-realtime > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* The list fills whatever height the column gives it, instead of the fixed
   232px the other panels use. */
.c-realtime .rt-list {
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
}

/* .dash-card.span2 was a generic two-column utility. Nothing uses it now that the trend
   carries its own .c-trend span, so it is gone rather than left as dead CSS. */

.dash-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text);
    padding: .45rem .7rem;
    background: #fbfcfe;
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
}

.hdr-note {
    font-size: .68rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ trend --- */

.trend { padding: 0 .3rem; }
.trend svg { display: block; }

.trend-legend {
    display: flex;
    gap: .8rem;
    padding: .1rem .7rem .35rem;
    font-size: .68rem;
    color: var(--text-muted);
}

.trend-legend span { display: inline-flex; align-items: center; gap: .28rem; }

.hdr-warn { color: #b45309; font-weight: 600; }

.trend-legend i,
.legend i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    display: inline-block;
    flex: 0 0 auto;
}

/* ------------------------------------------------------------ departments --- */

.dept-list { max-height: 232px; overflow-y: auto; }

.dept {
    display: grid;
    grid-template-columns: 1fr 62px 46px 40px;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: .76rem;
}

.dept:last-child { border-bottom: 0; }

.dept-name {
    font-weight: 600;
    color: #344054;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-meter svg { display: block; }
.dept-num { text-align: right; color: var(--text-muted); white-space: nowrap; }
.dept-num b { color: var(--text); }
.dept-pct { text-align: right; font-weight: 700; white-space: nowrap; }

.dept-pct.kpi-good { color: var(--kpi-good); }
.dept-pct.kpi-warn { color: var(--kpi-warn); }
.dept-pct.kpi-bad  { color: var(--kpi-bad); }

/* ------------------------------------------------------------- real-time --- */

/* The list height is controlled by the filling layout above and responsive caps below. */

.c-realtime .rt {
    display: grid;
    /* avatar | employee ID | name | department | GAP | status | time.

       Department was asked for "after Name, on the left", and it was already after Name in source
       order - but Name was the elastic column, so Name swallowed all the spare width and pushed
       Department visually to the right-hand half of the card. Order in the DOM was never the
       problem; which track absorbed the slack was.

       So the slack now goes into an explicit empty spacer track between Department and Status.
       Name is capped rather than elastic (max 260px, ellipsis beyond), which keeps a long name
       from shoving the whole row sideways. The result is two readable groups - who and where they
       work on the left, what they did and when on the right - instead of one name floating alone
       on the left with everything else crowded at the far end.

       Every track except the spacer is a FIXED length or capped, which is also what keeps the
       header aligned. Two failures measured on the way here, both worth recording so nobody
       "tidies" this back:

       1. `auto` tracks are resolved PER ROW. Sharing one template is not enough: the header sized
          its tracks from its own label text ("EMPLOYEE ID" is wider than the code "7") and pushed
          Name, Department, Status and Time up to 58px right of the data they label.

       2. `ch` units are ALSO per element, because ch is defined against that element's own font.
          With the header set to a smaller font, `10ch` was a narrower box on the header than on a
          data row - same number, different pixels - so the drift survived the change to fixed
          tracks, and "DEPARTMENT" wrapped mid-word. Hence px, which no font size can move.

       The spacer is the one deliberately elastic track, and it is empty in every row including
       the header, so it cannot change the alignment of anything. */
    /* The avatar track was 24px when this cell held only initials - a code is enough for a circle
       of initials, and the narrowest track kept the widest possible name column. It is 36px now
       because the cell carries a photograph when the employee has one, and a face at 22px is too
       small to recognise anyone at.

       The Time track went the same way, 56px to 92px, for the reason recorded on .rt-time: it now
       carries a date as well as a clock reading on any punch that is not from today, and
       "16 Oct 09:15 AM" does not exist at 56px. The extra width is taken out of the spacer on its
       left, which is the only track with anything to give - Status and Time keep their right-hand
       positions and the header moves with the data rows.

       The width moved once, deliberately, and every track after it therefore shifted right by 12px
       TOGETHER, header and rows alike - which is the only reason alignment survives. Raising any
       of these numbers again means re-measuring all seven tracks, not just the one that changed. */
    grid-template-columns: 36px 70px minmax(44px, 260px) 84px minmax(0, 1fr) 80px 92px;
    align-items: center;
    gap: .4rem;
    padding: .28rem .7rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: .75rem;

    /* Every piece of text in the grid is bold and black, on request. Set here on the row so the
       intent is in one place, and each cell below only has to say what makes it DIFFERENT - the
       monospace face on the ID, the fixed width on the department. That is why the greys that used
       to be scattered across .rt-id, .rt-name, .rt-dept and .rt-time are gone: they were four
       separate places to forget, and forgetting one showed up as a single grey row.

       Backgrounds are deliberately untouched. The avatar circle and the green "Check In" pill are
       colour that carries meaning, not text; black on those still reads cleanly, and flattening
       them would lose the at-a-glance check-in/check-out distinction for no gain. */
    font-weight: 700;
    color: #000;
}

/* The spacer. No content, no styling beyond that it must not be allowed to shrink the columns
   around it - min-width:0 on a grid item lets it collapse cleanly on a narrow card rather than
   forcing the row to overflow. */
.c-realtime .rt-gap { min-width: 0; }

.c-realtime .rt:last-child { border-bottom: 0; }

.c-realtime .avatar {
    /* Positioning context for the photograph layered over the initials below. Without it the
       image would be placed against whatever ancestor happens to be relative and land off the
       circle entirely. */
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e0edff;
    /* Colour inherited from .rt (black + bold) - only the circle is set here. */
    font-size: .78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* A photo replacing a shorter string of initials must not be able to grow the row. The
       circle's size is already fixed above; this stops the image being the thing that sets the
       line box instead. */
    overflow: hidden;
    flex: none;
}

/* The employee photograph, laid straight over the initials.
   The initials are STILL RENDERED underneath rather than being dropped when a photo exists, and
   that is the whole point: this image carries no fallback of its own. If the file is missing from
   ZKBio's folder, is a corrupt JPEG, or the request fails, the img is removed by its onerror and
   the initials sitting behind it are simply what remains - a row that degrades to the state it was
   in before photos existed instead of showing a broken-image glyph or an empty circle.

   object-fit:cover is what makes a 600x900 portrait and a 1080x1080 square both fill this circle
   without letterboxing; without it the wrong aspect ratio would leave the blue background showing
   through the top and bottom of what is supposed to be a face. */
.c-realtime .avatar-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.c-realtime .rt-id {
    /* Monospace and tabular figures so a column of codes lines up vertically and the eye can track
       one code down the page instead of re-reading each row. Clipped with a tooltip rather than
       wrapped, so a 5-digit code cannot push the clock off the edge of the card.

       Weight and colour are inherited from .rt - this cell used to be muted grey, which made the
       one column a reader is most likely to scan quietly grey out. */
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    max-width: 6.5ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The department cell. Wider cap than the ID because real names are longer than codes, and the
   ellipsis plus the title attribute keeps one long name from shoving the clock off the card.
   Weight and colour inherited from .rt - it used to be mid-grey, lighter than the name beside it. */
.c-realtime .rt-dept {
    max-width: 11ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Column headings. Deliberately reuses the .rt grid (see the class="rt rt-head" in the partial)
   rather than restating grid-template-columns, so a column added to the data rows cannot leave
   the headings silently misaligned over the wrong fields. */
.c-realtime .rt-head {
    /* Sticky, because it sits INSIDE the scrolling .rt-list. Measured reason for both halves of
       that decision: sharing the .rt class stops the columns drifting (see .rt), and being inside
       the list stops the ~15px scrollbar gutter making the rows narrower than the header. Sticky
       is what stops the headings scrolling away with the punches. */
    position: sticky;
    top: 0;
    z-index: 1;

    /* Bold and black like the rest of the grid. This was previously weight 600 in grey #94a3b8 on
       the argument that light labels sit better above a live feed - but a heading that is quieter
       than the data it labels reads as disabled, and "everything bold and black" is the opposite
       of that. Only the small caps and the tint are kept; they separate the heading row from the
       data rows without needing a lighter colour. */
    font-weight: 700;
    font-size: .6rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    /* Opaque, and it must be: a sticky element that is translucent shows the rows sliding
       underneath it, which looks like a rendering fault. */
    background: #f8fafc;
    /* The row rule is removed because the background change already separates it from the data,
       and two adjacent borders read as a thicker line. */
    border-bottom: 0;
    padding-top: .4rem;
    padding-bottom: .4rem;
}

/* Labels must never wrap. A heading that breaks "DEPARTMEN / T" stops reading as a word and
   hides the fact that the track was too narrow - which is the thing worth noticing. If a label
   ever does not fit its track, the track is wrong, not the label. */
.c-realtime .rt-head > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The avatar track holds a 34px circle in a 36px column - it was a 22px circle in a 24px column
   until the cell started carrying a photograph as well as initials. The two numbers have to move
   together: a circle bigger than its track is clipped by the row, and a track wider than its
   circle wastes the space the name column would rather have. No nudge is needed for the heading
   above it either: the empty first cell occupies the same track and is followed by the same gap,
   so the first label already lands over the first real column. An earlier version carried a
   margin-right hack here to correct a mismatch that the fixed tracks removed on their own. */

/* Time is the right-aligned column; its heading must be too, or "Time" sits left of the digits it
   labels.

   Both halves of that sentence matter, and only this half was ever written down. .rt-head-time
   was right-aligned while .rt-time was not, so the heading did not sit left of the digits - it sat
   30.7px to the RIGHT of them, overhanging the readings it labels. Measured with Range rects, not
   guessed: label 862.5-887.8 against values 831.8-879.9 in a 56px track.

   The declaration is on the values now, which is where the comment always claimed it already was.
   The heading rule is left alone because it is correct once the values agree with it - the right
   edges then land on the same pixel, which is what makes a column read as one column. */
.c-realtime .rt-head-time { justify-self: end; }

.c-realtime .rt-name {
    /* Explicit, not inherited: site.css .rt-name sets color: #344054 and font-weight: 600 on the
       element itself. A direct declaration beats inheritance outright, so relying on the row to
       hand down black + bold left the name grey and half-weight - measured, not assumed.

       The ellipsis stays: the name is the one column that can be arbitrarily long, and a
       truncated surname is still more useful than a truncated clock reading. */
    color: #000;
    font-weight: 700;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c-realtime .rt-state {
    /* Stated explicitly rather than inherited. site.css has its own .rt-state rule (grey, from an
       Attendance Punches layout that no longer exists) which sets colour ON THE ELEMENT. A direct
       declaration always beats an inherited one no matter how specific the parent is, so leaving
       this to inherit from .c-realtime .rt silently produced a grey "Check In" pill. */
    color: #000;
    font-weight: 700;
    font-size: .66rem;
    padding: .1rem .34rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* Only the pill's background is themed. The green fill is kept because it is the fastest way to
   tell Check In from Check Out at a glance down a scrolling list - and black on #dcfce7 measures
   at roughly 17:1 contrast, well clear of the WCAG AA 4.5:1 floor, so nothing is lost by making
   the label itself black. */
.c-realtime .state-in { background: #dcfce7; }

.c-realtime .rt-time {
    /* Explicit for the same reason as .rt-state: site.css .rt-time sets colour on the element and
       would otherwise win over anything inherited from the row. This was the faintest text in the
       panel, and a clock reading is exactly what a reader scans down the column. */
    color: #000;
    font-weight: 700;
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    /* Right-aligned to match the heading above it - see .rt-head-time for the measurement that
       produced this. Without it the heading floated 30.7px right of the times. */
    text-align: right;
}

/* ------------------------------------------------------------ mini lists --- */

.mini-list { max-height: 232px; overflow-y: auto; }

.mini {
    display: grid;
    grid-template-columns: 8px 1fr;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: .75rem;
}

.mini:last-child { border-bottom: 0; }

.mini-name {
    font-weight: 600;
    color: #344054;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-meta {
    grid-column: 2;
    font-size: .67rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .08rem .3rem;
    border-radius: 4px;
    background: #ede9fe;
    color: #6d28d9;
    white-space: nowrap;
}

.mini .tag { grid-row: span 2; }


/* -------------------------------------------------------------- responsive -- */

@media (max-width: 1400px) {
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Below three columns the pinned right-hand column stops making sense, so the
       real-time monitor rejoins normal flow and spans the full width instead. */
    .dash-card.c-realtime {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 0;
    }
    /* 470px rather than the 320px it was. The height was picked when every row was 31px tall; the
       avatar now holds a photograph, rows are 44px, and 320px showed six punches out of fourteen -
       two thirds of the feed sitting behind a scrollbar nobody asked for. 470px puts nine back on
       screen at the same row height. The card grows by 150px in this breakpoint only, which is the
       cost of the larger photo, and it is a cap rather than a height: on wide screens the base rule
       (max-height: none, flex: 1) still lets the list fill whatever the column gives it. */
    .c-realtime .rt-list { max-height: 470px; }
}

@media (max-width: 767.98px) {
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-card.c-trend { grid-column: span 1; }
}

/* ====================================================== VIP welcome screen ===
   The VIP tab is the kiosk/TV screen. One guest at a time, a photograph large
   enough to recognise across a room, and type that scales with the viewport
   rather than with the sidebar. The normal dashboard keeps its compact density
   in the other tab. */

.vip-tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border);
    margin: 0 0 .8rem;
}

.vip-tabs .nav-link {
    padding: .48rem .95rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
    color: #64748b;
    font-size: .86rem;
    font-weight: 600;
}

.vip-tabs .nav-link:hover { color: #0f172a; background: #f1f5f9; }

.vip-tabs .nav-link.active {
    color: #0f172a;
    background: #fff;
    border-color: var(--border);
}

.vip-tabs .nav-link.vip-tab.active {
    color: #78350f;
    box-shadow: inset 0 2px 0 #d97706;
}

.vip-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    margin-left: .35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: .72rem;
    font-weight: 700;
}

.vip-stage {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 250px);
    border-radius: 18px;
    color: #f8fafc;
    background:
        radial-gradient(1100px 700px at 8% 0%, rgba(233, 185, 73, .20), transparent 58%),
        radial-gradient(900px 600px at 100% 100%, rgba(225, 69, 96, .14), transparent 55%),
        linear-gradient(135deg, #070a12 0%, #111a2e 52%, #221706 100%);
    box-shadow: 0 22px 60px rgba(2, 6, 23, .28);
}

.vip-stage:fullscreen {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
}

.vip-carousel,
.vip-carousel .carousel-inner,
.vip-carousel .carousel-item { min-height: inherit; }

.vip-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: stretch;
    min-height: inherit;
}

.vip-photo-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: clamp(18px, 2.2vw, 36px);
}

/* Intrinsic width/height keeps the border and shadow hugging the actual photograph.
   Stretching the img and using object-fit would either crop a portrait's face away or
   leave a letterboxed gap inside a gold frame, both of which look broken on a TV. */
.vip-photo {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 330px);
    object-fit: contain;
    border: 3px solid rgba(233, 185, 73, .55);
    border-radius: 16px;
    background: rgba(255, 255, 255, .04);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .55);
}

.vip-photo.vip-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 32rem);
    height: auto;
    min-height: 45vh;
    color: rgba(233, 185, 73, .7);
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 800;
    letter-spacing: .04em;
}

.vip-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .35rem;
    padding: clamp(22px, 3.5vw, 64px);
}

.vip-kicker {
    align-self: flex-start;
    margin-bottom: .45rem;
    padding: .38rem .85rem;
    border-radius: 999px;
    background: #e9b949;
    color: #241a04;
    font-size: clamp(.66rem, .8vw, .82rem);
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.vip-name {
    margin: 0;
    font-size: clamp(2rem, 3.8vw, 4.5rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -.02em;
    color: #f5c451;
    background: linear-gradient(95deg, #fff3c4 0%, #f5c451 48%, #fde68a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.vip-title { color: #e2e8f0; font-size: clamp(1rem, 1.55vw, 1.65rem); font-weight: 600; }
.vip-company { color: #94a3b8; font-size: clamp(.9rem, 1.15vw, 1.25rem); }

.vip-message {
    max-width: 34ch;
    margin-top: .8rem;
    padding-left: 1rem;
    border-left: 4px solid #e9b949;
    color: #f1f5f9;
    font-size: clamp(1rem, 1.45vw, 1.6rem);
    font-style: italic;
    line-height: 1.45;
}

.vip-meta { margin-top: 1rem; color: #94a3b8; font-size: clamp(.78rem, .95vw, 1rem); }
.vip-dot { margin: 0 .35rem; color: #e9b949; }

.vip-arrow { width: 4.5rem; opacity: .55; }
.vip-arrow:hover { opacity: 1; }

.vip-indicators { margin-bottom: .6rem; }
.vip-indicators [data-bs-target] {
    width: .55rem;
    height: .55rem;
    border: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .45);
}
.vip-indicators .active { background-color: #e9b949; }

.vip-fs {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 5;
    padding: .4rem .8rem;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 8px;
    background: rgba(7, 10, 18, .55);
    color: #e2e8f0;
    font-size: .74rem;
    backdrop-filter: blur(6px);
}
.vip-fs:hover { background: rgba(7, 10, 18, .85); color: #fff; }

.vip-stage:fullscreen .vip-photo { max-height: calc(100vh - 90px); }
.vip-stage:fullscreen .vip-fs { right: 1.4rem; bottom: 1.4rem; }

@media (max-width: 991.98px) {
    .vip-stage { min-height: 0; }
    .vip-hero { grid-template-columns: 1fr; }
    .vip-photo-frame { padding: 1rem 1rem 0; }
    .vip-photo { max-height: 46vh; }
    .vip-copy { padding: 1.25rem 1.25rem 3.5rem; }
}

/* ============================================================================
   MODERN DASHBOARD - scoped to /Home

   Everything below is prefixed .dashboard-page, which only the dashboard view
   emits. The classes above stay in place because they carry the realtime grid
   measurements and the VIP kiosk, and because these pages already have a long
   history of layout fixes that are worth keeping readable. Nothing here can
   reach another screen: the wrapper is unique to Home.

   The visual language is deliberate:
     - one coloured hero (the attendance rate) and four white supporting tiles,
       so the screen has a focal point instead of five equal boxes;
     - soft indigo/cyan ambience on the page, white cards floating on it;
     - charts drawn inline in C# (Services/Svg.cs), so still no CDN, no charting
       library and no JavaScript needed to paint them;
     - semantic colour is unchanged - green good, amber attention, red problem.
       The gradients are decoration only and never replace the band meaning.
   ============================================================================ */

.dashboard-page {
    --dash-ink: #0f172a;
    --dash-muted: #64748b;
    --dash-line: #e7ecf4;
    --dash-card-radius: 18px;
    --dash-shadow: 0 14px 34px -26px rgba(15, 23, 42, .38), 0 1px 2px rgba(15, 23, 42, .03);
    min-height: calc(100vh - var(--topbar-h));
    padding: 1.1rem 1.15rem 1.6rem;
    color: var(--dash-ink);
    background:
        radial-gradient(900px 420px at 100% 0%, rgba(99, 102, 241, .09), transparent 62%),
        radial-gradient(760px 400px at 0% 14%, rgba(6, 182, 212, .07), transparent 62%),
        #f5f7fb;
}

.dashboard-page .dash-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dash-head-copy { min-width: 0; }

.dash-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .32rem;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: #6366f1;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    flex: none;
    animation: dashPulse 2.4s ease-out infinite;
}

@keyframes dashPulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
    70%  { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.dashboard-page .dash-title {
    margin: 0;
    font-size: 1.9rem;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -.035em;
    color: #0b1220;
}

.dashboard-page .dash-sub {
    margin: .28rem 0 0;
    font-size: .8rem;
    color: var(--dash-muted);
}

.dashboard-page .dash-head-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.dashboard-page .pill {
    display: inline-flex;
    align-items: center;
    gap: .34rem;
    padding: .38rem .68rem;
    border: 1px solid var(--dash-line);
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: .7rem;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.dashboard-page .pill-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}

.dashboard-page .pill-danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.pill-icon { width: 13px; height: 13px; flex: none; }

/* ------------------------------------------------------------- KPI strip --- */

.dashboard-page .kpi-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .8rem;
    margin-bottom: .9rem;
}

.dashboard-page .kpi {
    /* Grow into the row so a wrapped line never leaves a card-sized hole at its end. */
    flex: 1 1 auto;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 132px;
    padding: .85rem .9rem .8rem;
    border: 1px solid var(--dash-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--dash-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-page .kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px -26px rgba(15, 23, 42, .45), 0 1px 2px rgba(15, 23, 42, .03);
}

.kpi-top {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex: none;
}

.kpi-icon svg { width: 16px; height: 16px; }

.ki-blue   { background: #eff6ff; color: #2563eb; }
.ki-amber  { background: #fffbeb; color: #d97706; }
.ki-cyan   { background: #ecfeff; color: #0891b2; }
.ki-violet { background: #f5f3ff; color: #7c3aed; }

.dashboard-page .kpi-label {
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
    color: #667085;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-page .kpi-value {
    display: flex;
    align-items: baseline;
    gap: .08rem;
    margin-top: auto;
    padding-top: .7rem;
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
    color: #0b1220;
}

.dashboard-page .kpi.kpi-good .kpi-value { color: #15803d; }
.dashboard-page .kpi.kpi-warn .kpi-value { color: #b45309; }
.dashboard-page .kpi.kpi-bad  .kpi-value { color: #be123c; }

.dashboard-page .kpi-unit {
    margin-left: .06rem;
    font-size: .92rem;
    font-weight: 700;
    color: #94a3b8;
}

.dashboard-page .kpi-foot {
    margin-top: .2rem;
    font-size: .66rem;
    color: #7c8aa0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------- timetable band --- */

.dashboard-page .tt-band { margin-bottom: .9rem; }

.tt-band-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 0 .15rem .55rem;
}

.tt-band-title {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #667085;
}

.tt-band-title svg { width: 15px; height: 15px; color: #6366f1; }

.tt-band-sub { font-size: .72rem; font-weight: 600; color: #94a3b8; }

/* Fixed-width cards rather than full-width tracks: with one timetable in use, a card
   stretched across the page would read as a banner instead of one of a set. */
.tt-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
}

.tt-card {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 240px;
    max-width: 420px;
    min-width: 0;
    padding: .8rem .9rem .75rem;
    border: 1px solid var(--dash-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--dash-shadow);
}

.tt-card-top {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.tt-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #eef2ff;
    color: #4f46e5;
    flex: none;
}

.tt-card-icon svg { width: 16px; height: 16px; }

.tt-card-head {
    display: flex;
    flex-direction: column;
    gap: .08rem;
    flex: 1 1 auto;
    min-width: 0;
}

.tt-card-name {
    font-size: .98rem;
    font-weight: 800;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tt-card-sub {
    font-size: .68rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tt-card-pct {
    flex: none;
    align-self: flex-start;
    font-size: .95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tt-card.kpi-good .tt-card-pct { color: #15803d; }
.tt-card.kpi-warn .tt-card-pct { color: #b45309; }
.tt-card.kpi-bad  .tt-card-pct { color: #be123c; }

.tt-card-value {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    margin-top: .55rem;
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
    color: #0b1220;
}

.tt-card-value span {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #94a3b8;
}

.tt-bar {
    height: 6px;
    margin-top: .6rem;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.tt-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width .45s ease;
}

.tt-fill.kpi-good { background: linear-gradient(90deg, #34d399, #059669); }
.tt-fill.kpi-warn { background: linear-gradient(90deg, #fbbf24, #d97706); }
.tt-fill.kpi-bad  { background: linear-gradient(90deg, #fb7185, #dc2626); }

.tt-card-foot {
    margin-top: .5rem;
    font-size: .72rem;
    color: #7c8aa0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tt-card-foot b { color: #344054; font-weight: 800; }
.tt-card-foot i { font-style: normal; margin: 0 .1rem; color: #cbd5e1; }

.tt-card.is-unassigned .tt-card-icon { background: #f1f5f9; color: #94a3b8; }
.tt-card.is-unassigned .tt-card-name { font-weight: 700; color: #64748b; }

/* The rate tile is the focal point. Deep indigo -> cyan reads as the product's
   brand rather than as a status, so a bad morning does not paint the wall red;
   the gauge arc inside carries the actual green/amber/red meaning. */

.dashboard-page .kpi.kpi-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.05rem 1rem 1.15rem;
    border: 0;
    color: #fff;
    background:
        radial-gradient(260px 180px at 100% 0%, rgba(6, 182, 212, .38), transparent 66%),
        radial-gradient(320px 220px at 0% 110%, rgba(139, 92, 246, .42), transparent 66%),
        linear-gradient(135deg, #312e81 0%, #4338ca 52%, #0e7490 100%);
    box-shadow: 0 20px 40px -26px rgba(49, 46, 129, .75);
}

.dashboard-page .kpi.kpi-hero::after {
    content: "";
    position: absolute;
    top: -70px;
    right: -50px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    pointer-events: none;
}

.kpi-hero-copy { position: relative; z-index: 1; min-width: 0; }

.kpi-eyebrow {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
}

.kpi-hero .pulse-dot { background: #5eead4; }

.kpi-hero-summary {
    margin: .38rem 0 .5rem;
    font-size: .92rem;
    font-weight: 700;
    color: #fff;
}

.hero-delta {
    display: inline-flex;
    align-items: center;
    gap: .26rem;
    padding: .24rem .5rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .11);
    font-size: .62rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .78);
    white-space: nowrap;
}

.hero-delta b { color: #fff; font-size: .68rem; font-weight: 800; }

.delta-arrow {
    width: 11px;
    height: 11px;
    color: #5eead4;
    flex: none;
    transition: transform .2s ease;
}

.hero-delta.is-down .delta-arrow { color: #fda4af; transform: rotate(180deg); }
.hero-delta.is-flat .delta-arrow { display: none; }

.kpi-hero-foot {
    margin-top: .5rem;
    font-size: .62rem;
    color: rgba(255, 255, 255, .58);
}

.kpi-hero-gauge {
    position: relative;
    z-index: 1;
    flex: none;
    filter: drop-shadow(0 10px 18px rgba(2, 6, 23, .3));
}

.kpi-hero-gauge svg { display: block; }

/* --------------------------------------------------------------- cards --- */

.dashboard-page .dash-grid { gap: .85rem; }

.dashboard-page .dash-card {
    border: 1px solid var(--dash-line);
    border-radius: var(--dash-card-radius);
    background: #fff;
    box-shadow: var(--dash-shadow);
    overflow: hidden;
}

.dashboard-page .dash-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    flex-wrap: wrap;
    padding: .72rem .85rem;
    background: #fff;
    border-bottom: 1px solid #f0f3f8;
    border-radius: 0;
}

.card-head-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}

.card-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex: none;
}

.card-head-icon svg { width: 16px; height: 16px; }

.hi-indigo  { background: #eef2ff; color: #4f46e5; }
.hi-emerald { background: #ecfdf5; color: #059669; }
.hi-amber   { background: #fffbeb; color: #d97706; }
.hi-sky     { background: #f0f9ff; color: #0284c7; }

.card-head-copy { display: flex; flex-direction: column; min-width: 0; }

.card-title-text {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .83rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: #0f172a;
    white-space: nowrap;
}

.card-sub {
    font-size: .63rem;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-head-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .3rem;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: .22rem;
    padding: .27rem .5rem;
    border: 1px solid #eef2f7;
    border-radius: 999px;
    background: #f8fafc;
    font-size: .61rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.stat-chip b { font-size: .67rem; font-weight: 800; color: #0f172a; }

.stat-chip.is-warn {
    border-color: #fde68a;
    background: #fffbeb;
    color: #b45309;
}
.stat-chip.is-warn b { color: #92400e; }

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 .5rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: .68rem;
    font-weight: 800;
}

.count-pill.is-warn { background: #fff7ed; color: #c2410c; }

/* ---------------------------------------------------------------- trend --- */

.dashboard-page .c-trend > .card-body { padding: 0; }

.dashboard-page .trend {
    padding: .5rem .65rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.dashboard-page .trend-svg {
    display: block;
    width: 100%;
    height: auto;
    /* Below roughly 520px the browser's proportional scaling would shrink the
       axis labels to four or five pixels. A small horizontal scroll inside the
       card is the lesser evil, and it only happens on phones. */
    min-width: 520px;
}

/* The chart container is focusable so a keyboard user can scroll it with the arrow
   keys once the card is too narrow to show the full 14-day axis. */
.dashboard-page .trend:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

.dashboard-page .trend-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .55rem .85rem .8rem;
}

.dashboard-page .trend-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 0;
    font-size: .64rem;
    color: #7c8aa0;
}

.dashboard-page .trend-legend span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}

.dashboard-page .trend-legend i {
    display: inline-block;
    width: 13px;
    height: 4px;
    border-radius: 999px;
    flex: none;
}

.lg-line { background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4); }
.lg-avg { background: repeating-linear-gradient(90deg, #a78bfa 0 3px, transparent 3px 6px); height: 3px !important; }

.dashboard-page .trend-legend .lg-weekend,
.dashboard-page .trend-legend .lg-nodata {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.lg-weekend { background: #eef2f7; }
.lg-nodata { background: repeating-linear-gradient(45deg, #dfe6ef 0 2px, #f8fafc 2px 4px); }

.quality-chips {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
}

.quality {
    display: inline-flex;
    align-items: baseline;
    gap: .24rem;
    padding: .24rem .48rem;
    border-radius: 999px;
    font-size: .6rem;
    font-weight: 600;
    white-space: nowrap;
}

.quality b { font-size: .66rem; font-weight: 800; }
.q-good { background: #ecfdf5; color: #047857; }
.q-good b { color: #065f46; }
.q-warn { background: #fffbeb; color: #b45309; }
.q-warn b { color: #92400e; }
.q-bad { background: #fef2f2; color: #b91c1c; }
.q-bad b { color: #991b1b; }

/* ---------------------------------------------------------- departments --- */

.dashboard-page .dept-list {
    max-height: 336px;
    overflow-y: auto;
    padding: .2rem 0;
}

.dashboard-page .dept {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .52rem .85rem;
    border-bottom: 1px solid #f3f6fa;
    font-size: .76rem;
}

.dashboard-page .dept:last-child { border-bottom: 0; }

.dept-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid #eef2f7;
    border-radius: 7px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: .6rem;
    font-weight: 800;
    flex: none;
}

.dashboard-page .dept:first-child .dept-rank {
    border-color: #fde68a;
    background: #fffbeb;
    color: #b45309;
}

.dept-body { flex: 1 1 auto; min-width: 0; }

.dept-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    gap: .5rem;
}

.dashboard-page .dept-name {
    font-size: .75rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-page .dept-num {
    font-size: .62rem;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dashboard-page .dept-num b { color: #344054; font-weight: 800; }

.dashboard-page .dept-pct {
    min-width: 3.2em;
    text-align: right;
    font-size: .68rem;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dashboard-page .dept-pct.kpi-good { color: #15803d; }
.dashboard-page .dept-pct.kpi-warn { color: #b45309; }
.dashboard-page .dept-pct.kpi-bad  { color: #be123c; }

.dept-bar {
    height: 6px;
    margin-top: .36rem;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.dept-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width .45s ease;
}

.dept-fill.kpi-good { background: linear-gradient(90deg, #34d399, #059669); }
.dept-fill.kpi-warn { background: linear-gradient(90deg, #fbbf24, #d97706); }
.dept-fill.kpi-bad  { background: linear-gradient(90deg, #fb7185, #dc2626); }

/* --------------------------------------------------------------- to-do --- */

.dashboard-page .todo-list {
    max-height: 336px;
    overflow-y: auto;
    padding: .2rem 0;
}

.todo {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .52rem .85rem;
    border-bottom: 1px solid #f3f6fa;
}

.todo:last-child { border-bottom: 0; }

.todo-kind {
    flex: none;
    margin-top: .1rem;
    padding: .16rem .4rem;
    border-radius: 6px;
    font-size: .54rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.kind-leave    { background: #f5f3ff; color: #6d28d9; }
.kind-overtime { background: #fff7ed; color: #c2410c; }
.kind-meeting  { background: #ecfeff; color: #0e7490; }
.kind-other    { background: #f1f5f9; color: #475569; }

.todo-copy {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.todo-subject {
    font-size: .74rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-meta {
    font-size: .61rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-meta i { font-style: normal; color: #cbd5e1; margin: 0 .12rem; }

/* ----------------------------------------------------------- real-time --- */

.dashboard-page .dash-card.c-realtime { border-radius: var(--dash-card-radius); }

.dashboard-page .c-realtime .rt-status {
    padding: .27rem .55rem;
    border: 1px solid #eef2f7;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.dashboard-page .c-realtime .rt-status.text-warning-emphasis {
    border-color: #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.dashboard-page .dash-card.c-realtime.border-warning {
    border-color: #fda29b;
    box-shadow: 0 0 0 3px rgba(240, 68, 56, .08), var(--dash-shadow);
}

.dashboard-page .c-realtime .rt {
    padding: .42rem .85rem;
    transition: background .15s ease;
}

.dashboard-page .c-realtime .rt:not(.rt-head):hover { background: #f8fafc; }

.dashboard-page .c-realtime .rt-head {
    padding-top: .45rem;
    padding-bottom: .45rem;
    background: #f8fafc;
}

.dashboard-page .c-realtime .avatar {
    background: linear-gradient(135deg, #e0e7ff, #cffafe);
    color: #3730a3;
    font-weight: 800;
}

.dashboard-page .c-realtime .rt-state {
    padding: .16rem .45rem;
    border-radius: 999px;
    font-size: .62rem;
}

.dashboard-page .c-realtime .state-in    { background: #dcfce7; }
.dashboard-page .c-realtime .state-out   { background: #ffe4e6; }
.dashboard-page .c-realtime .state-break { background: #fef3c7; }
.dashboard-page .c-realtime .state-ot    { background: #ede9fe; }
.dashboard-page .c-realtime .state-other { background: #e2e8f0; }

/* ------------------------------------------------------------ VIP tabs --- */

.dashboard-page .vip-tabs {
    display: inline-flex;
    gap: .2rem;
    margin: 0 0 1rem;
    padding: .24rem;
    border: 1px solid var(--dash-line);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 18px -16px rgba(15, 23, 42, .4);
}

.dashboard-page .vip-tabs .nav-item { display: flex; }

.dashboard-page .vip-tabs .nav-link {
    padding: .38rem .9rem;
    border: 0;
    border-radius: 999px;
    color: #64748b;
    font-size: .76rem;
    font-weight: 700;
}

.dashboard-page .vip-tabs .nav-link:hover { background: #f1f5f9; color: #0f172a; }

.dashboard-page .vip-tabs .nav-link.active {
    background: #0f172a;
    color: #fff;
    box-shadow: none;
}

.dashboard-page .vip-tabs .nav-link.vip-tab.active {
    background: linear-gradient(135deg, #78350f, #b45309);
    color: #fff7ed;
    box-shadow: none;
}

.dashboard-page .vip-tab-count {
    background: rgba(255, 255, 255, .18);
    color: inherit;
}

/* -------------------------------------------------------------- responsive */


/* Three columns stop paying for themselves once the trend card drops under roughly
   600px: its 14 day labels get cramped, and the pinned monitor column is left too
   narrow for its seven tracks. The monitor needs about 485px before its fixed
   columns and the scrollbar fit, which happens at roughly 1420px of viewport, so
   the two-column layout starts at 1440. The monitor also returns to normal flow at
   full width - the same treatment the base grid already applies at 1200px, moved
   up so it arrives before the squeeze rather than after. */
/* The rail holds 470px rather than following the viewport: below that the monitor's fixed
   columns (id, status, time) and the elastic name no longer fit without clipping. */
@media (max-width: 1440px) {
    .dashboard-page .dash-layout { grid-template-columns: minmax(0, 1fr) 470px; }
}

/* Below 1340px the rail leaves too little beside it for the hero to keep its gauge inline, so
   the monitor drops beneath the cards and returns to its 470px list cap. */
@media (max-width: 1340px) {
    .dashboard-page .dash-layout { grid-template-columns: minmax(0, 1fr); }
    .dashboard-page .dash-side { position: static; }
    .dashboard-page .dash-card.c-realtime { max-height: none; min-height: 0; }
    .dashboard-page .c-realtime .rt-list { max-height: 470px; }
}

@media (max-width: 767.98px) {
    .dashboard-page { padding: .85rem .7rem 1.2rem; }
    .dashboard-page .dash-title { font-size: 1.55rem; }
    /* The base sheet already drops to one column here, but this modern sheet is
       loaded later and its 1440px two-column rule is more specific, so the
       collapse has to be restated or phones keep a two-column dashboard. */
    .dashboard-page .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-page .kpi { min-height: 122px; }

    /* The punch grid is intrinsically wider than a phone. Scrolling it is
       better than dropping columns: a monitor that hides the department or the
       time is no longer the same monitor. */
    .dashboard-page .c-realtime .rt-list { overflow-x: auto; }
    .dashboard-page .c-realtime .rt { min-width: 520px; }
}

@media (max-width: 480px) {
    .dashboard-page .kpi-hero-gauge svg { width: 88px; height: 88px; }
    .dashboard-page .card-head-meta { width: 100%; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-page *,
    .dashboard-page *::before,
    .dashboard-page *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Larger summary-card typography, scoped to the dashboard KPI strip. */
.dashboard-page .kpi-strip .kpi-label { font-size: 1.32rem; white-space: normal; }
.dashboard-page .kpi-strip .kpi-value { font-size: 4rem; }
.dashboard-page .kpi-strip .kpi-unit { font-size: 1.84rem; }
.dashboard-page .kpi-strip .kpi-foot { font-size: 1.32rem; white-space: normal; }
.dashboard-page .kpi-strip .kpi-eyebrow { font-size: 1.24rem; }
.dashboard-page .kpi-strip .kpi-hero-summary { font-size: 1.6rem; }
.dashboard-page .kpi-strip .hero-delta { font-size: 1.24rem; white-space: normal; }
.dashboard-page .kpi-strip .hero-delta b { font-size: 1.36rem; }
.dashboard-page .kpi-strip .kpi-hero-foot { font-size: 1.24rem; }
/* 190px rather than 224: the hero now shares its row with the monitor rail, and at the
   narrower main-column width the larger gauge forced every other KPI card onto its own row. */
.dashboard-page .kpi-strip .kpi-hero-gauge svg { width: 190px; height: 190px; }
.dashboard-page .kpi-strip .kpi-hero { flex-wrap: wrap; }

/* The rail takes roughly 490px off the main column. Between 1341 and 1440 that is enough to
   push the hero's gauge onto a second line and double the tile's height, so summary and gauge
   are tightened for that band only - above 1440 the column is wide enough for the full sizes. */
@media (min-width: 1341px) and (max-width: 1440px) {
    .dashboard-page .kpi-strip .kpi-hero-summary { font-size: 1.45rem; }
    .dashboard-page .kpi-strip .kpi-hero-gauge svg { width: 165px; height: 165px; }
}
/* Keep dashboard metadata aligned after removing the introductory heading. */
.dashboard-page .dash-head { justify-content: flex-end; }
.dashboard-page .dash-head-copy { display: none; }
