/* FlockAngel dashboard. No build step: this file is served as is.
   Palette from the FlockGuard app (frontend/lib/theme.dart, design/ICON_PALETTE_RATIONALE.md):
   Barn Red primary, Golden Hay accent, Fence Brown earth, Cream / Soft Wheat surfaces, earthy status colours. */

/* Plus Jakarta Sans, SIL Open Font License 1.1 (fonts/OFL.txt), self-hosted so the page makes no third-party requests. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/fonts/PlusJakartaSans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* brand */
  --barn-red: #B5471E;
  --golden-hay: #E8B23A;
  --fence-brown: #6B4423;
  --cream: #F4E8D3;
  --soft-wheat: #F9F2E4;
  --walnut: #2B2119;

  /* surfaces and text */
  --bg: var(--soft-wheat);
  --card: #FFFDF9;
  --sunk: #F4EFE7;
  --raised: #FFFFFF;
  --ink: var(--walnut);
  --muted: #6B5F54;
  --line: #E5DDD3;
  --line-strong: #CFC3B5;
  --primary: var(--barn-red);
  --primary-hover: #9C3B17;
  --on-primary: #FFFFFF;
  --primary-soft: #FBECE6;
  --accent: var(--golden-hay);
  --accent-ink: #8A5B0F;
  --earth: var(--fence-brown);
  --focus: #B57A18;

  /* status: always a soft container with dark text, so it stays readable in the sun */
  --success: #3D6628; --success-bg: #EDF4E8; --success-ink: #203B12;
  --warning: #C0761A; --warning-bg: #FDF1DC; --warning-ink: #5E3605;
  --info: #385E72;    --info-bg: #E9F0F4;    --info-ink: #183341;
  --neutral: #6E6862; --neutral-bg: #EFECE8; --neutral-ink: #3E3934;
  --danger: #A33B1F;  --danger-bg: #FBECE6;  --danger-ink: #6E2207;

  /* chart */
  --chart-bar: var(--barn-red);
  --chart-band: var(--golden-hay);
  --chart-band-opacity: .28;
  --chart-usual: #9A6A14;
  --chart-off: var(--line-strong);

  --shadow: 0 1px 2px rgba(43, 33, 25, .05), 0 4px 14px -6px rgba(43, 33, 25, .10);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Dark: warm espresso, never black-blue. The same tokens again under the explicit attribute, so a theme switch can be added later. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #17110D; --card: #221A15; --sunk: #1C1511; --raised: #35291F; --ink: #F5EEDB; --muted: #C2B4A1; --line: #3D322A; --line-strong: #5A4B3F;
    --primary: #E66E45; --primary-hover: #F08259; --on-primary: #2A0C00; --primary-soft: #45190B;
    --accent: #E8B23A; --accent-ink: #F2C867; --earth: #C79A6E; --focus: #E8B23A;
    --success: #7EBA59; --success-bg: #1B2E12; --success-ink: #BFE6A6;
    --warning: #E59E38; --warning-bg: #362005; --warning-ink: #FFD69A;
    --info: #6DA0BA;    --info-bg: #102633;    --info-ink: #A0CDE3;
    --neutral: #A89F95; --neutral-bg: #2B2520; --neutral-ink: #D6CFC7;
    --danger: #E66D43;  --danger-bg: #381509;  --danger-ink: #FFAB8C;
    --chart-bar: #E66E45; --chart-band: #E8B23A; --chart-band-opacity: .22; --chart-usual: #E8B23A; --chart-off: #5A4B3F;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17110D; --card: #221A15; --sunk: #1C1511; --raised: #35291F; --ink: #F5EEDB; --muted: #C2B4A1; --line: #3D322A; --line-strong: #5A4B3F;
  --primary: #E66E45; --primary-hover: #F08259; --on-primary: #2A0C00; --primary-soft: #45190B;
  --accent: #E8B23A; --accent-ink: #F2C867; --earth: #C79A6E; --focus: #E8B23A;
  --success: #7EBA59; --success-bg: #1B2E12; --success-ink: #BFE6A6;
  --warning: #E59E38; --warning-bg: #362005; --warning-ink: #FFD69A;
  --info: #6DA0BA;    --info-bg: #102633;    --info-ink: #A0CDE3;
  --neutral: #A89F95; --neutral-bg: #2B2520; --neutral-ink: #D6CFC7;
  --danger: #E66D43;  --danger-bg: #381509;  --danger-ink: #FFAB8C;
  --chart-bar: #E66E45; --chart-band: #E8B23A; --chart-band-opacity: .22; --chart-usual: #E8B23A; --chart-off: #5A4B3F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ---- base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack > * + * { margin-top: 10px; }
