/* ============================================================
   LabInstrument — Design System
   Warm "Claude.ai"-inspired aesthetic: cream paper, terracotta
   accent, editorial type. Original UI; not a copy of any product.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap');

:root {
  /* accent — overridable by Tweaks (terracotta default) */
  --accent-h: 28;
  --accent-c: 0.105;
  --accent-l: 0.585;
  --accent:        oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-strong: oklch(calc(var(--accent-l) - 0.08) var(--accent-c) var(--accent-h));
  --accent-soft:   oklch(0.95 0.03 var(--accent-h));
  --accent-softer: oklch(0.972 0.018 var(--accent-h));
  --accent-ring:   oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.28);
  --on-accent:     #fff;

  /* paper / neutrals (warm) */
  --bg:        oklch(0.974 0.006 86);
  --bg-sunk:   oklch(0.958 0.007 86);
  --surface:   oklch(0.995 0.004 86);
  --surface-2: oklch(0.978 0.006 86);
  --line:      oklch(0.905 0.008 80);
  --line-soft: oklch(0.935 0.007 82);

  --ink:       oklch(0.265 0.012 60);
  --ink-2:     oklch(0.44 0.012 65);
  --ink-3:     oklch(0.60 0.012 70);
  --ink-4:     oklch(0.72 0.010 75);

  /* semantic status */
  --ok-h: 150; --ok-c: 0.07; --ok-l: 0.56;
  --ok:        oklch(var(--ok-l) var(--ok-c) var(--ok-h));
  --ok-soft:   oklch(0.95 0.035 var(--ok-h));
  --warn-h: 70; --warn:  oklch(0.66 0.11 var(--warn-h));
  --warn-soft: oklch(0.945 0.06 var(--warn-h));
  --danger-h: 28; --danger: oklch(0.585 0.16 var(--danger-h));
  --danger-soft: oklch(0.945 0.05 var(--danger-h));
  --none:      oklch(0.62 0.006 70);
  --none-soft: oklch(0.93 0.004 80);

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px oklch(0.4 0.02 70 / 0.05), 0 1px 1px oklch(0.4 0.02 70 / 0.04);
  --shadow:    0 1px 3px oklch(0.4 0.02 70 / 0.07), 0 8px 24px -12px oklch(0.4 0.02 70 / 0.18);
  --shadow-lg: 0 4px 12px oklch(0.4 0.02 70 / 0.08), 0 24px 60px -20px oklch(0.4 0.02 70 / 0.28);

  --sans: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: 'Newsreader', Georgia, serif;
}

[data-theme="dark"] {
  --accent-soft:   oklch(0.33 0.05 var(--accent-h));
  --accent-softer: oklch(0.28 0.035 var(--accent-h));
  --accent-l: 0.66;
  --accent-ring:   oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.40);

  --bg:        oklch(0.225 0.006 70);
  --bg-sunk:   oklch(0.198 0.006 70);
  --surface:   oklch(0.262 0.007 72);
  --surface-2: oklch(0.295 0.008 74);
  --line:      oklch(0.345 0.008 72);
  --line-soft: oklch(0.31 0.007 72);

  --ink:       oklch(0.945 0.006 80);
  --ink-2:     oklch(0.80 0.008 78);
  --ink-3:     oklch(0.66 0.009 76);
  --ink-4:     oklch(0.52 0.009 74);

  --ok-soft:   oklch(0.34 0.05 var(--ok-h));
  --warn-soft: oklch(0.36 0.06 var(--warn-h));
  --danger-soft: oklch(0.35 0.06 var(--danger-h));
  --none-soft: oklch(0.32 0.004 75);

  --shadow-sm: 0 1px 2px #0006;
  --shadow:    0 2px 6px #0007, 0 12px 32px -16px #000a;
  --shadow-lg: 0 6px 20px #0008, 0 30px 70px -24px #000b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: var(--fs, 15px);
  line-height: 1.5;
  transition: background .35s ease, color .35s ease;
}
#root { min-height: 100vh; }

::selection { background: var(--accent-soft); }

/* scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line); border: 3px solid transparent; background-clip: padding-box; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: padding-box; }

/* ---------- layout shell ---------- */
.app { display: grid; grid-template-columns: var(--rail, 252px) 1fr; min-height: 100vh; }
.app.rail-collapsed { --rail: 76px; }

.rail {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-sunk);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 4px; min-height: 40px; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 #ffffff30, var(--shadow-sm);
}
.brand-name { font-weight: 600; letter-spacing: -.01em; font-size: 15.5px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; flex: 1; overflow-y: auto; min-height: 0; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-4); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  position: relative; transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
[data-theme="dark"] .nav-item.active { color: var(--ink); }
.nav-item .ico { flex: none; }
.nav-item .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 600; font-family: var(--mono);
  background: var(--danger); color: #fff; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.rail-collapsed .nav-item span.txt, .rail-collapsed .nav-label, .rail-collapsed .brand-text, .rail-collapsed .badge-count { display: none; }
.rail-collapsed .nav-item { justify-content: center; }

/* collapsible department sub-menu */
.nav-caret { margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--ink-4); }
.nav-caret:hover { background: var(--line-soft); color: var(--ink-2); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px; padding-left: 6px; }
.nav-subitem {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px 7px 16px; border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 500; color: var(--ink-3); border-radius: 8px; position: relative;
  transition: background .12s, color .12s;
}
.nav-subitem::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 1.5px; background: var(--line); }
.nav-subitem:hover { background: var(--surface-2); color: var(--ink); }
.nav-subitem.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-subitem.active::before { background: var(--accent); }
.nav-subitem .dept-dot { flex: none; }
.nav-subitem .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-subcount { font-size: 11px; color: var(--ink-4); font-weight: 600; }
.nav-subitem.active .nav-subcount { color: var(--accent-strong); }
.rail-collapsed .nav-sub { display: none; }

