/* The admin header, two rows (#441 follow-up, chosen from the proposal page):
 *   row one  — the page: title, subtitle, the page's own controls, then the
 *              window dropdown, the update widget and who is signed in
 *   row two  — the desks as tabs with their count in the window, the setup
 *              pages to the right in a quieter tone
 * header.js fills the slot and appends the tabs; pages keep their <h1> and
 * whatever else belongs on row one. Colours come from each page's tokens. */

header.ah { display: block; padding: 0; margin: 0 0 16px; }
header.ah .ah-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 10px 0 8px; }
header.ah .ah-row h1 { font-size: 18px; font-weight: 650; margin: 0; white-space: nowrap; }
header.ah .ah-row .sub { color: var(--muted); font-size: 12.5px; }
header.ah .ah-row .spacer { flex: 1; }
header.ah .ah-slot { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* row two — tabs */
header.ah .ah-tabs { display: flex; align-items: flex-end; gap: 2px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
header.ah .ah-tabs::-webkit-scrollbar { display: none; }
header.ah .ah-tabs a { padding: 7px 10px 8px; font-size: 12.5px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
header.ah .ah-tabs a:hover { color: var(--ink); background: var(--grid, #eef0f2); border-radius: 6px 6px 0 0; }
header.ah .ah-tabs a.on { color: var(--series); font-weight: 600; border-bottom-color: var(--series); }
header.ah .ah-tabs .cut { align-self: center; width: 1px; height: 16px; background: var(--border); margin: 0 6px; flex: none; }
header.ah .ah-tabs .tools { display: inline-flex; gap: 2px; margin-left: auto; }
header.ah .ah-tabs .tools a { color: var(--muted); }
header.ah .ah-tabs .cnt { font-size: 11px; color: var(--muted); margin-left: 5px; font-weight: 500; font-variant-numeric: tabular-nums; }
header.ah .ah-tabs a.on .cnt { color: var(--series); }
header.ah .ah-tabs .badge { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: var(--critical, #b42318); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 16px; text-align: center; }

/* window dropdown (H3) */
.ah-win { position: relative; display: inline-block; }
.ah-win > button { display: inline-flex; align-items: baseline; gap: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font: inherit; font-size: 12.5px; color: var(--ink-2); padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.ah-win > button b { color: var(--series); font-weight: 600; }
.ah-win > button small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ah-win > button .caret { color: var(--muted); font-size: 11px; }
.ah-win > button:hover { background: var(--grid, #eef0f2); }
.ah-win menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 8; margin: 0; padding: 4px; list-style: none; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.ah-win menu li { display: flex; justify-content: space-between; gap: 14px; padding: 6px 9px; border-radius: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.ah-win menu li small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ah-win menu li:hover { background: var(--grid, #eef0f2); }
.ah-win menu li.on { background: var(--series-dim, #e3f2ee); color: var(--series); font-weight: 600; }

/* update widget (J3): refresh · age · auto switch */
.ah-upd { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ah-upd .rf { border: 0; background: transparent; font: inherit; font-size: 14px; line-height: 1; color: var(--ink-2); cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.ah-upd .rf:hover { background: var(--grid, #eef0f2); color: var(--ink); }
.ah-upd .rf.busy { animation: ah-spin .8s linear infinite; }
@keyframes ah-spin { to { transform: rotate(360deg); } }
/* fixed width: "9 s ago" → "10 s ago" must not nudge the switch and the circle */
.ah-upd .age { display: inline-block; min-width: 82px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ah-upd .age.on { color: var(--series); font-weight: 600; }
.ah-upd .age.on::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--series); margin-right: 6px; vertical-align: 1px; animation: ah-pulse 1.6s ease-in-out infinite; }
@keyframes ah-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(14,124,102,.45); } 60% { box-shadow: 0 0 0 5px rgba(14,124,102,0); } }
.ah-upd .age.stale { color: var(--critical, #b42318); }
.ah-sw { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; color: var(--muted); font-size: 12.5px; }
.ah-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.ah-sw i { width: 26px; height: 14px; border-radius: 7px; background: var(--baseline, #cbd2d9); position: relative; transition: background .15s; flex: none; }
.ah-sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ah-sw input:checked + i { background: var(--series); }
.ah-sw input:checked + i::after { left: 14px; }
.ah-sw input:focus-visible + i { outline: 2px solid var(--series); outline-offset: 2px; }

/* who is signed in */
.ah-me { position: relative; display: inline-flex; align-items: center; }
.ah-me .circle { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--series-dim, #e3f2ee); color: var(--series); font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; padding: 0; font-family: inherit; }
.ah-me .circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ah-me .circle:hover { box-shadow: 0 0 0 2px var(--series-dim, #e3f2ee); }
.ah-me .signin { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font: inherit; font-size: 12.5px; color: var(--ink-2); padding: 5px 10px 5px 8px; cursor: pointer; white-space: nowrap; }
.ah-me .signin:hover { background: var(--grid, #eef0f2); color: var(--ink); }
.ah-me .signin svg { width: 15px; height: 15px; display: block; }
.ah-me menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 8; margin: 0; padding: 6px; list-style: none; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); font-size: 12.5px; }
.ah-me menu .who { padding: 6px 9px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ah-me menu .who b { display: block; color: var(--ink); font-weight: 600; }
.ah-me menu .who span { color: var(--muted); font-size: 12px; word-break: break-all; }
.ah-me menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; font-size: 12.5px; color: var(--ink-2); padding: 6px 9px; border-radius: 6px; cursor: pointer; }
.ah-me menu button:hover { background: var(--grid, #eef0f2); color: var(--ink); }
.ah-me .err { color: var(--critical, #b42318); font-size: 12px; padding: 4px 9px; }

@media (prefers-reduced-motion: reduce) { .ah-upd .age.on::before, .ah-upd .rf.busy { animation: none; } }
@media (max-width: 640px) { header.ah .ah-row { gap: 8px; } .ah-win > button small { display: none; } }
