/* ═══ Fonts ═══════════════════════════════════════════════════════════════════════════════════════════════ */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ═══ Design tokens ═══════════════════════════════════════════════════════════════════════════════════════
   Spacing scale: 4 / 8 / 16 / 24 / 32 / 48.  Radii: 8 (controls) · 12 (cards) · 16 (modals).               */
:root {
  --topbar-h: 57px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* Neutrals: soft off-white page, near-black text. No pure #fff / #000 anywhere. */
  --bg: #f5f5f7;
  --surface: #fcfcfd;
  --surface-2: #f2f2f5;
  --border: #e4e4e9;
  --border-strong: #d2d2d9;
  --text: #1d1d1f;
  --text-2: #424247;
  --muted: #64646c;

  /* One accent for primary actions + focus. */
  --accent: #0a64d6;
  --accent-hover: #0856b8;
  --accent-soft: #e6f0fc;
  --on-accent: #fbfbfd;

  --success: #1b7f4a; --success-soft: #e0f3e8;
  --t-blue: #0a64d6; --t-blue-bg: #e6f0fc; --t-green: #1a7f4b; --t-green-bg: #e3f5ea; --t-amber: #a35a07; --t-amber-bg: #fcf0d9;
  --t-red: #c0392b; --t-red-bg: #fdeae7; --t-violet: #5b3cc4; --t-violet-bg: #efe9fd; --t-teal: #0b7285; --t-teal-bg: #dbf0f4; --t-pink: #b8286b; --t-pink-bg: #fde7f1;
  --face: #5b3cc4; --face-soft: #efe9fd; --warning: #a35a07; --warning-soft: #fcf0d9;
  --danger: #c4291c; --on-danger: #fff; --danger-soft: #fbe5e2;

  --shadow-sm: 0 1px 2px rgb(20 20 30 / .04), 0 1px 1px rgb(20 20 30 / .03);
  --shadow-md: 0 4px 14px rgb(20 20 30 / .06), 0 1px 3px rgb(20 20 30 / .05);
  --shadow-lg: 0 20px 48px rgb(20 20 30 / .18), 0 4px 12px rgb(20 20 30 / .08);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: 140ms; --base: 220ms;

  /* Attendance status palette (text / tint) */
  --st-present: #17703f;       --st-present-bg: #e0f3e8;
  --st-late: #8f4f05;          --st-late-bg: #fcf0d9;
  --st-under_target: #ab400b;  --st-under_target-bg: #fde6d8;
  --st-absent: #b3241a;        --st-absent-bg: #fbe5e2;
  --st-incomplete: #7b3fa6;    --st-incomplete-bg: #f0e4f8;
  --st-in_progress: #0a64d6;   --st-in_progress-bg: #e6f0fc;
  --st-pending: #5d5d65;       --st-pending-bg: #ececf0;
  --st-off: #5f5f67;           --st-off-bg: #f0f0f3;
  --st-leave: #0c6b63;         --st-leave-bg: #dcf3f0;
  --st-wfh: #4f46e5;           --st-wfh-bg: #e8e9fb;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #1b1b1e; --surface-2: #232327; --border: #2d2d32; --border-strong: #3a3a41;
    --text: #f2f2f4; --text-2: #d0d0d6; --muted: #9a9aa3;
    --accent: #3d93f5; --accent-hover: #5aa4f7; --accent-soft: #14253b; --on-accent: #0d1117;
    --t-blue: #6db0f8; --t-blue-bg: #14253b; --t-green: #5fd096; --t-green-bg: #112a1c; --t-amber: #f0b45a; --t-amber-bg: #33260c;
    --t-red: #ff8a7e; --t-red-bg: #3a1815; --t-violet: #c4b5fd; --t-violet-bg: #2a1f45; --t-teal: #5fcde0; --t-teal-bg: #0f2d35; --t-pink: #f59ac4; --t-pink-bg: #3d1830;
    --face: #c4b5fd; --face-soft: #2a1f45; --success: #5fd096; --on-danger: #1a0b0a; --success-soft: #112a1c; --warning: #f0b45a; --warning-soft: #33260c; --danger: #ff8a7e; --danger-soft: #3a1815;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 4px 14px rgb(0 0 0 / .35); --shadow-lg: 0 20px 48px rgb(0 0 0 / .55);
    --st-present: #5fd096;      --st-present-bg: #112a1c;
    --st-late: #f0b45a;         --st-late-bg: #33260c;
    --st-under_target: #f59a6b; --st-under_target-bg: #3a1f10;
    --st-absent: #ff8a7e;       --st-absent-bg: #3a1815;
    --st-incomplete: #cfa0ee;   --st-incomplete-bg: #2b1a38;
    --st-in_progress: #7fb4f8;  --st-in_progress-bg: #14253b;
    --st-pending: #9a9aa3;      --st-pending-bg: #26262b;
    --st-off: #8c8c95;          --st-off-bg: #1e1e22;
    --st-leave: #5eead4;        --st-leave-bg: #0f2a28;
    --st-wfh: #a5b4fc;          --st-wfh-bg: #1b1d3a;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #1b1b1e; --surface-2: #232327; --border: #2d2d32; --border-strong: #3a3a41;
  --text: #f2f2f4; --text-2: #d0d0d6; --muted: #9a9aa3;
  --accent: #3d93f5; --accent-hover: #5aa4f7; --accent-soft: #14253b; --on-accent: #0d1117;
  --t-blue: #6db0f8; --t-blue-bg: #14253b; --t-green: #5fd096; --t-green-bg: #112a1c; --t-amber: #f0b45a; --t-amber-bg: #33260c;
  --t-red: #ff8a7e; --t-red-bg: #3a1815; --t-violet: #c4b5fd; --t-violet-bg: #2a1f45; --t-teal: #5fcde0; --t-teal-bg: #0f2d35; --t-pink: #f59ac4; --t-pink-bg: #3d1830;
  --face: #c4b5fd; --face-soft: #2a1f45; --success: #5fd096; --on-danger: #1a0b0a; --success-soft: #112a1c; --warning: #f0b45a; --warning-soft: #33260c; --danger: #ff8a7e; --danger-soft: #3a1815;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 4px 14px rgb(0 0 0 / .35); --shadow-lg: 0 20px 48px rgb(0 0 0 / .55);
  --st-present: #5fd096;      --st-present-bg: #112a1c;
  --st-late: #f0b45a;         --st-late-bg: #33260c;
  --st-under_target: #f59a6b; --st-under_target-bg: #3a1f10;
  --st-absent: #ff8a7e;       --st-absent-bg: #3a1815;
  --st-incomplete: #cfa0ee;   --st-incomplete-bg: #2b1a38;
  --st-in_progress: #7fb4f8;  --st-in_progress-bg: #14253b;
  --st-pending: #9a9aa3;      --st-pending-bg: #26262b;
  --st-off: #8c8c95;          --st-off-bg: #1e1e22;
  --st-leave: #5eead4;        --st-leave-bg: #0f2a28;
  --st-wfh: #a5b4fc;          --st-wfh-bg: #1b1d3a;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ═══ Base ════════════════════════════════════════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.5 var(--font); letter-spacing: -.006em; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 600; }
.muted { color: var(--muted); } .right { margin-left: auto; }
.icon { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }   /* an outline cannot be overridden by a component's own shadow */
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
[hidden] { display: none !important; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }   /* one column that never grows past its container */

/* ═══ Components ══════════════════════════════════════════════════════════════════════════════════════════ */
/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 36px; padding: 0 var(--s3); border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 14px/1 var(--font); letter-spacing: -.006em; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.92); }
.btn-ghost.btn-danger { border-color: transparent; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; transition: background var(--fast), color var(--fast); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Inputs */
input, select, textarea { font: 400 14px/1.4 var(--font); letter-spacing: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  height: 36px; padding: 0 12px; min-width: 0; width: 100%; transition: border-color var(--fast), box-shadow var(--fast); }
textarea { height: auto; padding: 8px 12px; resize: vertical; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("/img/chevron.svg");
  background-repeat: no-repeat; background-position: right 10px center; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type="search"] { appearance: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; } legend { padding: 0; margin-bottom: var(--s2); }
label.f { display: grid; gap: 6px; min-width: 0; }
.f-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.f-hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: var(--s2); padding: 6px 12px 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); cursor: pointer; background: var(--surface); transition: background var(--fast), border-color var(--fast); }
.check:has(input:checked) { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); box-shadow: var(--shadow-sm); min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.section { margin-top: var(--s5); }
.section > h2 { margin-bottom: var(--s3); }

