/* ==========================================================================
   LazyLean — the kitchen ledger
   Warm paper, espresso ink, paprika accent. Fraunces for the voice,
   Instrument Sans for the prose, Spline Sans Mono for the receipts.
   ========================================================================== */

:root {
  --paper: #f6f1e7;
  --paper-bright: #fffdf6;
  --paper-deep: #ece3d0;
  --ink: #2b2117;
  --ink-soft: #756753;
  --line: #d8cbb2;
  --line-soft: #e5dcc8;
  --paprika: #c44a26;
  --paprika-deep: #99311a;
  --olive: #66793a;
  --butter: #b07d18;
  --shadow: 0 1px 2px rgba(63, 46, 24, .06), 0 6px 18px -8px rgba(63, 46, 24, .18);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  font-optical-sizing: auto;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0 0.24 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--paprika); color: var(--paper-bright); }

:focus-visible { outline: 2px solid var(--paprika); outline-offset: 2px; border-radius: 4px; }

.shell { width: 100%; max-width: 780px; margin-inline: auto; padding-inline: 22px; }

main.shell { flex: 1; padding-bottom: 72px; }

a { color: inherit; }

.muted { color: var(--ink-soft); font-weight: 400; }

/* --------------------------------------------------------------------------
   Header & nav
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--paper-bright);
  padding: 18px 0 14px;
  margin-bottom: clamp(20px, 4vw, 40px);
}

.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { text-decoration: none; display: flex; align-items: baseline; gap: 12px; }

.brand-mark {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.brand-mark em { font-style: italic; color: var(--paprika); }

.brand-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-soft);
}

.site-nav { display: flex; gap: 22px; }

.site-nav a {
  font-family: var(--mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color .15s ease;
}

.site-nav a:hover { color: var(--ink); }

.site-nav a.is-active { color: var(--ink); border-bottom-color: var(--paprika); }

/* --------------------------------------------------------------------------
   Day pager
   -------------------------------------------------------------------------- */

.day-pager {
  display: grid;
  /* minmax(0, …) lets the link cells shrink below their nowrap content so
     narrow phones truncate labels instead of overflowing the page. */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 8px 2px;
  margin-bottom: 24px;
}

.pager-prev { display: flex; justify-content: flex-start; min-width: 0; }
.pager-next { display: flex; justify-content: flex-end; align-items: center; min-width: 0; }

.pager-link {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pager-link:hover { color: var(--paprika); }
.pager-glyph { color: var(--paprika); }

.pager-stamp {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--ink);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Type & section furniture
   -------------------------------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.eyebrow a { text-decoration: none; }
.eyebrow a:hover { color: var(--paprika); }

.capture-title, .page-title {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(34px, 6.5vw, 54px);
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 0 0 18px;
}

.capture-title em, .page-title em { font-style: italic; color: var(--paprika); }

.page-sub { color: var(--ink-soft); margin: -8px 0 26px; max-width: 52ch; }

.ledger-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 38px 0 14px;
}

.ledger-head h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 540;
  font-size: 21px;
  margin: 0;
  white-space: nowrap;
}

.ledger-head .rule { flex: 1; border-bottom: 1px dashed var(--line); transform: translateY(-4px); }

.chart-key { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }

.empty-state {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink-soft);
  text-align: center;
  padding: 34px 10px;
}

.empty-state::after { content: " ❧"; color: var(--paprika); }

/* --------------------------------------------------------------------------
   Capture form
   -------------------------------------------------------------------------- */

.capture-box {
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.capture-box:focus-within {
  border-color: var(--paprika);
  box-shadow: 0 0 0 3px rgba(196, 74, 38, .14), var(--shadow);
}

.capture-box textarea {
  display: block;
  width: 100%;
  border: 0;
  padding: 4px 2px 10px;
  background: transparent;
  resize: none;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
}

.capture-box textarea::placeholder { color: #a89a83; font-style: italic; }

.capture-box textarea:focus { outline: none; }

.capture-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--line-soft);
  padding-top: 10px;
}

.photo-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  border: 1.5px dashed var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.photo-button:hover { color: var(--paprika); border-color: var(--paprika); background: rgba(196, 74, 38, .05); }

.photo-button input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

.when-field {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 6px 6px;
}

.when-field:hover, .when-field:focus { border-color: var(--line); background: var(--paper-bright); }

.log-button {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--paper-bright);
  background: var(--paprika);
  border: 0;
  border-radius: 999px;
  padding: 11px 26px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--paprika-deep);
  transition: background .15s ease, transform .08s ease, box-shadow .08s ease;
}

