/* Whokeys — feuille de style unique, sans framework.
   Couleurs dérivées du logo : vert #007531, orange #F39200. */

@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin.woff") format("woff");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --green-900: #003d1b;
  --green-700: #005c27;
  --green: #007531;
  --green-100: #d7ecdf;
  --green-50: #eef7f1;
  --orange: #f39200;
  --orange-700: #a85d00;
  --orange-100: #ffe6c2;
  --orange-50: #fff6ea;
  --red: #c4302b;
  --red-50: #fdeeed;
  --blue-50: #edf3fb;
  --blue-700: #24508a;

  --ink: #1b221e;
  --ink-2: #444d47;
  --muted: #6c746f;
  --line: #e6e3dc;
  --line-2: #d6d2c8;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27, 34, 30, .05), 0 2px 8px rgba(27, 34, 30, .04);
  --shadow-lg: 0 10px 30px rgba(27, 34, 30, .14);
  --sidebar: 252px;
  --tabbar: 64px;
  --focus: 0 0 0 3px rgba(0, 117, 49, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 .75em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface); border-right: 1px solid var(--line);
  display: none; flex-direction: column; padding: 22px 14px; z-index: 30;
}
.sidebar .brand { padding: 4px 10px 22px; }
.sidebar .brand img { height: 40px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 700; text-decoration: none;
}
.nav a svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--green-50); color: var(--green-700); }
.nav a.active svg { color: var(--green); }
.nav a.scan-link { background: var(--green); color: #fff; margin: 4px 0 6px; }
.nav a.scan-link svg { color: #fff; }
.nav a.scan-link:hover { background: var(--green-700); }
.sidebar .account { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--orange-100); color: var(--orange-700); font-weight: 800; font-size: 13px;
}
.account-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.account-row .who { min-width: 0; }
.account-row .who strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-row .who span { font-size: 12px; color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand img { height: 32px; width: auto; }
.topbar .company-filter { max-width: 240px; }

.main { padding: 20px 16px calc(var(--tabbar) + 32px); max-width: 1180px; margin: 0 auto; }

.tabbar {
  position: fixed; inset: auto 0 0 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: 11px; font-weight: 700; color: var(--muted); background: none; border: 0; text-decoration: none; cursor: pointer;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar .active { color: var(--green); }
.tabbar .scan {
  color: #fff;
}
.tabbar .scan .bubble {
  width: 46px; height: 46px; border-radius: 50%; background: var(--green); display: grid; place-items: center;
  margin-top: -18px; box-shadow: 0 4px 14px rgba(0, 117, 49, .35);
}
.tabbar .scan > span:last-child { color: var(--green-700); }
.tabbar .scan .bubble svg { color: #fff; }

.sheet {
  position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 10px 14px calc(var(--tabbar) + 18px); box-shadow: var(--shadow-lg);
  transform: translateY(100%); visibility: hidden; transition: transform .2s ease, visibility .2s;
}
.sheet.open { transform: none; visibility: visible; }
.sheet .grabber { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 10px; }
.backdrop { position: fixed; inset: 0; background: rgba(20, 24, 22, .35); z-index: 35; }

@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .topbar, .tabbar, .sheet, .backdrop { display: none !important; }
  .main { margin-left: var(--sidebar); padding: 32px 40px 48px; max-width: calc(1180px + var(--sidebar)); }
  .app-content { max-width: 1180px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.page-head .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs span::before { content: "›"; margin-right: 6px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--surface); --c: var(--ink); --bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--bd);
  background: var(--b); color: var(--c); font: inherit; font-weight: 800; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { --b: var(--green); --c: #fff; --bd: var(--green); }
.btn-primary:hover { background: var(--green-700); }
.btn-warn { --b: var(--orange); --c: #241400; --bd: var(--orange); }
.btn-warn:hover { background: #e48800; }
.btn-danger { --b: var(--surface); --c: var(--red); --bd: #efc3c1; }
.btn-danger:hover { background: var(--red-50); }
.btn-ghost { --b: transparent; --bd: transparent; --c: var(--ink-2); }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); }
.btn-lg { min-height: 56px; font-size: 17px; border-radius: 14px; padding: 0 22px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 42px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 18px; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--line-2); }
.stat .label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .label i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.stat .value { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.alert .value { color: var(--red); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.good { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.badge.warn { background: var(--orange-50); color: var(--orange-700); border-color: var(--orange-100); }
.badge.danger { background: var(--red-50); color: var(--red); border-color: #f5cfcd; }
.badge.muted { background: #f0efeb; color: var(--muted); }
.badge.info { background: var(--blue-50); color: var(--blue-700); border-color: #d5e2f3; }

/* ---------- Lists (responsive rows instead of tables) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; gap: 4px 16px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: center; }
.rows .row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row .title { font-weight: 800; color: var(--ink); }
.row a.title:hover { color: var(--green-700); }
.row .meta { font-size: 13px; color: var(--muted); }
.row .end { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rows-head { display: none; }
@media (min-width: 900px) {
  .row { grid-template-columns: var(--cols); }
  .rows-head { display: grid; grid-template-columns: var(--cols); gap: 16px; padding: 10px 18px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
  .row .end { justify-content: flex-end; }
  .row .hide-lg { display: none; }
}
@media (max-width: 899px) { .row .hide-sm { display: none; } }

.keynum {
  display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px;
  background: var(--green-50); color: var(--green-700); font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; flex: none;
}
.keynum.out { background: var(--orange-50); color: var(--orange-700); }
.keynum.gone { background: #efeee9; color: var(--muted); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main > div { min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Toolbar & filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 220px; position: relative; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.toolbar .search input { padding-left: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 13px; text-decoration: none; }
.chip:hover { text-decoration: none; background: var(--surface-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a.active { color: var(--ink); border-color: var(--green); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field, .fields + .field, .field + .fields { margin-top: 16px; }
.fields { display: grid; gap: 16px; }
.fields > .field { margin-top: 0; }
@media (min-width: 640px) { .fields.two { grid-template-columns: 1fr 1fr; } .fields.three { grid-template-columns: repeat(3, 1fr); } .fields.addr { grid-template-columns: 140px 1fr; } }
label, .label { font-weight: 800; font-size: 14px; color: var(--ink); }
.label .opt, label .opt { font-weight: 600; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c746f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
.invalid input, .invalid select, .invalid textarea { border-color: var(--red); }
.error { color: var(--red); font-size: 13px; font-weight: 700; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); margin: 0; flex: none; }
.choice-list { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--green); background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green); }
.choice input { accent-color: var(--green); width: 20px; height: 20px; margin: 0; }
.choice strong { display: block; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 800; margin-bottom: 8px; padding: 0; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }

/* Person picker */
.picker { position: relative; }
.picker-results { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: 320px; overflow-y: auto; }
.picker-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; font: inherit; cursor: pointer; border-top: 1px solid var(--line); }
.picker-results button:first-child { border-top: 0; }
.picker-results button:hover, .picker-results button.focus { background: var(--green-50); }
.picker-results small { display: block; color: var(--muted); }
.picker-selected { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--green); background: var(--green-50); border-radius: 10px; font-weight: 800; }

/* ---------- Flash ---------- */
.flash-stack { position: fixed; z-index: 60; top: 12px; left: 12px; right: 12px; display: grid; gap: 8px; pointer-events: none; }
@media (min-width: 1024px) { .flash-stack { left: auto; right: 24px; top: 20px; width: 420px; } }
.flash { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 700; animation: flash-in .2s ease; }
.flash svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.flash.success svg { color: #7fd6a1; }
.flash.error { background: var(--red); }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--orange-50); color: var(--orange-700); }
.notice.danger { background: var(--red-50); color: var(--red); }
.notice.good { background: var(--green-50); color: var(--green-700); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--line-2); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Definition lists ---------- */
.dl { display: grid; grid-template-columns: 1fr; margin: 0; }
.dl > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); }
.dl > div:first-child { border-top: 0; }
.dl dt { color: var(--muted); font-weight: 700; font-size: 14px; }
.dl dd { margin: 0; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 6px 18px 12px; }
.timeline li { position: relative; padding: 12px 0 12px 30px; border-left: 2px solid var(--line); margin-left: 7px; }
.timeline li:last-child { border-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 15px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-2); }
.timeline li.good::before { border-color: var(--green); }
.timeline li.warn::before { border-color: var(--orange); }
.timeline li.muted::before { border-color: var(--muted); }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .what { font-weight: 800; }
.timeline .sig { margin-top: 8px; display: inline-block; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; }
.timeline .sig img { height: 54px; width: auto; }
.timeline .note { margin-top: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }

/* ---------- Scan screen ---------- */
.scan-wrap { max-width: 520px; margin: 0 auto; }
.status-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 999px; font-weight: 900; font-size: 17px; border: 2px solid; }
.status-banner svg { width: 22px; height: 22px; }
.status-banner.good { background: var(--green-50); color: var(--green-700); border-color: var(--green); }
.status-banner.warn { background: var(--orange-50); color: var(--orange-700); border-color: var(--orange); }
.status-banner.muted { background: #efeee9; color: var(--ink-2); border-color: var(--line-2); }
.status-banner.danger { background: var(--red-50); color: var(--red); border-color: var(--red); }
.scan-title { margin: 20px 0 2px; font-size: 28px; }
.contents { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.contents span { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 800; }
.photo { border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--muted); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.address-block { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; margin: 6px 0; }
.address-block svg { width: 20px; height: 20px; color: var(--muted); flex: none; margin-top: 2px; }
.instructions { background: var(--orange-50); border: 1px solid var(--orange-100); border-radius: 12px; padding: 12px 14px; margin: 14px 0; white-space: pre-line; }
.instructions strong { display: block; color: var(--orange-700); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }

/* Wizard */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 18px; }
.steps div { height: 6px; border-radius: 6px; background: var(--line); }
.steps div.done { background: var(--green); }
.step-label { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.wizard-step { display: none; }
.wizard-step.current { display: block; }
.no-js .wizard-step { display: block; margin-bottom: 24px; }
.signature-box { position: relative; border: 2px dashed var(--line-2); border-radius: 14px; background: #fff; touch-action: none; }
.signature-box canvas { width: 100%; height: 220px; display: block; border-radius: 12px; cursor: crosshair; }
.signature-box .placeholder { position: absolute; left: 0; right: 0; bottom: 34px; text-align: center; color: var(--line-2); font-weight: 800; pointer-events: none; border-top: 1px solid var(--line); margin: 0 30px; padding-top: 6px; }
.signature-box.signed .placeholder { display: none; }

/* Scanner */
.scanner-view { position: relative; border-radius: 18px; overflow: hidden; background: #111; aspect-ratio: 3 / 4; max-height: 70vh; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; }
.scanner-view .frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scanner-view .msg { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: #fff; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

/* ---------- Activity chart ---------- */
.chart { width: 100%; height: auto; }
.chart .bar-out { fill: var(--orange); }
.chart .bar-in { fill: var(--green); }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog::backdrop { background: rgba(20, 24, 22, .45); }
dialog .card-head { border-radius: 18px 18px 0 0; }
dialog .close { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

/* ---------- Guest pages ---------- */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(800px 400px at 0% 0%, rgba(243, 146, 0, .10), transparent 60%),
  radial-gradient(800px 400px at 100% 100%, rgba(0, 117, 49, .10), transparent 60%), var(--bg); }
.guest-card { width: 100%; max-width: 420px; }
.guest-card .logo { display: block; margin: 0 auto 26px; height: 64px; width: auto; }
.guest-card .card-body { padding: 26px; }
.guest-card h1 { font-size: 22px; margin-bottom: 6px; }
.guest-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ---------- Labels (print) ---------- */
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 6mm; }
.qr-label { border: 1px dashed #bbb; border-radius: 4mm; padding: 4mm; display: grid; grid-template-columns: 26mm 1fr; gap: 3mm; align-items: center; background: #fff; break-inside: avoid; color: #111; }
.qr-label .qr { width: 26mm; height: 26mm; }
.qr-label .qr path { fill: #111; }
.qr-label .n { font-size: 26pt; font-weight: 900; line-height: 1; color: var(--green); font-variant-numeric: tabular-nums; }
.qr-label .l { font-size: 9pt; font-weight: 800; margin-top: 1mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-label .a { font-size: 7.5pt; color: #555; line-height: 1.25; margin-top: 1mm; }
.qr-label .brand { white-space: nowrap; font-size: 6.5pt; font-weight: 900; color: var(--orange); margin-top: 1.5mm; letter-spacing: .02em; }
.qr-block svg path { fill: var(--ink); }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .tabbar, .flash-stack { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .label-sheet { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
}
.inline-form { display: inline; }
.stack > * + * { margin-top: 18px; }
