:root {
  --ink: #1c140f;
  --ink-soft: #5c4638;
  --paper: #f4ece3;
  --paper-2: #efe2d3;
  --card: #fffaf4;
  --line: #e5d3c2;
  --clay: #d85a2a;
  --clay-dark: #9d3a14;
  --gold: #e7b23a;
  --leaf: #1c7a4d;
  --danger: #9d1c1c;
  --shadow: 0 22px 50px rgba(48, 24, 10, .12);
  --display: "Fraunces", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(231, 178, 58, .18), transparent 50%),
    var(--paper);
}
h1, h2, h3, .brand strong, .stat-value, .ticket-total strong, .login-art h1 {
  font-family: var(--display);
  font-weight: 560;
  letter-spacing: -.03em;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--ink);
  color: #f8efe6;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  padding: 4px 8px 18px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold), var(--clay));
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.4rem;
}
.brand strong { display: block; font-size: 1.25rem; line-height: 1; }
.brand small, .side-user small { color: #d9c3b2; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f6ebe3;
  border-radius: 12px;
  padding: 11px 12px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}
.side-link i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: currentColor;
  opacity: .35;
}
.side-link:hover { background: rgba(255, 250, 244, .06); }
.side-link.is-active { background: rgba(231, 178, 58, .16); color: white; }
.side-link.is-active i { opacity: 1; background: var(--gold); }
.side-user { margin-top: auto; padding: 14px 8px 0; }
.side-user strong, .side-user small { display: block; }
.side-out { margin-top: 8px; padding-left: 0; color: #f0c7b4; }
.stage { padding: 28px; min-width: 0; }
.pos-body .stage { padding: 16px; }

.page-head, .pos-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .72rem;
  color: var(--clay-dark);
  font-weight: 700;
}
h1 { font-size: clamp(2rem, 3vw, 3.2rem); margin: 0; line-height: .95; }
.lede { color: var(--ink-soft); margin: 8px 0 0; max-width: 46rem; }

