/* =============================================================================
 * FitCoach 61 — stylesheet
 *
 * Direction: "index cards on a stone bench." The page ground is DARKER than the
 * cards, inverting the usual app convention — content sits on top of the
 * surface rather than being cut into it.
 *
 * Two-axis colour system carries the whole brief: EMBER for the fat-loss axis,
 * VERDIGRIS for the muscle-building axis. Every number in the app is coded to
 * one of the two, because the entire programme is those two opposing goals
 * running at once.
 *
 * Type is set in Avenir Next Condensed, which ships on every iPhone — chosen
 * over a web font because this app must work with no network at all. Numerals
 * are deliberately large: they are read at arm's length, mid-set.
 * ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  --stone:      #E4E1D9;
  --stone-deep: #D6D2C8;
  --card:       #FBFAF7;
  --card-sunk:  #F1EEE7;
  --ink:        #1B2027;
  --ink-soft:   #454E59;
  --steel:      #6E7681;
  --rule:       #CFCAC0;
  --rule-soft:  #E2DED5;

  --ember:      #B23A0E;
  --ember-soft: #F3E2D9;
  --verdigris:  #0E6E63;
  --verd-soft:  #DCEBE8;
  --brass:      #8A6A1F;
  --brass-soft: #F0E7D0;
  --alert:      #9B1C1C;

  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 1px 2px rgba(27,32,39,.07), 0 4px 14px rgba(27,32,39,.06);
  --shadow-lift:0 2px 6px rgba(27,32,39,.10), 0 12px 32px rgba(27,32,39,.10);

  --display: 'Avenir Next Condensed', 'Avenir Next', 'Segoe UI Semibold', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --body:    'Iowan Old Style', Charter, 'Palatino Linotype', Palatino, Georgia, serif;
  --ui:      'Avenir Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:    ui-monospace, 'SF Mono', Menlo, 'Cascadia Mono', Consolas, monospace;

  --tab-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone:      #14181C;
    --stone-deep: #0E1114;
    --card:       #1F252C;
    --card-sunk:  #191F25;
    --ink:        #ECE8E0;
    --ink-soft:   #C3BDB2;
    --steel:      #8B939D;
    --rule:       #333C46;
    --rule-soft:  #262E36;

    --ember:      #E4762F;
    --ember-soft: #35251C;
    --verdigris:  #46AE9D;
    --verd-soft:  #16302D;
    --brass:      #C6A252;
    --brass-soft: #2E2718;
    --alert:      #E06666;

    --shadow:     0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    --shadow-lift:0 2px 6px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.4);
  }
}

:root[data-theme="dark"] {
  --stone:      #14181C;
  --stone-deep: #0E1114;
  --card:       #1F252C;
  --card-sunk:  #191F25;
  --ink:        #ECE8E0;
  --ink-soft:   #C3BDB2;
  --steel:      #8B939D;
  --rule:       #333C46;
  --rule-soft:  #262E36;
  --ember:      #E4762F;
  --ember-soft: #35251C;
  --verdigris:  #46AE9D;
  --verd-soft:  #16302D;
  --brass:      #C6A252;
  --brass-soft: #2E2718;
  --alert:      #E06666;
  --shadow:     0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --shadow-lift:0 2px 6px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.4);
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: .01em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a { color: var(--verdigris); }

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

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

/* --- App shell ----------------------------------------------------------- */
#app { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--stone) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule-soft);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: baseline; gap: 10px;
}
.topbar h1 {
  font-size: 1.45rem; line-height: 1.1;
  text-transform: uppercase; letter-spacing: .06em;
}
.topbar .sub {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--steel); margin-left: auto;
  text-align: right; white-space: nowrap;
}
.topbar .iconbtn {
  background: none; border: 0; padding: 4px 6px; margin: -4px -6px -4px 4px;
  font-size: 1.25rem; color: var(--ink-soft); line-height: 1;
}

main {
  padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 780px; margin: 0 auto;
}

