/* Bon Fin Ops — warm neumorphic theme
   base  #723f18   accent  #f8f3ea */

:root {
  --bg: #efe8dc;
  --surface: #f8f3ea;
  --surface-2: #f2eadc;
  --surface-3: #ebe2d2;
  --base: #723f18;
  --base-700: #5c3212;
  --base-500: #8a5327;
  --base-200: #d9bda2;
  --base-100: #ead9c7;
  --base-50: #f3e8db;
  --text: #3b2a1e;
  --muted: #8b7563;
  --faint: #b5a391;
  --line: #e2d7c6;
  --shadow-dark: #d2c4b0;
  --shadow-darker: #c4b39c;
  --shadow-light: #ffffff;
  --success: #4e7c4a;
  --success-bg: #e6eedd;
  --danger: #a7483a;
  --danger-bg: #f4e2dc;
  --warn: #b4781e;
  --warn-bg: #f6ead3;
  --info: #5b6f8a;
  --info-bg: #e3e8ee;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --raised: 9px 9px 20px var(--shadow-dark), -9px -9px 20px var(--shadow-light);
  --raised-sm: 5px 5px 12px var(--shadow-dark), -5px -5px 12px var(--shadow-light);
  --raised-xs: 3px 3px 7px var(--shadow-dark), -3px -3px 7px var(--shadow-light);
  --inset: inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
  --inset-sm: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--base); text-decoration: none; }
a:hover { color: var(--base-700); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; color: var(--base-700); margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 28px 20px 20px;
}
.brand { display: block; padding: 6px 18px 18px; }
.brand img { width: 100%; max-width: 170px; display: block; margin: 0 auto; filter: drop-shadow(2px 3px 4px rgba(114, 63, 24, 0.15)); }
.nav { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 14px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
  transition: box-shadow .2s, color .2s, background .2s;
}
.nav-link:hover { color: var(--base); background: var(--surface-2); }
.nav-link.active { color: var(--base-700); background: var(--surface); box-shadow: var(--inset-sm); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 16px; }
.whoami { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); }
.whoami:hover { background: var(--surface-2); }
.whoami-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.whoami-text strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.whoami-text small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--base); color: var(--surface);
  font-family: var(--serif); font-size: 14px; font-weight: 600;
  box-shadow: var(--raised-xs);
}
.main { flex: 1; min-width: 0; padding: 32px 40px 60px; }

.tabbar { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--raised);
  padding: 24px 26px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head p { font-size: 13px; margin-top: 2px; }
.card-flat { box-shadow: none; background: var(--surface-2); }
.card-inset { box-shadow: var(--inset); background: var(--surface-2); }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { padding: 22px 24px; }
.stat-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-family: var(--serif); font-size: 32px; color: var(--base-700); margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats .stat { padding: 14px 16px; border-radius: 16px; }
  .stats .stat-label { font-size: 11px; }
  .stats .stat-value { font-size: 24px; }
  .stats .stat-sub { font-size: 12px; margin-top: 3px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border: 0; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--surface); color: var(--base-700);
  box-shadow: var(--raised-sm);
  transition: transform .12s, box-shadow .2s, background .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active, .btn.pressed { box-shadow: var(--inset-sm); transform: none; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--base); color: var(--surface); box-shadow: 6px 6px 14px rgba(114, 63, 24, 0.28), -5px -5px 12px var(--shadow-light); }
