:root {
  --bg: #0b121c;
  --bg-2: #111a27;
  --card: #152030;
  --line: #233247;
  --text: #e8edf3;
  --muted: #93a1b3;
  --accent: #d39a5e;
  --accent-2: #e9b882;
  --accent-ink: #1a0f06;
  --good: #6cc48f;
  --warn: #e0a84a;
  --bad: #ec7f72;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbf7f2;
    --bg-2: #f3ece3;
    --card: #ffffff;
    --line: #e5dace;
    --text: #23170e;
    --muted: #6f6152;
    --accent: #9a5a22;
    --accent-2: #b8742f;
    --accent-ink: #fff;
    --good: #2f7d4f;
    --warn: #9a6512;
    --bad: #b3412f;
    --shadow: 0 8px 24px rgba(60, 35, 10, .1);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
p a, .prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; outline: none; padding-bottom: 32px; min-height: 100vh; } /* keeps the footer below the fold while the page renders (no layout shift) */

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand img { border-radius: 8px; }
.brand em { font-style: normal; color: var(--accent); }
.top-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px;
}
.top-search svg, .hero-search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.top-search input, .hero-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; font-weight: 500; font-size: 15px; color: var(--muted); }
.top-nav a:hover, .top-nav a.on { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 15px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--bg-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Tab bar (phones) ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .top-search, .top-nav a { display: none; }
  .top-in { height: 54px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: sticky; bottom: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); font-weight: 500; }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 40px; }
.kicker { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { font-size: clamp(36px, 6vw, 54px); font-weight: 600; }
.hero h1 span { color: var(--accent); display: block; }
.hero p.lead { color: var(--muted); font-size: 17px; max-width: 520px; margin: 0 0 24px; }
.hero-search {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 16px;
  max-width: 540px; box-shadow: var(--shadow);
}
.hero-search input { height: 42px; font-size: 16px; }
@media (max-width: 520px) { .hero-search .btn { display: none; } }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.suggest a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.suggest a:hover, .suggest a.hl { background: var(--bg-2); }
.suggest small { color: var(--muted); }
.stats { display: flex; gap: 32px; margin-top: 28px; flex-wrap: wrap; }
.stats b { display: block; font-size: 26px; font-weight: 600; }
.stats span { color: var(--muted); font-size: 14px; }
.hero-art { border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 4 / 3.4; position: relative; }
.hero-art svg { width: 100%; height: 100%; }
.hero-art .cap {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.hero-art .cap a { font-weight: 600; }
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 28px; padding-bottom: 16px; gap: 24px; }
  .hero-art { aspect-ratio: 16 / 10; }
}

