/* The admin dashboard (templates/admin_desk.html): a calm light page, or
   the Black Iris dark one, chosen with the sun/moon button. */

:root {
    --d-bg: #F3F4F6;
    --d-card: #FFFFFF;
    --d-ink: #14161C;
    --d-text: #1C1F26;
    --d-muted: #6B7080;
    --d-line: rgba(0, 0, 0, .08);
    --d-soft: rgba(0, 0, 0, .04);
    --d-track: #E8EAEE;
    --d-green: #2F8A3E;
    --d-green-text: #0B7A37;
    --d-green-tint: rgba(63, 161, 68, .13);
    --d-amber: #A86A12;
    --d-amber-tint: rgba(240, 170, 60, .18);
    --d-red: #A8402F;
    --d-red-tint: rgba(194, 65, 44, .11);
    --d-blue: #185FA5;
    --d-blue-tint: rgba(55, 138, 221, .13);
    --d-seg: #14161C;
    --d-on-seg: #FFFFFF;
    --d-series-1: #2F8A3E;
    --d-series-2: #378ADD;
    --d-series-3: #BA7517;
    --d-series-4: #888780;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --d-bg: #080813;
    /* A step lighter than the ground, so cards stand off the page even
       where a shadow can't show on black. */
    --d-card: #161622;
    --d-ink: #ECEEF2;
    --d-text: #E2E4EA;
    --d-muted: #8E93A0;
    --d-line: rgba(255, 255, 255, .09);
    --d-soft: rgba(255, 255, 255, .05);
    --d-track: rgba(255, 255, 255, .08);
    --d-green: #348C48;
    --d-green-text: #8FD694;
    --d-green-tint: rgba(63, 161, 68, .2);
    --d-amber: #F0B45A;
    --d-amber-tint: rgba(240, 170, 60, .16);
    --d-red: #FFB1AA;
    --d-red-tint: rgba(214, 71, 63, .2);
    --d-blue: #8EC5F5;
    --d-blue-tint: rgba(59, 139, 212, .2);
    --d-seg: #ECEEF2;
    --d-on-seg: #080813;
    --d-series-1: #6FB642;
    --d-series-2: #85B7EB;
    --d-series-3: #EF9F27;
    --d-series-4: #8E93A0;
    color-scheme: dark;
}

/* The circle reveal does the work; no cross-fade underneath it. */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

body.desk-page {
    margin: 0;
    background: var(--d-bg);
    color: var(--d-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
.desk-page a { color: inherit; text-decoration: none; }
.desk-page button, .desk-page input { font: inherit; color: inherit; }

.desk { max-width: 1440px; margin: 0 auto; padding: 14px 16px 32px; }

.d-card {
    background: var(--d-card);
    border: 1px solid var(--d-line);
    border-radius: 16px;
    padding: 16px;
    min-width: 0;
}
.d-muted { color: var(--d-muted); }
.d-small { font-size: 12px; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.d-top {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 14px;
}
.d-brand { display: flex; align-items: center; gap: 10px; }
.d-brand img { height: 30px; display: block; }
.d-brand .logo-dark { display: none; }
:root:not([data-theme="dark"]) .d-brand .logo-white { display: none; }
:root:not([data-theme="dark"]) .d-brand .logo-dark { display: block; }

.d-seg {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--d-soft); border-radius: 999px;
}
.d-seg button {
    border: 0; background: transparent; cursor: pointer;
    padding: 7px 16px; border-radius: 999px; color: var(--d-muted); font-weight: 500;
}
.d-seg button[aria-selected="true"] { background: var(--d-seg); color: var(--d-on-seg); }

.d-spacer { flex: 1; }
.d-search {
    display: flex; align-items: center; gap: 6px;
    border: 1px solid var(--d-line); border-radius: 999px; padding: 6px 12px;
    color: var(--d-muted); width: 200px;
}
.d-search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--d-text); }
.d-icon-btn {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--d-line); background: transparent; color: var(--d-muted); cursor: pointer;
}
.d-icon-btn:hover { color: var(--d-ink); }
.d-new { position: relative; }
.d-new summary {
    list-style: none; cursor: pointer;
    background: var(--d-green); color: #fff; border-radius: 999px;
    padding: 8px 14px; font-weight: 500; display: flex; align-items: center; gap: 4px;
}
.d-new summary::-webkit-details-marker { display: none; }
.d-new .menu {
    position: absolute; right: 0; top: 42px; z-index: 5; min-width: 180px;
    background: var(--d-card); border: 1px solid var(--d-line); border-radius: 12px; padding: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.d-new .menu a { display: block; padding: 8px 10px; border-radius: 8px; }
.d-new .menu a:hover { background: var(--d-soft); }
.d-hello { line-height: 1.15; font-size: 12px; color: var(--d-muted); }
.d-hello b { display: block; color: var(--d-ink); font-weight: 600; font-size: 13px; }

:root[data-theme="dark"] .if-light, :root:not([data-theme="dark"]) .if-dark { display: none; }
.if-light, .if-dark { display: inline-flex; }

.flashes { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--d-line); background: var(--d-card); }
.flash-success { background: var(--d-green-tint); color: var(--d-green-text); }
.flash-warn { background: var(--d-amber-tint); color: var(--d-amber); }
.flash-error { background: var(--d-red-tint); color: var(--d-red); }

