/* Admin console layout. Builds on base.css. */
.app { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; background: var(--surface); }
.s-brand { font-weight: 700; padding: 4px 10px 16px; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.s-brand i { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); display: inline-block; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 14px; text-decoration: none; }
.nav-btn svg { width: 16px; height: 16px; flex: none; }
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-btn .badge { margin-left: auto; font: 600 11px var(--f-mono); background: var(--late); color: var(--on-accent); border-radius: 99px; padding: 1px 7px; }
.side-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 10px; display: grid; gap: 6px; }
.side-foot .live { display: flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 500; }
.side-foot .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: block; animation: blink 2s infinite; }
.side-foot .live.off { color: var(--late); }
.side-foot .live.off i { background: var(--late); animation: none; }
.side-foot .me { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes blink { 50% { opacity: .3; } }

.main { padding: 24px 28px 48px; min-width: 0; max-width: 1280px; }
.pane { display: grid; gap: 20px; align-content: start; }
.m-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.m-head h3 { font-size: 22px; font-weight: 600; }
.m-head p { color: var(--muted); font-size: 13px; }
.m-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.kpi { padding: 14px 16px; display: grid; gap: 2px; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi .k { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .k i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.kpi .v { font: 600 28px/1.15 var(--f-mono); font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.alert .v { color: var(--late); }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.chip b { font: 600 12px var(--f-mono); margin-left: 4px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] b { color: var(--bg); }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 14px; }
.p-card { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 11px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.p-card:hover { border-color: var(--accent); }
.p-card.flash { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink); grid-row: span 2; position: relative; flex: none; }
.av::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--idle); }
.av.s-on::after { background: var(--ok); }
.av.s-break::after { background: var(--warn); }
.av.s-absent::after { background: var(--late); }
.av.plain::after { display: none; }
.p-name { font-weight: 600; font-size: 14px; }
.p-dept { font-size: 12px; color: var(--muted); margin-left: 6px; }
.p-meta { grid-column: 2 / 4; display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.p-meta b { font: 500 12.5px var(--f-mono); color: var(--ink); }

.side-col { display: grid; gap: 20px; }
.exc { list-style: none; margin: 0; padding: 0; }
.exc li { padding: 12px 16px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.exc li:last-child { border-bottom: 0; }
.exc .row { display: flex; align-items: center; gap: 8px; }
.exc .t { font-size: 13.5px; font-weight: 600; }
.exc .d { font-size: 12.5px; color: var(--muted); }
.exc .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.feed { list-style: none; margin: 0; padding: 6px 0; max-height: 360px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 44px 10px 1fr; gap: 8px; align-items: baseline; padding: 7px 16px; font-size: 13px; }
.ev time { font: 500 12px var(--f-mono); color: var(--muted); }
.ev .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); align-self: center; }
.ev .dot.t-in, .ev .dot.t-break_end { background: var(--ok); }
.ev .dot.t-break_start { background: var(--warn); }
.ev .src { grid-column: 3; font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.ev em { font-style: normal; font-size: 12px; }
.ev.is-new { background: var(--accent-soft); animation: fade 3s ease-out forwards; }
@keyframes fade { to { background: transparent; } }

.ts-wrap { overflow-x: auto; }
table.ts { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 13px; }
.ts th, .ts td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.ts th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--surface-2); }
.ts th.today { color: var(--accent); }
.ts td.c { font: 12.5px/1.35 var(--f-mono); font-variant-numeric: tabular-nums; cursor: pointer; }
.ts td.c:hover { background: var(--surface-2); }
.ts td.c span { display: block; color: var(--muted); font-size: 11.5px; }
.ts td.c .late-in { color: var(--late); font-weight: 600; }
.ts td.c .miss { color: var(--warn); font-weight: 600; }
.ts td.c .ed { display: inline-block; font: 600 10px var(--f-sans); color: var(--accent); border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-left: 4px; vertical-align: 1px; cursor: help; }
.ts td.c.none { color: var(--muted); cursor: default; }
.ts td.tot, .ts th.tot { text-align: right; }
.ts td.tot { font: 600 13px var(--f-mono); }
.ts tr:last-child td { border-bottom: 0; }
.ts-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 16px; border-top: 1px solid var(--line); }
.ts-legend b { font-family: var(--f-mono); }

