/* Ферма: панель управления перепелиной фермой.
   Макет: шапка с итогами → сетка карточек; схема комнаты главная, задания рядом. */
:root {
  --bg: #eef0ea;
  --surface: #fbfcf9;
  --surface-2: #f3f5ef;
  --ink: #1b211c;
  --muted: #5f675e;
  --line: #d8ddd3;
  --accent: #2c6a4b;
  --accent-ink: #ffffff;
  --accent-soft: #dfece3;
  --shell: #d9cdb6;
  --speck: #5a4632;
  --laying: #2f8a55;
  --quarantine: #b9770e;
  --molt: #7b6bb0;
  --sick: #b3261e;
  --ok-st: #6f786d;
  --floor: #e6e2d6;
  --grid: #d3cfc2;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(20 30 20 / .06), 0 4px 16px rgb(20 30 20 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121613;
    --surface: #1a1f1b;
    --surface-2: #212721;
    --ink: #e6ebe3;
    --muted: #9aa496;
    --line: #2d342e;
    --accent: #72c094;
    --accent-ink: #0f1a13;
    --accent-soft: #1f3327;
    --shell: #8b8170;
    --speck: #2b2219;
    --laying: #5dbb83;
    --quarantine: #e0a33f;
    --molt: #a898dd;
    --sick: #ef6b5e;
    --ok-st: #8d978a;
    --floor: #232823;
    --grid: #343b34;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 18px;
}

