/* Safety Observation — "tag rack" identity
   แนวคิด: ทุกรายการคือแท็กความปลอดภัยแบบแขวน สีตามประเภท (UA แดง / UC ส้ม / GP เขียว / NM น้ำเงิน) */

:root {
  --bg: #E3E6E1;          /* concrete */
  --surface: #F8F9F6;
  --surface-2: #EDF0EA;
  --ink: #17201D;
  --ink-2: #4D5954;
  --line: #C7CEC6;
  --hivis: #F2C230;       /* hi-vis yellow — ปุ่มหลักเท่านั้น */
  --hivis-ink: #1A1808;
  --act: #C0392B;  --act-ink: #fff;
  --cond: #E0951F; --cond-ink: #1F1606;
  --good: #2C7F51; --good-ink: #fff;
  --near: #2F64A8; --near-ink: #fff;
  --other: #6B7772; --other-ink: #fff;
  --ok: #2C7F51; --warn: #9A5B00; --bad: #B03226;
  --focus: #2F64A8;
  --shadow: 0 1px 0 rgba(23,32,29,.06), 0 6px 18px -10px rgba(23,32,29,.35);
  --f-display: "Barlow Condensed", "IBM Plex Sans Thai", sans-serif;
  --f-body: "IBM Plex Sans Thai", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 10px;
  --nav-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513; --surface: #182019; --surface-2: #1F2823; --ink: #E6ECE8; --ink-2: #9DAAA3; --line: #2E3934;
    --act: #E0574A; --act-ink: #1A0503; --cond: #F0A23C; --good: #4DB27A; --good-ink: #04140B;
    --near: #5D93DA; --near-ink: #050F1D; --other: #8A9690; --other-ink: #0D1210;
    --ok: #5BC48A; --warn: #F0A23C; --bad: #F0776B; --focus: #7FB0F0;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 20px -12px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 22px; height: 22px; flex: none; }
.mono { font-family: var(--f-mono); font-size: .86em; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-2); }

