/* PLAN.md 4.14: dark mode, thin-bordered translucent cards, one accent
   color (kept as a single variable so it's a one-line change), small-caps
   uppercase section labels, big bold stat numbers. */
:root {
  --bg: #0b0b0d;
  --panel: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --text: #ececeC;
  --muted: #8a8a90;
  --accent: #FDA126; /* Flash Amber - swap this one line to rebrand */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0e0e11;
  border-right: 1px solid var(--border);
  padding: 20px 0;
}
.sidebar .brand { padding: 0 20px 20px; font-weight: 800; letter-spacing: 1px; }
.sidebar .group-label {
  padding: 16px 20px 6px;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.sidebar a {
  display: block;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--panel); }
.sidebar a.active { border-left-color: var(--accent); color: var(--accent); background: var(--panel); }

.main { flex: 1; padding: 28px 32px; overflow-y: auto; }
.topbar { margin-bottom: 24px; }
.topbar .crumb { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.topbar h1 { margin: 4px 0 0; font-size: 1.6rem; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 180px;
  flex: 1 1 180px;
}
.stat-card .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.stat-card .value { font-size: 2rem; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.block { margin-bottom: 32px; }
.block-header {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  font-weight: 700;
}
.block-header .num { color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 1px; }
tr:hover td { background: var(--panel); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: #4caf7d; }
.dot.warn { background: var(--accent); }
.dot.bad { background: #d64d5a; }
.dot.off { background: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
input, select {
  background: #17171b;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
}
button.btn {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.frame-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.frame-grid img { width: 140px; border-radius: 8px; border: 1px solid var(--border); }

/* SETTINGS_PLAN.md item 3 */
.muted { color: var(--muted); }
.sidebar-user {
  margin-top: auto;
  padding: 16px 20px 0;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
}
.sidebar { display: flex; flex-direction: column; }
.sidebar-user a { padding: 0; display: inline; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0;
}
form.inline.no-margin { margin-top: 0; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.override { color: var(--accent); border-color: var(--accent); }

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.settings-row .field-label { flex: 1 1 220px; min-width: 220px; }
.settings-row .field-label .key { display: block; font-size: 0.72rem; color: var(--muted); font-family: monospace; }
.settings-row input[type="checkbox"] { width: 18px; height: 18px; }
.settings-row .locked { color: var(--muted); font-size: 0.8rem; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; }
.flash.error { background: rgba(214,77,90,0.15); border: 1px solid #d64d5a; color: #ff9aa2; }
.flash.ok { background: rgba(76,175,125,0.15); border: 1px solid #4caf7d; color: #8fe0b8; }

.login-box { max-width: 360px; margin: 80px auto; }

@media (max-width: 700px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar .brand, .sidebar .group-label { display: none; }
  .sidebar a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar a.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  .main { padding: 16px; }
  .stat-card { min-width: 140px; }
}

/* -- report pages (/, /orders): filter bar, scrolling table with a pinned date column -- */
.muted { color: var(--muted); }
.period-note { font-size: 0.85rem; margin: 0 0 16px; }
.filterbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); text-decoration: none; font-size: 0.82rem; background: var(--panel);
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 700; }
.filter-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.filter-form input, .filter-form select { text-transform: none; letter-spacing: 0; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
a.btn, .btn.export-btn {
  display: inline-block; background: var(--accent); color: #1a1a1a; text-decoration: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 700; font-size: 0.88rem;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-table th, .report-table td { white-space: nowrap; padding: 8px 6px; font-size: 0.84rem; }
.report-table th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.report-table td:nth-child(3), .report-table td:nth-child(10) { white-space: normal; min-width: 96px; max-width: 150px; }
.report-table .num { text-align: right; }
.report-table .sticky { position: sticky; z-index: 1; background: #151518; }
.report-table .s1 { left: 0; min-width: 46px; width: 46px; }
.report-table .s2 { left: 46px; border-right: 1px solid var(--border); }
.report-table thead th.sticky { z-index: 2; }
.report-table tr:hover td.sticky { background: #1c1c20; }
.report-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; color: var(--accent); }
.report-table .files { min-width: 150px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 16px; }
/* links that carry no styling of their own were the browser's default dark blue on near-black */
.main a:not(.btn):not(.chip) { color: var(--accent); }
@media (max-width: 700px) {
  .report-table .s1 { position: static; }
  .report-table .s2 { left: 0; }
  .filter-form { width: 100%; }
  .filter-form label { flex: 1 1 140px; }
  .filter-form input, .filter-form select { width: 100%; }
}

/* -- report file column: thumbnail + รูป / วิดีโอ / พิมพ์ buttons, and the print modal -- */
.thumb { border-radius: 4px; border: 1px solid var(--border); height: auto; max-height: 80px; width: auto; max-width: 56px; object-fit: cover; cursor: zoom-in; flex-shrink: 0; }
.file-cell { display: flex; gap: 8px; align-items: flex-start; }
.btn-row { display: flex; gap: 5px; flex-wrap: nowrap; }
a.btn.small, button.btn.small {
  display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 6px 9px; min-height: 32px;
  font-size: 0.78rem; font-weight: 700; border-radius: 6px; border: 1px solid transparent; text-decoration: none; cursor: pointer;
}
a.btn.small.ghost { background: transparent; color: var(--text); border-color: var(--border); }
a.btn.small.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.btn.small.print { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }
button.btn.small.print:disabled { background: transparent; color: var(--muted); border-color: var(--border); cursor: not-allowed; }
.print-note { color: var(--muted); font-size: 0.72rem; margin-top: 5px; max-width: 190px; white-space: normal; line-height: 1.3; }
.pbadge { display: inline-block; margin-top: 5px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; border: 1px solid var(--border); white-space: normal; max-width: 220px; line-height: 1.35; }
.pbadge.run { color: var(--accent); border-color: var(--accent); }
.pbadge.ok { color: #8fe0b8; border-color: #4caf7d; }
.pbadge.bad { color: #ff9aa2; border-color: #d64d5a; }

dialog.modal {
  background: #151518; color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 22px;
  width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto;
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
dialog.modal h2 { margin: 0 0 14px; font-size: 1.15rem; }
.modal-close-form { position: absolute; top: 8px; right: 10px; margin: 0; }
.modal-x { background: transparent; border: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; }
.pm-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.pm-thumb { height: 120px; width: auto; max-width: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #0b0b0d; }
.pm-branch { font-weight: 700; margin-bottom: 6px; }
.pm-line { font-size: 0.88rem; color: var(--muted); margin-top: 3px; }
.pm-field { margin-bottom: 14px; }
.pm-field > label:first-child { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; font-size: 1.4rem; background: #17171b; border: 1px solid var(--border); color: var(--text); border-radius: 8px; cursor: pointer; }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper output { min-width: 36px; text-align: center; font-size: 1.5rem; font-weight: 800; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--text); }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); }
.choice.disabled { opacity: 0.5; cursor: not-allowed; }
.price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 4px 0 0 30px; }
.price-row label { font-size: 0.85rem; }
.price-row input { width: 110px; min-height: 40px; }
.pm-notice { padding: 10px 12px; border-radius: 8px; font-size: 0.86rem; margin-bottom: 12px; border: 1px solid #d64d5a; background: rgba(214,77,90,0.12); color: #ff9aa2; }
.pm-notice[data-kind="warn"] { border-color: var(--accent); background: rgba(253,161,38,0.12); color: var(--accent); }
.pm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.pm-actions .btn { min-height: 44px; min-width: 110px; font-size: 0.95rem; cursor: pointer; border-radius: 8px; font-weight: 700; border: 1px solid var(--accent); background: var(--accent); color: #1a1a1a; }
.pm-actions .btn:disabled { opacity: 0.5; cursor: wait; }
.pm-actions .ghost-btn { background: transparent; color: var(--text); border-color: var(--border); }
.steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 4px 0 16px; }
.steps li { flex: 1; text-align: center; padding: 10px 6px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 0.85rem; }
.steps li.past { color: var(--text); border-color: #4caf7d; }
.steps li.now { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.steps li.ok { color: #8fe0b8; border-color: #4caf7d; font-weight: 700; background: rgba(76,175,125,0.12); }
.steps li.bad { color: #ff9aa2; border-color: #d64d5a; font-weight: 700; background: rgba(214,77,90,0.12); }
.pm-result { min-height: 24px; font-size: 0.95rem; }
.pm-result.ok { color: #8fe0b8; }
.pm-result.bad { color: #ff9aa2; }
dialog.lightbox { width: auto; padding: 8px; background: #0b0b0d; }
dialog.lightbox img { display: block; max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); cursor: zoom-out; }
@media (max-width: 700px) {
  a.btn.small, button.btn.small { min-height: 44px; min-width: 44px; padding: 0 14px; font-size: 0.85rem; }
  .btn-row { gap: 8px; }
  .report-table .files { min-width: 260px; }
}

/* -- /printer: one card per branch + the roll-change form -- */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.paper-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.paper-card.low { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.paper-card.critical { border-color: #d64d5a; box-shadow: 0 0 0 1px #d64d5a inset; }
.pc-head h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pc-printer { font-size: 0.8rem; color: var(--muted); }
.pc-media { font-size: 0.85rem; color: var(--muted); }
.pc-media strong { color: var(--text); }
.pc-remaining { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.pc-remaining .big { font-size: 2.1rem; font-weight: 800; }
.paper-card.low .pc-remaining .big { color: var(--accent); }
.paper-card.critical .pc-remaining .big { color: #ff7c87; }
.pc-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.pc-bar .fill { height: 100%; background: #4caf7d; border-radius: 999px; }
.paper-card.low .pc-bar .fill { background: var(--accent); }
.paper-card.critical .pc-bar .fill { background: #d64d5a; }
.pc-unset { padding: 12px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 0.88rem; }
.pc-unset.small { padding: 6px 10px; font-size: 0.78rem; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.pc-stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.pc-stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-stats .wide { grid-column: 1 / -1; }
.paper-card .pbadge { align-self: flex-start; }
a.btn.small.solid { background: var(--accent); color: #1a1a1a; border-color: var(--accent); align-self: flex-start; }
.stack-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.stack-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--muted); }
.stack-form input, .stack-form select { min-height: 44px; font-size: 1rem; color: var(--text); }
.stack-form .req { color: #ff7c87; }
.stack-form .btn { min-height: 46px; font-size: 1rem; }
.stack-form .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.optional-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.bad-text { color: #ff9aa2; font-weight: 700; }
th.num, td.num { text-align: right; }
.card .filter-form { margin-bottom: 12px; }

/* settings page: pick the scope (central / one branch), what the page is editing */
.scope-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 14px; background: #0e0e11; border: 1px solid var(--border); border-radius: 10px; }
.scope-bar-label { font-size: 0.78rem; color: var(--muted); margin-right: 4px; }
.scope-bar-link { margin-left: auto; font-size: 0.82rem; color: var(--accent); text-decoration: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 100px; border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 0.88rem; font-weight: 600; }
.pill:hover { border-color: var(--accent); }
.main a.pill { color: var(--text); }
.main a.pill.active { background: var(--accent); border-color: var(--accent); color: #1a1100; }
.pill-count { background: rgba(255,255,255,0.14); border-radius: 100px; padding: 0 7px; font-size: 0.72rem; }
.pill.active .pill-count { background: rgba(0,0,0,0.2); }
.scope-banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 0.88rem; border: 1px solid var(--border); background: var(--panel); }
.scope-banner.branch { border-color: var(--accent); }
.scope-banner ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.scope-banner li { margin: 3px 0; }
.settings-row.is-own { background: rgba(253,161,38,0.05); }
.revert-note { font-size: 0.78rem; color: var(--muted); }
.hours-table tr.current td { background: rgba(253,161,38,0.10); }
.hours-central td { font-weight: 600; }
.pc-own { font-size: 0.75rem; }

/* -- booth page (fleet/<booth_id>): the applied-settings strip + its table -- */
.applied-card { padding: 14px 18px; }
.applied-line { font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.applied-line .warn { color: #e6a23c; }
.applied-line .okc { color: #4caf7d; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 10px; }
.table-scroll table { min-width: 520px; }
table.nowrap td:first-child, table.nowrap th:first-child { white-space: nowrap; }  /* a setting's name stays on one line; the table scrolls sideways on a phone */
table.nowrap td, table.nowrap th { white-space: nowrap; }
table.nowrap tr.differs { background: rgba(255,160,0,.12); }
.stat-card .value.small { font-size: 1.4rem; line-height: 1.2; overflow-wrap: anywhere; }

/* "จ่ายแล้วยังไม่ได้รูป": the number of open rows next to the menu entry, and the code the staff read out */
.badge-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 18px; }
.free-code { font-size: 2rem; letter-spacing: 0.25em; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- ธีม (themes.html / theme_editor.html) ---- */
.theme-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 12px; }
.theme-pick, .theme-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-menu { position: relative; }
.theme-menu summary { cursor: pointer; list-style: none; }
.theme-menu-body { position: absolute; right: 0; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; width: 360px; display: grid; gap: 10px; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.danger { color: #ff9aa2; }
.btn-ghost[disabled], button.btn[disabled] { opacity: .45; cursor: not-allowed; }
.small { font-size: 0.78rem; }
.filters { display: flex; gap: 8px; align-items: center; margin: 14px 0; }
.chip { padding: 6px 14px; border: 1px solid var(--border); border-radius: 100px; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.theme-card { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--text); }
.theme-card:hover { border-color: var(--accent); }
.theme-card.missing { border-style: dashed; }
.theme-card .tc-thumb { aspect-ratio: 16 / 9; background: repeating-conic-gradient(#1b1b20 0% 25%, #141418 0% 50%) 0 0 / 20px 20px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.theme-card .tc-thumb img, .theme-card .tc-thumb video { width: 100%; height: 100%; object-fit: contain; }
.theme-card .tc-thumb .empty { color: var(--muted); font-size: 0.85rem; padding: 8px; text-align: center; }
.tc-multi { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; justify-content: center; }
.tc-multi .mini { width: 44px; height: 44px; border: 1px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--muted); }
.tc-multi .mini.has { border-style: solid; border-color: var(--accent); }
.tc-multi .mini img { width: 100%; height: 100%; object-fit: contain; }
.theme-card .count { position: absolute; bottom: 6px; right: 8px; font-size: 0.75rem; color: var(--muted); }
.theme-card .meta { padding: 12px 14px 14px; }
.theme-card .title { font-weight: 700; margin-bottom: 6px; }
.theme-card .line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.badge.required { color: #ff9aa2; border-color: #d64d5a; }
.badge.ok { color: #7fd48a; border-color: #3f8f4a; }
.badge.warn { color: var(--accent); border-color: var(--accent); }

/* the editor */
.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-wrap.compare { grid-template-columns: 1fr; }
.stages { display: grid; gap: 16px; }
.stages.two { grid-template-columns: 1fr 1fr; }
.stage-title { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: repeating-conic-gradient(#1b1b20 0% 25%, #141418 0% 50%) 0 0 / 24px 24px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; container-type: inline-size; }
.stage.drop { outline: 3px dashed var(--accent); outline-offset: -6px; }
.stage .layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.stage .layer.fit { object-fit: contain; background: #000; }
.stage .layer.crop { object-fit: cover; }
.stage .box { position: absolute; box-sizing: border-box; }
.stage .outline { border: 2px dashed var(--accent); color: var(--accent); font-size: clamp(8px, 1.1cqw, 13px); line-height: 1.25; pointer-events: none; }
.stage .outline span { position: absolute; left: 0; top: 0; background: rgba(0, 0, 0, .78); padding: 1px 5px; white-space: nowrap; transform: translateY(-100%); border-radius: 3px 3px 0 0; }
.stage .outline.inside span { transform: none; }
.stage.hide-outlines .outline { display: none; }
.stage .sample { display: none; align-items: center; justify-content: center; color: #fff; font-weight: 700; overflow: hidden; pointer-events: none; font-size: 3cqw; }
.stage.show-sample .sample { display: flex; }
.sample.photo { background: linear-gradient(135deg, #8fb7d8, #e8c9a0 60%, #c98d8d); color: rgba(0,0,0,.55); font-size: 1.6cqw; }
.sample.button { background: #2b2b30; border: 2px solid #f6ecd3; border-radius: 1cqw; font-size: 1.6cqw; }
.sample.button img { width: 100%; height: 100%; object-fit: contain; }
.sample.numeral { font-size: 8cqw; text-shadow: 0 0 .5cqw #000; }
.sample.numeral img { width: 100%; height: 100%; object-fit: contain; }
.sample.text { font-size: 2cqw; text-shadow: 0 0 .5cqw #000; }
.sample.qr { background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 0 0 / 12% 12%; border: .6cqw solid #fff; }
.sample.spinner { border: .8cqw solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; }
.sample.spinner img { width: 100%; height: 100%; object-fit: contain; }
.sample.keypad, .sample.codebox, .sample.strip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); font-size: 1.4cqw; }
.sample.outline { background: rgba(255,255,255,.05); }
.stage .overlay-note { position: absolute; left: 8px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.editor-side { display: grid; gap: 12px; }
.editor-side .panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.editor-side h3 { margin: 0 0 8px; font-size: 0.95rem; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.tab { padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.tab.on { border-color: var(--accent); color: var(--accent); }
.verdict ul { margin: 4px 0 0; padding-left: 18px; }
.verdict .bad { color: #ff9aa2; }
.verdict .warn { color: var(--accent); }
.verdict .good { color: #7fd48a; }
.toggles { display: grid; gap: 6px; }
.toggles label { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
.buttons-col { display: grid; gap: 8px; }
.mobile-note { display: none; }
@media (max-width: 900px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }
  .mobile-note { display: block; }
  .stages.two { grid-template-columns: 1fr; }
}

/* layout editing (dragging the dashed boxes) */
.stage.editing .outline { pointer-events: auto; cursor: move; touch-action: none; }
.stage.taptest { cursor: crosshair; }
.stage.taptest .outline { pointer-events: none; }
.stage .outline .handle { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: var(--accent); border-radius: 3px; cursor: nwse-resize; display: none; }
.stage.editing .outline .handle { display: block; }
.stage .outline.hit { background: rgba(253, 161, 38, .35); border-style: solid; }
.sample.strip { gap: 1%; padding: 0 1%; justify-content: center; }
.sample.strip .th { height: 80%; aspect-ratio: 3 / 4; background: rgba(255,255,255,.28); border-radius: 4px; }
.layout-table, .bulk-table { width: 100%; font-size: 0.78rem; border-collapse: collapse; margin-top: 8px; }
.layout-table input { width: 58px; padding: 3px 4px; font-size: 0.78rem; }
.layout-table tr.moved td:first-child { color: var(--accent); }
.layout-table th, .bulk-table th { text-align: left; font-size: 0.68rem; }
.bulk-table td { padding: 3px 4px; vertical-align: middle; }
.bulk-table select { max-width: 90px; font-size: 0.78rem; }

.editor-wrap { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); }
.editor-wrap > div, .editor-side, .editor-side .panel { min-width: 0; }
.layout-table { table-layout: fixed; }
.layout-table td:first-child { width: 28%; word-break: break-word; }
.layout-table input { width: 100%; box-sizing: border-box; padding: 3px 2px; }
.layout-table button { white-space: normal; font-size: 0.7rem; padding: 3px 6px; }
.bulk-table { table-layout: fixed; }
.bulk-table td { word-break: break-word; }

.layout-table { display: grid; gap: 8px; margin-top: 8px; table-layout: auto; }
.layout-table .lrow { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.layout-table .lrow.moved .lhead span { color: var(--accent); }
.layout-table .lhead { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 0.8rem; }
.layout-table .lnums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.layout-table .lnums label { font-size: 0.7rem; color: var(--muted); display: grid; gap: 2px; }
.layout-table .lnums input { width: 100%; box-sizing: border-box; padding: 3px 4px; font-size: 0.8rem; }
.layout-table button { font-size: 0.68rem; padding: 2px 6px; white-space: nowrap; }

@keyframes savepulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(253,161,38,.7); } 50% { box-shadow: 0 0 0 10px rgba(253,161,38,0); } }
button.btn.pulse { animation: savepulse 1.1s infinite; }
.unsaved { margin-top: 8px; color: var(--accent); font-size: 0.85rem; font-weight: 700; }
.save-status { margin-top: 8px; font-size: 0.85rem; }
.save-status.good { color: #7fd48a; }
.save-status.bad { color: #ff9aa2; }
.save-bar { height: 8px; background: #222; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.save-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.stage .sample.always { display: flex; }
.stage .sample .txt { white-space: nowrap; line-height: 1.1; }
.titem { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; }
.titem.moved .lhead span { color: var(--accent); }
.titem .lhead { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 0.82rem; }
.titem .tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.titem label { font-size: 0.7rem; color: var(--muted); display: grid; gap: 2px; }
.titem label.chk { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text); }
.titem input[type=text], .titem input[type=number], .titem select { width: 100%; box-sizing: border-box; padding: 3px 4px; font-size: 0.8rem; }
.titem input[type=color] { width: 100%; height: 28px; padding: 0; background: none; border: 1px solid var(--border); }
.titem .tfmt { margin-top: 6px; }
.fonts-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.font-msg .bad { color: #ff9aa2; }

/* the loading spinner card: the Next button faded, the spinner turning on top of it */
@keyframes stage-spin { to { transform: rotate(360deg); } }
.stage .sample.spinner { border: none; border-radius: 0; background: none; }
.stage .sample.spinner .ring { width: 56%; height: 56%; box-sizing: border-box; border: .55cqw solid rgba(246,236,211,.25); border-top-color: var(--accent); border-radius: 50%; animation: stage-spin .8s linear infinite; }
.stage .sample.spinner img.spin, .stage .sample .pickbox.spin { width: 56%; height: 56%; object-fit: contain; animation: stage-spin 1.2s linear infinite; }
.stage .sample .pickbox { width: 100%; height: 100%; object-fit: contain; }
.stage .sample.dim { opacity: .3; }

/* element pictures live INSIDE their box (never over the page); a spinner file turns around its centre */
.stage .sample.spinner img.spin, .stage .sample .pickbox.spin { width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; animation: stage-spin var(--spin-sec, 1s) linear infinite; }
.stage.no-rotate .sample.spinner img.spin, .stage.no-rotate .sample .pickbox.spin { animation: none; }
.stage .sample img, .stage .sample .pickbox { max-width: 100%; max-height: 100%; }
.stage.has-ctx { background: #201D1C; }
.stage .ctx { border: 1px solid rgba(246,236,211,.18); background: rgba(246,236,211,.05); color: rgba(246,236,211,.35); font-size: clamp(8px, 1cqw, 12px); display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.trimbox { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 0.82rem; color: var(--accent); }
