/* Drying Report Line 1 — Thai Wah Public Company Limited
   Brand-matched to the Line 2 app (FM-PR-812) for visual consistency. */

/* BL Lot 2 add-on field */
.field input.field-emph {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 800;
  color: var(--bad);
  letter-spacing: .01em;
  min-height: 48px;
  text-align: center;
  background: #fff7f7;
  border-color: var(--bad);
}
.field input.field-emph:focus {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .18);
}
.field input.field-emph::placeholder {
  color: rgba(220, 38, 38, .35);
  font-weight: 600;
}
.bl2-add {
  appearance: none; border: 1px dashed var(--line-2); background: white;
  color: var(--brand); font-weight: 500; font-size: 13px;
  padding: 9px 12px; border-radius: 7px; cursor: pointer;
  min-height: 40px; text-align: left;
}
.bl2-add:hover { border-color: var(--brand); background: var(--brand-light); }
.bl2-block { position: relative; }
.bl2-block label { display: flex; justify-content: space-between; align-items: center; }
.bl2-remove {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); font-size: 16px; cursor: pointer;
  padding: 0 4px; line-height: 1;
}
.bl2-remove:hover { color: var(--bad); }
.bl2-start-l { font-size: 10px !important; color: var(--muted); margin-top: 6px; }
.bl2-start {
  width: 100%; border: 1px solid var(--line-2); border-radius: 7px;
  padding: 6px 10px; font-size: 12px; background: white; min-height: 34px;
  font-family: "IBM Plex Mono", monospace;
}
.bl2-start:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,59,102,.15); outline: 0; }

:root {
  --brand: #0d3b66;
  --brand-dark: #07254a;
  --brand-light: #e7eef7;
  --accent: #d97706;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --ink: #0b1320;
  --ink-2: #2d3748;
  --muted: #6b7280;
  --line: #e2e8f0;
  --line-2: #cbd5e0;
  --bg: #f6f7f9;
  --paper: #ffffff;
  --hilite: #fff4d6;
  --shadow-sm: 0 1px 2px rgba(11,19,32,.06), 0 1px 1px rgba(11,19,32,.04);
  --shadow-md: 0 4px 12px rgba(11,19,32,.08), 0 2px 4px rgba(11,19,32,.04);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "IBM Plex Sans", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
.mono, .num { font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }

/* ─── App shell ───────────────────────────────────────────────────── */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand); color: white;
  border-bottom: 1px solid var(--brand-dark);
}
.topbar-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .01em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: white; color: var(--brand);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: -.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { opacity: .85; font-weight: 400; font-size: 11px; margin-top: 1px; }
.spacer { flex: 1; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.seg {
  display: inline-flex; background: rgba(255,255,255,.12);
  border-radius: 8px; padding: 3px; gap: 2px;
}
.seg button {
  appearance: none; border: 0; background: transparent;
  color: rgba(255,255,255,.85);
  padding: 7px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; min-height: 32px;
}
.seg button[aria-pressed="true"] { background: white; color: var(--brand); box-shadow: var(--shadow-sm); }
.seg button:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.btn {
  appearance: none; border: 0; background: white; color: var(--brand);
  padding: 9px 14px; border-radius: 8px; font-weight: 600; cursor: pointer;
  min-height: 38px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: transform .04s ease, box-shadow .15s ease;
}
.btn:hover { box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: white; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.primary { background: var(--accent); color: white; }
.btn.sm { padding: 6px 10px; font-size: 12px; min-height: 30px; }

.save-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: rgba(255,255,255,.85);
  padding: 4px 10px; background: rgba(255,255,255,.08); border-radius: 999px;
}
.save-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.save-status.saving .dot { background: #fbbf24; animation: pulse 1s infinite; }
.save-status.error .dot { background: #f87171; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ─── Page / cards ────────────────────────────────────────────────── */

.page { max-width: 1700px; width: 100%; margin: 0 auto; padding: 16px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 14px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbfc, #ffffff);
}
.card-head h2 {
  margin: 0; font-size: 14px; font-weight: 600; color: var(--brand-dark);
  letter-spacing: .02em; text-transform: uppercase;
}
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 14px 16px; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0; }

/* ─── Header (meta) ───────────────────────────────────────────────── */

.meta-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px; color: var(--muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
}
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 7px;
  padding: 9px 11px; font-size: 14px; background: white;
  min-height: 40px; outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 59, 102, .15);
}
.field textarea { min-height: 60px; resize: vertical; }