.gap-top { margin-top: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin-top: 8px; }
.err.note { color: var(--muted); }

/* ---- forms ---- */
input, select, textarea {
  font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); min-width: 0; flex: 1 1 180px;
}
textarea { resize: vertical; min-height: 72px; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox] { flex: none; width: 18px; height: 18px; min-width: 0; padding: 0; margin: 0; accent-color: var(--primary); }
.uppercase { text-transform: uppercase; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field > input, .field > select, .field > textarea { flex: none; width: 100%; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.fields .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }

button, .button {
  font: inherit; font-weight: 600; font-size: 15px; padding: 10px 16px; min-height: 42px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: background-color .15s, border-color .15s;
}
button:hover, .button:hover { background: var(--primary-hover); }
button.quiet, .button.quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.quiet:hover, .button.quiet:hover { background: var(--sunk); }
button.danger { background: var(--danger); color: #fff; }
button.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary); font-weight: 600; text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }

/* ---- pills (status chips) ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
        background: var(--neutral-bg); color: var(--neutral-ink); border: 1px solid transparent; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); }
.pill.ok { background: var(--success-bg); color: var(--success-ink); } .pill.ok::before { background: var(--success); }
.pill.warn { background: var(--warning-bg); color: var(--warning-ink); } .pill.warn::before { background: var(--warning); }
.pill.info { background: var(--info-bg); color: var(--info-ink); } .pill.info::before { background: var(--info); }
.pill.plain::before { display: none; }
.camera { background: var(--sunk); color: var(--ink); border: 1px solid var(--line); font-weight: 500; font-size: 14px; padding: 6px 12px; gap: 8px; }
.camera::before { display: none; }

/* ---- header and tabs ---- */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: var(--shadow); }
.brand h1 { color: var(--ink); }
.brand .muted { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
nav.tabs { display: flex; gap: 4px; margin: 0 0 18px; padding: 4px; background: var(--sunk); border: 1px solid var(--line); border-radius: 14px;
           position: sticky; top: 8px; z-index: 10; }
nav.tabs a { flex: 1 1 0; text-align: center; padding: 9px 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; border-radius: 10px; }
nav.tabs a:hover { color: var(--ink); }
nav.tabs a[aria-current=page] { background: var(--raised); color: var(--primary); box-shadow: var(--shadow); }

/* ---- sign in ---- */
.login { max-width: 420px; margin: 8vh auto; padding: 28px 24px; }
.login .brand { margin-bottom: 14px; }
.login .brand img { width: 56px; height: 56px; border-radius: 14px; }
.login h1 { font-size: 24px; }
.login form > .row { margin-bottom: 10px; }

/* ---- today ---- */
.statuscard { border-left: 6px solid var(--neutral); }
.statuscard.learning { border-left-color: var(--info); }
.statuscard.attention { border-left-color: var(--warning); background: var(--warning-bg); }
.statuscard.normal { border-left-color: var(--success); background: var(--success-bg); }
.status { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.015em; }
.statuscard.attention .status, .statuscard.attention .muted { color: var(--warning-ink); }
.statuscard.normal .status, .statuscard.normal .muted { color: var(--success-ink); }
.bar { height: 10px; border-radius: 99px; background: var(--info-bg); overflow: hidden; margin: 12px 0 8px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--info); border-radius: 99px; }
.item { padding: 14px; margin-top: 10px; border-radius: 12px; background: var(--warning-bg); color: var(--warning-ink); border: 1px solid transparent; }
.item:first-child { margin-top: 0; }
.item.answered { background: var(--sunk); color: var(--ink); }
.item p { margin: 0 0 10px; font-weight: 600; }
.item.answered p { font-weight: 500; }
.chart { width: 100%; max-width: 680px; height: auto; display: block; margin: 6px 0 8px; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.chart .band { fill: var(--chart-band); opacity: var(--chart-band-opacity); }
.chart .usual { stroke: var(--chart-usual); stroke-width: 2; }
.chart .seen { fill: var(--chart-bar); }
.chart .off { fill: var(--chart-off); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend .k-bar { background: var(--chart-bar); }
.legend .k-band { background: var(--chart-band); opacity: .55; }
.legend .k-off { background: var(--chart-off); height: 4px; }
.observe { padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info-ink); font-size: 14px; }

/* ---- clips ---- */
.section-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head .spacer { flex: 1; }
.section-head select { flex: 0 1 auto; padding: 7px 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.clip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.player { position: relative; }
.clip video { width: 100%; display: block; background: #000; aspect-ratio: 16/9; object-fit: contain; }
.player.fs, .player:fullscreen { position: fixed; inset: 0; z-index: 50; height: 100dvh; background: #000; }
.player.fs video, .player:fullscreen video { width: 100%; height: 100%; aspect-ratio: auto; }
.player .fsbtn { position: absolute; top: 8px; right: 8px; min-height: 0; padding: 5px 9px; background: rgba(0,0,0,.55); color: #fff; font-size: 18px; line-height: 1; border-radius: 8px; }
.player .nopreview { position: absolute; inset: 0 0 48px; display: flex; align-items: center; justify-content: center; color: #9a948c; font-size: 13px; pointer-events: none; background: #1d1815; }
.player .nopreview[hidden] { display: none; }
.player canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pending { aspect-ratio: 16/9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; text-align: center; background: var(--sunk); }
.pending .spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pending .spinner { animation-duration: 4s; } button, .button { transition: none; } }
.clip .meta { padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex: 1; }
.clip .meta b { display: block; font-size: 15px; }
.clip .meta .result { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--ink); }
.clip .meta .row { flex-wrap: nowrap; }
.clip .meta .review { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink); }
.clip .meta .review.flag { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--warning-bg); color: var(--warning-ink); border-left: 3px solid var(--warning); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }

/* ---- who's this? ---- */
.crop { flex: none; width: 76px; min-height: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; align-items: stretch; background: none; color: var(--ink);
        border: 0; font-weight: 400; text-align: center; }
.crop:hover { background: none; }
.crop img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; background: var(--sunk); border: 2px solid var(--line); display: block; }
.crop span { font-size: 12px; line-height: 1.25; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crop.unknown img { border-style: dashed; border-color: var(--line-strong); }
.crop.unknown span { color: var(--muted); }
.crop.named img { border-color: var(--success); }
.crop.other img { border-color: var(--neutral); opacity: .75; }
.crop.guess span { color: var(--info-ink); }
.crop.guess img { border-color: var(--info); border-style: dashed; }
dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.35);
         width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(23, 17, 13, .55); }
