/* Vistoclock styles. Tokens first; see docs/STYLE.md. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1d2422;
  --muted: #5d6763;
  --line: #e2e0d8;
  --brand: #0f5c4c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ec;
  --ok: #17694f;
  --ok-soft: #dff2ea;
  --warn: #9a4a00;
  --warn-soft: #fdecd9;
  --danger: #b3261e;
  --danger-soft: #fbe5e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.warn { color: var(--warn); font-weight: 600; }

/* Header and footer */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner, .foot-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
.top-inner { min-height: 60px; justify-content: space-between; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand-mark { width: 22px; height: 26px; border: 3px solid var(--brand); border-radius: 50%; display: inline-block; }
.nav { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--brand); }
.nav form { margin: 0; }
.nav .btn { color: var(--brand-ink); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; font-weight: 500; }
.link:hover { color: var(--brand); }
.foot { margin-top: auto; border-top: 1px solid var(--line); }
.foot-inner { min-height: 56px; justify-content: space-between; color: var(--muted); font-size: .875rem; }

/* Main */
main.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 16px 48px; }
main.wide { width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
body.bare main.wide { max-width: none; padding: 0; }
.narrow { max-width: 420px; margin: 0 auto; }
.narrow-wide { max-width: 680px; }
.crumbs { margin-bottom: .5rem; font-size: .9rem; }
.crumbs a::before { content: "‹ "; }
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.head-row p { margin: 0; }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }
.empty { text-align: center; padding: 32px 20px; }
.empty p:last-child { margin-bottom: 0; }