/* --- Tab bar ------------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  appearance: none; background: none; border: 0;
  padding: 8px 2px 9px; min-height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--steel);
  font-family: var(--display); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .08em;
  border-top: 2.5px solid transparent; margin-top: -1px;
  transition: color .15s ease;
}
.tabbar button .glyph { font-size: 1.2rem; line-height: 1; }
.tabbar button[aria-selected="true"] { color: var(--ink); border-top-color: var(--ember); }
.tabbar button:active { background: var(--card-sunk); }

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h2 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .13em;
  color: var(--steel); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .tail { margin-left: auto; font-family: var(--mono); letter-spacing: .06em; font-size: .72rem; }
.card h3 { font-size: 1.05rem; margin-bottom: 6px; }

.eyebrow {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--steel);
}

.prose { font-family: var(--body); font-size: 1rem; line-height: 1.55; color: var(--ink-soft); }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }

/* --- Signature: the block grid ------------------------------------------ */
/* 16 programme weeks x 7 days. Ember tick = calorie target met.
   Verdigris tick = training completed. Both = a full day. */
.blockwrap { display: flex; gap: 6px; align-items: stretch; }
.blockdays {
  display: grid; grid-template-rows: repeat(7, 1fr); gap: 2px;
  font-family: var(--mono); font-size: .56rem; color: var(--steel);
  width: 9px; text-align: center;
}
.blockdays span { display: grid; place-items: center; line-height: 1; }
.blockgrid {
  flex: 1; display: grid; grid-template-columns: repeat(16, 1fr);
  grid-auto-rows: 1fr; gap: 2px;
}
.blockgrid .cell {
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: var(--card-sunk);
  border: 1px solid var(--rule-soft);
  position: relative;
  overflow: hidden;
}
.blockgrid .cell.future { background: transparent; border-style: dotted; opacity: .6; }
/* Days that fall in the calendar week but outside the 16-week block. */
.blockgrid .cell.outside { background: transparent; border-color: transparent; }
.blockgrid .cell.today {
  border-color: var(--ink); border-width: 1.5px; border-style: solid; opacity: 1;
}
.blockruler {
  display: flex; justify-content: space-between; margin: 5px 0 0 15px;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; color: var(--steel);
}
.blockgrid .cell .fuel  { position: absolute; inset: 0 50% 0 0; background: var(--ember); }
.blockgrid .cell .train { position: absolute; inset: 0 0 0 50%; background: var(--verdigris); }
.blockgrid .cell.deload { border-style: dashed; border-color: var(--brass); }

.grid-key {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .05em; color: var(--steel);
}
.grid-key span { display: inline-flex; align-items: center; gap: 5px; }
.grid-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* --- Big numerals -------------------------------------------------------- */
.statrow { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.stat {
  background: var(--card-sunk);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 10px 12px 11px;
}
.stat .label {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--steel); display: block; margin-bottom: 2px;
}
.stat .value {
  font-family: var(--display); line-height: 1;
  font-weight: 600; font-variant-numeric: tabular-nums;
  display: block; white-space: nowrap;
  /* These tiles sit in a fluid grid that can reach 90 px wide, and a value like
     "−1.5 kg" or "+0.42" must shrink to fit rather than be clipped. Never
     `overflow: hidden` here — silently truncating a number is worse than a
     slightly small one. */
  font-size: clamp(1.2rem, 6.4vw, 1.8rem);
}
.stat .unit { font-size: .7rem; color: var(--steel); margin-left: 2px; font-weight: 400; }
.stat .foot { font-size: .74rem; color: var(--steel); display: block; margin-top: 3px; line-height: 1.3; }
.stat.ember  .value { color: var(--ember); }
.stat.verd   .value { color: var(--verdigris); }
.stat.brass  .value { color: var(--brass); }