/* Шапка */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.egg-mark { width: 30px; height: 38px; }
.egg-mark ellipse { fill: var(--shell); }
.egg-mark circle { fill: var(--speck); }
h1 { font: 600 22px/1.1 var(--font-display); margin: 0; letter-spacing: -.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; min-width: 104px; display: flex; flex-direction: column;
}
.stat b { font: 500 22px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.warn b { color: var(--quarantine); }
.stat.bad b { color: var(--sick); }

/* Сетка */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-areas: "left right";
  align-items: start;
}
.col-left { grid-area: left; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-right { grid-area: right; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 920px) {
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "plan" "eggs" "notes"; }
  .col-left, .col-right { display: contents; }
  .plan-card { grid-area: plan; } .eggs-card { grid-area: eggs; } .notes-card { grid-area: notes; }
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
h2 { font: 600 16px/1.25 var(--font-body); margin: 0; text-wrap: balance; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* Кнопки */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--sick); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* План */
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint { font-size: 13px; color: var(--muted); }
.plan-wrap { overflow-x: auto; }
#plan { width: 100%; min-width: 320px; height: auto; display: block; touch-action: none; user-select: none; }
#plan .floor { fill: var(--floor); stroke: var(--muted); stroke-width: 1.2; }
#plan .gridline { stroke: var(--grid); stroke-width: .5; }
#plan .dim { fill: var(--muted); font-family: var(--font-body); }
#plan .cage { cursor: pointer; }
#plan .cage-body { fill: var(--surface); stroke: var(--ink); stroke-width: .8; }
#plan .cage-mesh { stroke: var(--grid); stroke-width: .4; }
#plan .cage:hover .cage-body, #plan .cage.sel .cage-body { stroke: var(--accent); stroke-width: 1.6; }
#plan .cage-name { font-weight: 600; font-family: var(--font-body); fill: var(--ink); }
#plan .cage-meta { font-family: var(--font-body); fill: var(--muted); }
#plan .cage-eggs { font-weight: 600; font-family: var(--font-body); fill: var(--ink); }
#plan.arrange .cage { cursor: grab; }
#plan.arrange .cage.drag { cursor: grabbing; opacity: .85; }
#plan .shell { fill: var(--shell); }
#plan .speck { fill: var(--speck); }
.st-laying { background: var(--laying); fill: var(--laying); }
.st-quarantine { background: var(--quarantine); fill: var(--quarantine); }
.st-molt { background: var(--molt); fill: var(--molt); }
.st-sick { background: var(--sick); fill: var(--sick); }
.st-ok { background: var(--ok-st); fill: var(--ok-st); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* Задания */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.task-title { font-weight: 500; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-details { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.tag { font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); }
.tag.claude { color: var(--accent); border-color: var(--accent); }
.tag.late { color: var(--quarantine); border-color: var(--quarantine); }
.task-group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 4px 2px; list-style: none; }
.add-task, .add-note { display: flex; gap: 8px; }
.add-note { flex-direction: column; align-items: flex-end; }
.add-task input, .add-note textarea, .field input, .field select, .field textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 7px 10px;
}
.add-note textarea { resize: vertical; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 4px; }

/* Датчики */
.sensors { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.sensor { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--line); }
.sensor b { font: 500 22px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.sensor span { font-size: 12px; color: var(--muted); }
.sensor.good { border-left-color: var(--laying); }
.sensor.warn { border-left-color: var(--quarantine); }
.sensor.bad { border-left-color: var(--sick); }
.spark-wrap svg { width: 100%; height: auto; display: block; }
.spark-wrap .line-t { fill: none; stroke: var(--sick); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-wrap .line-h { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-wrap text { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
.spark-wrap .band { fill: var(--accent-soft); }
.howto { font-size: 13px; color: var(--muted); margin: 0; }
.howto code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Яйца */
.chart { position: relative; min-height: 200px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { stroke: var(--muted); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 2;
}
.tip .d { color: var(--muted); }
.quick-eggs { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.quick-eggs h3 { margin: 0 0 2px; font-size: 13px; font-weight: 600; }
.qe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.qe-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.stepper button { border: 0; background: transparent; width: 32px; height: 32px; cursor: pointer; font-size: 18px; }
.stepper button:hover { background: var(--accent-soft); }
.stepper input { width: 44px; text-align: center; border: 0; background: transparent; font-variant-numeric: tabular-nums; font-weight: 600; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.small button { width: 26px; height: 28px; font-size: 15px; }
.stepper.small input { width: 32px; }
.qe-broken { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

/* Журнал */
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow: auto; }
.note { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.note time { font-size: 12px; color: var(--muted); }
.note p { margin: 2px 0 0; white-space: pre-wrap; }

/* Панель клетки */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .25); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 21;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgb(0 0 0 / .12);
  overflow-y: auto;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.drawer-inner { padding: 16px 18px 32px; display: flex; flex-direction: column; gap: 18px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer-head h2 { font: 600 18px/1.2 var(--font-display); }
.block { display: flex; flex-direction: column; gap: 10px; }
.block h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.eggs-today { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.eggs-today .stepper button { width: 44px; height: 44px; font-size: 22px; }
.eggs-today .stepper input { width: 64px; font-size: 22px; }
.bird { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bird-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.bird-name { font-weight: 600; }
.bird-counts { display: flex; gap: 12px; font-variant-numeric: tabular-nums; font-size: 14px; }
.bird-counts b { font-weight: 600; }
.status { font-size: 12px; padding: 1px 8px; border-radius: 999px; color: #fff; }
.status.st-ok { color: var(--surface); }
.bird-actions { display: flex; gap: 6px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field.full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--surface); padding: 8px 16px; border-radius: 8px; font-size: 14px; z-index: 30;
}
.toast.err { background: var(--sick); color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (max-width: 560px) {
  .stat { min-width: 0; flex: 1 1 calc(33% - 8px); padding: 6px 10px; }
  .stat b { font-size: 18px; }
  .form { grid-template-columns: minmax(0, 1fr); }
}
#drawer-body { display: flex; flex-direction: column; gap: 22px; }

/* ===== Вкладки и разделы ===== */
:root { --k-event: #5b7fc0; --k-buy: #c08a2d; --k-vet: #b9770e; --k-incub: #a35d9b; --k-plan: #2f8a55; --k-task: #7a8580; --plus: #2f8a55; --minus: #b3261e; }
@media (prefers-color-scheme: dark) { :root { --k-event: #86a6e0; --k-buy: #e0b05a; --k-vet: #e0a33f; --k-incub: #cf8fc6; --k-plan: #5dbb83; --k-task: #9aa496; --plus: #6fcf97; --minus: #ef7b6e; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.view:not(.grid) { display: flex; flex-direction: column; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tiles .stat { min-width: 0; }
.stat.good b { color: var(--plus); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.cal-cols { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 920px) { .cal-cols { grid-template-columns: minmax(0, 1fr); } }
.field.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; align-self: end; padding-bottom: 8px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { align-items: center; }
.form-actions .muted { margin-right: auto; }
.form-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* копилка */
.goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.goal { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.goal.done { opacity: .7; }
.goal-top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.goal h3, .batch h3 { margin: 0; font-size: 15px; font-weight: 600; }
.goal-sum { font-size: 14px; color: var(--muted); }
.goal-sum b { font: 500 20px/1.2 var(--font-display); color: var(--ink); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.goal-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.goal-actions input { width: 90px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; }
.goal .p, .goal p { margin: 0; }

/* таблицы и списки */
.table-box { overflow-x: auto; max-height: 480px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
.table .plus { color: var(--plus); font-weight: 600; }
.table .minus { color: var(--minus); }
.nowrap { white-space: nowrap; }
.tag.warn { color: var(--quarantine); border-color: var(--quarantine); background: transparent; cursor: pointer; margin-left: 6px; }
.warn-text { color: var(--quarantine); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .row:last-child { border-bottom: 0; }
.icon-btn.armed { font-size: 12px; color: var(--sick); }
.strike { text-decoration: line-through; color: var(--muted); }
.chip-line { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.chip-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.soon { justify-content: flex-start !important; }
.soon-date { width: 72px; flex: none; color: var(--muted); font-size: 13px; }

/* календарь */
.cal-nav { display: flex; gap: 6px; }
#cal-title { text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-day { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 4px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:hover { border-color: var(--muted); }
.cal-day.out { opacity: .45; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-day.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip { font-size: 11px; line-height: 1.3; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.chip.done { opacity: .5; text-decoration: line-through; }
.chip.more { background: transparent; color: var(--muted); padding-left: 2px; }
.k-event { background: var(--k-event); } .k-buy { background: var(--k-buy); } .k-vet { background: var(--k-vet); }
.k-incub { background: var(--k-incub); } .k-plan { background: var(--k-plan); } .k-task { background: var(--k-task); }
@media (prefers-color-scheme: dark) { .chip:not(.more) { color: #121613; } }
@media (max-width: 560px) {
  .cal-day { min-height: 54px; }
  .chip { font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; display: inline-block; }
  .chips { flex-direction: row; flex-wrap: wrap; }
  .chip.more { display: none; }
}

/* инкубатор */
.batches { display: flex; flex-direction: column; gap: 12px; }
.batch { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.batch p { margin: 0; }
.timeline { position: relative; padding-bottom: 34px; margin: 0 12px; }
.timeline .bar i { background: var(--k-incub); }
.steps { position: absolute; left: 0; right: 0; top: 12px; height: 30px; }
.step { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; display: flex; flex-direction: column; line-height: 1.2; }
.step:first-child { transform: none; text-align: left; }
.step:last-child { transform: translateX(-100%); text-align: right; }
.step b { font-weight: 600; color: var(--muted); }
.step.passed b { color: var(--ink); }
.batch-fields { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.batch-fields .field { width: 130px; }

/* планы */
.ms { align-items: flex-start !important; }
.ms-main { min-width: 0; }
.ms-title { font-weight: 500; }
.ms.done .ms-title { text-decoration: line-through; color: var(--muted); }
.ms-side { display: flex; gap: 4px; align-items: center; flex: none; }
.status-btn { font-size: 12px; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.status-btn.s-doing { color: var(--quarantine); border-color: var(--quarantine); }
.status-btn.s-done { color: var(--plus); border-color: var(--plus); }
.status-btn.s-idea { color: var(--k-incub); border-color: var(--k-incub); }
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.calc .stat { min-width: 0; }
#calc-hens { width: 100%; accent-color: var(--accent); }
.cal-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* стены, двери, загоны */
#plan .wall { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: square; }
#plan .door-leaf { stroke: var(--muted); stroke-width: 1; }
#plan .door-arc { fill: none; stroke: var(--muted); stroke-width: .6; stroke-dasharray: 2 2; }
#plan .room-label { fill: var(--muted); font-family: var(--font-body); font-weight: 600; letter-spacing: .08em; }
#plan .cage.pen .cage-body { fill: color-mix(in srgb, var(--k-buy) 10%, var(--floor)); stroke: var(--muted); stroke-dasharray: 4 3; }
#plan .cage.pen:hover .cage-body, #plan .cage.pen.sel .cage-body { stroke: var(--accent); stroke-dasharray: none; }
/* коровник и стройка */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.crumb { border: 0; background: transparent; padding: 2px 4px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
button.crumb:hover { background: var(--surface-2); color: var(--ink); }
.crumb[aria-current="page"] { color: var(--ink); cursor: default; }
.crumb-sep { color: var(--muted); }
.build-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; border: 1px dashed var(--accent); border-radius: 8px; }
.build-tools .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hint { margin: 0; }
#plan .room { cursor: pointer; }
#plan .room-body { fill: var(--surface); stroke: var(--ink); }
#plan .room:hover .room-body { stroke: var(--accent); }
#plan.arrange .room { cursor: grab; }
#plan .room.drag { opacity: .85; }
#plan .room-tag { fill: var(--surface); opacity: .9; }
#plan .mini-cage { fill: var(--surface-2); stroke: var(--muted); }
#plan .mini-cage.pen { fill: color-mix(in srgb, var(--k-buy) 12%, var(--floor)); stroke-dasharray: 4 3; }
#plan.build { cursor: crosshair; }
#plan.build .cage { pointer-events: none; opacity: .6; }
#plan .door-gap { stroke: var(--floor); stroke-width: 3.2; }
#plan .door .hit { fill: transparent; }
#plan.build .wall:hover, #plan.build .door:hover .door-leaf { stroke: var(--sick); }
#plan.build .room-label:hover { fill: var(--sick); }
#plan .wall.draft { stroke: var(--accent); stroke-dasharray: 4 3; }
#plan .snap-dot { fill: var(--accent); }
/* статистика денег */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 99px; }
.bar-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-h { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#view-money .chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
/* себестоимость */
.field-hint { font-size: 11px; color: var(--muted); }
.cost { display: flex; flex-direction: column; gap: 6px; }
.cost-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.cost-big div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.cost-big b { font: 500 24px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.cost-big span { font-size: 12px; color: var(--muted); }
.cost-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.cost-row span { color: var(--muted); }
.cost-row b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.cost-row.good b { color: var(--plus); }
.cost-row.bad b { color: var(--minus); }
.cost p { margin: 6px 0 0; }
/* тревоги */
.alerts { display: flex; flex-wrap: wrap; gap: 8px; }
.alert { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 14px; }
.alert:hover { border-color: var(--muted); }
.alert i { width: 8px; height: 8px; border-radius: 50%; background: var(--k-event); flex: none; }
.alert.warn { border-color: color-mix(in srgb, var(--quarantine) 50%, var(--line)); }
.alert.warn i { background: var(--quarantine); }
.alert.bad { border-color: var(--sick); background: color-mix(in srgb, var(--sick) 8%, var(--surface)); }
.alert.bad i { background: var(--sick); }
/* склад */
.stock { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.st-item { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.st-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.st-name { display: flex; flex-direction: column; min-width: 0; }
.st-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.st-val b { font: 500 20px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.st-val.warn b, .st-val.warn span { color: var(--quarantine); }
.st-val.bad b, .st-val.bad span { color: var(--sick); }
.st-val.unknown b { color: var(--muted); }
.st-bar { height: 6px; }
.st-bar.ok i { background: var(--plus); }
.st-bar.warn i { background: var(--quarantine); }
.st-bar.bad i { background: var(--sick); }
.st-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.small-btn { font-size: 13px; padding: 3px 10px; }
.st-form { display: flex; gap: 8px; align-items: flex-end; }
.st-form .field { flex: 1; }
.st-form input { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
/* выбор дня для яиц */
.qe-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.egg-date-row { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.egg-date { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 8px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- живой сарай ---------- */
:root { --q-phoenix: #c8913a; --q-phoenix-dark: #8a5a1c; --q-texas: #fbf8f0; --q-texas-line: #6f685a; --duck: #f0ece0; --duck-wing: #d9d2bf; --beak: #e0a030; --duck-beak: #e98b2a; --night: #16245a; --litter: #efe6cf; }
@media (prefers-color-scheme: dark) { :root { --q-texas: #e9e4d8; --duck: #e4dfd2; --night: #000814; --litter: #2a2b22; } }
#plan .life .torso { stroke-width: .35; }
#plan .bird-q.phoenix .torso, #plan .bird-q.phoenix .tail { fill: var(--q-phoenix); stroke: var(--q-phoenix-dark); stroke-width: .35; }
#plan .bird-q.phoenix .wing { fill: var(--q-phoenix-dark); opacity: .55; }
#plan .bird-q.phoenix .spot { fill: var(--q-phoenix-dark); opacity: .7; }
#plan .bird-q.texas .torso, #plan .bird-q.texas .tail { fill: var(--q-texas); stroke: var(--q-texas-line); stroke-width: .35; }
#plan .bird-q.texas .wing { fill: none; stroke: var(--q-texas-line); stroke-width: .3; }
#plan .bird-q .beak { fill: var(--beak); }
#plan .life .eye { fill: #1b1b1b; }
#plan .bird-d .torso, #plan .bird-d .tail { fill: var(--duck); stroke: var(--q-texas-line); stroke-width: .5; }
#plan .bird-d .neck { stroke: var(--duck); stroke-width: 3.6; stroke-linecap: round; }
#plan .bird-d .wing { fill: var(--duck-wing); stroke: var(--q-texas-line); stroke-width: .4; }
#plan .bird-d .beak { fill: var(--duck-beak); }
#plan .life .asleep .eye { opacity: 0; }
#plan .floor-eggs .shell { fill: var(--shell); stroke: var(--speck); stroke-width: .2; }
#plan .floor-eggs .speck { fill: var(--speck); }
#plan .quack { font-family: var(--font-body); font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 2; animation: quack 1.6s ease-out forwards; }
#plan .zz { font-family: var(--font-body); font-weight: 700; fill: #9fb4ff; animation: zz 2.4s ease-out forwards; }
#plan .feather { fill: var(--q-texas); stroke: var(--q-texas-line); stroke-width: .2; animation: feather 20s linear forwards; }
@keyframes quack { from { opacity: 0; transform: translateY(2px); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes zz { from { opacity: 0; transform: translate(0, 0); } 30% { opacity: .9; } to { opacity: 0; transform: translate(3px, -6px); } }
@keyframes feather { 0% { opacity: .9; } 85% { opacity: .9; } to { opacity: 0; } }
#plan .night-shade { fill: var(--night); transition: opacity 2s; }
#plan.night .cage-name, #plan.night .cage-meta, #plan.night .cage-eggs { paint-order: stroke; stroke: var(--surface); stroke-width: 2.4px; }
#plan .cage-name, #plan .cage-meta, #plan .cage-eggs { paint-order: stroke; stroke: var(--surface); stroke-width: 2px; stroke-linejoin: round; }
#plan.arrange .life, #plan.build .life, #plan.arrange .night-shade, #plan.build .night-shade { display: none; }
.plan-wrap { position: relative; }
.life-tag { margin-top: 6px; font-size: .85rem; color: var(--muted); }
.cage-week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cage-week div { background: var(--surface-2, var(--bg)); border-radius: 8px; padding: 8px; text-align: center; }
.cage-week b { display: block; font-size: 1.25rem; font-family: var(--font-display); }
.cage-week span { font-size: .78rem; color: var(--muted); }
#plan .litter { fill: var(--litter); opacity: .55; }
#plan .litter.pen { opacity: 0; }
#plan .bird-q.texas .torso { stroke-width: .45; }

/* ---------- кто вошел ---------- */
.me { display: flex; align-items: center; gap: 10px; font-size: .9rem; white-space: nowrap; }
.me a { color: var(--ink); text-decoration: none; font-weight: 600; }
.me a:hover { color: var(--accent); }
.me form { margin: 0; }
.me .link { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; }
.me .link:hover { color: var(--ink); text-decoration: underline; }
