:root {
  /* Pure white · charcoal navy (#000b3d) */
  --bg: #ffffff;
  --header: #ffffff;
  --card: #ffffff;
  --sidebar: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --key: #f3f4f6;
  --hover: #f3f4f6;
  --soft: #f9fafb;
  --tab-track: #f3f4f6;
  --tab-track-border: #e5e7eb;
  --accent: #000b3d;
  --accent-hover: #00145c;
  --tertiary: #000b3d;
  --tertiary-hover: #00145c;
  --orange: #000b3d;
  --green: #2e7d32;
  --danger: #c62828;
  --btn-h: 36px;
  --btn-h-sm: 28px;
  --radius: 12px;
  --panel-max: min(60vh, 28rem);
  --sidebar-w: 240px;
  --shadow: 0 1px 2px rgba(0, 11, 61, 0.06), 0 6px 16px rgba(0, 11, 61, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; }

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sidebar .brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  overflow: auto;
}
.sidebar-nav a {
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.12s ease, color 0.12s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-nav .nav-icon {
  flex: 0 0 auto;
  opacity: 0.9;
}
.sidebar-nav a:hover { background: var(--hover); color: var(--ink); }
.sidebar-nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active .nav-icon { opacity: 1; }
.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.sidebar-foot .version,
.top .version {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.sidebar-backdrop { display: none; }

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.app-shell > .top { display: none; }
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 14px;
}
nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
nav a {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.12s ease, color 0.12s ease;
}
nav a.active { background: var(--accent); color: #fff; }
nav a:hover:not(.active) { background: var(--hover); color: var(--ink); }
.wrap { padding: 24px 28px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.metric-card {
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tertiary);
}
.metric-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-card .metric { margin-top: 8px; }
.metric { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.row-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
.page-lead { margin: 0 0 16px; color: var(--muted); font-size: 14px; max-width: 62rem; }
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.page-toolbar .toolbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 6px;
}
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.table-tools input[type="search"],
.table-tools input[data-table-filter] {
  width: min(280px, 100%);
  min-width: 160px;
  height: var(--btn-h);
  padding: 0 12px;
}
.table-tools .count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.stock-bulk-tools {
  align-items: center;
  gap: 10px;
}
.stock-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.stock-bulk-actions .ghost-btn {
  font-size: 12px;
  padding: 0 10px;
}
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel > .table-scroll {
  flex: 1 1 auto;
  max-height: var(--panel-max);
}
.cash-cols {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
  margin-top: 14px;
}
.cash-cols > .card {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  min-height: 0;
  height: 28rem;
  display: flex;
  flex-direction: column;
}
.cash-cols .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cash-cols .card-head h3 { margin: 0; }
.cash-cols .card-head .sum { font-size: 15px; font-weight: 700; white-space: nowrap; }
.cash-cols > .card > .muted { flex: 0 0 auto; margin: 0 0 10px; }
.cash-cols .table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.cash-cols .table-scroll th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
tr.day-head td {
  background: #f7f7f7;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  font-size: 13px;
}
tr.day-total td {
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid var(--line);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.table-scroll {
  overflow: auto;
  max-height: var(--panel-max);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.table-scroll > table { margin: 0; }
.table-scroll thead th {
  position: sticky;
  top: 0;
  background: #fafafa;
  z-index: 1;
  box-shadow: 0 1px 0 var(--line);
}
.card > .table-scroll { border: 0; border-radius: 0; }
.card.panel > .table-scroll,
.card > .table-scroll:only-child,
.sales-section .card.table-scroll {
  max-height: var(--panel-max);
  border: 0;
}
.bars {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 160px;
}
.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.bar-track {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bar {
  width: 72%;
  max-width: 40px;
  background: var(--tertiary);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
}
.bar-col span {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.login .card {
  width: 360px;
  box-shadow: 0 8px 30px rgba(26, 26, 26, 0.08);
}
.login .card .brand { margin-bottom: 12px; font-size: 15px; }
.login .card h2 { margin-top: 0; }
input, select, button, .btn, .btn-ghost, .ghost-btn {
  font: inherit;
}
input, select {
  width: 100%;
  height: var(--btn-h);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  accent-color: var(--accent);
  flex: 0 0 auto;
  vertical-align: middle;
}
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(0, 11, 61, 0.28);
  outline-offset: 1px;
  border-color: var(--accent);
}
button:not(.preview-link):not(.link-action):not(.drag-handle):not(.icon-btn):not(.ghost-btn):not(.ghost):not(.btn-ghost):not(.seg-btn),
.btn,
a.btn,
.ghost-btn,
a.ghost-btn,
a.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-h);
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button:not(.preview-link):not(.link-action):not(.drag-handle):not(.icon-btn):not(.ghost-btn):not(.ghost):not(.btn-ghost):not(.seg-btn):hover,
.btn:hover,
a.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
button:not(.preview-link):not(.link-action):not(.drag-handle):not(.icon-btn):not(.ghost-btn):not(.ghost):not(.btn-ghost):not(.seg-btn):active,
.btn:active,
a.btn:active {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.ghost,
.btn-ghost,
.ghost-btn,
a.btn-ghost,
a.ghost-btn,
button.ghost-btn {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover,
.btn-ghost:hover,
.ghost-btn:hover,
a.btn-ghost:hover,
a.ghost-btn:hover,
button.ghost-btn:hover {
  background: var(--hover);
  border-color: #ccc;
  color: var(--ink);
}
.btn.compact,
.btn-sm,
.ghost-btn.compact,
button.compact {
  height: var(--btn-h-sm);
  padding: 0 10px;
  font-size: 12px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
button.seg-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  width: auto;
  box-shadow: none;
}
button.seg-btn:hover {
  background: var(--hover);
  color: var(--ink);
  border-color: transparent;
}
button.seg-btn.on,
button.seg-btn.on:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.force-end { max-width: 420px; }
.force-end label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.force-end input { margin-top: 0; }
.error {
  color: var(--danger);
  font-size: 13px;
  margin: 8px 0;
  padding: 10px 12px;
  background: #fdecea;
  border: 1px solid #f5c6c2;
  border-radius: 8px;
}
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ok {
  color: var(--green);
  font-size: 13px;
  margin: 8px 0;
  padding: 10px 12px;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  border-radius: 8px;
}
.neg { color: var(--danger); font-variant-numeric: tabular-nums; }
.pos { color: var(--green); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-inline input[type="text"], .form-inline input[type="number"], .form-inline input[type="password"] { width: auto; min-width: 140px; }
table.sales { font-size: 12px; white-space: nowrap; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters input[type="date"] { width: auto; height: var(--btn-h); }
.sales-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.range-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-picker { position: relative; }
.range-chip {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: var(--btn-h);
  padding: 0 12px;
  background: #fff;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.range-chip:hover { background: var(--hover); border-color: #ccc; }
.range-chip::-webkit-details-marker { display: none; }
.range-chip::marker { content: ""; }
.range-chev { color: var(--muted); font-size: 12px; }
.range-picker[open] .range-chev { transform: rotate(180deg); display: inline-block; }
.range-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 8;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  min-width: 280px;
}
.range-info {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-style: italic;
  font-family: Georgia, serif;
  color: var(--muted);
  cursor: help;
  user-select: none;
}
.range-presets {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--tab-track);
  border: 1px solid var(--tab-track-border);
  border-radius: 8px;
}
.range-presets a {
  display: inline-flex;
  align-items: center;
  height: calc(var(--btn-h) - 6px);
  padding: 0 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.12s ease, color 0.12s ease;
}
.range-presets a:hover { color: var(--ink); background: var(--hover); }
.range-presets a.on {
  background: var(--accent);
  color: #fff;
}
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.45);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(46, 125, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}
table.orders { font-size: 14px; }
.order-row { cursor: pointer; }
.order-row:hover { background: var(--hover); }
.order-row.open { background: #eeeeee; }
.order-row.fresh { animation: flash 1.4s ease; }
.order-row.held { background: #f6f6f6; }
.order-row.held:hover, .order-row.held.open { background: #ececec; }
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--key);
  color: var(--muted);
  font-weight: 600;
}
.status-pill.held {
  background: #e8eaf2;
  color: var(--tertiary);
}
.status-pill.cancelled {
  background: #fdecea;
  color: #b71c1c;
}
.status-pill.done {
  background: #e8f5e9;
  color: #1b5e20;
}
.status-pill.benefit {
  background: #e3f2fd;
  color: #0d47a1;
}
@keyframes flash {
  from { background: #e8f5e9; }
  to { background: transparent; }
}
.chev { width: 18px; color: var(--muted); }
.hidden { display: none; }
.items-row td { background: #f5f5f5; padding: 4px 8px 14px 36px; border-bottom: 1px solid var(--line); }
table.nested { width: 100%; max-width: 720px; font-size: 13px; }
table.nested th { text-transform: none; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  align-items: end;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.form-grid .check-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}
.form-grid input[type="checkbox"] { width: auto; }
.top .version {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tabbar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--tab-track);
  border: 1px solid var(--tab-track-border);
  border-radius: 12px;
}
.tabbar a {
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 650;
  color: var(--muted);
}
.tabbar a.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.1);
}
.staff-tabbar {
  flex-wrap: wrap;
  max-width: 100%;
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.icon-btn,
button.icon-btn,
a.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-h-sm, 32px);
  height: var(--btn-h-sm, 32px);
  min-width: var(--btn-h-sm, 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
}
.icon-btn:hover,
button.icon-btn:hover,
a.icon-btn:hover {
  background: var(--hover);
  border-color: #ccc;
  color: var(--ink);
}
.staff-soft-panel {
  padding: 12px 16px;
}
.staff-soft-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.staff-soft-summary::-webkit-details-marker { display: none; }
.loan-pay-detail { display: inline-block; }
.loan-pay-detail > summary {
  cursor: pointer;
  list-style: none;
}
.loan-pay-detail > summary::-webkit-details-marker { display: none; }
.loan-pay-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}
.loan-pay-list a { font-size: inherit; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-head h3 { margin: 0; }
.sales-section { margin-top: 22px; }
.sales-section .section-head { margin-bottom: 10px; align-items: baseline; }
.cancel-reason {
  max-width: 280px;
  white-space: normal;
  font-size: 13px;
  line-height: 1.35;
}
.cancelled-prompt { margin: 0; }
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 14px; }
.pill {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f5f5;
  color: var(--ink);
  font-size: 13px;
}
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.sort-list { display: flex; flex-direction: column; gap: 8px; }
.sort-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.05);
  flex-wrap: nowrap;
}
.sort-row.dragging { opacity: 0.4; }
button.drag-handle {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #eeeeee;
  color: #9e9e9e;
  cursor: grab;
  display: grid;
  place-items: center;
}
button.drag-handle:hover { background: #e0e0e0; color: var(--muted); }
button.drag-handle:active { cursor: grabbing; }
.sort-index {
  flex: 0 0 auto;
  width: 28px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--muted);
}
.sort-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sort-form input[type="text"] { flex: 1; min-width: 0; }
.sort-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.switch input { display: none; }
.slider {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--key);
  position: relative;
  display: inline-block;
}
.slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }
.extras { padding: 0; }
.extras summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 650;
}
.extras-body { padding: 0 18px 18px; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.4);
  display: grid;
  place-items: start center;
  padding: 24px;
  overflow: auto;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: auto 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}