/* Dryer/grade composite field */
.dryer-grade {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
}
.dryer-chips {
  display: inline-flex; background: var(--brand-light);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 3px; gap: 2px;
}
.dryer-chip {
  appearance: none; border: 0; background: transparent;
  color: var(--brand-dark); font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 5px; cursor: pointer;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  min-width: 50px;
}
.dryer-chip:hover { background: rgba(13,59,102,.08); }
.dryer-chip.on {
  background: var(--brand); color: white;
  box-shadow: var(--shadow-sm);
}
.dryer-grade-input {
  flex: 1; min-width: 140px;
  border: 1px solid var(--line-2); border-radius: 7px;
  padding: 9px 11px; font-size: 14px; background: white; min-height: 40px;
}

/* ─── Hour Focus mode ─────────────────────────────────────────────── */

.hour-focus { padding: 12px 0; }
.hour-nav {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; padding: 0 4px;
}
.hour-nav .now {
  flex: 1; text-align: center;
  background: var(--brand); color: white;
  border-radius: 10px; padding: 14px; font-weight: 600; font-size: 24px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.hour-nav .now .label-en { font-size: 11px; opacity: .85; display: block; font-family: "IBM Plex Sans"; }
.hour-nav .hour-step {
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: white; color: var(--brand);
  box-shadow: var(--shadow-md); font-size: 22px; cursor: pointer;
  display: grid; place-items: center;
}
.hour-nav .hour-step:disabled { opacity: .35; cursor: not-allowed; }

.hour-strip {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 4px 0 10px; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.hour-chip {
  flex: 0 0 auto; min-width: 64px; padding: 8px 10px;
  border-radius: 8px; background: white; border: 1px solid var(--line-2);
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-2);
  position: relative;
}
.hour-chip[data-active="true"] { background: var(--brand); color: white; border-color: var(--brand); }
.hour-chip[data-shift="2"]:not([data-active="true"]) { background: #f1f5f9; }
.hour-chip[data-filled="true"]:not([data-active="true"]) { border-color: var(--brand); border-width: 1.5px; }
.hour-chip[data-warn="true"] { border-color: var(--bad); }
.hour-chip[data-warn="true"]:not([data-active="true"]) { background: #fef2f2; color: var(--bad); }
.hour-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .3; }
.hour-chip[data-filled="true"] .dot { opacity: 1; }

.focus-sections {
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
/* SET / PROCESS span 2 cols (because they hold 4 dryer cells inside) so
   Inverter / moisture / output line up neatly underneath in row 2. */
.focus-section.focus-wide { grid-column: span 2; }

/* Tablet — drop to a 2-col grid, wide cards take the full row. */
@media (max-width: 1100px) {
  .focus-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .focus-section.focus-wide { grid-column: span 2; }
}
/* Phone — single column. */
@media (max-width: 600px) {
  .focus-sections { grid-template-columns: 1fr; }
  .focus-section.focus-wide { grid-column: span 1; }
}
.focus-section {
  background: white; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.focus-section h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark);
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.focus-section h3 > span:first-child { flex: 1; }
.focus-section h3 .th-spec {
  font-size: 11px; color: var(--muted); font-weight: 500;
  font-family: "IBM Plex Mono", monospace; text-transform: none; letter-spacing: 0;
}
.focus-section h3 em { font-style: normal; color: var(--accent); font-weight: 700; }
.focus-section.focus-ccp { border-color: var(--accent); border-top: 3px solid var(--accent); }

.focus-row {
  display: grid; grid-template-columns: 1fr 130px;
  align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.focus-row:last-child { border-bottom: 0; }
.focus-row .lbl { font-size: 13px; line-height: 1.3; }
.focus-row .lbl .th { display: block; font-size: 11px; color: var(--muted); }
.focus-row .value-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 7px;
  padding: 8px 10px; font-size: 17px; font-weight: 600; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums;
  min-height: 44px;
}
.focus-row .value-input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,59,102,.15); outline: 0;
}
.focus-row.out-of-spec .value-input {
  border-color: var(--bad); background: #fef2f2; color: var(--bad);
}
.focus-row.soft-spec .value-input { border-color: var(--warn); background: #fffbeb; color: #92400e; }

/* 4-dryer grid inside an hour-focus card */
.dryer-row-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
@media (min-width: 720px) {
  .dryer-row-grid { grid-template-columns: repeat(4, 1fr); }
}
.dryer-cell {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  padding: 8px; border: 1px solid var(--line-2); border-radius: 8px;
  background: #fafbfc; min-width: 0;
}
.dryer-cell-tag {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600;
  text-align: center; color: var(--muted); letter-spacing: .02em;
}
.dryer-cell .value-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 6px 4px; font-size: 17px; font-weight: 600; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  min-height: 42px; background: white;
}
.dryer-cell .value-input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,59,102,.15); outline: 0; }
.dryer-cell-unit { text-align: center; font-size: 10px; color: var(--muted); }
.dryer-cell.out-of-spec { border-color: var(--bad); background: #fef2f2; }
.dryer-cell.out-of-spec .value-input { border-color: var(--bad); color: var(--bad); }
.dryer-cell.soft-spec { border-color: var(--warn); background: #fffbeb; }

/* ─── Dryer Focus mode ────────────────────────────────────────────── */

.dryer-picker {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.dryer-tabs {
  flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--brand-light); padding: 6px; border-radius: 10px;
}
.dryer-tab {
  appearance: none; border: 0; background: transparent;
  border-radius: 7px; padding: 12px 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  color: var(--brand-dark);
  transition: background .12s;
}
.dryer-tab:hover { background: rgba(255,255,255,.5); }
.dryer-tab-l { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.dryer-tab-h { font-family: "IBM Plex Mono", monospace; font-size: 22px; font-weight: 700; }
.dryer-tab.on { background: var(--brand); color: white; box-shadow: var(--shadow-sm); }
.dryer-tab.on .dryer-tab-l { color: rgba(255,255,255,.8); opacity: 1; }

.dryer-hours-grid {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: white;
}
.dh-head, .dh-row {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr 80px;
  align-items: stretch;
}
.dh-head {
  background: var(--brand); color: white; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.dh-head .dh-col { padding: 10px; border-right: 1px solid rgba(255,255,255,.15); }
.dh-row { border-top: 1px solid var(--line); }
.dh-row:hover { background: #fafbfc; }
.dh-col { padding: 6px 10px; border-right: 1px solid var(--line); display: flex; align-items: center; }
.dh-col:last-child { border-right: 0; }
.dh-col-h { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.dh-col-h strong { font-family: "IBM Plex Mono", monospace; font-size: 16px; font-weight: 700; }
.dh-shift { font-size: 11px; color: var(--muted); font-weight: 500; }
.dh-col-shift { justify-content: center; font-family: "IBM Plex Mono", monospace; color: var(--muted); }
.dh-row-shift-break { border-top: 2px solid var(--brand-dark); }
.dh-col input.cell {
  width: 100%; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 8px 6px; font-size: 16px; font-weight: 600; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace; min-height: 40px;
  background: white;
}
.dh-col input.cell:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,59,102,.15); outline: 0; }
.dh-col.out-of-spec input.cell { border-color: var(--bad); background: #fef2f2; color: var(--bad); }
.dh-col.soft-spec input.cell  { border-color: var(--warn); background: #fffbeb; }

/* ─── Grid mode ───────────────────────────────────────────────────── */

.grid-wrap { overflow: auto; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.grid.g2 { border-collapse: collapse; min-width: 1500px; width: 100%; font-size: 13px; }
.grid.g2 th, .grid.g2 td { border: 1px solid var(--line-2); padding: 0; vertical-align: middle; background: white; }

.grid.g2 thead th {
  position: sticky; top: 0; z-index: 4;
  background: var(--brand-light); color: var(--brand-dark);
  padding: 6px 4px; font-size: 11px; font-weight: 600; text-align: center;
}
.grid.g2 thead th.g-shift-hd {
  background: var(--brand); color: white;
}
.grid.g2 thead th.g-shift-hd small { display: block; opacity: .75; font-weight: 400; font-size: 10px; }
.grid.g2 thead th.g-total-hd {
  background: var(--accent); color: white;
  font-size: 11px; line-height: 1.2;
}
.grid.g2 .g-lh {
  position: sticky; left: 0; z-index: 6;
  background: var(--brand); color: white;
  text-align: left; padding: 6px 10px;
  min-width: 200px; width: 200px;
}
.grid.g2 .g-sh {
  position: sticky; left: 200px; z-index: 6;
  background: var(--brand); color: white;
  min-width: 90px; width: 90px;
}
.grid.g2 .g-th {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px;
  min-width: 50px; white-space: nowrap;
}
.grid.g2 .g-th-cur { background: #fde68a; color: #78350f; }

.grid.g2 .g-en { display: block; font-size: 10px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.grid.g2 .g-label {
  position: sticky; left: 0; z-index: 2;
  background: #f8fafc;
  font-size: 12px; font-weight: 500; padding: 6px 8px;
  min-width: 200px; max-width: 200px; width: 200px;
  border-right: 2px solid var(--line-2);
  line-height: 1.3;
}
.grid.g2 .g-sub {
  position: sticky; left: 200px; z-index: 2;
  background: #f1f5f9; font-size: 11px;
  padding: 4px 8px; min-width: 90px; width: 90px;
  text-align: center; color: var(--ink-2);
  border-right: 2px solid var(--line-2);
  line-height: 1.2;
  font-family: "IBM Plex Mono", monospace;
}
.grid.g2 .g-sub.g-ccp { background: #fffbeb; color: var(--accent); font-weight: 700; font-size: 11px; }

.grid.g2 .g-section td { background: var(--brand); color: white; }
.grid.g2 .g-section .g-label { background: var(--brand); color: white; border-right-color: rgba(255,255,255,.2); position: sticky; left: 0; z-index: 3; }
.grid.g2 .g-section .g-label .g-en { color: rgba(255,255,255,.7); }
.grid.g2 .g-banner { font-size: 11px; text-align: left; padding: 4px 10px; font-weight: 500; }

.grid.g2 .g-cell { padding: 0; background: white; }
.grid.g2 .g-cur { background: #fffbeb; }
.grid.g2 .g-cell.out-of-spec { background: #fef2f2; }
.grid.g2 .g-cell.soft-spec  { background: #fffbeb; }
.grid.g2 input.cell {
  width: 100%; height: 100%; min-height: 32px;
  border: 0; background: transparent;
  font-size: 12.5px; text-align: center;
  font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums;
  color: var(--ink); padding: 2px 3px;
}
.grid.g2 .g-cell input.cell:focus {
  background: #fff; box-shadow: inset 0 0 0 2px var(--brand);
  position: relative; z-index: 1;
}
.grid.g2 .g-cell.out-of-spec input.cell { color: var(--bad); font-weight: 700; }
.grid.g2 .g-total {
  background: #fef3c7; color: var(--brand-dark);
  font-family: "IBM Plex Mono", monospace; font-weight: 700;
  text-align: center; padding: 4px 6px; min-width: 60px;
  font-size: 12px;
}
.grid.g2 .g-total b { display: block; }

/* ─── Summary ─────────────────────────────────────────────────────── */

.summary-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.summary-tile {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; background: #fafbfc;
}
.summary-tile .lbl {
  font-size: 11px; color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 500;
}
.summary-tile .lbl .th {
  display: block; color: var(--ink-2);
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px;
}
.sum-rows { display: flex; flex-direction: column; gap: 6px; }
.sum-row { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.sum-row b {
  font-family: "IBM Plex Mono", monospace; font-size: 22px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.sum-row span { font-size: 12px; color: var(--muted); }

.summary-tile.yield-tile { background: var(--brand); color: white; border-color: var(--brand-dark); }
.summary-tile.yield-tile .lbl, .summary-tile.yield-tile .lbl .th { color: rgba(255,255,255,.85); }
.summary-tile.yield-tile .sum-row b { color: white; }
.summary-tile.yield-tile .sum-row span { color: rgba(255,255,255,.7); }

/* ─── Toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white;
  padding: 12px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow-md); z-index: 100;
  display: flex; align-items: center; gap: 8px;
  max-width: 90vw;
  animation: toast-in .2s ease;
}
.toast.success { background: var(--ok); }
.toast.error { background: var(--bad); }
@keyframes toast-in { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Modal — ghost-button visibility on light bg
   (.btn.ghost was designed for the dark topbar; restyle for white modals.) */
.modal .btn.ghost {
  background: white;
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.modal .btn.ghost:hover {
  background: var(--brand-light);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.modal .btn.ghost:disabled {
  opacity: .5;
  cursor: not-allowed;
}
/* ─── Modal ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,19,32,.55); z-index: 100;
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white; border-radius: 14px;
  max-width: 520px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; color: var(--brand-dark); }
.modal-head button { background: transparent; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-body p { margin: 0 0 14px; line-height: 1.5; color: var(--ink-2); font-size: 14px; }
.modal-body .destination {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: #f1f5f9; border-radius: 8px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px;
  margin-bottom: 14px; word-break: break-all;
}
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #fafbfc; }
.modal-footer .btn { box-shadow: none; border: 1px solid var(--line-2); }
.modal-footer .btn.primary { background: var(--brand); color: white; border-color: var(--brand); }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar-inner { padding: 8px 10px; gap: 8px; }
  .brand-text small { display: none; }
  .page { padding: 10px; }
  .card-head { padding: 10px 12px; }
  .card-body { padding: 10px 12px; }
  .seg button { padding: 6px 9px; font-size: 12px; }
  .top-actions .btn .full-label { display: none; }
  .dryer-tabs { gap: 4px; padding: 4px; }
  .dryer-tab { padding: 8px 4px; }
  .dryer-tab-h { font-size: 18px; }
  .dh-head, .dh-row { grid-template-columns: 1fr 1fr 1fr 50px; font-size: 12px; }
  .dh-col { padding: 4px 6px; }
}
@media (max-width: 480px) {
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .dryer-grade { flex-direction: column; align-items: stretch; }
  .hour-nav .hour-step { width: 48px; height: 48px; font-size: 18px; }
  .hour-nav .now { font-size: 20px; padding: 10px; }
  .dryer-row-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .topbar, .hour-strip, .top-actions, .seg, .btn, .modal-backdrop { display: none !important; }
  .card { box-shadow: none; border: 1px solid #999; page-break-inside: avoid; }
  body { background: white; }
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════════════
   AUTH / REPORTS LIST / APPROVAL — extras for the multi-user workflow
   ═══════════════════════════════════════════════════════════════════ */

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  padding: 20px;
}
.login-card {
  background: white;
  width: 100%; max-width: 420px;
  border-radius: 16px;
  padding: 28px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; min-width: 0; }
.login-brand .brand-mark {
  width: 44px; height: 44px; border-radius: 10px; flex: 0 0 44px;
  background: var(--brand); color: white;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.login-brand > div { min-width: 0; flex: 1; }
.login-brand div strong { display: block; font-size: 14px; color: var(--brand-dark); line-height: 1.3; }
.login-brand div small { color: var(--muted); font-size: 11px; }
.login-card h2 { margin: 8px 0 0; font-size: 18px; color: var(--brand-dark); font-weight: 600; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.login-card label span { letter-spacing: .04em; text-transform: uppercase; }
.login-card label input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 11px 13px; font-size: 15px; min-height: 44px; background: white;
}
.login-card label input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,59,102,.15); outline: 0; }
.login-err { color: var(--bad); font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: 8px; border-left: 3px solid var(--bad); }
.login-btn { margin-top: 6px; min-height: 46px; font-size: 15px; box-shadow: var(--shadow-sm); }
.login-hint {
  margin-top: 12px; padding: 10px 12px;
  background: #f1f5f9; border-radius: 8px;
  font-size: 12px; color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.6;
}
.login-hint strong { font-family: "IBM Plex Sans", sans-serif; color: var(--ink-2); display: block; margin-bottom: 4px; }

.newreport-btn { background: var(--ok); border-color: var(--ok); }
.newreport-btn:hover { filter: brightness(.95); }

/* ─── Online users / presence ─────────────────────────────────────── */
.presence-btn {
  position: relative;
  padding-left: 26px !important;
}
.presence-btn .presence-dot {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
}
.presence-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .28);
  animation: presence-pulse 2s infinite;
}
.presence-dot-sm { width: 7px; height: 7px; box-shadow: 0 0 0 2px rgba(74, 222, 128, .28); }
.presence-dot-lg { width: 12px; height: 12px; box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); margin-right: 6px; vertical-align: middle; }
@keyframes presence-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(74, 222, 128, .55); }
  70%  { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0); }
}
.presence-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: rgba(255,255,255,.18); color: white;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  margin-left: 4px;
}

.presence-warn {
  background: #fffbeb; color: #92400e;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12px; margin-bottom: 14px;
  border-left: 3px solid #fbbf24;
}
.presence-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.presence-stat {
  display: flex; flex-direction: column;
  padding: 10px 12px; background: var(--brand-light);
  border-radius: 8px; text-align: center;
}
.presence-stat b {
  font: 700 22px "IBM Plex Mono", monospace; color: var(--brand-dark);
}
.presence-stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

.presence-group { margin-bottom: 14px; }
.presence-group:last-child { margin-bottom: 0; }
.presence-group h4 {
  margin: 0 0 6px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
}
.presence-group-count {
  font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: 12px;
}
.presence-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.presence-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 6px;
  background: var(--surface, #fafbfc); border: 1px solid var(--line);
  font-size: 13px;
}
.presence-list li strong { font-weight: 600; }
.presence-list li small { color: var(--muted); font-weight: 400; }
.presence-list li em {
  font-style: normal; color: var(--brand);
  font-weight: 600; margin-left: auto; font-size: 12px;
}
.primary-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  background: var(--brand-dark);
  border-top: 1px solid rgba(255,255,255,.08);
  overflow-x: auto;
  scrollbar-width: none;
}
.primary-tabs::-webkit-scrollbar { display: none; }
.primary-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.7);
  padding: 12px 18px;
  font: 600 14px "IBM Plex Sans", "Noto Sans Thai", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color .12s, border-color .12s, background .12s;
}
.primary-tabs button:hover { color: white; background: rgba(255,255,255,.06); }
.primary-tabs button.on {
  color: white;
  border-bottom-color: var(--accent);
}
.pt-cnt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: rgba(255,255,255,.18);
  color: white;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
}
.pt-cnt-warn { background: var(--accent); color: white; }
.pt-cnt-ok   { background: var(--ok); color: white; }
.pt-cnt-bad  { background: var(--bad); color: white; }

/* Form-empty state */
.form-empty { display: grid; place-items: center; min-height: 60vh; }
.empty-card {
  background: white;
  padding: 40px 36px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: center;
  max-width: 480px;
}
.empty-card h2 { margin: 0 0 8px; color: var(--brand-dark); font-size: 22px; }
.empty-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }

.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; background: rgba(255,255,255,.12); border-radius: 999px;
  font-size: 12px; color: white;
}
.user-pill strong { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: rgba(255,255,255,.2);
  color: white;
}
.role-badge.role-user    { background: #dbeafe; color: #1e3a8a; }
.role-badge.role-manager { background: #fde68a; color: #78350f; }
.role-badge.role-admin   { background: #fee2e2; color: #7f1d1d; }
.role-badge.status-draft     { background: #f1f5f9; color: #475569; }
.role-badge.status-pending   { background: #fef3c7; color: #92400e; }
.role-badge.status-approved  { background: #dcfce7; color: #14532d; }
.role-badge.status-rejected  { background: #fee2e2; color: #7f1d1d; }
.user-pill .role-badge { padding: 2px 7px; font-size: 9.5px; }

/* Reports list */
.reports-page { max-width: 1400px; margin: 0 auto; padding: 20px; }
.reports-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.reports-head h2 { margin: 0; font-size: 22px; color: var(--brand-dark); font-weight: 700; }
.reports-head small { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.reports-actions { display: flex; gap: 8px; }

.reports-tabs {
  display: flex; gap: 4px;
  background: white; padding: 4px;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px; max-width: 100%; overflow-x: auto;
}
.reports-tabs button {
  appearance: none; border: 0; background: transparent;
  padding: 10px 18px; font: 600 13px var(--ff, "IBM Plex Sans"), sans-serif;
  border-radius: 7px; cursor: pointer; color: var(--ink-2);
  white-space: nowrap; display: flex; align-items: center; gap: 8px;
  transition: background .12s;
}
.reports-tabs button:hover { background: var(--brand-light); }
.reports-tabs button.on { background: var(--brand); color: white; }
.reports-tabs .cnt {
  background: rgba(0,0,0,.1); padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-family: "IBM Plex Mono", monospace; font-weight: 700;
}
.reports-tabs button.on .cnt { background: rgba(255,255,255,.25); color: white; }
.reports-tabs .cnt-warn { background: #fef3c7; color: #92400e; }
.reports-tabs .cnt-ok   { background: #dcfce7; color: #14532d; }
.reports-tabs button.on .cnt-warn, .reports-tabs button.on .cnt-ok { background: rgba(255,255,255,.25); color: white; }

.reports-empty {
  text-align: center; padding: 60px 20px;
  background: white; border-radius: 12px;
  border: 1px dashed var(--line-2);
  color: var(--muted);
}
.reports-empty p { margin: 0 0 16px; font-size: 15px; }

.reports-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.report-card {
  background: white; border: 1px solid var(--line);
  border-radius: 10px; padding: 14px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .08s, box-shadow .15s, border-color .15s;
  position: relative;
  border-left: 4px solid var(--line-2);
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--brand); }
.report-card.status-pending  { border-left-color: #d97706; }
.report-card.status-approved { border-left-color: var(--ok); }
.report-card.status-draft    { border-left-color: var(--line-2); }
.report-card.status-rejected { border-left-color: var(--bad); }

.rc-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rc-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px; }
.rc-status.status-draft    { background: #f1f5f9; color: #475569; }
.rc-status.status-pending  { background: #fef3c7; color: #92400e; }
.rc-status.status-approved { background: #dcfce7; color: #14532d; }
.rc-status.status-rejected { background: #fee2e2; color: #7f1d1d; }
.rc-date { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); }

.rc-dryer {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.rc-dryer .rc-d-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rc-dryer strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px; font-weight: 800; color: var(--bad);
}
.rc-grade { font-size: 13px; color: var(--ink-2); font-weight: 500; }

.rc-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.rc-row span { color: var(--muted); }
.rc-row b { font-weight: 600; color: var(--ink); }

.rc-approver, .rc-reject {
  font-size: 12px; padding: 6px 8px;
  border-radius: 6px; margin-top: 8px;
  display: flex; gap: 6px; align-items: center;
}
.rc-approver { background: #dcfce7; color: #14532d; }
.rc-reject { background: #fee2e2; color: #7f1d1d; }

.rc-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line);
}
.rc-updated { font-size: 11px; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.rc-del {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  transition: background .12s, color .12s;
}
.rc-del:hover { background: #fee2e2; color: var(--bad); }

/* Editor back / breadcrumb */
.editor-back {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: white; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.editor-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.editor-meta small { font-size: 11px; color: var(--muted); }
.submit-for-approval { background: var(--accent); }

/* Approval bar */
.ap-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px; box-shadow: var(--shadow-sm);
}
.ap-bar-pending {
  background: #fffbeb; border: 1px solid #fbbf24; color: #78350f;
}
.ap-bar-approved {
  background: #dcfce7; border: 1px solid var(--ok); color: #14532d;
}
.ap-bar-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ap-bar-actions input.reject-input {
  border: 1px solid var(--line-2); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; min-width: 200px; min-height: 32px;
}

/* Readonly state for editor when report is approved/awaiting */
fieldset.readonly { opacity: .85; }
fieldset.readonly input, fieldset.readonly textarea, fieldset.readonly select {
  background: #f8fafc !important; cursor: not-allowed;
}

/* ─── Storage modal extras ────────────────────────────────────────── */
.modal.modal-lg { max-width: 800px; }
.dest-list { display: flex; flex-direction: column; gap: 8px; }
.dest-opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: 8px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dest-opt:hover { border-color: var(--brand); }
.dest-opt.on { border-color: var(--brand); background: var(--brand-light); }
.dest-opt.disabled { opacity: .5; cursor: not-allowed; }
.dest-opt input { margin-top: 3px; accent-color: var(--brand); width: 18px; height: 18px; }
.dest-opt span strong { display: block; }
.dest-opt span em { display: block; font-size: 12px; color: var(--muted); font-style: normal; margin-top: 3px; }

.settings-divider {
  margin: 18px 0 14px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.settings-divider strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.settings-divider code {
  display: block; font-size: 12px; padding: 6px 10px;
  background: #f1f5f9; border-radius: 6px;
  font-family: "IBM Plex Mono", monospace; color: var(--ink-2);
}

.sync-block {
  margin-top: 16px; padding: 14px;
  background: #f8fafc; border-radius: 10px; border: 1px solid var(--line);
}
.sync-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.sync-h span { font-size: 14px; font-weight: 600; color: var(--brand-dark); }
.sync-h small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.sync-l { display: block; font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.sync-row { display: flex; gap: 6px; align-items: stretch; }
.sync-row input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 7px;
  padding: 9px 11px; font-size: 13px; min-height: 38px;
  font-family: "IBM Plex Mono", monospace;
}
.sync-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,59,102,.15); outline: 0; }
.sync-msg { margin-top: 8px; font-size: 12px; padding: 6px 10px; border-radius: 6px;
  background: var(--brand-light); color: var(--brand-dark); }

/* Admin users table */
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th { text-align: left; padding: 8px 10px; background: #f1f5f9;
  border-bottom: 1px solid var(--line); color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.users-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.users-table input, .users-table select {
  width: 100%; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 6px 8px; font-size: 13px; min-height: 34px;
}
.users-table input:focus, .users-table select:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 2px rgba(13,59,102,.15); }
.users-table .rc-del { font-size: 16px; }

.muted { font-size: 12px; color: var(--muted); }

@media (max-width: 600px) {
  .reports-grid { grid-template-columns: 1fr; }
  .user-pill strong { display: none; }
  .editor-back { padding: 8px 10px; }
  .editor-meta small { display: none; }
}
