/* Lab Attendance -- v0.9 design ("polished dark").
   Layout: fixed left sidebar + main column for signed-in team members; the
   sidebar turns into a scrolling top bar under 860px. Login, check-in
   results and the kiosk use the plain centered layout (no sidebar).
   Class names from earlier versions are all kept, so every page picks the
   new look up without template changes. */

:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --panel: #141820;          /* cards / surfaces */
  --panel-2: #1a1f29;        /* inputs, nested surfaces, hover */
  --panel-3: #212734;
  --border: #252c39;
  --border-strong: #323a4a;
  --text: #e7eaf0;
  --muted: #8b93a4;
  --faint: #5d6576;
  --accent: #6d8fff;
  --accent-hover: #819fff;
  --accent-soft: rgba(109, 143, 255, 0.14);
  --good: #3ccb85;
  --good-soft: rgba(60, 203, 133, 0.13);
  --warn: #efb23b;
  --warn-soft: rgba(239, 178, 59, 0.13);
  --bad: #ef6363;
  --bad-soft: rgba(239, 99, 99, 0.13);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 650; line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 17px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
code {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font: 0.88em var(--font-mono); word-break: break-all;
}

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 22px 14px 16px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); flex-shrink: 0;
  display: grid; place-items: center; font: 650 15px/1 var(--font-display); color: #0c0f14;
}
.brand-name { font: 650 17px/1.1 var(--font-display); letter-spacing: -0.01em; }
.brand-name small { display: block; font: 500 11.5px/1.3 var(--font-body); color: var(--muted); letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14.5px; white-space: nowrap;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.nav .count { margin-left: auto; font: 500 11.5px/1 var(--font-mono); padding: 3px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); }
.me:hover { text-decoration: none; background: var(--panel-3); }
.me-text { min-width: 0; line-height: 1.3; }
.me-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tg-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex-shrink: 0; }
.tg-dot.off { background: var(--faint); }
.logout { font-size: 13px; color: var(--muted); padding: 4px 10px; }

.main { padding: 28px 32px 56px; min-width: 0; }
.main-inner { max-width: 1180px; margin: 0 auto; }
.main-inner.narrow { max-width: 900px; }