.log-button:hover { background: #b13e1e; }

.log-button:active { transform: translateY(2px); box-shadow: 0 0 0 var(--paprika-deep); }

.capture-photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
  padding: 7px 9px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.capture-photo-preview img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.photo-name {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-clear {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 8px;
}

.photo-clear:hover { color: var(--paprika); }

.form-error {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--paprika-deep);
  background: rgba(196, 74, 38, .07);
  border: 1px solid rgba(196, 74, 38, .25);
  border-radius: 8px;
  padding: 8px 12px;
}

.setup-note {
  font-size: 13.5px;
  color: var(--ink-soft);
  background: rgba(176, 125, 24, .08);
  border: 1px dashed rgba(176, 125, 24, .45);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 14px;
}

.setup-note code { font-family: var(--mono); font-size: 12px; color: var(--butter); }

/* --------------------------------------------------------------------------
   Day summary
   -------------------------------------------------------------------------- */

.day-summary {
  margin-top: clamp(22px, 4vw, 34px);
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px clamp(20px, 5vw, 52px);
  align-items: end;
  margin-bottom: 14px;
}

.sum-cell { display: flex; flex-direction: column; }

.sum-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(30px, 5.5vw, 40px);
  line-height: 1.05;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.sum-remaining .sum-num { color: var(--olive); }

.is-over .sum-remaining .sum-num { color: var(--paprika-deep); }

.sum-label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ink-soft);
  margin-top: 4px;
}

.sum-macros { justify-self: end; text-align: right; gap: 2px; }

.macro-line { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }

.macro-line strong { color: var(--ink); font-weight: 600; }

.meter {
  height: 10px;
  border-radius: 999px;
  background: #e0d4bd;
  box-shadow: inset 0 1px 2px rgba(63, 46, 24, .18);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d97a3c, var(--paprika));
  transition: width .7s cubic-bezier(.22, .8, .36, 1);
  min-width: 0;
}

.is-over .meter-fill { background: linear-gradient(90deg, var(--paprika), var(--paprika-deep)); }

.meter-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.meter-goal { letter-spacing: .08em; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   Meal cards
   -------------------------------------------------------------------------- */

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

.meal-card {
  display: flex;
  gap: 14px;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 15px;
  box-shadow: 0 1px 2px rgba(63, 46, 24, .05);
  transition: transform .15s ease, box-shadow .15s ease;
  animation: card-in .45s cubic-bezier(.22, .8, .36, 1) both;
}

.meal-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.meal--pending { border-style: dashed; background: linear-gradient(180deg, var(--paper-bright), #fbf6ea); }

.meal--failed { border-color: rgba(196, 74, 38, .4); }

.meal-photo { flex: 0 0 auto; }

.meal-photo img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 9px;
  border: 2px solid var(--paper-bright);
  outline: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(63, 46, 24, .18);
  transform: rotate(-1.2deg);
}

.meal-glyph {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 9px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 22px;
}

.meal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.meal-head { display: flex; align-items: baseline; gap: 12px; }

.meal-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18.5px;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.meal-time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.meal-desc { margin: 0; font-style: italic; color: var(--ink-soft); font-size: 14.5px; }

.meal-numbers { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.kcal { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }

.kcal strong { font-size: 19px; font-weight: 700; }

.macro-chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2.5px 9px;
  white-space: nowrap;
}

.conf-stamp {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1.2px solid currentColor;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.conf--high { color: var(--olive); }
.conf--medium { color: var(--butter); }
.conf--low { color: var(--paprika); }
.conf--manual { color: var(--ink-soft); border-style: dashed; transform: none; }

.estimating {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.estimating-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paprika);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(.7); opacity: .5; }
  50% { transform: scale(1); opacity: 1; }
}

.ellipsis::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.meal-detail summary {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  width: fit-content;
}

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

.meal-detail summary::before { content: "▸ "; color: var(--paprika); }

.meal-detail[open] summary::before { content: "▾ "; }

.meal-detail summary:hover { color: var(--ink); }

.item-list { list-style: none; margin: 8px 0 0; padding: 0; max-width: 460px; }

.item-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  font-size: 13.5px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line-soft);
}

.item-name { min-width: 0; }

.item-kcal { font-family: var(--mono); font-size: 12px; white-space: nowrap; }

.meal-notes {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 8px 0 0;
  max-width: 56ch;
}

.meal-notes::before { content: "※ "; color: var(--paprika); font-style: normal; }

.meal-error { margin: 0; font-size: 14px; color: var(--paprika-deep); }

.meal-failed-actions { display: flex; align-items: center; gap: 14px; }