.btn-primary:hover { background: var(--base-700); }
.btn-primary:active { box-shadow: inset 3px 3px 7px rgba(0,0,0,.25); }
.btn-ghost { box-shadow: none; background: transparent; color: var(--base); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: 18px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--surface); color: var(--muted); cursor: pointer; box-shadow: var(--raised-xs);
  transition: color .2s, box-shadow .2s;
}
.icon-btn:hover { color: var(--base); }
.icon-btn:active { box-shadow: var(--inset-sm); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field .hint { font-size: 12px; color: var(--faint); }
.input, .select, .textarea {
  width: 100%; padding: 12px 15px; border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit;
  box-shadow: var(--inset);
  outline: none; transition: box-shadow .2s;
  min-height: 46px;
}
.input:focus, .select:focus, .textarea:focus { box-shadow: var(--inset), 0 0 0 3px rgba(114, 63, 24, .18); }
.input::placeholder { color: var(--faint); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b7563' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='m19.5 8.25-7.5 7.5-7.5-7.5'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
.select-sm { min-height: 36px; padding: 7px 32px 7px 12px; font-size: 13px; border-radius: var(--radius-xs); box-shadow: var(--inset-sm); background-position: right 10px center; }
.input-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: var(--radius-xs); box-shadow: var(--inset-sm); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--base); }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 46px; height: 26px; border-radius: 13px; background: var(--surface-2); box-shadow: var(--inset-sm); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--raised-xs); transition: left .2s, background .2s; }
.switch input:checked + .track { background: var(--base-100); }
.switch input:checked + .track::after { left: 23px; background: var(--base); }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 44px; }
.prefix { position: relative; }
.prefix > span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.prefix .input { padding-left: 30px; }
.color-input { width: 40px; height: 36px; padding: 2px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: var(--inset-sm); cursor: pointer; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar .select { width: auto; min-width: 150px; }

/* ---------- Date picker ---------- */
.datepick { position: relative; }
.dp-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer; }
.dp-btn.placeholder .dp-text { color: var(--faint); }
.dp-btn .icon { color: var(--muted); }
.dp-pop { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: 300px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--raised), 0 0 0 1px var(--line); }
.dp-pop.dp-right { left: auto; right: 0; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-head strong { font-family: var(--serif); font-size: 16px; color: var(--base-700); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dp-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); text-align: center; padding-bottom: 4px; font-weight: 600; }
.dp-day { height: 36px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.dp-day:hover { background: var(--surface-2); }
.dp-day.past { color: var(--muted); }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--base-200); font-weight: 700; }
.dp-day.sel { background: var(--base); color: var(--surface); font-weight: 700; }
.dp-day:disabled { opacity: .3; cursor: default; }
.dp-foot { display: flex; gap: 8px; margin-top: 12px; }
.dp-foot .btn-ghost { margin-left: auto; }
@media (max-width: 600px) {
  .dp-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; z-index: 60; padding: 18px; border-radius: 22px; }
  .dp-pop.dp-right { left: 12px; right: 12px; }
  .dp-day { height: 42px; font-size: 16px; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 12px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.archived { opacity: .55; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .icon-btn { margin-left: 4px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.editable { cursor: text; position: relative; }
td.editable:hover { background: var(--surface-3); }
td.editable[contenteditable="true"] { box-shadow: var(--inset-sm), 0 0 0 3px rgba(114, 63, 24, .18); background: var(--surface); outline: none; }
td.editable.saved { animation: saved 1.2s ease-out; }
td.editable.error { box-shadow: inset 0 0 0 2px var(--danger); }
@keyframes saved { 0% { background: var(--success-bg); } 100% { background: transparent; } }
.desc-cell { max-width: 360px; color: var(--muted); }
.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--surface-3); box-shadow: var(--inset-sm); display: grid; place-items: center; color: var(--faint); }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.row-title { font-weight: 600; }
.row-sub { font-size: 12px; color: var(--muted); }
.table .c-thumb { width: 56px; }
.quick { display: flex; gap: 6px; flex-wrap: nowrap; }
.quick .select { width: auto; min-width: 118px; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.chip-placed { background: var(--info-bg); color: var(--info); }
.chip-ready { background: var(--warn-bg); color: var(--warn); }
.chip-picked_up { background: var(--success-bg); color: var(--success); }
.chip-cancelled { background: var(--danger-bg); color: var(--danger); }
.chip-paid_in_advance, .chip-paid_at_pickup { background: var(--success-bg); color: var(--success); }
.chip-unpaid { background: var(--danger-bg); color: var(--danger); }
.chip-admin { background: var(--base-100); color: var(--base-700); }
.chip-staff { background: var(--surface-3); color: var(--muted); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.cat i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: var(--raised-xs); }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 22px; box-shadow: var(--raised-sm); background: var(--surface); font-weight: 500; }
.flash-success { color: var(--success); }
.flash-error { color: var(--danger); }
.flash span { flex: 1; color: var(--text); }
.flash-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: grid; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--base-700); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-weight: 500; box-shadow: 0 10px 30px rgba(60, 35, 15, .3); transition: opacity .25s, transform .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.empty { padding: 28px; text-align: center; color: var(--faint); font-style: italic; }

