/* =========================================================================
   EV Inspect — Apple / iOS-inspired UI
   ========================================================================= */
:root {
  --bg: #f2f2f7;              /* iOS grouped background */
  --bg-elev: #ffffff;
  --card: #ffffff;
  --field: #ffffff;
  --field-alt: #f2f2f7;
  --text: #1c1c1e;
  --text-2: #3c3c43;
  --muted: #8e8e93;
  --sep: rgba(60, 60, 67, .13);
  --sep-strong: rgba(60, 60, 67, .29);
  --accent: #d0202e;         /* corporate red */
  --accent-press: #a3161f;
  --accent-tint: rgba(208, 32, 46, .10);
  --brand-grad: linear-gradient(135deg, #e23140, #b3121f);
  --blue: #d0202e;           /* ปุ่มลิงก์เป็นแดงให้เข้าธีม */
  --danger: #ff3b30;
  --amber: #ff9f0a;
  --radius-card: 18px;
  --radius-field: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --blur: saturate(180%) blur(20px);
  --seg-on: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --card: #1c1c1e;
    --field: #1c1c1e;
    --field-alt: #2c2c2e;
    --text: #ffffff;
    --text-2: #ebebf5;
    --muted: #8e8e93;
    --sep: rgba(84, 84, 88, .40);
    --sep-strong: rgba(84, 84, 88, .65);
    --accent: #ff4d5a;
    --accent-press: #e23140;
    --accent-tint: rgba(255, 77, 90, .18);
    --brand-grad: linear-gradient(135deg, #e23140, #8f0f1a);
    --blue: #ff6b74;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.5);
    --seg-on: #636366;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { letter-spacing: -0.01em; }

/* ---------- App shell ---------- */
.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top));
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(179,18,31,.25);
}
.topbar .logo { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.16); padding: 2px; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: -0.02em; flex: 1; color: #fff; }
.topbar .sub { font-size: 11.5px; color: rgba(255,255,255,.85); font-weight: 400; display: block; margin-top: 1px; }
/* ปุ่มไอคอน (เริ่มต้น: พื้นอ่อน ข้อความเข้ม — ใช้ในหน้าแก้ไข) */
.icon-btn {
  background: var(--field-alt); border: none; color: var(--accent);
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; cursor: pointer; transition: transform .12s, background .12s;
}
.icon-btn:active { transform: scale(.9); background: var(--sep); }
/* บนแถบสีแดง: ให้เป็นสีขาว */
.topbar .icon-btn { background: rgba(255,255,255,.18); color: #fff; }
.topbar .icon-btn:active { background: rgba(255,255,255,.3); }

.content { flex: 1; padding: 18px; padding-bottom: 108px; }

/* ---------- Dashboard (หน้าหลัก) ---------- */
.hero {
  background: var(--brand-grad); color: #fff; border-radius: 20px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(179,18,31,.28);
  display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden;
}
.hero::after { content: "🔌"; position: absolute; right: -6px; bottom: -14px; font-size: 92px; opacity: .16; transform: rotate(-12deg); }
.hero .h-txt { flex: 1; position: relative; z-index: 1; }
.hero .h-txt .t { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.hero .h-txt .s { font-size: 12.5px; opacity: .9; margin-top: 3px; }
.hero .h-stat { text-align: center; position: relative; z-index: 1; }
.hero .h-stat b { display: block; font-size: 26px; font-weight: 800; line-height: 1; }
.hero .h-stat span { font-size: 11px; opacity: .9; }

.net-status {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff4e5; color: #b45309; border: 1px solid #fde3c0;
  border-radius: 12px; padding: 9px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 16px; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .net-status { background: #3a2a12; color: #ffb057; border-color: #5a3f18; } }

.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; margin-bottom: 20px; }
.action-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer;
  background: none; border: none; color: var(--text); font-family: inherit;
}
.action-item .ico {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  font-size: 24px; color: #fff; background: var(--brand-grad); box-shadow: 0 4px 12px rgba(179,18,31,.25);
  transition: transform .12s;
}
.action-item:active .ico { transform: scale(.92); }
.action-item .lbl { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.25; }
.action-item.alt .ico { background: var(--field-alt); color: var(--accent); box-shadow: none; border: 1px solid var(--sep); }

.section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px 2px; letter-spacing: -.02em; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 40;
  width: 100%; max-width: 640px;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 0.5px solid var(--sep);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; color: var(--muted); font-family: inherit; padding: 4px;
}
.nav-item .nico { font-size: 21px; line-height: 1; }
.nav-item .nlbl { font-size: 10.5px; font-weight: 600; }
.nav-item.on { color: var(--accent); }
.nav-item.primary .nico {
  width: 46px; height: 46px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; font-size: 24px; margin-top: -20px; box-shadow: 0 6px 16px rgba(179,18,31,.4); border: 3px solid var(--bg);
}
.nav-item.primary .nlbl { margin-top: 1px; }

/* ---------- List ---------- */
.list-actions { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search { flex: 1; position: relative; }
.search input {
  width: 100%; background: var(--field-alt); border: none;
  border-radius: 11px; padding: 11px 12px 11px 36px; outline: none; font-size: 16px;
  color: var(--text); transition: box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { box-shadow: 0 0 0 3px var(--accent-tint); }
.search::before { content: "􀊫"; }
.search::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .45; font-size: 14px; }

.record {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: none;
  border-radius: var(--radius-card); padding: 12px 14px; margin-bottom: 12px;
  cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s ease, background .12s;
}
.record:active { transform: scale(.985); background: color-mix(in srgb, var(--card) 92%, var(--muted)); }
.record .thumb {
  width: 58px; height: 58px; border-radius: 13px; object-fit: cover;
  background: var(--field-alt); flex: none; display: grid; place-items: center; color: var(--muted); font-size: 24px;
}
.record .meta { flex: 1; min-width: 0; }
.record .meta .model { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.record .meta .serial { font-family: "SF Mono", ui-monospace, "Cascadia Mono", monospace; color: var(--text-2); font-size: 13px; word-break: break-all; margin-top: 1px; }
.record .meta .date { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.record .chev { color: var(--sep-strong); font-size: 20px; flex: none; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--field-alt); color: var(--muted); }
.badge.done { color: var(--accent); background: var(--accent-tint); }
.badge.dup { color: #b45309; background: #fff4e5; border: 1px solid #fde3c0; }
@media (prefers-color-scheme: dark) { .badge.dup { color: #ffb057; background: #3a2a12; border-color: #5a3f18; } }

.record.sel { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.record .check {
  width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: #fff; background: var(--field-alt); border: 2px solid var(--sep-strong);
}
.record .check.on { background: var(--accent); border-color: var(--accent); }

.gps-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gps-box { flex: 1; min-width: 140px; font-size: 13.5px; }
.gps-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.gps-empty { color: var(--muted); font-size: 13px; }

.empty { text-align: center; color: var(--muted); padding: 72px 20px; }
.empty .big { font-size: 52px; margin-bottom: 10px; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 15px 26px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  box-shadow: 0 6px 20px rgba(208,32,46,.4);
  display: flex; gap: 8px; align-items: center; cursor: pointer; transition: transform .12s;
}
.fab:active { transform: translateX(-50%) scale(.96); }

/* ---------- Fields & cards ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 7px 2px; font-weight: 500; }
.field .req { color: var(--accent); }
.input, textarea.input {
  width: 100%; background: var(--field); border: 0.5px solid var(--sep-strong);
  border-radius: var(--radius-field); padding: 13px 14px; outline: none; font-size: 16px;
  color: var(--text); transition: box-shadow .15s, border-color .15s;
}
.input:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-tint); }
.input.mono { font-family: "SF Mono", ui-monospace, "Cascadia Mono", monospace; letter-spacing: 0.02em; font-size: 17px; font-weight: 500; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
select.input { -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238e8e93' d='M6 8 0 2 1.4.6 6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* iOS segmented control */
.segment { display: flex; background: var(--field-alt); border-radius: 11px; padding: 3px; gap: 3px; }
.seg-opt {
  flex: 1; border: none; background: transparent; color: var(--text); padding: 10px 8px;
  border-radius: 8px; font-weight: 600; font-size: 15px; cursor: pointer; transition: all .18s ease;
}
.seg-opt.on { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0,0,0,.14); }

.card {
  background: var(--card); border: none;
  border-radius: var(--radius-card); padding: 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.card h3 .n { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }

/* photo capture */
.photo-slot { border-radius: 14px; overflow: hidden; background: var(--field-alt); position: relative; }
.photo-slot .ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 34px 12px; color: var(--muted); cursor: pointer; text-align: center;
  border: 1.5px dashed var(--sep-strong); border-radius: 14px;
}
.photo-slot .ph .ic { font-size: 34px; }
.photo-slot img.preview { width: 100%; max-height: 300px; object-fit: contain; background: #000; }
.photo-slot .bar { display: flex; gap: 8px; padding: 10px; border-top: 0.5px solid var(--sep); background: var(--card); }

.btn {
  background: var(--field-alt); border: none; color: var(--blue);
  border-radius: 11px; padding: 12px 14px; font-weight: 600; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; transition: transform .1s, filter .12s;
}
.btn:active { transform: scale(.97); filter: brightness(.95); }
.btn.brand { background: var(--accent); color: #fff; }
.btn.ghost { background: var(--field-alt); }
.btn.danger { color: var(--danger); background: var(--field-alt); }
.btn.sm { padding: 9px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.ocr-status {
  display: none; align-items: center; gap: 12px; margin-top: 12px;
  background: var(--field-alt); border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.ocr-status.on { display: flex; }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--sep); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { flex: 1; height: 6px; background: var(--sep); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  background: var(--accent-tint); border: none; border-radius: 999px; color: var(--accent-press);
  padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: "SF Mono", ui-monospace, monospace; font-weight: 600;
  transition: transform .1s;
}
.chip:active { transform: scale(.95); }
.chips-label { font-size: 13px; color: var(--muted); margin-top: 14px; }

details.raw { margin-top: 12px; }
details.raw summary { cursor: pointer; color: var(--blue); font-size: 14px; font-weight: 500; }
details.raw pre { white-space: pre-wrap; word-break: break-word; background: var(--field-alt); border-radius: 10px; padding: 12px; font-size: 12.5px; max-height: 170px; overflow: auto; margin-top: 8px; }

/* photo grids (รูปตัวเครื่อง + รูปงาน) */
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.wp-item { background: var(--field-alt); border-radius: 13px; overflow: hidden; box-shadow: var(--shadow); }
.wp-item img { width: 100%; height: 120px; object-fit: cover; background: #000; }
.wp-item input { width: 100%; border: none; border-top: 0.5px solid var(--sep); background: transparent; padding: 9px 10px; font-size: 14px; outline: none; color: var(--text); }
.wp-add {
  border: 1.5px dashed var(--sep-strong); border-radius: 13px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); cursor: pointer; transition: background .12s;
}
.wp-add:active { background: var(--field-alt); }
.wp-cell { position: relative; }
.wp-cell .del {
  position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: none; color: #fff; cursor: pointer; font-size: 14px; z-index: 2; display: grid; place-items: center;
}

.editor-actions {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
  display: flex; gap: 10px; padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 0.5px solid var(--sep);
  max-width: 640px; margin: 0 auto;
}
.editor-actions .btn { flex: 1; padding: 15px; font-size: 16px; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* Checklist */
.ck-badge { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--field-alt); padding: 3px 10px; border-radius: 999px; }
.ck-quick { margin-bottom: 10px; }
.ck-sec { font-size: 12px; font-weight: 700; color: var(--accent); margin: 14px 0 6px; }
.ck-item { padding: 8px 0; border-bottom: 1px solid var(--sep); }
.ck-item:last-child { border-bottom: none; }
.ck-top { margin-bottom: 7px; }
.ck-label { font-size: 14px; }
.ck-unit { color: var(--muted); font-size: 12px; }
.ck-controls { display: flex; align-items: center; gap: 8px; }
.ck-val { width: 78px; flex: none; background: var(--field); border: 0.5px solid var(--sep-strong); border-radius: 9px; padding: 8px 10px; font-size: 15px; outline: none; color: var(--text); font-family: "SF Mono", ui-monospace, monospace; }
.ck-val:focus { border-color: var(--accent); }
.ck-btns { display: flex; gap: 6px; flex: 1; }
.ck-b { flex: 1; border: 1px solid var(--sep-strong); background: var(--field); color: var(--muted); border-radius: 9px; padding: 8px 4px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; }
.ck-b:active { transform: scale(.96); }
.ck-b.pass.on { background: #e7f8ec; border-color: #34c759; color: #1a8a3d; }
.ck-b.fail.on { background: #ffecec; border-color: var(--danger); color: #d02a20; }
.ck-b.na.on { background: var(--field-alt); border-color: var(--sep-strong); color: var(--text); }
@media (prefers-color-scheme: dark) {
  .ck-b.pass.on { background: rgba(52,199,89,.22); color: #5be584; }
  .ck-b.fail.on { background: rgba(255,59,48,.22); color: #ff8a82; }
}
.ck-note { display: block; width: 100%; margin-top: 8px; background: var(--field); border: 0.5px solid var(--danger); border-radius: 9px; padding: 9px 11px; font-size: 14px; outline: none; color: var(--text); }
.ck-note.hidden { display: none; }

/* ---- จัดการ Checklist (แก้ไข/เพิ่ม/ลบ) ---- */
.ckm-sechead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ckm-secname { flex: 1; font-weight: 700; }
.ckm-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ckm-item .input { flex: 1; min-width: 0; }
.ckm-item .ckm-unit { width: 66px; flex: none; padding-right: 26px; }
.ckm-item .btn.sm.danger { flex: none; padding: 9px 11px; }

/* รูปที่โหลดไม่สำเร็จ (เน็ตหลุด) — แสดงเป็นปุ่มแตะเพื่อโหลดใหม่ แทนกล่องดำ */
img.img-failed {
  background: var(--field-alt) !important;
  border: 1px dashed var(--sep-strong);
  min-height: 90px;
  cursor: pointer;
  position: relative;
}

/* ครอปภาพจากป้าย เหนือช่อง Model/Serial */
.ocr-crop { margin-bottom: 10px; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.ocr-crop .tag { display: block; font-size: 11.5px; color: #fff; background: var(--accent); padding: 6px 10px; font-weight: 600; }
.ocr-crop img { width: 100%; max-height: 96px; object-fit: contain; background: #fff; padding: 6px; }
.fix-note { font-size: 12.5px; color: var(--text-2); background: var(--accent-tint); border-radius: 10px; padding: 8px 10px; margin-top: 8px; line-height: 1.5; }
.dup-warn { font-size: 12.5px; font-weight: 600; color: #b45309; background: #fff4e5; border: 1px solid #fde3c0; border-radius: 10px; padding: 9px 11px; margin-top: 8px; cursor: pointer; line-height: 1.5; }
@media (prefers-color-scheme: dark) { .dup-warn { background: #3a2a12; color: #ffb057; border-color: #5a3f18; } }

/* toast */
.toast {
  position: fixed; bottom: calc(100px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,32,.92); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: #fff; padding: 13px 20px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 120;
  opacity: 0; pointer-events: none; transition: all .28s cubic-bezier(.2,.9,.3,1.2); font-size: 14.5px; font-weight: 500; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(255,59,48,.94); }

/* Login */
.login-wrap { min-height: 68vh; display: grid; place-items: center; padding: 10px; }
.login-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 30px 24px; width: 100%; max-width: 340px; text-align: center; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 14px; box-shadow: var(--shadow); }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-sub { font-size: 13px; color: var(--muted); margin: 4px 0 20px; }
.login-card .input { margin-bottom: 12px; text-align: left; }
.login-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; font-weight: 600; }

.ro-banner { background: #fff4e5; color: #b45309; border: 1px solid #fde3c0; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; text-align: center; margin-bottom: 14px; }
@media (prefers-color-scheme: dark) { .ro-banner { background: #3a2a12; color: #ffb057; border-color: #5a3f18; } }

/* Viewer summary */
.vfield { display: flex; flex-direction: column; gap: 3px; padding: 9px 0; border-bottom: 1px solid var(--sep); }
.vlbl { font-size: 11.5px; color: var(--muted); }
.vval { font-size: 15px; font-weight: 500; }
.note-view { white-space: pre-wrap; background: var(--field-alt); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; font-size: 14px; min-height: 20px; }
.vck-item { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--sep); }
.vck-ic { width: 20px; text-align: center; font-weight: 800; flex: none; }
.vck-pass .vck-ic { color: #1a8a3d; }
.vck-fail { color: var(--danger); }
.vck-fail .vck-ic { color: var(--danger); }
.vck-na .vck-ic { color: var(--muted); }

/* Bottom sheet menu */
.sheet-wrap { position: fixed; inset: 0; z-index: 150; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.42); opacity: 0; transition: opacity .25s; }
.sheet-wrap.show .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto;
  background: var(--bg-elev); border-radius: 22px 22px 0 0;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 -10px 34px rgba(0,0,0,.22);
}
.sheet-wrap.show .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 999px; background: var(--sep-strong); margin: 8px auto 10px; }
.sheet-head { text-align: center; margin-bottom: 14px; }
.sheet-title { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.sheet-user { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sheet-list { display: flex; flex-direction: column; gap: 6px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px; background: var(--field-alt); border: none;
  border-radius: 13px; padding: 15px 16px; font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; font-family: inherit; text-align: left; transition: transform .1s, filter .12s;
}
.sheet-item:active { transform: scale(.985); filter: brightness(.95); }
.sheet-item .mi-ic { font-size: 20px; width: 26px; text-align: center; flex: none; }
.sheet-item .mi-label { flex: 1; }
.sheet-item .mi-chev { color: var(--muted); font-size: 18px; font-weight: 600; }
.sheet-item.danger { color: var(--danger); }
.sheet-item.danger .mi-chev { color: var(--danger); opacity: .6; }
.sheet-cancel {
  width: 100%; margin-top: 12px; padding: 15px; border: none; border-radius: 13px;
  background: var(--field-alt); color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.sheet-cancel:active { filter: brightness(.95); }

.hidden { display: none !important; }
.file-input { display: none; }

img.zoomable { cursor: zoom-in; }

/* Lightbox */
#lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.94); display: none; flex-direction: column; }
#lightbox.show { display: flex; }
.lb-bar { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); }
.lb-btn {
  background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: none; color: #fff; padding: 11px 15px; border-radius: 11px; font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.lb-btn:active { transform: scale(.96); }
.lb-stage { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 10px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .15s; cursor: zoom-in; }
.lb-stage img.zoom { max-width: none; max-height: none; width: 270%; height: auto; cursor: zoom-out; }

/* QR scanner */
.qr-scan { position: fixed; inset: 0; z-index: 210; background: #000; display: flex; flex-direction: column; }
.qr-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); color: #fff; font-size: 14px; }
.qr-stage { flex: 1; position: relative; overflow: hidden; display: grid; place-items: center; }
.qr-stage video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; width: 64vw; max-width: 300px; aspect-ratio: 1; border: 3px solid var(--accent); border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.qr-hint { position: absolute; bottom: 12%; color: #fff; background: rgba(0,0,0,.5); padding: 8px 16px; border-radius: 999px; font-size: 13px; }
