/* Same look as the StockView demo: navy + teal, left sidebar, Montserrat headings. Light theme via the Theme button. */
:root {
  --bg: #06111f; --bg-glow: rgba(35, 213, 196, .10); --side: rgba(5, 14, 27, .92);
  --surface: #0c1d33; --surface-2: #10263f; --sunk: #091829; --line: #1b3956; --line-teal: rgba(47, 227, 207, .30);
  --ink: #eaf4fb; --muted: #8fa8be;
  --accent: #2fe3cf; --accent-2: #1f8fd6; --accent-soft: rgba(47, 227, 207, .12); --on-accent: #032421; --blue: #60a5fa;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --crit: #f87171; --crit-soft: rgba(248, 113, 113, .14); --idle: #a78bfa; --idle-soft: rgba(167, 139, 250, .16);
  --map-bg: #0a1b2f; --map-road: #17324f;
  --f-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 14px; --logo-a: #ffffff; --logo-b: #22b3a9;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f3f6fa; --bg-glow: rgba(14, 159, 148, .08); --side: rgba(255, 255, 255, .96);
  --surface: #ffffff; --surface-2: #f8fafc; --sunk: #f2f5f9; --line: #d8e0ea; --line-teal: rgba(14, 159, 148, .35);
  --ink: #102030; --muted: #586a7d;
  --accent: #0b8f86; --accent-2: #1d6fd1; --accent-soft: rgba(11, 143, 134, .12); --on-accent: #ffffff; --blue: #2563eb;
  --ok: #15803d; --ok-soft: rgba(21, 128, 61, .12); --warn: #b45309; --warn-soft: rgba(180, 83, 9, .12);
  --crit: #c2331f; --crit-soft: rgba(194, 51, 31, .1); --idle: #6d28d9; --idle-soft: rgba(109, 40, 217, .1);
  --map-bg: #e8eef5; --map-road: #ffffff; --logo-a: #00203f; --logo-b: #017670;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink); font: 15px/1.5 var(--f-body);
  background: radial-gradient(900px 520px at 85% -8%, var(--bg-glow), transparent 70%), radial-gradient(700px 480px at 20% 108%, rgba(31, 143, 214, .10), transparent 70%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
h1 em, h2 em { font-style: normal; color: var(--accent); }
h2 { font-size: 1.02rem; font-weight: 700; }
h3 { font-size: .95rem; }
.num, td.n { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: .86em; }
.muted { color: var(--muted); }
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; background: var(--side); border-right: 1px solid var(--line); }
.brand { border: 0; background: none; padding: 0 6px; cursor: pointer; display: grid; gap: 6px; text-align: left; }
.logo { width: 150px; height: auto; display: block; }
.product { font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; }
.product span { color: var(--accent); }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.navgroup { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 10px 12px 2px; font-weight: 600; }
.tab { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap; }
.tab:hover { color: var(--ink); background: rgba(127, 127, 127, .07); }
.tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line-teal); font-weight: 600; }
.tab .count { margin-left: auto; font-size: .72rem; padding: 0 7px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.pilot { margin-top: auto; padding: 16px; border-radius: 12px; background: linear-gradient(160deg, rgba(47, 227, 207, .14), rgba(31, 143, 214, .08)); border: 1px solid var(--line-teal); display: grid; gap: 8px; font-size: .85rem; }
.pilot strong { font-family: var(--f-display); font-size: .98rem; line-height: 1.3; }
.pilot .eyebrow { color: var(--accent); }
.side-foot { font-size: .75rem; color: var(--muted); padding-inline: 6px; }

.maincol { min-width: 0; padding: 26px 32px 60px; display: grid; gap: 22px; align-content: start; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.top h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.top .sub { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }
.topRight { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.company { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .app { display: block; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; gap: 10px; padding: 12px 16px 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0; }
  .logo { width: 112px; } .product { font-size: 1rem; }
  .tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .navgroup, .pilot, .side-foot { display: none; }
  .tab { padding: 8px 12px; gap: 8px; font-size: .9rem; }
  .maincol { padding: 18px 16px 48px; gap: 16px; }
  .company .eyebrow { display: none; }
  input, select, textarea { font-size: 16px; }
}

.view { display: grid; gap: 18px; }
.panel { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
html[data-theme="light"] .panel, html[data-theme="light"] .kpi { box-shadow: 0 6px 20px rgba(16, 32, 48, .06); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head p { margin: 0; color: var(--muted); font-size: .85rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.kpi { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-teal); border-radius: var(--r); padding: 16px; display: grid; gap: 4px; min-width: 0; }
.kpi .ic { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-teal); background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); margin-bottom: 6px; }
.kpi .v { white-space: nowrap; font-family: var(--f-display); font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi.warn .v { color: var(--warn); } .kpi.crit .v { color: var(--crit); } .kpi.ok .v { color: var(--ok); }
.kpi .l { font-weight: 600; font-size: .88rem; }
.kpi .s { font-size: .78rem; color: var(--muted); }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px 10px 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.alert .stripe { align-self: stretch; background: var(--accent); }
.alert.crit .stripe { background: var(--crit); } .alert.warn .stripe { background: var(--warn); } .alert.idle .stripe { background: var(--idle); }
.alert .t { font-weight: 600; font-size: .9rem; }
.alert .d { font-size: .8rem; color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--surface-2); padding: 7px 13px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .85rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn.sm { padding: 4px 9px; font-size: .78rem; }
.btn.ok { border-color: var(--ok); color: var(--ok); } .btn.no { color: var(--crit); }
.btn.danger { border-color: var(--crit); color: var(--crit); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; font-size: inherit; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.acts.nw { flex-wrap: nowrap; }
td.nw { white-space: nowrap; }
select.st-Active { border-color: var(--ok) !important; color: var(--ok); }
select.st-Completed { border-color: var(--line-teal) !important; color: var(--accent); }
select.st-Inactive { color: var(--muted); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); } .pill.idle { background: var(--idle-soft); color: var(--idle); }
.pill.info { background: var(--accent-soft); color: var(--accent); } .pill.none { color: var(--muted); border: 1px solid var(--line); }

.tbl-wrap { overflow-x: auto; margin-inline: -4px; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td { background: rgba(47, 227, 207, .04); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: .76rem; color: var(--muted); }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
tr.clickable { cursor: pointer; }
td input.cell { width: 70px; text-align: right; background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
td select.cell { background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex: none; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-teal); }
.selfie { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; display: grid; place-items: center; border: 1px solid var(--line-teal); cursor: zoom-in; padding: 0; font-size: .7rem; font-weight: 700; color: #fff; background: linear-gradient(150deg, hsl(var(--h, 180) 45% 42%), hsl(calc(var(--h, 180) + 40) 50% 26%)); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .field > span { font-size: .78rem; color: var(--muted); font-weight: 600; }
input[type="search"], input[type="text"], input[type="number"], input[type="date"], input[type="time"], select, textarea { background: var(--sunk); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-width: 0; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.filters input[type="search"] { width: min(300px, 100%); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--sunk); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .form-row, .form-row.three { grid-template-columns: minmax(0, 1fr); } }
.form input, .form select, .form textarea { width: 100%; }
.form input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form input[type="range"] { accent-color: var(--accent); }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
.err { font-size: .82rem; color: var(--crit); margin: 0; min-height: 1.2em; }

.nowList { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nowList li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); font-size: .87rem; }
.nowList .n2 { font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; color: var(--accent); }
.nowList .ppl { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; }
.dates { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dates li { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); font-size: .87rem; }
.dates .dd { text-align: center; font-family: var(--f-display); font-weight: 800; line-height: 1.05; color: var(--accent); }
.dates .dd small { display: block; font-size: .64rem; font-family: var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.dates .d { color: var(--muted); font-size: .78rem; }

/* Maps (schematic SVG, no tiles) */
.mapsvg { width: 100%; height: auto; display: block; border-radius: 12px; background: var(--map-bg); border: 1px solid var(--line); }
.mapsvg .road { stroke: var(--map-road); stroke-width: 7; fill: none; stroke-linecap: round; }
.mapsvg .road.thin { stroke-width: 3; }
.mapsvg .fence { fill: rgba(47, 227, 207, .12); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; }
.mapsvg .site { fill: var(--accent); }
.mapsvg .me { fill: var(--blue); stroke: #fff; stroke-width: 3; }
.mapsvg .me.out { fill: var(--crit); }
.mapsvg .pulse { fill: var(--blue); opacity: .25; }
.mapsvg .pulse.out { fill: var(--crit); }
.mapsvg text { font: 600 11px var(--f-body); fill: var(--muted); }
.mapsvg text.lbl { fill: var(--ink); font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .85rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; }
.siteForm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 18px; align-items: start; }
@media (max-width: 760px) { .siteForm { grid-template-columns: minmax(0, 1fr); } }

/* Staff app (phone) */
.phoneWrap { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .phoneWrap { grid-template-columns: minmax(0, 1fr); } }
.phone { border: 10px solid #0b1422; border-radius: 38px; background: var(--bg); box-shadow: 0 20px 50px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--line); overflow: hidden; max-width: 390px; width: 100%; justify-self: center; }
html[data-theme="light"] .phone { border-color: #1d2a3a; }
.phone .scr { padding: 16px 16px 22px; display: grid; gap: 12px; }
.phone .notch { height: 22px; display: flex; justify-content: space-between; padding: 0 22px; font-size: .74rem; font-weight: 600; align-items: center; color: var(--muted); background: var(--side); }
.phone select, .phone input { width: 100%; }
.clockBig { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.clockBig .t { font-family: var(--f-display); font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.clockBig input[type="time"] { width: 120px; }
.step { display: grid; gap: 6px; }
.step > span { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.step > span b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .7rem; margin-right: 6px; }
.step.done > span b { background: var(--ok); color: var(--on-accent); }
.camRow { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; }
.camBox { width: 112px; height: 112px; border-radius: 14px; overflow: hidden; background: var(--sunk); border: 1px dashed var(--line-teal); display: grid; place-items: center; position: relative; }
.camBox video, .camBox img { width: 100%; height: 100%; object-fit: cover; }
.camBox video { transform: scaleX(-1); }
.camBox .ph { color: var(--muted); font-size: .72rem; text-align: center; display: grid; gap: 4px; justify-items: center; }
.camBox .ph svg { width: 28px; height: 28px; }
.camBtns { display: grid; gap: 6px; }
.statusBox { border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: .88rem; border: 1px solid var(--line); background: var(--sunk); }
.statusBox.in { border-color: var(--ok); background: var(--ok-soft); }
.statusBox.out { border-color: var(--crit); background: var(--crit-soft); }
.statusBox.field { border-color: var(--warn); background: var(--warn-soft); }
.statusBox b { display: block; }
.clockBtn { width: 100%; border: 0; border-radius: 14px; padding: 15px; font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; cursor: pointer; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.clockBtn.outBtn { background: linear-gradient(90deg, #fb923c, #f43f5e); color: #fff; }
.clockBtn:disabled { opacity: .45; cursor: not-allowed; }
.miniCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.miniCards div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; font-size: .72rem; color: var(--muted); }
.miniCards b { display: block; font-family: var(--f-display); font-size: 1.15rem; color: var(--ink); }
.explain { display: grid; gap: 12px; }
.explain ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--muted); font-size: .9rem; }
.explain ol b { color: var(--ink); }

/* Modal + paper documents (payslip, EA form) */
.modal { position: fixed; inset: 0; background: rgba(2, 8, 16, .72); display: grid; place-items: center; padding: 16px; z-index: 40; }
.modal .box { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line-teal); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.modal .box.wide { width: min(920px, 100%); }
.modal .mbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal .mbar .acts { display: flex; gap: 8px; }
.bigSelfie { width: min(320px, 100%); border-radius: 14px; display: block; margin: 0 auto; }
.paper { background: #fff; color: #14202c; border-radius: 6px; padding: 28px; font-size: 12.5px; line-height: 1.45; font-family: var(--f-body); }
.paper h3 { font-size: 15px; color: #00203f; }
.paper .ph { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #00203f; padding-bottom: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.paper .ph .r { text-align: right; }
.paper .meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 24px; margin-bottom: 14px; }
.paper .meta div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted #c9d3dd; padding: 2px 0; }
.paper .meta span { color: #5a6b7c; }
.paper .cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.paper table { font-size: 12.5px; }
.paper th { color: #5a6b7c; border-bottom: 1px solid #c9d3dd; padding: 5px 6px; background: #f2f5f8; }
.paper td { border-bottom: 1px solid #e3e9ef; padding: 5px 6px; }
.paper tfoot td { border-top: 1px solid #00203f; }
.paper .net { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #e6f6f4; border: 1px solid #017670; border-radius: 6px; font-weight: 700; font-size: 15px; color: #00203f; }
.paper .small { font-size: 11px; color: #5a6b7c; }
.paper .sec { background: #00203f; color: #fff; font-weight: 700; padding: 4px 8px; margin: 14px 0 4px; font-size: 12px; }
.paper .line { display: grid; grid-template-columns: 34px minmax(0, 1fr) 120px; gap: 8px; padding: 4px 6px; border-bottom: 1px solid #e3e9ef; }
.paper .line .a { text-align: right; font-variant-numeric: tabular-nums; }
.paper .line.tot { font-weight: 700; border-top: 1px solid #00203f; }
@media (max-width: 600px) { .paper { padding: 16px; } .paper .meta, .paper .cols2 { grid-template-columns: minmax(0, 1fr); } }

.profile { display: grid; gap: 14px; }
.profHead { display: flex; gap: 14px; align-items: center; }
.profHead .av { width: 56px; height: 56px; font-size: 1rem; }
.profGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 600px) { .profGrid { grid-template-columns: minmax(0, 1fr); } }
.profGrid section { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }

.note { padding: 12px 16px; border-radius: 12px; border: 1px dashed var(--line-teal); color: var(--muted); font-size: .88rem; margin: 0; }
.note b { color: var(--ink); }
.rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.rates div { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: .85rem; color: var(--muted); display: grid; gap: 4px; }
.rates b { color: var(--ink); font-family: var(--f-display); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-teal); padding: 10px 16px; border-radius: 10px; font-weight: 500; font-size: .9rem; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.foot { color: var(--muted); font-size: .8rem; display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.empty { padding: 22px 10px; text-align: center; color: var(--muted); font-size: .9rem; }

@media print {
  body { background: #fff; }
  .app, .toast { display: none !important; }
  .modal { position: static; background: none; padding: 0; display: block; }
  .modal .box { border: 0; padding: 0; max-height: none; overflow: visible; width: 100%; background: #fff; }
  .modal .mbar { display: none; }
  .paper { padding: 0; }
}

/* ---------- Real app additions ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.authBox { width: min(420px, 100%); display: grid; gap: 18px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-teal); border-radius: 18px; padding: 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.authBox .brandRow { display: flex; align-items: center; gap: 12px; }
.authBox .logo { width: 130px; }
.authBox h1 { font-size: 1.4rem; }
.authBox .links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .88rem; }
.authBox input { width: 100%; }
.btn.block { width: 100%; justify-content: center; padding: 11px; font-size: .95rem; }
.userBox { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunk); font-size: .82rem; }
.userBox b { font-size: .9rem; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; font-size: .9rem; border: 1px solid var(--line); background: var(--sunk); }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); }
.banner.crit { border-color: var(--crit); background: var(--crit-soft); }
.banner.ok { border-color: var(--ok); background: var(--ok-soft); }
.linkBox { display: grid; gap: 10px; }
.linkBox input { width: 100%; font-family: var(--f-mono); font-size: .8rem; }
.clockCard { max-width: 460px; width: 100%; display: grid; gap: 14px; }
.camBox.big { width: 100%; height: auto; aspect-ratio: 1; max-width: 260px; justify-self: center; }
.shiftList { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shiftList li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk); font-size: .87rem; }
.balCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.balCards div { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; font-size: .8rem; color: var(--muted); }
.balCards b { display: block; font-family: var(--f-display); font-size: 1.5rem; color: var(--ink); }
.thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line-teal); cursor: zoom-in; display: block; background: var(--sunk); }
.inl { display: inline-flex; gap: 6px; align-items: center; }
.small { font-size: .8rem; }
.right { margin-left: auto; }
.mt { margin-top: 12px; }
/* Phones: keep the clock near the top. Name and company move out of the way; sign-out becomes an icon. */
@media (max-width: 900px) {
  .userBox, .top .sub, .company { display: none; }
  .top { flex-wrap: nowrap; align-items: center; }
  .top h1 { font-size: 1.35rem; }
  #logoutBtn span { display: none; }
  .clockBig .t { font-size: 2.4rem; }
}
.shiftList .sub { display: block; font-size: .76rem; color: var(--muted); }
/* Plain, password and phone inputs get the same look as the other fields. */
input:not([type]), input[type="password"], input[type="tel"], input[type="datetime-local"] { background: var(--sunk); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-width: 0; color: var(--ink); }

/* ---------- Alignment ---------- */
/* Lists with columns: every row uses the same grid so times, hours and buttons line up. */
.shiftList.rows3 li { display: grid; grid-template-columns: minmax(0, 1fr) 118px 118px; gap: 4px 14px; align-items: center; }
.shiftList.rows2 li { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 4px 14px; align-items: center; }
.shiftList .c { text-align: center; white-space: nowrap; }
.shiftList .r { text-align: right; justify-self: end; }
.shiftList .num { font-variant-numeric: tabular-nums; }
/* Table action buttons sit in fixed slots, so the same button is in the same place on every row. */
.slots { display: grid; grid-template-columns: 52px 74px 68px; gap: 6px; justify-items: stretch; }
.slots.s2 { grid-template-columns: 74px 68px; }
.slots .btn.sm { padding: 4px 6px; }
.who { min-width: 150px; }
.slots .btn { justify-content: center; width: 100%; }
/* Leave balance cards: number, label, "of N days" on every card */
.balCards div { display: grid; gap: 2px; justify-items: center; }
.balCards span { color: var(--ink); font-weight: 600; font-size: .85rem; }
.balCards small { color: var(--muted); font-size: .76rem; }
/* One selfie button, full width beside the photo */
.camBtns .btn { justify-content: center; }
@media (max-width: 480px) {
  .shiftList.rows3 li { grid-template-columns: minmax(0, 1fr) auto; }
  .shiftList.rows3 li > :nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; justify-self: start; color: var(--muted); }
  .shiftList.rows3 li > :nth-child(3) { grid-row: 1 / span 2; grid-column: 2; }
  .balCards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .balCards div { padding: 10px 4px; }
}
/* Wide tables (attendance, payroll): tighter cells so they fit a 1280 px laptop without sideways scrolling. */
table.dense { font-size: .82rem; }
table.dense th, table.dense td { padding: 8px 6px; }
table.dense th { letter-spacing: .04em; white-space: normal; vertical-align: bottom; }
table.dense .who { min-width: 132px; gap: 8px; }
table.dense .av { width: 28px; height: 28px; font-size: .66rem; }