.hero-number {
  font-family: var(--display); font-weight: 600;
  font-size: 3.4rem; line-height: .95; font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.hero-number .unit { font-size: 1.1rem; color: var(--steel); letter-spacing: 0; }

/* --- Macro bars ---------------------------------------------------------- */
.macro { margin-bottom: 12px; }
.macro:last-child { margin-bottom: 0; }
.macro .top {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
}
.macro .top .name { text-transform: uppercase; letter-spacing: .12em; color: var(--steel); }
.macro .top .nums { margin-left: auto; font-variant-numeric: tabular-nums; }
.macro .top .nums b { font-weight: 600; }
.macro .track {
  height: 9px; border-radius: 5px; background: var(--card-sunk);
  border: 1px solid var(--rule-soft); overflow: hidden; position: relative;
}
.macro .fill { height: 100%; border-radius: 4px; transition: width .35s cubic-bezier(.2,.7,.3,1); }
.macro.protein .fill { background: var(--verdigris); }
.macro.carbs   .fill { background: var(--brass); }
.macro.fat     .fill { background: var(--steel); }
.macro.kcal    .fill { background: var(--ember); }
.macro .fill.over { background: repeating-linear-gradient(45deg, var(--alert), var(--alert) 5px, color-mix(in srgb, var(--alert) 60%, transparent) 5px, color-mix(in srgb, var(--alert) 60%, transparent) 10px); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 0 18px;
  border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--card-sunk); color: var(--ink);
  font-family: var(--display); font-size: .92rem; letter-spacing: .04em;
  text-transform: uppercase; font-weight: 600;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: var(--card); border-color: var(--ink); }
.btn.ember   { background: var(--ember); color: #fff; border-color: var(--ember); }
.btn.verd    { background: var(--verdigris); color: #fff; border-color: var(--verdigris); }
.btn.ghost   { background: transparent; }
.btn.small   { min-height: 36px; padding: 0 12px; font-size: .78rem; }
.btn.block   { display: flex; width: 100%; }
.btn.danger  { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 40%, var(--rule)); }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow .btn { flex: 1 1 auto; }

/* --- Segmented control --------------------------------------------------- */
.segmented {
  display: flex; gap: 2px; padding: 3px;
  background: var(--card-sunk); border: 1px solid var(--rule-soft);
  border-radius: var(--radius); margin-bottom: 14px;
  overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 1 0 auto; min-height: 38px; padding: 0 14px;
  background: none; border: 0; border-radius: 7px;
  font-family: var(--display); font-size: .8rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--steel); white-space: nowrap;
}
.segmented button[aria-selected="true"] {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 3px rgba(27,32,39,.12); font-weight: 600;
}

/* --- Forms --------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; margin-bottom: 5px;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--steel);
}
.field .hint { font-size: .78rem; color: var(--steel); margin-top: 5px; line-height: 1.4; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"],
input[type="search"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--card-sunk);
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--ui); font-size: 1rem;
  appearance: none; -webkit-appearance: none;
}
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--steel) 50%),
                    linear-gradient(135deg, var(--steel) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}
input::placeholder, textarea::placeholder { color: var(--steel); opacity: .8; }

.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-fields.three { grid-template-columns: repeat(3, 1fr); }

/* Stepper for numeric entry — bigger targets than a spinner. */
.stepper { display: flex; align-items: stretch; gap: 6px; }
.stepper input { text-align: center; flex: 1; }
.stepper button {
  width: 48px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card-sunk); font-size: 1.35rem; line-height: 1; color: var(--ink-soft);
}
.stepper button:active { background: var(--rule-soft); }

/* Toggle row */
.toggle {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 0; border: 0; border-bottom: 1px solid var(--rule-soft);
  background: none; text-align: left; min-height: 52px;
}
.toggle:last-child { border-bottom: 0; }
.toggle .tl { flex: 1; }
.toggle .tl b { display: block; font-weight: 600; font-size: .95rem; }
.toggle .tl span { display: block; font-size: .78rem; color: var(--steel); line-height: 1.35; }
.toggle .box {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  border: 2px solid var(--rule); display: grid; place-items: center;
  font-size: .95rem; color: transparent;
}
.toggle[aria-pressed="true"] .box {
  background: var(--verdigris); border-color: var(--verdigris); color: #fff;
}

/* Rating 1-5 */
.rating { display: flex; gap: 6px; }
.rating button {
  flex: 1; min-height: 44px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--card-sunk);
  font-family: var(--mono); font-size: .95rem; color: var(--steel);
}
.rating button[aria-pressed="true"] {
  background: var(--ink); color: var(--card); border-color: var(--ink); font-weight: 600;
}

