/* ============================================
   Hoof Record — 削レポ風 1画面カルテUI
   - タブレット横持ち3カラム / 縦持ち・スマホは縦積み
   - 手袋前提: タップ領域最小64px、大きな文字
   ============================================ */

:root {
  --blue: #3fc1f0;          /* プライマリ(シアン寄りの青) */
  --blue-dark: #1f8fc0;
  --blue-pale: #1c3049;      /* 濃い"淡色"面(アクセント背景) */
  --panel-border: #40587a;   /* 輪郭をはっきり見せる明るめボーダー */
  --orange: #ffb340;
  --orange-pale: #43301a;
  --red: #ff6b74;
  --red-pale: #46242a;
  --green: #34d977;
  --ink: #f0f5fc;
  --ink-sub: #a9bcd3;
  --bg: #0e1622;
  --card: #1e2b3f;           /* 面を一段明るく */
  --radius: 14px;
  --accent: #2ee0ff;         /* シアンの発光アクセント */
  --accent-2: #0ea5c4;
  --surface-2: #2a3b55;      /* さらに明るい面(ボタン上面) */
  --edge: rgba(140,180,225,0.5);   /* ボタン輪郭のハイライト */
  --glow: 0 0 0 1px rgba(46,224,255,0.3), 0 6px 18px rgba(46,224,255,0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 17px; }

body {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

button { font-family: inherit; border: none; cursor: pointer; touch-action: manipulation; }
button:active { filter: brightness(0.92); }

.hidden { display: none !important; }

/* ===== ヘッダー ===== */
#appHeader {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(#2a6cc0, var(--blue));
  color: #fff;
  padding: 8px 14px;
  min-height: 62px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
#headerTitle {
  font-size: 1.35rem;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#headerInfo { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.header-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 18px;
  min-height: 50px;
  min-width: 100px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.4);
}

/* ===== メイン ===== */
#main { max-width: 1366px; margin: 0 auto; padding: 12px 16px 20px; }

/* すべてのページを画面の高さいっぱいに使う(リストは内部スクロール) */
.view:not(.karte) {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 96px); /* ヘッダー+余白ぶん */
}
.view:not(.karte) > .list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.section-label { font-size: 1.05rem; font-weight: 700; color: var(--ink-sub); margin: 16px 0 8px; }
/* はじめての方向けの折りたたみガイド(データ管理のバックアップ説明) */
.help-fold { border: 1px solid var(--panel-border); border-radius: 10px; padding: 4px 14px; margin-bottom: 12px; background: rgba(46,224,255,0.05); }
.help-fold summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 48px; display: flex; align-items: center; }
.help-fold .help-body p { color: var(--ink-sub); font-size: 0.95rem; line-height: 1.75; margin: 0 0 12px; }
.help-fold .help-body b { color: var(--ink); }
.btn-note { color: var(--ink-sub); font-size: 0.88rem; line-height: 1.5; margin: 6px 2px 14px; }
/* 報告書の絞り込みチェック(記録の詳細) */
.report-filter { display: flex; align-items: center; gap: 10px; margin: 4px 2px 12px; font-size: 1rem; color: var(--ink); cursor: pointer; }
.report-filter input { width: 22px; height: 22px; flex-shrink: 0; }

.panel {
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(30,60,110,0.08);
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  border-left: 5px solid var(--blue);
  padding-left: 8px;
  margin-bottom: 10px;
}
.panel-hint { font-size: 0.85rem; color: var(--orange); font-weight: 700; margin-left: 6px; }