/* ── Rail and main ───────────────────────────────────────────────────── */
.d-body { display: flex; gap: 14px; align-items: flex-start; }
.d-rail {
    display: flex; flex-direction: column; gap: 4px; padding: 8px 6px;
    position: sticky; top: 14px;
}
.d-rail a {
    position: relative; width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; color: var(--d-muted);
}
.d-rail a:hover { background: var(--d-soft); color: var(--d-ink); }
.d-rail a.on { background: var(--d-green); color: #fff; }
.d-rail .badge {
    position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 3px;
    border-radius: 999px; background: #C2412C; color: #fff; font-size: 9.5px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; box-sizing: border-box;
}
.d-rail hr { border: 0; border-top: 1px solid var(--d-line); margin: 4px 6px; }
.d-main { flex: 1; min-width: 0; }

.d-head { display: flex; align-items: flex-end; gap: 8px; margin: 2px 0 12px; flex-wrap: wrap; }
.d-head h1 { font-size: 24px; font-weight: 600; margin: 2px 0 0; color: var(--d-ink); letter-spacing: -.3px; }
.d-chip {
    border: 1px solid var(--d-line); background: transparent; border-radius: 999px;
    padding: 6px 12px; color: var(--d-muted); cursor: pointer; font-size: 12.5px;
    display: inline-flex; align-items: center; gap: 6px;
}
.d-chip.on, .d-chip[aria-pressed="true"] { background: var(--d-card); color: var(--d-ink); }
a.d-chip:hover { color: var(--d-ink); }

/* ── Stat cards ──────────────────────────────────────────────────────── */
.d-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.d-stat .label { display: flex; align-items: center; gap: 8px; color: var(--d-muted); font-size: 12.5px; }
.d-stat .label span.ic {
    width: 26px; height: 26px; border-radius: 8px; background: var(--d-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.d-stat .num { font-size: 24px; font-weight: 600; color: var(--d-ink); margin-top: 10px; letter-spacing: -.3px; }
.d-stat .num small { font-size: 13px; font-weight: 400; color: var(--d-muted); }
.d-stat .num.warn { color: var(--d-amber); }
.d-stat .num.bad { color: var(--d-red); }
.d-delta {
    font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 6px; margin-left: 6px;
    vertical-align: middle; background: var(--d-green-tint); color: var(--d-green-text);
}
.d-delta.down { background: var(--d-red-tint); color: var(--d-red); }

/* ── Two-column panels ───────────────────────────────────────────────── */
.d-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 12px; }
.d-card h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--d-ink); }
.d-card .sub { color: var(--d-muted); font-size: 12px; margin: 2px 0 12px; }
.d-card-head { display: flex; align-items: flex-start; gap: 8px; }