.flash {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 600;
}
.flash-ok { background: #e7f6ee; color: #135c38; }
.flash-bad { background: #fde8e4; color: var(--danger); }

.btn-accent, .btn-ink, .btn-quiet, .btn-leaf {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
}
.btn-accent { background: var(--clay); color: white; }
.btn-accent:hover { background: var(--clay-dark); color: white; }
.btn-ink { background: var(--ink); color: white; }
.btn-ink:hover { color: white; }
.btn-leaf { background: var(--leaf); color: white; }
.btn-quiet { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.stat-grid, .chart-grid, .split-2 { display: grid; gap: 16px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.chart-grid { grid-template-columns: 1.4fr .8fr; margin-bottom: 16px; }
.split-2 { grid-template-columns: 1fr 1fr; }
.stat-card, .panel, .form-card, .dish-card, .bill-sheet, .gate {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.stat-card, .panel, .form-card { padding: 18px 18px 16px; }
.stat-card span, .panel h2 { color: var(--ink-soft); font-size: .92rem; }
.stat-value { display: block; font-size: 2rem; margin-top: 6px; }
.panel h2 { font-family: var(--sans); font-weight: 700; letter-spacing: 0; margin: 0 0 12px; }
.chart-box { height: 260px; }
.banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 16px;
  background: #fff7ea;
  border: 1px solid #f0d7b0;
}
.banner.is-off { background: #fde8e4; border-color: #f3c2b8; }

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th, table.data td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
table.data th {
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--paper-2);
}
.badge-active, .badge-free, .badge-paid { background: #e5f6ec; color: #14643d; }
.badge-upcoming, .badge-billing { background: #fff1cc; color: #8a5b00; }
.badge-expired, .badge-off { background: #fde8e4; color: var(--danger); }
.badge-occupied, .badge-open { background: #ffe8dc; color: var(--clay-dark); }
.logo-dot, .dish-card img, .item-photo img {
  object-fit: cover;
}
.logo-dot {
  width: 42px; height: 42px; border-radius: 12px;
}

.form-card { max-width: 760px; }
.form-card .row { --bs-gutter-x: 14px; --bs-gutter-y: 12px; }
.form-control, .form-select {
  border-radius: 12px;
  border-color: var(--line);
  min-height: 46px;
  background: white;
}
.hint { color: var(--ink-soft); font-size: .9rem; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 46px; }

.dish-grid, .restaurant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.dish-card { overflow: hidden; padding: 0; }
.dish-card img, .item-photo { aspect-ratio: 4 / 3; width: 100%; background: var(--paper-2); display: block; }
.dish-card .pad, .restaurant-card { padding: 14px; }
.restaurant-card {
  display: flex; gap: 12px; align-items: center;
}
.muted { color: var(--ink-soft); }
.actions { display: flex; gap: 8px; align-items: center; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
}
.login-art {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: #fff8f2;
  padding: 48px;
  display: flex;
  align-items: flex-end;
}
.login-art h1 { font-size: clamp(3rem, 5vw, 5.2rem); max-width: 10ch; }
.art-plate {
  position: absolute;
  border-radius: 50%;
  filter: saturate(1.1);
}
.art-a {
  width: 420px; height: 420px; right: -40px; top: -60px;
  background: radial-gradient(circle at 40% 40%, #ffe1b5, #d85a2a 55%, #6a2412);
  box-shadow: inset 0 0 0 28px rgba(255,250,244,.2);
}
.art-b {
  width: 220px; height: 220px; left: 48px; top: 80px;
  background: radial-gradient(circle at 40% 35%, #fff6d8, #e7b23a 60%, #8a5b00);
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.login-card { width: min(440px, 100%); }
.demo-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.demo-chip {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 650;
}

.pos-body:has(.pos-app) {
  height: 100vh;
  overflow: hidden;
}
.pos-body:has(.pos-app) .shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
.pos-body:has(.pos-app) .stage {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pos-body:has(.pos-app) .flash { flex: 0 0 auto; }
.pos-app { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.pos-bar { align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.pos-bar h1 { font-size: 1.55rem; }
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  min-height: 0;
  flex: 1;
}
.pos-board {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.pos-board > * { flex: 0 0 auto; }
.menu-search { display: block; margin-bottom: 10px; }
.menu-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 10px 16px;
  min-height: 44px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chip-row, .table-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip, .table-pill, .stepper button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
}
.chip, .table-pill { padding: 8px 14px; font-weight: 700; min-height: 44px; }
.chip.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.table-pill {
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 8px;
  align-items: center;
  line-height: 1.1;
  min-width: 128px;
  text-align: left;
}
.table-icon { width: 36px; height: 40px; grid-row: 1 / span 2; }
.date-pick { display: flex; align-items: center; gap: 8px; }
.date-pick label { font-weight: 700; }
.date-pick input {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 8px 12px;
  min-height: 44px;
}
.table-pill small { font-weight: 650; opacity: .85; }
.table-pill.is-free { background: #e7f6ee; color: #14643d; border-color: #1c7a4d; }
.table-pill.is-occupied { background: #fde8e4; color: #9d1c1c; border-color: #c62828; }
.table-pill.is-billing { background: #fff4d6; color: #8a5b00; border-color: #e7b23a; }
.table-pill.is-selected { outline: 3px solid #1c140f; outline-offset: 2px; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(168px, 100%), 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  padding-bottom: 12px;
}
.item-card {
  align-self: start;
  height: auto;
  min-height: max-content;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(48, 24, 10, .08);
  border: 1px solid transparent;
  text-align: left;
  padding: 0;
  position: relative;
  color: inherit;
  width: 100%;
}
.item-card .stepper span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}
.item-card:hover { transform: translateY(-2px); }
.item-card.is-sold { opacity: .55; }
.item-photo { position: relative; }
.item-no, .qty-badge {
  position: absolute;
  top: 8px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .75rem;
  font-weight: 800;
  background: rgba(28, 20, 15, .78);
  color: white;
}
.item-no { left: 8px; }
.qty-badge { right: 8px; background: var(--clay); }
.item-meta { padding: 10px 12px 12px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-end; }
.item-meta h2 { font-family: var(--sans); font-size: 1rem; margin: 0; letter-spacing: 0; font-weight: 700; }
.item-meta p { margin: 0; color: var(--clay-dark); font-weight: 800; }
.stepper { display: flex; gap: 6px; }
.stepper button { width: 36px; height: 36px; font-size: 1.2rem; line-height: 1; }

.ticket-wrap { min-height: 0; display: flex; flex-direction: column; }
.bill-dock { display: none; }
.floor-dialog {
  border: 0;
  border-radius: 20px;
  padding: 22px;
  width: min(480px, calc(100vw - 32px));
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.floor-dialog::backdrop { background: rgba(28, 20, 15, .45); }
.floor-dialog h2 { margin: 0 0 12px; }
.ticket {
  background: var(--ink);
  color: #fff8f2;
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.ticket h2 { margin: 0; font-size: 1.8rem; }
.ticket-lines { list-style: none; padding: 0; margin: 14px 0; overflow: auto; flex: 1; min-height: 0; }
.ticket-lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,248,242,.12);
}
.ticket .stepper button { background: transparent; color: white; border-color: rgba(255,248,242,.3); }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; }
.ticket-total strong { font-size: 2rem; }
.ticket .btn-accent, .ticket .btn-leaf, .ticket .btn-quiet { width: 100%; }
.ticket .btn-quiet { color: white; border-color: rgba(255,248,242,.3); }
.ticket-note { min-height: 1.2em; color: #f0c7b4; font-weight: 650; }
.gate {
  padding: 48px 32px;
  max-width: 720px;
}
.gate h1 { margin-bottom: 12px; }

.bill-sheet { max-width: 720px; margin: 0 auto; padding: 28px; }
.bill-sheet table { width: 100%; }
.money { text-align: right; }

@media (max-width: 1100px) {
  .stat-grid, .chart-grid, .split-2, .login-screen, .shell { grid-template-columns: 1fr; }
  .pos-body:has(.pos-app) .shell { grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { height: auto; position: relative; }
  .side-nav { flex-direction: row; overflow: auto; }
  .side-user { margin-top: 12px; }
  .pos-body .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
  }
  .pos-body .brand { padding: 0; flex: 0 0 auto; }
  .pos-body .brand small { display: none; }
  .pos-body .side-nav { flex: 1; min-width: 0; }
  .pos-body .side-user { margin: 0; padding: 0; flex: 0 0 auto; }
  .pos-body .side-user strong, .pos-body .side-user small { display: none; }
  .pos-body .side-out { margin: 0; padding: 8px 10px; }
  .table-row { flex-wrap: nowrap; overflow-x: auto; }
  .table-pill { flex: 0 0 auto; }
}
@media (max-width: 800px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr); }
  .pos-board { padding-bottom: 84px; }
  .pos-bar h1 { font-size: 1.35rem; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); }
  .ticket-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column-reverse;
  }
  .bill-dock {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    border: 0;
    background: var(--ink);
    color: #fff8f2;
    font-weight: 750;
    padding: 12px 16px;
  }
  .ticket { display: none; border-radius: 24px 24px 0 0; max-height: min(78vh, 640px); overflow: auto; }
  .ticket-wrap.is-open .ticket { display: flex; }
}
@media (max-width: 720px) {
  .stage, .login-art { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 2.2rem; }
}
@media print {
  .sidebar, .flash, .no-print { display: none !important; }
  .pos-body, .shell, .stage { display: block; height: auto !important; overflow: visible !important; padding: 0; background: white; }
  .bill-sheet, .stat-card, .panel { box-shadow: none; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