/* ===== ホーム ===== */
.home-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 14px;
  margin-top: 8px;
  min-height: 0;
}
.home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(30,60,110,0.1);
}
.home-btn.primary {
  grid-column: 1 / -1;
  background: linear-gradient(#2a6cc0, var(--blue));
  color: #fff;
  border-color: var(--blue-dark);
  font-size: 1.65rem;
}
.home-btn.resume { grid-column: 1 / -1; border-color: var(--orange); color: var(--orange); min-height: 90px; }
.home-btn.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  min-height: 76px;
  font-size: 1.15rem;
  color: var(--ink-sub);
}
.home-btn small { font-size: 0.95rem; font-weight: 400; opacity: 0.85; }
/* 線画SVGアイコン(currentColorでボタンの文字色に追従) */
.home-icon { display: flex; align-items: center; justify-content: center; }
.home-icon svg {
  width: 46px; height: 46px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-btn .home-icon { color: var(--accent); }          /* 通常ボタン=シアン一色 */
.home-btn.primary .home-icon,
.home-btn.resume .home-icon { color: inherit; }          /* カルテ入力/つづきからは文字色と同じ */
.home-btn.wide .home-icon svg { width: 30px; height: 30px; }
.home-btn.wide .home-icon { color: var(--ink-sub); }
.version-note { text-align: center; color: var(--ink-sub); font-size: 0.85rem; margin-top: 14px; }

/* ===== 大ボタン ===== */
.big-btn {
  display: block;
  width: 100%;
  min-height: 70px;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--panel-border);
  margin: 10px 0;
  padding: 10px;
}
.big-btn.primary { background: var(--blue); color: #fff; border-color: var(--blue-dark); }
.big-btn.danger { background: var(--red); color: #fff; border-color: #8c1d18; }
.big-btn.danger-outline { background: #fff; color: var(--red); border-color: var(--red); margin-top: 26px; }
.big-btn.muted { background: #e4e8ee; color: var(--ink-sub); }
.big-btn.add { border-style: dashed; color: var(--blue); border-color: var(--blue); }

.flat-btn {
  display: block;
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-pale);
  border-radius: 10px;
  margin-top: 8px;
}

/* ===== リスト ===== */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 76px;
  background: var(--card);
  border: 2px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}
.list-item .item-main { flex: 1; min-width: 0; }
.list-item .item-sub {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-sub);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .item-arrow { color: var(--ink-sub); font-size: 1.1rem; }
.list-item .item-badge {
  flex-shrink: 0;
  background: var(--red-pale);
  color: var(--red);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
}
.list-item .item-badge.ok { background: #e2f3e4; color: var(--green); }
.item-delete {
  flex-shrink: 0;
  min-width: 60px;
  min-height: 60px;
  border-radius: 10px;
  background: var(--red-pale);
  color: var(--red);
  font-size: 1.2rem;
}
.empty-note { color: var(--ink-sub); text-align: center; padding: 28px 0; font-size: 1.05rem; }

/* ===== セッション情報 ===== */
.session-farm { font-size: 1.4rem; font-weight: 700; }
.session-date { color: var(--ink-sub); margin-top: 3px; }
.session-stats { margin-top: 8px; font-size: 1.1rem; color: var(--blue); font-weight: 700; }

/* ============================================
   カルテ入力(ステップ式)
   ============================================ */
.view.karte { padding-bottom: 0; } /* 1画面収まり優先(下余白は取消ボタン自身のマージンで確保) */

body.karte-mode #main { max-width: 720px; padding: 10px 12px 0; }

/* ステップ表示 */
.step-indicator {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.step-indicator span {
  flex: 1;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-sub);
  background: #cdd6e2;
  border-radius: 8px;
  padding: 10px 4px;
  white-space: nowrap;
}
.step-indicator span.current {
  background: var(--blue);
  color: #fff;
}
.step-indicator span.done {
  background: var(--blue-pale);
  color: var(--blue);
}

.step-actions { display: flex; gap: 10px; margin-bottom: 12px; } /* 縦画面: テンキー直下に置くため下の記録パネルとの間隔を確保 */
.step-actions .big-btn { flex: 2; }
.step-actions .big-btn.muted { flex: 1; min-width: 110px; }

.big-btn.success { background: var(--green); color: #fff; border-color: #1b5e20; }
.big-btn.tall { min-height: 88px; font-size: 1.45rem; }

.flat-btn.danger-text {
  color: var(--red);
  background: var(--red-pale);
  margin: 5px auto 5px; /* 上下で計10px(合計高さ不変)。下端に貼り付かないよう下にも余白 */
  max-width: 380px;
  min-height: 46px;
  font-size: 0.95rem;
}

.pos-cow-no { font-size: 1.2rem; color: var(--blue); margin-left: 8px; }

/* --- フルスクリーンステップ共通 --- */
.fullstep {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 225px); /* ヘッダー+ステップ表示+取消ボタンぶんを引く */
  gap: 10px;
}
.fullstep.hidden { display: none; }
.kstep-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue-dark);
  border-left: 6px solid var(--blue);
  padding-left: 10px;
}
.leg-badge {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: 4px 14px;
  margin-right: 10px;
  font-size: 1.15rem;
}
.step-nav { display: flex; gap: 10px; margin-top: auto; }
.step-nav .big-btn { flex: 2; margin: 6px 0; }
.step-nav .big-btn.muted { flex: 1; min-width: 108px; }
.step-nav .big-btn.add { flex: 1.4; }
.memo-slot { margin-top: 4px; }
.memo-slot:empty { display: none; }

/* --- 肢の選択(ステップ②) --- */
.leg-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 14px;
  min-height: 46vh;
}
.leg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 2.1rem;
  font-weight: 700;
  border-radius: 16px;
  background: var(--card);
  border: 3px solid var(--panel-border);
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(30,60,110,0.12);
}
.leg-btn small { font-size: 1rem; font-weight: 400; color: var(--ink-sub); }
.leg-btn.marked { border-color: var(--red); background: var(--red-pale); }
.leg-btn.marked::after { content: "● 所見あり"; font-size: 0.95rem; color: var(--red); font-weight: 700; }

/* --- 蹄ゾーンマップ --- */
.zone-map {
  width: 100%;
  flex: 0 1 auto; /* 図の大きさぶんだけ確保(余白を作らない) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 4px;
}
.zone-map svg {
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* 公式ベクターの輪郭のみ(分割線は廃止)。趾は淡く塗って形を出す */
.claw-line { fill: #eef3f8; stroke: #33475f; stroke-width: 2.4; pointer-events: none; stroke-linejoin: round; stroke-linecap: round; }

/* 番号は丸ボタン。ボタン自体がタップ対象 */
.zone .zbtn { fill: #fff; stroke: #33475f; stroke-width: 2.2; cursor: pointer; }
.zone.marked .zbtn { fill: var(--red-pale); stroke: var(--red); stroke-width: 3; }
.zone.selected .zbtn { fill: var(--orange-pale); stroke: var(--orange); stroke-width: 3.4; }
.zone-num {
  font-size: 26px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.zone.marked .zone-num { fill: var(--red); }
.zone.selected .zone-num { fill: #9c5a00; }

.zone-legend {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--ink-sub);
  text-align: center;
  line-height: 1.6;
}
.zone-legend b { color: var(--blue-dark); font-size: 1.05rem; }
.zone-legend .lg-grp { display: block; margin: 2px 0; }
.zone-legend .lg-grp + .lg-grp { border-top: 1px solid var(--panel-border); padding-top: 5px; }
.zone-legend .lg-title { font-weight: 700; color: var(--ink-sub); margin-right: 4px; }
/* 凡例のゾーンボタン(マップと連動): 押すたびに外趾→内趾→両方→解除 */
.lgz {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 3px 4px 3px 0;
  padding: 6px 9px;
  min-height: 42px;
  border-radius: 9px;
  background: linear-gradient(180deg, #33465f, var(--card));
  border: 1px solid var(--edge);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}
.lgz b { color: var(--accent); font-size: 1rem; }
.lgz .st {
  display: none;
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--orange);
  color: #2a1c00;
}
.lgz.on {
  background: linear-gradient(180deg, #5a4426, var(--orange-pale));
  border-color: var(--orange);
  color: #ffd48c;
  box-shadow: 0 3px 10px rgba(245,165,36,0.25);
}
.lgz.on b { color: #ffd48c; }
.lgz.on .st { display: inline-block; }

/* --- 牛群 --- */
.group-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 6px 14px;
  margin-bottom: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--blue-pale);
  color: var(--blue-dark);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  text-align: left;
}
.group-bar .gb-label {
  flex-shrink: 0;
  font-size: 0.9rem;
  background: var(--blue);
  color: #fff;
  border-radius: 6px;
  padding: 3px 10px;
}
.group-bar .gb-name {
  flex: 1;
  font-size: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-bar .gb-arrow { color: var(--ink-sub); }
.group-tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--blue-pale);
  color: var(--blue-dark);
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}
.group-list { max-height: 46vh; overflow-y: auto; margin-bottom: 6px; }
.group-item.selected { border-color: var(--blue); background: var(--blue-pale); }

/* --- 牛番号 --- */
.cow-no-display {
  background: #f2f7ff;
  border: 2px solid var(--blue);
  border-radius: 10px;
  font-size: 2.4rem;
  font-weight: 700;
  text-align: center;
  padding: 8px;
  min-height: 72px;
  letter-spacing: 2px;
  margin-bottom: 10px;
  color: var(--blue-dark);
  overflow: hidden;
  white-space: nowrap;
}
.cow-no-display.long { font-size: 1.7rem; letter-spacing: 1px; line-height: 2.2; }
.dup-warning {
  background: var(--red-pale);
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 10px;
  margin: -4px 0 10px;
  text-align: center;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  min-height: 84px;
  font-size: 2.1rem;
  font-weight: 700;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--panel-border);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(30,60,110,0.15);
}
.key.muted { background: #e4e8ee; color: var(--ink-sub); }

.today-panel .count-badge {
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 0.95rem;
  margin-left: 6px;
}
.mini-list { display: flex; flex-direction: column; gap: 5px; }
.mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  background: #f4f7fb;
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 48px;
  width: 100%;
  text-align: left;
  color: var(--ink);
}
.mini-item .m-badge { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: var(--red); }
.mini-item .m-badge.ok { color: var(--green); }

/* --- 蹄図 --- */
.hoof-panel { padding: 10px 6px; }
.hoof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  justify-items: center;
}
.hoof-unit { text-align: center; }
.hoof-unit .leg-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 2px;
}
.hoof-unit svg { width: 100%; max-width: 230px; height: auto; display: block; margin: 0 auto; }

