/* Quail: warm neutral canvas, crisp white cards, one amber accent. Same bones as the Home and Recipes apps. */
@font-face { font-family: "Inter var"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #f0ece6;
  --text: #17130e;
  --muted: #675e54;
  --faint: #a89f94;
  --line: rgba(23, 19, 14, .09);
  --accent: #a86218;
  --on-accent: #ffffff;
  --accent-soft: #fbeeda;
  --accent-text: #8a4f10;
  --danger-text: #b3261c;
  --hero: #3d2410;
  --on-hero: #fff6e6;
  --hero-muted: #d9bd9b;
  --hero-line: rgba(255, 246, 230, .16);
  --hero-pop: #f5c07a;
  --shadow: 0 1px 2px rgba(23, 19, 14, .04), 0 4px 16px rgba(23, 19, 14, .04);
  --shadow-up: 0 2px 4px rgba(23, 19, 14, .05), 0 12px 32px rgba(23, 19, 14, .09);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0c0a;
    --surface: #181512;
    --surface-2: #231f1a;
    --text: #f3efe9;
    --muted: #a59c90;
    --faint: #6b6359;
    --line: rgba(255, 255, 255, .09);
    --accent: #f0a94e;
    --on-accent: #1c1206;
    --accent-soft: #33240f;
    --accent-text: #f5c07a;
    --danger-text: #ff9c91;
    --hero: #2b1a0b;
    --shadow: none;
    --shadow-up: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter var", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss03", "calt";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: calc(env(safe-area-inset-bottom) + 96px);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -0.025em; }
.ic { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- navigation: floating tab bar on phones, side rail on wide screens ---------- */
#tabbar {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 6px;
  width: min(340px, calc(100% - 32px)); border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line); box-shadow: var(--shadow-up);
}
#tabbar .brand { display: none; }
#tabbar a {
  display: grid; justify-items: center; gap: 1px; padding: 7px 4px 6px; border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; transition: background .15s, color .15s;
}
#tabbar a span { display: grid; place-items: center; }
#tabbar a .ic { width: 21px; height: 21px; }
#tabbar a.on { color: var(--accent-text); background: var(--accent-soft); }
body.logged-out #tabbar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.titles { flex: 1; min-width: 0; }
#crumb { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#crumb:empty { display: none; }
.topbar h1 { font-size: 26px; font-weight: 750; line-height: 1.15; letter-spacing: -0.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; }
main { padding: 6px max(18px, env(safe-area-inset-right)) 40px max(18px, env(safe-area-inset-left)); }
.topbar, main { max-width: 760px; margin: 0 auto; }

@media (min-width: 860px) {
  body { padding-bottom: 0; }
  #tabbar {
    top: 0; bottom: 0; left: 0; transform: none; width: 232px; border-radius: 0;
    display: flex; flex-direction: column; gap: 2px; padding: 22px 14px;
    border: 0; border-right: 1px solid var(--line); background: none; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  #tabbar .brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 24px; font-size: 17px; letter-spacing: -0.02em; }
  #tabbar .brand img { width: 30px; height: 30px; border-radius: 9px; box-shadow: var(--shadow); }
  #tabbar a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; font-size: 14.5px; }
  #tabbar a:hover { background: var(--surface-2); color: var(--text); }
  #tabbar a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); outline: 1px solid var(--line); }
  #tabbar a.on .ic { color: var(--accent); }
  #tabbar a .ic { width: 19px; height: 19px; }
  #page { margin-left: 232px; }
  body.logged-out #page { margin-left: 0; }
  .topbar { padding: 30px 36px 14px; }
  .topbar h1 { font-size: 30px; }
  main { padding: 6px 36px 64px; }
  #toast { bottom: 28px !important; }
}