/* --- Lists --------------------------------------------------------------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule-soft);
}
.rows li:last-child { border-bottom: 0; }
.rows .main { flex: 1; min-width: 0; }
.rows .main b { display: block; font-weight: 600; font-size: .95rem; }
.rows .main span { display: block; font-size: .78rem; color: var(--steel); }
.rows .num {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: .88rem; text-align: right; white-space: nowrap;
}
.rows .num b { display: block; font-size: 1rem; }
.rows .num span { display: block; font-size: .7rem; color: var(--steel); }
.rows button.del {
  background: none; border: 0; color: var(--steel); font-size: 1.1rem;
  padding: 6px; margin: -6px -6px -6px 0; min-width: 34px;
}

.tappable { cursor: pointer; }
.tappable:active { background: var(--card-sunk); }

.check-item { display: flex; align-items: flex-start; gap: 11px; padding: 9px 0; }
.check-item .cb {
  width: 24px; height: 24px; flex: 0 0 24px; margin-top: 1px;
  border: 2px solid var(--rule); border-radius: 6px;
  display: grid; place-items: center; font-size: .8rem; color: transparent;
  background: none;
}
.check-item[data-done="1"] .cb { background: var(--verdigris); border-color: var(--verdigris); color: #fff; }
.check-item[data-done="1"] .lbl { text-decoration: line-through; color: var(--steel); }
.check-item .lbl { flex: 1; font-size: .95rem; line-height: 1.4; }
.check-item .qty { font-family: var(--mono); font-size: .82rem; color: var(--steel); white-space: nowrap; }

/* --- Set logger ---------------------------------------------------------- */
.exercise { border-bottom: 1px solid var(--rule); padding: 15px 16px; }
.exercise:last-child { border-bottom: 0; }
.exercise .head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.exercise .head h3 { flex: 1; font-size: 1.08rem; }
.exercise .pattern {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--steel);
}
.exercise .variant { font-size: .86rem; color: var(--ink-soft); margin-bottom: 8px; }
.exercise .suggest {
  font-size: .82rem; line-height: 1.4; padding: 8px 10px; margin: 8px 0 10px;
  border-left: 3px solid var(--verdigris); background: var(--verd-soft);
  border-radius: 0 6px 6px 0; color: var(--ink-soft);
}
.exercise .suggest.up   { border-left-color: var(--verdigris); background: var(--verd-soft); }
.exercise .suggest.down { border-left-color: var(--ember); background: var(--ember-soft); }
.exercise .suggest.hold { border-left-color: var(--brass); background: var(--brass-soft); }

.setgrid { display: grid; grid-template-columns: 26px 1fr 1fr 1fr 40px; gap: 6px; align-items: center; }
.setgrid .hdr {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--steel); text-align: center; padding-bottom: 2px;
}
.setgrid .idx {
  font-family: var(--mono); font-size: .82rem; color: var(--steel); text-align: center;
}
.setgrid input { min-height: 44px; padding: 6px 4px; text-align: center; font-size: 1rem; }
.setgrid .done {
  min-height: 44px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card-sunk); display: grid; place-items: center;
  color: var(--steel); font-size: 1rem;
}
.setgrid .done[data-done="1"] { background: var(--verdigris); border-color: var(--verdigris); color: #fff; }

.cues { margin: 10px 0 0; padding: 0 0 0 18px; font-size: .84rem; color: var(--ink-soft); line-height: 1.45; }
.cues li { margin-bottom: 3px; }
.caution {
  margin-top: 9px; padding: 8px 10px; border-radius: 6px;
  background: var(--ember-soft); border-left: 3px solid var(--ember);
  font-size: .82rem; line-height: 1.42; color: var(--ink-soft);
}

/* --- Rest timer ---------------------------------------------------------- */
.resttimer {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 45; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--card);
  border-radius: var(--radius-lg); padding: 11px 14px;
  box-shadow: var(--shadow-lift);
  max-width: 756px; margin: 0 auto;
}
.resttimer .t {
  font-family: var(--display); font-size: 1.7rem; font-variant-numeric: tabular-nums;
  line-height: 1; min-width: 68px;
}
.resttimer .lbl { flex: 1; font-size: .8rem; opacity: .8; line-height: 1.3; }
.resttimer button {
  background: none; border: 1px solid rgba(255,255,255,.35); color: inherit;
  border-radius: 8px; min-height: 36px; padding: 0 12px; font-size: .78rem;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .06em;
}