/* ---------- Bar charts ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 5px; }
.bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--inset-sm); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--base); min-width: 6px; transition: width .6s ease; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 10px 6px 0; }
.spark .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.spark .col .proj { background: var(--base-200); border-radius: 4px 4px 0 0; width: 100%; position: relative; }
.spark .col .paid { background: var(--base); border-radius: 4px 4px 0 0; width: 100%; position: absolute; bottom: 0; left: 0; }
.spark .col:hover .proj { filter: brightness(.96); }
.spark .col .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--base-700); color: var(--surface); font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
.spark .col:hover .tip { display: block; }
.spark .col:first-child .tip { left: 0; transform: none; }
.spark .col:last-child .tip { left: auto; right: 0; transform: none; }
.spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); padding: 6px 6px 0; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* ---------- Ops schedule ---------- */
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-nav h2 { min-width: 220px; text-align: center; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1400px) { .week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .week { grid-template-columns: 1fr; } .day { min-height: 0; } .day-empty { padding: 8px 0; } }
.day { background: var(--surface); border-radius: var(--radius); box-shadow: var(--raised-sm); padding: 16px 14px; min-height: 220px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .2s, background .2s; }
.day.today { outline: 2px solid var(--base-200); outline-offset: -2px; }
.day.past { opacity: .72; }
.day.drop-target { background: var(--base-50); box-shadow: var(--inset); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-head .dow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.day-head .dom { font-family: var(--serif); font-size: 22px; color: var(--base-700); }
.day-total { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.day-total strong { color: var(--base-700); }
.bake { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.bake li { display: flex; justify-content: space-between; gap: 8px; }
.bake li b { color: var(--text); font-variant-numeric: tabular-nums; }
.bake { list-style: none; margin: 0; padding: 0 0 6px; }
.order-card { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--raised-xs); cursor: grab; font-size: 13px; transition: box-shadow .2s, transform .15s; position: relative; }
.order-card:active { cursor: grabbing; }
.order-card.dragging { opacity: .5; transform: scale(.98); }
.order-card .oc-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.order-card .oc-name { font-weight: 600; line-height: 1.3; }
.order-card .oc-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.order-card .oc-items { color: var(--muted); margin-top: 3px; font-size: 12px; line-height: 1.4; }
.order-card .oc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 6px; }
.order-card .oc-foot a { font-size: 12px; font-weight: 600; }
.order-card .chip { padding: 2px 8px; font-size: 11px; }
.day-empty { color: var(--faint); font-size: 13px; font-style: italic; text-align: center; padding: 20px 0; }

/* ---------- Register (POS) ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pos-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pos-cats .btn { padding: 8px 14px; font-size: 13px; }
.pos-cats .btn.active { box-shadow: var(--inset-sm); color: var(--base-700); background: var(--surface-2); }
.ptile { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--raised-sm); padding: 12px; cursor: pointer; user-select: none; display: flex; flex-direction: column; gap: 8px; transition: transform .12s, box-shadow .2s; min-height: 118px; position: relative; border: 0; font: inherit; text-align: left; color: var(--text); }
.ptile:hover { transform: translateY(-2px); }
.ptile:active { box-shadow: var(--inset-sm); transform: none; }
.ptile .ptile-img { height: 64px; border-radius: 10px; background: var(--surface-3); box-shadow: var(--inset-sm); overflow: hidden; display: grid; place-items: center; color: var(--faint); }
.ptile .ptile-img img { width: 100%; height: 100%; object-fit: cover; }
.ptile .ptile-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.ptile .ptile-price { color: var(--muted); font-size: 13px; }
.ptile .qty-badge { position: absolute; top: -8px; right: -8px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--base); color: var(--surface); font-weight: 700; display: grid; place-items: center; font-size: 13px; box-shadow: 0 4px 10px rgba(114,63,24,.35); padding: 0 8px; }
.ptile.in-cart { outline: 2px solid var(--base-200); outline-offset: -2px; }
.cart { position: sticky; top: 24px; }
.cart-lines { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; max-height: 320px; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--inset-sm); font-size: 14px; }
.cart-line .cl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-line .cl-price { font-size: 12px; color: var(--muted); }
.cart-line .cl-total { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; text-align: right; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--raised-xs); color: var(--base); cursor: pointer; display: grid; place-items: center; font: inherit; }
.stepper button:active { box-shadow: var(--inset-sm); }
.stepper .icon { width: 14px; height: 14px; }
.stepper span { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals { display: flex; flex-direction: column; gap: 6px; font-size: 14px; padding: 12px 4px 4px; border-top: 1px solid var(--line); }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-family: var(--serif); font-size: 24px; color: var(--base-700); margin-top: 4px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--raised); padding: 6px; z-index: 20; max-height: 260px; overflow-y: auto; }
.combo-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 0; background: none; font: inherit; color: var(--text); border-radius: 10px; cursor: pointer; text-align: left; }
.combo-list button:hover, .combo-list button.hl { background: var(--surface-2); }
.combo-list small { color: var(--muted); }
.pos-success { text-align: center; padding: 30px 20px; }
.pos-success .big-check { width: 72px; height: 72px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; margin: 0 auto 16px; box-shadow: var(--raised-sm); }
.pos-success .big-check .icon { width: 36px; height: 36px; }
.pos-bar { display: none; }
@media (max-width: 1000px) {
  .pos { grid-template-columns: 1fr; } .cart { position: static; }
  .pos-products { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .ptile .ptile-img { height: 52px; }
  .pos-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 39;
    align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border: 0; border-radius: 18px;
    background: var(--base); color: var(--surface); font: inherit; font-weight: 600; cursor: pointer;
    box-shadow: 0 10px 26px rgba(114, 63, 24, .35); }
  .pos-bar span:last-child { display: inline-flex; align-items: center; gap: 4px; opacity: .9; }
  .pos-bar.hidden { display: none; }
}

/* ---------- Order edit ---------- */
.edit-layout { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); align-items: start; }
@media (max-width: 1000px) { .edit-layout { grid-template-columns: 1fr; } }
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 40px; gap: 10px; align-items: center; }
.line .line-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 640px) {
  .line { grid-template-columns: 96px minmax(0, 1fr) 40px; gap: 8px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .line > select { grid-column: 1 / 3; grid-row: 1; }
  .line > .icon-btn { grid-column: 3; grid-row: 1; justify-self: end; }
  .line > input { grid-column: 1; grid-row: 2; }
  .line .line-total { grid-column: 2 / 4; grid-row: 2; }
  .line:last-child { border-bottom: 0; padding-bottom: 0; }
}
.save-bar { display: none; }
@media (max-width: 900px) {
  .save-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 39;
    align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 18px;
    background: var(--surface); box-shadow: var(--raised); }
  .save-bar > div { display: flex; flex-direction: column; line-height: 1.2; }
  .save-bar strong { font-family: var(--serif); font-size: 22px; color: var(--base-700); }
  .save-bar .btn { padding: 12px 22px; }
  body:has(.save-bar) .main { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
}
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 12px; font-size: 13px; }
.timeline li i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--raised-xs); position: relative; display: block; margin-top: 2px; }
.timeline li i::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--base-200); }
.timeline li .when { color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Auth ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; }
.auth-main { width: 100%; max-width: 400px; padding: 24px; }
.auth-card { text-align: center; padding: 36px 32px; }
.auth-card .brand img { max-width: 190px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; text-align: left; margin-top: 14px; }
.auth-card h1 { font-size: 22px; margin: 6px 0 2px; }
.auth-error { color: var(--danger); font-size: 14px; background: var(--danger-bg); padding: 10px 14px; border-radius: var(--radius-xs); }
.code-input { text-align: center; letter-spacing: .4em; font-size: 24px; font-family: var(--sans); }

