:root {
  --bg: #f3f0e7;
  --bg-deep: #ebe6da;
  --surface: #fffdf8;
  --surface-soft: #f8f5ed;
  --ink: #173f35;
  --ink-soft: #2c5449;
  --green: #2f7d5d;
  --green-bright: #3f8f70;
  --green-soft: #e1efe7;
  --lime: #dfe9c6;
  --accent: #e28a4a;
  --accent-soft: #f8e5d3;
  --danger: #b54a3f;
  --danger-soft: #f9e2df;
  --warning: #9a6a1d;
  --warning-soft: #fbf0d7;
  --muted: #7b8780;
  --line: #e5e0d4;
  --line-strong: #d6d0c2;
  --shadow: 0 18px 45px rgba(23, 63, 53, .07);
  --shadow-soft: 0 8px 24px rgba(23, 63, 53, .05);
  --radius: 20px;
  --radius-sm: 12px;
  --sidebar: 264px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 2.4vw, 34px); line-height: 1.15; letter-spacing: -.03em; }
h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: 16px; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
code {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: .92em;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--green) !important; }
.mt { margin-top: 12px; }
.veg { font-size: .9em; }

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow.light { color: rgba(255, 255, 255, .62); }

/* ---------- shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(117, 173, 139, .25), transparent 38%),
    radial-gradient(circle at 100% 80%, rgba(226, 138, 74, .12), transparent 35%),
    var(--ink);
  color: #f4f3eb;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  padding: 0 8px;
  margin-bottom: 38px;
}
.brand:hover { color: #fff; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--lime);
  color: var(--ink);
  font-size: 21px;
  box-shadow: inset 0 -2px 0 rgba(23, 63, 53, .1);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 18px; letter-spacing: -.03em; }
.brand-text small { color: rgba(255, 255, 255, .62); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .68);
  font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.nav-link.is-active { background: rgba(223, 233, 198, .14); color: #fff; box-shadow: inset 3px 0 0 var(--lime); }
.nav-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  font-size: 13px;
}
.nav-link.is-active .nav-icon { background: var(--lime); color: var(--ink); }

.sidebar-foot { margin-top: auto; padding-top: 28px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { font-size: 12px; }
.user-meta small { color: rgba(255, 255, 255, .55); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, .48);
  font-size: 12px;
}
.logout-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.main {
  min-width: 0;
  padding: 30px clamp(20px, 3.2vw, 48px) 60px;
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.topbar-title .eyebrow { margin-bottom: 5px; }
.topbar-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.date-chip {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .7);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 8px 18px rgba(23, 63, 53, .16); }
.btn-primary:hover { background: var(--ink-soft); color: #fff; }
.btn-secondary { background: var(--green); color: #fff; }
.btn-secondary:hover { background: var(--green-bright); color: #fff; }
.btn-ghost { border-color: var(--line-strong); background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink-soft); background: var(--surface); color: var(--ink); }
.btn-danger-ghost { border-color: #e8c8c3; color: var(--danger); background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 6px 12px; border-radius: 10px; font-size: 12px; }
.btn-block { width: 100%; }
.button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.card-head .eyebrow { margin-bottom: 4px; }
.card-note { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 12px; }
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}
.card-foot a { color: var(--green); }
.sticky-card { position: sticky; top: 24px; }
.content-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.content-grid-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.content-grid-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.align-start { align-items: start; }

/* ---------- stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -45px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--green-soft);
  opacity: .45;
}
.stat-card.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat-card.accent::after { background: rgba(223, 233, 198, .18); }
.stat-card.accent .stat-label, .stat-card.accent .stat-foot .muted { color: rgba(255, 255, 255, .58); }
.stat-card.accent .stat-icon { background: rgba(255, 255, 255, .1); color: var(--lime); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.stat-value { margin: 13px 0 7px; font-size: clamp(23px, 2.2vw, 31px); font-weight: 800; letter-spacing: -.045em; line-height: 1.1; }
.stat-value small { color: var(--muted); font-size: .55em; font-weight: 600; }
.stat-value.small-value { font-size: 20px; line-height: 1.25; }
.stat-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; }
.stat-card.accent .stat-foot .badge { background: rgba(255, 255, 255, .14); color: #fff; }
.progress-line { height: 5px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; margin-top: 2px; }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--green); }

/* ---------- badges / alerts ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-warm { background: var(--warning-soft); color: var(--warning); }
.badge-outline { border: 1px solid var(--line-strong); color: var(--muted); background: transparent; }
.badge-ai { background: #ece7fa; color: #6750a4; }

.alert {
  padding: 13px 16px;
  margin-bottom: 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
}
.alert-success { background: var(--green-soft); border-color: #c6e2d3; color: #23664c; }
.alert-error { background: var(--danger-soft); border-color: #efc9c4; color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: #efd9aa; color: var(--warning); }
.alert-info { background: #e7eef6; border-color: #cbd9e9; color: #31597d; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .field textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 93, .12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.check-row input, .check-mini input { width: 16px; height: 16px; accent-color: var(--green); }
.check-mini { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.inline-form { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.inline-form input { width: auto; min-height: 36px; padding: 6px 10px; }
.inline-form input[type="date"] { width: auto; }
.form-section-title { margin: 8px 0 2px; padding-top: 15px; border-top: 1px solid var(--line); }
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  gap: 2px;
}
.segmented a { padding: 7px 13px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.segmented a.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 7px rgba(23, 63, 53, .08); }
.page-tabs { margin-bottom: 18px; }
.input-inline {
  width: 100%;
  min-height: 34px !important;
  padding: 5px 8px !important;
  border-color: transparent !important;
  background: transparent !important;
  font-size: 13px;
}
.input-inline:hover, .input-inline:focus { border-color: var(--line-strong) !important; background: #fff !important; }
.name-input { font-weight: 700; }
.desc-input { font-size: 11px; color: var(--muted); }
.cost-input { display: flex; align-items: center; gap: 5px; }
.cost-input span { color: var(--muted); font-size: 11px; }
.cost-field { width: 85px !important; font-weight: 700; }
.over, .cost-field.over, .cell-cost.over { color: var(--danger) !important; }
.cost-field.over { border-color: #e8c8c3 !important; background: var(--danger-soft) !important; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(47, 125, 93, .025); }
.data-table tfoot td { padding: 12px 10px; border-top: 1px solid var(--line-strong); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .actions { text-align: right; }
.row-muted { opacity: .52; }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.mini-bar { display: block; width: 74px; height: 6px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar-value { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- dashboard ---------- */
.chart-wrap { position: relative; height: 280px; }
.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.order-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.order-list li:last-child { border-bottom: 0; }
.order-name { font-size: 13px; }
.order-qty { display: grid; place-items: center; min-width: 29px; height: 25px; padding: 0 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; }
.count-bubble { display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 800; }
.feedback-score { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.score-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), var(--bg-deep) 0);
}
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.score-ring strong, .score-ring small { position: relative; z-index: 1; }
.score-ring strong { font-size: 18px; letter-spacing: -.04em; }
.score-ring small { margin-top: -4px; font-size: 9px; }
.cluster-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cluster-list li { display: grid; grid-template-columns: 92px minmax(50px, 1fr) 38px; align-items: center; gap: 9px; font-size: 12px; }
.cluster-list b { text-align: right; font-size: 11px; }
.cluster-bar { display: block; height: 5px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; }
.cluster-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--green-bright)); }