/* Page header */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.subtitle { color: var(--muted); margin-top: 6px; font-size: 15px; }
.page-header-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: var(--s3); }
.back-link:hover { color: var(--text); text-decoration: none; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat { display: grid; gap: 4px; padding: var(--s3) var(--s4); }
.stat .l { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .n { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* Toolbar (filters) */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s4); }
.toolbar > label.f { flex: 0 1 180px; } .toolbar > label.f.grow { flex: 1 1 260px; }
.search { position: relative; } .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; } .search input { padding-left: 36px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 12px var(--s3); white-space: nowrap; vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .01em; background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; }
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap td:first-child, .table-wrap th:first-child { padding-left: var(--s4); } .table-wrap td:last-child, .table-wrap th:last-child { padding-right: var(--s4); }
tr.click { cursor: pointer; transition: background var(--fast); } tr.click:hover td { background: var(--surface-2); }
tr.click:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 0; }
td .sub { color: var(--muted); font-size: 12.5px; }
.actions-cell { display: flex; gap: 2px; justify-content: flex-end; }
tr.empty-row td { padding: 0; border: 0; } tr.empty-row:hover td { background: none; }
.is-loading { opacity: .55; pointer-events: none; transition: opacity var(--fast); }
.pager { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); color: var(--muted); }

/* Badges, pills, status */
.pill, .st { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.sev-critical { background: var(--danger-soft); color: var(--danger); } .sev-warning { background: var(--warning-soft); color: var(--warning); } .sev-info { background: var(--accent-soft); color: var(--accent); }
.st { color: var(--c); background: var(--bg-c); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--danger); color: var(--on-danger); font-size: 11px; font-weight: 700; }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: var(--s2); vertical-align: middle; }
.err { color: var(--danger); font-size: 13px; min-height: 20px; }
.notice { padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; background: var(--surface-2); color: var(--text-2); }
.notice.ok { background: var(--success-soft); color: var(--success); } .notice.err { background: var(--danger-soft); color: var(--danger); min-height: 0; }
.notice:empty { display: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s3); font-size: 13.5px; } .kv dt { color: var(--muted); padding: 6px 0; } .kv dd { margin: 0; padding: 6px 0; }


/* Status → colour variables consumed by .st and .cell */
.st-present { --c: var(--st-present); --bg-c: var(--st-present-bg); }
.st-late { --c: var(--st-late); --bg-c: var(--st-late-bg); }
.st-under_target { --c: var(--st-under_target); --bg-c: var(--st-under_target-bg); }
.st-absent { --c: var(--st-absent); --bg-c: var(--st-absent-bg); }
.st-incomplete { --c: var(--st-incomplete); --bg-c: var(--st-incomplete-bg); }
.st-in_progress { --c: var(--st-in_progress); --bg-c: var(--st-in_progress-bg); }
.st-pending { --c: var(--st-pending); --bg-c: var(--st-pending-bg); }
.st-off { --c: var(--st-off); --bg-c: var(--st-off-bg); }
.st-leave { --c: var(--st-leave); --bg-c: var(--st-leave-bg); }
.st-wfh { --c: var(--st-wfh); --bg-c: var(--st-wfh-bg); }
.st-off_day_work { --c: var(--st-in_progress); --bg-c: var(--st-in_progress-bg); }

/* Empty / error states */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s6) var(--s4); }
.empty h3 { margin-top: var(--s1); } .empty p { color: var(--muted); max-width: 360px; margin-bottom: var(--s2); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); }
.empty-error .empty-icon { background: var(--danger-soft); color: var(--danger); }
.card > .empty { padding-block: var(--s5); }

/* Skeleton shimmer */
.skeleton { border-radius: 6px; background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.sk-title { height: 32px; width: 260px; margin-bottom: var(--s2); } .sk-line { height: 14px; } .sk-num { height: 32px; width: 56%; margin-top: var(--s1); }
.sk-row { display: flex; gap: var(--s4); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); } .sk-row:last-child { border: 0; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Modal */
dialog.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); animation: pop var(--base) var(--ease); }
dialog.modal::backdrop { background: rgb(14 14 20 / .42); backdrop-filter: blur(3px); animation: fade var(--base) var(--ease); }
dialog.modal form, dialog.modal .modal-body { display: grid; gap: var(--s3); }
.modal-title { font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
dialog.modal img { max-width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); }
dialog.modal .map-box img { border: 0; border-radius: 0; } /* the photo frame above must not draw on map tiles and the pin */
.code { font: 600 26px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .14em; padding: var(--s4); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md); text-align: center; user-select: all; }

/* Toasts */
#toasts { position: fixed; right: var(--s3); bottom: var(--s3); display: grid; gap: var(--s2); z-index: 60; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: slide-in var(--base) var(--ease); }
.toast > span { flex: 1; padding-top: 1px; } .toast.leaving { opacity: 0; transform: translateX(12px); transition: all 200ms var(--ease); }
.toast-critical > .icon { color: var(--danger); } .toast-warning > .icon { color: var(--warning); } .toast-info > .icon { color: var(--accent); }

/* ═══ App shell ═══════════════════════════════════════════════════════════════════════════════════════════ */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.layout > div { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
nav.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s1); padding: var(--s4) var(--s3); background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; padding: var(--s1) 12px var(--s4); font-weight: 650; font-size: 16px; letter-spacing: -.015em; }
.brand-logo { display: block; width: 32px; height: 32px; border-radius: 10px; flex: none; box-shadow: var(--shadow-sm); }
.wordmark b { font-weight: 760; letter-spacing: -.02em; } .wordmark { font-weight: 420; }
nav.side a.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; transition: background var(--fast), color var(--fast); }
nav.side a.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
nav.side a.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
nav.side a.nav-link .badge { margin-left: auto; }
nav.side .spacer { flex: 1; }
.account { display: flex; align-items: center; gap: 12px; padding: var(--s3) 12px 0; border-top: 1px solid var(--border); margin-top: var(--s2); }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); flex: none; }
.account-text { min-width: 0; flex: 1; line-height: 1.3; } .account-text b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .account-text span { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.topbar { display: none; }
main { padding: var(--s5) var(--s5) var(--s3); min-width: 0; width: 100%; max-width: 1240px; margin-inline: auto; outline: none; flex: 1 0 auto; display: flex; flex-direction: column; }
.view-enter { animation: rise var(--base) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); background: radial-gradient(900px 420px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login form { width: min(400px, 100%); display: grid; gap: var(--s3); padding: var(--s5); box-shadow: var(--shadow-md); animation: rise var(--base) var(--ease); }
.login .brand-logo { width: 52px; height: 52px; border-radius: 16px; margin-bottom: var(--s3); }
.login-brand { margin: 0 0 var(--s1); font-size: 15px; color: var(--muted); }
.login h1 { font-size: 24px; } .login .btn { height: 40px; }

/* The calendar page uses the whole content area with minimal padding, at any resolution. */
main:has(> .cal-wide) { max-width: none; padding: var(--s4) var(--s3) var(--s2); }
.team { max-height: calc(100vh - 280px); }

/* ═══ Calendar ════════════════════════════════════════════════════════════════════════════════════════════
   Quiet by default: ordinary days are a soft wash, exceptions carry the colour. Status colours are the fixed
   --st-* scale (contrast-checked), always paired with an icon + label.                                       */
.cal-root { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.cal-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.cal-bar .group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); }
.month-nav { display: inline-flex; align-items: center; gap: var(--s1); box-sizing: border-box; height: 36px; padding: 0 var(--s1); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); } /* same height and frame as the filters beside it */
.month-nav input[type="month"] { border: 0; background: transparent; height: 32px; width: 176px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; text-align: center; }
.month-nav input[type="month"]:hover:not(:disabled) { background: var(--surface-2); }
.month-nav .btn { width: 32px; height: 32px; padding: 0; border: 0; box-shadow: none; }
.month-nav .today-btn { width: auto; padding: 0 12px; font-size: 13px; color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font: 500 13px/1 var(--font); cursor: pointer; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.chip:hover { background: var(--surface-2); } .chip:active { transform: scale(.97); }
.chip .icon { color: var(--c); }
.chip .n { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--bg-c); border-color: color-mix(in srgb, var(--c) 38%, transparent); color: var(--c); }
.chip[aria-pressed="true"] .n { color: inherit; }
.chips .hint { align-self: center; color: var(--muted); font-size: 12.5px; margin-left: var(--s1); }