/* --- Charts (inline SVG) ------------------------------------------------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid  { stroke: var(--rule-soft); stroke-width: 1; }
.chart .band  { fill: var(--verd-soft); }
.chart .raw   { fill: var(--steel); opacity: .55; }
.chart .trend { fill: none; stroke: var(--ember); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .axis  { fill: var(--steel); font-family: var(--mono); font-size: 9px; }
.chart .goal  { stroke: var(--verdigris); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .bar   { fill: var(--verdigris); }

/* --- Notices ------------------------------------------------------------- */
.notice {
  padding: 11px 13px; border-radius: var(--radius); margin-bottom: 12px;
  font-size: .87rem; line-height: 1.45;
  border-left: 3px solid var(--steel); background: var(--card-sunk); color: var(--ink-soft);
}
.notice.good { border-left-color: var(--verdigris); background: var(--verd-soft); }
.notice.warn { border-left-color: var(--brass); background: var(--brass-soft); }
.notice.bad  { border-left-color: var(--ember); background: var(--ember-soft); }
.notice b { color: var(--ink); }

.empty { text-align: center; padding: 28px 16px; color: var(--steel); font-size: .9rem; line-height: 1.5; }
.empty .glyph { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }

/* --- Sheet (modal) ------------------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20,24,28,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  background: var(--stone); width: 100%; max-width: 620px;
  border-radius: 18px 18px 0 0;
  max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lift);
  animation: rise .24s cubic-bezier(.2,.8,.3,1);
}
.sheet .sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; background: var(--stone);
  border-radius: 18px 18px 0 0;
}
.sheet .sheet-head h2 { flex: 1; font-size: 1.12rem; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0; }
.sheet .sheet-head .x {
  background: none; border: 0; font-size: 1.5rem; line-height: 1;
  color: var(--steel); padding: 4px 8px; margin: -4px -8px;
}
.sheet .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.sheet .sheet-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); background: var(--stone);
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(22px); opacity: .6 } to { transform: translateY(0); opacity: 1 } }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 70; background: var(--ink); color: var(--card);
  padding: 11px 18px; border-radius: 22px; font-size: .87rem;
  box-shadow: var(--shadow-lift); animation: rise .2s ease;
  max-width: calc(100vw - 40px); text-align: center;
}

/* --- Photo analyser ------------------------------------------------------ */
.photo-drop {
  border: 2px dashed var(--rule); border-radius: var(--radius-lg);
  padding: 26px 16px; text-align: center; background: var(--card-sunk);
}
.photo-drop .glyph { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.photo-preview {
  width: 100%; border-radius: var(--radius); display: block;
  border: 1px solid var(--rule); margin-bottom: 12px;
  max-height: 280px; object-fit: cover;
}
.conf {
  display: inline-block; font-family: var(--mono); font-size: .64rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
}
.conf.high   { background: var(--verd-soft); color: var(--verdigris); }
.conf.medium { background: var(--brass-soft); color: var(--brass); }
.conf.low    { background: var(--ember-soft); color: var(--ember); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* --- Utility ------------------------------------------------------------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--steel); }
.tiny { font-size: .76rem; line-height: 1.4; }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
.center { text-align: center; }
.divider { height: 1px; background: var(--rule-soft); margin: 14px 0; border: 0; }
.pill {
  display: inline-block; font-family: var(--mono); font-size: .64rem;
  letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px;
  border-radius: 4px; background: var(--card-sunk); color: var(--steel);
  border: 1px solid var(--rule-soft);
}
.pill.ember { background: var(--ember-soft); color: var(--ember); border-color: transparent; }
.pill.verd  { background: var(--verd-soft); color: var(--verdigris); border-color: transparent; }
.pill.brass { background: var(--brass-soft); color: var(--brass); border-color: transparent; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- Larger screens ------------------------------------------------------ */
@media (min-width: 720px) {
  body { font-size: 17px; }
  main { padding-left: 24px; padding-right: 24px; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .two-col > .card { margin-bottom: 0; }
}
