/* Attendance Hub — tokens follow the Trident "Industrial Utilitarian" palette (light + dark, WCAG AA pairs). */
:root {
  --bg: #F6FAFE; --surface: #FFFFFF; --surface-2: #F0F4F8; --surface-3: #EAEEF2;
  --text: #171C1F; --text-2: #44474C; --muted: #5A5D62;
  --border: #DCE2E8; --border-2: #C9D0D8;
  --slab: #0D1B2A; --on-slab: #FFFFFF; --on-slab-muted: #9FA4AB;
  --amber: #FEAE2C; --on-amber: #3F2800; --amber-text: #835500;
  --ok: #12703F; --ok-fill: #27AE60; --warn: #7A4E00; --warn-fill: #FEAE2C; --err: #BA1A1A; --err-fill: #FFDAD6;
  --link: #0F3D66; --radius: 10px; --shadow: 0 1px 2px rgba(23,28,31,.06);
}
:root[data-theme="dark"] {
  --bg: #0F1316; --surface: #1A1F23; --surface-2: #1E2327; --surface-3: #22272B;
  --text: #E0E3E7; --text-2: #C3C7CD; --muted: #A7ADB3;
  --border: #2C3237; --border-2: #3E454B;
  --slab: #26384A; --on-slab: #FFFFFF; --on-slab-muted: #9FA4AB;
  --amber: #FEAE2C; --on-amber: #3F2800; --amber-text: #FFBF4D;
  --ok: #62D891; --ok-fill: #3CC273; --warn: #F4B94E; --warn-fill: #FEAE2C; --err: #FFB4AB; --err-fill: #4A1A1A;
  --link: #9CC4EA; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1316; --surface: #1A1F23; --surface-2: #1E2327; --surface-3: #22272B;
    --text: #E0E3E7; --text-2: #C3C7CD; --muted: #A7ADB3;
    --border: #2C3237; --border-2: #3E454B;
    --slab: #26384A; --on-slab: #FFFFFF; --on-slab-muted: #9FA4AB;
    --amber: #FEAE2C; --on-amber: #3F2800; --amber-text: #FFBF4D;
    --ok: #62D891; --ok-fill: #3CC273; --warn: #F4B94E; --warn-fill: #FEAE2C; --err: #FFB4AB; --err-fill: #4A1A1A;
    --link: #9CC4EA; --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 650; }
h3 { font-size: 13px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11px; }
.warn-text { color: var(--warn); font-weight: 600; } .err-text { color: var(--err); font-weight: 600; } .ok-text { color: var(--ok); font-weight: 600; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--slab); color: var(--on-slab); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-slab); font-weight: 700; font-size: 15px; margin-bottom: 20px; }
.brand.big { font-size: 20px; color: var(--text); margin-bottom: 4px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--amber); display: inline-block; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--on-slab-muted); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.side nav a:hover { color: var(--on-slab); background: rgba(255,255,255,.06); text-decoration: none; }
.side nav a.active { color: var(--on-amber); background: var(--amber); font-weight: 650; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.side-foot .muted { color: var(--on-slab-muted); }
.main { padding: 22px 28px 60px; min-width: 0; }
.bare { min-height: 100vh; display: grid; place-items: center; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .side nav { flex-direction: row; flex-wrap: wrap; } .side-foot { margin-top: 0; margin-left: auto; }
  .main { padding: 14px; }
}

/* header + stats */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; min-width: 100px; box-shadow: var(--shadow); }
.stat .num { display: block; font-size: 22px; font-weight: 700; line-height: 1.1; } .stat .lbl { font-size: 11.5px; color: var(--muted); }
.stat.warn .num { color: var(--warn); }

/* cards + tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; } @media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } @media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.compact td { padding: 5px 8px; }
.table tr:last-child td { border-bottom: 0; }
.table tr.unmatched td { background: color-mix(in srgb, var(--warn-fill) 12%, transparent); }
.table-wrap { overflow-x: auto; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--border-2); border-radius: var(--radius); }

/* pills, dots, dirs */
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pill.ok { background: color-mix(in srgb, var(--ok-fill) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn-fill) 22%, transparent); color: var(--warn); }
.pill.err { background: var(--err-fill); color: var(--err); }
.dir { font-weight: 700; font-size: 11.5px; text-transform: uppercase; }
.dir.in { color: var(--ok); } .dir.out { color: var(--amber-text); } .dir.dup, .dir.unknown, .dir.pending { color: var(--muted); } .dir.unmatched { color: var(--warn); }
.state-online .dot { background: var(--ok-fill); } .state-amber .dot { background: var(--warn-fill); } .state-red .dot { background: #E74C3C; } .state-never .dot { background: var(--border-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok-fill); } .dot.warn { background: var(--warn-fill); } .dot.err { background: #E74C3C; } .dot.off { background: var(--border-2); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--radius); padding: 12px 14px; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--border-2); }
.tile.state-online { border-left-color: var(--ok-fill); } .tile.state-amber { border-left-color: var(--warn-fill); } .tile.state-red { border-left-color: #E74C3C; }
.tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .tile-head strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.tile-sync { margin-top: 8px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 6px; }

/* alerts */
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--border-2); display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.alerts li.sev-warn { border-left-color: var(--warn-fill); } .alerts li.sev-error { border-left-color: #E74C3C; } .alerts li.sev-info { border-left-color: var(--link); }

/* forms + buttons */
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--amber); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
.inline label { flex-direction: row; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 7px 14px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--on-amber); } .btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: inherit; } .btn.ghost:hover { background: rgba(127,127,127,.12); }
.side .btn.ghost { color: var(--on-slab-muted); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; } .btn.xs { padding: 2px 8px; font-size: 11.5px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: color-mix(in srgb, var(--ok-fill) 12%, transparent); border-color: color-mix(in srgb, var(--ok-fill) 40%, transparent); color: var(--ok); }
.flash.warn { background: color-mix(in srgb, var(--warn-fill) 16%, transparent); border-color: var(--warn-fill); color: var(--warn); }
.flash.err { background: var(--err-fill); border-color: color-mix(in srgb, var(--err) 40%, transparent); color: var(--err); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--amber); } .tabs a:hover { text-decoration: none; color: var(--text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--ok-fill); }
details summary { cursor: pointer; color: var(--link); font-weight: 600; }
pre.log { background: var(--surface-2); padding: 8px 10px; border-radius: 8px; overflow: auto; max-height: 300px; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* login */
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: 0 8px 30px rgba(13,27,42,.10); }
.login-card p { margin: 0 0 18px; }

@keyframes flashIn { from { background: color-mix(in srgb, var(--amber) 35%, transparent); } to { background: transparent; } }
.flash-in { animation: flashIn 1.8s ease-out; }
.status-present { color: var(--ok); } .status-late, .status-half, .status-incomplete { color: var(--warn); } .status-absent { color: var(--err); } .status-rest, .status-holiday { color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 120px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; } .chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12px; }
.report-head { text-align: center; margin-bottom: 14px; } .report-head h1 { margin-bottom: 0; }
@media print { .side, .filters, .btn, .flash, .tabs { display: none !important; } .shell { display: block; } .main { padding: 0; } .card { border: 0; box-shadow: none; } body { background: #fff; color: #000; } }
