/* ==========================================================================
   Face Attendance Portal: Digital Waves design system
   Layout: dark navy navigation rail on the left, light working canvas on the right.
   Colours are the Digital Waves tokens sampled from the logo; never hand-pick new ones.
   ========================================================================== */

:root {
  /* Digital Waves brand — stops sampled from the app icon gradient
     (deep navy #003056 → ocean #0A7180 → teal #13A097 → bright #1DC2A2). */
  --navy: #0C4A63;
  --navy-deep: #003056;
  --navy-ink: #04243B;
  --ocean: #0A7180;
  --teal: #13A097;
  --mint: #1DC2A2;
  --slate: #3E4C56;
  --fog: #EAF1F4;
  --paper: #F7FAFB;
  --white: #FFFFFF;
  --line: rgba(10, 72, 99, 0.14);
  --line-strong: rgba(10, 72, 99, 0.24);
  --grad-wave: linear-gradient(120deg, var(--navy-deep) 0%, var(--ocean) 45%, var(--teal) 72%, var(--mint) 100%);

  /* Semantic states (kept separate from the brand accent) */
  --ok: #2F8A6E;        --ok-soft: #E3F3EC;
  --warn: #A86A12;      --warn-soft: #FBF0DD;
  --danger: #B23A3A;    --danger-soft: #F8E5E5;
  --info: #2E7EA0;      --info-soft: #E2F0F6;
  --muted: #6B7C87;     --muted-soft: #EEF2F4;

  --text: #0B2233;
  --text-2: #3E4C56;
  --text-3: #6B7C87;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --font-arabic: "Tajawal", "Segoe UI", sans-serif;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-1: 0 1px 2px rgba(9, 42, 66, 0.06), 0 1px 1px rgba(9, 42, 66, 0.04);
  --shadow-2: 0 10px 30px rgba(9, 42, 66, 0.12), 0 2px 6px rgba(9, 42, 66, 0.08);
  --rail: 252px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy-deep); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15.5px; font-weight: 600; }
p { margin: 0; }
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
/* Blazor moves focus to the page title after navigation for screen readers; no visible box is needed there. */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus { outline: none; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.arabic { font-family: var(--font-arabic); direction: rtl; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
svg.ico-sm { width: 14px; height: 14px; vertical-align: -2px; flex: 0 0 auto; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ocean);
  font-weight: 500;
}
.wave-rule { height: 3px; background: var(--grad-wave); border: 0; margin: 0; }

/* ---------- App frame (app-shell: header / sidebar / content / footer) ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header header"
    "sidebar content"
    "footer footer";
  height: 100vh;
}

/* Full-width header — the dark brand frame across the top. */
.app-header {
  grid-area: header; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; min-height: 60px;
  background: var(--navy-deep); color: #C9DCE6;
  border-bottom: 3px solid transparent; border-image: var(--grad-wave) 1;
}
.app-header .brand { padding: 0; gap: 10px; margin-right: 4px; }
.app-header .brand img { width: 38px; }
.app-header .menu-btn { display: inline-flex; color: #C9DCE6; }
.app-header .menu-btn:hover { background: rgba(255,255,255,.08); }
.app-header .muted { color: #8FB0C2; }
.app-header .who .name { color: #E4EEF3; }
.app-header .btn.ghost { color: #C9DCE6; }
.app-header .btn.ghost:hover { background: rgba(255,255,255,.08); }
.app-header .avatar { background: rgba(255,255,255,.12); color: #fff; }

.rail {
  grid-area: sidebar;
  background: var(--navy-deep);
  color: #C9DCE6;
  border-right: 1px solid var(--navy-ink);
  overflow-y: auto;
}

/* Desktop: the header burger collapses the sidebar (content goes full width). */
.app.rail-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "content" "footer"; }
.app.rail-collapsed .rail { display: none; }

/* Read-only (Viewer role): disable the mutating controls, keep view / search / filter / export working. */
.app.readonly-user .btn.primary,
.app.readonly-user .btn.accent,
.app.readonly-user .btn.danger,
.app.readonly-user .btn.warn,
.app.readonly-user .row-actions .btn,
.app.readonly-user .card-foot .btn,
.app.readonly-user .modal input:not([type="search"]),
.app.readonly-user .modal select,
.app.readonly-user .modal textarea { pointer-events: none !important; opacity: .5 !important; cursor: not-allowed; }

/* ---------- Scrollbars (thin, branded — replaces the chunky classic bars) ---------- */
* { scrollbar-width: thin; scrollbar-color: #c2cdd6 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c2cdd6; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #9fb0bb; }
.rail { scrollbar-color: rgba(255,255,255,.2) transparent; }
.rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border: 2px solid transparent; background-clip: padding-box; }
.rail::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.34); }
.facethumb { padding: 0; border: none; background: none; cursor: pointer; line-height: 0; border-radius: 8px; }
.facethumb img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; display: block; transition: transform .12s ease; }
.facethumb:hover img { transform: scale(1.08); box-shadow: var(--e-2, 0 4px 14px rgba(9,35,52,.18)); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 46px; height: auto; flex: 0 0 auto; }
.brand-name { font-family: var(--font-display); font-weight: 700; color: var(--white); font-size: 15.5px; letter-spacing: 0.04em; line-height: 1.1; }
.brand-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); margin-top: 3px; }
.nav { padding: 14px 12px 24px; display: grid; gap: 2px; }
.nav-group { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: #6F93A8; padding: 18px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius);
  color: #C9DCE6; font-weight: 500; font-size: 14px;
  text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: 0.85; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: var(--white); }