.mini-button {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--paper-bright);
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.mini-button:hover { background: var(--paprika); }

.mini-link { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }

.mini-link:hover { color: var(--paprika); }

.meal-actions {
  display: flex;
  gap: 14px;
  margin-top: 2px;
  opacity: .5;
  transition: opacity .15s ease;
}

.meal-card:hover .meal-actions, .meal-card:focus-within .meal-actions { opacity: 1; }

.inline-form { display: inline; }

.card-action {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.card-action:hover { color: var(--ink); }

.card-action.danger:hover { color: var(--paprika-deep); }

/* --------------------------------------------------------------------------
   History
   -------------------------------------------------------------------------- */

.stat-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper-bright);
}

.board-cell {
  padding: 18px 18px 14px;
  border-right: 1px dashed var(--line-soft);
  border-bottom: 1px dashed var(--line-soft);
  display: flex;
  flex-direction: column;
}

.board-cell:nth-child(3n) { border-right: 0; }
.board-cell:nth-child(n+4) { border-bottom: 0; }

.board-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(24px, 4.5vw, 32px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.board-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-top: 4px;
}

.chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 220px;
  padding: 12px 4px 0;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 4px;
  border-bottom: 2px solid var(--ink);
}

.goal-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--goal-pos, 60%);
  border-top: 2px dashed rgba(196, 74, 38, .55);
  pointer-events: none;
}

.goal-line::after {
  content: "goal";
  position: absolute;
  right: 8px;
  top: -18px;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--paprika);
}

.bar-slot {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-decoration: none;
  border-radius: 4px 4px 0 0;
}

.bar-slot:hover { background: rgba(196, 74, 38, .06); }

.bar {
  display: block;
  width: 100%;
  max-width: 22px;
  border-radius: 3px 3px 0 0;
  background: #4a3b29;
  transform-origin: bottom;
  animation: grow .6s cubic-bezier(.22, .8, .36, 1) both;
}

.bar-slot:hover .bar { background: var(--paprika); }

.bar-slot.is-over .bar { background: var(--paprika-deep); }

.bar-slot.is-today .bar { background: var(--paprika); }

.bar-slot.is-zero .bar { background: var(--line); }

@keyframes grow { from { transform: scaleY(0); } }

.chart-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 7px;
}

.journal-list { list-style: none; margin: 0; padding: 0; }

.journal-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 8px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14.5px;
}

.journal-row:hover { background: var(--paper-bright); }

.journal-date { font-family: var(--mono); font-size: 12.5px; min-width: 96px; }

.journal-dots { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); }

.journal-kcal { font-family: var(--mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.journal-delta { font-family: var(--mono); font-size: 11.5px; min-width: 52px; text-align: right; }

.journal-delta.is-over { color: var(--paprika-deep); }

.journal-delta.is-under { color: var(--olive); }

/* --------------------------------------------------------------------------
   Edit & settings forms
   -------------------------------------------------------------------------- */

.edit-form { max-width: 560px; }

.edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
}

.edit-form input[type="text"],
.edit-form input[type="email"],
.edit-form input[type="password"],
.edit-form input[type="number"],
.edit-form input[type="datetime-local"],
.edit-form textarea {
  font-family: var(--sans);
  /* ≥16px keeps iOS Safari from zooming the page when a field gets focus */
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  width: 100%;
}

.edit-form input:focus, .edit-form textarea:focus {
  outline: none;
  border-color: var(--paprika);
  box-shadow: 0 0 0 3px rgba(196, 74, 38, .13);
}

.field-group { margin-bottom: 16px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.numbers-row { grid-template-columns: repeat(4, 1fr); }

.edit-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

.edit-photo img { border-radius: 9px; border: 1px solid var(--line); }

.photo-button.standalone { margin-bottom: 16px; width: fit-content; }

.edit-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }

.ghost-button {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all .15s ease;
}

.ghost-button:hover { background: var(--ink); color: var(--paper-bright); }

.estimator-status, .account-status {
  margin-top: 44px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
  max-width: 560px;
}

.estimator-status h2, .account-status h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  font-weight: 540;
  margin: 0 0 6px;
}

.estimator-status p, .account-status p { margin: 0; font-size: 14px; color: var(--ink-soft); }

.signout-form { margin-top: 14px; }

/* Sign-in: the edit-form look, held to a reading-width column */
.signin-form { max-width: 420px; }

.estimator-status code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-deep);
  border-radius: 5px;
  padding: 1.5px 6px;
  white-space: nowrap;
}

.estimator-status.is-on h2::after { content: " ●"; color: var(--olive); font-size: 13px; }