.claw {
  fill: #eef2f7;
  stroke: #7d94b5;
  stroke-width: 3;
  cursor: pointer;
}
.claw-label { font-size: 26px; font-weight: 700; fill: var(--ink-sub); pointer-events: none; }
.claw.marked { fill: var(--red-pale); stroke: var(--red); }
.claw.selected { fill: var(--orange-pale); stroke: var(--orange); stroke-width: 6; }
.claw.selected.marked { fill: #ffd2c4; }
.claw-count { font-size: 30px; font-weight: 700; fill: var(--red); pointer-events: none; }

.shikan-btn {
  width: 100%;
  max-width: 230px;
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 999px;
  background: #eef2f7;
  border: 2px solid #7d94b5;
  color: var(--ink-sub);
  margin-top: 4px;
}
.shikan-btn.marked { background: var(--red-pale); border-color: var(--red); color: var(--red); }
.shikan-btn.selected { background: var(--orange-pale); border-color: var(--orange); color: #9c5a00; border-width: 3px; }

.selected-claw-label {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--orange);
  background: #fff7ec;
  border: 1px dashed var(--orange);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}
.fullstep .selected-claw-label { margin-top: 0; width: 100%; max-width: 1120px; margin-left: auto; margin-right: auto; }
.selected-claw-label.none { color: var(--ink-sub); background: #f4f7fb; border-color: var(--panel-border); }

/* --- 所見サマリー --- */
.finding-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.fs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--red);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 56px;
}
.fs-item .fs-main { flex: 1; font-size: 1.05rem; font-weight: 700; }
.fs-item .fs-sub { display: block; font-size: 0.88rem; font-weight: 400; color: var(--ink-sub); }
/* 入力中(未確定)の所見 */
.fs-item.pending { border: 2px dashed var(--orange); background: var(--orange-pale); }

textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1.1rem;
  padding: 12px;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  background: var(--card);
  resize: none;
}

/* --- 前回情報 --- */
.prev-info {
  background: #fff8e1;
  border: 2px solid #e6c96a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #7a5c00;
  margin-bottom: 10px;
}