.nav a.active { background: rgba(58, 172, 190, 0.16); color: var(--white); }
.nav a.active svg { color: var(--teal); opacity: 1; }
.nav .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; background: rgba(255,255,255,0.1); color: #E4EEF3; padding: 1px 7px; border-radius: 999px; }
/* Full-width footer — the developer credit, part of the dark frame. */
.app-footer {
  grid-area: footer; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap;
  padding: 8px 20px; min-height: 46px;
  background: var(--navy-deep); border-top: 1px solid var(--navy-ink);
  color: #7E9FB2; font-size: 12px;
}
.app-footer .dev-credit { display: flex; align-items: center; gap: 10px; }
.app-footer .dev-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: rgba(255,255,255,.06); padding: 3px; flex: none; }
.app-footer .dev-text { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.app-footer .dev-by { color: #C9DCE6; }
.app-footer .dev-by b { color: #fff; font-weight: 700; }
.app-footer .dev-rights { color: #7E9FB2; font-variant-numeric: tabular-nums; }
.app-footer .foot-legal { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.app-footer .foot-legal .arabic { font-size: 13px; color: #A9C3D1; }

.content { grid-area: content; overflow-y: auto; padding: 26px 28px 40px; width: 100%; max-width: none; }

/* Detail-page identity header (photo + name + pills + actions). */
.detail-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.detail-hero .photo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.detail-hero .photo .ph { width: 104px; height: 104px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); background: var(--fog); font-size: 34px; }
.detail-hero .info { min-width: 0; flex: 1 1 240px; }
.detail-hero .info h1 { margin: 6px 0 4px; overflow-wrap: anywhere; }
.detail-hero .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

.page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px 20px; margin-bottom: 22px; }
.page-head .titles { min-width: 0; flex: 1 1 320px; }
.page-head h1 { margin-top: 4px; }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 70ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Surfaces ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15.5px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.stack { display: grid; gap: 18px; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* KPI stat cards: separated, with an icon badge and a hover lift. */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; padding: 16px; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); transition: transform .12s ease, box-shadow .12s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.kpi .ico { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.kpi .ico svg { width: 17px; height: 17px; }
.kpi .ico.a-teal { background: rgba(19,160,151,.12); color: #0d7d72; }
.kpi .ico.a-blue { background: rgba(10,113,128,.12); color: #0a7180; }
.kpi .ico.a-mint { background: rgba(29,194,162,.14); color: #11a085; }
.kpi .ico.a-navy { background: rgba(0,48,86,.09); color: #0b2233; }
.kpi .ico.a-amber { background: rgba(201,154,46,.16); color: #9a6b16; }
.kpi .label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding-right: 38px; }
.kpi .value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--navy-deep); margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .value small { font-size: 14px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.kpi .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.kpi .bar { height: 5px; background: var(--fog); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.kpi .bar span { display: block; height: 100%; background: var(--grad-wave); border-radius: 999px; transition: width .4s ease; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--white); color: var(--navy-deep);
  font: 600 13.5px var(--font-body); cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--fog); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn.primary:hover { background: var(--navy-deep); }
.btn.accent { background: var(--ocean); border-color: var(--ocean); color: var(--white); }
.btn.accent:hover { background: #267E9B; }
.btn.danger { color: var(--danger); border-color: rgba(178, 58, 58, 0.35); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--fog); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid + .form-grid { margin-top: 14px; }
/* Consistent section sub-header inside a form/modal (replaces ad-hoc <h3> styling). */
.form-section { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; }
/* inline help text / links inside a section header stay normal-case and lighter */
.form-section .muted, .form-section a, .form-section small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label-text { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--white); color: var(--text);
  font: 400 14px var(--font-body);
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(58, 172, 190, 0.18); }
.input.mono { font-family: var(--font-mono); }
.input.invalid, .invalid.input { border-color: var(--danger); }
/* Form-alignment sweep: unify the native controls so every form lines up the same way. */
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23617E8E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="color"].input { padding: 3px; cursor: pointer; }
input[type="color"].input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].input::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type="time"].input, input[type="date"].input, input[type="datetime-local"].input { padding-right: 9px; }
input[type="number"].input { text-align: left; }
.validation-message { color: var(--danger); font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ocean); flex: 0 0 auto; }
.check .t { font-weight: 600; font-size: 13.5px; color: var(--text); }
.check .d { font-size: 12.5px; color: var(--text-3); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #FBFDFD; }
.toolbar .input { width: auto; min-width: 150px; height: 34px; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--text-3); }
.search .input { padding-left: 34px; width: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; padding: 10px 14px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); background: #FBFDFD; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #F6FAFB; }
.table tr.clickable { cursor: pointer; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .sel { width: 34px; text-align: center; padding-left: 10px; padding-right: 6px; }
.table .sel input { accent-color: var(--ocean); cursor: pointer; }
.table tbody tr.selected { background: var(--info-soft); }
.cap { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--text-3); }
.cap svg { width: 13px; height: 13px; }
.table tbody tr.selected:hover { background: var(--info-soft); }
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 26px; height: 26px; color: var(--teal); opacity: 1; padding: 15px; background: rgba(19,160,151,.1); border-radius: 50%; box-sizing: content-box; margin-bottom: 4px; }
.empty strong { color: var(--navy-deep); font-family: var(--font-display); font-size: 15.5px; }

/* Skeleton loaders (shimmer) — replace bare spinners while content loads. */
.skeleton { position: relative; overflow: hidden; background: var(--fog); border-radius: 6px; display: inline-block; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; }
.sk-circle { width: 34px; height: 34px; border-radius: 50%; flex: none; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.muted { background: var(--muted-soft); color: var(--muted); }
.pill.live::before { animation: pulse 1.6s ease-in-out infinite; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--fog); color: var(--navy); white-space: nowrap; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- People ---------- */
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .who { min-width: 0; }
.person .name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { position: relative; width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; background: var(--fog); border: 1px solid var(--line); display: inline-grid; place-items: center; font: 600 13px var(--font-display); color: var(--navy); overflow: hidden; }
.avatar.lg { width: 72px; height: 72px; border-radius: 12px; font-size: 22px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* The captured punch photo wins over the enrolled photo (it's what actually happened at that punch). */
.avatar img.cap-img { z-index: 2; }
/* GPS pin for a punch location (opens a map) */
.geo-pin { display: inline-flex; align-items: center; gap: 4px; color: var(--teal, #3AACBE); text-decoration: none; vertical-align: middle; }
.geo-pin:hover { color: var(--navy, #0D3F60); }
.geo-pin svg { width: 14px; height: 14px; }
.geo-pin { cursor: pointer; }
.geo-meta { display: flex; flex-direction: column; gap: 2px; }
.geo-map { width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 10px; display: block; }
.avatar.zoomable { cursor: zoom-in; }
.avatar.zoomable::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 8px; height: 8px; z-index: 3; border-radius: 2px; background: var(--ok, #2e9e6a); box-shadow: 0 0 0 1.5px #fff; }
/* Click-to-enlarge overlay for a captured punch photo */
.pcap-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(13,27,42,.6); display: grid; place-items: center; backdrop-filter: blur(2px); }
.pcap-box { position: relative; background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-width: min(92vw, 440px); }
.pcap-box img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 8px; background: var(--fog); }
.pcap-cap { display: flex; flex-direction: column; gap: 2px; padding: 10px 6px 4px; font-size: 13px; }
.pcap-cap span { color: var(--muted); font-variant-numeric: tabular-nums; }
.pcap-x { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border: none; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 14px; cursor: pointer; }
.pcap-x:hover { background: rgba(0,0,0,.65); }
.pcap-src { color: var(--muted); font-size: 12px; }
/* Initials placeholder shown when neither the capture nor the enrolled face could be loaded. */
.pcap-fallback { display: none; width: 100%; aspect-ratio: 1; border-radius: 8px; background: var(--fog);
    color: var(--muted); font-weight: 700; font-size: 64px; letter-spacing: 1px; place-items: center; }
.pcap-box.noimg .pcap-fallback { display: grid; }
/* Portal-wide loading cue */
.busybar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1200; background: transparent; overflow: hidden; pointer-events: none; }
.busybar.on::before { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 0 3px 3px 0; background: linear-gradient(90deg, var(--ocean, #2E90B0), var(--teal, #3AACBE), var(--mint, #42A085)); animation: busyslide 1.05s ease-in-out infinite; }
@keyframes busyslide { 0% { left: -40%; } 100% { left: 100%; } }
.busychip { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1201; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--navy, #0D3F60); color: #fff; font-size: 12.5px; font-weight: 600; box-shadow: 0 6px 20px rgba(13,63,96,.3); pointer-events: none; animation: busychipin .18s ease-out; }
.busychip .spinner { width: 13px; height: 13px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes busychipin { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 600 13.5px var(--font-body); color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--navy); }
.tabs button.active { color: var(--navy-deep); border-bottom-color: var(--ocean); }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li.fresh { animation: fresh 2.4s ease-out; }
.feed .when { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.feed .when b { display: block; font-family: var(--font-mono); font-size: 13px; color: var(--navy-deep); font-weight: 500; }
@keyframes fresh { from { background: rgba(66, 160, 133, 0.16); } to { background: transparent; } }

/* ---------- Terminal tiles ---------- */
.terminals { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.terminal { padding: 16px 18px; display: grid; gap: 12px; text-decoration: none; color: inherit; }
.terminal:hover { border-color: var(--teal); text-decoration: none; }
.terminal .top { display: flex; gap: 12px; align-items: center; }
.terminal .device { width: 40px; height: 40px; border-radius: 8px; background: var(--fog); display: grid; place-items: center; color: var(--navy); flex: 0 0 auto; }
.terminal .device svg { width: 22px; height: 22px; }
.terminal dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 12.5px; }
.terminal dt { color: var(--text-3); }
.terminal dd { margin: 0; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Definition lists ---------- */
.dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 9px 18px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* Two label/value pairs per row on wide screens (used on full-width detail panels) */
.dl-2 { grid-template-columns: minmax(110px, auto) minmax(0, 1fr) minmax(110px, auto) minmax(0, 1fr); column-gap: 28px; }
@media (max-width: 720px) { .dl-2 { grid-template-columns: minmax(110px, auto) 1fr; } }

/* ---------- Notices ---------- */
.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid; align-items: flex-start; }
.notice svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.notice.info { background: var(--info-soft); border-color: rgba(46,126,160,.25); color: #1E5B74; }
.notice.warn { background: var(--warn-soft); border-color: rgba(168,106,18,.28); color: #7A4C0B; }
.notice.danger { background: var(--danger-soft); border-color: rgba(178,58,58,.28); color: #852A2A; }
.notice.ok { background: var(--ok-soft); border-color: rgba(47,138,110,.28); color: #1F6450; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Face enrolment ---------- */
.face-panel { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.face-frame { width: 220px; aspect-ratio: 1; border-radius: 12px; background: var(--fog); border: 1px dashed var(--line-strong); display: grid; place-items: center; overflow: hidden; position: relative; }
.face-frame img { width: 100%; height: 100%; object-fit: cover; }
.face-frame .placeholder { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 16px; display: grid; gap: 8px; justify-items: center; }
.face-frame .placeholder svg { width: 40px; height: 40px; color: var(--teal); }
.dropzone { position: relative; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 18px; text-align: center; color: var(--text-2); background: #FBFDFD; }
.dropzone:hover { border-color: var(--teal); background: #F3FAFB; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone svg { width: 22px; height: 22px; vertical-align: -5px; margin-right: 6px; color: var(--ocean); }
.webcam { position: relative; width: 100%; max-width: 520px; aspect-ratio: 4 / 3; background: var(--navy-ink); border-radius: var(--radius-lg); overflow: hidden; }
.webcam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.webcam .guide { position: absolute; inset: 14% 28%; border: 2px solid rgba(255,255,255,.7); border-radius: 46% 46% 42% 42%; pointer-events: none; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 30, 48, 0.48); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--white); border-radius: 12px; box-shadow: var(--shadow-2); }
.modal.wide { width: min(820px, 100%); }
.modal.xwide { width: min(1180px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--navy-deep); color: #E8F1F5; box-shadow: var(--shadow-2); font-size: 13.5px; animation: toast-in .18s ease-out; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--mint); }
.toast.Error .dot { background: #F07B7B; }
.toast.Warning .dot { background: #F0B75A; }
.toast.Info .dot { background: var(--teal); }
.toast button { margin-left: auto; background: none; border: 0; color: #9DB8C6; cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }

/* ---------- Misc ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(46,144,176,.25); border-top-color: var(--ocean); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
.btn .spinner { width: 14px; height: 14px; border-color: rgba(255,255,255,.35); border-top-color: currentColor; }
@keyframes spin { to { rotate: 360deg; } }
.boot { min-height: 60vh; display: grid; place-items: center; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.kbd { font-family: var(--font-mono); font-size: 11.5px; background: var(--fog); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.chart-bars .b { flex: 1 1 0; display: grid; gap: 6px; justify-items: center; align-content: end; height: 100%; min-width: 0; }
.chart-bars .b span { width: 100%; max-width: 34px; background: var(--grad-wave); border-radius: 5px 5px 2px 2px; min-height: 2px; transition: height .4s ease, filter .12s ease; }
.chart-bars .b:hover span { filter: brightness(1.1) saturate(1.1); }
.chart-bars .b em { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.chart-bars .b strong { font-size: 11.5px; color: var(--navy-deep); font-variant-numeric: tabular-nums; }
.chart-bars .b em.date { font-size: 9.5px; color: var(--text-3); opacity: 0.8; margin-top: -4px; }
.table tbody tr.fresh { animation: fresh 2.4s ease-out; }

/* Device-style configuration editor */
.cfg-sections { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.cfg-sections button { border: 1px solid var(--line); background: #fff; color: var(--text-2); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.cfg-sections button:hover { border-color: var(--ocean); color: var(--navy-deep); }
.cfg-sections button.active { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }
.cfg-body { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.cfg-body.single { grid-template-columns: 1fr; }
.cfg-subnav { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 8px; }
.cfg-subnav button { text-align: left; border: 0; background: transparent; color: var(--text-2); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; border-left: 3px solid transparent; }
.cfg-subnav button:hover { background: var(--fog); }
.cfg-subnav button.active { background: var(--fog); color: var(--navy-deep); font-weight: 600; border-left-color: var(--ocean); }
.cfg-form { max-width: 620px; }
.cfg-group-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 0 0 4px; }
.cfg-row { display: flex; align-items: center; gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.cfg-row:last-child { border-bottom: 0; }
.cfg-row > label { flex: 0 0 210px; font-size: 13.5px; color: var(--text-2); }
.cfg-row .cfg-control { flex: 1; display: flex; align-items: center; gap: 8px; max-width: 320px; }
.cfg-row .cfg-control .input { margin: 0; }
.cfg-row .cfg-val { font-family: var(--font-mono); font-size: 13px; color: var(--navy-deep); }
.cfg-row.changed { background: var(--info-soft); border-radius: 6px; }
.cfg-row .unit { color: var(--text-3); font-size: 12px; }
.cfg-time { display: inline-flex; align-items: center; gap: 4px; }
.cfg-time input { width: 52px; text-align: center; }
.cfg-time .sep { color: var(--text-3); }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: #cbd5db; border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle .track::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + .track { background: var(--mint); }
.toggle input:checked + .track::before { transform: translateX(18px); }
@media (max-width: 720px) { .cfg-body { grid-template-columns: 1fr; } .cfg-subnav { flex-direction: row; flex-wrap: wrap; } .cfg-row { flex-wrap: wrap; } .cfg-row > label { flex-basis: 100%; } }
.photo-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: var(--fog); }
.blazor-error-boundary { background: var(--danger-soft); color: var(--danger); padding: 14px; border-radius: var(--radius); }
#blazor-error-ui { display: none; }

/* ---------- Sign-in ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr); background: var(--white); }
.auth-hero { position: relative; overflow: hidden; background: var(--navy-deep); color: #D7E6EE; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--grad-wave); }
.auth-hero .pixels { position: absolute; right: -40px; top: -20px; width: 520px; opacity: 0.55; pointer-events: none; }
.auth-hero .mark { width: 110px; position: relative; }
.auth-hero h1 { color: var(--white); font-size: clamp(30px, 3.6vw, 46px); line-height: 1.08; max-width: 14ch; position: relative; }
.auth-hero .lede { font-size: 16px; max-width: 46ch; color: #B7CEDA; margin-top: 16px; position: relative; }
.auth-hero .arabic-title { font-family: "Cairo", var(--font-arabic); font-weight: 700; font-size: 24px; color: #9FD3DC; margin-top: 18px; position: relative; text-align: right; max-width: 30ch; margin-left: auto; }
.auth-hero .facts { display: flex; gap: 28px; flex-wrap: wrap; position: relative; }
.auth-hero .facts div { font-size: 12.5px; color: #8FB0C2; }
.auth-hero .facts b { display: block; font-family: var(--font-display); color: var(--white); font-size: 20px; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-card .logo { width: 230px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .btn { height: 42px; font-size: 14.5px; }

/* ---------- Kiosk ---------- */
.kiosk { position: fixed; inset: 0; background: radial-gradient(1200px 700px at 70% -10%, #13527A 0%, var(--navy-deep) 55%, var(--navy-ink) 100%); color: var(--white); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.kiosk-top { display: flex; align-items: center; gap: 16px; padding: 18px 28px; }
.kiosk-top img { width: 52px; }
.kiosk-top .t { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: .04em; }
.kiosk-top .s { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); }
.kiosk-clock { margin-left: auto; text-align: right; }
.kiosk-clock b { display: block; font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kiosk-clock span { font-size: 14px; color: #A9C3D1; }
.kiosk-exit { margin-left: 18px; }
.kiosk-exit button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #A9C3D1;
    font-size: 13px; cursor: pointer; transition: background .15s, color .15s; }
.kiosk-exit button:hover { background: rgba(240,123,123,.18); border-color: rgba(240,123,123,.4); color: #fff; }
.kiosk-exit svg { width: 18px; height: 18px; }
.kiosk-stage { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr); gap: 32px; padding: 8px 28px 20px; min-height: 0; }
.kiosk-cam { position: relative; border-radius: 22px; overflow: hidden; background: #03131F; box-shadow: 0 30px 80px rgba(0,0,0,.45); min-height: 0; }
.kiosk-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.kiosk-cam .ring { position: absolute; border: 3px solid rgba(255,255,255,.55); border-radius: 18px; transition: all .18s ease-out; box-shadow: 0 0 0 9999px rgba(3, 19, 31, 0.28); }
.kiosk-cam .ring.ok { border-color: var(--mint); }
.kiosk-cam .ring.bad { border-color: #F07B7B; }
.kiosk-cam .kiosk-oval { position: absolute; left: 50%; top: 48%; transform: translate(-50%,-50%); width: min(34vh, 320px); height: min(46vh, 430px); border: 3px solid rgba(255,255,255,.6); border-radius: 50% / 60%; box-shadow: 0 0 0 2000px rgba(3,19,31,.28); pointer-events: none; transition: border-color .2s ease; }
.kiosk-cam .kiosk-oval.ok { border-color: var(--mint); }
.kiosk-cam .kiosk-oval.bad { border-color: #F07B7B; }
.kiosk-cam .arrow { position: absolute; top: 50%; translate: 0 -50%; width: 120px; height: 120px; display: grid; place-items: center; border-radius: 50%; background: rgba(58,172,190,.92); color: var(--white); animation: nudge 1s ease-in-out infinite; }
.kiosk-cam .arrow svg { width: 64px; height: 64px; }
.kiosk-cam .arrow.left { left: 28px; }
.kiosk-cam .arrow.right { right: 28px; }
@keyframes nudge { 0%, 100% { translate: 0 -50%; } 50% { translate: var(--nudge, 0) -50%; } }
.kiosk-cam .arrow.left { --nudge: -10px; }
.kiosk-cam .arrow.right { --nudge: 10px; }
.kiosk-cam .kiosk-flip { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; background: rgba(3,19,31,.55); color: #fff; }
.kiosk-cam .kiosk-flip:hover { background: rgba(3,19,31,.8); }
.kiosk-cam .kiosk-flip svg { width: 22px; height: 22px; }
.kiosk-side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.kiosk-status { border-radius: 22px; padding: 30px 28px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); display: grid; gap: 14px; }
.kiosk-status .phase { font-family: var(--font-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); }
.kiosk-status h2 { color: var(--white); font-size: clamp(28px, 3vw, 40px); line-height: 1.1; }
.kiosk-status p { color: #B7CEDA; font-size: 17px; }
.kiosk-status.recorded { background: rgba(66,160,133,.22); border-color: rgba(66,160,133,.55); }
.kiosk-status.recorded .phase { color: #8EE0C3; }
.kiosk-status.failed { background: rgba(240,123,123,.14); border-color: rgba(240,123,123,.4); }
.kiosk-who { display: flex; gap: 16px; align-items: center; }
.kiosk-who img, .kiosk-who .avatar { width: 84px; height: 84px; border-radius: 16px; border: 2px solid rgba(255,255,255,.25); }
.kiosk-who b { font-family: var(--font-display); font-size: 22px; display: block; }
.kiosk-who span { color: #A9C3D1; font-family: var(--font-mono); font-size: 13px; }
.kiosk-funcs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 6px; }
.kiosk-funcs:has(.kiosk-func:only-child) { grid-template-columns: 1fr; }
.kiosk-func { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px 14px;
    border-radius: 16px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.07); color: var(--white);
    font-family: var(--font-display); font-size: 19px; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; }
.kiosk-func svg { width: 30px; height: 30px; color: var(--teal); }
.kiosk-func:hover { background: rgba(66,160,133,.22); border-color: rgba(66,160,133,.6); }
.kiosk-func:active { transform: scale(.97); }
.kiosk-recent { border-radius: 18px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); padding: 14px 18px; overflow: hidden; min-height: 0; }
.kiosk-recent h3 { color: #A9C3D1; font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 500; margin-bottom: 8px; }
.kiosk-recent div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 15px; }
.kiosk-recent div:last-child { border-bottom: 0; }
.kiosk-recent em { font-style: normal; font-family: var(--font-mono); color: #8EE0C3; }
.kiosk-log { width: 100%; border-collapse: collapse; font-size: 14px; }
.kiosk-log th { text-align: left; color: #A9C3D1; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; padding: 4px 10px 8px 0; border-bottom: 1px solid rgba(255,255,255,.14); }
.kiosk-log td { padding: 7px 10px 7px 0; border-bottom: 1px solid rgba(255,255,255,.06); color: #D7E6EE; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kiosk-log tr:last-child td { border-bottom: 0; }
.kiosk-log th:first-child, .kiosk-log td:first-child { color: #7E9FB2; width: 1%; }
.kiosk-log td:nth-child(3) { white-space: normal; }
.kiosk-log em { font-style: normal; font-family: var(--font-mono); color: #8EE0C3; }
.kiosk-foot { padding: 12px 28px 18px; display: flex; justify-content: space-between; color: #7E9FB2; font-size: 12.5px; gap: 16px; flex-wrap: wrap; }
.kiosk-foot .arabic { font-size: 14px; color: #A9C3D1; }
.kiosk-start { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; gap: 14px; background: rgba(3,19,31,.82); }
.kiosk-start .btn { height: 52px; font-size: 17px; padding: 0 28px; }

/* ---------- Employee self-service ---------- */
.me-hero { padding: 26px; border-radius: 14px; background: var(--navy-deep); color: #D7E6EE; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.me-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad-wave); }
.me-hero h1 { color: var(--white); }
.me-hero .today { display: flex; gap: 28px; margin-top: 14px; flex-wrap: wrap; }
.me-hero .today div { font-size: 12px; color: #8FB0C2; }
.me-hero .today b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--white); font-variant-numeric: tabular-nums; }
.punch-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.punch-buttons .btn { height: 52px; padding: 0 22px; font-size: 15.5px; }
.punch-buttons .btn.in { background: var(--mint); border-color: var(--mint); color: var(--white); }
.punch-buttons .btn.out { background: transparent; border-color: rgba(255,255,255,.4); color: var(--white); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "header" "content" "footer";
  }
  .rail { position: fixed; z-index: 60; inset: 60px auto 0 0; width: var(--rail); translate: -100% 0; transition: translate .2s ease; }
  .app.nav-open .rail { translate: 0 0; box-shadow: var(--shadow-2); }
  .app-header .menu-btn { display: inline-flex; }
  .app-header .brand .brand-sub { display: none; }
  .content { padding: 20px 16px 40px; }
  .app-header { padding: 0 14px; gap: 8px; }
  .hide-sm { display: none !important; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .face-panel { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { padding: 32px 24px; }
  .kiosk-stage { grid-template-columns: minmax(0, 1fr); }
  .me-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Data grid: sortable headers, a filter row, checkbox-list filters */
.table.dgrid th.sortable { cursor: pointer; user-select: none; }
.table.dgrid th.sortable:hover { color: var(--navy); }
.table.dgrid .sort-arrow { font-size: 9px; margin-left: 4px; color: var(--ocean); }
/* OIS-style labeled filter bar above the grid */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #FBFDFD; }
.filter-item { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filter-item > label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.filter-item .input { height: 34px; width: 100%; font-size: 13px; }
.filter-item .input::placeholder { color: var(--text-3); opacity: 0.65; }
.mfilter { position: relative; display: block; max-width: 100%; }
.mfilter-btn { display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); color: var(--text-2); font: 500 13px var(--font-body); cursor: pointer; transition: border-color .12s, background .12s; }
.mfilter-btn:hover { border-color: var(--line-strong); }
.mfilter-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; text-align: left; }
.mfilter-btn svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: 0.7; }
.mfilter-btn::after { content: "▾"; font-size: 9px; flex: 0 0 auto; opacity: 0.6; }
.mfilter-btn.on { border-color: var(--ocean); color: var(--navy); background: var(--info-soft); font-weight: 600; }
.mfilter-btn.on svg { opacity: 1; }
.mfilter-backdrop { position: fixed; inset: 0; z-index: 40; }
.mfilter-pop { position: absolute; z-index: 41; top: calc(100% + 4px); left: 0; width: 280px; max-width: 86vw; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 10px; display: grid; gap: 8px; text-align: left; }
.mfilter-pop .input { height: 32px; width: 100%; min-width: 0; }
.mfilter-actions { display: flex; gap: 6px; }
.mfilter-list { max-height: 300px; overflow: auto; display: grid; }
.mfilter-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 400; }
.mfilter-item:hover { background: var(--fog); }
.mfilter-item .grow { min-width: 0; overflow-wrap: anywhere; }

/* Authority editor: permission groups in a fixed 4-column grid */
.auth-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.auth-group { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.auth-group h3 { margin: 0; padding: 7px 11px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--navy); background: var(--fog); border-bottom: 1px solid var(--line); }
.auth-group .rights { padding: 7px 11px 9px; display: grid; gap: 1px; }
.check.sm { display: flex; align-items: flex-start; gap: 8px; padding: 4px 5px; margin: 0 -5px; border-radius: 4px; font-size: 12.5px; line-height: 1.35; cursor: pointer; color: var(--text-2); }
.check.sm:hover { background: var(--fog); }
.check.sm input { margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--ocean); }
.check.sm input:disabled { cursor: not-allowed; }
.check.sm:has(input:disabled) { cursor: default; color: var(--text-3); }
.check.sm:has(input:disabled):hover { background: none; }
.check.sm:has(input:checked) { color: var(--navy-deep); font-weight: 500; }
@media (max-width: 1100px) { .auth-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .auth-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Compact field rows inside the authority editor */
.auth-meta { display: grid; grid-template-columns: 140px 1fr 180px; gap: 14px; align-items: end; margin-bottom: 16px; }
@media (max-width: 720px) { .auth-meta { grid-template-columns: 1fr; } }

/* Consistent action cell for every master-data / admin grid: Edit · Delete · … inline, right-aligned, never wrapping. */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
/* On a table cell itself, stay a cell (a flex cell loses its row border and width) and space the buttons with margins instead. */
td.row-actions { display: table-cell; text-align: right; vertical-align: middle; }
td.row-actions > * + * { margin-left: 8px; }

/* Truncated terminal/location labels: keep the (Type) suffix visible, slightly smaller, no wrap */
.tlabel { font-size: .86em; white-space: nowrap; }

/* ---------- Shift roster ---------- */
.roster-kpis .kpi .value { font-size: 22px; }
.roster-card { overflow: hidden; }
.roster-toolbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.roster-toolbar .period { display: flex; align-items: center; gap: 6px; }
.roster-toolbar .period b { font-family: var(--font-display); color: var(--navy-deep); min-width: 150px; text-align: center; }
.roster-toolbar .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.roster-toolbar .filters .input { width: auto; min-width: 150px; }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; }
select.input.sm { padding-right: 28px; background-position: right 7px center; background-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 0 12px; height: 32px; font: 600 12.5px var(--font-body); color: var(--text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--navy-deep); color: #fff; }

.roster-brushes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.roster-brushes .spacer, .roster-savebar .spacer { flex: 1; }
.brush { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--bg); color: var(--ink); font: 700 12px var(--font-mono); cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; }
.brush:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.brush.on { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10, 113, 128, .18); }
.brush.static { cursor: default; height: 22px; padding: 0 7px; font-size: 11px; }
.brush.static:hover { transform: none; box-shadow: none; }
.brush kbd { font: 600 9.5px var(--font-mono); opacity: .55; border: 0; padding: 0; background: none; }
kbd { font: 600 11px var(--font-mono); padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--white); }
.roster-hint { padding: 8px 18px; border-bottom: 1px solid var(--line); }
.warn-key { display: inline-block; width: 0; height: 0; border-top: 7px solid var(--danger); border-left: 7px solid transparent; vertical-align: middle; }

.roster-wrap { overflow: auto; max-height: calc(100vh - 330px); min-height: 260px; }
table.roster { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; user-select: none; font-size: 12px; }
table.roster th, table.roster td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table.roster thead th { position: sticky; top: 0; z-index: 2; background: var(--white); }
table.roster tfoot td, table.roster tfoot th { background: var(--paper); }
table.roster .emp { position: sticky; left: 0; z-index: 1; background: var(--white); text-align: left; min-width: 270px; max-width: 270px; padding: 6px 10px; font-weight: 400; }
table.roster thead .emp { z-index: 3; }
table.roster tfoot .emp { background: var(--paper); }
table.roster thead .emp .check { align-items: center; font: 600 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
table.roster thead .emp .check input { margin-top: 0; }
.emp-cell { display: flex; align-items: center; gap: 8px; }
.emp-cell input[type=checkbox] { accent-color: var(--ocean); width: 15px; height: 15px; flex: 0 0 auto; }
.emp-cell .who { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.emp-cell .name { font-weight: 600; color: var(--navy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.emp-cell .name:hover { text-decoration: underline; }
.emp-cell .meta { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
select.mini { height: 24px; font: 600 11px var(--font-mono); border: 1px solid var(--line-strong); border-radius: 4px; background: var(--white); color: var(--text-2); padding: 0 2px; max-width: 74px; }
tr.selected .emp { background: #EEF7F7; }

table.roster th.day { width: 38px; min-width: 38px; padding: 5px 0 4px; text-align: center; font-weight: 400; }
th.day .dow { display: block; font: 600 9.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
th.day .dn { display: block; font: 700 14px var(--font-display); color: var(--navy-deep); }
table.roster th.day.wkend { background: #F1F5F7; }
table.roster th.day.hol { background: #DCEEF9; box-shadow: inset 0 -3px 0 #2E7EA0; }
th.day.today .dn { color: #fff; background: var(--ocean); border-radius: 999px; width: 24px; height: 24px; line-height: 24px; margin: 1px auto 0; }

td.cell { position: relative; height: 36px; width: 38px; min-width: 38px; padding: 0; text-align: center; cursor: crosshair;
  background: var(--bg); color: var(--ink); font: 700 10.5px var(--font-mono); letter-spacing: -.02em; }
td.cell.src-default { opacity: .62; font-weight: 500; }
td.cell.src-override::after { content: ""; position: absolute; left: 3px; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
td.cell.pending { opacity: 1; outline: 2px dashed var(--ink); outline-offset: -4px; }
td.cell.warn::before { content: ""; position: absolute; top: 0; right: 0; border-top: 9px solid var(--danger); border-left: 9px solid transparent; }
td.cell.today { box-shadow: inset 2px 0 0 var(--ocean), inset -2px 0 0 var(--ocean); }
td.cell:hover { filter: brightness(.95); }
td.cell.sel { outline: 2px solid var(--navy-deep); outline-offset: -2px; filter: brightness(.9); opacity: 1; }
td.tot, th.tot { min-width: 46px; text-align: center; font: 700 12px var(--font-mono); color: var(--ocean); background: var(--paper); }
td.cov { text-align: center; font: 600 11px var(--font-mono); color: var(--text-2); height: 26px; }
td.cov.zero { color: var(--text-3); opacity: .5; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px; border-top: 1px solid var(--line); }

.roster-savebar { position: sticky; bottom: 14px; z-index: 20; margin: 14px auto 0; max-width: 760px; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--navy-deep); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.roster-savebar svg { width: 18px; height: 18px; color: var(--mint); }
.roster-savebar .btn.ghost { color: #fff; }

.pattern-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; padding: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
ol.steps { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.import-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0; }
.import-kpis .value.ok { color: var(--ok); }
.import-kpis .value.danger { color: var(--danger); }
.sub-h { font-size: 14px; margin: 14px 0 8px; }
.scroll-box { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 900px) { .roster-toolbar .filters { margin-left: 0; } table.roster .emp { min-width: 190px; max-width: 190px; } select.mini { display: none; } .import-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Live monitor ---------- */
tr.fresh td { animation: fresh-row 4s ease-out; }
@keyframes fresh-row { from { background: rgba(29, 194, 162, .22); } to { background: transparent; } }
.activity-list { list-style: none; margin: 0; padding: 4px 0; max-height: 560px; overflow: auto; }
.activity-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border-bottom: 0; }
.activity-list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; color: var(--navy-deep); text-decoration: none; }
.activity-list .name:hover { text-decoration: underline; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); opacity: .5; }
.dot.ok { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); opacity: 1; }
@media (prefers-reduced-motion: reduce) { tr.fresh td { animation: none; background: rgba(29, 194, 162, .12); } }

/* ---------- Report builder ---------- */
.rb-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.rb-side { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow: auto; }
.rb-side .card-head { padding: 12px 16px; }
.rb-side .card-head h2 { font-size: 14px; }
.rb-empty { padding: 4px 16px 12px; }
.rb-list { list-style: none; margin: 0; padding: 0 0 6px; }
.rb-list li { display: grid; gap: 2px; padding: 9px 16px; cursor: pointer; border-left: 3px solid transparent; }
.rb-list li b { font-size: 13px; color: var(--navy-deep); font-weight: 600; }
.rb-list li .small { line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rb-list li:hover { background: var(--fog); }
.rb-list li.on { background: #EAF6F5; border-left-color: var(--teal); }
.rb-main { display: grid; gap: 18px; min-width: 0; }
.rb-titlebar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.rb-names { display: grid; gap: 6px; flex: 1 1 320px; min-width: 0; }
.rb-name { font: 700 18px var(--font-display); color: var(--navy-deep); height: 40px; }
.rb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rb-steps { display: grid; }
.rb-step { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 14px; align-items: start; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.rb-step > .rb-hint { grid-column: 2; }
.rb-label { font: 600 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding-top: 8px; display: flex; align-items: center; gap: 8px; }
.rb-label .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--navy-deep); color: #fff; font-size: 10.5px; letter-spacing: 0; }
.rb-sources { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-source { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); font: 600 13px var(--font-body); color: var(--text-2); cursor: pointer; }
.rb-source svg { width: 16px; height: 16px; color: var(--ocean); }
.rb-source:hover { border-color: var(--teal); }
.rb-source.on { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }
.rb-source.on svg { color: var(--mint); }
.rb-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px; background: #EAF6F5; color: #0d6a66; font: 600 12.5px var(--font-body); border: 1px solid rgba(19,160,151,.3); }
.rb-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; }
.rb-chip button:hover { background: rgba(19,160,151,.18); }
.rb-row { gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.rb-sub { font: 600 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 12px 0 6px; }
.rb-runbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px; background: var(--paper); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.rb-runbar .spacer { flex: 1; }
.rb-table-wrap { overflow: auto; max-height: 640px; }
.rb-table thead th { position: sticky; top: 0; z-index: 1; background: var(--white); cursor: pointer; white-space: nowrap; }
.rb-table thead th:hover { color: var(--ocean); }
.rb-table tfoot td { position: sticky; bottom: 0; background: #EAF1F4; font-weight: 700; border-top: 2px solid var(--line-strong); }
@media (max-width: 1100px) { .rb-layout { grid-template-columns: minmax(0, 1fr); } .rb-side { position: static; max-height: none; } }
@media (max-width: 720px) { .rb-step { grid-template-columns: minmax(0, 1fr); } .rb-step > .rb-hint { grid-column: 1; } }

/* ---------- Month close bar ---------- */
.lock-bar { margin-bottom: 18px; align-items: center; }
.lock-bar .spacer { flex: 1; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.recovery-codes code { font: 600 14px var(--font-mono); padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.twofa-setup { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.twofa-setup img { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.twofa-key { display: inline-block; margin-top: 4px; font: 600 15px var(--font-mono); letter-spacing: .04em; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }



/* ---------- Nav badge (pending approvals) ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn, #c77700); color: #fff;
  font: 700 11px var(--font-mono); display: inline-grid; place-items: center; }

/* ---------- Integrations: getting-started text and code samples ---------- */
.prose ol { padding-left: 20px; display: grid; gap: 8px; }
.prose h3 { margin: 18px 0 8px; font: 700 15px var(--font-display); color: var(--navy-deep); }
.prose code, pre.code { font: 500 12.5px var(--font-mono); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.prose code { padding: 1px 5px; }
pre.code { padding: 12px 14px; overflow-x: auto; white-space: pre; line-height: 1.6; }

/* ---------- Notification list ---------- */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { padding: 10px 18px; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: 0; }
ul.list li.unread { background: var(--paper); border-left: 3px solid var(--teal); }