.who-sheet { padding: 18px; }
.who-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.who-head img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; background: var(--sunk); flex: none; }
.who-head h2 { margin-bottom: 4px; }
.who-hint { margin: 6px 0 0; font-size: 14px; padding: 4px 10px; border-radius: 8px; background: var(--info-bg); color: var(--info-ink); display: inline-block; }
.who-birds { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.who-birds button { justify-content: flex-start; gap: 10px; background: var(--sunk); color: var(--ink); border-color: var(--line); padding: 6px 10px 6px 6px; font-weight: 600; }
.who-birds button:hover { background: var(--primary-soft); border-color: var(--primary); }
.who-birds button.current { border-color: var(--success); background: var(--success-bg); color: var(--success-ink); }
.who-birds button.suggested { border-color: var(--info); background: var(--info-bg); color: var(--info-ink); }
.who-birds img, .who-birds .face { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; background: var(--card);
                                   display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.who-wild { padding-top: 10px; border-top: 1px solid var(--line); }
.who-wild h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.who-sheet .spacer { flex: 1; }

/* ---- settings ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; align-items: start; }
#cameraRow { margin-top: 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details[open] summary { margin-bottom: 8px; }
.danger-zone { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.danger-zone form > .row { margin-bottom: 8px; }

/* ---- my flock ---- */
.birds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.bird { display: flex; gap: 12px; align-items: center; justify-content: flex-start; text-align: left; width: 100%; padding: 12px; min-height: 0;
        background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 400; }
.bird:hover { background: var(--card); border-color: var(--line-strong); }
.bird.inactive { opacity: .7; box-shadow: none; }
.birds > .group-head { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.birds > .group-head:first-child { margin-top: 0; }
.wild-collection { padding-top: 14px; border-top: 1px solid var(--line); }
.wild-collection h3 { margin: 0; font-size: 16px; }
.bird .face { width: 56px; height: 56px; border-radius: 12px; flex: none; object-fit: cover; background: var(--sunk); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--muted); }
.bird b { display: block; font-size: 16px; }
.bird .muted { display: block; font-size: 13px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.tag i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--sunk); flex: none; }
.clash { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--warning-ink); background: var(--warning-bg); padding: 2px 8px; border-radius: 6px; }
.warnbox { padding: 12px 14px; border-radius: 12px; background: var(--warning-bg); color: var(--warning-ink); font-size: 14px; margin-bottom: 12px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; max-width: 560px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sunk); border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button.remove { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; background: rgba(0,0,0,.65); color: #fff; }
.photo button.add-tile { width: 100%; height: 100%; min-height: 0; border-radius: 0; padding: 8px; background: transparent; color: var(--muted); font-size: 14px; }
.photo button.add-tile:hover { background: var(--primary-soft); }
.photo.preparing { color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; padding: 8px; }
.photo-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.photo-menu button { flex: 1 1 140px; min-height: 46px; }
fieldset.group { border: 0; padding: 0; margin: 0; }
.field > legend, .field > .label, .field > label > span { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; flex: 1 1 auto; display: flex; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-width: 0; padding: 0; margin: 0; flex: none; }
.seg span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px; cursor: pointer; }
.seg input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg.looks label { flex: 1 1 calc(50% - 8px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-height: 36px; padding: 4px 12px; font-size: 14px; font-weight: 600; background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.chip:hover { background: var(--sunk); }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-strong); flex: none; }
details.more { margin-bottom: 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--primary); padding: 8px 0; min-height: 24px; }
details.more .fields { margin-top: 8px; }
.save-row button { flex: 1 1 auto; }
.notes { list-style: none; margin: 0 0 12px; padding: 0; }
.notes li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.notes li:first-child { border-top: 0; }
.notes time { flex: none; font-size: 13px; font-weight: 700; color: var(--earth); min-width: 82px; padding-top: 1px; }
.notes .text { flex: 1; white-space: pre-wrap; word-break: break-word; }
.back { margin-bottom: 12px; }
.inbox-link { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius); text-decoration: none;
              background: var(--info-bg); color: var(--info-ink); border: 1px solid transparent; }