/* --- 蹄病ボタン --- */
.lesion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fullstep .lesion-grid { flex: 1; grid-auto-rows: 1fr; }
.fullstep .lesion-btn { min-height: 96px; font-size: 1.3rem; }
.lesion-btn {
  min-height: 84px;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--panel-border);
  color: var(--ink);
  padding: 4px 2px;
  line-height: 1.25;
}
.lesion-btn.active { background: var(--red); border-color: #8c1d18; color: #fff; }
.lesion-btn.disabled { opacity: 0.45; }
.lesion-btn .sev-tag { display: block; font-size: 0.85rem; font-weight: 700; }

/* --- 重症度(ステップ⑤: フルスクリーン大ボタン) --- */
.sev-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 40vh;
}
.sev-col .sev-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 100px;
  font-size: 2rem;
  font-weight: 700;
  border-radius: 16px;
  background: var(--card);
  border: 3px solid var(--panel-border);
  color: var(--ink);
}
.sev-col .sev-btn small { font-size: 1rem; font-weight: 400; color: var(--ink-sub); }
.sev-btn[data-sev="軽度"] { border-left-width: 14px; border-left-color: #d8b60f; }
.sev-btn[data-sev="中程度"] { border-left-width: 14px; border-left-color: var(--orange); }
.sev-btn[data-sev="重度"] { border-left-width: 14px; border-left-color: var(--red); }
.sev-btn[data-sev="最重度"] { border-left-width: 14px; border-left-color: #6a1b1b; }
.sev-btn.selected[data-sev="軽度"] { background: #f9df70; border-color: #c7a410; color: #6b5600; }
.sev-btn.selected[data-sev="中程度"] { background: var(--orange); border-color: #a35f00; color: #fff; }
.sev-btn.selected[data-sev="重度"] { background: var(--red); border-color: #8c1d18; color: #fff; }
.sev-btn.selected[data-sev="最重度"] { background: #6a1b1b; border-color: #4a0f0f; color: #fff; }
.sev-btn.selected small { color: inherit; opacity: 0.85; }

/* --- 処置ボタン --- */
.treat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fullstep .treat-grid { flex: 1; grid-auto-rows: 1fr; }
.fullstep .treat-btn { min-height: 96px; font-size: 1.4rem; }
.treat-btn {
  min-height: 80px;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 12px;
  background: var(--card);
  border: 2px solid var(--panel-border);
  color: var(--ink);
  padding: 4px;
}
.treat-btn.active { background: var(--blue); border-color: var(--blue-dark); color: #fff; }
.treat-btn.disabled { opacity: 0.45; }

.big-btn:disabled { opacity: 0.4; }

/* ===== 設定(トグルスイッチ) ===== */
.setting-note { color: var(--ink-sub); font-size: 1rem; line-height: 1.7; margin: 6px 2px 12px; }
.setting-note b { color: var(--blue-dark); }
#settingFlowPreview { margin-top: auto; padding-top: 14px; font-size: 1.1rem; }
.setting-panel { padding: 4px 14px; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  border-bottom: 1px solid #e3e9f0;
}
.toggle-row:last-child { border-bottom: none; }
/* (重症度の字下げは「ズレに見える」とのユーザー要望で廃止。全項目を同じ位置に揃える) */
.toggle-row.disabled { opacity: 0.45; }
.tr-label { flex: 1; font-size: 1.2rem; font-weight: 700; }
.tr-label small { display: block; font-size: 0.88rem; font-weight: 400; color: var(--ink-sub); margin-top: 2px; }
.switch {
  flex-shrink: 0;
  position: relative;
  width: 92px;
  height: 52px;
  border-radius: 999px;
  background: #c3ccd8;
  border: 2px solid #a9b4c3;
  transition: background 0.15s;
}
.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  transition: left 0.15s;
}
.switch.on { background: var(--green); border-color: #1b5e20; }
.switch.on::before { left: 42px; }

/* ===== モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10,25,50,0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #f2f5f9;
  width: 100%;
  max-width: 560px;
  border-radius: 16px;
  padding: 22px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
/* 文字入力のある小窓は上寄りに出す(スマホのキーボードで「やめる/決定」が隠れないように)。
   小窓が画面より縦に長くなる場合はスクロールできるようにする(ボタンが画面外に出て押せなくなるのを防ぐ) */
#nameModal, #invoiceModal { align-items: flex-start; overflow-y: auto; }
#nameModal .modal-box, #invoiceModal .modal-box { margin-top: 7vh; margin-bottom: 24px; }
.modal-title { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 16px; white-space: pre-line; }
.confirm-row { display: flex; gap: 12px; }
.confirm-row .big-btn { flex: 1; }
.name-input {
  width: 100%;
  font-size: 1.4rem;
  padding: 14px;
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  margin-bottom: 14px;
  font-family: inherit;
}

/* ===== 集計 ===== */
.summary-card { font-size: 1.05rem; line-height: 2; }
.summary-card b { color: var(--blue); font-size: 1.25rem; }
.summary-lesion { color: var(--red); font-weight: 700; }
.data-stats { font-size: 1.05rem; line-height: 2; color: var(--ink-sub); }
.backup-warn { color: var(--orange); font-weight: 700; }

/* ===== ホーム画面追加の案内カード ===== */
.install-hint {
  margin: 14px 0 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 179, 64, 0.08);
  border: 1px solid rgba(255, 179, 64, 0.45);
}
.install-hint .ih-title { font-weight: 800; color: var(--orange); }
/* 警告ではない案内(初回の設定案内など)はシアン系 */
.install-hint.hint-info { background: rgba(46, 224, 255, 0.06); border-color: rgba(46, 224, 255, 0.35); }
.install-hint.hint-info .ih-title { color: var(--accent); }
.install-hint .ih-body { margin-top: 6px; font-size: 0.92rem; line-height: 1.75; color: var(--ink-sub); }
.install-hint .ih-body b { color: var(--ink); }
.install-hint .ih-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.install-hint .ih-actions .big-btn { width: auto; min-height: 48px; padding: 10px 18px; font-size: 1rem; }
.install-hint .ih-actions .flat-btn { margin: 0; }
.about-note { font-size: 0.95rem; line-height: 1.8; color: var(--ink-sub); }
.about-note b { color: var(--ink); }

/* ===== ライセンス ===== */
.lic-row { display: flex; gap: 10px; margin: 10px 0; }
.lic-row input {
  flex: 1;
  min-width: 0; /* flexの既定min-width:autoだと長いplaceholder幅より縮まず狭い画面ではみ出す */
  min-height: 56px;
  font-size: 1.1rem;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--blue-pale);
  color: var(--ink);
}
.lic-row .big-btn { width: auto; min-width: 110px; }
.lic-note {
  text-align: center;
  margin-top: 12px;
  font-weight: 700;
  color: var(--orange);
}
.lic-note.expired { color: var(--red); }

/* ===== テンキー: C/?(耳標なし)ボタン ===== */
.key .key-sub { font-size: 0.62em; opacity: 0.75; margin-left: 2px; }
.key-hint { text-align: center; color: var(--ink-sub); font-size: 0.82rem; margin-top: 8px; }
.key-hint b { color: var(--accent); }

/* ===== ステップの自動送り: スライド演出(押した→進んだ が目で追える) ===== */
.kstep.step-anim-fwd { animation: stepInFwd 0.45s ease; }
.kstep.step-anim-back { animation: stepInBack 0.45s ease; }
@keyframes stepInFwd {
  from { opacity: 0.1; transform: translateX(110px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes stepInBack {
  from { opacity: 0.1; transform: translateX(-110px); }
  to { opacity: 1; transform: translateX(0); }
}

/* タップした瞬間の確認演出: ふくらんで光る */
.tap-confirm { animation: tapConfirm 0.6s ease; }
@keyframes tapConfirm {
  0% { transform: scale(1); }
  30% { transform: scale(1.07); box-shadow: 0 0 0 8px rgba(46,224,255,0.45); }
  100% { transform: scale(1); box-shadow: none; }
}
/* 肢: 押した肢が進むまでの間はっきり点灯 */
.leg-btn.picked {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(46,224,255,0.5), 0 10px 26px rgba(0,0,0,0.4);
  color: var(--accent);
}

/* ===== 請求書: 料金設定・作成モーダル ===== */
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* 文字サイズ大の端末では行を折り返す(ラベルの文字を縦に折らない) */
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--panel-border);
}
.pr-label { flex-shrink: 0; }
.price-row:last-child { border-bottom: none; }
.price-row.col { flex-direction: column; align-items: stretch; }
.pr-label { font-weight: 600; }
.pr-input { display: flex; align-items: center; gap: 6px; color: var(--ink-sub); font-weight: 700; white-space: nowrap; }
.pr-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.pr-mode { display: flex; border: 1px solid var(--panel-border); border-radius: 8px; overflow: hidden; }
.pr-mode button {
  min-height: 50px;
  padding: 0 14px;
  font-size: 0.98rem;
  font-weight: 700;
  background: var(--card);
  color: var(--ink-sub);
  border: none;
}
.pr-mode button + button { border-left: 1px solid var(--panel-border); }
.pr-mode button.on { background: var(--accent-2); color: #fff; }
.pr-auto { color: var(--ink-sub); font-size: 0.9rem; text-align: right; }
.pr-input input {
  width: 120px;
  flex-shrink: 0; /* 狭い画面で入力箱が押しつぶされて行ごとに大きさが揃わなくなるのを防ぐ */
  min-height: 50px;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--blue-pale);
  color: var(--ink);
}
.pr-text, .price-row textarea {
  flex: 1;
  min-height: 50px;
  font-size: 1.05rem;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--blue-pale);
  color: var(--ink);
}
.price-row textarea { resize: vertical; font-family: inherit; }
#invoiceModal .price-row { border-bottom: none; padding: 5px 0; }
#invoiceModal .modal-box { max-width: 560px; }

/* ===== トースト ===== */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,40,70,0.95);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 999px;
  z-index: 100;
  white-space: nowrap;
}

/* ============================================
   タブレット横持ち(ワイド画面): 2カラム構成
   ============================================ */
@media (min-width: 900px) {
  #main, body.karte-mode #main { max-width: 1366px; padding: 12px 22px 12px; }
  body.karte-mode #main { padding-bottom: 0; } /* カルテはスクロールなしで1画面に収める */

  /* 1画面に必ず収める: ヘッダー62+余白12+ステップ表示57+取消ボタン56+下余白12 */
  .fullstep { height: calc(100vh - 200px); min-height: 0; overflow-y: auto; }

  /* 農家管理・農家選択: リストを2列で大きく */
  #farmList, #setupFarmList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    gap: 12px;
    align-content: start;
  }
  #farmList .list-item, #setupFarmList .list-item { min-height: 96px; font-size: 1.35rem; }

  /* 記録一覧(履歴): 2列 */
  #historyList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    gap: 12px;
    align-content: start;
  }

  /* データ管理: 3枚のパネルを横ならびに */
  #view-data { flex-direction: row; align-items: stretch; gap: 16px; }
  #view-data .panel { flex: 1; margin-bottom: 0; display: flex; flex-direction: column; }
  #view-data .panel .big-btn { min-height: 84px; }

  /* 設定: トグルを2列に */
  #view-settings .setting-panel {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 40px;
    align-content: start;
    padding: 4px 24px;
  }
  #view-settings .toggle-row { min-height: 104px; }
  #view-settings .toggle-row:nth-last-child(2) { border-bottom: none; }

  /* 記録の詳細・この期間の一覧: 牛ごとの記録を2列 */
  #detailCowList, #sessionCowList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    gap: 10px;
    align-content: start;
  }

  /* ① 番号: 左=テンキー / 右=登録ボタン+この期間の記録(画面の高さいっぱい) */
  #step-number {
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    grid-template-areas:
      "pad today"
      "pad memo"
      "pad actions";
    grid-template-rows: 1fr auto auto;
    gap: 0 20px;
    height: calc(100vh - 155px); /* 取消ボタンが無いぶん高く使える */
    min-height: 0;
  }
  #step-number > .panel:not(.today-panel) {
    grid-area: pad;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }
  #step-number .cow-no-display { min-height: 80px; font-size: 2.8rem; }
  #step-number .cow-no-display.long { font-size: 2rem; line-height: 2.3; }
  #step-number .keypad { flex: 1; min-height: 0; grid-template-rows: repeat(4, 1fr); gap: 12px; }
  #step-number .key { min-height: 56px; font-size: 2.4rem; }
  #step-number > .step-actions { grid-area: actions; flex-direction: column; gap: 14px; margin-bottom: 0; }
  #step-number > .step-actions .big-btn { width: 100%; margin: 0; min-height: 116px; font-size: 1.7rem; }
  #step-number > .memo-slot { grid-area: memo; margin-top: 14px; }
  #step-number > .today-panel {
    grid-area: today;
    margin-top: 14px;
    margin-bottom: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  #step-number .mini-list { flex: 1; min-height: 0; overflow-y: auto; }
  #step-number .mini-item { min-height: 58px; font-size: 1.15rem; }
  #step-number .flat-btn { min-height: 64px; }

  /* ② 肢: 2×2の巨大ボタンを画面中央に左右対称で配置 */
  #step-leg .kstep-title { text-align: center; border-left: none; }
  #step-leg .leg-grid {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    gap: 18px;
    min-height: 0;
  }
  #step-leg .finding-summary {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0;
  }
  #step-leg .fs-item { min-height: 50px; padding: 6px 12px; flex: 0 1 auto; }
  #step-leg .memo-slot { width: 100%; max-width: 960px; margin: 4px auto 0; }

  /* ③ ゾーン: 左=大きなゾーンマップ / 右=凡例+サマリー */
  #step-zone {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 296px; /* 説明欄は固定幅に詰めて図へ幅を回す */
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "title title"
      "map legend"
      "map summary"
      "map memo"
      "nav nav";
    gap: 10px 14px;
  }
  #step-zone .kstep-title { grid-area: title; font-size: 1.15rem; }
  #step-zone .zone-map { grid-area: map; overflow: hidden; }
  #step-zone .zone-map svg { max-height: calc(100vh - 342px); max-width: none; }
  #step-zone .step-nav .big-btn { margin: 2px 0; }
  #step-zone .zone-legend {
    grid-area: legend;
    text-align: left;
    margin-top: 0;
    background: var(--card);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.75;
  }
  #step-zone .finding-summary { grid-area: summary; align-content: start; margin-bottom: 0; }
  #step-zone .memo-slot { grid-area: memo; }
  #step-zone .step-nav { grid-area: nav; }

  /* ④ 蹄病: 4列×3段を中央に配置して1画面に収める */
  #step-lesion .kstep-title { text-align: center; border-left: none; }
  .fullstep .lesion-grid {
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
  }
  .fullstep .lesion-btn { min-height: 104px; }

  /* ⑤ 重症度: 横ならび大ボタンを中央に */
  #step-severity .kstep-title { text-align: center; border-left: none; }
  .sev-col { flex-direction: row; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 0; width: 100%; max-width: 1120px; margin: 0 auto; gap: 20px; }
  .sev-col .sev-btn { flex: 0 0 auto; width: min(240px, 22vw); height: min(240px, 22vw); min-height: 0; font-size: 2rem; }
  .sev-btn[data-sev] { border-left-width: 3px; border-top-width: 14px; }
  .sev-btn[data-sev="軽度"] { border-top-color: #d8b60f; border-left-color: var(--panel-border); }
  .sev-btn[data-sev="中程度"] { border-top-color: var(--orange); border-left-color: var(--panel-border); }
  .sev-btn[data-sev="重度"] { border-top-color: var(--red); border-left-color: var(--panel-border); }
  .sev-btn[data-sev="最重度"] { border-top-color: #6a1b1b; border-left-color: var(--panel-border); }
  .sev-btn.selected[data-sev="軽度"] { border-color: #c7a410; }
  .sev-btn.selected[data-sev="中程度"] { border-color: #a35f00; }
  .sev-btn.selected[data-sev="重度"] { border-color: #8c1d18; }
  .sev-btn.selected[data-sev="最重度"] { border-color: #4a0f0f; }

  /* ⑥ 処置: 中央に3列の大ボタン、下にサマリー+メモ */
  #step-treat .kstep-title { text-align: center; border-left: none; }
  #step-treat .treat-grid {
    flex: 1;
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
    grid-template-columns: repeat(3, 1fr);
    min-height: 0;
  }
  #step-treat .finding-summary {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0;
  }
  #step-treat .fs-item { min-height: 50px; padding: 6px 12px; flex: 0 1 auto; }
  #step-treat .memo-slot { width: 100%; max-width: 1020px; margin: 4px auto 0; }

  /* ナビ・ステップ表示は本文と同じ幅で中央に。戻る=左の固定幅 / 進む=残り全部 */
  .step-indicator { max-width: 1220px; margin-left: auto; margin-right: auto; }
  .step-nav {
    width: 100%;
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
  }
  .step-nav .big-btn { width: auto; flex: 1 1 auto; min-width: 0; }
  .step-nav .big-btn.muted { width: auto; flex: 0 0 200px; }
  .step-nav .big-btn.add { width: auto; flex: 0 0 300px; }

  /* ホームは3列 */
  .home-grid { grid-template-columns: repeat(3, 1fr); }
  .home-btn.primary { grid-column: 1 / -1; min-height: 150px; }
  .home-btn.resume { grid-column: 1 / -1; }
  .home-btn.wide { grid-column: 1 / -1; min-height: 76px; }
}

/* ============================================
   横画面なのに高さが足りない環境の救済
   (Chromebookの表示拡大・低解像度タブレット・画面分割など)
   「1画面収まり」をやめて縦スクロールに切り替え、要素の重なりを防ぐ。
   通常のタブレット(横800px級の高さ)やiPadでは発動しない。
   ============================================ */
@media (min-width: 900px) and (max-height: 600px) {
  #step-number {
    height: auto;
    min-height: calc(100vh - 155px);
  }
  #step-number .keypad { min-height: 288px; } /* テンキーが潰れない最低高 */
  #step-number .mini-list { min-height: 120px; } /* 記録一覧も最低限見える */
  #step-zone .zone-map svg { max-height: 340px; } /* ゾーン図が小さくなりすぎない */
}

/* ============================================
   レスポンシブ: タブレット縦・スマホは縦積み
   ============================================ */
@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr; }
  .lesion-grid { grid-template-columns: repeat(2, 1fr); }
  .treat-grid { grid-template-columns: repeat(2, 1fr); }
  .step-indicator span { font-size: 0.82rem; padding: 8px 2px; }
  .leg-btn { font-size: 1.6rem; }
  html { font-size: 15px; }
}