/* topbar notification bell */
.topbell { position: relative; }
.topbell-dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg); line-height: 1;
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }

/* main column */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 30px;
  background: oklch(from var(--bg) l c h / 0.82);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.page-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.content { padding: 28px 30px 64px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ---------- primitives ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.005em;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .14s, border-color .14s, transform .08s, box-shadow .14s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 9px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; transition: all .14s; white-space: nowrap; font-family: inherit;
}
.chip:hover { border-color: var(--ink-4); color: var(--ink); }
.chip.on { background: var(--accent); border-color: transparent; color: var(--on-accent); }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 9px 3px 8px; border-radius: 99px;
  white-space: nowrap; letter-spacing: -.005em;
}
.pill .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; flex: none; }
.pill.ok     { background: var(--ok-soft);     color: oklch(0.42 0.09 var(--ok-h)); }
.pill.warn   { background: var(--warn-soft);   color: oklch(0.46 0.10 var(--warn-h)); }
.pill.danger { background: var(--danger-soft); color: oklch(0.50 0.15 var(--danger-h)); }
.pill.none   { background: var(--none-soft);   color: var(--ink-3); }
[data-theme="dark"] .pill.ok { color: oklch(0.85 0.10 var(--ok-h)); }
[data-theme="dark"] .pill.warn { color: oklch(0.86 0.11 var(--warn-h)); }
[data-theme="dark"] .pill.danger { color: oklch(0.80 0.13 var(--danger-h)); }

/* mono code token */
.code {
  font-family: var(--mono); font-size: .92em; letter-spacing: -.01em;
  font-weight: 500; color: var(--ink);
}
.kbd-code {
  font-family: var(--mono); font-weight: 600; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 7px; color: var(--ink);
  display: inline-flex; gap: 1px;
}

.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; display: block; letter-spacing: -.005em; }
.input, .select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; transition: border-color .14s, box-shadow .14s; outline: none;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--ink-4); }

/* search */
.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 12px; color: var(--ink-4); pointer-events: none; }
.search input {
  font-family: inherit; font-size: 14px; color: var(--ink); width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 12px 9px 36px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* table */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; cursor: pointer; user-select: none;
}
.tbl thead th:hover { color: var(--ink); }
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover { background: var(--accent-softer); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* dept color dot */
.dept-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }

/* stat figure */
.figure { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* progress bar */
.bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.2,1); }

.divider { height: 1px; background: var(--line-soft); border: none; margin: 0; }

.muted { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* fade/slide entrance */
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.enter { animation: pop .4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes spin { to { transform: rotate(360deg); } }

/* drawer / modal */
.scrim { position: fixed; inset: 0; background: oklch(0.2 0.01 70 / 0.42); backdrop-filter: blur(2px); z-index: 50; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw);
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  z-index: 51; display: flex; flex-direction: column; animation: slidein .32s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3);
  border: none; background: none; padding: 6px 13px; border-radius: 7px; cursor: pointer; transition: all .14s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.rail-toggle { display: none !important; }

/* dropdown menu item */
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; border: none; background: none; cursor: pointer;
  font-family: inherit; color: var(--ink); transition: background .12s;
}
.menu-item:hover { background: var(--surface-2); }
.doc-row:hover { border-color: var(--accent) !important; background: var(--accent-softer) !important; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 9px; z-index: 80;
  background: var(--ink); color: var(--bg); font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
}