table.grid-t { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 13.5px; }
.grid-t th, .grid-t td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid-t th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--surface-2); }
.grid-t tr:last-child td { border-bottom: 0; }
.grid-t .who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.grid-t .who .av { width: 30px; height: 30px; font-size: 12px; grid-row: auto; }
.grid-t td.m { font-family: var(--f-mono); color: var(--muted); }
.grid-t .ops { display: flex; gap: 6px; justify-content: flex-end; }
.grid-t tr.off td { color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
.form { padding: 16px; display: grid; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.dev { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: 13.5px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.dev:last-child { border-bottom: 0; }
.dev .mute { color: var(--muted); font-size: 12.5px; }
.dev .push { margin-left: auto; display: flex; gap: 6px; }
.audit { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.audit li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit li:last-child { border-bottom: 0; }
.audit time { font: 12px var(--f-mono); color: var(--muted); }
.audit .who { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.stats > div { padding: 14px 16px; display: grid; gap: 2px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats .k { font-size: 12.5px; color: var(--muted); }
.stats .v { font: 600 24px var(--f-mono); }
.stats .s { font-size: 12px; color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chart-body { padding: 12px 14px 14px; }
.chart-body svg { width: 100%; height: auto; display: block; }
.chart-note { font-size: 12px; color: var(--muted); padding: 0 16px 14px; }
svg .grid { stroke: var(--line); stroke-width: 1; }
svg .ax { fill: var(--muted); font: 11px var(--f-mono); }
svg .ax.late { fill: var(--late); }
svg .lbl { fill: var(--ink); font: 500 11.5px var(--f-sans); }
svg .lbl.late { fill: var(--late); }
svg .bar { fill: var(--accent); }
svg .bar.late { fill: var(--late); }
svg .ref { stroke: var(--muted); stroke-width: 1.2; }
svg .ref.late { stroke: var(--late); stroke-dasharray: 4 3; }
svg .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg .area { fill: var(--accent); opacity: .12; }
svg .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
svg .pt.end { fill: var(--accent); }
svg .cell { fill: var(--accent); }
svg .cell-bg { fill: var(--surface-2); }
svg .cnt { font: 500 11px var(--f-mono); }
svg .cnt.hi { fill: var(--on-accent); }
svg .cnt.lo { fill: var(--ink); }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); z-index: 41; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.dr-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dr-h .av { width: 44px; height: 44px; font-size: 15px; grid-row: auto; }
.dr-h h4 { font-size: 17px; }
.dr-h .sub { font-size: 12.5px; color: var(--muted); }
.dr-x { margin-left: auto; border: 0; background: var(--surface-2); border-radius: 7px; width: 32px; height: 32px; cursor: pointer; font-size: 16px; }
.dr-b { padding: 18px 20px; overflow-y: auto; display: grid; gap: 22px; align-content: start; }
.dr-b h5 { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .04em; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.tl time { font: 600 13px var(--f-mono); }
.tl .src { font-size: 12px; color: var(--muted); }
.tl .src.edit { color: var(--accent); }
.tl li.voided time, .tl li.voided .what { text-decoration: line-through; color: var(--muted); }
.day-sel { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini td, .mini th { padding: 7px 0; border-bottom: 1px solid var(--line); text-align: left; }
.mini th { font-size: 12px; color: var(--muted); font-weight: 500; }
.mini td { font-family: var(--f-mono); font-size: 12.5px; }
.mini td:first-child { font-family: var(--f-sans); }
.addp { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.addp .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.void-form { display: flex; gap: 6px; grid-column: 1 / -1; }
.void-form input { flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 13px; background: var(--surface); min-width: 0; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .side-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 2px; }
  .s-brand, .side-sep, .side-foot { display: none; }
  .nav-btn { width: auto; white-space: nowrap; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .main { padding: 18px 16px 40px; }
}
@media (max-width: 620px) {
  .side-col { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .audit li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