/* ---------- Sections & cards ---------- */
.sec { margin-top: 44px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.sec-head h2 { font-size: 26px; font-weight: 600; margin: 0; }
.sec-head a { color: var(--accent); font-weight: 500; font-size: 15px; white-space: nowrap; }
.sec > p.sub { color: var(--muted); margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.card .art { aspect-ratio: 4 / 3; position: relative; }
.card .art svg { width: 100%; height: 100%; }
.card .tag {
  position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  background: color-mix(in srgb, var(--bg) 75%, transparent); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}
.card .body { padding: 12px 14px 14px; }
.card h3 { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.card p { color: var(--muted); font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .body { padding: 10px 11px 12px; }
  .card h3 { font-size: 15px; }
  .card p { font-size: 13px; }
}

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.tile:hover { border-color: var(--accent); }
.tile .ic { width: 38px; height: 38px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 18%, transparent); display: grid; place-items: center; margin-bottom: 6px; }
.tile .ic svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile b { font-weight: 600; }
.tile span { color: var(--muted); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 5px 12px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip.on, .chip:hover { border-color: var(--accent); color: var(--accent-2); }
.chip.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* ---------- Browse ---------- */
.page-head { padding: 32px 0 12px; }
.page-head h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 600; }
.page-head p { color: var(--muted); margin: 0; }
.filters { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 20px; }
.filters input[type=search] {
  width: 100%; max-width: 420px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 14px;
}
.scroll-x { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chips { flex-wrap: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--r); }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 4px; }

/* ---------- Detail ---------- */
.crumbs { padding-top: 20px; font-size: 14px; color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 36px; padding: 16px 0 8px; align-items: start; }
.detail h1 { font-size: clamp(32px, 5vw, 46px); font-weight: 600; margin-bottom: 4px; }
.detail .type { color: var(--accent); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; }
.detail .alt { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.detail .summary { font-size: 18px; margin: 14px 0 18px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.facts div { background: var(--card); padding: 10px 14px; }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.prose h3 { font-size: 20px; font-weight: 600; margin: 28px 0 8px; }
.prose p { margin: 0 0 12px; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.prose ol { padding-left: 22px; margin: 0; }
.prose li { margin-bottom: 6px; }
details.qa { border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-bottom: 8px; }
details.qa summary { cursor: pointer; padding: 11px 14px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
details.qa summary::after { content: "+"; color: var(--muted); }
details.qa[open] summary::after { content: "−"; }
details.qa p { padding: 0 14px 12px; margin: 0; color: var(--muted); }
@media (max-width: 860px) {
  .detail { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* ---------- Brew tool ---------- */
.brew {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 6px 0 8px; box-shadow: var(--shadow);
}
.brew-top { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; color: var(--text); font-size: 16px;
}
.field input[type=number] { width: 96px; }
.brew-sum { margin-left: auto; text-align: right; }
.brew-sum b { font-size: 22px; display: block; }
.brew-sum span { font-size: 13px; color: var(--muted); }
.clock { display: flex; align-items: center; gap: 18px; margin: 18px 0 12px; }
.clock .ring { width: 116px; height: 116px; flex: none; }
.clock .ring circle { fill: none; stroke-width: 8; }
.clock .ring .bg { stroke: var(--line); }
.clock .ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .3s linear; transform: rotate(-90deg); transform-origin: 50% 50%; }
.clock .ring text { fill: var(--text); font-size: 22px; font-weight: 600; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.clock .now b { display: block; font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.clock .now span { color: var(--muted); font-size: 14px; }
.steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; }
.steps li .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.steps li .p { font-weight: 600; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.steps li.done { opacity: .5; }
.steps li.cur { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.brew-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tips { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }

/* ---------- Journal ---------- */
.two { display: grid; grid-template-columns: 380px 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel h2 { font-size: 20px; font-weight: 600; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
.form .field input, .form .field select, .form .field textarea { width: 100%; }
.stars { display: flex; gap: 2px; }
.stars button { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--line); padding: 0 2px; }
.stars button.on { color: var(--accent); }
.log { display: flex; flex-direction: column; gap: 10px; }
.entry { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.entry h3 { font-size: 17px; margin: 0; font-weight: 600; }
.entry .meta { color: var(--muted); font-size: 14px; }
.entry .r { color: var(--accent); letter-spacing: 1px; text-align: right; }
.entry p { grid-column: 1 / -1; margin: 4px 0 0; font-size: 15px; }
.entry .del { grid-column: 2; justify-self: end; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; }
.entry .del:hover { color: var(--text); text-decoration: underline; }
.saved-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mini { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 14px; font-weight: 500; }
.mini svg { width: 28px; height: 28px; border-radius: 50%; }

/* ---------- Photos, 3D, charts ---------- */
.card .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--bg-2); }
.media { position: sticky; top: 80px; }
.media .stage { border-radius: 20px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3.2; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 16%, var(--bg-2)), var(--bg-2) 70%); position: relative; }
.media .stage > img, .media .stage > svg { width: 100%; height: 100%; object-fit: cover; }
.media .stage canvas { display: block; }
.loading3d { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; padding: 16px; text-align: center; }
.media-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-selected=true] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.thumbs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.thumbs button { flex: none; width: 46px; height: 46px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--bg-2); }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.credit, .src { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.credit a, .src a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.prose .src { font-size: 13px; color: var(--muted); }
.spark { width: 100%; height: 170px; display: block; margin: 8px 0 0; overflow: visible; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.spark .area { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: none; }
.spark text { fill: var(--muted); font-size: 12px; }
.bars { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.bars div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bars span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars span a { color: var(--accent-2); }
.bars i { height: 10px; border-radius: 5px; background: var(--line); position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 5px; }
.bars b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.bars.big div { padding: 4px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 520px) { .bars div { grid-template-columns: 1fr auto; } .bars i { grid-column: 1 / -1; grid-row: 2; } }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.ph { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; background: var(--bg-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.ph:hover img { transform: scale(1.04); }
@media (max-width: 520px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; } }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(5, 8, 12, .88); display: grid; place-items: center; padding: 16px; }
.lightbox figure { margin: 0; max-width: min(960px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.lightbox img { max-width: 100%; max-height: 72vh; object-fit: contain; border-radius: 12px; margin: 0 auto; }
.lightbox figcaption { color: #e8edf3; font-size: 15px; }
.lightbox figcaption small { color: #93a1b3; }
.lightbox figcaption a { color: inherit; text-decoration: underline; }
.lightbox figcaption .btn { margin-top: 8px; text-decoration: none; }
.lightbox .close { position: absolute; top: 16px; right: 16px; }
@media (max-width: 860px) { .media { position: static; } .media .stage { aspect-ratio: 16 / 11; } }

/* ---------- Identify ---------- */
.top-nav a.cam { display: inline-flex; padding: 8px 10px; color: var(--accent-ink); }
.drop { display: block; border: 2px dashed var(--line); border-radius: 18px; background: var(--bg-2); cursor: pointer; overflow: hidden; transition: border-color .15s; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop-in { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; }
.drop-in svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.drop-in b { font-size: 18px; }
.drop-in span { color: var(--muted); font-size: 14px; }
.drop-in img { max-height: 360px; max-width: 100%; border-radius: 10px; object-fit: contain; }
.id-result { margin-top: 18px; }
.id-result .kicker { text-transform: uppercase; margin-bottom: 6px; }
.id-result h2 { font-size: 26px; }
.id-result p { margin: 0 0 8px; }

/* ---------- Footer & toast ---------- */
.foot { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 40px; font-size: 14px; }
.foot-in { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; padding: 32px 16px 20px; }
.foot p { color: var(--muted); max-width: 360px; }
.foot h2 { margin: 0 0 10px; font-weight: 700; line-height: 1.3; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.foot-in > div:not(:first-child) a { display: block; margin-bottom: 6px; }
.foot-in a:hover { color: var(--accent-2); }
.foot-base a { text-decoration: underline; text-underline-offset: 2px; }
.foot-base a:hover { color: var(--accent-2); }
.foot-base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 16px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .foot-in { grid-template-columns: 1fr 1fr; } .foot-in > div:first-child { grid-column: 1 / -1; } }
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; font-size: 15px;
  transition: .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin */
.admin { padding-bottom: 32px; }
.subnav { display: flex; align-items: center; gap: 4px; padding: 16px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.subnav a { padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--muted); white-space: nowrap; }
.subnav a.on { color: var(--text); background: var(--bg-2); }
.subnav a:hover { color: var(--text); }
.subnav a.out { margin-left: auto; color: var(--accent-2); }
.admin .signin { max-width: 520px; margin-top: 24px; }
.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.t td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.t .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .who img, .t .who .ini { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.t .who .ini { display: grid; place-items: center; background: var(--bg-2); font-weight: 700; color: var(--accent-2); }
.t .who b { display: block; }
.t .who small { color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .t.stack thead { display: none; }
  .t.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .t.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; }
  .t.stack td::before { content: attr(data-l); color: var(--muted); }
  .t.stack td:first-child::before { content: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
.admin .eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.admin .page-head h1 { margin: 0 0 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.kpi b { font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span:not(.pill) { color: var(--muted); font-size: 14px; }
.admin .panel { margin-bottom: 16px; }
.admin .panel h2 { margin: 0 0 8px; }
.fixlist { list-style: none; margin: 0; padding: 0; }
.fixlist li { display: grid; grid-template-columns: minmax(120px, 22%) 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fixlist a { color: var(--accent-2); font-weight: 600; }
.fixlist span:not(.pill) { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.admin summary { cursor: pointer; color: var(--accent); font-weight: 600; margin: 8px 0; }
.admin details .chips { margin: 8px 0; }
@media (max-width: 720px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 26px; }
  .fixlist li { grid-template-columns: 1fr auto; }
  .fixlist span:not(.pill) { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Account ---------- */
.top-nav a.acct { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.top-nav a.acct.in { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.top-nav a.acct img { width: 100%; height: 100%; object-fit: cover; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.banner b { display: block; }
.banner span { color: var(--muted); font-size: 14px; }
.acct-card { display: flex; align-items: center; gap: 14px; }
.acct-card img { width: 56px; height: 56px; border-radius: 50%; }
.acct-card b { display: block; font-size: 18px; }
.acct-card span { color: var(--muted); }

/* ---------- Coffee profile (packaged coffee looked up online) ---------- */
.cp-wrap { margin-top: 18px; }
.cp-loading .bar-load { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0; }
.cp-loading .bar-load span { display: block; width: 30%; height: 100%; background: var(--accent); animation: cp-load 1.4s ease-in-out infinite; }
@keyframes cp-load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.cp { padding: 0; overflow: hidden; }
.cp-head { display: grid; grid-template-columns: 112px 1fr; gap: 18px; padding: 20px; align-items: start; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.cp-head img { width: 112px; height: 140px; object-fit: cover; border-radius: 10px; }
.cp-head .kicker { margin-bottom: 4px; }
.cp-head h2 { font-size: 26px; margin: 0 0 10px; line-height: 1.15; }
.cp-rating { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.cp-rating b { font-size: 26px; color: var(--text); }
.cp-rating svg { width: 18px; height: 18px; fill: var(--accent); stroke: none; }
.cp-sum { padding: 16px 20px 0; margin: 0; }
.cp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; padding: 4px 20px 16px; }
.cp-grid section { padding: 14px 0; border-top: 1px solid var(--line); }
.cp-grid section:nth-child(-n+2) { border-top: 0; }
.cp h3 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.cp h4 { font-size: 14px; margin: 14px 0 8px; }
.cp-origin h4 { margin-top: 0; }
.cp-origin + .cp-origin { margin-top: 14px; }
.cp-scale { display: grid; grid-template-columns: 60px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.cp-scale span:last-child { text-align: right; }
.cp-scale .track { position: relative; height: 8px; border-radius: 8px; background: var(--line); }
.cp-scale .track i { position: absolute; top: 0; width: 36px; height: 8px; border-radius: 8px; background: var(--accent); }
.cp-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.cp-facts div { display: contents; }
.cp-facts dt { color: var(--muted); }
.cp-facts dd { margin: 0; }
.cp-nut { width: 100%; border-collapse: collapse; font-size: 14px; border: 2px solid var(--text); }
.cp-nut caption { text-align: left; font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.cp-nut th, .cp-nut td { padding: 6px 10px; border-top: 1px solid var(--line); text-align: left; font-weight: 400; }
.cp-nut td { text-align: right; }
.cp-nut tr.b th, .cp-nut tr.b td { font-weight: 700; }
.cp-src { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.cp-src a { color: var(--accent-2); }
@media (max-width: 640px) {
  .cp-head { grid-template-columns: 84px 1fr; gap: 14px; padding: 16px; }
  .cp-head img { width: 84px; height: 105px; }
  .cp-head h2 { font-size: 21px; }
  .cp-sum { padding: 14px 16px 0; }
  .cp-grid { grid-template-columns: minmax(0, 1fr); padding: 4px 16px 12px; }
  .cp-grid section:nth-child(2) { border-top: 1px solid var(--line); }
  .cp-src { padding: 12px 16px; }
}

/* ---------- Open-data sections ---------- */
.prose h4 { font-size: 15px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prose ul { padding-left: 22px; margin: 0 0 10px; }
.prose ul.links { list-style: none; padding: 0; }
.prose ul.links li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.prose ul.links a { color: var(--accent-2); }
.plant-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.plant-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
@media (max-width: 520px) { .plant-row { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Phone comfort: header fits 360 px, links and stars are easy to tap ---------- */
@media (max-width: 720px) {
  .top-in { gap: 10px; }
  .top-nav { gap: 10px; }
  .crumbs a, .sec-head a { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .stars button { padding: 6px 6px; font-size: 30px; }
  .card .tag, .facts dt { font-size: 12px; }
  .bars.big span a { display: inline-block; padding: 8px 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