/* ---------- empty ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 42px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state > span { font-size: 30px; opacity: .55; }
.empty-state h3 { color: var(--ink); }
.empty-state p { max-width: 420px; font-size: 13px; }
.empty-state small { font-size: 11px; }
.empty-state .btn { margin-top: 8px; }
.empty-state.compact { padding: 26px 14px; }
.empty-state.compact > span { font-size: 23px; }
.text-link { font-size: 12px; font-weight: 700; }

/* ---------- menu ---------- */
.menu-preview { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.day-card { padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.day-card header { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.day-card header span { font-size: 12px; font-weight: 800; }
.day-card header small { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.day-dish { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.day-dish:last-child { border-bottom: 0; padding-bottom: 0; }
.slot-tag { display: inline-block; width: fit-content; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.dish-name { font-size: 11px; font-weight: 600; line-height: 1.35; }
.dish-cost { color: var(--green); font-size: 10px; font-weight: 800; }
.dish-cost.over { color: var(--danger); }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.editor-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.menu-table-wrap { padding: 0; overflow: hidden; margin-bottom: 16px; }
.menu-editor-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.menu-editor-table th, .menu-editor-table td { padding: 12px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.menu-editor-table tr:last-child td, .menu-editor-table tr:last-child th { border-bottom: 0; }
.menu-editor-table th:last-child, .menu-editor-table td:last-child { border-right: 0; }
.menu-editor-table thead th { background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; text-align: left; }
.menu-editor-table .day-col { width: 112px; font-size: 12px; text-align: left; background: var(--surface-soft); }
.menu-editor-table tbody .day-col { color: var(--ink); font-weight: 800; }
.menu-editor-table .sum-col { width: 100px; text-align: right; font-size: 11px; white-space: nowrap; }
.dish-select { min-height: 40px; padding: 6px 8px; border-radius: 8px; font-size: 12px; background: #fffefa; }
.cell-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; min-height: 16px; }
.cell-cost { color: var(--green); font-size: 10px; font-weight: 800; }
.change-note {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}
.editor-actions { padding: 16px 20px; }
.save-result:empty { display: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spinner { color: var(--muted); font-size: 12px; align-items: center; gap: 6px; }
.spinner::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-run-note { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.ai-run-note b { color: var(--ink); }
.compare-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.ai-summary { margin: 8px 0; padding: 10px 13px; background: var(--accent-soft); border-radius: 8px; font-size: 12px; }
.compare-table-wrap { padding: 0; margin-bottom: 16px; }
.compare-table { width: 100%; border-collapse: collapse; min-width: 800px; font-size: 12px; }
.compare-table th { padding: 10px 12px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line-strong); }
.compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare-table .day-cell { background: var(--surface-soft); font-size: 12px; white-space: nowrap; border-right: 1px solid var(--line); }
.compare-table .row-changed { background: rgba(226, 138, 74, .055); }
.cost-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.cost-strip > div { padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); display: flex; flex-direction: column; gap: 2px; }
.cost-strip span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.cost-strip b { font-size: 13px; }
.cost-strip small { color: var(--muted); font-size: 9px; }

/* ---------- dishes / settings ---------- */
.dishes-table td:first-child { min-width: 230px; }
.dishes-table td { vertical-align: top; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 11px; font-weight: 700; }
.chip small { color: var(--muted); font-size: 9px; }
.mini-summary { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.mini-summary > div { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 7px; border-bottom: 1px dashed var(--line); font-size: 12px; }
.mini-summary > div:last-child { border-bottom: 0; }
.mini-summary span { color: var(--muted); }
.mini-summary b { text-align: right; }
.staff-create { display: grid; grid-template-columns: 1.2fr 1fr .9fr 1fr auto; align-items: end; gap: 10px; padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }

/* ---------- feedback ---------- */
.rating-list { display: flex; flex-direction: column; gap: 13px; }
.rating-row { display: flex; flex-direction: column; gap: 5px; }
.rating-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; }
.rating-head small { margin-left: 4px; }
.rating-bar { height: 6px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; }
.rating-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #72b58e); }
.cluster-cards { display: flex; flex-direction: column; gap: 11px; }
.cluster-card { display: flex; flex-direction: column; gap: 5px; }
.cluster-card > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.cluster-card small { color: var(--muted); font-size: 10px; }
.comment-feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.comment-card { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.comment-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; margin-bottom: 6px; }
.comment-card p { font-size: 12px; color: var(--ink-soft); }
.rating-mark { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: var(--green-soft); font-size: 11px; }
.rating-mark.down { background: var(--danger-soft); }

/* ---------- savings ---------- */
.savings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  margin-bottom: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 85% 20%, rgba(223, 233, 198, .2), transparent 30%),
    var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}
.savings-hero h2 { font-size: clamp(34px, 4vw, 54px); letter-spacing: -.055em; margin: 5px 0; }
.savings-sub { color: rgba(255, 255, 255, .58); font-size: 12px; }
.savings-hero-side { display: flex; gap: 28px; flex-wrap: wrap; }
.savings-hero-side div { display: flex; flex-direction: column; gap: 3px; }
.savings-hero-side span { color: rgba(255, 255, 255, .55); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.savings-hero-side b { font-size: 16px; }
.goal-visual { padding: 10px 0 4px; }
.goal-number { font-size: 30px; font-weight: 800; letter-spacing: -.05em; margin-bottom: 10px; }
.goal-track { position: relative; height: 9px; border-radius: 99px; background: var(--bg-deep); }
.goal-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--accent)); }
.goal-track i { position: absolute; top: -4px; width: 2px; height: 17px; background: var(--ink); border-radius: 2px; }
.goal-labels { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 9px; }

/* ---------- summary ---------- */
.summary-table td { font-size: 13px; }
.portion-badge { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-weight: 800; }
.class-breakdown { display: flex; flex-wrap: wrap; gap: 5px; }
.class-breakdown span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.class-breakdown b { color: var(--ink); }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.class-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.class-card header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 7px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.class-card header span { font-weight: 800; }
.class-card header b { color: var(--green); }
.class-card > div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); padding: 2px 0; }

/* ---------- auth ---------- */
.auth-body { background: var(--surface); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); min-height: 100vh; }
.auth-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 64px);
  background:
    radial-gradient(circle at 18% 18%, rgba(223, 233, 198, .2), transparent 25%),
    radial-gradient(circle at 90% 85%, rgba(226, 138, 74, .22), transparent 30%),
    var(--ink);
  color: #fff;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -170px;
  top: 15%;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255, 255, 255, .025), 0 0 0 110px rgba(255, 255, 255, .018);
  pointer-events: none;
}
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; position: relative; z-index: 1; }
.auth-brand .brand-mark { width: 36px; height: 36px; font-size: 18px; }
.auth-hero-content { position: relative; z-index: 1; max-width: 570px; }
.auth-hero h1 { font-size: clamp(40px, 5.3vw, 72px); line-height: 1.02; letter-spacing: -.06em; margin: 14px 0 20px; }
.auth-lead { max-width: 460px; color: rgba(255, 255, 255, .68); font-size: clamp(14px, 1.25vw, 17px); line-height: 1.65; }
.auth-metrics { display: flex; gap: clamp(20px, 4vw, 54px); margin-top: 42px; }
.auth-metrics div { display: flex; flex-direction: column; gap: 2px; }
.auth-metrics strong { color: var(--lime); font-size: clamp(23px, 2.6vw, 34px); letter-spacing: -.045em; }
.auth-metrics span { color: rgba(255, 255, 255, .5); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.auth-foot { position: relative; z-index: 1; color: rgba(255, 255, 255, .38); font-size: 11px; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-card { width: min(430px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h2 { margin: 5px 0 7px; font-size: 27px; letter-spacing: -.035em; }
.auth-card .muted { font-size: 12px; margin-bottom: 20px; }
.auth-note { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; text-align: center; }

/* ---------- error ---------- */
.error-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.error-card { width: min(520px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.error-code { display: inline-block; color: var(--accent); font-size: 70px; font-weight: 800; line-height: 1; letter-spacing: -.07em; }
.error-card h1 { margin: 12px 0 8px; }
.error-card p { color: var(--muted); margin-bottom: 22px; }
.error-card .button-row { justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  :root { --sidebar: 232px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid-2-1 { grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr); }
  .menu-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .staff-create { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-create .btn { width: fit-content; }
}

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar {
    position: relative;
    height: auto;
    padding: 15px 18px;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    overflow: visible;
  }
  .brand { margin: 0; padding: 0; flex: 0 0 auto; }
  .brand-text small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 3px; flex: 1; }
  .nav-link { padding: 7px 9px; white-space: nowrap; font-size: 12px; }
  .nav-link .nav-icon { display: none; }
  .sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 0; margin: 0; flex: 0 0 auto; }
  .user-chip { border: 0; padding: 0; background: transparent; }
  .user-meta { display: none; }
  .logout-btn { margin: 0; width: auto; padding: 6px 8px; }
  .main { padding-top: 22px; }
  .content-grid-2-1, .content-grid-1-1, .content-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .sticky-card { position: static; }
  .menu-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .savings-hero { flex-direction: column; align-items: flex-start; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: 420px; }
  .auth-panel { padding: 28px 18px 50px; }
}

@media (max-width: 640px) {
  .main { padding: 18px 14px 42px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .topbar-meta { justify-content: flex-start; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .card { padding: 16px; border-radius: 16px; }
  .stat-card { padding: 16px; border-radius: 16px; }
  .content-grid { gap: 12px; }
  .menu-preview { grid-template-columns: minmax(0, 1fr); }
  .comment-feed { grid-template-columns: minmax(0, 1fr); }
  .settings-grid, .settings-grid-3, .field-row { grid-template-columns: minmax(0, 1fr); }
  .cost-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .savings-hero { padding: 22px; }
  .savings-hero-side { gap: 18px; }
  .editor-head, .compare-head { flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented a { flex: 1; text-align: center; white-space: nowrap; }
  .sidebar { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .auth-hero { min-height: 360px; padding: 24px; }
  .auth-metrics { margin-top: 26px; gap: 18px; }
  .auth-card { padding: 24px; }
  .staff-create { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .sidebar, .topbar-actions, .topbar-meta, .button-row, .alert, .page-tabs { display: none !important; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 0; }
  .card, .stat-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .topbar { margin-bottom: 15px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .content-grid { display: block; }
  .content-grid > * { margin-bottom: 12px; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Login and dashboard: a clear view of tomorrow's kitchen plan. */
::selection { background: #cbdcbe; color: #173f35; }
:focus-visible { outline: 3px solid #bd6a34; outline-offset: 3px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid #bd6a34; outline-offset: 3px; }
input, textarea { caret-color: var(--green); }
.auth-shell { grid-template-columns: minmax(0, 1.2fr) minmax(390px, .8fr); min-height: 100dvh; }
.auth-hero { padding: clamp(32px, 4vw, 60px); background: #173f35; justify-content: flex-start; gap: clamp(38px, 7vh, 80px); }
.auth-hero::after { display: none; }
.auth-brand { gap: 12px; line-height: 1.1; font-size: 15px; }
.auth-brand-symbol { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #87ae9a; border-radius: 50%; color: #e6f0df; font-size: 19px; }
.auth-hero-content { max-width: 720px; width: 100%; }
.auth-hero h1 { margin: 0 0 18px; font-size: clamp(38px, 4.5vw, 66px); line-height: 1.08; letter-spacing: -.035em; text-wrap: balance; }
.auth-lead { max-width: 500px; color: #d0ded4; font-size: 16px; }
.auth-product { margin: clamp(28px, 4vh, 46px) 0 0; max-width: 690px; }
.auth-product img { display: block; width: 100%; height: auto; border-radius: 10px; }
.auth-product figcaption { margin-bottom: 11px; color: #c6d8ca; font-size: 12px; }
.auth-panel { background: #f3f0e7; }
.auth-card { width: min(390px, 100%); padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.auth-card h2 { margin: 0 0 10px; font-size: clamp(28px, 2.8vw, 36px); }
.auth-intro { margin-bottom: 30px; color: #52695d; font-size: 14px; line-height: 1.65; }
.auth-card .field { gap: 8px; }
.auth-card .field input { min-height: 52px; background: #fffdf8; }
.auth-card .stack { gap: 18px; }
.auth-card .btn { min-height: 52px; margin-top: 5px; }
.auth-note { text-align: left; color: #596d61; font-size: 12px; }
.orders-feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, .85fr); gap: clamp(28px, 4vw, 58px); padding: clamp(26px, 3.4vw, 44px); margin-bottom: 20px; background: #173f35; color: #f5f5ed; border-radius: 16px; }
.orders-feature-date { color: #bad1c0; font-size: 12px; font-weight: 700; }
.orders-feature h2 { margin: 16px 0 12px; font-size: clamp(30px, 3vw, 43px); line-height: 1.1; letter-spacing: -.035em; }
.orders-feature-copy { max-width: 360px; color: #d0ded4; font-size: 14px; line-height: 1.6; }
.orders-feature-link { display: inline-flex; align-items: center; gap: 20px; margin-top: 26px; padding: 11px 17px; border-radius: 8px; background: #e2edda; color: #173f35; font-weight: 800; }
.orders-feature-link:hover { background: #f7faf3; color: #173f35; }
.orders-feature-detail { align-self: stretch; padding-left: clamp(24px, 3vw, 40px); border-left: 1px solid #648675; }
.orders-feature-count { display: flex; align-items: center; gap: 17px; padding-bottom: 15px; }
.orders-feature-count strong { font-size: clamp(46px, 5vw, 65px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.orders-feature-count span { color: #d0ded4; font-size: 13px; line-height: 1.4; }
.orders-feature-list { padding: 0; margin: 0; list-style: none; }
.orders-feature-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid #648675; font-size: 13px; }
.orders-feature-list small { color: #c5d8c9; }
.orders-feature-list strong { font-variant-numeric: tabular-nums; }
.orders-feature-empty, .orders-feature-foot { color: #d0ded4; font-size: 12px; }
.orders-feature-foot { margin-top: 15px; }
.dashboard-context { padding: 28px; background: #e1ebe0; border-radius: 16px; }
.dashboard-context h2 { margin-bottom: 12px; font-size: 21px; }
.dashboard-context p { max-width: 40ch; color: #385b49; line-height: 1.7; }
.dashboard-context a { display: inline-block; margin-top: 22px; font-weight: 800; }
.stat-value, .data-table .num { font-variant-numeric: tabular-nums; }
/* CleanKg reference: strong editorial contrast and a single red accent. */
:root { --bg: #f5f5f2; --bg-deep: #ebebe6; --surface: #ffffff; --surface-soft: #f0f0eb; --ink: #171918; --ink-soft: #3f4541; --green: #b82f26; --green-bright: #cb382d; --green-soft: #f9e8e4; --lime: #eeeeea; --accent: #e33a2b; --accent-soft: #fce9e5; --muted: #5d655f; --line: #dedfd8; --line-strong: #bcc0b8; --shadow: none; --shadow-soft: none; --radius: 12px; }
.sidebar { background: #171918; }
.nav-link.is-active { background: #f3f3ed; color: #171918; border-color: transparent; box-shadow: none; }
.brand-mark { background: #f3f3ed; box-shadow: none; }
.auth-hero { background: #171918; }
.auth-brand-symbol { border-color: #9b9f98; color: #f6f6ef; }
.auth-panel { background: #f5f5f2; }
.auth-intro, .auth-note { color: #555e57; }
.auth-hero h1 { color: #f5f5ef; }
.auth-lead, .auth-product figcaption { color: #d9ddd5; }
.auth-card .btn-primary { background: #d53629; color: #fff; box-shadow: none; }
.auth-card .btn-primary:hover { background: #b82c22; }
.orders-feature { background: #171918; border-radius: 10px; }
.orders-feature-link { background: #f1f1e9; color: #171918; }
.orders-feature-link:hover { background: #fff; color: #171918; }
.orders-feature-date, .orders-feature-copy, .orders-feature-count span, .orders-feature-foot, .orders-feature-empty, .orders-feature-list small { color: #d7dcd3; }
.orders-feature-detail, .orders-feature-list li { border-color: #626a61; }
.stat-card { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.stat-card::after { display: none; }
.stat-card.accent { background: transparent; color: #171918; border-color: transparent; }
.stat-card.accent .stat-label, .stat-card.accent .stat-foot .muted { color: #5d655f; }
.stat-card.accent .stat-icon { color: #b82f26; background: #f9e8e4; }
.stat-grid { gap: 0; border-bottom: 1px solid #bcc0b8; margin-bottom: 26px; }
.stat-card + .stat-card { border-left: 1px solid #dedfd8; }
.card { box-shadow: none; border-radius: 12px; }
.dashboard-context { background: #eceee7; }
.dashboard-context p { color: #3f4541; }
.stat-icon, .nav-icon { display: none; }
.topbar-title .eyebrow, .card-head .eyebrow { display: none; }
.ai-summary { border-left: 0; border-radius: 8px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-color: #b82f26; }
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; gap: 28px; }
  .auth-panel { padding: 42px 24px; }
}
@media (max-width: 640px) {
  .auth-shell { display: flex; flex-direction: column; }
  .auth-hero { display: contents; }
  .auth-brand { order: 0; padding: 24px 22px; background: #171918; color: #fff; }
  .auth-panel { order: 1; padding: 36px 22px; }
  .auth-hero-content { order: 2; padding: 30px 22px 38px; background: #171918; color: #fff; }
  .auth-hero h1 { font-size: 34px; }
  .auth-lead { font-size: 14px; }
  .auth-product { margin-top: 25px; }
  .orders-feature { grid-template-columns: 1fr; gap: 28px; padding: 24px; }
  .orders-feature-detail { padding: 23px 0 0; border-left: 0; border-top: 1px solid #648675; }
  .orders-feature h2 { font-size: 31px; }
  .dashboard-context { padding: 22px; }
}