/* ---------- Misc ---------- */
.img-preview { width: 100%; max-width: 280px; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); box-shadow: var(--raised-sm); display: block; }
.img-placeholder { width: 100%; max-width: 280px; aspect-ratio: 4/3; border-radius: var(--radius-sm); box-shadow: var(--inset); display: grid; place-items: center; color: var(--faint); background: var(--surface-2); }
.img-placeholder .icon { width: 36px; height: 36px; }
.qr-layout { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
@media (max-width: 640px) { .qr-layout { grid-template-columns: 1fr; justify-items: center; } .qr-layout .stack { width: 100%; } }
.qr { width: 220px; height: 220px; border-radius: var(--radius-sm); box-shadow: var(--raised-sm); background: #fff; padding: 8px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .08em; word-break: break-all; background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius-xs); box-shadow: var(--inset-sm); }
.integration { display: flex; gap: 16px; align-items: flex-start; }
.integration .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); box-shadow: var(--inset-sm); display: grid; place-items: center; color: var(--base); flex: none; }
.integration .ico .icon { width: 24px; height: 24px; }
.cat-row { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.error-page { max-width: 480px; margin: 60px auto; text-align: center; }
.error-page .code { font-family: var(--serif); font-size: 72px; color: var(--base-200); line-height: 1; }
details.card summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary .icon { transition: transform .2s; }
details.card[open] summary .icon.chev { transform: rotate(90deg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .card { padding: 18px; border-radius: 18px; }
  .page-head { margin-bottom: 18px; }
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-radius: 22px; box-shadow: var(--raised); padding: 8px 6px; z-index: 40;
  }
  .tabbar > a, .tabbar summary { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; }
  .tabbar summary::-webkit-details-marker { display: none; }
  .tabbar > a.active { color: var(--base-700); box-shadow: var(--inset-sm); background: var(--surface-2); }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar .more { flex: 1; position: relative; }
  .more-menu { position: absolute; right: 0; bottom: calc(100% + 14px); background: var(--surface); border-radius: 18px; box-shadow: var(--raised); padding: 8px; min-width: 200px; display: flex; flex-direction: column; }
  .more-menu a, .more-menu button { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; color: var(--text); font: inherit; font-weight: 500; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; }
  .more-menu a:hover, .more-menu button:hover { background: var(--surface-2); }
  .toolbar .select { flex: 1; }
  .toolbar .datepick { flex: 1; min-width: 140px; }
  .toolbar .datepick .dp-btn { width: 100%; }
  .input, .select, .textarea, .select-sm, .input-sm, .dp-btn { font-size: 16px; }
  .table th, .table td { padding: 10px 8px; }
  .hide-mobile { display: none !important; }
  .page-head .btn-primary { width: 100%; }
  .icon-btn.sm { width: 38px; height: 38px; }
  .icon-btn.sm .icon { width: 18px; height: 18px; }
}
@media (min-width: 901px) { .hide-desktop { display: none !important; } }

/* ---------- Card tables (phones) ---------- */
@media (max-width: 720px) {
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody { display: block; }
  .table-cards tbody tr { display: grid; gap: 4px 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: center; }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards tbody tr:hover { background: transparent; }
  .table-cards td { display: block; padding: 0; border: 0; }
  .table-cards td.empty { grid-column: 1 / -1; }
  .table-cards .actions { text-align: right; }

  .orders-table tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cust total" "pickup act" "items items" "quick quick"; }
  .orders-table .c-id { display: none; }
  .orders-table .c-cust { grid-area: cust; }
  .orders-table .c-total { grid-area: total; }
  .orders-table .c-pickup { grid-area: pickup; display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
  .orders-table .c-pickup .row-title { font-weight: 500; color: var(--text); }
  .orders-table .c-pickup .row-sub { font-size: 13px; }
  .orders-table .c-pickup .row-sub::before { content: "· "; }
  .orders-table .c-items { grid-area: items; max-width: none; font-size: 13px; margin-top: 2px; }
  .orders-table .c-quick { grid-area: quick; margin-top: 8px; }
  .orders-table .c-act { grid-area: act; }
  .quick { flex-wrap: nowrap; }
  .quick .select { flex: 1; min-width: 0; }

  .products-table tbody tr { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "thumb name price" "thumb cat act" "thumb desc desc"; gap: 2px 12px; }
  .products-table .c-thumb { grid-area: thumb; align-self: start; }
  .products-table .c-name { grid-area: name; }
  .products-table .c-price { grid-area: price; }
  .products-table .c-cat { grid-area: cat; }
  .products-table .c-act { grid-area: act; }
  .products-table .c-desc { grid-area: desc; max-width: none; font-size: 13px; }
  .products-table .c-desc:empty, .products-table .c-desc.faint { display: none; }

  .users-table tbody tr { grid-template-columns: 44px auto auto minmax(0, 1fr) auto; grid-template-areas: "thumb name name name act" "thumb role tfa status status"; gap: 6px 10px; }
  .users-table .c-thumb { grid-area: thumb; align-self: start; }
  .users-table .c-name { grid-area: name; }
  .users-table .c-act { grid-area: act; }
  .users-table .c-email { display: none; }
  .users-table .c-role { grid-area: role; }
  .users-table .c-2fa { grid-area: tfa; }
  .users-table .c-status { grid-area: status; justify-self: start; }
}