.d-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--d-muted); }
.d-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
/* A fixed height, so opening everyone's hours beside it never stretches it. */
.d-chart { position: relative; height: 340px; margin-top: 6px; }
#panel-overview .d-grid { align-items: start; }
.d-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.d-chart .tip {
    position: absolute; pointer-events: none; background: var(--d-card); border: 1px solid var(--d-line);
    border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
    white-space: nowrap; display: none;
}

.d-rank { list-style: none; margin: 0; padding: 0; }
.d-rank li { padding: 9px 0; border-top: 1px solid var(--d-line); }
.d-rank li:first-child { border-top: 0; }
.d-rank .top { display: flex; align-items: center; gap: 10px; }
.d-rank .n {
    width: 22px; height: 22px; border-radius: 50%; background: var(--d-soft); color: var(--d-muted);
    font-size: 11px; display: flex; align-items: center; justify-content: center; flex: none;
}
.d-rank li:first-child .n { background: var(--d-green); color: #fff; }
.d-rank .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-rank .val { font-weight: 600; color: var(--d-ink); }
.d-bar { height: 6px; border-radius: 9px; background: var(--d-track); margin: 7px 0 0 32px; overflow: hidden; }
.d-bar div { height: 100%; border-radius: 9px; background: var(--d-green); }
.d-bar.warn div { background: var(--d-amber); }
.d-bar.full div { background: #C2412C; }

/* ── Rows ────────────────────────────────────────────────────────────── */
.d-rows { list-style: none; margin: 0; padding: 0; }
.d-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--d-line); }
.d-rows .d-row:first-child { border-top: 0; }
.d-av {
    width: 32px; height: 32px; border-radius: 50%; flex: none; font-size: 12px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    background: var(--d-green-tint); color: var(--d-green-text);
}
.d-row .who { flex: 1; min-width: 0; }
.d-row .who b { font-weight: 500; color: var(--d-ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-row .who span { color: var(--d-muted); font-size: 12px; }
.d-row .t { width: 64px; text-align: right; color: var(--d-muted); font-variant-numeric: tabular-nums; }
.d-row .h { width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.d-row .code { font-weight: 600; color: var(--d-ink); width: 70px; }
.d-row form { margin: 0; display: inline; }

.d-tag { font-size: 11.5px; font-weight: 500; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.d-tag.in, .d-tag.Approved { background: var(--d-green-tint); color: var(--d-green-text); }
.d-tag.out, .d-tag.not_in, .d-tag.Closed, .d-tag.Cancelled { background: var(--d-soft); color: var(--d-muted); }
.d-tag.leave, .d-tag.Receipt { background: var(--d-blue-tint); color: var(--d-blue); }
.d-tag.long, .d-tag.Rejected { background: var(--d-red-tint); color: var(--d-red); }
.d-tag.Open { background: var(--d-amber-tint); color: var(--d-amber); }

.d-btn {
    border: 1px solid var(--d-line); background: transparent; border-radius: 999px;
    padding: 5px 12px; font-size: 12px; cursor: pointer; color: var(--d-text);
}
.d-btn:hover { background: var(--d-soft); }
.d-btn.ok { background: var(--d-green); border-color: var(--d-green); color: #fff; }
.d-btn.ok:hover { filter: brightness(1.08); }

.d-empty { color: var(--d-muted); padding: 18px 0; text-align: center; }
.d-more { display: block; text-align: center; padding-top: 10px; color: var(--d-green-text); font-size: 12.5px; }

/* Anything hidden stays hidden, whatever display its class gives it
   (the People search and department filter rely on this). */
.desk-page [hidden] { display: none !important; }

.d-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.d-note {
    display: inline-flex !important; align-items: center; gap: 4px; margin-top: 4px;
    font-size: 11.5px !important; font-weight: 500; color: var(--d-red) !important;
    background: var(--d-red-tint); border-radius: 999px; padding: 2px 8px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.d-row .who .d-note { display: inline-flex; }
button.d-more { border: 0; background: transparent; width: 100%; cursor: pointer; font: inherit; font-size: 12.5px; }
a.d-btn { display: inline-block; white-space: nowrap; }
a.d-stat { color: inherit; }

/* ── Ask Hafa and the install prompt, in this page's colours ─────────── */
body.desk-page {
    --primary: var(--d-green);
    --primary-edge: transparent;
    --primary-hover: var(--d-green);
    --green-tint: var(--d-green-tint);
    --border: var(--d-line);
    --danger-tint: var(--d-red-tint);
    --danger-text: var(--d-red);
    --ink: var(--d-ink);
    --muted: var(--d-muted);
}
.desk { padding-bottom: 96px; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hafa-launcher {
    position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 60;
    display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 12px;
    border-radius: 999px; background: var(--d-green); color: #fff; font-weight: 600; font-size: 14px;
    border: 0; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.hafa-launcher .leaf, .hafa-head .leaf {
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .18);
    display: grid; place-items: center;
}
.hafa-panel {
    position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 61;
    width: min(340px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 40px));
    background: var(--d-card); border: 1px solid var(--d-line); border-radius: 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    display: none; flex-direction: column; overflow: hidden;
}
.hafa-panel[open], .hafa-panel.is-open { display: flex; }
.hafa-head {
    background: var(--d-green); color: #fff; padding: 12px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hafa-head .who { display: flex; align-items: center; gap: 10px; }
.hafa-head .name { font-weight: 600; line-height: 1.1; }
.hafa-head .role { font-size: 12px; opacity: .9; }
.hafa-close { background: transparent; border: 0; color: #fff; padding: 4px; border-radius: 6px; cursor: pointer; display: flex; }
.hafa-close:hover { background: rgba(255, 255, 255, .16); }
.hafa-body { padding: 14px; overflow-y: auto; font-size: 13.5px; }
.hafa-bubble {
    background: var(--d-soft); border: 1px solid var(--d-line); border-radius: 12px 12px 12px 4px;
    padding: 10px 12px; color: var(--d-ink); margin-bottom: 10px;
}
.hafa-foot { border-top: 1px solid var(--d-line); padding: 10px; }
.hafa-foot input {
    flex: 1; border: 1px solid var(--d-line); border-radius: 999px; padding: 8px 12px;
    background: var(--d-soft); color: var(--d-text); outline: 0;
}
.hafa-foot .note { font-size: 12px; color: var(--d-muted); margin: 8px 2px 0; }

.install-card {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
    background: var(--d-card); border: 1px solid var(--d-line); border-radius: 16px; padding: 12px 16px;
}
.install-icon img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.install-text { flex: 1 1 220px; }
.install-text strong { display: block; color: var(--d-ink); font-weight: 600; }
.install-text p { margin: 2px 0 0; color: var(--d-muted); font-size: 13px; }
.install-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.install-actions button {
    border: 1px solid var(--d-green); background: var(--d-green); color: #fff;
    border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.install-actions button.btn-secondary { background: transparent; color: var(--d-text); border-color: var(--d-line); }
@media (max-width: 600px) {
    .hafa-launcher, .hafa-panel { right: 14px; bottom: calc(50px + env(safe-area-inset-bottom, 0px)); }
}

/* ── Narrow screens: one column, the rail across the top ─────────────── */
@media (max-width: 1100px) {
    .d-search { display: none; }
}
@media (max-width: 900px) {
    .d-grid { grid-template-columns: minmax(0, 1fr); }
    .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .d-body { flex-direction: column; }
    .d-rail { flex-direction: row; position: static; overflow-x: auto; width: 100%; box-sizing: border-box; }
    .d-rail a { flex: none; }
    .d-rail hr { display: none; }
    .d-hello { display: none; }
}
@media (max-width: 600px) {
    .desk { padding: 10px 10px 24px; }
    .d-top { flex-wrap: wrap; }
    .d-top .d-seg { order: 5; width: 100%; }
    .d-top .d-seg button { flex: 1; padding: 7px 0; }
    .d-row .t { display: none; }
    .d-row { flex-wrap: wrap; row-gap: 8px; }
    .d-row .who { flex: 1 1 calc(100% - 52px); }
    #people-list .d-row .h { width: auto; text-align: left; margin-left: 44px; margin-right: auto; }
    .d-row .code { width: auto; }
    .d-brand img { height: 24px; }
    .d-top { gap: 6px; }
    .d-icon-btn { width: 34px; height: 34px; }
    .d-new summary { padding: 8px 10px; }
    .d-new summary .lbl { display: none; }
}
.desk-page .hafa-bubble--assistant { background: var(--d-soft); }

/* ── The bubble look: raised cards on a plain ground ─────────────
   Depth comes from soft shadows, not outlines; the top bar and the rail
   float as frosted pills over the page. */
:root {
    --d-ground: #F1F3F5;
    --d-raise: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -6px rgba(16, 24, 40, .09);
    --d-raise-hover: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 36px -8px rgba(16, 24, 40, .14);
    --d-rim: rgba(255, 255, 255, .9);
    --d-frost: rgba(255, 255, 255, .72);
}
:root[data-theme="dark"] {
    --d-ground: #06060D;
    /* In the dark a faint light edge along the top does what the shadow does
       in light mode: it lifts the card. */
    --d-raise: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .4), 0 14px 32px -10px rgba(0, 0, 0, .7);
    --d-raise-hover: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 4px rgba(0, 0, 0, .45), 0 20px 44px -12px rgba(0, 0, 0, .8);
    --d-rim: rgba(255, 255, 255, .09);
    --d-frost: rgba(20, 20, 32, .72);
}
body.desk-page { background: var(--d-ground); background-attachment: fixed; }

.d-card {
    border: 1px solid var(--d-rim);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--d-raise);
}
a.d-card, .d-rank a.top, .d-rows a.who { transition: box-shadow .2s ease, transform .2s ease; }
a.d-card:hover { box-shadow: var(--d-raise-hover); transform: translateY(-1px); }

/* Frosted, floating chrome */
.d-top, .d-rail {
    background: var(--d-frost);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
}
.d-top { border-radius: 999px; padding: 8px 10px 8px 18px; position: sticky; top: 12px; z-index: 20; }
.d-rail { border-radius: 999px; padding: 10px 7px; top: 92px; }
.d-rail a { border-radius: 50%; }
.d-rail a.on { box-shadow: 0 6px 14px -4px rgba(47, 138, 62, .55); }

/* Pill controls with a little lift */
.d-seg { background: var(--d-soft); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06); padding: 4px; }
.d-seg button[aria-selected="true"] { box-shadow: 0 4px 12px -4px rgba(16, 24, 40, .35); }
.d-icon-btn, .d-search { background: var(--d-card); border-color: var(--d-rim); box-shadow: var(--d-raise); }
.d-new summary { box-shadow: 0 8px 18px -6px rgba(47, 138, 62, .6); }
.d-chip { background: var(--d-card); border-color: var(--d-rim); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.d-chip[aria-pressed="true"], .d-chip.on { background: var(--d-seg); color: var(--d-on-seg); }

/* Stat cards: the icon sits in a soft green bubble, the number reads big */
.d-stat .label span.ic {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--d-green-tint); color: var(--d-green-text);
}
.d-stat .num { font-size: 28px; margin-top: 14px; }

/* Rows sit in their own soft bubbles instead of between hairlines */
.d-rows .d-row, .d-rank li {
    border-top: 0; border-radius: 14px; padding: 10px 10px; margin: 0 -10px;
}
.d-rows .d-row:hover, .d-rank li:hover { background: var(--d-soft); }
.d-bar { height: 8px; background: var(--d-track); }
.d-bar div { background: linear-gradient(90deg, #3FA144, #6FB642); }
.d-bar.warn div { background: linear-gradient(90deg, #BA7517, #EF9F27); }
.d-bar.full div { background: linear-gradient(90deg, #A8402F, #E0665E); }
.d-btn { background: var(--d-card); box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.d-btn.ok { box-shadow: 0 6px 14px -6px rgba(47, 138, 62, .7); }
.d-av { box-shadow: inset 0 0 0 1px var(--d-rim); }

.flash { border-radius: 16px; box-shadow: var(--d-raise); border-color: var(--d-rim); }
.install-card { border-radius: 22px; box-shadow: var(--d-raise); border-color: var(--d-rim); }
.hafa-launcher { box-shadow: 0 10px 24px -6px rgba(47, 138, 62, .6); }
.hafa-panel { border-radius: 22px; box-shadow: var(--d-raise-hover); border-color: var(--d-rim); }

@media (max-width: 600px) {
    .d-top { border-radius: 26px; position: static; padding: 10px 12px; }
    .d-rail { border-radius: 22px; padding: 6px; }
    .d-stat .num { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    a.d-card:hover { transform: none; }
}

/* ── The rail opens on hover to show each page's name ────────────────────
   It grows over the page (the negative margin keeps the layout still). */
.d-rail { width: 56px; box-sizing: border-box; overflow: hidden; z-index: 15;
          transition: width .22s ease, margin-right .22s ease, border-radius .22s ease, box-shadow .22s ease; }
.d-rail a { width: 40px; justify-content: flex-start; padding: 0 10.5px; gap: 12px; border-radius: 999px;
            white-space: nowrap; flex: none; box-sizing: border-box; overflow: hidden;
            transition: width .22s ease, background .15s ease; }
.d-rail a svg { flex: none; }
.d-rail .lbl { font-size: 13.5px; font-weight: 500; opacity: 0; transition: opacity .15s ease; }
.d-rail .badge { left: 25px; right: auto; top: 3px; }
@media (hover: hover) and (min-width: 901px) {
    .d-rail:hover, .d-rail:focus-within {
        width: 212px; margin-right: -156px; border-radius: 26px; box-shadow: var(--d-raise-hover);
    }
    .d-rail:hover a, .d-rail:focus-within a { width: 100%; }
    .d-rail:hover .lbl, .d-rail:focus-within .lbl { opacity: 1; transition-delay: .06s; }
}
@media (max-width: 900px) {
    .d-rail { width: 100%; }
    .d-rail a { padding: 0; width: 40px; justify-content: center; }
    .d-rail .lbl { display: none; }
}

/* Your own clock in the top bar */
.d-clock {
    display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
    border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
    background: var(--d-card); color: var(--d-ink); border: 1px solid var(--d-rim);
    box-shadow: var(--d-raise);
}
.d-clock:hover { box-shadow: var(--d-raise-hover); }
.d-clock.on { background: var(--d-green-tint); color: var(--d-green-text); border-color: transparent; }
.d-clock .dot {
    width: 8px; height: 8px; border-radius: 50%; background: #3FA144;
    box-shadow: 0 0 0 3px rgba(63, 161, 68, .22);
}
@media (max-width: 600px) {
    .d-clock { padding: 0 10px; height: 34px; }
    .d-clock .lbl { display: none; }
}

/* The tab pill: one shape that flows between the tabs (see admin_desk.html). */
.d-seg { position: relative; }
.d-seg .ind {
    position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 999px;
    background: var(--d-seg); box-shadow: 0 4px 12px -4px rgba(16, 24, 40, .35);
    z-index: 0; pointer-events: none; transform-origin: center;
}
.d-seg button { position: relative; z-index: 1; transition: color .3s ease; }
.d-seg button[aria-selected="true"] { background: transparent; box-shadow: none; }
