/* Kuss Absensi — design system.

   Calm clinical console: a soft neutral canvas, large rounded cards, hairline
   dividers, one teal accent and tabular numerals. Mobile-first: a bottom tab
   bar on phones, inline tabs on wide screens. */

:root {
  color-scheme: light dark;

  --bg: light-dark(#f2f5f3, #0b1210);
  --bg-glow: light-dark(rgb(12 111 98 / 0.07), rgb(69 201 180 / 0.08));
  --surface: light-dark(#ffffff, #121b19);
  --surface-2: light-dark(#eef3f1, #1a2523);
  --surface-3: light-dark(#e4ebe8, #22302c);

  --text: light-dark(#0f1c19, #e7efec);
  --muted: light-dark(#5d6e68, #97a6a1);
  --line: light-dark(#e2e9e6, #24322e);
  --line-strong: light-dark(#cfdad6, #33443f);

  --brand: light-dark(#0c6f62, #45c9b4);
  --brand-2: light-dark(#0f8e7c, #64dcc8);
  --brand-soft: light-dark(#e2f3ef, #10312c);
  --brand-ink: light-dark(#ffffff, #052420);

  --ok: light-dark(#14794a, #86e6ad);
  --ok-soft: light-dark(#e1f5ea, #10301f);
  --warn: light-dark(#9a6206, #f4c275);
  --warn-soft: light-dark(#fbf1de, #33260e);
  --danger: light-dark(#b3261e, #ff9d94);
  --danger-soft: light-dark(#fbe9e7, #331410);

  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 28px;
  --tap: 48px;

  --shadow-sm: 0 1px 2px rgb(10 30 26 / 0.06);
  --shadow: 0 1px 2px rgb(10 30 26 / 0.05), 0 18px 40px -24px rgb(10 30 26 / 0.35);
  --shadow-brand: 0 12px 28px -14px color-mix(in oklab, var(--brand) 70%, transparent);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  accent-color: var(--brand);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(38rem 22rem at 100% -6rem, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 var(--font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.center { display: grid; place-items: center; padding: 1.25rem; }

a { color: var(--brand); text-underline-offset: 2px; }

h1, h2, h3 { line-height: 1.18; margin: 0 0 .5rem; letter-spacing: -0.022em; }
h1 { font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.0625rem; font-weight: 650; }
h3 { font-size: .9375rem; font-weight: 650; }

p { margin: 0; }

.skip {
  position: absolute; left: -999px; top: 0; padding: .75rem 1rem;
  background: var(--surface); border-radius: 0 0 var(--radius) 0; z-index: 40;
}
.skip:focus { left: 0; }

/* ---------- App bar ---------- */

.appbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}

.appbar-inner {
  width: min(72rem, 100%); margin-inline: auto;
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem clamp(.875rem, 3vw, 1.5rem);
  min-height: 60px;
}

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 700; letter-spacing: -0.02em; color: var(--text); text-decoration: none;
  margin-inline-end: auto; white-space: nowrap;
}
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 11px; color: var(--brand-ink);
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: var(--shadow-brand);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand small { display: block; font-size: .6875rem; font-weight: 500; color: var(--muted); letter-spacing: .01em; }

.who {
  display: none; color: var(--muted); font-size: .8125rem;
  padding: .35rem .7rem; border-radius: 999px; background: var(--surface-2);
  white-space: nowrap;
}

nav.tabs { display: none; gap: .15rem; }

nav.tabs a {
  min-height: 38px; display: inline-flex; align-items: center; padding: 0 .8rem;
  border-radius: 999px; text-decoration: none; color: var(--muted);
  font-size: .875rem; font-weight: 550; white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
nav.tabs a:hover { background: var(--surface-2); color: var(--text); }
nav.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 650; }

.appbar-actions { display: flex; align-items: center; gap: .25rem; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  text-decoration: none; transition: background .18s ease, color .18s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.wide { width: auto; padding-inline: .8rem; gap: .45rem; font: inherit; font-size: .8125rem; font-weight: 600; }
.icon-btn.wide svg { width: 17px; height: 17px; }
.icon-btn.wide span { display: none; }
.icon-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Bottom tab bar (phones) ---------- */

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: .15rem; padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
}

.tabbar a {
  display: grid; justify-items: center; gap: .15rem;
  padding: .35rem .25rem; border-radius: 14px;
  color: var(--muted); text-decoration: none;
  font-size: .6875rem; font-weight: 600; letter-spacing: .01em;
  transition: color .18s ease, background .18s ease;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.tabbar a:active { transform: scale(.96); }

/* ---------- Layout ---------- */

.wrap {
  width: min(72rem, 100%); margin-inline: auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(.875rem, 3vw, 1.5rem);
  padding-bottom: calc(6.75rem + env(safe-area-inset-bottom));
  container-type: inline-size;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1rem, 2.5vw, 1.4rem);
  box-shadow: var(--shadow-sm);
}
.card.narrow { width: min(26rem, 100%); }
.card.compact { padding: .6rem .75rem; }
.stack { display: grid; gap: 1rem; }
.stack.tight { gap: .55rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: .875rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grow { flex: 1; }

.muted { color: var(--muted); }
.small { font-size: .8438rem; }
.big { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); font-weight: 650; letter-spacing: -0.03em; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.eyebrow {
  font-size: .6875rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.pre-wrap { white-space: pre-wrap; }
.input-inline { max-width: 12rem; }

/* ---------- Hero / home ---------- */

.hero-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 3vw, 1.75rem);
  background:
    radial-gradient(28rem 16rem at 102% -30%, color-mix(in oklab, var(--brand) 18%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--line) 45%, transparent) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, color-mix(in oklab, var(--line) 45%, transparent) 0 1px, transparent 1px 44px),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero-card > * { position: relative; }
.hero-top { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.hero-title { margin-bottom: .15rem; }
.hero-sub { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; color: var(--muted); font-size: .8438rem; }

.pill-link {
  display: inline-flex; align-items: center; gap: .35rem; flex: none;
  padding: .4rem .7rem; border-radius: 999px; text-decoration: none;
  background: var(--warn-soft); color: var(--warn);
  font-size: .75rem; font-weight: 700;
}
.pill-link svg { width: 14px; height: 14px; }

.status-strip { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1.1rem; }

.status-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .75rem .35rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: .78rem; font-weight: 650;
}
.status-pill::before {
  content: ""; width: .5rem; height: .5rem; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px color-mix(in oklab, currentColor 18%, transparent);
}
.status-pill.ok { background: var(--ok-soft); color: var(--ok); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-pill.danger { background: var(--danger-soft); color: var(--danger); }
.status-pill.live { background: var(--brand-soft); color: var(--brand); }

.clock-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem;
  align-items: center; margin-top: 1.25rem;
  padding: 1rem 1.1rem; border-radius: var(--radius);
  background: color-mix(in oklab, var(--surface-2) 72%, transparent);
  border: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}
.clock-block { display: grid; gap: .1rem; }
.clock-block .label {
  font-size: .6875rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.clock-block .value { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.15rem); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.clock-block .value.empty { color: color-mix(in oklab, var(--muted) 60%, transparent); }
.clock-divider { width: 1px; align-self: stretch; background: var(--line); }

.hero-cta { display: grid; gap: .65rem; margin-top: 1.15rem; }
.hero-cta .btn.large { min-height: 62px; }
.helper { font-size: .78rem; color: var(--muted); }

.quick-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.quick-item {
  display: grid; gap: .35rem; align-content: start;
  padding: 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.quick-item:hover { border-color: color-mix(in oklab, var(--brand) 40%, var(--line)); box-shadow: var(--shadow-sm); }
.quick-item:active { transform: scale(.99); }
.quick-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: .25rem;
}
.quick-icon svg { width: 19px; height: 19px; }
.quick-item strong { font-size: .9375rem; font-weight: 650; }
.quick-item span { font-size: .78rem; color: var(--muted); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-size: .78rem; font-weight: 550;
}
.chip svg { width: 14px; height: 14px; color: var(--muted); }

/* ---------- Buttons, fields ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: 0 1.05rem; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.985); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(150deg, var(--brand-2), var(--brand));
  border-color: transparent; color: var(--brand-ink); box-shadow: var(--shadow-brand);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.large { min-height: 62px; font-size: 1.0625rem; width: 100%; border-radius: 16px; }

.field { display: grid; gap: .4rem; }
.field > span { font-weight: 600; font-size: .875rem; }
.field > small { color: var(--muted); font-size: .78rem; }
input, select, textarea {
  min-height: var(--tap); padding: .65rem .8rem; border-radius: 13px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklab, var(--brand) 30%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 16%, transparent); }
textarea { min-height: 6rem; resize: vertical; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-height: 0; }

.field .error, .error-text { color: var(--danger); font-size: .8125rem; }
.field .error:empty { display: none; }
input:user-invalid, select:user-invalid, textarea:user-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 12%, transparent);
}

.alert {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid color-mix(in oklab, var(--danger) 35%, var(--line));
  color: var(--text); font-size: .9rem;
}
.notice {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid color-mix(in oklab, var(--brand) 26%, var(--line));
  color: var(--text); font-size: .9rem;
}

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tables & list rows ---------- */

.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  container-type: inline-size;
}
table { border-collapse: collapse; width: 100%; min-width: 32rem; }
th, td { padding: .7rem .85rem; text-align: start; border-bottom: 1px solid var(--line); }
th {
  background: var(--surface-2); font-size: .6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklab, var(--surface-2) 45%, transparent); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

.list { display: grid; gap: .6rem; }
.list-row {
  display: grid; gap: .2rem;
  padding: .85rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.list-row .meta { display: flex; flex-wrap: wrap; gap: .4rem .75rem; color: var(--muted); font-size: .78rem; align-items: center; }
.list-row strong { font-weight: 650; }

/* ---------- Camera / attendance ---------- */

.camera-frame {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: #0a0f0e; aspect-ratio: 1 / 1; display: grid; place-items: center;
  border: 1px solid var(--line);
}
.camera-frame video, .camera-frame canvas { width: 100%; height: 100%; object-fit: cover; }
.camera-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(58% 42% at 50% 46%, transparent 62%, rgb(6 18 16 / 0.55) 100%),
    linear-gradient(to top, rgb(6 18 16 / 0.5), transparent 30%);
}
.camera-guide {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 62%; aspect-ratio: 3 / 4;
  border: 2px dashed rgb(255 255 255 / 0.55); border-radius: 50%;
  pointer-events: none; z-index: 1;
}
.camera-tip {
  position: absolute; inset-inline: 0; bottom: 4.9rem; z-index: 2;
  text-align: center; color: #fff; font-size: .78rem; font-weight: 600;
  text-shadow: 0 1px 8px rgb(0 0 0 / .6);
}
.shutter {
  position: absolute; inset-inline: .8rem; bottom: .8rem; z-index: 3;
  width: auto; min-height: 56px; font-size: 1rem;
  box-shadow: 0 14px 30px -10px rgb(0 0 0 / .6);
}
.camera-frame .spinner {
  position: absolute; top: .9rem; inset-inline-end: .9rem; z-index: 4;
  width: 1.5rem; height: 1.5rem; border-width: 3px;
  border-color: rgb(255 255 255 / .35); border-top-color: #fff;
}
.camera-overlay {
  position: absolute; top: .8rem; inset-inline: .8rem; z-index: 2;
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.camera-overlay .chip { background: rgb(9 24 21 / 0.6); color: #fff; backdrop-filter: blur(8px); }
.camera-overlay .chip svg { color: #d7fff7; }

.status-line {
  display: flex; align-items: flex-start; gap: .55rem;
  font-size: .8125rem; color: var(--muted);
}
.status-line svg { width: 16px; height: 16px; margin-top: .15rem; flex: none; color: var(--brand); }

.submit-bar { display: grid; gap: .35rem; }
.submit-bar > .row { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.submit-bar .spinner { margin-inline: .35rem; }
.icon-xs { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Feedback ---------- */

.toast-region {
  position: fixed; inset-inline: 0; bottom: calc(5.5rem + env(safe-area-inset-bottom));
  display: grid; gap: .5rem; justify-items: center; padding-inline: 1rem; z-index: 40;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: .5rem .5rem .5rem 1rem; box-shadow: var(--shadow);
  font-size: .875rem; animation: toast-in .2s ease-out;
}
.toast button {
  min-height: 36px; min-width: 36px; border-radius: 999px; border: 0;
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.banner {
  position: fixed; inset-inline: 0; top: 0; padding: .5rem 1rem; text-align: center;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .8125rem;
  border-bottom: 1px solid color-mix(in oklab, var(--warn) 30%, var(--line));
  z-index: 50;
}

.spinner {
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--brand) 30%, transparent);
  border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- Login ---------- */

.auth {
  width: min(25rem, 100%); display: grid; gap: 1.25rem;
}
.auth .card { padding: 1.6rem; }
.auth-mark {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px;
  color: var(--brand-ink); background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: var(--shadow-brand);
}
.auth-mark svg { width: 28px; height: 28px; }
.auth h1 { margin-bottom: .25rem; }
.auth-foot { text-align: center; font-size: .78rem; color: var(--muted); }

/* ---------- Responsive ---------- */

@container (min-width: 40rem) {
  .punch { grid-template-columns: 1fr 1fr; }
  .camera-frame { aspect-ratio: 4 / 3; }
}

/* Responsive table (container query): below 36rem the table becomes stacked cards.
   Each cell keeps its header as an injected label, so no information is lost. */
@container (max-width: 36rem) {
  table, thead, tbody, tr, th, td { display: block; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: .65rem .85rem; border-bottom: 1px solid var(--line); }
  tbody tr:hover td { background: none; }
  tbody td { border: 0; padding: .18rem 0; display: flex; gap: .75rem; justify-content: space-between; }
  tbody td::before {
    content: attr(data-label);
    color: var(--muted); font-size: .78rem; font-weight: 600;
  }
  td.num { text-align: start; }
  td.is-empty { display: none; }
}

@media (min-width: 48rem) {
  .appbar-inner { min-height: 68px; }
  nav.tabs { display: flex; }
  .who { display: inline-flex; }
  .tabbar { display: none; }
  .wrap { padding-bottom: clamp(1.6rem, 4vw, 2.6rem); }
  .toast-region { bottom: 1rem; }
  .hero-card .clock-grid { margin-top: 1.4rem; }
  .icon-btn.wide { width: auto; }
  .icon-btn.wide span { display: inline; }
}

@media (min-width: 60rem) {
  .hero-card { grid-template-columns: 1.2fr .8fr; column-gap: 2rem; row-gap: .9rem; }
  .hero-card .hero-top { grid-column: 1; grid-row: 1; }
  .hero-card .status-strip { grid-column: 1; grid-row: 2; margin-top: 0; }
  .hero-card .clock-grid { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  .hero-card .hero-cta { grid-column: 1 / -1; grid-row: 3; }
  .hero-cta .btn.large { width: auto; min-width: 22rem; justify-self: start; }
}

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

@media (display-mode: standalone) {
  .appbar { padding-top: max(.25rem, env(safe-area-inset-top)); }
}

@media print {
  .appbar, .tabbar, nav.tabs, .btn { display: none; }
  body { background: #fff; color: #000; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#preview { transform: scaleX(-1); }

/* ==========================================================================
   V2 — shell, profile, request form, check-in feedback
   ========================================================================== */

.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-brand);
  object-fit: contain;
}

.avatar-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  text-decoration: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar-xl {
  width: 58px;
  height: 58px;
  flex: none;
  font-size: 1.05rem;
}

.avatar-link:hover .avatar {
  background: color-mix(in oklab, var(--brand) 16%, var(--brand-soft));
}

.avatar-link[aria-current="page"] .avatar {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
}

.avatar-link:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.auth-logo {
  display: block;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow-brand);
  object-fit: contain;
}

.profile-layout {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
}

.form-page,
.checkin-page {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-head > div {
  flex: 1;
  min-width: 0;
}

.page-head .btn {
  flex: none;
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-head h1 {
  margin: 0;
}

.page-head .eyebrow {
  margin-bottom: 0.15rem;
}

.page-head .muted {
  max-width: 46ch;
  margin-top: 0.2rem;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(20rem 10rem at 104% -30%, color-mix(in oklab, var(--brand) 16%, transparent), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.profile-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.profile-copy h2 {
  margin: 0;
  font-size: 1.15rem;
}

.profile-copy p {
  font-size: 0.84rem;
}

.profile-copy .chip {
  justify-self: start;
  margin-top: 0.25rem;
}

.settings-list {
  display: grid;
}

.settings-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.settings-row:first-child {
  border-top: 0;
}

.settings-row.static {
  cursor: default;
}

.settings-row:hover .settings-chevron {
  color: var(--brand);
  transform: translateX(2px);
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}

.settings-icon svg {
  width: 18px;
  height: 18px;
}

.settings-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.settings-copy strong {
  font-size: 0.9rem;
  font-weight: 650;
}

.settings-copy small {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

.settings-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.settings-row .badge {
  justify-self: end;
}

.danger-zone {
  border-color: color-mix(in oklab, var(--danger) 28%, var(--line));
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.segmented a,
.segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.segmented a[aria-current="page"],
.segmented button.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.quota-card {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.quota-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.quota-top strong {
  font-size: 1.1rem;
  font-weight: 650;
}

.quota-progress {
  width: 100%;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.quota-progress::-webkit-progress-bar {
  background: var(--surface-3);
}

.quota-progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
}

.quota-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--brand);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.action-grid .btn {
  min-height: 44px;
  padding-inline: 0.4rem;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.2rem;
}

.form-actions .btn.primary {
  min-width: 12rem;
}

.upload-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.8rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.upload-box:hover {
  border-color: var(--brand);
}

.upload-box > .icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--brand);
}

.upload-box strong {
  display: block;
  font-size: 0.86rem;
}

.upload-box small {
  display: block;
  margin-top: 1px;
  font-size: 0.73rem;
  color: var(--muted);
}

.upload-name {
  max-width: 12rem;
  margin-inline-start: auto;
  overflow: hidden;
  font-size: 0.73rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.counter {
  display: block;
  text-align: end;
  font-size: 0.72rem;
  color: var(--muted);
}

.camera-card {
  display: grid;
  gap: 0.75rem;
}

.camera-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.camera-meta .btn {
  flex: none;
}

.radius-line {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.radius-line[data-state="ok"] {
  border-color: color-mix(in oklab, var(--ok) 30%, var(--line));
  background: var(--ok-soft);
  color: var(--ok);
}

.radius-line[data-state="warn"] {
  border-color: color-mix(in oklab, var(--warn) 30%, var(--line));
  background: var(--warn-soft);
  color: var(--warn);
}

.radius-line svg {
  color: currentColor;
}

.step-list {
  display: grid;
  gap: 0.7rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
}

.step-list .step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
}

.step-list strong {
  font-size: 0.875rem;
}

.step-list p {
  margin: 0.1rem 0 0;
  font-size: 0.77rem;
  line-height: 1.45;
  color: var(--muted);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--surface-2) 55%, transparent);
  color: var(--muted);
}

.empty-state .icon {
  width: 24px;
  height: 24px;
  color: var(--brand);
}

.empty-state strong {
  color: var(--text);
  font-size: 0.9rem;
}

.empty-state p {
  max-width: 42ch;
  font-size: 0.8rem;
}

.empty-state .btn {
  margin-top: 0.2rem;
}

.empty-note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty-note .icon {
  width: 16px;
  height: 16px;
  margin-top: 0.1rem;
  color: var(--brand);
}

.notice.with-icon {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.notice.with-icon .icon {
  flex: none;
  margin-top: 0.1rem;
  color: var(--brand);
}

.hero-card {
  padding: clamp(1.2rem, 3.2vw, 1.8rem);
  border-radius: var(--radius-lg);
}

.hero-title {
  font-size: clamp(1.65rem, 1.3rem + 1.6vw, 2.2rem);
}

.hero-sub {
  font-size: 0.8rem;
}

.status-strip {
  margin-top: 1rem;
}

.clock-grid {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
}

.clock-block .value {
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2rem);
}

.hero-cta .btn.large {
  min-height: 58px;
}

.quick-item {
  padding: 0.9rem;
  border-radius: 16px;
}

.table-wrap {
  border-radius: var(--radius);
}

th {
  font-size: 0.65rem;
}

td {
  font-size: 0.85rem;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.field textarea {
  min-height: 7rem;
}

.tabbar a {
  border-radius: 14px;
}

@media (max-width: 40rem) {
  .page-head {
    align-items: flex-start;
  }

  .page-head .btn.primary {
    width: 100%;
  }

  .profile-card {
    align-items: flex-start;
  }

  .camera-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .camera-meta .btn {
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .quota-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .upload-box {
    align-items: flex-start;
  }

  .upload-name {
    width: 100%;
    max-width: 100%;
    margin-inline-start: 0;
  }
}

@media (max-width: 22rem) {
  .date-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 60rem) {
  .hero-cta {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .hero-cta .helper {
    justify-self: end;
    max-width: 34ch;
    margin: 0;
    text-align: end;
  }
}

#update-toast button {
  min-height: 44px;
  padding-inline: 0.8rem;
  font-weight: 600;
}

/* Salary and weekly schedule are matrices: keep them as a scrollable table on
   phones instead of turning every cell into a stacked card. */
.table-wrap.table-matrix {
  overflow-x: auto;
}

.table-wrap.table-matrix table {
  min-width: 52rem;
}

@container (max-width: 36rem) {
  .table-wrap.table-matrix table {
    display: table;
    min-width: 52rem;
  }

  .table-wrap.table-matrix thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .table-wrap.table-matrix tbody {
    display: table-row-group;
  }

  .table-wrap.table-matrix tr {
    display: table-row;
    padding: 0;
    border: 0;
  }

  .table-wrap.table-matrix th,
  .table-wrap.table-matrix td {
    display: table-cell;
    padding: 0.6rem 0.7rem;
  }

  .table-wrap.table-matrix td::before {
    content: none;
  }
}
