@font-face {
  font-family: "Nunito";
  src: local("Nunito");
}

:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --line: #EDE3D6;
  --line-control: #E3D7C8;
  --ink: #3B3445;
  --dim: #6F667A;
  --dim-on-tint: #5B5266;
  --cta: #FFB199;
  --tint-sky: #DCEBFA;
  --tint-sky-row: #EAF3FC;
  --tint-butter: #FFF0C4;
  --tint-peach: #FFE1D6;
  --tint-mint: #D9F0E3;
  --tint-lavender: #E9E1F8;
  --tint-sand: #F3EADC;
  --selected-bg: #CFE5F8;
  --selected-border: #7FB4E4;
  --chart-line: #3F7CB5;
  --chart-threshold: #E58F73;
  --chart-threshold-label: #A8523A;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 96px;
  position: relative;
}

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input { font-family: inherit; }

.eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
}

.page-title { font-size: 32px; font-weight: 900; }
.sheet-title { font-size: 28px; font-weight: 900; }
.big-number { font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.card-value { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.body-text { font-size: 16px; }
.secondary-text { font-size: 14px; font-weight: 600; color: var(--dim); }
.tabular { font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
.card.featured { border-radius: 24px; }
.card.tint-sky { background: var(--tint-sky); border-color: transparent; }
.card.tint-butter { background: var(--tint-butter); border-color: transparent; }
.card.tint-peach { background: var(--tint-peach); border-color: transparent; }
.card.tint-mint { background: var(--tint-mint); border-color: transparent; }
.card.tint-lavender { background: var(--tint-lavender); border-color: transparent; }
.card.tint-sand { background: var(--tint-sand); border-color: transparent; }

.btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 56px;
  background: var(--cta); color: var(--ink);
  border-radius: 999px; font-weight: 800; font-size: 16px;
}
.btn-primary:disabled { opacity: 0.5; }

.btn-secondary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 56px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-control);
  border-radius: 999px; font-weight: 800; font-size: 16px;
}

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 20px;
  border: 1px solid var(--line-control); border-radius: 999px;
  font-weight: 700; font-size: 15px; background: var(--surface);
}
.pill.small { height: 40px; padding: 0 14px; font-size: 14px; }
.pill.selected { background: var(--selected-bg); border-color: var(--selected-border); border-width: 2px; }
.pill[aria-pressed="true"] { background: var(--selected-bg); border-color: var(--selected-border); border-width: 2px; }

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

.stepper {
  display: flex; align-items: center; justify-content: center; gap: 24px;
}
.stepper button {
  width: 48px; height: 48px; border-radius: 999px;
  border: 1px solid var(--line-control); background: var(--surface);
  font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.stepper .value { min-width: 140px; text-align: center; }

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

.input-row { display: flex; flex-direction: column; gap: 6px; }
.input-row label { font-size: 14px; font-weight: 700; color: var(--dim); }
.input-row input, .input-row textarea {
  height: 48px; border-radius: 12px; border: 1px solid var(--line-control);
  padding: 0 14px; font-size: 16px; color: var(--ink); background: var(--surface);
}
.input-row textarea { height: auto; padding: 12px 14px; min-height: 80px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  height: 80px; background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--dim);
}
.tabbar button .tab-icon {
  width: 40px; height: 28px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}
.tabbar button .tab-icon svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--ink); }
.tabbar button.active .tab-icon { background: var(--tint-sky); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 24px 0;
}

.header-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 12px 0 16px;
  border: 1px solid var(--line-control); border-radius: 999px;
  font-weight: 700; font-size: 14px; background: var(--surface);
}
.header-pill svg { width: 16px; height: 16px; }

.screen-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 24px 0;
}

.screen { padding: 0 24px; display: none; flex-direction: column; gap: 24px; }
.screen.active { display: flex; }

.timeline { display: flex; flex-direction: column; }
.timeline-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.timeline-row:last-child { border-bottom: none; }
.timeline-time { font-size: 13px; color: var(--dim); font-weight: 700; white-space: nowrap; width: 40px; flex-shrink: 0; }
.timeline-dot {
  width: 36px; height: 36px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.timeline-dot svg { width: 18px; height: 18px; }
.timeline-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timeline-title { font-weight: 800; font-size: 15px; }
.timeline-sub { font-size: 13px; color: var(--dim); }
.timeline-who { font-size: 13px; color: var(--dim); font-weight: 700; white-space: nowrap; }
.timeline-row-simple { cursor: pointer; }
.timeline-row-simple .timeline-who { margin-left: auto; }
.timeline-row-simple .timeline-time { font-weight: 800; color: var(--ink); }

.totals-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.totals-grid .total-item { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; min-width: 0; }
.totals-grid .card-value { white-space: nowrap; }

.empty-state { padding: 32px 0; text-align: center; color: var(--dim); font-size: 15px; }

.sheet-overlay {
  position: fixed; inset: 0; background: rgba(59, 52, 69, 0.3);
  display: none; align-items: flex-end; justify-content: center; z-index: 100;
}
.sheet-overlay.open { display: flex; }
.sheet {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 24px; display: flex; flex-direction: column; gap: 20px;
}
.sheet-header { display: flex; align-items: center; justify-content: space-between; }
.sheet-close {
  width: 36px; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-control);
}
.sheet-footer-total { font-size: 14px; color: var(--dim); text-align: center; }

.btn-primary svg, .btn-secondary svg { width: 18px; height: 18px; margin-right: 8px; }
.stepper button svg { width: 20px; height: 20px; }

.elapsed-row { display: flex; align-items: baseline; gap: 8px; }

.log-sections { display: flex; flex-direction: column; gap: 8px; }
.log-section { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.log-section.active { border-color: var(--selected-border); }
.log-section-header {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; font-weight: 700; font-size: 15px; text-align: left;
}
.log-section.active .log-section-header { background: var(--tint-sky-row); }
.log-section-icon { display: flex; color: var(--dim); }
.log-section-icon svg { width: 20px; height: 20px; }
.log-section-label { flex: 1; }
.log-section-check { display: flex; color: var(--chart-line); }
.log-section-check svg { width: 18px; height: 18px; }
.log-section-fields { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.log-section-fields:empty { padding: 0; }

.week-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.week-table th, .week-table td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.week-table th { font-weight: 800; color: var(--dim); font-size: 12px; text-transform: uppercase; }
.week-table tr.today { background: var(--tint-sky-row); }

@media print {
  .tabbar, .no-print { display: none !important; }
  .screen { display: flex !important; padding: 0; }
  body { background: #fff; }
}