/* Team view: one attendance strip per person, days grouped by week */
.team { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: auto; max-height: 74vh; }
.t-row { display: flex; align-items: center; width: 100%; min-width: max-content; padding: 12px 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.t-row:last-child { border-bottom: 0; }
.t-head { position: sticky; top: 0; z-index: 4; align-items: flex-end; padding: 10px 0 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.t-name { position: sticky; left: 0; z-index: 3; flex: none; width: 208px; padding: 0 var(--s3) 0 var(--s4); background: inherit; }
.t-head .t-name { color: var(--muted); font-size: 12px; font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who .avatar { width: 44px; height: 44px; font-size: 14px; background: var(--accent-soft); color: var(--accent); }
.who-text { min-width: 0; flex: 1; overflow: hidden; line-height: 1.35; } .who-text a { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text a:hover { color: var(--accent); text-decoration: none; } .who-text > span:not(.sub) { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-days { display: flex; flex: 1 1 auto; gap: 2px; padding-right: var(--s3); } .t-days > .mon { margin-left: 8px; }
.dh { flex: 1 1 20px; min-width: 20px; max-width: 48px; text-align: center; font-size: 11px; line-height: 1.25; color: var(--muted); position: relative; }
.dh b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dh.we, .dh.we b { color: var(--muted); } .dh.today b { color: var(--accent); }
.dh.today::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.c { flex: 1 1 20px; min-width: 20px; max-width: 48px; height: 40px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: var(--bg-c); cursor: default; position: relative;
  transition: transform var(--fast) var(--ease), opacity var(--base) var(--ease), box-shadow var(--fast) var(--ease); }
.c:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); z-index: 1; }
.c.st-present { background: color-mix(in srgb, var(--st-present-bg) 70%, transparent); }
.c.st-present::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--st-present); opacity: .55; }
.c.st-off, .c.st-none { background: transparent; box-shadow: none; } .c.st-off::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--st-off); opacity: .5; }
.c.st-none::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--st-off); opacity: .22; }
.c.st-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.c.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); } .c.today:hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent), var(--shadow-md); }
.c.late-flag::before { content: ""; position: absolute; right: -2px; top: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-late); box-shadow: 0 0 0 2px var(--surface); }
.dim { opacity: .18; }

