:root {
  --bg: #fbf7f1;
  --surface: #fffdf9;
  --surface-2: #f5efe6;
  --line: #e6dccf;
  --text: #29231f;
  --muted: #81746a;
  --soft: #a7988b;
  --brand: #8a3f08;
  --brand-strong: #6f2f04;
  --brand-soft: #f4dfc8;
  --danger: #de4959;
  --warning: #d89121;
  --ok: #2eaf6b;
  --sidebar: #2a1207;
  --sidebar-soft: #3a1b0d;
  --shadow: 0 12px 32px rgba(42, 18, 7, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  color: #f9efe4;
  padding: 18px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 24px;
  font-weight: 800;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--brand);
  font-weight: 800;
}

.nav-section {
  margin: 18px 0;
}

.nav-title {
  padding: 0 10px 6px;
  color: rgba(249, 239, 228, 0.48);
  font-size: 12px;
  font-weight: 700;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(249, 239, 228, 0.72);
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: var(--sidebar-soft);
  color: #fff9f2;
}

.nav-dot {
  width: 16px;
  color: #e8a65c;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-footer {
  margin: 36px 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(249, 239, 228, 0.8);
  font-size: 12px;
}

.sidebar-footer strong {
  display: block;
  color: #fff9f2;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px 32px 48px;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar,
.segmented {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 1px 1px rgba(42, 18, 7, 0.02);
}

.btn:hover {
  border-color: #d5c6b5;
  background: #fff9f1;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fffaf2;
}

.btn.primary:hover {
  background: var(--brand-strong);
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.date-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-control input,
.input,
.select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
  outline: none;
}

.date-control input {
  width: 150px;
}

.input:focus,
.select:focus,
.date-control input:focus {
  border-color: #c28a56;
  box-shadow: 0 0 0 3px rgba(138, 63, 8, 0.12);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.card.pad {
  padding: 18px;
}

.metric {
  min-height: 110px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.section-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.menu-card {
  min-height: 150px;
}

.menu-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 16px;
}

.menu-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.menu-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffaf3;
  padding: 10px;
}

.menu-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #d8cbbb;
  border-radius: 8px;
  background: #fffaf4;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.initial {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  flex: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: #fff1f3;
  color: var(--danger);
  border: 1px solid #ffd4db;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.tag.neutral {
  background: #f3eee8;
  border-color: #e4d8cb;
  color: var(--muted);
}

.tag.ok {
  background: #eaf8f0;
  border-color: #c5ebd4;
  color: var(--ok);
}

.tag.warn {
  background: #fff4df;
  border-color: #f4d89e;
  color: var(--warning);
}

.preference-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preference-group {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  padding: 12px;
}

.preference-group legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.preference-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.check-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #e8d7c5;
  border-radius: 999px;
  background: #fff9f1;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #5f5147;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.check-option:hover {
  border-color: #cfa678;
  background: #fff4e7;
}

.check-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-option:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fffaf2;
  box-shadow: 0 8px 18px rgba(138, 63, 8, 0.14);
}

.tag-admin-card {
  min-height: 120px;
}

.tag-admin-item {
  gap: 6px;
  padding-right: 4px;
}

.tag-remove {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(222, 73, 89, 0.12);
  color: var(--danger);
  font-weight: 900;
  line-height: 1;
}

.customer-grid,
.dish-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dish-meta {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.dish-meta strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.recipe-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recipe-group {
  background: #fffaf4;
}

.recipe-options {
  display: grid;
  gap: 8px;
}

.recipe-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #ead9c8;
  border-radius: 8px;
  background: #fffdf9;
}

.recipe-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.recipe-check span {
  overflow-wrap: anywhere;
}

.recipe-qty {
  height: 32px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.customer-card {
  min-height: 190px;
}

.customer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.info-line {
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  min-height: 32px;
  border-radius: 7px;
  padding: 6px 11px;
  font-weight: 800;
  font-size: 13px;
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fffaf2;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}

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

.weekday {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.day-cell {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  text-align: left;
}

.day-cell.muted-day {
  opacity: 0.35;
}

.day-cell.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.day-number {
  font-weight: 800;
  margin-bottom: 7px;
}

.calendar-menu {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 4px;
  padding: 3px 5px;
  margin-top: 4px;
  background: #fff1d6;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.calendar-menu.dinner {
  background: #edf0ff;
  color: #4657b8;
}

.route-card {
  min-height: 250px;
}

.route-list {
  counter-reset: route;
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.route-person {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.route-person::before {
  counter-increment: route;
  content: counter(route) ".";
  color: var(--muted);
  font-weight: 800;
}

.route-print-stack {
  display: grid;
  gap: 18px;
}

.route-print-sheet {
  background: #fff;
  color: #16110e;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.route-print-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid #16110e;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.route-print-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.route-print-summary {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.route-print-summary strong {
  color: #16110e;
  font-size: 18px;
}

.route-print-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.route-print-meta span {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font-weight: 800;
  background: #fffaf2;
}

.route-print-sheet .table-wrap {
  margin-top: 12px;
}

.route-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.sign-line {
  display: block;
  min-width: 86px;
  height: 28px;
  border-bottom: 1px solid #777;
}

.route-print-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #999;
  font-weight: 800;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warning);
}

.status-danger {
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: start center;
  background: rgba(42, 18, 7, 0.45);
  z-index: 50;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(42, 18, 7, 0.28);
}

body:has(.modal-backdrop) {
  overflow: hidden;
}

.wide-modal {
  width: min(760px, 100%);
}

.modal-customer {
  width: min(900px, 100%);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 18px 22px;
  background: rgba(255, 253, 249, 0.96);
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 22px;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.customer-form {
  display: grid;
  gap: 14px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  padding: 14px;
}

.section-kicker {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.tall-select {
  min-height: 190px;
}

.print-sheet {
  background: #fff;
  color: #111;
  box-shadow: none;
}

.print-title {
  text-align: center;
  margin: 10px 0 24px;
}

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

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

  .customer-grid,
  .dish-grid,
  .grid.cols-3,
  .grid.cols-4,
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 20px 14px 36px;
  }

  .page-header {
    display: block;
  }

  .toolbar {
    margin-top: 14px;
  }

	  .grid.cols-2,
	  .menu-list,
	  .form-grid,
	  .preference-picker,
	  .recipe-picker,
	  .route-print-meta,
	  .route-print-footer {
	    grid-template-columns: 1fr;
	  }

  .form-grid .span-2 {
    grid-column: span 1;
  }

  .day-cell {
    min-height: 78px;
    padding: 6px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .no-print,
  .toolbar,
  .btn:not(.print-keep) {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .page {
    max-width: none;
  }

  .card {
    box-shadow: none;
    border-color: #bbb;
  }

  .route-print-stack {
    gap: 0;
  }

  .route-print-sheet {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    padding: 12mm;
  }

  .route-print-sheet:last-child {
    break-after: auto;
  }

  .route-print-meta span,
  .route-print-sheet th {
    background: #f3f3f3;
  }
}