.inbox-link:hover { border-color: var(--info); }
.inbox-link b { display: block; font-size: 16px; }
.inbox-link .muted { color: var(--info-ink); }
.inbox-crops { display: flex; flex: none; }
.inbox-crops img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; border: 2px solid var(--info-bg); margin-left: -10px; background: var(--sunk); }
.inbox-crops img:first-child { margin-left: 0; }
.crop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.crop-grid .crop { width: 100%; }
.crop-grid .crop img { width: 100%; height: auto; aspect-ratio: 1; }
.crop-grid .crop span { white-space: normal; }
.crop .when { font-size: 11px; font-weight: 500; color: var(--muted); white-space: normal; }
.tracks { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px 0; scrollbar-width: thin; }
.guesses-section { padding: 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--info-bg); border: 1px solid var(--info); }
.guesses-section .section-head { margin-bottom: 4px; }
.guesses-section h3 { margin: 0; font-size: 16px; color: var(--info-ink); }
.guesses-section > .muted { color: var(--info-ink); margin-bottom: 10px; }
.guesses-section button.quiet { background: var(--card); }
.guess-filter { margin: 0 0 12px; }
.guess-filter .chip { font-weight: 600; background: var(--card); }
.guess-filter .chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.guess-groups { display: flex; flex-direction: column; gap: 14px; }
.guess-group { padding: 12px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.guess-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.guess-group-head h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.guess-group-head .spacer { flex: 1; }
.guess-group-head img, .guess-group-head .face { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex: none; background: var(--sunk);
                                                 display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--muted); }