/* Single employee: a real month grid */
.m-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2); }
.m-head { padding: 0 var(--s1) var(--s1); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.m-day { min-height: 0; position: relative; overflow: hidden; container-type: size; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), opacity var(--base) var(--ease); }
.m-day:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.m-day.blank { background: transparent; border: 0; box-shadow: none; pointer-events: none; }
.m-day.we, .m-day.st-off { background: var(--surface-2); box-shadow: none; } .m-day.st-none { background: transparent; border-style: dashed; box-shadow: none; }
.m-day .num { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.m-day.today .num { background: var(--accent); color: var(--on-accent); }
/* Hours are the headline of each day: big, bold, and colour-coded against the target. Size follows the cell. */
.m-day .hrs { margin-top: auto; font-size: clamp(15px, min(24cqh, 22cqw), 34px); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.m-day .hrs small { margin-left: 3px; font-size: .5em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hrs.under { color: var(--st-under_target); } .hrs.ok { color: var(--st-present); } .hrs.over { color: var(--accent); }
.hrs-key { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding-left: var(--s3); color: var(--muted); font-size: 12.5px; white-space: nowrap; flex: none; }
.hrs-key .k { width: 10px; height: 10px; border-radius: 50%; margin-left: 8px; } .hrs-key .k:first-child { margin-left: 0; }
.hrs-key .k.under { background: var(--st-under_target); } .hrs-key .k.ok { background: var(--st-present); } .hrs-key .k.over { background: var(--accent); }
.m-day .times { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Tooltip: values lead, labels follow */
.tip { position: fixed; z-index: 90; pointer-events: none; max-width: 264px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 12.5px; line-height: 1.4; opacity: 0; transform: translateY(4px); transition: opacity 120ms var(--ease), transform 120ms var(--ease); }
.tip.on { opacity: 1; transform: none; }
.tip .t-date { opacity: .7; font-size: 12px; } .tip .t-name2 { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.tip .t-statuses { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.tip .t-statuses .st { font-size: 12.5px; padding: 3px 10px 3px 8px; }
.tip .t-kv { display: flex; justify-content: space-between; gap: var(--s4); } .tip .t-kv span { opacity: .7; } .tip .t-kv b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ═══ Charts ══════════════════════════════════════════════════════════════════════════════════════════════ */
.bar-chart text { fill: var(--muted); font: 500 12px var(--font); } .bar-chart .axis-month { fill: var(--text-2); font-weight: 600; } .bar-chart .grid { stroke: var(--border); stroke-width: 1; }
.bar-chart .target { stroke: var(--text-2); stroke-dasharray: 4 4; opacity: .7; } .bar-chart rect { fill-opacity: .82; transition: opacity var(--fast); } .bar-chart rect:hover { opacity: .75; }
.chart-key { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; } .chart-key i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: var(--s4); align-items: start; }
.form-grid { display: grid; gap: var(--s3); align-items: start; } .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-card { display: grid; gap: var(--s3); align-content: start; } .form-card > h3 { font-size: 16px; padding-bottom: var(--s2); border-bottom: 1px solid var(--border); }
.form-footer { grid-column: 1 / -1; display: flex; gap: var(--s3); align-items: center; position: sticky; bottom: var(--s3); padding: var(--s3) var(--s4); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); }

/* ═══ Responsive ══════════════════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) { main { padding: var(--s4) var(--s4) var(--s3); } .layout { grid-template-columns: 208px minmax(0, 1fr); } }
@media (max-width: 800px) {
  .layout { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; padding: 12px var(--s3); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .topbar .brand { padding: 0; }
  nav.side { position: fixed; inset: auto 0 0 0; height: auto; z-index: 30; flex-direction: row; justify-content: space-around; padding: 6px var(--s2) calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); }
  nav.side .brand, nav.side .spacer, nav.side .account { display: none; }
  nav.side a.nav-link { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 10.5px; flex: 1; justify-content: center; position: relative; border-radius: var(--r-sm); }
  nav.side a.nav-link .badge { position: absolute; top: 0; left: 55%; margin: 0; min-width: 16px; height: 16px; font-size: 10px; }
  main { padding: var(--s3) var(--s3) calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .page-header { align-items: flex-start; margin-bottom: var(--s3); } .toolbar > label.f, .toolbar > label.f.grow { flex: 1 1 calc(50% - 8px); } .toolbar > label.f.grow { flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); } .stat { padding: var(--s3); } .stat .n { font-size: 26px; }
  .form-grid.two { grid-template-columns: 1fr; } .card { padding: var(--s3); } .card-flush { padding: 0; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  dialog.modal { padding: var(--s3); } .form-footer { bottom: calc(80px + env(safe-area-inset-bottom)); padding: var(--s2) var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ═══ Location map preview ════════════════════════════════════════════════════════════════════════════════ */
.map-box { position: relative; isolation: isolate; z-index: 0; height: 320px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.map-canvas { position: absolute; inset: 0; }
.map-status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: var(--s4); color: var(--muted); }
.map-status[hidden], .map-canvas[hidden] { display: none; }
@media (max-width: 800px) { .map-box { height: 260px; } }

@media (max-width: 800px) {
  main:has(> .cal-wide) { padding: var(--s3) var(--s3) calc(88px + env(safe-area-inset-bottom)); }
  .cal-bar .group { width: 100%; } .cal-bar .group > label.f { flex: 1; } .month-nav { width: 100%; justify-content: space-between; } .month-nav input[type="month"] { flex: 1; width: auto; }
  .t-name { width: 188px; padding-left: var(--s3); } .who .avatar { display: none; }
  .m-grid { gap: 4px; } .m-day { padding: 5px; gap: 2px; align-items: flex-start; border-radius: var(--r-sm); }
  .m-day .st { font-size: 0; gap: 0; padding: 4px; } .m-day .times, .m-day .hrs small { display: none; } .m-day .hrs { font-size: 12px; }
  .m-head { text-align: center; padding: 0 0 var(--s1); font-size: 11px; }
}

/* Credit line */
.credit { margin: auto 0 0; padding-top: var(--s5); text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .01em; flex: none; }
.login-wrap { width: min(400px, 100%); } .login-wrap .credit { margin-top: var(--s4); }
.login form { width: 100%; }

a.btn:hover { text-decoration: none; }
.cal-bar { align-items: flex-end; } .detail-slot { margin-left: auto; }

/* ── Single employee: the month grid fits the screen exactly, so the page never scrolls ───────────────── */
main:has(> .cal-wide.fit) { height: 100dvh; max-height: 100dvh; flex: none; overflow: hidden; }
.cal-wide.fit { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.cal-wide.fit ~ .credit { margin-top: 0; padding: var(--s2) 0 0; }
.cal-wide.fit .page-header { margin-bottom: var(--s3); }
.cal-wide.fit .cal-bar { flex: none; margin-bottom: var(--s3); }
.cal-wide.fit .cal-root { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: var(--s3); }
.cal-wide.fit .chips { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .cal-wide.fit .chips::-webkit-scrollbar { display: none; } .cal-wide.fit .chip { flex: none; } .cal-wide.fit .chips .hint { display: none; }
.cal-wide.fit .cal-body { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.cal-single { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: var(--s3); }
.cal-single .stats { flex: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); margin: 0; }
.cal-single .stat { padding: 8px 14px; gap: 0; } .cal-single .stat .n { font-size: 22px; } .cal-single .stat .l { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cal-single .stat .l .short { display: none; }
.cal-single .m-grid { flex: 1 1 0; min-height: 0; grid-template-rows: auto repeat(var(--weeks, 6), minmax(0, 1fr)); gap: 6px; }
.m-head { padding-bottom: 0; }

/* Each day adapts to the room it is given. Content is dropped in order of importance, with thresholds taken from
   the height each combination actually needs: times, then the extra "late" pill (a dot replaces it), then the status
   label (icon only), then the hours. */
.m-day .late-dot { display: none; position: absolute; right: 10px; bottom: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-late); box-shadow: 0 0 0 2px var(--surface); }
/* NB: container queries measure the content box (cell height minus 22px of padding). Needed content height:
   date + pill + late pill + times + hours = 150, without times = 124, without the late pill = 90, icon-only pill = 58. */
@container (max-height: 149px) { .times { display: none; } }
@container (max-height: 124px) { .m-day .st.extra { display: none; } .m-day .late-dot { display: block; } }
@container (max-height: 86px) { .st { position: absolute; top: 8px; right: 8px; font-size: 0; gap: 0; padding: 4px; } }
@container (max-height: 50px) { .m-day .hrs, .m-day .late-dot { display: none; } }
@container (max-width: 100px) { .st { position: absolute; top: 6px; right: 6px; font-size: 0; gap: 0; padding: 4px; } .m-day .st.extra { display: none; } .m-day .late-dot { display: block; } .hrs small { display: none; } }

@media (max-width: 800px) {
  main:has(> .cal-wide.fit) { height: calc(100dvh - var(--topbar-h)); max-height: calc(100dvh - var(--topbar-h)); padding: var(--s3) var(--s3) calc(76px + env(safe-area-inset-bottom)); }
  .cal-wide.fit h1 { font-size: 20px; } .cal-wide.fit .page-header { margin-bottom: var(--s2); }
  .cal-wide.fit .cal-bar { margin-bottom: var(--s2); } .cal-wide.fit .cal-bar .group { gap: var(--s2); } .cal-wide.fit .cal-bar label.f .f-label { display: none; }
  .cal-wide.fit .month-nav .today-btn { display: none; } .cal-wide.fit .detail-slot { display: none; }
  .cal-wide.fit .cal-root { gap: var(--s2); } .cal-single { gap: var(--s2); }
  .cal-single .stat { padding: 6px 8px; } .cal-single .stat .n { font-size: 16px; } .cal-single .stat .l { font-size: 10px; } .cal-single .stat .l .long { display: none; } .cal-single .stat .l .short { display: inline; }
  .cal-single .m-grid { gap: 3px; }
}
@media (max-height: 640px) and (min-width: 801px) { .cal-wide.fit h1 { font-size: 20px; } .cal-wide.fit .page-header { margin-bottom: var(--s2); } .cal-single .stat { padding: 4px 12px; } .cal-single .stat .n { font-size: 18px; } }

/* ═══ Search-and-autocomplete picker ══════════════════════════════════════════════════════════════════════ */
.cb { position: relative; }
.cb input { padding-right: 58px; text-overflow: ellipsis; }
.cb-chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.cb-clear { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); } .cb-clear[hidden] { display: none; }
.cb-list { position: absolute; z-index: 70; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(380px, 92vw); max-height: 280px; overflow: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: pop 140ms var(--ease); }
.cb-list[hidden] { display: none; }
.cb-opt { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; }
.cb-opt.active { background: var(--surface-2); } .cb-opt[aria-selected="true"] .cb-label { font-weight: 600; color: var(--accent); }
.cb-opt.free .cb-label { color: var(--accent); } .cb-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; } .cb-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.t-row[hidden] { display: none; }
.cal-bar .group > label.f { flex: 0 0 210px; } .cal-bar .group > label.f:last-child { flex-basis: 170px; }
@media (max-width: 800px) { .cal-bar .group > label.f, .cal-bar .group > label.f:last-child { flex: 1 1 calc(50% - 8px); } .cal-wide.fit .cal-bar .group { flex-wrap: wrap; } }

/* ═══ Sign-in ═════════════════════════════════════════════════════════════════════════════════════════════ */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; color: #EAF2FF; padding: var(--s6); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s5);
  background: radial-gradient(900px 520px at 0% 0%, rgb(255 255 255 / .2), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgb(47 168 245 / .55), transparent 60%), linear-gradient(150deg, #0A2158 0%, #0A4DB3 55%, #0B66D6 100%); }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgb(255 255 255 / .09) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.scan-art { position: absolute; right: -170px; bottom: -170px; width: 640px; pointer-events: none; overflow: visible; animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0, 0) rotate(0); } to { transform: translate(-14px, -10px) rotate(-2deg); } }
.scan-art .q-shape { opacity: .16; }
.scan-art .q-bolt { opacity: .4; transform-box: fill-box; transform-origin: center; animation: bolt-pulse 3.2s ease-in-out infinite; }
@keyframes bolt-pulse { 0%, 100% { transform: scale(1); opacity: .28; } 50% { transform: scale(1.07); opacity: .5; } }
.scan-art .ping { transform-box: fill-box; transform-origin: center; opacity: 0; animation: ping 4.8s cubic-bezier(.2, .6, .3, 1) infinite; }
.scan-art .ping-2 { animation-delay: 1.6s; } .scan-art .ping-3 { animation-delay: 3.2s; }
@keyframes ping { 0% { transform: scale(1); opacity: .32; } 100% { transform: scale(2.1); opacity: 0; } }
.scan-art .orbit { transform-box: view-box; transform-origin: 100px 100px; animation: orbit 22s linear infinite; opacity: .8; }
@keyframes orbit { to { transform: rotate(360deg); } }
.hero-orb { position: absolute; border-radius: 50%; filter: blur(50px); pointer-events: none; opacity: .5; }
.orb-a { width: 340px; height: 340px; left: -80px; top: 30%; background: rgb(120 140 255 / .55); animation: orb-a 16s ease-in-out infinite alternate; }
.orb-b { width: 280px; height: 280px; right: 10%; top: -60px; background: rgb(47 200 245 / .4); animation: orb-b 19s ease-in-out infinite alternate; }
@keyframes orb-a { to { transform: translate(60px, -50px) scale(1.15); } } @keyframes orb-b { to { transform: translate(-70px, 60px) scale(.9); } }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; font-size: 38px; letter-spacing: -.02em; }
.auth-brand .brand-logo { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 10px 30px rgb(0 0 0 / .35), 0 0 0 1px rgb(255 255 255 / .18); animation: logo-float 5s ease-in-out infinite; }
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.auth-pitch { position: relative; z-index: 1; max-width: 560px; margin: auto 0; }
.auth-pitch h2 { font-size: clamp(32px, 3.6vw, 46px); line-height: 1.08; letter-spacing: -.035em; font-weight: 750; margin-bottom: var(--s3); text-wrap: balance; }
.auth-pitch > p { color: rgb(234 242 255 / .85); font-size: 17px; line-height: 1.55; }
.auth-points { list-style: none; margin: var(--s5) 0 0; padding: 0; display: grid; gap: var(--s4); }
.auth-points li { display: flex; gap: 14px; align-items: flex-start; }
.auth-points .ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; background: rgb(255 255 255 / .14); border: 1px solid rgb(255 255 255 / .18); backdrop-filter: blur(8px); }
.auth-points b { display: block; font-weight: 600; font-size: 15px; } .auth-points li span:not(.ic) { color: rgb(234 242 255 / .75); font-size: 14px; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4); padding: var(--s5); background: var(--bg); }
.auth-card { width: min(420px, 100%); padding: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); animation: rise 360ms var(--ease); }
.auth-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s3); }
.auth-card h1 { font-size: 26px; } .auth-card .subtitle { margin: 6px 0 var(--s4); }
.auth-form { display: grid; gap: var(--s3); }
.pw { position: relative; } .pw input { height: 46px; padding-right: 46px; font-size: 15px; } .pw-toggle { position: absolute; right: 8px; top: 9px; }
.btn-lg { height: 46px; font-size: 15px; width: 100%; }
.auth-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: var(--s4) 0 0; color: var(--muted); font-size: 12.5px; }
.auth-panel .credit { margin: 0; padding: 0; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-hero { padding: var(--s4) var(--s4) var(--s5); gap: 0; } .auth-pitch { display: none; } .scan-art { width: 380px; right: -90px; bottom: -110px; } .auth-brand { font-size: 28px; gap: 14px; } .auth-brand .brand-logo { width: 56px; height: 56px; border-radius: 17px; }
  .auth-panel { justify-content: flex-start; padding: var(--s4) var(--s3); margin-top: -20px; } .auth-card { padding: var(--s4); }
}

