/* 수정사 발정 알림 — 휴대폰 먼저. 운전 중 잠깐 보는 화면이라 글자·누르는 곳을 크게 둔다. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --series: #2a78d6;
  --alert: #ec835a;
  --alert-wash: rgba(236, 131, 90, 0.22);
  --missing: #ecebe6;
  --warn-bg: #fff1e8;
  --warn-ink: #9a3a12;
  --info-bg: #e9f1fc;
  --info-ink: #184f95;
  --error: #d03b3b;
  --ok-bg: #e3f4ea;
  --ok-ink: #11663a;
  --phase-insem: #2a78d6;
  --phase-preg: #1baf7a;
  --phase-dry: #6250d6;
  --phase-wait: #dedcd4;
  --phase-grow: #ecebe6;
  --radius: 14px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --card: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --line: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-ink: #0b0b0b;
    --series: #3987e5;
    --alert: #ec835a;
    --alert-wash: rgba(236, 131, 90, 0.26);
    --missing: #262624;
    --warn-bg: #3a2216;
    --warn-ink: #f3b08f;
    --info-bg: #16263d;
    --info-ink: #9ec5f4;
    --ok-bg: #12301f;
    --ok-ink: #8fd9ad;
    --phase-insem: #3987e5;
    --phase-preg: #199e70;
    --phase-dry: #9085e9;
    --phase-wait: #3a3a37;
    --phase-grow: #2c2c2a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --card: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a988f;
  --line: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-ink: #0b0b0b;
  --series: #3987e5;
  --alert-wash: rgba(236, 131, 90, 0.26);
  --missing: #262624;
  --warn-bg: #3a2216;
  --warn-ink: #f3b08f;
  --info-bg: #16263d;
  --info-ink: #9ec5f4;
  --ok-bg: #12301f;
  --ok-ink: #8fd9ad;
  --phase-insem: #3987e5;
  --phase-preg: #199e70;
  --phase-dry: #9085e9;
  --phase-wait: #3a3a37;
  --phase-grow: #2c2c2a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, p { margin: 0; }
small { font-weight: 400; color: var(--muted); font-size: 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }

/* 위 막대 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 10px;
  background: var(--accent); color: var(--accent-ink);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.15rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar p { font-size: 0.8rem; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-back { color: inherit; text-decoration: none; font-weight: 600; padding: 8px 8px 8px 0; white-space: nowrap; }
.topbar-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: rgba(255, 255, 255, 0.16); color: inherit;
  font-size: 1.35rem; cursor: pointer; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 50px; min-width: 210px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); overflow: hidden;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; padding: 14px 16px; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; text-decoration: none; cursor: pointer;
}
.menu-panel form + *, .menu-panel a + form { border-top: 1px solid var(--line); }

.wrap { max-width: 720px; margin: 0 auto; padding: 12px var(--gutter) calc(env(safe-area-inset-bottom) + 32px); }

.summary { padding: 6px 2px 10px; font-size: 1.05rem; }
.summary strong { font-size: 1.4rem; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--missing); border-radius: 12px; }
.tabs a {
  display: grid; place-items: center; min-height: 44px; border-radius: 9px;
  text-decoration: none; color: var(--ink-2); font-weight: 600;
}
.tabs a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.hint { color: var(--muted); font-size: 0.9rem; padding: 12px 2px 8px; }
.hint a { white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.card {
  display: block; background: var(--card); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
a.card { text-decoration: none; }
a.card:active { background: var(--surface); }
.card + .card { margin-top: 10px; }
.card h2 { font-size: 1.05rem; margin-bottom: 8px; }

/* 소 카드 */
.cow-when { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cow-when strong { font-size: 1.05rem; }
.cow-when > span:last-child { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.cow-id { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.cow-number { font-size: 1.75rem; font-weight: 800; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.cow-name { color: var(--ink-2); }
.cow-where { color: var(--ink-2); }
.cow-facts { color: var(--ink-2); font-size: 0.92rem; margin-top: 2px; }
.cow-other { color: var(--warn-ink); font-size: 0.88rem; margin-top: 6px; }
.tags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.tag-warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag-info { background: var(--info-bg); color: var(--info-ink); }
p.tag { margin-top: 8px; }

.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 0.82rem; margin-top: 12px; }

/* 단추 */
.btn {
  display: inline-grid; place-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  font: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; width: 100%; font-size: 1.05rem; }

/* 소 상세 */
.cow-name-line { color: var(--ink-2); padding: 2px 2px 10px; }
.heat-now { border-color: var(--alert); background: var(--warn-bg); }
.heat-now-title { font-size: 1.05rem; }
.facts-line { color: var(--ink-2); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li span:last-child { text-align: right; }

/* 로그인 */
.login { max-width: 400px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) var(--gutter) 32px; text-align: center; }
.login h1 { font-size: 1.6rem; margin-top: 12px; }
.login-form { display: grid; gap: 14px; margin: 28px 0 18px; text-align: left; }
.login-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.login-form input {
  font: inherit; font-size: 1.1rem; padding: 12px 14px; min-height: 50px;
  border-radius: 12px; border: 1px solid var(--axis); background: var(--card); color: var(--ink);
}
.error { color: var(--error); font-weight: 600; }

.empty { text-align: center; padding: 36px 12px; color: var(--ink-2); display: grid; gap: 6px; }
.empty h1 { font-size: 1.2rem; color: var(--ink); }
.foot { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 20px; }
ol { padding-left: 1.3em; margin: 0; display: grid; gap: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 18px; font-size: 0.9rem; z-index: 20;
  width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.4;
}

/* 그래프 단위 */
.tabs-small { margin-bottom: 8px; }
.tabs-small a { min-height: 40px; font-size: 0.92rem; }
.chart-note { color: var(--muted); font-size: 0.8rem; margin: 2px 2px 8px; }

/* 번식 진행 */
.breeding { margin: 10px 0 0; }
.breeding-svg { display: block; width: 100%; height: auto; overflow: visible; }
.breeding .phase-track { fill: var(--missing); }
.breeding .phase-grow, .swatch.phase-grow { fill: var(--phase-grow); background: var(--phase-grow); }
.breeding .phase-wait, .swatch.phase-wait { fill: var(--phase-wait); background: var(--phase-wait); }
.breeding .phase-insem, .swatch.phase-insem { fill: var(--phase-insem); background: var(--phase-insem); }
.breeding .phase-preg, .swatch.phase-preg { fill: var(--phase-preg); background: var(--phase-preg); }
.breeding .phase-dry, .swatch.phase-dry { fill: var(--phase-dry); background: var(--phase-dry); }
.breeding .phase { stroke: var(--card); stroke-width: 1; }
.breeding .heat-tick { fill: var(--alert); }
.breeding .next-heat, .swatch.next-heat { fill: var(--alert-wash); background: var(--alert-wash); }
.breeding .ev-glyph, .legend-glyph .ev-glyph { fill: var(--ink); stroke: var(--card); stroke-width: 1; }
.breeding .ev-line, .legend-glyph .ev-line { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.breeding .due-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 2; }
.breeding .today-line { stroke: var(--ink); stroke-width: 1.5; }
.breeding .today-label { font-size: 10px; fill: var(--ink); font-weight: 700; }
.breeding .month-label { font-size: 10px; fill: var(--muted); }
.breeding-legend { gap: 6px 12px; margin-top: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 14px; height: 12px; border-radius: 2px; }
.swatch-heat { color: var(--alert); font-size: 0.75rem; }
.legend-glyph { width: 13px; height: 13px; }
.breeding-rows { margin-top: 8px; }

/* AI 해석 */
.ai-body { margin-bottom: 10px; display: grid; gap: 6px; }
.ai-text { line-height: 1.6; }
.ai-btn { width: 100%; }
.ai-note { color: var(--muted); font-size: 0.78rem; margin-top: 8px; }


/* ── 파머스핸즈(FH) 앱과 같은 색 ───────────────────────────
   발정 그래프 4색·발정 표시·수정적기는 FH 앱 값 그대로 (FH 앱은 밝은 화면만 있다 — 어두운 화면 값은 이 앱에서 정했다) */
:root {
  --fh-mount: #ff585f;
  --fh-rum: #51dc7d;
  --fh-lying: #ffde78;
  --fh-act: #34a5eb;
  --fh-heat: #ffcad9;
  --fh-flame: #ff5889;
  --fh-timing: #f6f2ff;
  --fh-grid: #e2e2e2;
  --fh-label: #8a918e;
  --fh-title: #adb3b1;
  --fh-head: #666666;
  --fh-lack: #e2e2e2;
  --fh-sel: #888888;
  --fh-track: #f5f6f5;
  --fh-span: #b2e67b;
  --fh-now: #434746;
  --fh-now-dim: #cfd2d0;
  --fh-caption: #4d5150;
  --fh-caption-dim: #8a918e;
  --fh-warn: #fa6753;
  --fh-btn-line: #adb3b1;
  --fh-btn-ink: #434746;
  --b-sus-bg: #ffe3eb; --b-sus-ink: #b0174f;
  --b-con-bg: #dff4e0; --b-con-ink: #0b6b3d;
  --b-dis-bg: #eceeed; --b-dis-ink: #4d5150;
  --st-insem-bg: #eaf1fe; --st-insem-ink: #2e6be6;
  --st-preg-bg: #e2f6ec; --st-preg-ink: #0e7f50;
  --st-wait-bg: #fcf1dc; --st-wait-ink: #9a6206;
  --st-grow-bg: #edf0f4; --st-grow-ink: #4b5463;
  --st-dry-bg: #efeafe; --st-dry-ink: #5a46c8;
  --soon: #b06d00;
  --warn-strong: #d63c3c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fh-timing: rgba(150, 120, 255, 0.2);
    --fh-grid: #383835;
    --fh-label: #9a988f;
    --fh-title: #6f6d68;
    --fh-head: #c3c2b7;
    --fh-lack: #4a4a47;
    --fh-sel: #9a988f;
    --fh-track: #2c2c2a;
    --fh-now: #f0efec;
    --fh-now-dim: #55554f;
    --fh-caption: #c3c2b7;
    --fh-caption-dim: #9a988f;
    --fh-btn-line: #4a4a47;
    --fh-btn-ink: #f0efec;
    --b-sus-bg: #4a1c2b; --b-sus-ink: #ffb3ca;
    --b-con-bg: #12301f; --b-con-ink: #8fd9ad;
    --b-dis-bg: #2c2c2a; --b-dis-ink: #c3c2b7;
    --st-insem-bg: #16263d; --st-insem-ink: #9ec5f4;
    --st-preg-bg: #12301f; --st-preg-ink: #8fd9ad;
    --st-wait-bg: #3a2c12; --st-wait-ink: #f1c77a;
    --st-grow-bg: #2c2c2a; --st-grow-ink: #c3c2b7;
    --st-dry-bg: #241f45; --st-dry-ink: #b8adf5;
    --soon: #f1c77a;
    --warn-strong: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --fh-timing: rgba(150, 120, 255, 0.2);
  --fh-grid: #383835;
  --fh-label: #9a988f;
  --fh-title: #6f6d68;
  --fh-head: #c3c2b7;
  --fh-lack: #4a4a47;
  --fh-sel: #9a988f;
  --fh-track: #2c2c2a;
  --fh-now: #f0efec;
  --fh-now-dim: #55554f;
  --fh-caption: #c3c2b7;
  --fh-caption-dim: #9a988f;
  --fh-btn-line: #4a4a47;
  --fh-btn-ink: #f0efec;
  --b-sus-bg: #4a1c2b; --b-sus-ink: #ffb3ca;
  --b-con-bg: #12301f; --b-con-ink: #8fd9ad;
  --b-dis-bg: #2c2c2a; --b-dis-ink: #c3c2b7;
  --st-insem-bg: #16263d; --st-insem-ink: #9ec5f4;
  --st-preg-bg: #12301f; --st-preg-ink: #8fd9ad;
  --st-wait-bg: #3a2c12; --st-wait-ink: #f1c77a;
  --st-grow-bg: #2c2c2a; --st-grow-ink: #c3c2b7;
  --st-dry-bg: #241f45; --st-dry-ink: #b8adf5;
  --soon: #f1c77a;
  --warn-strong: #ff8a80;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabs-3 { grid-template-columns: 1fr 1fr 1fr; }
.tabs-3 a { font-size: 0.95rem; }

/* 소 카드 (링크 + 아래 단추) */
.cow-link { display: block; color: inherit; text-decoration: none; margin: -14px -14px 0; padding: 14px 14px 0; border-radius: var(--radius); }
.cow-link:active { background: var(--surface); }
.cow-card { padding-bottom: 14px; }
.cow-when-main { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.cow-response { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.is-dismissed .cow-link { opacity: 0.75; }

/* FH 판정 칩 · 번식상태 */
.bucket { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.bucket-suspected { background: var(--b-sus-bg); color: var(--b-sus-ink); }
.bucket-confirmed { background: var(--b-con-bg); color: var(--b-con-ink); }
.bucket-dismissed { background: var(--b-dis-bg); color: var(--b-dis-ink); }
.heat-now-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.heat-now.is-dismissed { border-color: var(--border); background: var(--card); }

/* '발정 아님' 단추 (FH 번식 카드 단추 모양) */
.act-row { margin-top: 12px; }
.act {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 44px;
  border: 1px solid var(--fh-btn-line); border-radius: 8px; background: var(--card); color: var(--fh-btn-ink);
  font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.act:active { background: var(--surface); }
.act-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.act-lock { width: 14px; height: 14px; margin-left: 4px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.act-locked { color: var(--muted); }
.act[aria-busy="true"] { opacity: 0.6; }
.act-note { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

/* 수정적기 막대 (FH FhInseminationTimingBar) */
.tbar { margin-top: 10px; }
.tbar-row { position: relative; height: 16px; }
.tbar-track, .tbar-span { position: absolute; top: 4px; height: 8px; border-radius: 2px; }
.tbar-track { left: 0; right: 0; background: var(--fh-track); }
.tbar-span { background: var(--fh-span); }
.tbar-now { position: absolute; top: -3px; left: calc(50% - 7px); width: 14px; height: 12px; fill: var(--fh-now); }
.tbar-analyzing .tbar-now { fill: var(--fh-now-dim); }
.tbar-caption { margin-top: 4px; font-size: 0.88rem; color: var(--fh-caption); font-variant-numeric: tabular-nums; }
.tbar-analyzing .tbar-caption { color: var(--fh-caption-dim); }
.tbar-warn { margin-top: 10px; color: var(--fh-warn); font-size: 0.88rem; font-weight: 600; }
.tbar-warn, .tbar-warn summary { display: flex; align-items: center; gap: 4px; }
details.tbar-warn { display: block; }
.tbar-warn summary { list-style: none; cursor: pointer; }
.tbar-warn summary::-webkit-details-marker { display: none; }
.tbar-warn-icon { flex: none; width: 24px; height: 24px; }
.tbar-warn-icon circle { fill: var(--fh-warn); }
.tbar-warn-icon path { stroke: #fff; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.tbar-tip {
  margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--card); color: var(--ink-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); border: 1px solid var(--line); font-size: 0.85rem; font-weight: 400;
}
.heat-timing { margin-top: 10px; }
.heat-timing-label { font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
.heat-timing .tbar { margin-top: 6px; }

/* 발정 그래프 (FH 앱 모양) */
.fh-mount { --c: var(--fh-mount); }
.fh-rum { --c: var(--fh-rum); }
.fh-lying { --c: var(--fh-lying); }
.fh-act { --c: var(--fh-act); }
.fh-lack { --c: var(--fh-lack); }
.fh-timing { --c: var(--fh-timing); fill: var(--c); }
.fh-line { fill: none; stroke: var(--c); stroke-linecap: round; stroke-linejoin: round; }
.fh-vline { stroke: var(--fh-grid); stroke-width: 1; stroke-linecap: round; }
.fh-guide { stroke: var(--fh-grid); stroke-width: 1; }
.fh-badge-bg { fill: var(--fh-heat); }
.fh-flame { fill: var(--fh-flame); }
.fh-xlabel { fill: var(--fh-label); }
.fhg { margin-top: 4px; }
.fhg-head { color: var(--fh-head); font-weight: 600; font-size: 1rem; line-height: 1.3; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.fhl { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--fh-label); font-size: 0.82rem; margin-bottom: 10px; }
.fhl-compact { font-size: 0.78rem; margin-bottom: 4px; }
.fhl-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fhl-line { display: inline-block; width: 10px; height: 2px; border-radius: 2px; background: var(--c); }
.fhl-square { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.fhl-square.fh-timing { box-shadow: inset 0 0 0 1px var(--fh-grid); }
.fhl-badge { width: 18px; height: 18px; }
.fhg-body { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); }
.fhg-yaxis text { font-size: 14px; fill: var(--fh-title); }
.fhg-scroll { overflow-x: auto; overflow-y: hidden; direction: rtl; overscroll-behavior-x: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.fhg-inner { direction: ltr; display: inline-block; position: relative; }
.fhg-svg { display: block; overflow: visible; }
.fhg.is-selected .fhg-scroll { touch-action: none; }
.fhg-sel line { stroke: var(--fh-sel); stroke-width: 2; stroke-linecap: round; }
.fhg-sel .sel-ring { fill: #fff; }
.fhg-tip {
  position: absolute; z-index: 3; padding: 6px 12px; border-radius: 4px; background: var(--card); color: var(--ink);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4); font-size: 0.9rem; font-weight: 600; pointer-events: none; white-space: nowrap;
}
.fhg-tip p { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.fhg-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fhg-mini { margin-top: 10px; }
.fhg-mini .fhg-svg { width: 100%; height: auto; }
.card-legend { margin-top: 16px; }

/* 첫 화면 농장 목록 */
.search-box { display: block; margin: 4px 0 10px; }
.search-box input {
  width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; font-size: 1rem;
  border-radius: 12px; border: 1px solid var(--axis); background: var(--card); color: var(--ink);
}
.farm-index { list-style: none; margin: 0; padding: 2px 14px; }
.farm-index li + li { border-top: 1px solid var(--line); }
.farm-index a { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 0; color: var(--ink); text-decoration: none; }
.fi-main { flex: 1; min-width: 0; display: grid; }
.fi-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-meta { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-heat { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--b-sus-bg); color: var(--b-sus-ink); font-size: 0.82rem; font-weight: 700; }
.filter-empty { text-align: center; padding: 20px 0; }
.farm-all-link { display: inline-block; margin-top: 10px; font-size: 0.92rem; font-weight: 600; }

/* 농장 화면 · 전체 개체 표 (시안 '소 번식정보 테이블뷰') */
.chips { display: flex; gap: 6px; margin: 12px 0 2px; overflow-x: auto; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink-2); font-size: 0.92rem; font-weight: 600; text-decoration: none;
}
.chip span { color: var(--muted); font-weight: 600; font-size: 0.85em; }
.chip.on { background: var(--ink); color: var(--page); border-color: transparent; }
.chip.on span { color: inherit; opacity: 0.75; }
.table-hint { color: var(--muted); font-size: 0.82rem; margin: 0 2px 8px; }
.table-hint strong { color: var(--ink); }
.table-wrap {
  overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.cow-table { border-collapse: separate; border-spacing: 0; font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 100%; }
.cow-table th, .cow-table td { white-space: nowrap; border-bottom: 1px solid var(--line); text-align: left; }
.cow-table th.center, .cow-table td.center { text-align: center; }
.cow-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 0; border-bottom-color: var(--axis); }
.cow-table th button {
  display: flex; align-items: center; gap: 3px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; background: none;
  font: inherit; font-size: 0.78rem; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.cow-table th.center button { justify-content: center; }
.cow-table th[aria-sort] button { color: var(--accent); }
.sort-mark { font-size: 0.65rem; }
th[aria-sort="ascending"] .sort-mark::after { content: "▲"; }
th[aria-sort="descending"] .sort-mark::after { content: "▼"; }
.cow-table td { height: 44px; padding: 0 10px; background: var(--card); }
.cow-table tbody tr { cursor: pointer; }
.cow-table tbody tr:active td { background: var(--surface); }
.col-fixed { position: sticky; left: 0; z-index: 1; box-shadow: 6px 0 8px -8px rgba(0, 0, 0, 0.3); }
.cow-table thead th.col-fixed { z-index: 3; }
.cow-table td.col-fixed a { color: var(--ink); font-weight: 800; font-size: 0.95rem; text-decoration: none; }
.cell-empty { color: var(--axis); }
.cell-sub { color: var(--muted); font-weight: 600; }
.cell-soon { color: var(--soon); font-weight: 700; }
.cell-warn { color: var(--warn-strong); font-weight: 700; }
.heat-cell { display: inline-flex; align-items: center; gap: 6px; }
.st { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; }
.st-insem { background: var(--st-insem-bg); color: var(--st-insem-ink); }
.st-preg { background: var(--st-preg-bg); color: var(--st-preg-ink); }
.st-wait { background: var(--st-wait-bg); color: var(--st-wait-ink); }
.st-grow, .st-end { background: var(--st-grow-bg); color: var(--st-grow-ink); }
.st-dry { background: var(--st-dry-bg); color: var(--st-dry-ink); }
.due-chip { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 0.78rem; font-weight: 800; background: var(--missing); color: var(--ink-2); }
.due-chip.due-soon { background: var(--warn-bg); color: var(--warn-strong); }
.sensor-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; background: var(--missing); color: var(--ink-2); }

/* ── 오늘 수정할 소 ('수정하소' 시안에서 가져온 모양) ── */
.tfarms { margin: 4px calc(-1 * var(--gutter)) 0; }
.tfarm { border-top: 8px solid var(--missing); background: var(--card); }
.tfarm:last-child { border-bottom: 8px solid var(--missing); }
.tfarm-head summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px;
  padding: 10px var(--gutter) 4px; list-style: none; cursor: pointer;
}
.tfarm-head summary::-webkit-details-marker { display: none; }
.tfarm-name { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.tfarm-head[open] .tfarm-name .chev { display: inline-block; transform: rotate(90deg); }
.tfarm-count { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tfarm-info { padding: 4px var(--gutter) 12px; }
.chev { margin-left: 4px; color: var(--muted); font-weight: 500; }
.trow { position: relative; margin: 0 var(--gutter); }
.trow + .trow { border-top: 1px solid var(--line); }
.trow-main { display: grid; gap: 4px; padding: 14px 44px 14px 0; color: var(--ink); text-decoration: none; }
.trow-main:active { background: var(--surface); }
.trow-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trow-no { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.trow-sensor { color: var(--muted); font-weight: 600; font-size: 0.85em; }
.trow-sub { color: var(--ink-2); font-size: 0.85rem; }
.trow-time { color: var(--muted); font-size: 0.88rem; }
.trow-other { color: var(--warn-ink); font-size: 0.85rem; }
.trow .tbar { margin-top: 4px; }
.trow.is-done .trow-no, .trow.is-done .trow-time { color: var(--muted); }
.pill-done { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--axis); color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.trow-not {
  position: absolute; top: 8px; right: -8px; display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
}
.trow-not svg {
  width: 32px; height: 32px; box-sizing: border-box; padding: 7px; border-radius: 50%; background: var(--missing);
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.trow-not.act-locked { color: var(--muted); }
.drawer { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 0 14px; }
.drawer summary { display: flex; align-items: center; gap: 6px; min-height: 52px; font-weight: 700; color: var(--ink-2); cursor: pointer; list-style: none; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary span:first-of-type { color: var(--muted); }
.drawer[open] summary .chev { display: inline-block; transform: rotate(90deg); }
.drawer-list { list-style: none; margin: 8px 0 6px; padding: 0; }
.drawer-list li + li { border-top: 1px solid var(--line); }
.drawer-list a { display: grid; gap: 2px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.drawer-list .trow-no { font-size: 1.05rem; }
.drawer-sub { color: var(--muted); font-size: 0.85rem; }

/* 농장 정보 두 줄 */
.info-list { margin: 0; display: grid; gap: 12px; }
.info-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: center; }
.info-item dt { grid-column: 1; grid-row: 1; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.info-item dd { grid-column: 1; grid-row: 2; margin: 0; color: var(--ink); line-height: 1.4; }
.info-item .btn { grid-column: 2; grid-row: 1 / 3; min-width: 72px; }
.info-item .tel { font-variant-numeric: tabular-nums; font-weight: 600; }
.btn-line { border-color: var(--ink); }
.info-more { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.farm-card .info-list { margin-top: 2px; }

/* 소 상세: 수정적기 상태 · 이번 산차 */
.timing-state { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--info-bg); color: var(--info-ink); }
.timing-now { background: var(--b-con-bg); color: var(--b-con-ink); }
.timing-after { background: var(--missing); color: var(--muted); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.hist li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 26px; bottom: -8px; width: 1px; background: var(--line); }
.hist-dot { flex: none; width: 13px; height: 13px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--ink-2); background: var(--card); }
.hist-calving .hist-dot { background: var(--axis); border-color: var(--axis); }
.hist-alert .hist-dot, .hist-alert-yes .hist-dot { border-color: var(--fh-flame); background: var(--fh-heat); }
.hist-alert-no .hist-dot { border-color: var(--axis); border-style: dashed; }
.hist-event .hist-dot { background: var(--ink-2); }
.hist-tx { display: grid; gap: 2px; }
.hist-tx b { font-weight: 700; }
.hist-tx span { color: var(--muted); font-size: 0.85rem; }