/* ---------- buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 11px; padding: 8px 14px; min-height: 38px; cursor: pointer;
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  white-space: nowrap; text-decoration: none; box-shadow: 0 1px 1px rgba(23, 19, 14, .03);
  transition: transform .1s ease, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.danger { background: none; border-color: transparent; box-shadow: none; color: var(--danger-text); padding-left: 2px; }
.btn.small { padding: 5px 11px; min-height: 32px; font-size: 13px; border-radius: 9px; }
.btn.small .ic { width: 15px; height: 15px; }
.btn:disabled { opacity: .45; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; padding: 0; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.flat { background: none; border-color: transparent; box-shadow: none; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
input[type=text], input[type=number], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 16px; /* 16px stops iOS zooming in */
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea { min-height: 150px; resize: vertical; line-height: 1.55; display: block; font-size: 15px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.hint { color: var(--muted); font-size: 13.5px; }
.error { color: var(--danger-text); font-size: 14px; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- sections and cards ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 30px 2px 12px; min-height: 30px; }
.section-head:first-child { margin-top: 8px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head > a { display: inline-flex; align-items: center; gap: 2px; font-size: 13.5px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.pill.quiet { background: var(--surface-2); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; display: grid; gap: 10px; justify-items: center; }
.empty img { width: 76px; height: 76px; border-radius: 20px; }
.empty h2 { color: var(--text); font-size: 22px; font-weight: 750; }

/* ---------- today: where the batch is right now ---------- */
.hero { background: var(--hero); color: var(--on-hero); border-radius: 24px; padding: 20px; box-shadow: var(--shadow-up); }
.hero .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hero-pop); }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin: 4px 0 2px; }
.hero .sub { color: var(--hero-muted); font-size: 15px; }
.track { display: flex; gap: 4px; margin: 16px 0 6px; }
.track i { flex: 1; height: 6px; border-radius: 3px; background: var(--hero-line); }
.track i.done { background: var(--hero-muted); }
.track i.now { background: var(--hero-pop); flex: 2; }
.dates { display: grid; gap: 0; margin-top: 10px; }
.dates div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--hero-line); font-size: 14.5px; }
.dates span { color: var(--hero-muted); }
.dates b { font-weight: 650; text-align: right; white-space: nowrap; }
.hero .btn { margin-top: 12px; background: var(--hero-pop); color: #2b1a0b; border-color: transparent; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 12px 0 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.fact small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fact b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; display: block; margin-top: 2px; }
.fact.light { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.fact.light small, .fact.light b { color: var(--accent-text); }

/* ---------- guide text ---------- */
.sec { margin-top: 12px; padding: 14px 18px 8px; }
.sec h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec p { margin: 6px 0 10px; color: var(--muted); }
.cl { list-style: none; margin: 0 0 8px; padding: 0; }
.cl li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; gap: 11px; }
.cl li:first-child { border-top: 0; }
.cl li.d1 { padding-left: 26px; border-top: 0; padding-top: 0; color: var(--muted); }
.cl li.d2 { padding-left: 52px; border-top: 0; padding-top: 0; color: var(--muted); }
.cl li.d0 > .dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 8px 3px 0 3px; }
.cl li.d1 > .dot, .cl li.d2 > .dot { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); margin: 9px 2px 0 2px; }
.cl li.check { cursor: pointer; min-height: 40px; align-items: flex-start; }
.cl li.pic { padding-top: 0; }
.cl li.pic img { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.box { flex: none; width: 22px; height: 22px; margin-top: 0; border: 2px solid var(--faint); border-radius: 7px; transition: background .12s, border-color .12s; }
.check.done .box {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--accent);
}
.check.done .txt { color: var(--faint); text-decoration: line-through; }
.txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.txt a { color: var(--accent-text); font-weight: 600; }
.callout { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; border-radius: 12px; padding: 10px 12px; margin: 6px 0 10px; }
.tbl-wrap { overflow-x: auto; margin: 4px -4px 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; white-space: nowrap; }
td { padding: 9px 8px; border-top: 1px solid var(--line); }
tr.now td { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
tr.now td:first-child { border-radius: 10px 0 0 10px; } tr.now td:last-child { border-radius: 0 10px 10px 0; }

/* ---------- guide: the timeline of stages ---------- */
.stages { display: grid; gap: 10px; }
.stage-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; text-decoration: none; }
.stage-card .num { flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-weight: 800; }
.stage-card .body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.stage-card b { font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.stage-card .when { color: var(--muted); font-size: 13.5px; }
.stage-card .ic { color: var(--faint); }
.stage-card.past .num { background: var(--surface-2); color: var(--faint); }
.stage-card.past b { color: var(--muted); }
.stage-card.now { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.stage-card.now .num { background: var(--accent); color: var(--on-accent); }

/* ---------- forms ---------- */
form.edit { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.sec-edit { padding: 14px; display: grid; gap: 10px; }
.sec-edit .bar { display: flex; gap: 6px; align-items: center; }
.sec-edit .bar input { flex: 1; min-width: 0; font-weight: 700; }
.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; position: sticky; bottom: calc(env(safe-area-inset-bottom) + 92px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: var(--shadow-up); }
@media (min-width: 860px) { .form-actions { bottom: 16px; } }
details.help { font-size: 14px; color: var(--muted); }
details.help summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
details.help li { margin: 4px 0; }
.batch-card { padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.batch-card .body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.batch-card b { font-size: 16px; font-weight: 700; }
.batch-card span { color: var(--muted); font-size: 13.5px; }

.login { max-width: 360px; margin: 12vh auto 0; text-align: center; display: grid; gap: 12px; padding: 28px 24px; }
.login img { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 4px; }
.login h2 { font-size: 26px; font-weight: 750; }
.login p { color: var(--muted); }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18); z-index: 20; max-width: calc(100% - 32px);
}

/* ---------- broods, log, supplies ---------- */
button.batch-card { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
a.batch-card { text-decoration: none; }
.batch-card .ic { color: var(--faint); }
.section-head > a .ic { width: 14px; height: 14px; }
.hero .btn + .btn { margin-left: 8px; }
.log-form { display: grid; gap: 10px; }
.log-form textarea { min-height: 72px; }
.log-row { grid-template-columns: 1.6fr 1fr 1fr; }
.log { list-style: none; margin: 10px 0 0; padding: 4px 18px; }
.log li { padding: 10px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 38px; }
.log-head .icon-btn { margin-left: auto; }
.log .txt { color: var(--muted); white-space: pre-wrap; }
.supplies { padding-bottom: 6px; }
.supply { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; min-height: 44px; }
.supplies h3 + .supply { border-top: 0; }
.supply .body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.supply b { font-weight: 650; }
.supply .body span { color: var(--muted); font-size: 13.5px; }
.supply .ic { color: var(--faint); }
.log-row { align-items: end; }
.log li { position: relative; }
.log-head { padding-right: 44px; }
.log-head .icon-btn { position: absolute; right: -8px; top: 10px; margin: 0; }
.batch-card b { color: var(--text); }