.chips[hidden] { display: none; }
.chips .hrs-key { margin-left: 0; padding-left: 0; }

/* Breathing room between the toolbar and whatever follows it (the status chips used to provide it). */
.cal-bar { margin-bottom: var(--s4); }

/* Narrower desktops and tablets: month navigation gets its own row, Employee and Status share the next one. */
@media (max-width: 1180px) and (min-width: 801px) {
  .cal-bar .group > .month-nav { flex: 1 1 100%; justify-content: space-between; }
  .cal-bar .group > label.f, .cal-bar .group > label.f:last-child { flex: 1 1 calc(50% - 8px); }
  .cal-bar { margin-bottom: var(--s3); }
}
/* Sidebar brand never wraps */
.brand { white-space: nowrap; }
@media (max-width: 1024px) and (min-width: 801px) { .brand { font-size: 15px; gap: 10px; padding-inline: 8px; } .brand-logo { width: 30px; height: 30px; } }

.cb-all input::placeholder { color: var(--text); opacity: 1; }

/* ── Settings page ─────────────────────────────────────────────────────────────────────────────── */
.settings-page { max-width: 1120px; }
.set-section { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); gap: var(--s4); padding-block: var(--s5); border-top: 1px solid var(--border); }
.settings-page > .page-header + .set-section { margin-top: var(--s3); }
.settings-page > .page-header + .card { margin-top: var(--s3); }
.set-intro { display: grid; gap: var(--s2); align-content: start; }
.set-intro p { font-size: 13px; line-height: 1.5; max-width: 26ch; }
.set-body { display: grid; gap: 0; padding: 0; }
.set-body > * { padding: var(--s4) var(--s5); }
.set-body > * + * { border-top: 1px solid var(--border); }
.set-group { display: grid; gap: var(--s4); align-content: start; }
.set-group > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.set-form { display: block; }
.set-form .set-section:last-of-type { border-bottom: 0; }
.set-actions { display: flex; justify-content: flex-start; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* A label that wraps to two lines must not push its box down: labels stay at the top, the boxes line up along the bottom. */
.form-grid.three { align-items: stretch; }
.form-grid.three > label.f { grid-template-rows: 1fr auto; }
.days .row { gap: var(--s2); margin-top: 6px; }
.days legend { padding: 0; margin-bottom: 2px; }
fieldset.days { border: 0; padding: 0; margin: 0; min-width: 0; }

.office-list { display: grid; padding: 0 !important; }
.office-list:empty { display: none; }
.office-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); }
.office-row + .office-row { border-top: 1px solid var(--border); }
.office-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.office-main { min-width: 0; } .office-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-main .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.office-tags { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.office-actions { display: flex; gap: var(--s1); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.face { background: var(--face-soft); color: var(--face); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--surface-2); color: var(--muted); }


.form-footer { margin-top: var(--s3); }
@media (max-width: 900px) {
  .set-section { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .set-intro p { max-width: none; }
}
@media (max-width: 640px) {
  .set-body > * { padding: var(--s3); }
  .form-grid.three, .form-grid.two { grid-template-columns: minmax(0, 1fr); }
  .office-row { padding: var(--s3); }
     }

/* ── Colourful icons ───────────────────────────────────────────────────────────────────────────── */
.tone-blue { --tone: var(--t-blue); --tone-bg: var(--t-blue-bg); } .tone-green { --tone: var(--t-green); --tone-bg: var(--t-green-bg); }
.tone-amber { --tone: var(--t-amber); --tone-bg: var(--t-amber-bg); } .tone-red { --tone: var(--t-red); --tone-bg: var(--t-red-bg); }
.tone-violet { --tone: var(--t-violet); --tone-bg: var(--t-violet-bg); } .tone-teal { --tone: var(--t-teal); --tone-bg: var(--t-teal-bg); }
.tone-pink { --tone: var(--t-pink); --tone-bg: var(--t-pink-bg); }
.ic-tile { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--tone-bg); color: var(--tone); }
.ic-tile.sm { width: 28px; height: 28px; border-radius: 8px; } .ic-tile.lg { width: 44px; height: 44px; border-radius: 12px; }

/* sidebar */
nav.side a.nav-link { position: relative; }
.nav-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--tone-bg); color: var(--tone); flex: none; transition: transform var(--fast); }
nav.side a.nav-link:hover .nav-ic { transform: scale(1.08); }
nav.side a.nav-link[aria-current="page"] { background: var(--tone-bg); color: var(--text); font-weight: 600; }
nav.side a.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); }
nav.side a.nav-link[aria-current="page"] .nav-ic { background: var(--surface); box-shadow: var(--shadow-sm); }