/* plain layout (login, check-in result, kiosk) */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar nav { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.topbar .who { color: var(--muted); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 20px; }

/* ------------------------------------------------------------ elements */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14.5px; border: 1px solid; }
.flash-error { background: var(--bad-soft); border-color: rgba(239, 99, 99, 0.5); }
.flash-success { background: var(--good-soft); border-color: rgba(60, 203, 133, 0.45); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 4px 0 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px; min-width: 0;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-header h2, .panel-header h1 { margin: 0; }
.panel h3 { margin: 20px 0 8px; }
.panel ol { margin: 0 0 8px; padding-left: 22px; }
.panel ol li { margin-bottom: 8px; line-height: 1.55; }
.panel > p:last-child { margin-bottom: 0; }
.card-link { font-size: 13px; color: var(--muted); font-weight: 500; }
.card-link:hover { color: var(--accent); text-decoration: none; }
.n-pill { font: 500 12px/1 var(--font-mono); color: var(--muted); background: var(--panel-2); padding: 4px 8px; border-radius: 999px; vertical-align: 2px; }

.center-card {
  max-width: 440px; margin: 40px auto; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; text-align: center;
}
.wide-card { max-width: 600px; }

.badge {
  display: inline-block; background: var(--panel-2); border: 1px solid var(--border); color: #c3c9d5;
  font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; margin: 0 4px 4px 0; white-space: nowrap;
}
.badge svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; vertical-align: -1px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-muted { background: var(--panel-2); color: var(--muted); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

/* forms */
.stack { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 20px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.stack .hint { font-weight: 400; font-size: 12.5px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm); font: 16px var(--font-body); /* 16px stops iOS zoom */
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="file"] { font-size: 14px; color: var(--muted); padding: 8px; }
input[type="range"] { padding: 0; accent-color: var(--accent); background: none; border: 0; }
textarea { font-family: inherit; resize: vertical; width: 100%; line-height: 1.5; }
.row-form { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.row-form input[type="text"], .row-form input[type="number"], .row-form input[type="search"], .row-form input[type="date"] { flex: 1 1 200px; min-width: 0; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-top: 4px; }
.checkbox-item { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: 14px !important; color: var(--text) !important; font-weight: 400 !important; }
.checkbox-item input { width: auto; padding: 0; }

/* buttons */
button, .button-link, .button-small, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #0b0e14; border: 1px solid var(--accent);
  padding: 9px 15px; border-radius: var(--radius-sm); font: 600 14px/1.2 var(--font-body);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap;
}
button:hover, .button-link:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.button-link { margin-top: 16px; }
.button-small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
.btn-ghost, .button-small {
  background: var(--panel-2); color: var(--text); border-color: var(--border);
}
.btn-ghost:hover, .button-small:hover { background: var(--panel-3); border-color: var(--border-strong); }
.btn-danger, button.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: rgba(239, 99, 99, 0.45); }
.btn-danger:hover { background: rgba(239, 99, 99, 0.22); border-color: var(--bad); }
.btn-good { background: var(--good); border-color: var(--good); color: #08140e; }
.btn-good:hover { background: #52d895; border-color: #52d895; }
.btn svg, .button-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-button { background: none; border: 0; color: var(--muted); padding: 0; font-weight: 500; font-size: 13px; }
.link-button:hover { background: none; color: var(--bad); text-decoration: underline; }

.status { font-weight: 600; padding: 10px; border-radius: var(--radius-sm); }
.status-in { background: var(--good-soft); color: var(--good); }
.status-out { background: var(--panel-2); color: var(--muted); }

/* stats */
.stats-row { display: flex; gap: 14px; margin: 20px 0; justify-content: center; flex-wrap: wrap; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; text-align: center; min-width: 110px; }
.stat-num { font: 650 26px/1.1 var(--font-display); letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 22px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-value { font: 650 30px/1 var(--font-display); letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 8px; }
.kpi-value small { font: 500 13px/1 var(--font-body); color: var(--muted); letter-spacing: 0; }
.kpi-foot { font-size: 12.5px; color: var(--muted); }
.kpi-foot b { color: var(--text); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; flex-shrink: 0; }
.live-dot.off { background: var(--faint); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(60,203,133,.45); } 70% { box-shadow: 0 0 0 7px rgba(60,203,133,0); } 100% { box-shadow: 0 0 0 0 rgba(60,203,133,0); } }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.spark span { width: 8px; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--panel-3); }
.spark span.on { background: var(--accent); }
.spark span.today { outline: 1px solid var(--accent); outline-offset: 1px; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.table .wrap-cell { white-space: normal; min-width: 180px; }
.table .num { text-align: right; }
.row-inactive { opacity: 0.55; }
.panel.flush { padding: 0; }
.panel.flush .panel-header { padding: 16px 20px 0; }
.panel.flush .table th:first-child, .panel.flush .table td:first-child { padding-left: 20px; }
.panel.flush .table th:last-child, .panel.flush .table td:last-child { padding-right: 20px; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell b { font-weight: 600; }

/* avatars */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 600; }
.avatar-c0 { background: #5b8cff; }
.avatar-c1 { background: #2fa866; }
.avatar-c2 { background: #d9534b; }
.avatar-c3 { background: #e0a800; color: #1a1a1a; }
.avatar-c4 { background: #9a5cf0; }
.avatar-c5 { background: #16a9b8; }
.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--panel-2); }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.who .avatar { margin-right: 6px; }
.avatar-upload-form { display: flex; gap: 10px; align-items: center; margin: 12px 0 20px; flex-wrap: wrap; justify-content: center; }

/* lists (dashboard widgets, due soon) */
.list { list-style: none; margin: 0 -10px; padding: 0; }
.list li > a, .list li > .row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); }
.list li > a:hover { background: var(--panel-2); text-decoration: none; }
.list .t { min-width: 0; flex: 1; line-height: 1.3; }
.list .t b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .t span { font-size: 12.5px; color: var(--muted); }
.list .meta { font: 500 12px/1 var(--font-mono); color: var(--muted); white-space: nowrap; }
.list .meta.warn, .due-today { color: var(--warn); }
.list .meta.bad, .due-over { color: var(--bad); }
.empty-note { color: var(--muted); font-size: 14px; padding: 6px 0; margin: 0; }

.due-soon-list { list-style: none; margin: 0; padding: 0; }
.due-soon-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; gap: 8px; }
.due-soon-list li:last-child { border-bottom: none; }
.due-soon-title { flex: 1; text-align: left; min-width: 0; }

/* dashboard */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dash-col > .panel { margin-bottom: 0; }
.live-rows { list-style: none; margin: 0 -10px; padding: 0; }
.live-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 9px 10px; border-radius: var(--radius-sm); }
.live-row:hover { background: var(--panel-2); }
.live-row .roles { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 3px; }
.live-row .roles .badge { margin: 0 3px 0 0; }
.live-row .dur { font: 500 14px/1.2 var(--font-mono); text-align: right; }
.live-row .since { font-size: 12px; color: var(--muted); text-align: right; }
.live-row a.name { color: var(--text); font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--border); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 1.8; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; background: none; border: 0; box-shadow: none !important; padding: 9px 0; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.seg button, .seg a { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button:hover, .seg a:hover { background: none; color: var(--text); text-decoration: none; }
.seg [aria-pressed="true"], .seg a.on { background: var(--panel-3); color: var(--text); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 9px; border-radius: var(--radius-sm); background: var(--panel-2); }
.day .dn { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.day .ring { width: 30px; height: 30px; }
.day .ring circle { fill: none; stroke-width: 4; }
.day .ring .track { stroke: var(--panel-3); }
.day .ring .val { stroke: var(--good); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.day .cnt { font: 500 11.5px/1 var(--font-mono); color: var(--muted); }
.day.off { background: transparent; border: 1px dashed var(--border); }
.day.off .dn { color: var(--faint); }
.day.today { outline: 1px solid var(--accent); }
.day.miss .ring .val { stroke: var(--warn); }

/* progress */
.progress { height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s; }
.progress.done > span { background: var(--good); }
.progress-lg { height: 10px; }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--panel-2); }
.bar span { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.legend div { display: flex; flex-direction: column; gap: 2px; }
.legend .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend .sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.legend .v { font: 650 21px/1.1 var(--font-display); }

/* ------------------------------------------------------------ task board */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select { padding: 6px 10px; font-size: 14px; }
.task-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.task-column { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.task-column-title { font: 600 12px/1.2 var(--font-body); color: var(--muted); margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; }
.task-column-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.task-count { background: var(--panel-2); color: var(--text); font: 500 11.5px/1 var(--font-mono); padding: 3px 7px; border-radius: 999px; margin-left: auto; letter-spacing: 0; }
.task-empty { font-size: 13px; color: var(--faint); margin: 4px 0; }
.task-card { position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 10px; margin-bottom: 10px; }
.task-card:hover { border-color: var(--border-strong); }
.task-card.prio-high { box-shadow: inset 3px 0 0 var(--bad); }
.task-card.prio-low { opacity: 0.88; }
.task-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.task-title:hover { color: var(--accent); text-decoration: none; }
.task-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.task-tags .badge { margin: 0; }
.prio { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.prio-high-tag { background: var(--bad-soft); color: var(--bad); }
.prio-low-tag { background: var(--panel-3); color: var(--muted); }
.task-progress { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font: 500 11.5px/1 var(--font-mono); color: var(--muted); }
.task-progress .progress { flex: 1; }
.task-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; flex-wrap: wrap; }
.task-assignee { display: flex; align-items: center; gap: 6px; color: var(--text); min-width: 0; }
.task-icons { display: flex; gap: 8px; color: var(--muted); font-size: 12px; align-items: center; }
.task-icons svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; vertical-align: -2px; }
.task-due { color: var(--muted); white-space: nowrap; font-family: var(--font-mono); font-size: 11.5px; }
.task-due-soon { color: var(--warn); font-weight: 600; }
.task-due-overdue { color: var(--bad); font-weight: 600; }
.task-move-form { margin-top: 10px; }
.task-move-form select { width: 100%; font-size: 13px; padding: 5px 8px; }
.archive-note { margin-top: 14px; font-size: 13.5px; }

/* task page */
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.task-side .panel { margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.prose { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.prose a { word-break: break-all; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .check-btn { width: 22px; height: 22px; padding: 0; border-radius: 6px; background: var(--panel-2); border: 1.5px solid var(--border-strong); color: transparent; flex-shrink: 0; }
.checklist .check-btn:hover { border-color: var(--accent); background: var(--panel-2); }
.checklist .done .check-btn { background: var(--good); border-color: var(--good); color: #08140e; }
.checklist .check-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 3; }
.checklist .item-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.checklist .done .item-text { color: var(--muted); text-decoration: line-through; }
.checklist form { display: inline; margin: 0; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.thread li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.thread .head { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.thread .head b { color: var(--text); font-weight: 600; }
.submission { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--panel-2); }
.submission + .submission { margin-top: 10px; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list a { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; }
.file-list svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.activity { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.activity li { padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--muted); }
.activity li:last-child { border-bottom: 0; }
.activity b { color: var(--text); font-weight: 500; }
.review-box { border: 1px solid rgba(239, 178, 59, 0.45); background: var(--warn-soft); }

/* heatmap */
#heatmap { overflow-x: auto; padding-top: 8px; }
.heatmap-outer { display: flex; gap: 6px; }
.heatmap-weekdays { display: flex; flex-direction: column; gap: 3px; padding-top: 18px; }
.heatmap-weekday-label { height: 12px; font-size: 10px; color: var(--muted); line-height: 12px; }
.heatmap-grid-wrapper { display: flex; flex-direction: column; gap: 4px; }
.heatmap-months { display: flex; gap: 3px; height: 14px; }
.heatmap-month-label { width: 12px; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: visible; }
.heatmap-grid { display: flex; gap: 3px; }
.heatmap-week-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 2px; background: var(--panel-2); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heatmap-legend .heatmap-cell { display: inline-block; }
.year-nav a { margin-left: 12px; color: var(--muted); }
.year-nav a.active-link { color: var(--text); font-weight: 600; }

/* kiosk + check-in */
.kiosk { display: flex; gap: 40px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.kiosk-qr-panel { text-align: center; }
.qr-frame { background: white; padding: 20px; border-radius: 16px; display: inline-block; }
.qr-frame img { width: 320px; height: 320px; display: block; }
.qr-timer { width: 320px; height: 6px; background: var(--panel-2); border-radius: 3px; margin: 14px auto 4px; overflow: hidden; }
.qr-timer-bar { height: 100%; background: var(--accent); width: 100%; }
.kiosk-live-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; min-width: 280px; }
.live-list { list-style: none; margin: 0; padding: 0; }
.live-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.live-left { display: flex; align-items: center; gap: 8px; }
.live-avatar { width: 22px; height: 22px; font-size: 10px; flex-shrink: 0; }
.live-name { font-weight: 600; }
.live-time { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }
.result-card { border-width: 2px; }
.result-ok { border-color: var(--good); }
.result-fail { border-color: var(--bad); }
.result-icon { font-size: 40px; margin-bottom: 10px; }
.result-ok .result-icon { color: var(--good); }
.result-fail .result-icon { color: var(--bad); }

/* calendar */
.cal-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.cal-dot-ok { background: var(--good); }
.cal-dot-miss { background: var(--bad); }
.cal-dot-off { background: var(--panel-2); border: 1px solid var(--border); }
.cal-table th { text-align: center; }
.cal-cell { vertical-align: top !important; white-space: normal !important; text-align: left; min-width: 92px; padding: 8px !important; }
.cal-cell-empty { background: transparent; }
.cal-cell-today { background: var(--accent-soft); border-radius: 8px; }
.cal-day-num { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cal-name-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; color: var(--bad); }
.cal-name-list li { padding: 1px 0; }
details summary { cursor: pointer; font-size: 12px; color: var(--bad); }
details summary::marker { color: var(--muted); }
details.section > summary { font: 600 15px var(--font-display); color: var(--text); padding: 4px 0; }
details.section > summary .n-pill { margin-left: 6px; }

/* budget */
.budget-pie-row { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.pie-legend { list-style: none; margin: 0; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 7px; }
.pie-legend li { display: flex; align-items: center; gap: 8px; }
.pie-swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.cat-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; }
.cat-row input[type="text"] { flex: 1; min-width: 0; padding: 6px 10px; font-size: 14px; }

/* inventory */
.qty-adjust { display: flex; align-items: center; gap: 6px; }
.qty-adjust form { display: inline; margin: 0; }
.qty-num { min-width: 28px; text-align: center; font: 600 14px var(--font-mono); }
.qty-num.qty-low { color: var(--bad); }
.row-low-stock { background: rgba(239, 99, 99, 0.05); }
.loc-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.loc-chip:hover { text-decoration: none; background: rgba(109, 143, 255, 0.24); }
.loc-chip svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.loc-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.loc-card:hover { border-color: var(--accent); text-decoration: none; }
.loc-card b { font-weight: 600; }
.loc-card span { font-size: 12.5px; color: var(--muted); }
.move-form { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.labels-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.label-card { background: #fff; color: #111; border-radius: 10px; padding: 14px; text-align: center; break-inside: avoid; }
.label-card img { width: 150px; height: 150px; display: block; margin: 0 auto 8px; }
.label-card b { font: 650 17px var(--font-display); display: block; }
.label-card span { font-size: 11px; color: #555; }

/* import preview */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.row-error td { background: var(--bad-soft); }
.row-note { font-size: 12px; color: var(--warn); }
.row-err-text { font-size: 12px; color: var(--bad); }

/* profile */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.connect-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; padding: 14px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }

.toast-copy { font-size: 13px; color: var(--good); margin-left: 8px; }

/* -------------------------------------------------------------- narrow */
@media (max-width: 1100px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .task-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .dash-grid, .task-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 12px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden;
  }
  .brand-name small, .nav-label, .me-text, .logout { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 7px 10px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; }
  .me { padding: 4px; background: none; }
  .main { padding: 22px 16px 48px; }
}
@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .wrap { padding: 18px 14px; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; row-gap: 8px; }
  .topbar nav { gap: 10px; flex-wrap: wrap; font-size: 13px; }
  .brand-name { font-size: 15px; }
  .center-card, .wide-card { padding: 22px 18px; margin: 20px auto; max-width: 100%; }
  .stat { flex: 1 1 90px; padding: 12px 14px; }
  .stat-num { font-size: 22px; }
  .panel { padding: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .row-form, .avatar-upload-form { flex-wrap: wrap; }
  .task-board { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 25px; }
  .live-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .live-row form { grid-column: 2 / -1; }
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .move-form { grid-template-columns: 80px minmax(0, 1fr); }
  .table th, .table td { padding: 8px 10px; font-size: 13px; }
  .qr-frame { padding: 14px; }
  .qr-frame img { width: min(280px, 78vw); height: min(280px, 78vw); }
  .qr-timer { width: min(280px, 78vw); }
  .kiosk { gap: 24px; }
  .kiosk-live-panel { width: 100%; min-width: 0; }
}

@media print {
  body { background: #fff; }
  .sidebar, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .labels-sheet { grid-template-columns: repeat(3, 1fr); }
  .label-card { border: 1px dashed #999; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
#budget-pie { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
#budget-pie svg { max-width: 100%; height: auto; }
.card-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; vertical-align: -2px; }
.button-link[style*="transparent"] { border-color: transparent; }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* ===================================================== phones (v0.9.1) ===
   Under 860px the sidebar is replaced by a compact header + a bottom tab
   bar (thumb-reachable), with the less-used admin pages in a "More" sheet
   that opens via #more (pure CSS :target, works without JavaScript). */
.m-header, .m-tabbar, .m-sheet { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .shell { display: block; min-height: 100vh; }

  .m-header {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20;
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
    background: rgba(12, 15, 20, 0.88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .m-header .brand { padding: 0; }
  .m-header .brand-mark { width: 28px; height: 28px; font-size: 14px; }
  .m-me { display: flex; border-radius: 50%; }

  .m-tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: rgba(20, 24, 32, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .m-tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: 10px; min-height: 48px;
    color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
  }
  .m-tab:hover { text-decoration: none; color: var(--text); }
  .m-tab.active { color: var(--accent); }
  .m-tab.active .m-tab-icon { background: var(--accent-soft); }
  .m-tab-icon { position: relative; display: grid; place-items: center; width: 44px; height: 26px; border-radius: 999px; }
  .m-tab-icon svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .m-badge {
    position: absolute; top: -4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 999px; background: var(--warn); color: #1a1205; font: 700 10.5px/17px var(--font-body); text-align: center;
  }

  .m-sheet { display: block; position: fixed; inset: 0; z-index: 40; pointer-events: none; }
  .m-sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity .2s; }
  .m-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border-top: 1px solid var(--border-strong); border-radius: 18px 18px 0 0;
    transform: translateY(105%); transition: transform .22s ease;
  }
  .m-sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 4px auto 10px; }
  .m-sheet .nav a { padding: 13px 12px; font-size: 16px; }
  .m-sheet .nav a svg { width: 20px; height: 20px; }
  .m-sheet:target { pointer-events: auto; }
  .m-sheet:target .m-sheet-backdrop { opacity: 1; }
  .m-sheet:target .m-sheet-panel { transform: translateY(0); }

  .main { padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
}

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-head .head-actions { width: 100%; }
  .head-actions .btn, .head-actions button { padding: 8px 12px; font-size: 13.5px; }
  .head-actions .btn:last-child { margin-left: auto; }
  .panel { padding: 16px; border-radius: 14px; }
  .panel.flush { padding: 0; }
  .panel.flush .panel-header { padding: 14px 16px 0; }

  /* forms: inputs and their button stack full-width; bigger touch targets */
  .row-form { flex-direction: column; align-items: stretch !important; }
  .row-form > * { width: 100%; }
  .row-form .checkbox-item { width: auto; }
  .row-form button, .row-form .button-small { justify-content: center; padding: 10px 14px; font-size: 14px; margin-top: 0 !important; }
  .toolbar .btn-ghost[type="submit"] { display: none; } /* instant search filters as you type */

  /* tables that become cards: <table class="table table-stack"> with
     data-label on each cell */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; align-items: center; gap: 8px; padding: 0 !important; border: 0; white-space: normal; min-width: 0; font-size: 14px; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--faint); font-size: 12px; min-width: 64px; }
  .table-stack td.cell-main { grid-column: 1 / -1; font-size: 15px; }
  .table-stack td.cell-main::before { display: none; }
  .table-stack td.cell-side { grid-column: 2; grid-row: 2 / span 3; justify-content: flex-end; align-self: center; }
  .table-stack td.cell-side::before { display: none; }
  .table-stack td.cell-full { grid-column: 1 / -1; }
  .table-stack td.empty-cell { grid-column: 1 / -1; }
  .table-stack .wrap-cell { min-width: 0; }
  .panel.flush .table-stack td:first-child, .panel.flush .table-stack td:last-child { padding-left: 0 !important; padding-right: 0 !important; }

  /* task board: swipe between columns instead of one very long page */
  .board-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
  .board-tabs::-webkit-scrollbar { display: none; }
  .board-tabs a { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; }
  .board-tabs a:hover { text-decoration: none; }
  .board-tabs a.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
  .board-tabs .dot { width: 7px; height: 7px; border-radius: 50%; }
  .task-board {
    display: flex !important; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px; scrollbar-width: none;
  }
  .task-board::-webkit-scrollbar { display: none; }
  .task-column { flex: 0 0 88%; scroll-snap-align: start; padding: 12px; }
  .task-card { padding: 12px; }
  .task-move-form select { padding: 9px 10px; font-size: 15px; }

  /* task page: key facts first, history last */
  .task-layout { display: flex; flex-direction: column; gap: 0; }
  .task-layout > .task-main { order: 1; }
  .task-side { display: contents; }
  .task-side .task-facts { order: 0; }
  .task-side .task-history { order: 2; }
  .facts { grid-template-columns: 84px minmax(0, 1fr); }

  .move-form { grid-template-columns: 1fr 1fr; }
  .move-form input[type="number"] { grid-column: 1 / -1; font-size: 18px; text-align: center; }
  .move-form input[type="text"] { grid-column: 1 / -1; }
  .move-form button { padding: 12px; font-size: 15px; }

  .summary .kpi-value { font-size: 24px !important; }
  .legend .v { font-size: 18px; }
  .flash { font-size: 14px; }
}
.board-tabs { display: none; }
@media (max-width: 640px) { .board-tabs { display: flex; } }

/* finger-sized controls on touch screens */
@media (pointer: coarse) {
  .button-small { min-height: 38px; padding: 8px 12px; }
  .qty-adjust .button-small { min-width: 40px; }
  .checklist .check-btn { width: 28px; height: 28px; }
  .checklist li { padding: 10px 0; }
  .link-button { padding: 8px 4px; }
  select { min-height: 40px; }
}
@media (max-width: 640px) {
  .table-stack td.hide-sm { display: none; }
  .table-stack tr[hidden] { display: none; }
  .table-stack .row-inactive, .table-stack tr.row-inactive { opacity: .6; }
}
@media (max-width: 860px) {
  .m-sheet { visibility: hidden; transition: visibility 0s .22s; }
  .m-sheet:target { visibility: visible; transition: visibility 0s; }
  .m-sheet .nav { flex-direction: column; }
}
.summary.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .summary.three .kpi:nth-child(3) { border-left: 1px solid var(--border); }
  .summary.three .kpi:nth-child(n+3), .summary.two .kpi:nth-child(n+3) { border-top: 0; }
}
@media (max-width: 640px) {
  .summary.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary.three .kpi:first-child { grid-column: 1 / -1; }
  .summary.three .kpi:nth-child(2) { border-left: 0; border-top: 1px solid var(--border); }
  .summary.three .kpi:nth-child(3) { border-top: 1px solid var(--border); }
  .task-layout > *, .task-side > .panel { width: 100%; }
  .stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { min-width: 0; padding: 12px 8px; }
}