.modal-card.wide { width: min(760px, 100%); }
.variant-item-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.variant-item-head {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.variant-item-head label { min-width: 120px; }
.staff-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) 140px 140px auto;
  gap: 10px;
  align-items: end;
}
.staff-grid-create {
  grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) 120px 120px auto;
}
.staff-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.staff-active {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}
.staff-active input {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
}
.staff-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Information-first rows: one primary action + overflow menu */
.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.more-menu {
  position: relative;
  display: inline-block;
}
.more-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  min-width: var(--btn-h-sm);
  width: var(--btn-h);
  height: var(--btn-h);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.05em;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu > summary::marker { content: ""; }
.more-menu > summary:hover { background: var(--hover); border-color: #ccc; }
.more-menu[open] > summary { background: var(--hover); border-color: #bbb; }
.more-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.more-menu-panel.is-fixed {
  position: fixed;
  top: auto;
  right: auto;
}
.more-menu-panel a,
.more-menu-panel button,
.more-menu-panel .menu-item {
  width: 100%;
  justify-content: flex-start;
  height: auto;
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
}
.more-menu-panel a:hover,
.more-menu-panel button:hover,
.more-menu-panel .menu-item:hover {
  background: var(--hover);
  color: var(--ink);
  border: 0;
}
.more-menu-panel .menu-danger { color: var(--danger); }
.more-menu-panel .menu-danger:hover { background: #fdecea; color: var(--danger); }
.more-menu-panel .menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
  border: 0;
}
.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.toolbar-actions > .icon-btn,
.toolbar-actions .more-menu > summary.icon-btn {
  width: var(--btn-h);
  height: var(--btn-h);
  min-width: var(--btn-h);
  font-size: inherit;
  letter-spacing: normal;
}
.link-action {
  color: var(--tertiary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  height: auto;
}
.link-action:hover {
  text-decoration: underline;
  background: none;
  color: var(--tertiary-hover);
  border: 0;
}
.link-action-quiet {
  color: var(--muted);
  font-weight: 500;
}
.link-action-quiet:hover {
  color: var(--ink);
}
.preview-link {
  color: var(--ink);
  font-size: inherit;
  font-weight: 650;
  text-decoration: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.preview-link:hover {
  text-decoration: underline;
  color: var(--tertiary);
  background: none;
  border: 0;
}
.preview-panel {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}
.preview-row {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 8px 14px;
  align-items: start;
  font-size: 14px;
}
.preview-label {
  color: var(--muted);
  font-size: 13px;
}
.preview-value {
  margin: 0;
  font-weight: 500;
}
.preview-value .status-pill {
  margin-right: 6px;
  margin-bottom: 4px;
}
.preview-section {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.preview-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
}
.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.sort-main .preview-link {
  display: block;
  margin-bottom: 2px;
}
.status-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}
.status-with-icon svg { flex: 0 0 auto; }
.status-ok { color: #027a48; }
.status-warn { color: #b54708; }
table.data-table td { vertical-align: middle; }
table.data-table .inline-field {
  width: 100%;
  min-width: 0;
}
table.data-table .inline-field-sm { width: 110px; max-width: 120px; }
.salary-card { width: min(640px, 100%); }
.bonus-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 160px auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.bonus-row .bonus-remove { margin-bottom: 2px; }
.log-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.log-order {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.log-order-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 4px;
}
.log-order-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 16px;
}
.log-order-when { font-variant-numeric: tabular-nums; font-size: 13px; }
.log-events { list-style: none; margin: 8px 0 0; padding: 0; }
.log-event {
  display: grid;
  grid-template-columns: 88px 150px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  align-items: baseline;
}
.log-event time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.log-staff { font-weight: 600; }
.filters select { width: auto; min-width: 140px; }
.filters input[type="text"] { width: auto; min-width: 160px; }
.stock-qty { font-variant-numeric: tabular-nums; font-weight: 600; }
.stock-qty.zero { color: var(--danger); }
table.stock-table td { vertical-align: middle; }
.stock-inactive-card {
  background: #f6f6f6;
}
table.stock-table-inactive td {
  color: var(--muted);
}
table.stock-table-inactive td strong {
  font-weight: 600;
  color: #424242;
}
tr.open { background: #f3f3f3; }
.plan-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  align-items: center;
}
.plan-bar form { margin: 0; }
.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.form-inline input,
.form-inline select { width: auto; min-width: 140px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0 0 4px; }
.status-pill.cancelled {
  background: #fdecea;
  color: #b71c1c;
}
button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.plan-card-table .form-inline input[name="hpp"] { min-width: 110px; max-width: 140px; }
.stock-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.stock-check { width: 36px; }
.stock-check input { width: auto; }
.opname-actions { display: flex; flex-direction: column; gap: 8px; }
.receipt-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(420px, 1.4fr);
  gap: 14px;
  align-items: start;
}
.receipt-photo img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #fafafa;
}
.receipt-meta {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 10px;
  margin-bottom: 12px;
}
.receipt-meta label, .receipt-lines input, .receipt-lines select {
  width: 100%;
}
.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.warn {
  background: #fff8e1;
  border: 1px solid #f0d78c;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.warn p { margin: 0 0 6px; }
.warn ul { margin: 0; padding-left: 18px; }
.receipt-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fafafa;
  display: block;
}
@media (max-width: 900px) {
  .grid, .row-2, .form-grid, .staff-grid, .staff-head, .log-event, .stock-quad, .bonus-row, .receipt-layout, .receipt-meta { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 0 12px 40px rgba(26, 26, 26, 0.18);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.35);
    z-index: 35;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  .sidebar-backdrop[hidden] { display: none !important; }
  .wrap { padding: 18px 16px 48px; }
}

