:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --panel: #ffffff;
  --ink: #1f2528;
  --muted: #647176;
  --line: #d8dfdc;
  --field: #f8faf9;
  --row: #f8faf9;
  --soft: #eef5f2;
  --accent: #1f6f68;
  --accent-strong: #15534e;
  --ok: #23634c;
  --ok-bg: #f0faf5;
  --warn: #9b4f16;
  --warn-bg: #fff8ed;
  --bad: #a03333;
  --bad-bg: #fff6f5;
  --shadow: 0 18px 45px rgba(31, 37, 40, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 52px) 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

h2 {
  font-size: 24px;
}

p {
  text-wrap: pretty;
}

.status-chip {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.status-chip.ready {
  color: var(--accent-strong);
  border-color: rgba(31, 111, 104, 0.35);
}

.status-chip.error {
  color: var(--bad);
  border-color: rgba(160, 51, 51, 0.35);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 42px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #e9efec;
  border-radius: 8px;
  overflow: hidden;
}

.step {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  transition-property: background-color, box-shadow, color, transform;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.step:last-child {
  border-right: 0;
}

.step span {
  display: inline-grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(31, 37, 40, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.step strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.1;
}

.step small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.step.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.step.is-active span {
  background: var(--accent);
  color: white;
}

.panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.panel.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
}

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

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

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 9px 11px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 111, 104, 0.65);
  outline: 3px solid rgba(31, 111, 104, 0.14);
}

input[type="number"],
input[inputmode="decimal"],
.amount,
.total-box strong {
  font-variant-numeric: tabular-nums;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
  transition-property: background-color, border-color, box-shadow, color, transform;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

button:not(:disabled):hover {
  box-shadow: 0 6px 18px rgba(31, 37, 40, 0.08);
}

button:not(:disabled):active {
  transform: scale(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible {
  outline: 3px solid rgba(31, 111, 104, 0.2);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

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

.action-buttons {
  display: flex;
  gap: 10px;
}

.table-stack {
  display: grid;
  gap: 10px;
}

.row-grid {
  display: grid;
  grid-template-columns: 140px minmax(150px, 1fr) minmax(150px, 1fr) 120px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--row);
}

.day-row {
  grid-template-columns: 110px minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) 110px 120px;
}

.row-title {
  display: grid;
  gap: 3px;
}

.row-title strong {
  font-size: 14px;
}

.row-title span,
.row-grid > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.meal-row {
  grid-template-columns: 140px repeat(3, minmax(180px, 1fr));
}

.meal-cell {
  display: grid;
  gap: 9px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.meal-toggle,
.compact-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.meal-toggle span,
.compact-check span {
  font-size: 13px;
  color: var(--ink);
}

.own-amount {
  color: var(--muted);
  font-size: 12px;
}

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

.receipt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.details-grid {
  margin: 14px 0;
}

.receipt-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.receipt-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.receipt-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.receipt-item strong {
  display: block;
}

.receipt-item span {
  color: var(--muted);
  font-size: 13px;
}

.receipt-item em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.calculation {
  display: grid;
  gap: 12px;
}

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

.total-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--row);
}

.total-box.emphasis {
  border-color: rgba(31, 111, 104, 0.35);
  background: var(--soft);
}

.total-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.total-box strong {
  font-size: 22px;
}

.issues {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.issues.compact {
  margin-top: 12px;
}

.issue,
.warning,
.success {
  border: 1px solid rgba(160, 51, 51, 0.28);
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.warning {
  border-color: rgba(155, 79, 22, 0.28);
  color: var(--warn);
  background: var(--warn-bg);
}

.success {
  border-color: rgba(35, 99, 76, 0.28);
  color: var(--ok);
  background: var(--ok-bg);
}

.empty-state {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: var(--panel);
}

.empty-state strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-state span {
  font-size: 13px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin: 0;
  color: var(--ink);
}

.panel > .check-row {
  margin-bottom: 18px;
}

@media (max-width: 820px) {
  .app-header,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

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

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

  .step:nth-child(2n) {
    border-right: 0;
  }

  .grid.two,
  .grid.three,
  .row-grid,
  .meal-row,
  .totals {
    grid-template-columns: 1fr;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .receipt-item {
    grid-template-columns: 1fr;
  }

  .receipt-item-actions {
    justify-content: stretch;
  }

  .receipt-item-actions button {
    flex: 1;
  }
}
