:root {
  --paper: #f3ecdf;
  --card: #fffaf3;
  --ink: #241c16;
  --muted: #5c5148;
  --line: #e4d5c3;
  --terra: #9a3e1c;
  --terra-soft: #f8e6db;
  --olive: #3e5c45;
  --olive-soft: #e6f0e6;
  --gold: #c9893a;
  --shadow: 0 16px 40px rgba(60, 36, 16, 0.08);
  --radius: 18px;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 0% -10%, #f8e6d4, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #e5efe6, transparent 50%),
    var(--paper);
}

button, input { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 3px;
}

#app { min-height: 100vh; }

.layout {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 28px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--olive);
}

.brand {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 520;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.brand span { display: block; color: var(--terra); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 500;
}

.nav a:hover { background: rgba(255, 250, 243, 0.7); }

.nav a[aria-current="page"] {
  background: var(--olive);
  color: #f7f3ea;
}

.data-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.data-tools.mobile { display: none; }

.data-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.week-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.kicker {
  margin: 0 0 4px;
  color: var(--olive);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 520;
  letter-spacing: -0.03em;
  margin: 0;
}

h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.05; }

h2 { font-size: 1.45rem; }

.lede {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 46rem;
  line-height: 1.45;
}

.week-nav { display: flex; gap: 8px; align-items: center; }

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

.total-card { padding: 22px 22px 18px; }

.total-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.total-value {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  font-weight: 640;
  letter-spacing: -0.04em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.total-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress {
  margin: 0;
  text-align: right;
  color: var(--olive);
  font-weight: 600;
}

.bar {
  display: flex;
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe4d4;
}

.bar-places { background: var(--olive); height: 100%; }
.bar-extras { background: var(--gold); height: 100%; }

.legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  margin-right: 6px;
}

.swatch.places { background: var(--olive); }
.swatch.extras { background: var(--gold); }

.banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--olive-soft);
  border: 1px solid #c9ddcb;
  border-radius: 14px;
}

.banner p { margin: 0; line-height: 1.45; }

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

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }

.main h2 { margin: 22px 0 10px; }

.btn, .btn-quiet, .btn-danger, .file-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--terra);
  color: #fffaf3;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--terra);
  border: 1px solid #efcfc2;
}

.btn:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.4; cursor: default; filter: none; }
.btn-quiet:hover, .btn-danger:hover, .file-btn.quiet:hover { background: rgba(255, 250, 243, 0.8); }

.file-btn.quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
}

.file-btn input { display: none; }

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }

.place-card, .extra-card, .history-card, .editor-card {
  padding: 14px 16px;
  display: grid;
  gap: 10px 16px;
  align-items: center;
}

.place-card {
  grid-template-columns: 1fr auto;
  border-left: 4px solid transparent;
}

.place-card.is-done {
  background: #f4faf4;
  border-left-color: var(--olive);
}

.place-card.needs-price { border-left-color: var(--gold); }

.checkline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  font-weight: 600;
  font-size: 1.05rem;
}

.place-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.place-title { overflow-wrap: anywhere; }

.checkline input, .extra-line input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--olive);
}

.tasks {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.92rem;
  line-height: 1.4;
}

.hint {
  margin: 0;
  color: var(--terra);
  font-size: 0.85rem;
  font-weight: 500;
}

.place-card:not(.needs-price) .hint { display: none; }

.money {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 8.5rem;
}

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

.money input {
  border: 0;
  width: 100%;
  min-width: 0;
  background: transparent;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.money input:focus { outline: none; }
.money input::placeholder, .text-input::placeholder, .task-input::placeholder { color: #b3a496; }

.extra-card {
  grid-template-columns: 1fr auto;
}

.extra-line {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.extra-line input[type="text"], .text-input, .task-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}

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

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

.chip {
  border: 1px dashed #d7b89a;
  background: var(--terra-soft);
  color: var(--terra);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 8px;
}

.editor-card { grid-template-columns: 1fr; align-items: stretch; }

.editor-top, .task-row {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 8px;
  align-items: center;
}

.task-row { grid-template-columns: 1fr auto; }

.editor-tools { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.summary-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
}

.history-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  grid-template-columns: 1fr auto;
  color: inherit;
}

.history-card strong { font-variant-numeric: tabular-nums; font-size: 1.15rem; }

.history-card p { margin: 4px 0 0; color: var(--muted); }

.empty {
  padding: 22px;
  color: var(--muted);
  line-height: 1.45;
}

.archived {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f7f1e8;
  border: 1px dashed var(--line);
}

.archived h3 { margin: 0 0 8px; font-size: 0.95rem; }

.archived-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 18px 16px 40px; }
  .sidebar, .main, .nav { min-width: 0; max-width: 100%; }
  .sidebar { position: static; }
  .brand { font-size: 2rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .sidebar .data-tools { display: none; }
  .data-tools.mobile { display: flex; }
  .week-head, .section-head, .banner { flex-direction: column; align-items: stretch; }
  .place-card, .extra-card { grid-template-columns: 1fr; }
  .money { justify-self: start; }
  .extra-actions { justify-content: flex-start; }
  .add-form, .editor-top { grid-template-columns: 1fr; }
  .progress { text-align: left; }
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card { width: min(460px, 100%); padding: 28px 24px; }

.login-card h1 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 520;
  letter-spacing: -0.03em;
}

.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.login-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }

.login-hint, .whoami, .role-label { margin: 8px 0 0; color: var(--muted); line-height: 1.4; }

.whoami { font-weight: 600; color: var(--ink); }

.form-error {
  margin: 12px 0 0;
  color: var(--terra);
  font-weight: 600;
}

.assignment { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-left: 4px solid transparent; }

.assignment h3 { margin: 0; font-size: 1.08rem; }

.assignment-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }

.assignment.is-approved { background: #f4faf4; border-left-color: var(--olive); }
.assignment.is-rejected { background: #fdf6f3; border-left-color: var(--terra); }
.assignment.is-skipped { border-left-color: var(--line); }
.assignment.is-pending { border-left-color: var(--gold); }

.days { display: flex; flex-direction: column; gap: 12px; }

.day {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 243, 0.72);
}

.day.is-today { outline: 2px solid var(--olive); }

.day summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 14px 16px;
  font-weight: 600;
}

.day summary::-webkit-details-marker { display: none; }

.day-count { color: var(--muted); font-weight: 500; font-size: 0.92rem; }

.day-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }

.day-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.place-day { display: flex; flex-direction: column; gap: 8px; }

.place-day h3 {
  margin: 6px 2px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 520;
}

.place-day h3 span { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; }

.optional-tag { color: var(--olive); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.price-tag { font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  margin: 0;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

.badge-ok { background: var(--olive-soft); color: var(--olive); }
.badge-no { background: var(--terra-soft); color: var(--terra); }
.badge-wait { background: #f6ecd4; color: #8a5a12; }

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

.choice.is-on.done { background: var(--olive); color: #f7f3ea; border-color: transparent; }
.choice.is-on.no { background: var(--terra); color: #fffaf3; border-color: transparent; }

.account-card { padding: 16px; }

@media (max-width: 640px) {
  .assignment-top { flex-direction: column; }
}

@media print {
  body { background: white; }
  .sidebar, .no-print, .banner { display: none !important; }
  .layout { display: block; width: auto; }
  .card { box-shadow: none; }
}