/* Messages */
.flash, .alert, .note { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.flash { background: var(--ok-soft); color: var(--ok); }
.alert { background: var(--danger-soft); color: var(--danger); }
.note { background: var(--brand-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: 600 1rem var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); filter: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.danger-zone summary.btn-ghost { color: var(--danger); border-color: var(--danger); }
.danger-zone summary.btn-ghost:hover { background: var(--danger-soft); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.form input:not([type=checkbox]), .form select {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: 400 1rem var(--font); background: var(--surface); color: var(--ink);
}
.form input:focus, .form select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.form .check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.form-inline { grid-template-columns: 2fr 1fr auto; align-items: end; }

/* Tables: rows become cards on phones */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #faf9f6; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; }
.table td a { font-weight: 600; text-decoration: none; }

/* Tags */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eceae4; color: var(--ink); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-muted { background: #f0efea; color: var(--muted); }

/* Dashboard stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-n { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .9rem; }

/* Employee page */
.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.events .tag { min-width: 44px; text-align: center; margin-right: 6px; }
.danger-zone h2 { color: var(--danger); }
.danger-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 8px; }
.confirm { background: var(--danger-soft); border-radius: 10px; padding: 12px; max-width: 420px; }
.confirm p { font-size: .9rem; margin-bottom: 10px; }
.kiosk-link { word-break: break-all; background: var(--bg); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }

/* Consent */
.consent ul { padding-left: 1.1rem; margin: 0 0 1rem; display: grid; gap: 10px; }

/* Camera */
.cam { position: relative; width: 100%; max-width: 640px; aspect-ratio: 4 / 3; background: #101614; border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-oval { position: absolute; left: 50%; top: 46%; width: 46%; height: 72%; transform: translate(-50%, -50%); border: 3px dashed rgba(255, 255, 255, .55); border-radius: 50%; pointer-events: none; transition: border-color .2s; }
.cam.good .cam-oval { border-color: #5fe0b0; border-style: solid; }
.cam-msg { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; background: rgba(10, 16, 14, .72); color: #fff; border-radius: 10px; font-weight: 600; text-align: center; }
.shots { list-style: none; display: flex; gap: 10px; padding: 0; margin: 0 0 16px; }
.cam-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255, 255, 255, .12); }
.cam-progress span { display: block; height: 100%; width: 0; background: #5fe0b0; transition: width .2s linear; }
.shots li { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--brand); }
.shots li.done { background: var(--brand); }

/* Kiosk */
body.bare { background: #0c1210; color: #f2f5f4; }
.kiosk { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 16px; gap: 12px; }
.kiosk .brand { color: #f2f5f4; }
.kiosk .brand-mark { border-color: #5fe0b0; }
.kiosk-head { width: 100%; max-width: 900px; display: flex; justify-content: space-between; align-items: center; }
.kiosk-clock { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kiosk { --kw: min(900px, 100%, calc((100vh - 240px) * 4 / 3)); }
.cam-kiosk { max-width: none; width: var(--kw); margin: 0; }
.kiosk .result, .kiosk-head { width: var(--kw); max-width: none; }
.kiosk-start { min-height: 56px; font-size: 1.15rem; padding: 0 28px; }
.kiosk-note { color: #a9b5b1; font-size: .9rem; margin: 0; text-align: center; }
.result { width: 100%; max-width: 900px; border-radius: var(--radius); padding: 20px; text-align: center; background: #1b2522; }
.result.ok { background: #0f5c4c; }
.result.late { background: #8a4600; }
.result.fail { background: #6b1f1a; }
.result-title { font-size: 1.75rem; font-weight: 700; margin: 0; }
.result-sub { margin: 4px 0 0; font-size: 1.1rem; opacity: .9; }

/* Landing */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; padding: 32px 0 24px; }
.eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; margin-bottom: .5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero .row-actions { margin-bottom: 12px; }
.hero-card { text-align: center; padding: 24px; }
.demo-cam { aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(160deg, #22352f, #101614); display: grid; place-items: center; margin-bottom: 16px; }
.demo-face { width: 38%; aspect-ratio: 3 / 4; border: 3px solid #5fe0b0; border-radius: 50%; }
.demo-title { font-size: 1.3rem; font-weight: 700; margin: 0; }
.demo-sub { color: var(--ok); margin: 0; font-weight: 600; }
.section { padding: 32px 0 8px; }
.section > h2 { font-size: 1.5rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; margin-bottom: 10px; }
.steps strong { display: block; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.features .card { margin: 0; }
.features p { margin: 0; color: var(--muted); }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 360px)); gap: 16px; }
.plan ul { padding-left: 1.1rem; margin: 0 0 20px; display: grid; gap: 6px; }
.price { color: var(--muted); }
.price span { font-size: 2rem; font-weight: 700; color: var(--ink); }

/* Privacy */
.prose { max-width: 720px; }
.prose ul { padding-left: 1.1rem; display: grid; gap: 8px; margin: 0 0 1.25rem; }
.prose h2 { margin-top: 1.5rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .steps { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  main.page { padding-top: 20px; }
  .top-inner { padding-top: 10px; padding-bottom: 10px; }
  .nav { gap: 4px 14px; font-size: .95rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr; }
  .form-inline { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; }
  .table td.num { text-align: right; }
  .table td.actions { justify-content: flex-end; }
  .table td.actions:empty { display: none; }
  .table td.actions::before { content: none; }
  .kiosk-clock { font-size: 1.15rem; }
  .result-title { font-size: 1.4rem; }
  .kiosk { --kw: min(100%, calc((100vh - 240px) * 3 / 4)); }
  .cam-kiosk { aspect-ratio: 3 / 4; }
  .cam-kiosk .cam-oval { width: 64%; height: 58%; }
}

@media (prefers-color-scheme: dark) {
  :root:not(.kiosk-root) {
    --bg: #111614; --surface: #1a211e; --ink: #e8eeeb; --muted: #9eaaa5; --line: #2c3632;
    --brand: #4fc79f; --brand-ink: #08231b; --brand-soft: #18352c;
    --ok: #6fd8b0; --ok-soft: #173329; --warn: #f2a65a; --warn-soft: #3a2614;
    --danger: #ff8a80; --danger-soft: #3a1b18;
    --shadow: none;
    color-scheme: dark;
  }
  .table th { background: #161c1a; }
  .tag:not(.tag-ok):not(.tag-warn):not(.tag-muted) { background: #26302c; }
  .tag-muted { background: #222a27; }
  .btn-danger { color: #2a0b08; }
}