/* ───────── shell ───────── */
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: #17201D; color: #E6ECE8;
}
@media (prefers-color-scheme: dark) { .topbar { background: #0A0E0C; border-bottom: 1px solid var(--line); } }
@media (min-width: 900px) { .rack-head .btn-primary { display: none; } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-mark { width: 28px; height: 34px; background: var(--hivis); clip-path: polygon(6px 0,100% 0,100% 100%,6px 100%,0 calc(100% - 6px),0 6px); position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 50%; top: 6px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: #17201D; }
.brand b { font: 700 20px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.brand small { display: block; font: 500 11px/1.2 var(--f-mono); opacity: .7; letter-spacing: .02em; }
.top-user { font-size: 13px; text-align: right; line-height: 1.3; opacity: .9; }
.top-user span { display: block; font: 500 11px var(--f-mono); opacity: .7; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; }
.iconbtn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

.main { max-width: 1080px; margin: 0 auto; padding: 16px; }
.demo-flag { background: var(--hivis); color: var(--hivis-ink); font: 600 13px var(--f-body); text-align: center; padding: 4px 12px; }

/* bottom nav (มือถือ) */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font-size: 12px; color: var(--ink-2); min-height: 44px; position: relative; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--ink); border-radius: 0 0 3px 3px; }
.nav .fab { color: var(--hivis-ink); }
.nav .fab .fab-disc { display: grid; place-items: center; width: 52px; height: 52px; margin-top: -22px; border-radius: 14px; background: var(--hivis); box-shadow: 0 0 0 4px var(--surface), var(--shadow); }
.nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--act); color: var(--act-ink); font: 600 11px/18px var(--f-mono); text-align: center; }
.nav .desk, .nav .desk-l, .desk-only { display: none; }

@media (min-width: 900px) {
  .shell { padding-bottom: 24px; display: grid; grid-template-columns: 232px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav { position: sticky; top: 64px; inset: auto; height: calc(100vh - 64px); display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; border-top: 0; border-right: 1px solid var(--line); background: transparent; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
  .nav a:hover { background: var(--surface-2); }
  .nav a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
  .nav a[aria-current="page"]::before { top: 10px; bottom: 10px; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .nav .fab { order: -1; margin-bottom: 12px; background: var(--hivis); color: var(--hivis-ink); font-weight: 600; }
  .nav .fab:hover { background: color-mix(in srgb, var(--hivis) 88%, #000); }
  .nav .fab .fab-disc { width: auto; height: auto; margin: 0; background: none; box-shadow: none; }
  .nav .badge { position: static; margin-left: auto; }
  .nav .desk { display: flex; }
  .nav .mob, .nav .mob-l { display: none; }
  .nav .desk-l { display: inline; }
  .desk-only { display: inline-grid; }
  .main { padding: 24px 32px; width: 100%; }
}

/* ───────── type ───────── */
.eyebrow { font: 600 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.h1 { font: 700 26px/1.15 var(--f-body); letter-spacing: -.01em; }
.h2 { font: 600 18px/1.3 var(--f-body); }
.pagehead { display: flex; align-items: flex-end; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.pagehead > div { margin-right: auto; }
.pagehead .eyebrow { margin-bottom: 6px; }

/* ───────── buttons / fields ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--hivis); border-color: var(--hivis); color: var(--hivis-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--hivis) 88%, #000); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--ink-2); }
.req { color: var(--act); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface); transition: border-color .15s;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.grid2 { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.err { color: var(--bad); font-size: 14px; font-weight: 500; }

/* segmented choices */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 500; }
.choice input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.choice input:checked + span .risk i { background: color-mix(in srgb, var(--bg) 35%, transparent); }
.choice input:checked + span .risk.r1 i:nth-child(-n+1), .choice input:checked + span .risk.r2 i:nth-child(-n+2) { background: var(--bg); }
.choice input:checked + span .risk.r3 i { background: var(--hivis); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice .sw { width: 12px; height: 16px; background: var(--tc); clip-path: polygon(3px 0,100% 0,100% 100%,3px 100%,0 calc(100% - 3px),0 3px); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ───────── panels ───────── */
.panel { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.panel > .h2 { margin-bottom: 12px; }
.fieldset { border: 0; margin: 0 0 8px; padding: 0; }
.fieldset legend { font: 600 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 0; margin-bottom: 12px; }

/* ───────── tag (ตัวแทนของรายการ Observation) ───────── */
.t-act { --tc: var(--act); --tc-ink: var(--act-ink); }
.t-cond { --tc: var(--cond); --tc-ink: var(--cond-ink); }
.t-good { --tc: var(--good); --tc-ink: var(--good-ink); }
.t-near { --tc: var(--near); --tc-ink: var(--near-ink); }
.t-other { --tc: var(--other); --tc-ink: var(--other-ink); }

.taglist { display: grid; gap: 10px; }
.tag {
  display: grid; grid-template-columns: 46px 1fr; text-decoration: none; background: var(--surface);
  border-radius: 0 var(--r) var(--r) 0; box-shadow: var(--shadow); min-height: 96px;
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  transition: transform .15s;
}
.tag:hover { transform: translateX(2px); }
.tag-stub { background: var(--tc); color: var(--tc-ink); display: flex; flex-direction: column; align-items: center; padding-top: 12px; gap: 8px; }
.tag-stub::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px color-mix(in srgb, #000 22%, transparent); }
.tag-stub b { font: 700 17px/1 var(--f-display); letter-spacing: .06em; writing-mode: vertical-rl; transform: rotate(180deg); }
.tag-body { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; min-width: 0; }
.tag-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.tag-title { grid-column: 1; font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tag-foot { grid-column: 1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.tag-thumb { grid-column: 2; grid-row: 1 / span 3; width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--surface-2); align-self: center; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-pending { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.s-action { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, var(--surface)); }
.s-verify { color: var(--near); background: color-mix(in srgb, var(--near) 12%, var(--surface)); }
.s-closed { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.s-rejected { color: var(--ink-2); }
.risk { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.risk i { width: 4px; background: var(--line); border-radius: 1px; }
.risk i:nth-child(1) { height: 5px; } .risk i:nth-child(2) { height: 8px; } .risk i:nth-child(3) { height: 12px; }
.risk.r1 i:nth-child(-n+1), .risk.r2 i:nth-child(-n+2), .risk.r3 i { background: var(--ink); }
.risk.r3 i { background: var(--act); }
.overdue { color: var(--bad); font-weight: 600; }

/* ───────── dashboard: ราวแขวนแท็ก (signature) ───────── */
.rack { position: relative; padding: 4px 0 8px; margin-bottom: 20px; }
.rack-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.rack-head .h1 span { color: var(--ink-2); font-weight: 500; }
.rail { height: 6px; border-radius: 3px; background: linear-gradient(var(--ink-2), var(--ink)); margin: 0 4px; }
.hooks { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2.5vw, 24px); padding: 0 clamp(4px, 2vw, 24px); list-style: none; margin: 0; }
.hang {
  --h: 22px; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  margin-top: var(--h); padding: 26px 8px 16px; min-height: 176px; background: var(--tc); color: var(--tc-ink);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
  border-radius: 0 0 8px 8px; transform-origin: 50% calc(var(--h) * -1); animation: sway 1.4s cubic-bezier(.3,1.6,.5,1) both;
  animation-delay: calc(var(--i) * 90ms);
}
.hooks li { position: relative; }
.hooks li::before { content: ""; position: absolute; left: 50%; top: -2px; width: 2px; height: calc(var(--h, 22px) + 16px); margin-left: -1px; background: var(--ink-2); z-index: 1; }
.hang::before { content: ""; position: absolute; top: 10px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 20%, transparent); }
.hang-code { font: 700 13px/1 var(--f-display); letter-spacing: .14em; opacity: .85; margin-top: 4px; }
.hang-num { font: 700 clamp(44px, 9vw, 76px)/1 var(--f-display); letter-spacing: -.01em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.hang-label { font: 600 clamp(12px, 1.8vw, 15px)/1.15 var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.hang-th { font-size: 11.5px; line-height: 1.3; opacity: .85; margin-top: 2px; }
.hang:hover { filter: brightness(1.05); }
@keyframes sway { 0% { transform: rotate(-7deg); } 100% { transform: rotate(0); } }
@media (max-width: 520px) { .hang-th { display: none; } .hang { min-height: 140px; padding-top: 24px; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; text-decoration: none; display: block; }
.stat b { display: block; font: 700 34px/1.05 var(--f-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-2); }
.stat.alert b { color: var(--bad); }
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1.4fr 1fr; } }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 18px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; min-width: 0; }
.bar-col { width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; background: var(--surface-2); position: relative; }
.bar-col i { display: block; background: var(--tc); }
.bar-n { font: 600 12px var(--f-mono); color: var(--ink-2); }
.bar-l { font: 500 11px var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--tc); }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 10px; font-size: 14px; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--ink); border-radius: 5px; }
.hbar b { font: 600 13px var(--f-mono); text-align: right; }

/* ───────── list toolbar ───────── */
.toolbar { display: grid; gap: 10px; margin-bottom: 14px; }
.search { position: relative; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.search .input { padding-left: 42px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .select { width: auto; min-height: 40px; padding: 6px 10px; font-size: 14px; flex: 1 1 140px; }
@media (max-width: 639px) { .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .filters .select { flex: none; max-width: 70vw; } }
.count { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty .btn { margin-top: 12px; }

/* ───────── detail ───────── */
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--ink-2); min-height: 44px; font-weight: 500; }
.dhead { display: grid; grid-template-columns: 58px 1fr; background: var(--surface); box-shadow: var(--shadow); border-radius: 0 var(--r) var(--r) 0; margin-bottom: 16px; clip-path: polygon(14px 0,100% 0,100% 100%,14px 100%,0 calc(100% - 14px),0 14px); }
.dhead .tag-stub b { font-size: 22px; }
.dhead-body { padding: 16px; display: grid; gap: 8px; }
.dhead-body .h1 { font-size: 22px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); font-size: 13px; text-align: center; padding: 8px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo .cap { position: absolute; left: 8px; top: 8px; z-index: 1; background: var(--ink); color: var(--bg); font: 600 11px/1 var(--f-mono); letter-spacing: .08em; padding: 5px 7px; border-radius: 4px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
@media (min-width: 640px) { .kv { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.kv div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv dt { font-size: 12.5px; color: var(--ink-2); }
.kv dd { margin: 2px 0 0; font-weight: 500; white-space: pre-wrap; word-break: break-word; }
.kv .wide { grid-column: 1 / -1; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.steps li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; margin: 5px 0 0 5px; border: 2px solid var(--line); background: var(--surface); z-index: 1; }
.steps li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li.done::before { background: var(--ink); border-color: var(--ink); }
.steps li.now::before { background: var(--hivis); border-color: var(--ink); }
.steps b { display: block; font-weight: 600; }
.steps span { font-size: 13px; color: var(--ink-2); }

/* photo picker */
.picker { display: grid; place-items: center; gap: 6px; min-height: 140px; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; text-align: center; padding: 16px; color: var(--ink-2); position: relative; overflow: hidden; }
.picker:hover { border-color: var(--ink-2); }
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.picker:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker .ico { width: 32px; height: 32px; color: var(--ink); }

.stickybar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; display: flex; gap: 10px; padding: 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); border-radius: 14px; }
.stickybar .btn { flex: 1; }
@media (min-width: 900px) { .stickybar { bottom: 12px; } }

/* tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 600 12px var(--f-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rows { display: grid; gap: 10px; }
.row-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 6px; }
.row-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.row-card .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(10,14,12,.55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 0 18px; }
.dlg-body { padding: 8px 18px 18px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  repeating-linear-gradient(-45deg, var(--hivis) 0 14px, var(--ink) 14px 28px) top / 100% 10px no-repeat, var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-tag { background: var(--surface); box-shadow: var(--shadow); padding: 34px 22px 22px; position: relative; clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%, 0 22px); border-radius: 0 0 14px 14px; }
.login-tag::before { content: ""; position: absolute; top: 12px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 3px var(--line); }
.login h1 { font: 700 40px/0.95 var(--f-display); letter-spacing: .02em; text-transform: uppercase; margin: 10px 0 6px; }
.login p.lead { margin: 0 0 20px; color: var(--ink-2); }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-weight: 500; min-height: 44px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 500; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

.skeleton { height: 96px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