/* ============================================
   印刷(報告書)
   ============================================ */
#printArea { display: none; }

/* ============================================
   ✦ モダン・ダーク仕上げ(色/質感のみ・構造は無変更)
   ============================================ */
body {
  background:
    radial-gradient(1100px 550px at 12% -8%, rgba(46,224,255,0.16), transparent 60%),
    radial-gradient(900px 480px at 96% -4%, rgba(122,92,255,0.14), transparent 58%),
    radial-gradient(1300px 700px at 50% 115%, rgba(20,140,190,0.12), transparent 62%),
    linear-gradient(175deg, #121e30 0%, var(--bg) 48%, #0b1320 100%);
  background-attachment: fixed;
}

/* --- ヘッダー: オーロラライン --- */
#appHeader {
  background: linear-gradient(120deg, #14263e 0%, #1a3a5c 60%, #173250 100%);
  border-bottom: none;
  box-shadow: 0 4px 22px rgba(0,0,0,0.5);
  position: sticky;
}
#appHeader::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, #7a5cff 45%, #ff7ab8 75%, var(--orange) 100%);
  opacity: 0.9;
  box-shadow: 0 2px 12px rgba(46,224,255,0.4);
}
#headerTitle { letter-spacing: 0.03em; text-shadow: 0 1px 10px rgba(46,224,255,0.35); }
.header-btn { background: rgba(46,224,255,0.16); border: 1px solid rgba(46,224,255,0.5); }
.header-btn:active { background: rgba(46,224,255,0.3); }

