/* ================================================================
 * Kraalio design system – "Savanna Dusk"
 * Dark (default) is warm charcoal with sunset glows; light is warm cream
 * for bright sunlight. Theme is picked in Settings (data-theme on <html>):
 * dark | light | auto (follows the phone).
 * Tokens → base → chrome → components → features → motion → print
 * ================================================================ */
:root {
  color-scheme: dark;
  --bg: #110d0b; --bg-glow: rgba(255, 138, 76, .16); --bg-glow-2: rgba(232, 72, 95, .10);
  --surface: #1b1613; --surface-2: #221c18; --surface-3: #2c241f;
  --glass: rgba(34, 27, 23, .72);
  --ink: #f7efe6; --muted: #b5a598; --faint: #807065; --line: #352c26;
  /* brand */
  --brand: #ff9f43; --brand-2: #ff6b5a; --brand-ink: #1c1410; --brand-soft: rgba(255, 159, 67, .14);
  --grad: linear-gradient(135deg, #ffc15e 0%, #ff8a4c 50%, #e8485f 100%);
  --grad-text: linear-gradient(100deg, #ffd27a, #ff8a4c 45%, #ff5f7a);
  --glow: 0 10px 34px rgba(255, 128, 72, .32);
  /* section accents */
  --c-animals: #5ec4ff; --c-camps: #ffc15e; --c-breeding: #ff6fa8; --c-health: #ff7a6b;
  --c-money: #63dba0; --c-insight: #b79bff; --c-weather: #ffa24c; --c-scan: #7aa6ff;
  /* states */
  --urgent: #ff8a7a; --urgent-bg: rgba(255, 90, 80, .14); --warn: #ffc76a; --warn-bg: rgba(255, 190, 80, .13);
  --info: #8fc8f5; --info-bg: rgba(110, 170, 240, .13); --ok: #7fdcab; --ok-bg: rgba(99, 219, 160, .13);
  /* shape */
  --r-sm: 12px; --r: 18px; --r-lg: 26px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf5ee; --bg-glow: rgba(255, 170, 100, .30); --bg-glow-2: rgba(255, 120, 130, .14);
  --surface: #ffffff; --surface-2: #fff8f1; --surface-3: #f6ebdf;
  --glass: rgba(255, 255, 255, .78);
  --ink: #2a1d16; --muted: #7a6455; --faint: #a8958a; --line: #efe1d3;
  --brand: #e2681c; --brand-2: #e0435a; --brand-ink: #ffffff; --brand-soft: #ffeedd;
  --grad: linear-gradient(135deg, #ffad4a 0%, #f97a3c 50%, #e2435c 100%);
  --grad-text: linear-gradient(100deg, #f08a1c, #f0602e 45%, #d93a5c);
  --glow: 0 10px 30px rgba(240, 110, 50, .28);
  --c-animals: #0a86c8; --c-camps: #d48606; --c-breeding: #d6337a; --c-health: #e0453a;
  --c-money: #0e9b6a; --c-insight: #7a4be0; --c-weather: #ef7614; --c-scan: #2563eb;
  --urgent: #c8312a; --urgent-bg: #fdeceb; --warn: #9a6200; --warn-bg: #fff3d9;
  --info: #1f62a8; --info-bg: #e7f0fa; --ok: #12744a; --ok-bg: #e2f4ea;
  --shadow: 0 1px 2px rgba(80, 40, 10, .05), 0 6px 18px rgba(80, 40, 10, .07);
  --shadow-lg: 0 16px 36px rgba(80, 40, 10, .14);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #fbf5ee; --bg-glow: rgba(255, 170, 100, .30); --bg-glow-2: rgba(255, 120, 130, .14);
    --surface: #ffffff; --surface-2: #fff8f1; --surface-3: #f6ebdf;
    --glass: rgba(255, 255, 255, .78);
    --ink: #2a1d16; --muted: #7a6455; --faint: #a8958a; --line: #efe1d3;
    --brand: #e2681c; --brand-2: #e0435a; --brand-ink: #ffffff; --brand-soft: #ffeedd;
    --grad: linear-gradient(135deg, #ffad4a 0%, #f97a3c 50%, #e2435c 100%);
    --grad-text: linear-gradient(100deg, #f08a1c, #f0602e 45%, #d93a5c);
    --glow: 0 10px 30px rgba(240, 110, 50, .28);
    --c-animals: #0a86c8; --c-camps: #d48606; --c-breeding: #d6337a; --c-health: #e0453a;
    --c-money: #0e9b6a; --c-insight: #7a4be0; --c-weather: #ef7614; --c-scan: #2563eb;
    --urgent: #c8312a; --urgent-bg: #fdeceb; --warn: #9a6200; --warn-bg: #fff3d9;
    --info: #1f62a8; --info-bg: #e7f0fa; --ok: #12744a; --ok-bg: #e2f4ea;
    --shadow: 0 1px 2px rgba(80, 40, 10, .05), 0 6px 18px rgba(80, 40, 10, .07);
    --shadow-lg: 0 16px 36px rgba(80, 40, 10, .14);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 85% -160px, var(--bg-glow), transparent 70%),
    radial-gradient(700px 460px at -10% 110%, var(--bg-glow-2), transparent 70%), var(--bg);
  background-attachment: fixed;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
body.noscroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 1.08rem; margin: 26px 0 10px; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 1rem; margin: 0 0 4px; font-weight: 650; }
h4 { margin: 12px 0 6px; font-size: .92rem; }
p { margin: 6px 0; }
.muted, small { color: var(--muted); }
.i { width: 22px; height: 22px; flex: none; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 850; font-size: 1.22rem; letter-spacing: -.035em; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand > span:last-child { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; box-shadow: var(--glow); overflow: hidden; transition: transform .4s var(--spring); }
.logo img { width: 100%; height: 100%; display: block; }
.brand:hover .logo, .brand:active .logo { transform: rotate(-8deg) scale(1.06); }
.pill { font-size: .72rem; font-weight: 600; padding: 4px 10px 4px 22px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); position: relative; margin-right: 4px; }
.pill::before { content: ""; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: currentColor; }
.pill.off { background: var(--warn-bg); color: var(--warn); }
.icon-btn { position: relative; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 1.15rem; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.dot-badge, .tabbar b { position: absolute; background: var(--urgent); color: #fff; font-size: .66rem; font-weight: 700; border-radius: 99px; padding: 1px 6px; line-height: 1.4; border: 2px solid var(--surface); }
.dot-badge { top: 3px; right: 2px; }
.dot-badge[hidden], .tabbar b[hidden] { display: none; }

main { max-width: 860px; margin: 0 auto; padding: 18px 16px; outline: none; }

.tabbar {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom)); width: min(560px, calc(100% - 20px));
  display: flex; padding: 6px; gap: 2px; border-radius: 24px;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; font-size: .68rem; font-weight: 650; color: var(--faint); border-radius: 18px; position: relative; transition: background .3s var(--ease), color .3s; }
.tabbar a:hover { text-decoration: none; color: var(--ink); }
.tabbar a .i { width: 23px; height: 23px; transition: transform .35s var(--spring); }
.tabbar a:active .i { transform: scale(.85); }
.tabbar a.on { color: var(--brand); background: var(--brand-soft); }
.tabbar a.on .i { animation: tabPop .5s var(--spring); }
.tabbar a.on::after { content: ""; position: absolute; top: 2px; width: 18px; height: 3px; border-radius: 3px; background: var(--grad); box-shadow: 0 0 10px var(--brand); }
.tabbar b { top: 2px; left: 54%; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.link { display: block; color: inherit; transition: transform .15s, box-shadow .15s; }
.card.link:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 6px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head a { font-size: .88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.section-head a .i { width: 16px; height: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 10px 16px; border-radius: 12px; font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer; min-height: 44px; transition: background .15s, transform .05s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { position: relative; overflow: hidden; background: var(--grad); color: #1c1410; font-weight: 700; border-color: transparent; box-shadow: var(--glow); }
.btn.primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-120%); pointer-events: none; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:hover::after { transform: translateX(120%); transition: transform .8s var(--ease); }
.btn:active { transform: scale(.97); }
.btn.danger { color: var(--urgent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .86rem; border-radius: 10px; }
.btn .i { width: 18px; height: 18px; }
[hidden] { display: none !important; }

/* quick actions (coloured) */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 16px; }
.quick .btn, .qa { flex-direction: column; gap: 8px; padding: 14px 8px; font-size: .8rem; line-height: 1.2; white-space: normal; text-align: center; border-radius: var(--r); box-shadow: var(--shadow); }
.quick .btn span { font-size: 1.4rem; }
.qa .qi, .kpi .qi, .tint { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent); flex: none; }
.qa .qi .i { width: 22px; height: 22px; }

/* tiles & KPIs */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 1.45rem; letter-spacing: -.02em; }
.tile small { display: block; font-size: .78rem; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 7px 14px; font: inherit; font-size: .86rem; font-weight: 550; cursor: pointer; transition: background .15s; }
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
a.chip { text-decoration: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--ok); margin: 2px 4px 2px 0; }
.badge.urgent { background: var(--urgent-bg); color: var(--urgent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.camp-chip { --gc: var(--c-camps); background: color-mix(in srgb, var(--gc) 15%, transparent); color: color-mix(in srgb, var(--gc) 70%, var(--ink)); }
.camp-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gc); }

/* ---------- alerts ---------- */
.alert { border-radius: var(--r); margin-bottom: 10px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.alert summary { list-style: none; display: flex; gap: 12px; padding: 14px; cursor: pointer; align-items: flex-start; }
.alert summary::-webkit-details-marker { display: none; }
.alert .lvl { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem; }
.alert.urgent { border-left: 4px solid var(--urgent); }
.alert.warn { border-left: 4px solid var(--warn); }
.alert.info { border-left: 4px solid var(--info); }
.alert.urgent .lvl { background: var(--urgent-bg); }
.alert.warn .lvl { background: var(--warn-bg); }
.alert.info .lvl { background: var(--info-bg); }
.alert summary small { display: block; margin-top: 2px; }
.alert-body { padding: 0 14px 14px 64px; }
.alert-body ol, .result ol, .result ul { padding-left: 20px; margin: 4px 0 10px; }
.alert-body li, .result li { margin-bottom: 4px; }

/* ---------- lists ---------- */
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; color: inherit; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
a.list-item:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.list-item .ico { font-size: 1.6rem; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--surface-3); }
.list-item .meta { font-size: .84rem; color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { flex: none; width: 94px; font-size: .8rem; color: var(--muted); }
.timeline .x { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 1rem; padding: 4px 8px; border-radius: 8px; }
.timeline .x:hover { background: var(--surface-3); color: var(--urgent); }
.timeline.tl li { align-items: flex-start; }
.timeline .dot { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-size: .95rem; }
.timeline li.year { font-weight: 750; color: var(--muted); padding: 10px 0 2px; border-bottom: 0; font-size: .85rem; letter-spacing: .04em; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { padding: 22px; text-align: center; color: var(--muted); background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--r); }

/* ---------- forms ---------- */
input, select, textarea {
  font: inherit; width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 76px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; }
.field small { display: block; margin-top: 4px; font-size: .78rem; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.grid2 select, .grid3 select { text-overflow: ellipsis; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.grid3 > select { margin-bottom: 8px; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; cursor: pointer; }
.check input, .symgrid input, .picklist input, .selbox { width: 22px; height: 22px; min-height: 22px; flex: none; accent-color: var(--brand); }
.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 10px; margin-bottom: 12px; }
.symgrid label { display: flex; gap: 8px; align-items: center; font-size: .9rem; padding: 7px 6px; border-radius: 10px; cursor: pointer; }
.symgrid label:hover { background: var(--surface-3); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 650; font-size: .88rem; padding: 0 6px; }
.preview { background: var(--brand-soft); border-radius: var(--r); padding: 14px; margin-bottom: 14px; font-size: .92rem; }
.preview b.big { font-size: 1.35rem; display: block; letter-spacing: -.02em; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(8, 14, 11, .5); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--surface); width: 100%; max-width: 660px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 0 18px 18px; box-shadow: var(--shadow-lg); animation: up .25s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 720px) { .modal { align-items: center; } .sheet { border-radius: 24px; } }
.sheet-head { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; padding: 16px 0 10px; z-index: 1; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 1.2rem; }
.form-actions { position: sticky; bottom: -18px; background: var(--surface); display: flex; gap: 10px; justify-content: flex-end; padding: 12px 0 18px; border-top: 1px solid var(--line); }
.form-actions .btn { flex: 1; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; font-weight: 550; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- charts & data ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 20px; }
.chart .grid { stroke: var(--line); }
.chart .line { stroke: var(--brand); stroke-width: 3; fill: none; }
.chart .bench { stroke: var(--c-camps); stroke-width: 2; stroke-dasharray: 6 5; fill: none; }
.chart circle { fill: var(--surface); stroke: var(--brand); stroke-width: 2.5; }
.bar { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.insight { border-left: 4px solid var(--brand); }
.insight.warn { border-left-color: var(--warn); }
.insight.urgent { border-left-color: var(--urgent); }
.insight.info { border-left-color: var(--c-insight); }
.result .cond { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.banner { padding: 12px 14px; border-radius: var(--r); margin-bottom: 10px; font-weight: 600; }
.banner.urgent { background: var(--urgent-bg); color: var(--urgent); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.disclaimer { font-size: .8rem; color: var(--muted); }
.pos { color: var(--ok); } .neg { color: var(--urgent); }
.tile b small { font-size: .8rem; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th, table.data td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 600; background: var(--surface-2); }

/* ---------- profile ---------- */
.tabs { margin: 14px 0 4px; position: sticky; top: 58px; z-index: 3; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); padding: 8px 0; }
.thumb { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; flex: none; }
.photo { width: 88px; height: 88px; border-radius: 20px; object-fit: cover; flex: none; }
.photo.icon { display: grid; place-items: center; font-size: 3rem; background: var(--surface-3); }
.photo-sm { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.profile-head h1 { font-size: 1.4rem; }

/* ---------- pick lists & selection ---------- */
.pick input[type=search] { flex: 1; }
.picklist { max-height: 270px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 8px; }
.picklist label { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picklist label:hover { background: var(--surface-2); }
.picklist label[hidden] { display: none; }
.pickcount { display: block; margin-top: 4px; }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 20px)); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 11; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; box-shadow: var(--shadow-lg); }
label.list-item { cursor: pointer; }
main:has(.selbar) { padding-bottom: 170px; }

/* ---------- weighing ---------- */
.wrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wrow:last-child { border-bottom: 0; }
.wrow input { width: 100px; flex: none; font-size: 1.1rem; text-align: right; }
.whint { width: 72px; flex: none; font-size: .8rem; text-align: right; font-weight: 600; }
.whint.ok { color: var(--ok); } .whint.low { color: var(--warn); } .whint.neg { color: var(--urgent); }
.wrow.hit { background: var(--brand-soft); border-radius: 12px; padding-left: 10px; padding-right: 10px; }
#wcount { align-self: center; }

/* ---------- breeding advice / lineage ---------- */
.advice { border-radius: var(--r-sm); padding: 11px 13px; margin-top: 10px; font-size: .9rem; background: var(--info-bg); }
.advice.ok { background: var(--ok-bg); } .advice.warn { background: var(--warn-bg); } .advice.urgent { background: var(--urgent-bg); }
.treewrap { overflow-x: auto; padding-bottom: 6px; }
.tree { display: grid; grid-template-columns: repeat(4, minmax(104px, 1fr)); grid-template-rows: repeat(8, minmax(40px, auto)); gap: 4px 6px; min-width: 440px; }
.tree > div { display: flex; align-items: center; }
.pbox { display: flex; flex-direction: column; width: 100%; padding: 5px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c-animals); color: inherit; font-size: .78rem; line-height: 1.2; overflow: hidden; }
.pbox:hover { text-decoration: none; background: var(--surface-2); }
.pbox.dam { border-left-color: var(--c-breeding); }
.pbox span { color: var(--muted); }
.pbox small { font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbox.unknown { border-style: dashed; align-items: center; justify-content: center; min-height: 44px; }
.warnt { color: var(--warn) !important; font-weight: 700; }
.desc, .desc ul { list-style: none; padding-left: 16px; margin: 0; }
.desc { padding-left: 0; }
.desc li { padding: 4px 0; }
.desc ul { border-left: 2px solid var(--line); margin-left: 6px; }

/* ---------- scanning & camera ---------- */
.scanbox { margin: 10px 0; }
.scanbox.row { gap: 8px; }
.scanin { font-size: 1.15rem; min-height: 58px; border: 2px solid var(--c-scan); background: var(--surface); letter-spacing: .3px; border-radius: var(--r); }
.scanres.hit { border-color: var(--brand); }
.scanres.miss { border-color: var(--warn); }
.camrow .btn { flex: 1; }
.camov { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; }
.camov video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camov .reticle { position: absolute; left: 50%; top: 45%; width: min(68vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.9); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.camtop { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px 16px; background: linear-gradient(rgba(0,0,0,.7), transparent); }
.camtop .icon-btn { color: #fff; background: rgba(255,255,255,.15); }
.cambottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.8)); text-align: center; display: grid; gap: 10px; }
#camMsg { font-size: 1.05rem; font-weight: 600; padding: 9px 14px; border-radius: 14px; background: rgba(0,0,0,.5); }
#camMsg.good { background: #17784a; } #camMsg.bad { background: #9b2c22; }
#camCount { opacity: .85; }

/* ---------- QR labels ---------- */
.qrbox { background: #fff; padding: 5px; border-radius: 10px; line-height: 0; border: 1px solid var(--line); }
.labelsheet { display: grid; gap: 4mm; background: #fff; padding: 4mm; border-radius: var(--r); }
.labelsheet.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.labelsheet.large { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.label { display: flex; gap: 3mm; align-items: center; border: 1px dashed #999; border-radius: 3mm; padding: 2.5mm; color: #000; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.label .qr { flex: none; width: 24mm; height: 24mm; }
.labelsheet.large .label .qr { width: 36mm; height: 36mm; }
.ltext { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ltext b { font-size: 1.15rem; } .labelsheet.large .ltext b { font-size: 1.6rem; }
.ltext span { font-weight: 600; }
.ltext small { color: #333; font-size: .68rem; overflow-wrap: anywhere; }
@media screen and (max-width: 560px) { .labelsheet.small, .labelsheet.large { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================
 * Dashboard
 * ================================================================ */
/* hero: dark dusk sky with drifting sunset orbs (always dark, in both themes) */
.hero {
  position: relative; overflow: hidden; isolation: isolate; color: #fff7ee; border-radius: var(--r-lg); padding: 22px 20px 18px;
  background: linear-gradient(160deg, #2a1a14 0%, #1a1110 55%, #120c0b 100%);
  border: 1px solid rgba(255, 170, 110, .16); box-shadow: 0 22px 50px rgba(30, 10, 0, .35);
}
.hero .orb { position: absolute; z-index: -1; border-radius: 50%; filter: blur(34px); opacity: .75; pointer-events: none; will-change: transform; }
.hero .orb.o1 { width: 260px; height: 260px; right: -70px; top: -110px; background: #ff8a4c; animation: drift1 14s ease-in-out infinite alternate; }
.hero .orb.o2 { width: 200px; height: 200px; left: -60px; bottom: -120px; background: #e8485f; opacity: .55; animation: drift2 17s ease-in-out infinite alternate; }
.hero .orb.o3 { width: 120px; height: 120px; left: 45%; top: -60px; background: #ffc15e; opacity: .35; animation: drift3 11s ease-in-out infinite alternate; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.5) 1px, transparent 1.2px); background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 55%); mask-image: linear-gradient(180deg, #000, transparent 55%); }
.hero .eyebrow { font-size: .74rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: #ffc89a; margin: 0; }
.hero h1 { font-size: 1.85rem; margin: 6px 0 4px; letter-spacing: -.035em; font-weight: 800; }
.hero h1 .gt { background: linear-gradient(100deg, #ffd27a, #ff8a4c 40%, #ff5f7a 70%, #ffd27a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s linear infinite; }
.hero p.sub { margin: 0; color: rgba(255, 240, 228, .78); font-size: .95rem; }
.hero a { color: #ffd2a8; text-decoration: underline; text-underline-offset: 3px; }
.hero-top { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; position: relative; }
.wx-pill { flex: none; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: 16px; padding: 8px 12px; font: inherit; font-weight: 750; font-size: 1.15rem; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .3s var(--spring), background .2s; }
.wx-pill:hover { background: rgba(255,255,255,.14); transform: translateY(-2px); }
.wx-pill span { font-size: 1.4rem; display: inline-block; animation: bob 3.5s ease-in-out infinite; }
.hero-body { display: flex; align-items: center; gap: 18px; margin-top: 18px; position: relative; }
.hero-stats { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.hero-stats a { display: flex; align-items: baseline; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 8px 12px; color: #fff; text-decoration: none; transition: background .2s, transform .3s var(--spring); }
.hero-stats a:hover { background: rgba(255,255,255,.12); transform: translateX(3px); }
.hero-stats b { font-size: 1.3rem; letter-spacing: -.02em; line-height: 1.1; min-width: 1.4em; font-variant-numeric: tabular-nums; }
.hero-stats b.hot { color: #ff9a8a; }
.hero-stats small { color: rgba(255, 236, 222, .78); font-size: .8rem; }

/* Herd Pulse ring */
.pulse-ring { flex: none; position: relative; width: 132px; height: 132px; border: 0; padding: 0; background: none; cursor: pointer; color: #fff; font: inherit; border-radius: 50%; transition: transform .35s var(--spring); }
.pulse-ring:hover { transform: scale(1.04); }
.pulse-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.pulse-ring .track { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 10; }
.pulse-ring .val { fill: none; stroke: url(#pulseGrad); stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--pc)); transition: stroke-dashoffset 1.2s var(--ease); }
.pulse-ring .mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.pulse-ring .mid b { font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.pulse-ring .mid small { font-size: .62rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,236,222,.7); margin-top: 3px; }
.pulse-ring .mid em { font-style: normal; font-size: .72rem; font-weight: 700; color: var(--pc); margin-top: 4px; }
.pulse-ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--pc) 22%, transparent), transparent 70%); animation: breathe 3.2s ease-in-out infinite; }
.pulse-list { display: grid; gap: 10px; }
.pulse-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: inherit; }
.pulse-row:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.pulse-row .e { grid-row: span 2; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: var(--surface-3); }
.pulse-row .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.pulse-row .bar { grid-column: 2 / 4; height: 7px; }
.pulse-row .bar > i { transform-origin: left; animation: grow 1s var(--ease) backwards; }
.pulse-row small { grid-column: 2 / 4; display: block; }
.pulse-big { text-align: center; margin: 4px 0 16px; }
.pulse-big b { font-size: 3rem; font-weight: 800; letter-spacing: -.04em; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* herd mix donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { flex: none; width: 128px; height: 128px; position: relative; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 16; transition: stroke-width .2s; }
.donut circle.seg { animation: segIn 1.1s var(--ease) backwards; }
.donut .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.donut .mid b { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; }
.donut .mid small { font-size: .7rem; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.legend i { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend span.pct { color: var(--muted); font-size: .78rem; width: 38px; text-align: right; }
@media (max-width: 380px) { .donut-wrap { flex-direction: column; align-items: stretch; } .donut { margin: 0 auto; } }

.qa-row { display: flex; gap: 10px; overflow-x: auto; margin: 16px -16px 0; padding: 2px 16px 8px; scrollbar-width: none; }
.qa-row::-webkit-scrollbar { display: none; }
@media (max-width: 480px) { .hero h1 { font-size: 1.5rem; } .hero { padding: 18px 16px 16px; } .hero-body { gap: 14px; margin-top: 14px; } .pulse-ring { width: 116px; height: 116px; } .pulse-ring .mid b { font-size: 1.9rem; } .hero-stats b { font-size: 1.15rem; } }
@media (max-width: 350px) { .hero-body { flex-direction: column; align-items: stretch; } .pulse-ring { margin: 0 auto; } }
.qa { flex: 0 0 auto; width: 84px; padding: 10px 6px !important; gap: 6px !important; font-size: .76rem !important; display: flex; align-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.qa:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.focus-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 8px; color: inherit; }
.focus-item:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.focus-item .tint { width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; }
.focus-item.urgent .tint { --c: var(--urgent); } .focus-item.warn .tint { --c: var(--warn); } .focus-item.info .tint { --c: var(--info); }
.focus-item small { display: block; }
.focus-item > .i { color: var(--faint); }

.dash-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid .span2 { grid-column: span 2; } }
.dash-grid > * { margin: 0; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.panel-head h3 .tint { width: 34px; height: 34px; border-radius: 11px; }
.panel-head h3 .tint .i { width: 19px; height: 19px; }
.panel-head a { font-size: .85rem; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; position: relative; overflow: hidden; }
.kpi:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.kpi::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--c, var(--brand)) 8%, transparent); }
.kpi .qi { width: 38px; height: 38px; border-radius: 12px; }
.kpi .qi .i { width: 20px; height: 20px; }
.kpi b { font-size: 1.55rem; letter-spacing: -.03em; line-height: 1; }
.kpi small { font-size: .78rem; display: block; margin-top: 3px; }

/* weather */
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-now .big { font-size: 3rem; line-height: 1; }
.wx-now .temp { font-size: 2.4rem; font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.wx-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; color: var(--muted); margin-top: 6px; }
.wx-meta span { display: inline-flex; align-items: center; gap: 4px; }
.wx-meta .i { width: 15px; height: 15px; }
.wx-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 14px; }
.wx-day { text-align: center; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; }
.wx-day .e { font-size: 1.45rem; display: block; margin: 2px 0; }
.wx-day b { font-size: .92rem; }
.wx-day .rain { color: var(--c-animals); font-weight: 600; font-size: .72rem; display: block; }
.wx-day.best { border-color: var(--brand); background: var(--brand-soft); }
.tip { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); margin-top: 8px; font-size: .88rem; }
.tip .e { font-size: 1.2rem; flex: none; }
.tip b { display: block; }
.tip.urgent { background: var(--urgent-bg); } .tip.warn { background: var(--warn-bg); } .tip.ok { background: var(--ok-bg); }

/* camps */
.camp-strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none; }
.camp-strip::-webkit-scrollbar { display: none; }
.camp-card { --gc: var(--c-camps); flex: 0 0 auto; min-width: 150px; padding: 12px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--gc) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gc) 30%, var(--line)); color: inherit; position: relative; }
.camp-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.camp-card .cn { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 6px; }
.camp-card .cn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--gc); }
.camp-card b { font-size: 1.5rem; letter-spacing: -.02em; display: block; margin-top: 6px; }
.camp-card small { display: block; font-size: .76rem; }
.camp-tile { --gc: var(--c-camps); border-top: 5px solid var(--gc); }
.camp-tile .count { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.graze { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.graze.long { background: var(--warn-bg); color: var(--warn); }
.graze.rest { background: var(--ok-bg); color: var(--ok); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--sw); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.swatches input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand); }
.plan-group { border-left: 4px solid var(--gc, var(--line)); }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.plan-row select { width: 46%; max-width: 230px; min-height: 40px; padding: 7px 10px; }

.welcome-card { text-align: center; padding: 28px 20px; }
.welcome-card .e { font-size: 3rem; }

/* ================================================================
 * Login / account
 * ================================================================ */
.auth { position: fixed; inset: 0; z-index: 70; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; animation: fade .25s; }
.auth-hero { flex: none; position: relative; overflow: hidden; isolation: isolate; color: #fff7ee; background: linear-gradient(165deg, #2c1a13 0%, #170f0d 60%, #110b0a 100%); padding: calc(28px + env(safe-area-inset-top)) 24px 70px; }
.auth-hero::before, .auth-hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; filter: blur(40px); }
.auth-hero::before { width: 340px; height: 340px; right: -120px; top: -140px; background: #ff8a4c; opacity: .7; animation: drift1 14s ease-in-out infinite alternate; }
.auth-hero::after { width: 260px; height: 260px; left: -90px; bottom: -150px; background: #e8485f; opacity: .55; animation: drift2 17s ease-in-out infinite alternate; }
.auth-hero h1 { background: linear-gradient(100deg, #fff4e8, #ffd27a 50%, #ff8a4c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero .auth-tag, .auth-feats small { color: rgba(255, 236, 222, .8); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; position: relative; }
.logo.big { width: 52px; height: 52px; border-radius: 15px; box-shadow: 0 10px 30px rgba(255, 128, 72, .45); animation: floaty 5s ease-in-out infinite; }
.auth-brand > span:last-child { font-size: 1.5rem; letter-spacing: -.04em; }
.auth-hero h1 { font-size: 2rem; margin: 26px 0 8px; position: relative; letter-spacing: -.03em; }
.auth-tag { opacity: .9; max-width: 420px; position: relative; margin: 0; }
.auth-feats { list-style: none; padding: 0; margin: 22px 0 0; display: none; position: relative; }
.auth-feats li { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.auth-feats .fi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.16); flex: none; }
.auth-feats b { display: block; }
.auth-feats small { color: rgba(255,255,255,.82); }
.auth-panel { flex: 1; display: flex; justify-content: center; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); margin-top: -46px; position: relative; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 22px 20px; box-shadow: var(--shadow-lg); align-self: flex-start; }
.auth-card h2 { margin: 18px 0 2px; font-size: 1.4rem; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 16px; font-size: .92rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface-3); }
.seg button { border: 0; background: none; font: inherit; font-weight: 650; font-size: .92rem; padding: 10px; border-radius: 11px; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth-label { display: block; font-weight: 600; font-size: .85rem; margin: 12px 0 6px; }
.auth-label.row { display: flex; }
.auth-label a { font-weight: 600; font-size: .82rem; }
.auth-field { position: relative; }
.auth-field input { padding-left: 44px; min-height: 50px; border-radius: 14px; }
.auth-field .afi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; pointer-events: none; }
.auth-field .afi .i { width: 20px; height: 20px; }
.auth-field input[type=password], .auth-field input[name=password] { padding-right: 48px; }
.auth-field .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--faint); border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.auth-field .eye.on, .auth-field .eye:hover { color: var(--brand); background: var(--surface-3); }
.auth-field .eye .i { width: 20px; height: 20px; }
.auth-go { width: 100%; min-height: 52px; margin-top: 18px; font-size: 1rem; border-radius: 14px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(28,20,16,.25); border-top-color: #1c1410; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.auth-msg { margin-top: 14px; padding: 11px 13px; border-radius: 12px; font-size: .9rem; background: var(--urgent-bg); color: var(--urgent); font-weight: 550; }
.auth-msg.ok { background: var(--ok-bg); color: var(--ok); }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: .82rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-local { width: 100%; min-height: 48px; border-radius: 14px; }
.fine { font-size: .78rem; color: var(--muted); text-align: center; margin: 12px 0 0; }
@media (min-width: 860px) {
  .auth { flex-direction: row; }
  .auth-hero { flex: 1.1; display: flex; flex-direction: column; justify-content: center; padding: 60px 64px; }
  .auth-hero h1 { font-size: 2.8rem; }
  .auth-feats { display: block; }
  .auth-panel { flex: 1; align-items: center; margin: 0; padding: 40px; }
  .auth-card { align-self: center; padding: 30px 28px; }
}
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #1c1410; display: grid; place-items: center; font-weight: 750; font-size: 1.1rem; flex: none; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.6rem; margin: 0 auto; }
.avatar .i { width: 24px; height: 24px; }
.acct-head { display: flex; gap: 16px; align-items: center; }
.acct-head .avatar.xl { margin: 0; }
#net { cursor: pointer; }
/* team */
.badge.role-owner { background: color-mix(in srgb, var(--c-insight) 16%, transparent); color: var(--c-insight); }
.badge.role-manager { background: color-mix(in srgb, var(--c-animals) 16%, transparent); color: var(--c-animals); }
.badge.role-worker { background: color-mix(in srgb, var(--c-camps) 18%, transparent); color: color-mix(in srgb, var(--c-camps) 75%, var(--ink)); }
.badge.role-viewer { background: var(--surface-3); color: var(--muted); }
.member-row, .farm-row { padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.member-row:last-child, .farm-row:last-of-type { border-bottom: 0; }
.member-row .avatar { width: 38px; height: 38px; font-size: .95rem; }
.role-sel { width: auto; min-height: 38px; padding: 6px 10px; font-size: .88rem; }
.code-in { text-transform: uppercase; letter-spacing: .08em; }
.code-in::placeholder { text-transform: none; letter-spacing: normal; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; }
.invite-code { text-align: center; padding: 18px; border-radius: var(--r); background: var(--brand-soft); border: 1.5px dashed var(--brand); }
.invite-code small { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.invite-code b { display: block; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 2rem; letter-spacing: .12em; margin: 4px 0; color: var(--ink); }
.role-pick { display: grid; gap: 8px; }
.role-pick label { position: relative; cursor: pointer; }
.role-pick input { position: absolute; opacity: 0; }
.role-pick span { display: block; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); transition: border-color .15s, background .15s; }
.role-pick span small { display: block; margin-top: 2px; }
.role-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.role-pick input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn.primary.danger-fill { background: var(--urgent); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--urgent) 30%, transparent); }
/* update banner & what's new */
.updbar { position: fixed; z-index: 12; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom)); width: min(560px, calc(100% - 20px));
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--brand);
  box-shadow: var(--shadow-lg); animation: updIn .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes updIn { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.updbar .ue { font-size: 1.4rem; }
.updbar small { display: block; font-size: .78rem; }
.updbar .btn { flex: none; }
@media (max-width: 420px) { .updbar { flex-wrap: wrap; } .updbar .grow { flex-basis: calc(100% - 40px); } .updbar .btn { flex: 1; } }
.whatsnew h4 { margin: 10px 0 4px; color: var(--brand); }
.whatsnew ul { margin: 0 0 6px; padding-left: 20px; }
.whatsnew li { margin-bottom: 5px; }
.choice-list { display: grid; gap: 8px; margin: 12px 0 4px; }
.choice-list .btn { flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; padding: 12px 14px; }
.choice-list .btn small { font-weight: 400; color: var(--muted); }
.about-static { max-width: 640px; margin: 24px auto; line-height: 1.6; }
.about-static h1 { font-size: 1.5rem; }
.about-static li { margin-bottom: 6px; }
.danger-zone { border-color: color-mix(in srgb, var(--urgent) 40%, var(--line)); }
.del-list { margin: 4px 0 10px; padding-left: 20px; }
.del-list li { margin-bottom: 4px; }
.card.moved { border: 2px solid var(--c-camps); background: color-mix(in srgb, var(--c-camps) 9%, var(--surface)); margin-bottom: 16px; }

/* ================================================================
 * Surfaces polish + motion
 * Only transform/opacity are animated (cheap on low-end phones).
 * Entrance animations run only when you open a page (#view.enter),
 * not on every refresh. Everything stops with "reduce motion".
 * ================================================================ */
.panel, .kpi, .card, .focus-item, .list-item, .qa, .tile, .alert { transition: transform .3s var(--spring), box-shadow .3s var(--ease), border-color .3s; }
.panel:hover, .kpi:hover, .focus-item:hover { border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); }
.kpi:hover, .focus-item:hover { transform: translateY(-2px); }
.kpi b, .tile b, .camp-card b { font-variant-numeric: tabular-nums; }
.kpi::after { transition: transform .6s var(--ease); }
.kpi:hover::after { transform: scale(1.5); }
.qa .qi, .kpi .qi, .panel-head .tint { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--brand)) 22%, transparent); }
.qa:hover .qi { animation: wiggle .5s var(--ease); }
.panel-head h3 { font-weight: 750; letter-spacing: -.01em; }
.section-head h2 { font-weight: 800; letter-spacing: -.02em; }
.bar > i { background: var(--grad); }
.chip.on { background: var(--grad); color: #1c1410; border-color: transparent; box-shadow: var(--glow); }
.sheet { animation: up .4s var(--spring); }
.toast { border-radius: 16px; background: var(--ink); }
.toast.show { animation: toastPop .45s var(--spring); }

#view.enter > :not(.selbar):not(.tabs) { animation: rise .55s var(--ease) backwards; }
#view.enter > :nth-child(2) { animation-delay: .05s !important; }
#view.enter > :nth-child(3) { animation-delay: .1s !important; }
#view.enter > :nth-child(4) { animation-delay: .15s !important; }
#view.enter > :nth-child(5) { animation-delay: .2s !important; }
#view.enter > :nth-child(6) { animation-delay: .25s !important; }
#view.enter > :nth-child(n+7) { animation-delay: .3s !important; }
#view.enter .qa-row > * { animation: popIn .5s var(--spring) backwards; }
#view.enter .qa-row > :nth-child(2) { animation-delay: .12s; } #view.enter .qa-row > :nth-child(3) { animation-delay: .16s; }
#view.enter .qa-row > :nth-child(4) { animation-delay: .2s; } #view.enter .qa-row > :nth-child(5) { animation-delay: .24s; }
#view.enter .qa-row > :nth-child(n+6) { animation-delay: .28s; }
#view.enter .kpis > *, #view.enter .dash-grid > * { animation: rise .6s var(--ease) backwards; }
#view.enter .kpis > :nth-child(2), #view.enter .dash-grid > :nth-child(2) { animation-delay: .32s; }
#view.enter .kpis > :nth-child(3), #view.enter .dash-grid > :nth-child(3) { animation-delay: .38s; }
#view.enter .kpis > :nth-child(4), #view.enter .dash-grid > :nth-child(4) { animation-delay: .44s; }
#view.enter .kpis > :nth-child(5), #view.enter .dash-grid > :nth-child(5) { animation-delay: .5s; }
#view.enter .kpis > :nth-child(n+6), #view.enter .dash-grid > :nth-child(n+6) { animation-delay: .56s; }
#view.enter .kpis > :first-child, #view.enter .dash-grid > :first-child { animation-delay: .26s; }
#view.enter .pulse-ring .val { animation: ringIn 1.4s var(--ease) .25s backwards; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.85); } }
@keyframes ringIn { from { stroke-dashoffset: var(--full); } }
@keyframes segIn { from { stroke-dasharray: 0 400; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes drift1 { to { transform: translate(-40px, 30px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(50px, -20px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-60px, 20px) scale(1.3); } }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .6; } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes floaty { 50% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes tabPop { 0% { transform: scale(.7); } 60% { transform: scale(1.15) translateY(-2px); } }
@keyframes wiggle { 30% { transform: rotate(-10deg) scale(1.08); } 60% { transform: rotate(8deg) scale(1.08); } }
@keyframes toastPop { from { transform: translateX(-50%) translateY(20px) scale(.9); } }

/* theme picker */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-pick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 650; font-size: .86rem; cursor: pointer; transition: border-color .2s, transform .3s var(--spring); }
.theme-pick button:hover { transform: translateY(-2px); }
.theme-pick button.on { border-color: var(--brand); box-shadow: var(--glow); }
.theme-pick .sw { width: 100%; height: 44px; border-radius: 10px; border: 1px solid rgba(128,128,128,.25); }
.theme-pick .sw.dark { background: radial-gradient(60px 40px at 80% 0, #ff8a4c99, transparent), #161110; }
.theme-pick .sw.light { background: radial-gradient(60px 40px at 80% 0, #ffad4a88, transparent), #fbf5ee; }
.theme-pick .sw.auto { background: linear-gradient(110deg, #161110 50%, #fbf5ee 50%); }

/* ================================================================
 * Print (QR labels)
 * ================================================================ */
@media print {
  @page { margin: 8mm; }
  body { background: #fff !important; padding: 0 !important; }
  .topbar, .tabbar, .noprint, .toast, .modal, .selbar, .auth { display: none !important; }
  main { padding: 0 !important; max-width: none !important; }
  .labelsheet { padding: 0; border-radius: 0; }
  .labelsheet.small { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .labelsheet.large { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