/* page title */
.page-title { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.page-title h1 { margin: 0; }

/* overview and detail stats */
.stat-rich { grid-template-columns: 1fr auto; align-items: center; column-gap: var(--s3); row-gap: 2px; border-top: 3px solid var(--tone); transition: transform var(--fast), box-shadow var(--fast); }
.stat-rich:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-rich .l { grid-column: 1; grid-row: 1; } .stat-rich .n { grid-column: 1; grid-row: 2; }
.stat-rich .ic-tile { grid-column: 2; grid-row: 1 / span 2; width: 42px; height: 42px; border-radius: 12px; }

/* initials avatars */
.avatar.tone-blue, .avatar.tone-green, .avatar.tone-amber, .avatar.tone-red, .avatar.tone-violet, .avatar.tone-teal, .avatar.tone-pink { background: var(--tone-bg); color: var(--tone); }
.who-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* settings section headings */
.set-intro .ic-tile { margin-bottom: var(--s1); }

/* empty states and row action icons */
.empty-icon { background: var(--accent-soft); color: var(--accent); }
.empty-error .empty-icon { background: var(--danger-soft); color: var(--danger); }
.btn-ghost.ic-blue { color: var(--t-blue); } .btn-ghost.ic-amber { color: var(--t-amber); }
.btn-ghost.ic-blue:hover { background: var(--t-blue-bg); } .btn-ghost.ic-amber:hover { background: var(--t-amber-bg); }

@media (max-width: 800px) {
  .nav-ic { width: 26px; height: 26px; background: transparent; }
  nav.side a.nav-link[aria-current="page"]::before { display: none; }
  nav.side a.nav-link[aria-current="page"] .nav-ic { background: var(--tone-bg); box-shadow: none; }
  .page-title .ic-tile { width: 32px; height: 32px; border-radius: 9px; }
}
.office-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--t-blue-bg); color: var(--t-blue); font-size: 12px; font-weight: 600; white-space: nowrap; }
/* Label gets the full card width; the icon sits beside the number, so nothing overlaps or wraps early. */
.stats-6 .stat-rich .l { grid-column: 1 / -1; grid-row: 1; } .stats-6 .stat-rich .n { grid-row: 2; align-self: end; } .stats-6 .stat-rich .ic-tile { grid-row: 2; align-self: end; }
@media (min-width: 1000px) { .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stats-6 .stat-rich .ic-tile { width: 34px; height: 34px; border-radius: 10px; } }
@media (min-width: 1400px) { .stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.table-wrap td .who-cell .avatar { width: 40px; height: 40px; font-size: 13px; }
td.ellipsis { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle { color: var(--text-2); } .theme-toggle:hover { color: var(--text); background: var(--surface-2); }
.auth-theme { position: absolute; top: var(--s3); right: var(--s3); z-index: 2; width: 36px; height: 36px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
.auth-panel { position: relative; }

/* Overview: office tabs and the clickable "Available now" card */
.office-tabs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.office-tab { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; transition: background var(--fast), border-color var(--fast), color var(--fast); }
.office-tab:hover { background: var(--surface-2); color: var(--text); }
.office-tab[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.tab-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--t-teal-bg); color: var(--t-teal); font-size: 12px; font-weight: 700; }
.stat-btn { cursor: pointer; }
.stat-btn:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }
.stat-btn.on { box-shadow: 0 0 0 2px var(--tone), var(--shadow-md); }

.table-wrap.compact th, .table-wrap.compact td { padding-inline: 10px; }
.table-wrap.compact th:first-child, .table-wrap.compact td:first-child { padding-left: var(--s3); }
.table-wrap.compact th:last-child, .table-wrap.compact td:last-child { padding-right: var(--s3); }

/* Required-field marker */
.req { color: var(--danger); font-weight: 700; margin-left: 3px; }
.req-note { font-size: 12.5px; color: var(--muted); }
.modal-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ═══ Motion: Overview entrance and live alerts ═══════════════════════════════════════════════════════════ */
.enter .stats-6 > .stat-rich { animation: rise 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.enter .table-wrap tbody tr { animation: rise 360ms var(--ease) both; animation-delay: calc(360ms + var(--r, 0) * 35ms); }
.badge.bump { animation: bump 520ms cubic-bezier(.16, 1, .3, 1); }
@keyframes bump { 0% { transform: scale(.5); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
tr.flash > td { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 25% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }

/* ═══ Recovery code and sign-in links ═════════════════════════════════════════════════════════════════════ */
.link-btn { display: block; margin: var(--s3) auto 0; padding: 4px 8px; background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; border-radius: var(--r-sm); }
.link-btn:hover { text-decoration: underline; } .link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.recovery { display: grid; gap: var(--s3); }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(15px, 3.4vw, 20px); letter-spacing: .06em; font-weight: 650; text-align: center; padding: var(--s4) var(--s3); border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); user-select: all; word-break: break-all; }

/* ═══ Dashboard background: a faint looping Q, bolt and rings (decorative, behind everything) ═══════════════ */
.bg-art { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.layout { position: relative; z-index: 1; }
.bg-q { position: absolute; right: -170px; bottom: -170px; width: 720px; overflow: visible; animation: bg-drift 26s ease-in-out infinite alternate; }
@keyframes bg-drift { from { transform: translate(0, 0) rotate(0); } to { transform: translate(-22px, -16px) rotate(-3deg); } }
.bg-q-shape { stroke: var(--accent); opacity: .07; }
.bg-bolt { fill: #ffb938; stroke: #ffb938; transform-box: fill-box; transform-origin: center; animation: bg-bolt 6s ease-in-out infinite; }
@keyframes bg-bolt { 0%, 100% { opacity: .06; transform: scale(1); } 50% { opacity: .15; transform: scale(1.06); } }
.bg-ping { stroke: var(--accent); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; opacity: 0; animation: bg-ping 9s cubic-bezier(.2, .6, .3, 1) infinite; }
.bg-ping-2 { animation-delay: 3s; } .bg-ping-3 { animation-delay: 6s; }
@keyframes bg-ping { 0% { transform: scale(1); opacity: .16; } 100% { transform: scale(2.4); opacity: 0; } }
.bg-orbit { transform-box: view-box; transform-origin: 100px 100px; animation: bg-orbit 40s linear infinite; }
.bg-orbit circle { fill: var(--accent); opacity: .2; }
@keyframes bg-orbit { to { transform: rotate(360deg); } }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(70px); }
.bg-glow-a { width: 420px; height: 420px; left: 18%; top: -120px; background: color-mix(in srgb, var(--accent) 9%, transparent); animation: bg-glow-a 30s ease-in-out infinite alternate; }
.bg-glow-b { width: 360px; height: 360px; right: 22%; bottom: -100px; background: color-mix(in srgb, #ffb938 7%, transparent); animation: bg-glow-b 34s ease-in-out infinite alternate; }
@keyframes bg-glow-a { to { transform: translate(90px, 70px) scale(1.12); } } @keyframes bg-glow-b { to { transform: translate(-80px, -60px) scale(.92); } }
@media (max-width: 800px) { .bg-q { width: 420px; right: -120px; bottom: 40px; } }

/* ═══ Click motion: ripple, press-in and icon pop on everything pressable (see js/motion.js) ═════════════════ */
nav.side a.nav-link[aria-current="page"] { animation: nav-activate 380ms var(--ease); }
@keyframes nav-activate { from { background-color: transparent; } }
nav.side a.nav-link[aria-current="page"]::before { animation: nav-bar 460ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes nav-bar { from { transform: scaleY(0); opacity: 0; } }
/* `scale` is a separate property, so it combines with any transform an element already has (hover lift, centring). */
button, a.btn, [role="button"], .icon-btn, .office-tab, nav.side a.nav-link { transition-property: background, color, border-color, box-shadow, transform, scale; }
button:not(:disabled):active, a.btn:active, [role="button"]:active, .icon-btn:active, .office-tab:active, nav.side a.nav-link:active { scale: .96; transition-duration: 90ms; }
.fx-pop { animation: fx-pop 480ms cubic-bezier(.3, 1.4, .5, 1); }
@keyframes fx-pop { 0% { scale: 1; rotate: 0deg; } 30% { scale: .8; rotate: -8deg; } 65% { scale: 1.2; rotate: 5deg; } 100% { scale: 1; rotate: 0deg; } }
.fx-ripple { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.fx-ripple-dot { position: absolute; border-radius: 50%; background: var(--tone, var(--accent)); opacity: .22; transform: scale(0); animation: fx-ripple 560ms ease-out forwards; }
.fx-ripple-dot.on-solid { background: #fff; opacity: .35; }
@keyframes fx-ripple { to { transform: scale(1); opacity: 0; } }

/* Buttons under the small forms (password, recovery code): they stay with their form, unlike the sticky save bar of the big settings form. */
.form-actions { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s2); }
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; } .credit a:hover { color: var(--text); }

/* A line saying how many people the list below shows */
.count-line { margin: 0 0 var(--s2); color: var(--muted); font-size: 13px; }
.count-line b { color: var(--text); font-weight: 600; }

/* Overview: late check-ins in two slabs */
.late-section { margin: var(--s4) 0; }
.late-title { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); font-size: 16px; }
.late-slabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--s3); }
.late-slab { padding: var(--s3); }
.late-slab-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.late-slab-head h3 { margin: 0; font-size: 14px; }
.late-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.late-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 8px; border-radius: var(--r-sm); cursor: pointer; }
.late-list li:hover, .late-list li:focus-visible { background: var(--surface-2); }
.late-min { font-weight: 600; font-size: 13px; white-space: nowrap; }
.late-slab.tone-amber .late-min { color: var(--warning); }
.late-slab.tone-red .late-min { color: var(--danger); }
/* A small beating dot while there are late check-ins */
.late-beep { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; }
.late-beep::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--danger); animation: late-beep 1.4s ease-out infinite; }
.late-slab-head .pill { animation: late-pulse 1.4s ease-in-out infinite; }
@keyframes late-beep { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
@keyframes late-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .late-beep::after, .late-slab-head .pill { animation: none; } }
@media (max-width: 760px) { .late-slabs { grid-template-columns: 1fr; } }
.default-pill { margin-left: 8px; vertical-align: 1px; }