/* ---------- print report ---------- */
#print-area { display: none; }
@media print {
  /* hide the entire app (display:none removes layout height → no blank pages) */
  body.printing > #root, body.printing .app { display: none !important; }
  body.printing #print-area, body.printing #print-area * { visibility: visible !important; }
  #print-area {
    display: block !important; position: static; width: 100%;
    padding: 10mm; color: #1a1714; font-family: 'IBM Plex Sans Thai', sans-serif;
  }
  .rpt-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #f97316; padding-bottom: 10px; }
  .rpt-title { font-size: 18px; font-weight: 700; }
  .rpt-sub { font-size: 11px; color: #666; margin-top: 3px; }
  .rpt-logo { width: 40px; height: 40px; border-radius: 9px; background: #f97316; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: 'IBM Plex Mono', monospace; }
  .rpt-summary { display: flex; gap: 18px; font-size: 11.5px; margin: 12px 0; }
  .rpt-summary b { font-size: 13px; }
  .rpt-tbl { width: 100%; border-collapse: collapse; font-size: 10px; }
  .rpt-tbl th { text-align: left; background: #f4efe8; padding: 6px 8px; border-bottom: 1.5px solid #ddd; font-size: 9.5px; text-transform: uppercase; letter-spacing: .03em; color: #555; }
  .rpt-tbl td { padding: 6px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
  .rpt-tbl .mono { font-family: 'IBM Plex Mono', monospace; }
  .rpt-tbl .sub { color: #888; font-size: 9px; }
  .rpt-foot { margin-top: 14px; font-size: 9px; color: #999; text-align: center; }
  /* instrument label */
  /* instrument label — overlay is portaled to <body>, so hide the whole app */
  body.printing-label > #root, body.printing-label .app { display: none !important; }
  body.printing-label #label-print, body.printing-label #label-print * { visibility: visible !important; }
  body.printing-label #label-print { position: static !important; inset: auto !important; background: #fff; display: block; padding: 0; overflow: visible; z-index: auto; }
  body.printing-label #label-print .scrim, body.printing-label .label-toolbar { display: none !important; }
  body.printing-label .label-stack { display: block !important; gap: 0 !important; padding: 0 !important; min-height: 0 !important; }
  body.printing-label .label-sheet { box-shadow: none !important; margin: 0 auto !important; }
  body.printing-label .label-page { break-after: page; break-inside: avoid; display: flex; justify-content: center; }
  body.printing-label .label-page:last-child { break-after: auto; }
  /* temperature log */
  body.printing-temp .rail, body.printing-temp .topbar, body.printing-temp .tl-noprint, body.printing-temp .scrim, body.printing-temp .drawer { display: none !important; }
  body.printing-temp .app { display: block !important; position: static !important; }
  body.printing-temp .main, body.printing-temp .content, body.printing-temp .tl-sheetwrap { display: block !important; position: static !important; max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
  body.printing-temp .temp-sheet { zoom: 0.84; margin: 0 auto !important; box-shadow: none !important; border: 2px solid #111 !important; }
  @page { size: A4 landscape; margin: 6mm; }
  /* repair / maintenance log */
  body.printing-repair .rail, body.printing-repair .topbar, body.printing-repair .tl-noprint, body.printing-repair .rp-del, body.printing-repair .scrim, body.printing-repair .drawer { display: none !important; }
  body.printing-repair .app { display: block !important; position: static !important; }
  body.printing-repair .main, body.printing-repair .content, body.printing-repair .tl-sheetwrap { display: block !important; position: static !important; max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
  body.printing-repair .repair-sheet { zoom: 0.78; margin: 0 auto !important; box-shadow: none !important; border: 2px solid #111 !important; }
  body.printing-repair .rp-date, body.printing-repair .rp-status { display: none !important; }
  body.printing-repair .rp-date-print, body.printing-repair .rp-status-print { display: inline !important; font-size: 11.5px; padding: 4px 6px; }
  body.printing-repair table.rp-tbl textarea, body.printing-repair table.rp-tbl input { color: #111 !important; }
}

/* ============================================================
   INSTRUMENT LABEL (FR-QP-0012 — ISO 15189)
   ============================================================ */
#label-print { position: fixed; inset: 0; z-index: 70; overflow: auto; }
.label-stack { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 30px 28px 60px; min-height: 100%; }
.label-page { display: flex; justify-content: center; }
.label-toolbar { position: fixed; top: 18px; right: 22px; z-index: 72; display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); }
.label-sheet {
  width: 1040px; background: #fff; color: #111; border: 2px solid #111; zoom: var(--lblz, 1);
  font-family: 'IBM Plex Sans Thai', sans-serif; box-shadow: var(--shadow-lg); position: relative; flex: none;
}
.lbl-logo-img { width: 158px; height: auto; display: block; }
.label-sheet * { box-sizing: border-box; }
.lbl-head { display: grid; grid-template-columns: 200px 1fr 300px; border-bottom: 2px solid #111; }
.lbl-logo { border-right: 2px solid #111; padding: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.lbl-logo .emblem { width: 62px; height: 62px; }
.lbl-logo .hn { font-size: 11px; font-weight: 700; color: #1a6b2f; line-height: 1.2; }
.lbl-logo .hn small { display: block; font-size: 8.5px; color: #555; font-weight: 500; letter-spacing: .5px; }
.lbl-title-c { border-right: 2px solid #111; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px; text-align: center; gap: 3px; line-height: 1.3; }
.lbl-title-c b { font-size: 21px; font-weight: 700; }
.lbl-title-c span { font-size: 19px; font-weight: 700; }
.lbl-doc { padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 8px; font-size: 14px; }
.lbl-doc .dl { border-bottom: 1px solid #bbb; padding-bottom: 6px; }
.lbl-doc .dl:last-child { border-bottom: 0; }
.lbl-band { text-align: center; padding: 12px; background: #ededed; border-bottom: 2px solid #111; font-size: 25px; font-weight: 700; }
.lbl-body { display: grid; grid-template-columns: 1fr 360px; }
.lbl-fields { padding: 22px 26px; display: flex; flex-direction: column; gap: 17px; }
.lbl-fields .fr { font-size: 18px; line-height: 1.35; }
.lbl-fields .fr b { font-weight: 700; }
.lbl-fields .fr .val { font-weight: 400; }
.lbl-fields .fr .code { font-family: var(--mono); font-weight: 700; letter-spacing: .3px; }
.lbl-qr { border-left: 1px dashed #999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 22px; }
.lbl-qr .cap { font-family: var(--mono); font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.lbl-foot { border-top: 2px solid #111; text-align: center; padding: 9px; font-size: 12.5px; font-style: italic; color: #555; }
.lbl-logo { gap: 8px; }
.sel-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ============================================================
   TEMPERATURE LOG (FM-CL-00-045)
   ============================================================ */
.tl-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.tl-bar .fld { display: flex; flex-direction: column; gap: 5px; }
.tl-bar label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.tl-sheetwrap { overflow-x: auto; }
.temp-sheet { width: 1180px; background: #fff; color: #111; border: 2px solid #111; font-family: 'IBM Plex Sans Thai', sans-serif; box-shadow: var(--shadow); margin: 0 auto; }
.temp-sheet .lbl-doc { font-size: 12px; }
.temp-sheet .lbl-head { grid-template-columns: 150px 1fr 280px; }
.temp-sheet .lbl-logo { padding: 6px; gap: 4px; }
.temp-sheet .lbl-logo-img { width: 92px; }
.temp-sheet .lbl-logo .hn { font-size: 9px; }
.temp-sheet .lbl-title-c { padding: 8px 10px; gap: 2px; }
.temp-sheet .lbl-title-c b { font-size: 16px; }
.temp-sheet .lbl-title-c span { font-size: 14px; }
.temp-sheet .lbl-doc { padding: 6px 12px; gap: 5px; }
.temp-sheet .lbl-doc .dl { padding-bottom: 4px; font-size: 11.5px; }
.ts-meta { padding: 12px 16px; border-bottom: 2px solid #111; font-size: 13.5px; line-height: 2; }
.ts-meta .uline { border-bottom: 1px dotted #555; padding: 0 8px; font-weight: 600; display: inline-block; min-width: 60px; text-align: center; }
.ts-meta input { border: none; border-bottom: 1px dotted #777; font-family: inherit; font-size: 13px; font-weight: 600; text-align: center; padding: 0 4px; background: transparent; color: #111; outline: none; }
.ts-meta input:focus { border-bottom-color: var(--accent); }
table.tl-grid { border-collapse: collapse; width: 100%; }
table.tl-grid th, table.tl-grid td { border: 1px solid #333; text-align: center; font-size: 11px; padding: 0; height: 26px; }
table.tl-grid thead th { background: #ededed; font-weight: 700; padding: 4px 2px; }
.tl-rowlab { background: #f5f5f5; font-weight: 600; white-space: nowrap; padding: 0 8px !important; text-align: left !important; }
.tl-sesslab { background: #e6efe6; font-weight: 700; writing-mode: vertical-rl; text-orientation: mixed; }
.tl-cell input { width: 100%; height: 24px; border: none; background: transparent; text-align: center; font-family: var(--mono); font-size: 11px; color: #111; outline: none; padding: 0; }
.tl-cell input:focus { background: color-mix(in srgb, var(--accent) 14%, #fff); }
.tl-cell.oor { background: #ffd9d4; }
.tl-cell.oor input { color: #c0271a; font-weight: 700; }
.ts-notes { padding: 8px 16px; font-size: 11.5px; line-height: 1.55; border-bottom: 2px solid #111; }
.ts-corr { padding: 9px 16px; }
.ts-corr h4 { margin: 0 0 6px; font-size: 13px; }
table.tl-corr { border-collapse: collapse; width: 100%; }
table.tl-corr th, table.tl-corr td { border: 1px solid #333; font-size: 12px; padding: 4px 6px; }
table.tl-corr th { background: #ededed; }
table.tl-corr input { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12px; outline: none; color: #111; }
.ts-review { padding: 9px 16px; font-size: 13px; text-align: right; }
[data-skin="midnight"] .temp-sheet, [data-skin="midnight"] .label-sheet { color: #111; }

/* ---------- repair / maintenance log ---------- */
.rp-queue { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.rp-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-queue-empty { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 13.5px; font-weight: 600; margin-top: 12px; }
.rp-queue-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.rp-chip { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; cursor: pointer; font-family: inherit; transition: border-color .14s, background .14s; max-width: 360px; }
.rp-chip:hover { border-color: var(--accent); }
.rp-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.rp-chip-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.rp-chip-code { font-size: 11.5px; color: var(--ink-3); }

.repair-sheet { width: 1180px; background: #fff; color: #111; border: 2px solid #111; font-family: 'IBM Plex Sans Thai', sans-serif; box-shadow: var(--shadow); margin: 0 auto; }
.repair-sheet .lbl-doc { font-size: 12px; }
.repair-sheet .lbl-head { grid-template-columns: 150px 1fr 280px; }
.repair-sheet .lbl-logo { padding: 6px; gap: 4px; }
.repair-sheet .lbl-logo-img { width: 92px; }
.repair-sheet .lbl-doc { padding: 6px 12px; gap: 5px; }
.repair-sheet .lbl-doc .dl { padding-bottom: 4px; font-size: 11.5px; }
.rp-band { text-align: center; font-weight: 700; font-size: 16px; padding: 9px; border-bottom: 2px solid #111; background: #f3f3f3; }
.rp-id { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 2px solid #111; }
.rp-id-row { display: flex; gap: 8px; padding: 7px 16px; align-items: baseline; }
.rp-id-row:nth-child(odd) { border-right: 1px solid #bbb; }
.rp-id-k { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.rp-id-v { font-size: 12.5px; color: #222; }
.rp-id-v.code { font-weight: 600; }
table.rp-tbl { border-collapse: collapse; width: 100%; table-layout: fixed; }
table.rp-tbl th, table.rp-tbl td { border: 1px solid #333; font-size: 12px; padding: 0; vertical-align: top; }
table.rp-tbl th { background: #ededed; font-weight: 700; padding: 5px 4px; text-align: center; }
table.rp-tbl td { padding: 2px; }
.rp-c-num { text-align: center; vertical-align: middle; font-weight: 600; }
table.rp-tbl textarea, table.rp-tbl input { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12px; color: #111; outline: none; resize: none; padding: 4px 6px; line-height: 1.4; overflow: hidden; min-height: 34px; }
table.rp-tbl input { min-height: 0; }
table.rp-tbl textarea:focus, table.rp-tbl input:focus { background: color-mix(in srgb, var(--accent) 12%, #fff); }
.rp-date { font-family: var(--mono); font-size: 11px !important; }
.rp-date-print, .rp-status-print { display: none; }
.rp-stcol { position: relative; }
.rp-status { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 11.5px; font-weight: 700; padding: 6px 4px; outline: none; cursor: pointer; -webkit-appearance: none; appearance: none; text-align: center; }
.rp-status-warn { color: #9a7d10; }
.rp-status-danger { color: #c0271a; }
.rp-status-ok { color: #1f8a5b; }
.rp-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none; background: #f0f0f0; border-radius: 5px; color: #999; cursor: pointer; display: none; align-items: center; justify-content: center; }
.rp-stcol:hover .rp-del { display: flex; }

/* on-screen the status select looks like a clickable colored pill */
.rp-status { border: 1px solid var(--line) !important; border-radius: 7px; background:
  var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 7px center !important;
  padding-right: 20px !important; }
.rp-status:hover { border-color: var(--ink-4) !important; }

/* repair workflow stepper */
.rp-flow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 16px; margin-bottom: 14px; }
.rp-flow-title { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 12px; }
.rp-flow-steps { display: flex; align-items: center; gap: 4px; }
.rp-step { display: flex; align-items: center; gap: 10px; flex: none; }
.rp-step-dot { width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; flex: none; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink-4); transition: all .2s; }
.rp-step-tx { display: flex; flex-direction: column; line-height: 1.25; }
.rp-step-tx b { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.rp-step-tx span { font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.rp-step-bar { flex: 1; height: 3px; border-radius: 99px; background: var(--line); min-width: 24px; }
.rp-step-bar.done { background: var(--ok); }
.rp-step.current .rp-step-dot { border-color: var(--accent); background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.rp-step.current .rp-step-tx b { color: var(--ink); }
.rp-step.done .rp-step-dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.rp-step.done .rp-step-tx b { color: var(--ink-2); }

.rp-hint { display: flex; align-items: flex-start; gap: 9px; background: var(--accent-softer); border: 1px solid var(--accent-soft); border-radius: 11px; padding: 10px 14px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.rp-hint > svg { color: var(--accent); flex: none; margin-top: 2px; }
.rp-hint-warn { color: #9a7d10; } .rp-hint-danger { color: #c0271a; } .rp-hint-ok { color: #1f8a5b; }
[data-theme="dark"] .rp-hint-warn { color: oklch(0.82 0.12 80); } [data-theme="dark"] .rp-hint-ok { color: oklch(0.8 0.12 150); } [data-theme="dark"] .rp-hint-danger { color: oklch(0.78 0.14 28); }

/* responsive */
@media (max-width: 1040px) {
  .topbar-search { display: none !important; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; transform: translateX(-100%); transition: transform .3s; width: 252px; }
  .app.rail-open .rail { transform: none; }
  .content { padding: 20px 18px 60px; }
  .topbar { padding: 12px 18px; }
  .rail-toggle { display: inline-flex !important; }
  .add-label { display: none; }
}
@media (max-width: 720px) {
  .dash-grid, .detail-grid { grid-template-columns: 1fr !important; }
}

/* ============================================================
   AUTH — login & lock screen
   ============================================================ */
.auth {
  position: fixed; inset: 0; z-index: 200; display: grid;
  grid-template-columns: 1.08fr 0.92fr; background: var(--bg);
  color: var(--ink); overflow: hidden; animation: fade .35s ease both;
}
/* left showcase panel */
.auth-show {
  position: relative; overflow: hidden; padding: 44px 46px;
  display: flex; flex-direction: column;
  background:
    radial-gradient(90% 70% at 12% 8%, color-mix(in srgb, var(--accent) 26%, transparent) 0%, transparent 55%),
    radial-gradient(80% 80% at 100% 100%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 50%),
    var(--bg-sunk);
  border-right: 1px solid var(--line);
}
.auth-show::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 38px 38px; mask-image: radial-gradient(70% 70% at 30% 30%, #000 0%, transparent 75%);
}
.auth-scan {
  content: ""; position: absolute; left: 0; right: 0; height: 140px; pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 13%, transparent), transparent);
  animation: scanline 5.5s linear infinite; opacity: .8;
}
@keyframes scanline { 0% { top: -160px; } 100% { top: 100%; } }
.auth-brand { display: flex; align-items: center; gap: 13px; position: relative; }
.auth-mark {
  width: 46px; height: 46px; border-radius: 13px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: var(--shadow), inset 0 1px 0 #ffffff30;
}
[data-skin="midnight"] .auth-mark { box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 #ffffff30; }
.auth-headline {
  font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1.12;
  letter-spacing: -.02em; margin-top: auto; max-width: 13ch; text-wrap: balance;
}
.auth-tag { font-size: 15px; color: var(--ink-2); margin-top: 16px; max-width: 38ch; line-height: 1.6; }
.auth-stats { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; position: relative; }
.auth-stat {
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line);
  border-radius: 13px; padding: 12px 16px; backdrop-filter: blur(6px); min-width: 92px;
}
.auth-stat .v { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.auth-stat .l { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.auth-foot { margin-top: 30px; font-size: 12px; color: var(--ink-4); display: flex; gap: 14px; align-items: center; position: relative; }

/* right form panel */
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 372px; }
.auth-title { font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
.auth-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }
.auth-field { margin-top: 16px; }
.auth-inputwrap { position: relative; display: flex; align-items: center; }
.auth-inputwrap > .ico { position: absolute; left: 13px; color: var(--ink-4); pointer-events: none; }
.auth-inputwrap input {
  width: 100%; font-family: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 13px 12px 40px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.auth-inputwrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.auth-eye { position: absolute; right: 8px; background: none; border: none; color: var(--ink-4); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; }
.auth-eye:hover { color: var(--ink-2); background: var(--surface-2); }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; font-size: 13px; }
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; }
.auth-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.auth-link { color: var(--accent); cursor: pointer; font-weight: 600; white-space: nowrap; }
.auth-submit {
  width: 100%; margin-top: 20px; padding: 13px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 12px; background: var(--accent); color: var(--on-accent);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: filter .14s, transform .08s; box-shadow: var(--shadow-sm);
}
[data-skin="midnight"] .auth-submit { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 40%, transparent); }
.auth-submit:hover { filter: brightness(1.06); }
.auth-submit:active { transform: translateY(1px); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-4); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-sso { display: flex; gap: 10px; }
.auth-sso button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 11px; cursor: pointer; transition: all .14s;
}
.auth-sso button:hover { border-color: var(--ink-4); color: var(--ink); }
.auth-demo { margin-top: 18px; font-size: 12px; color: var(--ink-3); text-align: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 9px; }
.auth-segrole { display: flex; gap: 7px; }
.auth-segrole button {
  flex: 1; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); line-height: 1.3;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; cursor: pointer; transition: all .14s; white-space: nowrap;
}
.auth-segrole button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
[data-skin="midnight"] .auth-segrole button.on { color: var(--accent); }

/* lock screen */
.lock {
  position: fixed; inset: 0; z-index: 210; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(18px) saturate(1.2);
  animation: fade .3s ease both;
}
.lock-card { text-align: center; width: min(360px, 90vw); }
.lock-clock { font-family: var(--mono); font-size: 74px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.lock-date { font-size: 15px; color: var(--ink-2); margin-top: 8px; }
.lock-user { display: inline-flex; align-items: center; gap: 11px; margin: 32px 0 18px; }
.lock-avatar { width: 52px; height: 52px; border-radius: 99px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 18px; box-shadow: var(--shadow); }
[data-skin="midnight"] .lock-avatar { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 50%, transparent); }

/* ============================================================
   DENSITY — global spacing modes (compact / monitor)
   ============================================================ */
[data-density="compact"] .content { padding: 18px 22px 48px; }
[data-density="compact"] .card-pad { padding: 15px 17px; }
[data-density="compact"] .topbar { padding: 10px 24px; }
[data-density="compact"] .tbl tbody td, [data-density="compact"] .tbl thead th { padding: 8px 12px; }
[data-density="compact"] .nav-item { padding: 7px 10px; }

[data-density="monitor"] .content { padding: 14px 18px 40px; max-width: none; }
[data-density="monitor"] .card-pad { padding: 12px 14px; }
[data-density="monitor"] .topbar { padding: 8px 18px; }
[data-density="monitor"] .page-title { font-size: 16px; }
[data-density="monitor"] .page-sub { font-size: 11px; }
[data-density="monitor"] .tbl { font-size: 12.5px; }
[data-density="monitor"] .tbl tbody td { padding: 6px 11px; }
[data-density="monitor"] .tbl thead th { padding: 7px 11px; font-size: 10.5px; }
[data-density="monitor"] .nav-item { padding: 6px 10px; font-size: 13px; }
[data-density="monitor"] .topbar .page-title + .page-sub { display: none; }
[data-density="monitor"] .card { border-radius: 11px; }
[data-density="monitor"] .pill { font-size: 11px; padding: 2px 8px; }

/* ============================================================
   AMBIENT BACKGROUND — glow + grid + grain (borrowed from RM-LIS)
   ============================================================ */
.amb, .amb-grain { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.amb::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(900px 600px at 12% -5%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%),
    radial-gradient(820px 700px at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 55%),
    radial-gradient(720px 720px at 50% 118%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%);
}
.amb::after {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 82% 60% at 50% 26%, #000 28%, transparent 80%);
  mask-image: radial-gradient(ellipse 82% 60% at 50% 26%, #000 28%, transparent 80%);
}
.amb-grain {
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-skin="midnight"] .amb-grain { opacity: .05; }
.app { position: relative; z-index: 1; }
/* let ambient show through main column gaps */
.has-amb .main { background: transparent; }
.has-amb .rail { background: color-mix(in srgb, var(--bg-sunk) 86%, transparent); backdrop-filter: blur(6px); }
.has-amb .topbar { background: color-mix(in srgb, var(--bg) 72%, transparent); }

/* ============================================================
   STEPPER WIZARD (borrow RM-LIS report form)
   ============================================================ */
.wiz { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.wiz-rail { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.wiz-ringcard { padding: 18px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.wiz-meta { padding: 16px 18px; }
.wiz-meta .row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.wiz-meta .row:last-child { border-bottom: 0; padding-bottom: 0; }
.wiz-meta .k { font-family: var(--mono); font-size: 10px; letter-spacing: .6px; color: var(--ink-3); text-transform: uppercase; }
.wiz-meta .v { font-family: var(--mono); font-size: 12.5px; color: var(--ink); font-weight: 500; }
.wiz-meta .v.accent { color: var(--accent); }
.wiz-steps { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.wstep { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; color: var(--ink-2); transition: background .16s, color .16s; position: relative; border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
.wstep:hover { background: var(--accent-softer); color: var(--ink); }
.wstep.active { background: var(--accent-soft); color: var(--ink); }
.wstep.active::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; background: var(--accent); border-radius: 3px; }
[data-skin="midnight"] .wstep.active::before { box-shadow: 0 0 10px var(--accent); }
.wstep .idx { font-family: var(--mono); font-size: 11px; width: 26px; height: 26px; flex: none; border: 1px solid var(--line-2, var(--line)); border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); transition: .16s; }
.wstep.active .idx { border-color: var(--accent); color: var(--accent); }
.wstep.done .idx { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.wstep .nm { font-size: 13px; font-weight: 500; flex: 1; }
.wstep .nm small { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 400; }
.wmain { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; scroll-margin-top: 88px; }
.block-head { display: flex; align-items: center; gap: 14px; padding: 17px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--accent-softer), transparent); }
.block-head .num { font-family: var(--mono); font-size: 12px; color: var(--accent); border: 1px solid var(--accent-soft); background: var(--accent-soft); border-radius: 9px; padding: 7px 10px; }
.block-head h3 { font-size: 16px; font-weight: 600; margin: 0; }
.block-head h3 small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); font-weight: 400; letter-spacing: .5px; margin-top: 2px; }
.block-head .chk { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; transition: .2s; color: var(--ok); }
.block-head .chk svg { opacity: 0; transform: scale(.5); transition: .2s; }
.block.complete .block-head .chk { border-color: var(--ok); background: var(--ok-soft); }
.block.complete .block-head .chk svg { opacity: 1; transform: scale(1); }
.block-body { padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.flabel { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.flabel .tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .5px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.flabel .req { color: var(--danger); }

/* dropzone */
.dropzone { border: 1.5px dashed var(--line-2, var(--line)); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; transition: border-color .16s, background .16s; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-softer); }
.dz-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); display: grid; place-items: center; margin: 0 auto 10px; color: var(--accent); }
.dropzone p { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0; }
.dropzone span { font-size: 11.5px; color: var(--ink-3); }
.filelist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fileitem { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }

/* review grid */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.rev-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.rev-row .rk { font-size: 11.5px; color: var(--ink-3); }
.rev-row .rv { font-size: 13.5px; font-weight: 600; }

/* ============================================================
   ANALYTICS (borrow RM-LIS dashboard patterns)
   ============================================================ */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
.tag-h { font-family: var(--mono); font-size: 10px; letter-spacing: .6px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; text-transform: uppercase; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 160px; }
.dleg { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.dleg .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dleg .nm { color: var(--ink-2); flex: 1; }
.dleg .vv { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.dleg .pp { font-family: var(--mono); font-size: 11px; color: var(--ink-3); width: 40px; text-align: right; }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.vbar { width: 100%; max-width: 46px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent)); transition: height .6s cubic-bezier(.2,.7,.2,1); position: relative; }
[data-skin="midnight"] .vbar { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.vbar-v { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.vbar-l { font-size: 10.5px; color: var(--ink-3); }
.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar-row { display: grid; grid-template-columns: 150px 1fr 38px; gap: 12px; align-items: center; }
.hbar-nm { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 9px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.hbar-v { font-family: var(--mono); font-size: 12.5px; font-weight: 600; text-align: right; }

/* ============================================================
   PIN MODAL + admin badge
   ============================================================ */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 60;
  width: min(380px, 92vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px; text-align: center;
  animation: pop .3s cubic-bezier(.2,.7,.2,1) both;
}
.modal-ic { width: 54px; height: 54px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.pin-input { width: 100%; text-align: center; font-size: 24px; letter-spacing: 10px; font-family: var(--mono); padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); outline: none; margin-top: 6px; }
.pin-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.admin-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .5px; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok); border-radius: 99px; padding: 4px 10px; }

/* topbar cluster (RM-LIS style) */
.topclock { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); text-align: right; line-height: 1.3; white-space: nowrap; }
.topclock b { color: var(--ink); font-weight: 500; }
.topclock span { color: var(--ink-3); font-size: 10.5px; }
.status-online { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok); border-radius: 20px; padding: 6px 11px; white-space: nowrap; }
.avatar-wrap { position: relative; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 12.5px; font-weight: 700; background: linear-gradient(135deg, var(--accent-strong), var(--accent)); color: var(--on-accent); border: 2px solid color-mix(in srgb, var(--ink) 12%, transparent); cursor: pointer; flex: none; }
.avatar-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 220px; z-index: 45; padding: 8px; box-shadow: var(--shadow-lg); }
.am-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.rail-collapse { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); display: grid; place-items: center; cursor: pointer; flex: none; transition: .15s; }
.rail-collapse:hover { color: var(--accent); border-color: var(--accent); }
.rail-collapsed .rail-collapse { margin: 0 auto; }
@media (max-width: 1100px) { .topclock { display: none; } }
@media (max-width: 940px) { .status-online { display: none; } }

/* ============================================================
   SKIN: SaaS — Light Purple · Soft-UI Lite · Glassmorphism
   · Linear-style sidebar.  Layered over base tokens via
   [data-skin="saas"] (later in source → wins over :root).
   ============================================================ */
[data-skin="saas"] {
  /* light purple SaaS palette */
  --bg:        oklch(0.974 0.011 292);
  --bg-sunk:   oklch(0.962 0.014 292);
  --surface:   oklch(0.995 0.004 292);
  --surface-2: oklch(0.972 0.012 292);
  --line:      oklch(0.915 0.016 292);
  --line-soft: oklch(0.945 0.012 292);

  --ink:       oklch(0.29 0.035 290);
  --ink-2:     oklch(0.45 0.030 290);
  --ink-3:     oklch(0.60 0.026 290);
  --ink-4:     oklch(0.72 0.022 292);

  --accent-soft:   oklch(0.95 0.035 292);
  --accent-softer: oklch(0.975 0.018 292);
  --accent-ring:   oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.26);

  --ok-soft:     oklch(0.95 0.04 165);
  --warn-soft:   oklch(0.955 0.06 75);
  --danger-soft: oklch(0.95 0.045 18);
  --none-soft:   oklch(0.95 0.012 292);

  /* soft-UI lite — diffuse violet-tinted shadows, airy radii */
  --radius:    18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px oklch(0.45 0.10 292 / 0.07), 0 1px 1px oklch(0.45 0.10 292 / 0.04);
  --shadow:    0 2px 6px oklch(0.45 0.10 292 / 0.06), 0 14px 34px -16px oklch(0.45 0.12 292 / 0.22);
  --shadow-lg: 0 6px 18px oklch(0.45 0.10 292 / 0.10), 0 36px 70px -28px oklch(0.45 0.14 292 / 0.34);
}

/* page backdrop: subtle lavender wash */
[data-skin="saas"] body {
  background:
    radial-gradient(1100px 620px at 78% -8%, oklch(0.95 0.05 292 / 0.55), transparent 60%),
    radial-gradient(900px 560px at 8% 108%, oklch(0.95 0.045 258 / 0.45), transparent 60%),
    var(--bg);
}

/* ---- Linear-style sidebar: frosted, tight, restrained ---- */
[data-skin="saas"] .rail {
  background: oklch(0.985 0.008 292 / 0.72);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-right: 1px solid oklch(0.9 0.02 292 / 0.7);
}
[data-skin="saas"] .nav-item {
  border-radius: 9px; font-weight: 500; font-size: 13.5px; padding: 8px 10px;
  color: var(--ink-3);
}
[data-skin="saas"] .nav-item:hover { background: oklch(0.95 0.02 292 / 0.7); color: var(--ink); }
[data-skin="saas"] .nav-item .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-skin="saas"] .nav-item.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-strong); font-weight: 600;
}
[data-skin="saas"] .nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: var(--accent);
}
[data-skin="saas"] .nav-label { font-size: 10px; letter-spacing: .11em; color: var(--ink-4); }
[data-skin="saas"] .brand-mark {
  border-radius: 12px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent-strong));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 1px 0 #ffffff55;
}

/* ---- soft-UI cards: borderless, diffuse shadow, rounder ---- */
[data-skin="saas"] .card {
  border: 1px solid oklch(0.94 0.014 292 / 0.7);
  box-shadow: 0 1px 2px oklch(0.45 0.10 292 / 0.05), 0 10px 26px -16px oklch(0.45 0.12 292 / 0.28);
}
[data-skin="saas"] .btn {
  border-radius: 11px;
  box-shadow: 0 1px 2px oklch(0.45 0.08 292 / 0.06);
}
[data-skin="saas"] .btn-primary {
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 90%, #fff), var(--accent));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 #ffffff45;
}
[data-skin="saas"] .chip { border-radius: 99px; }
[data-skin="saas"] .pill { border-radius: 99px; }

/* ---- glassmorphism: topbar + overlays ---- */
[data-skin="saas"] .topbar {
  background: oklch(0.99 0.006 292 / 0.62);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid oklch(0.91 0.02 292 / 0.6);
}
[data-skin="saas"] .scrim {
  background: oklch(0.5 0.08 292 / 0.28);
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
}
[data-skin="saas"] .drawer,
[data-skin="saas"] .modal,
[data-skin="saas"] .avatar-menu,
[data-skin="saas"] .seg {
  background: oklch(0.995 0.004 292 / 0.78);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid oklch(0.92 0.018 292 / 0.7);
}
[data-skin="saas"] .input, [data-skin="saas"] .select, [data-skin="saas"] .search input {
  border-radius: 11px; background: oklch(0.98 0.008 292 / 0.8);
}
[data-skin="saas"] .seg button.on { background: oklch(0.995 0.004 292 / 0.9); }
[data-skin="saas"] table.tbl thead th { background: oklch(0.965 0.014 292 / 0.7); }
[data-skin="saas"] .tbl tbody tr:hover { background: var(--accent-softer); }
.audit-row:hover { background: var(--accent-softer); }

/* keep printable FR sheets pure white regardless of skin */
[data-skin="saas"] .temp-sheet, [data-skin="saas"] .label-sheet, [data-skin="saas"] .repair-sheet { color: #111; }

/* ---------- numeric calibration results table ---------- */
.cal-res-tbl { font-size: 12.5px; }
.cal-res-tbl thead th { background: var(--surface-2); font-size: 10.5px; padding: 8px 8px; }
.cal-res-tbl tbody tr:hover { background: transparent; }
.cal-res-tbl tbody td { padding: 8px 8px; }
.cal-res-tbl .pill { font-size: 11px; }

/* ---------- annual calibration master plan ---------- */
.cp-loadrow { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; }
.cp-loadcell { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; border-radius: 9px; }
.cp-loadcell.now { background: var(--accent-softer); }
.cp-loadbar-track { width: 100%; height: 64px; display: flex; align-items: flex-end; justify-content: center; }
.cp-loadbar { width: 60%; max-width: 26px; min-height: 4px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.cp-loadnum { font-size: 13px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cp-loadmon { font-size: 10.5px; color: var(--ink-3); }
.cp-loadcell.now .cp-loadmon { color: var(--accent-strong); font-weight: 600; }

.cp-dept-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 14px 18px; border: none; background: none; cursor: pointer; font-family: inherit; border-bottom: 1px solid var(--line-soft); }
.cp-dept-head:hover { background: var(--surface-2); }

table.cp-grid { table-layout: fixed; }
table.cp-grid thead th { background: var(--surface-2); padding: 8px 4px; text-align: center; font-size: 10.5px; }
table.cp-grid thead th.cp-mon-col { width: 56px; }
.cp-name-col { width: 250px; text-align: left !important; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.cp-grid thead th.cp-name-col { background: var(--surface-2); }
table.cp-grid tbody td { padding: 7px 4px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.cp-cell.now, table.cp-grid thead th.cp-mon-col.now { background: var(--accent-softer); }
table.cp-grid tbody tr:hover { background: var(--accent-softer); }
table.cp-grid tbody tr:hover .cp-name-col { background: var(--accent-softer); }
.cp-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm); }
.cp-dot.done { width: 11px; height: 11px; background: transparent; border: 2px solid var(--ink-4); box-shadow: none; }