.estimator-status.is-off h2::after { content: " ○"; color: var(--paprika); font-size: 13px; }

/* --------------------------------------------------------------------------
   Flashes & footer
   -------------------------------------------------------------------------- */

.flashes {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 460px);
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-left: 4px solid var(--paprika);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
  padding: 11px 16px;
  animation: flash-in .35s cubic-bezier(.22, .8, .36, 1) both,
             flash-out .5s ease 4.2s both;
}

.flash--alert { border-left-color: var(--paprika-deep); color: var(--paprika-deep); }

.flash a { color: var(--paprika); }

@keyframes flash-in { from { opacity: 0; transform: translateY(-12px); } }

@keyframes flash-out { to { opacity: 0; transform: translateY(-8px); visibility: hidden; } }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 26px;
  margin-top: 30px;
}

.site-footer p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Repeat — carbon-copy past mode
   -------------------------------------------------------------------------- */

/* The past is a carbon copy: warm paper goes cool archival blue-grey, ink
   cools with it, paprika deliberately unchanged. Everything styled via
   var(--*) follows on its own; the paper grain multiplies fine over grey. */
.theme-carbon {
  --paper: #e6ebee;
  --paper-bright: #f6f9fb;
  --paper-deep: #d8e0e6;
  --ink: #22303a;
  --ink-soft: #607482;
  --line: #b6c4cd;
  --line-soft: #cbd6dd;
  --paprika: #c44a26;
  --paprika-deep: #99311a;
  --shadow: 0 1px 2px rgba(30, 48, 58, .08), 0 6px 18px -8px rgba(30, 48, 58, .22);
}

/* the world-shift reads as one move — Turbo runs the flip inside a view
   transition (days views carry <meta name="view-transition">); a body
   transition can't do this, since Turbo replaces the body on navigation */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* ↻ Repeat / ↩ Back to now — a .photo-button worn by a link */
.flip-button { background: none; min-height: 44px; text-decoration: none; }

.flip-glyph { font-size: 15px; line-height: 1; }

/* past-mode capture box: the hint line stands in for the textarea */
.capture-hint {
  margin: 0;
  padding: 4px 2px 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ink-soft);
}

.recents { margin-top: 18px; }

/* the whole card is the tap target — the footer button stretches over it */
.repeat-card { position: relative; cursor: pointer; }

.repeat-card:hover, .repeat-card:focus-within { border-color: var(--paprika); }

.repeat-card .card-action { color: var(--paprika); }

.repeat-card .repeat-action::after { content: ""; position: absolute; inset: 0; }

/* --------------------------------------------------------------------------
   Reveal choreography
   -------------------------------------------------------------------------- */

.reveal { animation: rise .55s cubic-bezier(.22, .8, .36, 1) both; }

.reveal-1 { animation-delay: .07s; }
.reveal-2 { animation-delay: .14s; }
.reveal-3 { animation-delay: .21s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

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

  /* the universal rule can't reach the view-transition pseudo tree */
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .brand-tag { display: none; }

  .header-inner { align-items: center; }

  .site-nav { gap: 16px; }

  .day-pager { padding: 7px 0; }

  .pager-link { font-size: 11px; letter-spacing: .06em; }

  .pager-stamp { font-size: 10.5px; }

  .summary-grid { grid-template-columns: 1fr 1fr; }

  .sum-macros {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
    flex-direction: row;
    display: flex;
    gap: 14px;
  }

  .capture-row { gap: 8px; }

  .when-field { font-size: 11.5px; padding: 6px 2px; }

  .log-button { width: 100%; margin-left: 0; order: 10; }

  .stat-board { grid-template-columns: 1fr 1fr; }

  .board-cell:nth-child(3n) { border-right: 1px dashed var(--line-soft); }
  .board-cell:nth-child(2n) { border-right: 0; }
  .board-cell:nth-child(n+4) { border-bottom: 1px dashed var(--line-soft); }
  .board-cell:nth-child(n+5) { border-bottom: 0; }

  .chart { gap: 2px; height: 170px; }

  /* Paired fields stack; the four macro numbers stay two-up. */
  .field-row { grid-template-columns: 1fr; }

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

  .journal-date { min-width: 78px; }

  .meal-photo img, .meal-glyph { width: 58px; height: 58px; }
}

/* --------------------------------------------------------------------------
   Touch devices — no hover to reveal, no focus zoom
   -------------------------------------------------------------------------- */

@media (hover: none) {
  .meal-actions { opacity: 1; }

  .card-action { padding: 5px 0; }

  /* ≥16px keeps iOS Safari from zooming the page when the picker opens */
  .when-field { font-size: 16px; }
}
