:root {
  --ink: #172026;
  --muted: #60707c;
  --line: #d9e2e7;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --side: #101923;
  --side-soft: #172636;
  --accent: #0f766e;
  --accent-soft: #e6f4f1;
  --danger: #b42318;
  --warm: #b45309;
  --ok: #16803b;
  --shadow: 0 18px 45px rgba(16, 25, 35, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef5f6 0, var(--bg) 340px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #eef5f6 0, var(--bg) 100%);
}
.login[hidden] { display: none; }
.login-box {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  box-shadow: var(--shadow);
}
.hint {
  margin-top: 12px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
label {
  display: block;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 360px;
  min-height: 100vh;
}
aside, main { padding: 20px; }
aside {
  background: var(--side);
  border-right: 1px solid rgba(255, 255, 255, .08);
  color: #f7fbfc;
}
.right {
  background: rgba(255, 255, 255, .62);
  border-left: 1px solid var(--line);
  border-right: 0;
  color: var(--ink);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #2f9e8f);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(15, 118, 110, .28);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; }
h2 { font-size: 32px; letter-spacing: 0; }
h3 { margin-bottom: 12px; font-size: 17px; }
p { color: var(--muted); font-size: 13px; }
aside p, aside label { color: #9fb0bd; }
aside input, aside select {
  border-color: rgba(255, 255, 255, .12);
  background: var(--side-soft);
  color: #f7fbfc;
}
aside option { color: var(--ink); }

nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
nav button[hidden] { display: none; }
nav button, .primary, .secondary, .danger {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 850;
}
nav button {
  background: transparent;
  color: #b8c5cf;
  text-align: left;
}
nav button:hover { background: rgba(255, 255, 255, .06); color: white; }
nav button.active {
  background: rgba(15, 118, 110, .2);
  color: white;
  box-shadow: inset 3px 0 0 var(--accent);
}
.primary { background: var(--accent); color: white; box-shadow: 0 10px 24px rgba(15, 118, 110, .2); }
.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.danger { background: var(--danger); color: white; }
.compact { min-height: 36px; padding: 0 10px; }
.full { width: 100%; margin-top: 10px; }
.shell[hidden] { display: none; }
aside .secondary {
  background: transparent;
  color: #f7fbfc;
  border-color: rgba(255, 255, 255, .16);
}

header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.metrics > div, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
  box-shadow: 0 8px 24px rgba(16, 25, 35, .04);
}
.metrics.executive > div {
  min-height: 118px;
  display: grid;
  align-content: center;
  border-top: 4px solid var(--accent);
}
.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr);
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.compact-head { margin-bottom: 4px; }
.table-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.table-card {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  padding: 12px;
  text-align: left;
}
.table-card strong,
.table-card span,
.table-card b { display: block; }
.table-card span {
  margin: 9px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.table-card b { color: var(--accent); }
.table-card.busy {
  border-color: rgba(15, 118, 110, .35);
  background: var(--accent-soft);
}
.notice {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #edf0f1;
}
.notice:last-child { border-bottom: 0; }
.notice span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf2f5;
  color: var(--ink);
  font-weight: 900;
}
.notice.warning span {
  background: #fff4e6;
  color: var(--warm);
}
.kitchen-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.kitchen-column {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  padding: 12px;
}
.kitchen-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  margin-bottom: 10px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  background: #eef2f5;
}
.status-pill.pending { color: var(--warm); background: #fff4e6; }
.status-pill.ready { color: var(--accent); background: var(--accent-soft); }
.status-pill.served { color: var(--ok); background: #e8f6ee; }
.toolbar, .form-grid, .actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tabs button {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 800;
}
.tabs button.active { background: var(--accent); color: white; border-color: var(--accent); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.grid-help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.grid-help > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}
.product {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  text-align: left;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product:hover {
  border-color: rgba(15, 118, 110, .45);
  box-shadow: 0 12px 30px rgba(16, 25, 35, .08);
  transform: translateY(-1px);
}
.product strong { font-size: 16px; }
.product span, small { color: var(--muted); font-size: 13px; }
.product b { color: var(--accent); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f1;
}
.row small {
  display: block;
  margin-top: 3px;
}
.row:last-child { border-bottom: 0; }
.stack { display: grid; gap: 10px; }
.muted { color: var(--muted); }
.mini {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: white;
  font-size: 12px;
  font-weight: 800;
}
.pill {
  display: inline-flex;
  min-width: 60px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--ok);
  color: white;
  font-size: 12px;
  font-weight: 850;
}
.pill.low { background: var(--warm); }
.pill.out { background: var(--danger); }
.total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
  font-size: 20px;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  transition: .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .kitchen-board { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); }
  header, .toolbar, .form-grid, .actions { grid-template-columns: 1fr; display: grid; }
  aside:first-of-type {
    padding-bottom: 84px;
  }
  nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    gap: 0;
    overflow-x: auto;
    margin: 0;
    padding: 8px;
    border-top: 1px solid var(--line);
    background: var(--panel);
  }
  nav button {
    min-width: 92px;
    text-align: center;
    font-size: 12px;
    color: var(--ink);
  }
  nav button.active { color: white; box-shadow: none; }
  .right {
    padding-bottom: 86px;
  }
  .right .panel:first-child {
    position: sticky;
    bottom: 62px;
    z-index: 4;
    box-shadow: 0 -12px 32px rgba(23, 32, 38, .12);
  }
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .product {
    min-height: 118px;
  }
  h2 { font-size: 24px; }
}