.guess-group-head .accept-group { background: var(--success); color: #fff; }
.guess-group-head .accept-group:hover { background: var(--success-ink); }
.sub-head-row { margin: 16px 0 10px; }
.sub-head-row .sub-head { margin: 0; font-size: 16px; }
.sub-head { margin: 16px 0 10px; font-size: 16px; }
#unknownView { padding-bottom: 170px; }
.inbox-item { position: relative; user-select: none; -webkit-user-select: none; }
.inbox-item .crop { width: 100%; }
.inbox-item .confirm-guess { position: absolute; top: 4px; left: 4px; min-height: 0; width: 30px; height: 30px; padding: 0; border-radius: 50%;
                             background: var(--success); color: #fff; font-size: 16px; font-weight: 700; line-height: 1; }
.inbox-item .confirm-guess:hover { background: var(--success-ink); }
.inbox-item .dismiss { position: absolute; top: 4px; right: 4px; min-height: 0; width: 30px; height: 30px; padding: 0; border-radius: 50%;
                    background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; }
.inbox-item .dismiss:hover { background: rgba(0,0,0,.8); }
.inbox-item .select-toggle { position: absolute; top: 4px; left: 4px; min-height: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%;
                             background: rgba(0,0,0,.45); color: #fff; border: 2px solid rgba(255,255,255,.85); font-size: 15px; font-weight: 700; line-height: 1; }
.inbox-item .select-toggle:hover { background: rgba(0,0,0,.7); border-color: #fff; }
.inbox-item.has-guess .select-toggle { top: 38px; }
.inbox-item.answered { opacity: .55; }
.inbox-item.answered .confirm-guess, .inbox-item.answered .dismiss, .inbox-item.answered .select-toggle { display: none; }
.selecting .dismiss, .selecting .confirm-guess { display: none; }
.selecting .inbox-item { cursor: pointer; }
.selecting .inbox-item.has-guess .select-toggle { top: 4px; }
.inbox-item.selected .crop img { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary); }
.inbox-item.selected .select-toggle { background: var(--primary); color: var(--on-primary); border-color: var(--on-primary); }
.select-bar { position: fixed; left: max(12px, calc(50% - 490px)); right: max(12px, calc(50% - 490px)); bottom: 12px; z-index: 30;
              display: flex; flex-direction: column; gap: 10px; padding: 12px 14px;
              border-radius: 14px; background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-weight: 600; }
.select-bar-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.select-bar .spacer { flex: 1; }
.select-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.select-bar .accept-selected { background: var(--success); color: #fff; }
.select-bar .accept-selected:hover { background: var(--success-ink); }
.select-birds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.select-bird { background: var(--sunk); color: var(--ink); border-color: var(--line-strong); padding: 4px 10px 4px 5px; gap: 6px; font-weight: 600; }
.select-bird:hover:not(:disabled) { background: var(--primary-soft); border-color: var(--primary); color: var(--ink); }
.select-bird.suggested { border-color: var(--info); background: var(--info-bg); color: var(--info-ink); }
.select-bird img, .select-bird .face { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex: none; background: var(--card);
                                       display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.select-verdicts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.undo-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; padding: 10px 16px; border-radius: 12px;
            background: var(--walnut); color: #F5EEDB; box-shadow: var(--shadow); font-size: 15px; }
.undo-bar .link { color: var(--golden-hay); margin-left: 6px; }
.sighting { display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.sighting .crop span { color: var(--muted); font-weight: 500; }
.sighting .crop.guess span { color: var(--info-ink); font-weight: 600; }
.small-link { font-size: 13px; align-self: center; }
.bird-summary { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.bird-summary .face { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--sunk); display: flex; align-items: center;
                      justify-content: center; font-size: 26px; font-weight: 700; color: var(--muted); }
.bird-summary h2 { margin: 0; font-size: 20px; }
.bird-summary .muted { display: block; }
.stats { display: flex; gap: 18px; margin: 0; }
.stats div { min-width: 0; }
.stats dt { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats dd { margin: 2px 0 0; font-weight: 600; }
.activity-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

/* ---- feeding and drinking stations (Settings) ---- */
.stations-card { max-width: 760px; }
.station-pic { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--sunk); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.station-pic img { display: block; width: 100%; height: auto; pointer-events: none; }
.station-layer { position: absolute; inset: 0; }
.station-box { position: absolute; border: 2px solid var(--station); background: color-mix(in srgb, var(--station) 18%, transparent); border-radius: 4px; touch-action: none; cursor: move; }
.station-box.feeding { --station: #E8B23A; }
.station-box.drinking { --station: #4FA3CF; }
.station-box.selected { border-width: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .35); }
.station-box:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.station-label { position: absolute; left: -2px; bottom: 100%; max-width: calc(100% + 4px); padding: 1px 6px; border-radius: 4px 4px 0 0; background: var(--station); color: #2B2119; font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.station-box.label-inside .station-label { bottom: auto; top: 0; border-radius: 0 0 4px 0; }
/* Corner handles: drawn small, but each catches a finger-sized area around it. */
.station-handle { position: absolute; width: 36px; height: 36px; margin: -18px; touch-action: none; }
.station-handle::after { content: ""; position: absolute; left: 11px; top: 11px; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; border: 3px solid var(--station); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.station-handle.nw { left: 0; top: 0; cursor: nwse-resize; }
.station-handle.ne { left: 100%; top: 0; cursor: nesw-resize; }
.station-handle.sw { left: 0; top: 100%; cursor: nesw-resize; }
.station-handle.se { left: 100%; top: 100%; cursor: nwse-resize; }
.station-help { margin: 8px 0 0; }
.station-edit { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunk); }
.station-edit .group { border: 0; padding: 0; margin: 0; }
.station-edit .seg span { min-height: 44px; }

@media (max-width: 520px) {
  main { padding: 12px 12px 32px; }
  .card { padding: 16px; border-radius: 14px; }
  .status { font-size: 20px; }
  nav.tabs a { font-size: 14px; padding: 9px 2px; }
  .grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .notes li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .notes .text { grid-column: 1 / -1; grid-row: 2; }
  .who-head img { width: 88px; height: 88px; }
  .bird-summary { grid-template-columns: auto 1fr; }
  .stats { grid-column: 1 / -1; }
  .crop-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .who-birds { grid-template-columns: 1fr 1fr; }
  .guess-group { padding: 10px; }
  .select-verdicts { margin-left: 0; }
}

/* Other cameras (Settings) */
.upload-list { display: grid; gap: 10px; }
.upload-cam { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.upload-cam .muted { display: block; font-size: 13px; }
.upload-cam .row { margin-top: 8px; }
.upload-cam.quiet-cam .cam-state { color: var(--warning-ink); }
.upload-token { border: 1px solid var(--primary); border-radius: var(--radius-sm); padding: 12px; background: var(--primary-soft); }
.upload-token input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.upload-help { margin-bottom: 4px; }
.upload-help summary { cursor: pointer; font-weight: 600; }
.upload-help code { font-size: 13px; }

/* Gemini: the day's story on Today (and writing another day's), and what is sent and spent under Settings. */
.storycard { border-left: 6px solid var(--accent); }
.storycard p#storyText { margin: 6px 0 8px; line-height: 1.55; }
.gemini-sent { margin: 0 0 10px; font-size: 14px; line-height: 1.45; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-ink); }
.gemini-spend { margin: 0; font-weight: 600; }
#geminiBar.over > i { background: var(--warning); }
.story-again { margin-top: 10px; }
.story-again summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.story-again input[type=date] { flex: 1; min-width: 0; }