/* Hours today for someone in the office: a live, counting figure */
.hours-live { display: inline-flex; align-items: center; gap: 8px; color: var(--success); font-weight: 600; }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--success); animation: live-ping 1.6s ease-out infinite; }
.live-val.tick { animation: live-tick .9s ease-out; }
@keyframes live-ping { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(3); opacity: 0; } }
@keyframes live-tick { 0% { transform: translateY(-4px); opacity: .2; } 40% { opacity: 1; background: var(--success-soft); } 100% { transform: none; background: transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after, .live-val.tick { animation: none; } }

/* Profile pictures: the photo fills the circle, cropped from the centre. Rows grow a little to make room. */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-photo { background: var(--surface-2); }
.avatar-xl { width: 56px; height: 56px; font-size: 18px; }
.table-wrap td .who-cell { padding-block: 3px; }
.photo-field { display: flex; align-items: center; gap: var(--s3); }
.photo-field .avatar { width: 64px; height: 64px; flex: none; }
.photo-field p { margin: 2px 0 0; }
.photo-empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--muted); }

/* Leave balance tables: the current month or quarter stands out */
tr.now td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
td.neg { color: var(--danger); font-weight: 600; }

/* Leave balance: three summary cards and the month table */
.leave-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s3); }
.leave-tile { padding: var(--s3); display: grid; gap: 4px; border-top: 3px solid var(--tone); }
.leave-tile .l { display: flex; align-items: center; gap: 8px; color: var(--tone); font-weight: 600; font-size: 13px; }
.leave-tile .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.leave-tile .big small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.leave-tile .sub { color: var(--muted); font-size: 12.5px; }
th.group { text-align: center; border-left: 1px solid var(--border); }

/* Overview header: the faces of everyone in the office right now */
.ov-here { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 14px; }
.ov-here .faces { display: flex; }
.ov-here .faces .avatar, .ov-here .faces .more { width: 40px; height: 40px; margin-left: -10px; box-shadow: 0 0 0 3px var(--bg); }
.ov-here .faces > :first-child { margin-left: 0; }
.ov-here .faces .more { display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }
.ov-here > span { display: inline-flex; align-items: center; gap: 8px; }

.reason-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(0,0,0,.04)); font-size: 14px; }

/* ── Calendar: name summary, empty-month note, focus, narrow screens ───────────────────────────────────── */
.who-text .sub { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--muted); font-size: 12.5px; }
.who-text .sub > span { display: inline; white-space: nowrap; }
.who-text .sub .n { font-weight: 600; } .who-text .sub .late { color: var(--st-late); } .who-text .sub .absent { color: var(--st-absent); }
.cal-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); color: var(--text-2); }
.cal-single > .cal-note, .cal-wide.fit .cal-body > .cal-note { margin-bottom: var(--s3); background: var(--surface-2); border-radius: var(--r-md); }
.stats-empty { color: var(--muted); font-size: 13.5px; }
.chip .n { margin-left: 2px; }
.hrs-key { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 12.5px; }
.chips .hint .link { background: none; border: 0; padding: 0 2px; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.c:focus-visible, .m-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 2; }
.m-day.st-none { border-style: solid; border-color: transparent; }
.cal-wide .office-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .cal-wide .office-tabs::-webkit-scrollbar { display: none; } .office-tab { flex: none; }
.cal-wide.fit .chips .hint { display: inline; }
@media (max-width: 800px) {
  .t-name { width: 150px; padding-left: var(--s3); padding-right: var(--s2); }
  .dh, .c { min-width: 28px; }
  .m-day .hrs { display: none; }
  .m-day .st { position: absolute; top: auto; right: 4px; bottom: 4px; } .m-day .late-dot { display: none !important; }
  nav.side a.nav-link, nav.side .nav-more { font-size: 11px; }
  nav.side a.nav-link.nav-secondary { display: none; }
  nav.side .nav-more { background: none; border: 0; cursor: pointer; font-family: inherit; font-weight: 500; color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 1; padding: 6px 4px; position: relative; border-radius: var(--r-sm); }
  nav.side .nav-more[aria-current="page"], nav.side .nav-more[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
  .more-sheet { position: fixed; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 40; min-width: 200px; padding: var(--s1); display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
  .more-sheet a.nav-link { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; padding: 10px 12px; font-size: 14px; flex: none; }
  nav.side a.nav-link .badge { font-size: 11px; }
}
.cal-note + .cal-single .stats-empty { display: none; }
.t-days { padding-left: 6px; }

/* "More" is only for the phone's bottom bar. */
@media (min-width: 801px) { .nav-more, .more-sheet { display: none; } }
.more-sheet[hidden] { display: none; }

/* HR checks someone out by hand */
.st-auto_closed { --c: var(--st-incomplete); --bg-c: var(--st-incomplete-bg); }
td.row-action { text-align: right; white-space: nowrap; }
.checkout-action { margin-top: var(--s2); }

/* ── Employee page ───────────────────────────────────────────────────────────────────────────────────── */
.emp-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.emp-page > .back-link { margin-bottom: 0; }
.emp-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); }
.emp-status:empty { display: none; }
.status-text { color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; } .status-text.warn { color: var(--st-late); font-weight: 600; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); margin-bottom: var(--s2); }
.section-head h2 { margin: 0; }
.sub-head { margin: var(--s2) 0 0; font-size: 15px; font-weight: 600; }
.year-label { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }


/* The summary is one strip: figures with hairlines between them, colour only where a count is a problem */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.stat-item { padding: var(--s3) var(--s4); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; min-width: 0; }
.stat-item dt { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-item dd { margin: 4px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-item dd small { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.stat-item.bad dd { color: var(--st-absent); }
.stat-item:nth-child(3).bad dd { color: var(--st-late); }

/* Requests waiting for HR: a tinted panel, no coloured edge */
.callout { background: var(--st-late-bg); border-radius: var(--r-md); padding: var(--s3) var(--s4); display: grid; gap: var(--s2); }
.callout h2 { margin: 0; font-size: 16px; color: var(--st-late); }
.callout-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.callout-list li { display: grid; gap: var(--s1); }
.callout-what { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.callout-reason { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* A folded section */
.disclosure { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.disclosure > summary { cursor: pointer; padding: var(--s3) var(--s4); font-weight: 600; list-style-position: inside; min-height: 44px; display: flex; align-items: center; }
.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.disclosure > :not(summary) { padding: var(--s3) var(--s4) var(--s4); }
.disclosure .table-wrap { box-shadow: none; }

.row-off td { color: var(--muted); }
td.wrap-cell { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
.neg { color: var(--st-absent); }

/* Phones: wide tables become one stacked block per row, and anything pressed is at least 44px */
@media (max-width: 640px) {
  .stackable { overflow: visible; background: none; border: 0; box-shadow: none; border-radius: 0; }
  .stackable table, .stackable tbody, .stackable tr, .stackable td { display: block; }
  .stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stackable tbody tr { padding: var(--s2) var(--s3); margin-bottom: var(--s2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
  .stackable tbody tr.empty-row { padding: 0; border: 0; background: none; }
  .stackable td, .stackable td:first-child, .stackable td:last-child { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: 5px 0; border: 0; text-align: right; white-space: normal; min-width: 0; }
  .stackable td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12.5px; text-align: left; }
  .stackable td:first-child { font-weight: 600; color: var(--text); }
  .stackable td.empty-cell::before, .stackable .empty-row td::before { content: none; }
  .stackable td .row { justify-content: flex-end; }
  .stackable td.dash { display: none; }
  .stackable td:first-child::before { content: none; }
  .stackable td:first-child { justify-content: flex-start; padding-bottom: 6px; }
  .stackable td > div { text-align: right; }
  .stackable td .sub { margin: 0; }
}
@media (max-width: 800px), (pointer: coarse) {
  .icon-btn { min-width: 44px; min-height: 44px; }
  .chip { min-height: 44px; }
  .month-nav { height: 48px; } .month-nav .btn { width: 44px; height: 44px; }
  .credit a { display: inline-block; padding: 14px 6px; }
  .btn, .btn-sm { min-height: 44px; }
  input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; }
  .back-link { display: inline-flex; align-items: center; min-height: 44px; }
  .seg-btn { min-height: 44px; min-width: 44px; }
}

/* ── Employee page, round 2 ──────────────────────────────────────────────────────────────────────────── */
/* One control for the period: step back, three presets, step forward. The exact dates are a second step. */
.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.seg-btn { background: none; border: 0; border-right: 1px solid var(--border); padding: 0 14px; min-height: 40px; min-width: 40px; font: 500 14px var(--font); color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; border-radius: 0; }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg-btn:disabled { color: var(--muted); opacity: .5; cursor: default; }
.seg-btn:focus-visible { outline-offset: -3px; }
.range-label { margin: 0; color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; }

/* The verdict: how the period went, in a sentence */
.verdict { margin: 0; font-size: 17px; line-height: 1.45; color: var(--text); max-width: 70ch; text-wrap: pretty; }
.strip-hint { margin: calc(var(--s2) * -1) 0 0; }
.stat-item { position: relative; }
.stat-pick { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.stat-pick::after { content: ""; position: absolute; inset: 0; }
.stat-pick:focus-visible { outline: none; }
.stat-pick:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: var(--r-sm); }
.stat-item.pickable:hover { background: var(--surface-2); }
.stat-item.on { background: var(--accent-soft); }
.stat-item.on dt { color: var(--accent); font-weight: 600; }

/* The chart's colour key */
.chart-key { flex-wrap: wrap; gap: 6px 12px; }
.key-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-key .swatch { display: inline-block; width: 10px; height: 10px; border: 0; border-radius: 3px; }

.chart-fold > summary { font-weight: 600; }
.chart-fold > div { padding: var(--s2); }
.chart-fold .card { border: 0; box-shadow: none; padding: 0; }

/* Phones: each day is two short lines (date and status, then times and hours) instead of five */
.times-sm { display: none; }
@media (max-width: 640px) {
  .range-bar .seg { width: 100%; } .range-bar .seg-btn { flex: 1; }
  .seg-btn { min-height: 44px; min-width: 44px; }
  .chart-fold .card-title h2 { display: none; }
  .range-bar .seg-step { flex: 0 0 48px; }
  .table-wrap.compact-rows tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: var(--s3); row-gap: 2px; padding: 10px 14px; }
  .table-wrap.compact-rows td { display: block; padding: 0; text-align: left; border: 0; }
  .table-wrap.compact-rows td::before { content: none; }
  .table-wrap.compact-rows td[data-label="Date"] { grid-column: 1; grid-row: 1; font-weight: 600; color: var(--text); }
  .table-wrap.compact-rows td[data-label="Status"] { grid-column: 2; grid-row: 1; justify-self: end; }
  .table-wrap.compact-rows td.times-sm { display: block; grid-column: 1; grid-row: 2; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; align-self: end; }
  .table-wrap.compact-rows td.times-sm.dash { display: none; }
  .table-wrap.compact-rows td[data-label="In"], .table-wrap.compact-rows td[data-label="Out"] { display: none; }
  .table-wrap.compact-rows td[data-label="Hours"] { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; }
  .table-wrap.compact-rows td[data-label="Hours"].dash { display: none; }
  .table-wrap.compact-rows td .row { justify-content: flex-end; }
  .table-wrap.compact-rows tbody tr.empty-row { display: block; }
}

/* Employee header and period bar, laid out on one rhythm: 8 / 16 / 24, every control 40px tall */
.emp-head { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s4); align-items: start; }
.emp-head .emp-avatar .avatar { width: 72px; height: 72px; font-size: 24px; }
.emp-head-text { min-width: 0; display: grid; align-content: start; }
.emp-head h1 { margin: 0; line-height: 1.15; }
.emp-meta { margin: var(--s1) 0 0; color: var(--muted); font-size: 15px; }
.emp-meta:empty { display: none; }
.range-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); padding: var(--s3) 0; border-block: 1px solid var(--border); }
.range-bar .f { display: grid; gap: 6px; min-width: 0; }
.range-bar .f-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.range-bar input[type="date"] { height: 40px; width: 160px; }
.seg-btn { min-height: 40px; }
.seg { height: 40px; }
@media (max-width: 640px) {
  .emp-head { column-gap: var(--s3); }
  .emp-head .emp-avatar .avatar { width: 56px; height: 56px; font-size: 20px; }
  .emp-head h1 { font-size: 24px; }
  .range-bar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .range-bar > .f:first-child { grid-column: 1 / -1; }
  .range-bar .f:first-child .seg { width: 100%; height: auto; }
  .range-bar .seg-btn { min-height: 44px; }
  .range-bar input[type="date"] { width: 100%; height: 44px; }
}

/* ═══ Date picker (js/datepicker.js): replaces the browser's <input type="date"> popup ═══════════════════ */
.dp { position: relative; }
.dp-trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); width: 100%; height: 36px; padding: 0 12px; text-align: left;
  font: 400 14px/1.4 var(--font); letter-spacing: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast); }
.dp-trigger:hover { border-color: var(--muted); }
.dp-trigger:focus-visible, .dp-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: var(--ring); }
.dp-trigger .icon { color: var(--muted); }
.dp-trigger.placeholder .dp-text { color: var(--muted); }
.dp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp:has(.dp-clear:not([hidden])) .dp-trigger { padding-right: 40px; }
.dp-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.dp-pop { position: absolute; z-index: 70; top: calc(100% + 6px); left: 0; width: 296px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: pop 140ms var(--ease); }
.dp-pop.align-right { left: auto; right: 0; }
.dp-pop.above { top: auto; bottom: calc(100% + 6px); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head .icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.dp-title { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.dp-week, .dp-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week { margin-bottom: 4px; }
.dp-week span { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0; }
.dp-grid { display: grid; gap: 2px; }
.dp-day { height: 36px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: 500 13.5px/1 var(--font); font-variant-numeric: tabular-nums;
  cursor: pointer; transition: background var(--fast), color var(--fast); }
.dp-day:hover:not(:disabled):not(.selected) { background: var(--surface-2); }
.dp-day.out { color: var(--muted); opacity: .55; }
.dp-day.today:not(.selected) { color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--accent); }
.dp-day.selected { background: var(--accent); color: var(--on-accent); font-weight: 600; opacity: 1; }
.dp-day:disabled { opacity: .28; cursor: not-allowed; }
.dp-day:focus-visible { box-shadow: var(--ring); }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dp-link { border: 0; background: transparent; color: var(--accent); font: 500 13.5px/1 var(--font); padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.dp-link:hover:not(:disabled) { background: var(--accent-soft); }
.dp-link:disabled { color: var(--muted); opacity: .5; cursor: not-allowed; }
@media (max-width: 420px) { .dp-pop { width: min(296px, calc(100vw - 32px)); } }

/* Date pickers inside the employee page's period bar match the other 40px controls */
.range-bar .dp-trigger { height: 40px; width: 160px; }
@media (max-width: 640px) { .range-bar .dp-trigger { width: 100%; height: 44px; } }