/* --- パネル/カード --- */
.panel {
  background: linear-gradient(180deg, var(--surface-2), var(--card));
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
}
.panel-title { color: #cdeefb; border-left-color: var(--accent); }
.panel-hint { color: var(--orange); }
.section-label { color: var(--ink-sub); letter-spacing: 0.04em; }

/* --- ホーム --- */
.home-btn {
  background: linear-gradient(180deg, #33465f, var(--card));
  border: 2px solid var(--edge);
  box-shadow: 0 10px 26px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.home-btn:active { transform: translateY(1px); }
.home-btn.primary {
  background: linear-gradient(135deg, #4beaff 0%, var(--blue) 50%, #2276b8 100%);
  color: #032430;
  border: 2px solid rgba(120,236,255,0.8);
  box-shadow: 0 12px 38px rgba(46,224,255,0.42), inset 0 2px 0 rgba(255,255,255,0.5);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.home-btn.resume { background: linear-gradient(180deg, #33465f, var(--card)); border-color: var(--orange); color: var(--orange); }
.home-btn.wide { color: var(--ink-sub); }

/* --- 大ボタン --- */
.big-btn {
  background: linear-gradient(180deg, #33465f, var(--card));
  border: 2px solid var(--edge);
  color: var(--ink);
  box-shadow: 0 5px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.big-btn.primary {
  background: linear-gradient(135deg, #4beaff, var(--blue) 55%, #2276b8);
  color: #032430; border: 2px solid rgba(120,236,255,0.75);
  box-shadow: 0 7px 24px rgba(46,224,255,0.4), inset 0 2px 0 rgba(255,255,255,0.45);
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.big-btn.success {
  background: linear-gradient(135deg, #4fe993, var(--green) 60%, #1d9e52);
  color: #03240f; border: 2px solid rgba(90,235,155,0.7);
  box-shadow: 0 7px 24px rgba(52,217,119,0.35), inset 0 2px 0 rgba(255,255,255,0.4);
}
.big-btn.danger {
  background: linear-gradient(135deg, #ff8189, var(--red) 60%, #d84a55);
  color: #fff; border: 2px solid rgba(255,140,148,0.65);
  box-shadow: 0 7px 24px rgba(255,107,116,0.35);
}
.big-btn.danger-outline { background: rgba(255,107,116,0.08); color: var(--red); border: 2px solid var(--red); }
.big-btn.muted { background: linear-gradient(180deg, #2c3d56, #22314a); color: #c2d2e6; border: 2px solid var(--panel-border); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08); }
.big-btn.add { background: rgba(46,224,255,0.1); border: 2px dashed var(--accent); color: var(--accent); box-shadow: none; }
.big-btn:disabled { opacity: 0.35; box-shadow: none; }

.flat-btn { background: rgba(46,224,255,0.12); color: var(--accent); border: 1px solid rgba(46,224,255,0.35); }

/* --- リスト --- */
.list-item {
  background: linear-gradient(180deg, #31445e, var(--card));
  border: 2px solid var(--edge);
  box-shadow: 0 5px 16px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.1);
}
.list-item .item-badge { background: var(--red-pale); color: #ff9aa1; }
.list-item .item-badge.ok { background: rgba(41,199,102,0.14); color: #6de0a0; }
.item-delete { background: var(--red-pale); color: #ff9aa1; }
.session-stats { color: var(--accent); }

/* --- ステップ表示 --- */
.step-indicator span { background: #263752; color: var(--ink-sub); border: 1px solid rgba(120,160,210,0.25); }
.step-indicator span.current { background: linear-gradient(135deg, #4beaff, var(--blue-dark)); color: #032430; border-color: rgba(120,236,255,0.7); box-shadow: 0 4px 16px rgba(46,224,255,0.4); }
.step-indicator span.done { background: rgba(46,224,255,0.15); color: var(--accent); border-color: rgba(46,224,255,0.35); }

.kstep-title { color: #cdeefb; border-left-color: var(--accent); }
.leg-badge { background: linear-gradient(135deg, var(--accent), var(--blue-dark)); color: #04222c; }
.pos-cow-no { color: var(--accent); }

/* --- 肢ボタン --- */
.leg-btn {
  background: linear-gradient(180deg, #33465f, var(--card));
  border: 2px solid var(--edge);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.leg-btn.marked { border-color: var(--red); background: linear-gradient(180deg, #55303a, var(--red-pale)); box-shadow: 0 8px 22px rgba(255,107,116,0.25); }

/* --- 蹄ゾーンマップ(図は視認性優先で明るいまま) --- */
.zone-map {
  background: linear-gradient(180deg, #eef4fb, #dfe9f4);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.6);
}
.zone-num { fill: #14202e; }
.zone.marked .zbtn { fill: #ffd7d3; stroke: var(--red); }
.zone.marked .zone-num { fill: #b3241d; }
.zone.selected .zbtn { fill: #ffe0b0; stroke: var(--orange); }
.zone.selected .zone-num { fill: #8a4f00; }
.zone-legend b { color: var(--accent); }

/* --- 牛群バー --- */
.group-bar { background: var(--blue-pale); color: var(--ink); border: 1px solid var(--panel-border); }
.group-bar .gb-label { background: linear-gradient(135deg, var(--accent), var(--blue-dark)); color: #04222c; }
.group-bar .gb-name { color: var(--ink); }
.group-tag { background: rgba(34,211,238,0.12); color: var(--accent); }
.group-item.selected { border-color: var(--accent); background: rgba(34,211,238,0.1); }

/* --- 個体番号ディスプレイ(デジタル表示風) --- */
.cow-no-display {
  background: linear-gradient(180deg, #0a1420, #0c1b2b);
  border: 1px solid rgba(34,211,238,0.5);
  color: var(--accent);
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.6), 0 0 0 1px rgba(34,211,238,0.15);
  text-shadow: 0 0 12px rgba(34,211,238,0.5);
}
.dup-warning { background: var(--red-pale); border-color: var(--red); color: #ff9aa1; }

/* --- テンキー --- */
.key {
  background: linear-gradient(180deg, #35485f, #263650);
  border: 2px solid var(--edge);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.14);
  color: var(--ink);
}
.key:active { background: rgba(46,224,255,0.2); }
.key.muted { background: linear-gradient(180deg, #24334a, #1b2739); color: var(--ink-sub); }

/* --- この期間の記録 --- */
.today-panel .count-badge { background: linear-gradient(135deg, var(--accent), var(--blue-dark)); color: #04222c; }
.mini-item { background: var(--surface-2); color: var(--ink); }
.mini-item .m-badge { color: #ff9aa1; }
.mini-item .m-badge.ok { color: #6de0a0; }

/* --- 前回情報 --- */
.prev-info { background: #2b2410; border: 1px solid #6b5a1e; color: #f0d68a; }

/* --- 選択中の趾ラベル --- */
.selected-claw-label { background: rgba(245,165,36,0.1); border-color: var(--orange); color: var(--orange); }
.selected-claw-label.none { background: var(--surface-2); border-color: var(--panel-border); color: var(--ink-sub); }

/* --- 所見サマリー --- */
.fs-item { background: var(--card); border-color: var(--red); }
.fs-item.pending { background: rgba(245,165,36,0.1); border-color: var(--orange); }

/* --- 蹄病/処置ボタン --- */
.lesion-btn, .treat-btn {
  background: linear-gradient(180deg, #33465f, var(--card));
  border: 2px solid var(--edge);
  box-shadow: 0 4px 14px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}
.lesion-btn.active { background: linear-gradient(135deg, #ff8189, #e8505b); border-color: #ffa2a8; color: #fff; box-shadow: 0 7px 22px rgba(255,107,116,0.4), inset 0 2px 0 rgba(255,255,255,0.3); }
.treat-btn.active { background: linear-gradient(135deg, #4beaff, var(--blue-dark)); border-color: rgba(120,236,255,0.8); color: #032430; box-shadow: 0 7px 22px rgba(46,224,255,0.38), inset 0 2px 0 rgba(255,255,255,0.4); }

/* --- 重症度ボタン --- */
.sev-col .sev-btn { background: linear-gradient(180deg, #33465f, var(--card)); border: 3px solid var(--edge); box-shadow: 0 6px 18px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12); }
.sev-btn.selected[data-sev="軽度"] { background: linear-gradient(160deg, #ffe066, #e3bd12); border-color: #ffe98c; color: #2a2200; box-shadow: 0 8px 26px rgba(227,189,18,0.4); }
.sev-btn.selected[data-sev="中程度"] { background: linear-gradient(160deg, #ffc35e, #f59c14); border-color: #ffd48c; color: #2a1c00; box-shadow: 0 8px 26px rgba(245,165,36,0.4); }
.sev-btn.selected[data-sev="重度"] { background: linear-gradient(160deg, #ff8189, #e8505b); border-color: #ffa2a8; color: #fff; box-shadow: 0 8px 26px rgba(255,107,116,0.4); }
.sev-btn.selected[data-sev="最重度"] { background: linear-gradient(160deg, #c03a44, #8a1f1f); border-color: #e8646e; color: #fff; box-shadow: 0 8px 26px rgba(192,58,68,0.45); }

/* --- テキスト入力 --- */
textarea, .name-input {
  background: #0f1926; color: var(--ink); border: 1px solid var(--panel-border);
}
textarea::placeholder, .name-input::placeholder { color: #607388; }

/* --- 設定トグル --- */
.toggle-row { border-bottom: 1px solid var(--panel-border); }
.setting-note b { color: var(--accent); }
.switch { background: #33455b; border: 1px solid #3f5063; }
.switch::before { background: #dfe8f2; }
.switch.on { background: linear-gradient(135deg, #33d67b, var(--green)); border-color: rgba(41,199,102,0.6); }

/* --- モーダル --- */
.modal { background: rgba(4,10,18,0.7); backdrop-filter: blur(3px); }
.modal-box {
  background: linear-gradient(180deg, var(--surface-2), var(--card));
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* --- その他テキスト色 --- */
.hoof-unit .leg-label { color: #cdeefb; }
.summary-card b { color: var(--accent); }
.toast { background: rgba(12,22,34,0.96); border: 1px solid rgba(34,211,238,0.3); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  body { background: #fff; }
}

/* PDF共有用のオフスクリーン描画: 画面外にA4幅(794px)で組んでhtml2canvasに渡す */
#printArea.pdf-render {
  display: block;
  position: fixed; left: -12000px; top: 0;
  width: 794px;
  background: #fff;
  padding: 32px;
  box-sizing: border-box;
}

/* 報告書・請求書の見た目(印刷とPDF共有の両方で使う。画面では#printAreaが非表示なので影響なし) */
  .rp { font-size: 12px; color: #000; }
  .rp h1 { font-size: 22px; text-align: center; margin-bottom: 12px; letter-spacing: 6px; }
  .rp .rp-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
  .rp .rp-farm { font-size: 18px; font-weight: 700; border-bottom: 2px solid #000; padding: 4px 20px 4px 4px; }
  .rp table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  .rp th, .rp td { border: 1px solid #444; padding: 5px 7px; text-align: left; vertical-align: top; }
  .rp th { background: #eee; }
  .rp .rp-summary { margin-top: 10px; border: 1px solid #444; padding: 8px; }
  .rp .rp-note { font-size: 11px; color: #555; }
  .rp .rp-sign { margin-top: 20px; text-align: right; }
  .rp .rp-sign span { display: inline-block; border-bottom: 1px solid #000; min-width: 220px; padding: 4px; }

  /* 請求書 */
  .iv { font-size: 13px; color: #000; max-width: 720px; margin: 0 auto; }
  .iv h1 { font-size: 24px; text-align: center; letter-spacing: 12px; margin-bottom: 16px; }
  .iv-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
  .iv-farm { font-size: 18px; font-weight: 700; border-bottom: 2px solid #000; padding: 4px 28px 4px 4px; }
  .iv-meta { font-size: 12px; text-align: right; line-height: 1.7; }
  .iv-issuer { display: flex; align-items: flex-end; gap: 10px; }
  .iv-seal {
    width: 58px; height: 58px;
    border: 1px dashed #999;
    border-radius: 4px;
    color: #bbb;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
  }
  .iv-due { font-size: 13px; margin: -4px 0 10px; }
  .iv-total { display: inline-block; border: 2px solid #000; padding: 8px 18px; font-size: 15px; margin: 8px 0 14px; }
  .iv-total b { font-size: 24px; margin-left: 14px; }
  .iv table { width: 100%; border-collapse: collapse; }
  .iv th, .iv td { border: 1px solid #444; padding: 7px 9px; text-align: left; }
  .iv th { background: #eee; }
  .iv .num { text-align: right; }
  .iv .sum { font-weight: 700; background: #f5f5f5; }
  .iv-note { margin-top: 16px; border: 1px solid #444; padding: 9px; line-height: 1.8; }
