:root {
  --ink: #182027;
  --muted: #68737d;
  --paper: #f3f1ec;
  --surface: #fffdf8;
  --surface-strong: #f8efe0;
  --line: #ded5c5;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --gold: #c7781d;
  --red: #b42318;
  --green: #16803d;
  --blue: #285f9f;
  --charcoal: #24313a;
  --shadow: 0 18px 42px rgba(36, 49, 58, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(222, 213, 197, 0.75);
  background: #212d34;
  color: #fffaf0;
  padding: 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup p,
.brand-lockup strong {
  display: block;
  margin: 0;
}

.brand-lockup p {
  color: #d9cdbb;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-lockup strong {
  font-size: 1.12rem;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #211100;
  font-weight: 950;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #f6ead8;
  padding: 0 12px;
  text-align: left;
  font-weight: 850;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 253, 248, 0.16);
  background: rgba(255, 253, 248, 0.1);
}

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 253, 248, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.08);
  padding: 14px;
}

.sidebar-card span,
.sidebar-card small {
  color: #d9cdbb;
  font-size: 0.8rem;
  font-weight: 750;
}

.sidebar-card strong {
  font-size: 2.4rem;
  line-height: 1;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px;
}

.topbar,
.surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.clock {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3vw, 3.6rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.surface {
  padding: clamp(16px, 2vw, 22px);
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading.tight {
  align-items: center;
  margin-bottom: 12px;
}

.pos-layout,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 18px;
}

.product-panel,
.cart-panel,
.inbox-panel,
.audit-panel,
.batch-panel {
  min-width: 0;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.84rem;
  font-weight: 900;
}

.segmented button.is-active {
  background: var(--charcoal);
  color: #fffdf8;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.product-tile {
  display: grid;
  min-height: 126px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.product-tile:hover {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.1);
}

.product-tile[disabled] {
  cursor: not-allowed;
  opacity: 0.52;
}

.product-tile strong,
.product-card strong,
.order-card strong {
  line-height: 1.16;
}

.product-tile span,
.product-card span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

.price {
  color: var(--accent);
  font-weight: 950;
}

.field-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 950;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--gold);
  color: #231305;
  font-size: 1.4rem;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary,
.button.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.ghost {
  min-height: 34px;
}

.button.danger {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff;
  color: var(--red);
}

.button.full {
  width: 100%;
  margin-top: 12px;
}

.cart-lines {
  display: grid;
  max-height: 34vh;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.cart-line-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 950;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.totals span {
  color: var(--muted);
  font-weight: 850;
}

.totals .grand {
  font-size: 1.35rem;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

.order-board,
.kitchen-grid,
.metric-grid,
.menu-admin,
.display-menu,
.featured-row {
  display: grid;
  gap: 12px;
}

.order-board {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.order-card,
.kitchen-card,
.metric-card,
.product-card,
.display-item,
.chat-bubble,
.audit-item,
.exception-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-card,
.kitchen-card,
.product-card,
.display-item,
.metric-card {
  padding: 14px;
}

.order-top,
.status-row,
.product-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  background: #eef3f1;
  color: var(--accent-dark);
  padding: 0 9px;
  font-size: 0.75rem;
  font-weight: 950;
}

.badge.phone {
  background: #edf2ff;
  color: var(--blue);
}

.badge.whatsapp {
  background: #e9f8ef;
  color: var(--green);
}

.badge.warn {
  background: #fff2e0;
  color: #9a5a0d;
}

.badge.danger {
  background: #fff0ee;
  color: var(--red);
}

.order-lines,
.meta-list {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kitchen-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.kitchen-column {
  display: grid;
  gap: 10px;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf6ed;
  padding: 10px;
}

.kitchen-column h3 {
  margin: 0;
}

.batch-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.chat-window,
.audit-panel,
.inbox-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.chat-window {
  min-height: 420px;
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f4ef;
  padding: 12px;
}

.chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
}

.chat-bubble.customer {
  justify-self: end;
  border-color: rgba(15, 118, 110, 0.25);
  background: #e8f5f3;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.exception-item,
.audit-item {
  padding: 10px;
}

.menu-admin {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.product-admin-row {
  align-items: start;
  margin-bottom: 12px;
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggle-row label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.display-screen {
  background: #191f22;
  color: #fffaf0;
}

.display-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 253, 248, 0.14);
  padding-bottom: 18px;
}

.display-hero h2 {
  font-size: clamp(2.3rem, 6vw, 6rem);
}

.display-screen .eyebrow {
  color: #ffb85c;
}

#displayUpdated {
  color: #d4c7b1;
  font-weight: 900;
}

.featured-row {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 18px 0;
}

.featured-row .display-item {
  border-color: rgba(255, 184, 92, 0.4);
  background: #2b241a;
}

.display-menu {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.display-item {
  background: #242d30;
  border-color: rgba(255, 253, 248, 0.12);
}

.display-item span {
  color: #d4c7b1;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

.metric-card span {
  color: var(--muted);
  font-weight: 850;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-strong);
  color: #3a2f20;
  font-size: 0.82rem;
  font-weight: 950;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  transform: translateY(20px);
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-card {
    margin-top: 0;
  }

  .pos-layout,
  .split-layout,
  .kitchen-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .panel-heading,
  .display-hero,
  .order-top,
  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list,
  .field-grid.two,
  .toggle-row,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .product-grid,
  .order-board,
  .menu-admin,
  .display-menu {
    grid-template-columns: 1fr;
  }
}
