/* KOA 配車フォロー — デザイン刷新（v1.7）
 * 方針: 枠線を減らして面と影で階層を作る／数字を主役にする／親指の届く範囲に操作を置く。
 * 色トークンは light / dark の両方を必ず用意し、文字は実際の重ね合わせで4.5以上を確認する。 */
:root {
  --bg: #f2f5fb; --bg-tint: rgba(79,70,229,.05);
  --surface: #ffffff; --surface-2: #f5f8fd; --surface-3: #ebeff8;
  --text: #0b1220; --text-mid: #47536b; --muted: #5f6b84;
  --border: #e8ecf5; --border-2: #d2daea;
  --accent: #4f46e5; --accent-d: #4338ca; --accent-sf: #eef1ff; --accent-2: #7c6cff;
  --ok: #059669; --ok-text: #047857; --warn: #b45309; --warn-text: #92400e; --danger: #dc2626;
  --area: #0f766e; --area-bg: #ccfbf1;   /* エリア表示（個数の紫とぶつからない色） */
  --topbar: rgba(15,23,41,.92); --code-bg: #0f172a; --code-text: #e2e8f0;
  --radius: 18px; --radius-s: 12px; --radius-l: 24px;
  /* 影は2枚重ね（輪郭＋落ち影）。枠線の代わりに階層を作る */
  --shadow: 0 1px 2px rgba(11,18,32,.05), 0 6px 18px rgba(11,18,32,.06);
  --shadow-lg: 0 2px 6px rgba(11,18,32,.06), 0 18px 40px rgba(11,18,32,.12);
  --on-accent: #ffffff;
  /* ガラス（半透明＋ぼかし）。中身のカードは不透明のままにして、数字の読みやすさは落とさない */
  --glass: rgba(255,255,255,.72); --glass-line: rgba(255,255,255,.85);
  --glass-edge: rgba(11,18,32,.07);
  --hero-1: rgba(124,108,255,.16); --hero-2: rgba(79,70,229,.05);
  --seg-track: var(--surface-3); --seg-on-bg: var(--surface); --seg-on-text: var(--accent);
  --rec-name: var(--accent);
  --tint-warn: rgba(180,83,9,.12); --tint-accent: var(--accent-sf);
  --ring: 0 0 0 3px var(--accent-sf);
  --ease: cubic-bezier(.2,.7,.3,1);
}
/* ダークトークン（手動ダーク & 自動ダーク で共用） */
:root[data-theme="dark"] {
  --bg:#0a0f1e; --bg-tint: rgba(139,131,255,.07);
  --surface:#141b2e; --surface-2:#1b2439; --surface-3:#243049;
  --text:#eef2ff; --text-mid:#c3cde0; --muted:#93a0bb;
  --border:#243049; --border-2:#36455f;
  --accent:#8b83ff; --accent-d:#a49eff; --accent-sf:rgba(139,131,255,.16); --accent-2:#a49eff;
  --ok:#34d399; --ok-text:#34d399; --warn:#fbbf24; --warn-text:#fbbf24; --danger:#fb7185;
  --area:#5eead4; --area-bg:rgba(94,234,212,.14);
  --topbar:rgba(8,13,26,.9);
  --on-accent: #12162a;
  --glass: rgba(20,27,46,.66); --glass-line: rgba(255,255,255,.10);
  --glass-edge: rgba(0,0,0,.5);
  --hero-1: rgba(139,131,255,.20); --hero-2: rgba(139,131,255,.05);
  --seg-track: rgba(255,255,255,.06); --seg-on-bg: var(--surface-3); --seg-on-text: var(--accent-d);
  --rec-name: var(--accent-d);
  --tint-warn: rgba(251,191,36,.16); --tint-accent: rgba(139,131,255,.16);
  --shadow:0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35);
  --shadow-lg:0 2px 6px rgba(0,0,0,.4), 0 18px 40px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg:#0a0f1e; --bg-tint: rgba(139,131,255,.07);
    --surface:#141b2e; --surface-2:#1b2439; --surface-3:#243049;
    --text:#eef2ff; --text-mid:#c3cde0; --muted:#93a0bb;
    --border:#243049; --border-2:#36455f;
    --accent:#8b83ff; --accent-d:#a49eff; --accent-sf:rgba(139,131,255,.16); --accent-2:#a49eff;
    --ok:#34d399; --ok-text:#34d399; --warn:#fbbf24; --warn-text:#fbbf24; --danger:#fb7185;
    --area:#5eead4; --area-bg:rgba(94,234,212,.14);
    --topbar:rgba(8,13,26,.9);
    --on-accent: #12162a;
    --glass: rgba(20,27,46,.66); --glass-line: rgba(255,255,255,.10);
    --glass-edge: rgba(0,0,0,.5);
    --hero-1: rgba(139,131,255,.20); --hero-2: rgba(139,131,255,.05);
    --seg-track: rgba(255,255,255,.06); --seg-on-bg: var(--surface-3); --seg-on-text: var(--accent-d);
    --rec-name: var(--accent-d);
    --tint-warn: rgba(251,191,36,.16); --tint-accent: rgba(139,131,255,.16);
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35);
    --shadow-lg:0 2px 6px rgba(0,0,0,.4), 0 18px 40px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 横スクロールを絶対に起こさない（1か所はみ出すと下のメニューバーまでズレるため） */
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body { font-family: "Hiragino Sans","Yu Gothic","Noto Sans JP",system-ui,-apple-system,sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; -webkit-text-size-adjust: 100%;
  font-feature-settings: "palt"; }
#app { max-width: 820px; margin: 0 auto; min-height: 100vh; overflow-x: hidden;
  background:
    radial-gradient(90% 420px at 12% -80px, var(--hero-1), transparent 68%),
    radial-gradient(70% 320px at 92% 40px, var(--hero-2), transparent 70%),
    var(--bg); }
.center { display: grid; place-items: center; min-height: 60vh; }
.muted { color: var(--muted); } .sm { font-size: .82rem; } .hidden { display: none !important; }
.err { color: var(--danger); font-size: .85rem; min-height: 1.1em; margin: 6px 0; }
.row { display: flex; align-items: center; } .gap { gap: 10px; flex-wrap: wrap; }

/* マスコット */
.mascot { width: 96px; height: 96px; display: block; }
.mascot.sm { width: 54px; height: 54px; }
.mascot.lg { width: 120px; height: 120px; }
.ms-wing { transform-origin: 60px 58px; }
/* ふわふわ浮く（動きを減らす設定の人には出さない） */
.mascot.float { animation: ms-float 3.2s ease-in-out infinite; }
.mascot.float .ms-wing { animation: ms-flap 3.2s ease-in-out infinite; }
.mascot.pop { animation: ms-pop .5s cubic-bezier(.34,1.56,.64,1); }
.mascot.think .ms-wing { animation: ms-flap 1.5s ease-in-out infinite; }
.mascot.think .ms-dots circle { animation: ms-dot 1.4s ease-in-out infinite; }
.mascot.think .ms-dots circle:nth-child(2) { animation-delay: .18s; }
.mascot.think .ms-dots circle:nth-child(3) { animation-delay: .36s; }
.mascot .ms-spark { animation: ms-twinkle 1.6s ease-in-out infinite; }
@keyframes ms-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ms-flap  { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(.82); } }
@keyframes ms-pop   { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes ms-dot   { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes ms-twinkle { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .mascot, .mascot .ms-wing, .mascot .ms-dots circle, .mascot .ms-spark { animation: none !important; }
}
/* キャラ＋ひとこと */
.ms-talk { display: flex; align-items: center; gap: 12px; }
.ms-talk .ms-say { flex: 1 1 auto; min-width: 0; font-size: .86rem; line-height: 1.65; color: var(--text-mid); }
.ms-talk .ms-say b { color: var(--text); }

/* 右下に常駐するキャラ（ひとことも喋る・タップで話しかけ） */
.assist-fab-wrap { position: fixed; right: 12px; z-index: 30; display: flex; align-items: flex-end; gap: 8px;
  bottom: calc(70px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
.assist-fab-wrap.hide { display: none; }
.fab-say { max-width: min(60vw, 260px); text-align: left; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 14px 14px 4px 14px; padding: 8px 11px;
  font-size: .8rem; font-weight: 700; line-height: 1.5; box-shadow: var(--shadow); cursor: pointer; }
.fab-say.talk-in { animation: talk-in .45s ease-out; }
@keyframes talk-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.assist-fab { flex: 0 0 auto; width: 62px; height: 62px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--surface); box-shadow: 0 6px 20px rgba(79,70,229,.28); cursor: grab;
  display: grid; place-items: center; padding: 0; touch-action: none; }
/* つまんで動かしている間 */
.assist-fab-wrap.dragging { transition: none; }
.assist-fab-wrap.dragging .assist-fab { cursor: grabbing; box-shadow: 0 10px 26px rgba(79,70,229,.45); }
.assist-fab-wrap.dragging .fab-say { display: none; }
.assist-fab-wrap.dragging .mascot { animation: none !important; }
.assist-fab .mascot { width: 46px; height: 46px; }
.assist-fab:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { .fab-say.talk-in { animation: none; } }

/* 話しかけるシート（下から出てくる） */
.assist-sheet { position: fixed; left: 0; right: 0; z-index: 40; display: none;
  bottom: calc(56px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; padding: 10px 12px 12px;
  box-shadow: 0 -10px 30px rgba(15,23,42,.18); max-height: 70vh; overflow-y: auto; }
.assist-sheet.open { display: block; }
.assist-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.assist-head > span { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 800; }
.assist-head .mascot.xs { width: 26px; height: 26px; }
.assist-close { border: none; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer;
  width: 34px; height: 34px; border-radius: 999px; }
.assist-close:hover { background: var(--surface-2); color: var(--text); }

/* ふきだし */
.bubble { max-width: 86%; font-size: .86rem; line-height: 1.6; padding: 9px 12px; margin-bottom: 8px;
  border-radius: 14px; word-break: break-word; }
.bubble.mine { margin-left: auto; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { display: flex; align-items: flex-start; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.bubble.theirs .mascot.xs { width: 30px; height: 30px; flex: 0 0 30px; }
.bubble.err-bubble { border-color: var(--danger); color: var(--danger); }
.bubble.typing .dots { display: inline-flex; align-items: center; gap: 4px; padding-top: 8px; }
.bubble.typing .dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--muted);
  animation: ms-dot 1.2s ease-in-out infinite; }
.bubble.typing .dots i:nth-child(2) { animation-delay: .15s; }
.bubble.typing .dots i:nth-child(3) { animation-delay: .3s; }

/* やること一覧＋確認 */
.assist-plan { background: var(--accent-sf); border: 1px solid var(--accent); border-radius: var(--radius-s);
  padding: 10px 12px; margin-bottom: 8px; }
.assist-plan b { font-size: .84rem; color: var(--accent); }
.assist-plan ul { margin: 6px 0 0; padding-left: 1.2em; }
.assist-plan li { font-size: .84rem; color: var(--text); line-height: 1.7; }
.plan-btns { margin-top: 10px; }
.plan-btns .btn { flex: 1 1 auto; }

/* 入力バー */
.assist-bar { display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: 999px; padding: 4px 4px 4px 14px; }
.assist-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sf); }
.assist-input { flex: 1 1 auto; min-width: 0; border: none; background: transparent; color: var(--text);
  font-size: .95rem; padding: 9px 0; font-family: inherit; }
.assist-input:focus { outline: none; }
.assist-btn { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 999px; border: none;
  background: var(--accent); color: #fff; font-size: .95rem; cursor: pointer; }
.assist-btn:disabled { opacity: .5; cursor: default; }

/* 言い方のヒント */
.assist-hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.hint { border: 1px solid var(--border-2); background: var(--surface); color: var(--text-mid);
  border-radius: 999px; padding: 5px 11px; font-size: .76rem; cursor: pointer; }
.hint:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-sf); }

/* ログイン */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 24px; width: 100%; max-width: 390px; }
.login-logo { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 17px; background: linear-gradient(145deg, var(--accent), var(--accent-d)); color: #fff; font-weight: 900; letter-spacing: .04em; box-shadow: var(--shadow); }
.login-mascot { display: grid; place-items: center; margin: 0 auto 6px; }
.running-card { border-color: var(--accent); background: var(--accent-sf); margin-top: 12px; }
.login-card h1 { font-size: 1.25rem; margin: 0 0 6px; font-weight: 800; text-align: center; }
.login-card > .muted { text-align: center; }
.login-card input { width: 100%; padding: 12px; border: 1px solid var(--border-2); border-radius: var(--radius-s); font-size: 1rem; margin-top: 10px; background: var(--surface); color: var(--text); }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sf); }
/* パスワードの表示切り替え（目のボタン） */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; bottom: 4px; width: 40px; height: 40px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--radius-s); }
.pw-eye:hover { color: var(--accent); background: var(--accent-sf); }
.pw-eye[aria-pressed="true"] { color: var(--accent); }
.google-btn { position: relative; min-height: 50px; color: var(--text); font-size: .95rem; background: var(--surface); }
.google-mark { position: absolute; left: 16px; color: #4285f4; font-size: 1.15rem; font-weight: 900; }
.auth-seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin: 4px 0 10px; }
.auth-seg .seg-btn { min-height: 40px; }
.auth-note { margin: 0 0 4px; text-align: center; line-height: 1.5; }
.ok-msg { color: var(--ok); font-size: .84rem; margin: 6px 0; line-height: 1.5; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; color: var(--muted); font-size: .75rem; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
  padding: 9px 16px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface);
  color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .01em; cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease); }
.btn:hover { background: var(--accent-sf); border-color: var(--accent); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent;
  color: var(--on-accent); box-shadow: 0 4px 14px rgba(79,70,229,.28); }
.btn.primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-d)); }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 12px; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }

/* トップバー */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--topbar); color: #f1f5f9;
  padding: 9px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 1px 0 var(--glass-edge), 0 8px 24px rgba(11,18,32,.10); }
@supports (backdrop-filter: blur(1px)) {
  .topbar { background: color-mix(in srgb, var(--topbar) 78%, transparent);
    backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); }
}
.topbar-row { display: flex; align-items: center; gap: 4px; }
.brand-icon { width: 26px; height: 26px; border-radius: 8px; display: block; flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.top-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.verinfo { font-size: .68rem; color: #94a3b8; font-weight: 700; margin-right: 4px; }
.brand { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; white-space: nowrap; }

/* PC用グループ分けナビ */
.desktop-nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-group { display: inline-flex; align-items: center; gap: 4px; }
.nav-group-label { font-size: .64rem; color: #94a3b8; font-weight: 800; letter-spacing: .04em; }
.nav-link { border: none; background: transparent; color: #cbd5e1; font-size: .82rem; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: rgba(139,131,255,.3); color: #fff; }

/* スマホ用の下タブバー（PCでは隠す） */
.mobile-tabbar { display: none; }
.brand-mark { font-weight: 900; letter-spacing: .06em; color: #fff; font-size: .96rem; }
.brand-sub { font-weight: 700; font-size: .8rem; color: #aab6cc; }
.icon-btn { background: transparent; border: none; color: #cbd5e1; font-size: 1.15rem; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.icon-btn.on { background: rgba(139,131,255,.28); color: #fff; }

/* 日バー / セグメント */
.pad { padding: 14px; }
.daybar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.date-input { border: 1px solid var(--border-2); border-radius: 999px; padding: 9px 14px; font-size: .92rem;
  font-weight: 700; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.date-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.seg { display: inline-flex; background: var(--seg-track); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.seg-btn { border: none; background: transparent; color: var(--text-mid); font-weight: 800; font-size: .86rem;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.seg-btn:active { transform: scale(.97); }
.seg-btn.on { background: var(--seg-on-bg); color: var(--seg-on-text); box-shadow: var(--shadow); }
@media (prefers-reduced-motion: reduce) { .seg-btn { transition: none; } }

/* カード */
.card { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
/* 上端の細い光。厚みのあるガラス板に見せるための1本 */
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; pointer-events: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--glass-line), transparent); }
.card.slim { padding: 12px 16px; }
.card.accent { border-color: transparent; box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-lg); }
.card h2 { font-size: 1.02rem; margin: 0 0 6px; font-weight: 800; letter-spacing: .01em; }
.card h3 { font-size: .92rem; margin: 0; font-weight: 700; }
.card h4 { font-size: .85rem; margin: 12px 0 6px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.card-head h2 { margin: 0; }
.loc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chip { background: var(--accent-sf); color: var(--accent); border-radius: 999px; padding: 3px 11px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip.soft { background: var(--surface-2); color: var(--text-mid); border: 1px solid var(--border); font-weight: 600; }

/* 次にやること：機能はそのまま、現在の1手だけを強く見せる */
.task-guide { padding: 0; overflow: hidden; border: 2px solid var(--accent); }
.task-guide.warn { border-color: var(--warn); }
.task-guide.done { border-color: var(--ok); }
.task-guide.past { border-color: var(--border-2); }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; background: var(--accent-sf); }
.task-guide.warn .guide-head { background: var(--surface-2); color: var(--warn); }
.task-guide.done .guide-head { background: var(--surface-2); color: var(--ok); }
.task-guide.past .guide-head { background: var(--surface-2); color: var(--text-mid); }
.guide-head > b { font-size: .88rem; }
.guide-close { min-height: 36px; padding: 5px 12px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; }
.guide-close:hover { background: var(--surface); color: var(--text); }
.guide-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 11px 12px 8px; }
.guide-step { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0;
  color: var(--muted); font-size: .7rem; font-weight: 700; white-space: nowrap; }
.guide-step i { display: grid; place-items: center; width: 21px; height: 21px; flex: 0 0 21px;
  border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-style: normal; font-size: .68rem; }
.guide-step.current { color: var(--accent); }
.guide-step.current i { border-color: var(--accent); background: var(--accent); color: #fff; }
.guide-step.done { color: var(--ok); }
.guide-step.done i { border-color: var(--ok); background: var(--ok); color: #fff; }
.guide-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 12px; }
.guide-next > div { min-width: 0; flex: 1 1 auto; }
.guide-next strong { display: block; color: var(--text); font-size: .95rem; line-height: 1.45; }
.guide-next p { margin: 3px 0 0; color: var(--text-mid); font-size: .78rem; line-height: 1.55; }
.guide-action { flex: 0 0 auto; }
.guide-reopen { width: 100%; min-height: 40px; margin: 0 0 10px; border: 1px dashed var(--border-2);
  border-radius: var(--radius-s); background: var(--surface); color: var(--text-mid);
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.guide-reopen:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-sf); }

/* 取り込み */
.file-drop { display: grid; place-items: center; min-height: 120px; border: 2px dashed var(--border-2); border-radius: var(--radius-s); background: var(--surface-2); color: var(--accent); font-weight: 700; cursor: pointer; margin: 12px 0; overflow: hidden; }
.file-drop:hover { border-color: var(--accent); background: var(--accent-sf); }
.thumb { max-width: 100%; max-height: 240px; display: block; }
.status { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-s); padding: 11px 13px; font-size: .85rem; margin-top: 10px; }
.ta { width: 100%; min-height: 110px; border: 1px solid var(--border-2); border-radius: var(--radius-s); padding: 11px; font-size: .9rem; font-family: inherit; background: var(--surface); color: var(--text); margin-top: 8px; }
.ta:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sf); }
details.sub { margin-top: 12px; } details.sub summary { font-weight: 700; cursor: pointer; color: var(--text-mid); font-size: .85rem; }
.preview { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--border-2); }
.preview h3 { font-weight: 800; margin-bottom: 8px; }

/* テーブル */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-s); }
.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 360px; }
.tbl th { text-align: left; background: var(--surface-2); color: var(--muted); font-weight: 700; padding: 7px 9px; white-space: nowrap; border-bottom: 1px solid var(--border); }
.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text-mid); }

/* サマリー統計 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 0; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 4px; text-align: center; }
.stat .v { font-size: 1.24rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat .l { font-size: .66rem; color: var(--muted); margin-top: 1px; font-weight: 700; }
/* 見出しと右側の操作。狭い画面でも横にはみ出さないよう、見出し側を縮める */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 3px 2px 8px; min-width: 0; }
.section-title h2 { margin: 0; font-size: 1rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.section-title span { color: var(--muted); font-size: .72rem; }
.pkg-cell { color: var(--accent) !important; font-weight: 900; }
.no-float { border-color: var(--ok); }

/* フォロー */
.float-row { padding: 12px; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface-2); }
.float-head { font-size: .96rem; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sel, .inp { padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--radius-s);
  font-size: .9rem; background: var(--surface); color: var(--text); min-width: 0;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease); }
.sel:focus, .inp:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.sel { flex: 1 1 160px; } .inp { flex: 1 1 120px; }
.block-input { display: block; width: 100%; margin-top: 8px; }
.route-recs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
/* min-width: 0 が無いとグリッド項目が中身の最小幅より縮まず、はみ出して
   下のタブバーまでズレる（2026-07-30に同じ形の不具合あり）。
   バッジ（番号が近い・◯◯が担当中）を消さずに見せたいので、小さい行は折り返す。 */
.route-rec { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); color: var(--text); padding: 8px; cursor: pointer; }
.route-rec { transition: border-color .16s var(--ease), transform .12s var(--ease), background .16s var(--ease); }
.route-rec:hover { border-color: var(--accent); background: var(--accent-sf); }
.route-rec:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { .route-rec { transition: none; } .route-rec:active { transform: none; } }
.route-rec b { color: var(--rec-name); font-size: .78rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-rec span { font-size: .75rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.route-rec small { color: var(--text-mid); font-size: .65rem; min-width: 0; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 560px) { .route-recs { grid-template-columns: 1fr; } }

/* ダイアリー */
.diary-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diary-bin { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px; cursor: pointer; color: var(--text); }
.diary-bin:hover { border-color: var(--accent); }
.diary-bin.empty { display: flex; align-items: center; justify-content: space-between; color: var(--muted); cursor: default; }
.db-top { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.db-stats { display: flex; gap: 12px; font-size: .82rem; color: var(--text-mid); margin-bottom: 4px; }
.db-stats b { color: var(--accent); font-size: 1.05rem; }
/* 年月ごとのまとまり */
.month-card > summary > span:first-child { font-size: .95rem; }
.month-sum { font-size: .7rem; color: var(--muted); font-weight: 700; margin-left: auto; margin-right: 8px; }
.diary-day { padding: 8px 0; border-top: 1px solid var(--border); }
.diary-day:first-of-type { border-top: none; }
.dd-date { font-size: .78rem; font-weight: 800; color: var(--text-mid); margin-bottom: 5px; }
.diary-day .diary-bin { padding: 10px; min-height: 0; }
.diary-day .db-top { font-size: .82rem; margin-bottom: 0; }
.diary-day .diary-bin.empty { padding: 10px; }

/* メンバー編集 */
.member-row { display: grid; grid-template-columns: 1.1fr 1fr 1.3fr auto; gap: 6px; align-items: center; margin-bottom: 7px; }
.member-row .inp { padding: 8px 9px; font-size: .85rem; }
@media (max-width: 560px) { .member-row { grid-template-columns: 1fr 1fr auto; } .member-row .m-note { grid-column: 1 / -1; } }

/* 解析ログ */
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.usage-grid span { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 9px 11px; font-size: .82rem; color: var(--text-mid); }
.usage-grid b { color: var(--accent); }
.log-view { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-s); padding: 11px; font-size: .72rem; line-height: 1.5; }

/* トースト */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--code-bg); color: #f1f5f9; padding: 12px 20px; border-radius: 999px; font-size: .86rem;
  font-weight: 700; opacity: 0; pointer-events: none; transition: .28s var(--ease); z-index: 50;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.08); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* システム情報（概要） */
.about-flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.about-flow div { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 9px 7px; text-align: center; }
.about-flow b { color: var(--accent); font-size: .78rem; }
.about-flow span { font-size: .64rem; color: var(--muted); }
.about-list { margin: 8px 0 0; padding-left: 1.1em; }
.about-list li { font-size: .84rem; color: var(--text-mid); margin-bottom: 7px; line-height: 1.6; }
.about-list b { color: var(--text); }
.chglog { padding: 10px 0; border-top: 1px solid var(--border); }
.chglog:first-of-type { border-top: none; }
.chglog-head { display: flex; align-items: baseline; gap: 8px; }
.chglog-head b { color: var(--accent); font-size: .9rem; }

/* スマホ: 横スクロールを減らし、主要操作を親指で押せる大きさにする */
@media (max-width: 560px) {
  /* 下タブバー: 主要2画面＋メニュー。親指の届く位置に固定 */
  .desktop-nav { display: none; }
  .mobile-tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 4px 6px env(safe-area-inset-bottom); box-shadow: 0 -6px 24px rgba(11,18,32,.10); }
  @supports (backdrop-filter: blur(1px)) {
    .mobile-tabbar { background: var(--glass); border-top-color: var(--glass-line);
      backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  }
  .mobile-tabbar .tab-btn, .mobile-more > summary { position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; min-height: 54px; border: none; background: transparent;
    color: var(--muted); font-size: .66rem; font-weight: 800; cursor: pointer; list-style: none;
    border-radius: 14px; transition: color .18s var(--ease); }
  .mobile-more > summary::-webkit-details-marker { display: none; }
  .mobile-tabbar .tab-ico { font-size: 1.2rem; line-height: 1.15; transition: transform .22s var(--ease); }
  .mobile-tabbar .tab-btn.active, .mobile-more.active > summary { color: var(--accent); }
  /* 選択中は上に短い線を出す（いま見ている場所が分かるように） */
  .mobile-tabbar .tab-btn.active::before, .mobile-more.active > summary::before {
    content: ""; position: absolute; top: 2px; width: 26px; height: 3px; border-radius: 999px; background: var(--accent); }
  .mobile-tabbar .tab-btn.active .tab-ico, .mobile-more.active > summary .tab-ico { transform: translateY(1px) scale(1.08); }
  .mobile-tabbar .tab-btn:active { background: var(--surface-2); }
  @media (prefers-reduced-motion: reduce) {
    .mobile-tabbar .tab-btn, .mobile-tabbar .tab-ico { transition: none; }
    .mobile-tabbar .tab-btn.active .tab-ico, .mobile-more.active > summary .tab-ico { transform: none; }
  }
  .mobile-menu-panel { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); background: var(--surface);
    border-top: 1px solid var(--border); border-radius: var(--radius-l) var(--radius-l) 0 0;
    padding: 16px 10px 12px; display: grid; gap: 4px; box-shadow: 0 -10px 34px rgba(11,18,32,.2);
    animation: sheet-up .22s var(--ease); }
  .mobile-menu-panel::before { content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 999px; background: var(--border-2); }
  @keyframes sheet-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .mobile-menu-panel { animation: none; } }
  .mobile-menu-panel .nav-link { color: var(--text); text-align: left; padding: 13px 14px; border-radius: var(--radius-s); font-size: .92rem; }
  .mobile-menu-panel .nav-link:hover, .mobile-menu-panel .nav-link.active { background: var(--accent-sf); color: var(--accent); }
  /* 下タブバーと右下のキャラに隠れないよう、本文の下にしっかり余白をとる
     （タブバー56px＋キャラ62px＋吹き出し分の余裕） */
  #view { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .about-flow { grid-template-columns: repeat(2, 1fr); }
  .login-wrap { padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
  .login-card { width: min(100%, calc(100vw - 28px)); padding: 24px 18px; }
  .topbar { gap: 2px; padding: max(7px, env(safe-area-inset-top)) 8px 7px; }
  .icon-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  .pad { padding: 10px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .daybar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
  .date-input { width: 100%; min-height: 46px; font-size: 1rem; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg-btn { min-height: 42px; padding: 7px 10px; }
  .card { padding: 12px; margin-bottom: 10px; border-radius: 12px; }
  .card.slim { padding: 12px; }
  .btn { min-height: 46px; padding: 10px 14px; font-size: .9rem; }
  .btn.sm { min-height: 42px; padding: 8px 11px; font-size: .82rem; }
  .file-drop { min-height: 104px; }
  .guide-steps { gap: 2px; padding: 10px 8px 7px; }
  .guide-step { flex-direction: column; gap: 2px; font-size: .64rem; }
  .guide-next { align-items: stretch; flex-direction: column; gap: 8px; padding: 7px 10px 10px; }
  .guide-action { width: 100%; }
  /* 見出しと日付バーを1行に収めて縦を節約 */
  .section-title { flex-wrap: nowrap; gap: 6px; }
  .section-title h2 { font-size: .9rem; white-space: nowrap; }
  .section-title span { display: none; }
  .title-tools .btn.sm { min-height: 32px; padding: 5px 8px; font-size: .74rem; white-space: nowrap; }
  .daybar { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .date-input { width: auto; min-height: 40px; font-size: .92rem; padding: 6px 8px; }
  .seg-btn { min-height: 36px; padding: 6px 8px; font-size: .8rem; }

  /* 統計は1行4つに詰めて、スクロール量を減らす */
  /* 狭い画面では「名前＋エリア／個数」と「着車・コース番号」の2行に分け、
     エリア名を省略せず全部見せる */
  .mrow { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 0; padding: 4px 0 8px; }
  .m-name { grid-column: 1; grid-row: 1; line-height: 1.35; font-size: .88rem; }
  .m-meta { grid-column: 1; grid-row: 2; font-size: .68rem; line-height: 1.3; }
  .m-pkg { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 1.12rem; }
  /* 狭い画面では個数の下に「渡せる分」を積む（横に伸ばして氏名を潰さないため） */
  .m-sur { display: block; margin: 1px 0 0; text-align: center; }
  .m-area { display: inline-block; margin-left: 5px; padding: 1px 7px; font-size: .7rem; }

  .stat-row { grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 8px; }
  .stat { padding: 7px 2px; border-radius: 10px; }
  .stat .v { font-size: 1.05rem; }
  .stat .l { font-size: .6rem; }
  .card { padding: 11px; margin-bottom: 8px; }
  .compact-list { padding: 9px 11px; }
  .section-title { margin: 2px 2px 6px; }
  .daybar { margin-bottom: 8px; }
  .tbl-wrap { overflow: visible; }
  .tbl.mobile-list { min-width: 0; border-collapse: separate; }
  .mobile-list thead { display: none; }
  .mobile-list tbody { display: grid; gap: 7px; }
  .mobile-list tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
  .mobile-list td { display: flex; flex-direction: column; min-width: 0; padding: 4px 6px; border: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 700; color: var(--text); }
  .mobile-list td::before { content: attr(data-label); margin-bottom: 1px; color: var(--muted); font-size: .66rem; font-weight: 600; }
  .mobile-list .pkg-cell { font-size: 1.08rem; }
  /* フォロー欄が一番縦を食うので詰める: 候補は横2列、入力は少し低く */
  .route-recs { grid-template-columns: 1fr 1fr; gap: 5px; margin: 6px 0; }
  .route-rec { min-height: 52px; padding: 7px 8px; }
  .route-rec b { font-size: .74rem; }
  .route-rec span { font-size: .68rem; }
  .float-row { padding: 8px 0; }
  .float-row .row { align-items: stretch; flex-direction: column; gap: 6px; }
  .sel, .inp { width: 100%; min-height: 42px; font-size: .95rem; flex-basis: auto; }
  .follow-tools .btn { flex: 1 1 auto; }
  .diary-bins { grid-template-columns: 1fr; gap: 8px; }
  .diary-bin { min-height: 76px; }
  .member-row { grid-template-columns: 1fr auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-s); }
  .member-row .m-name, .member-row .m-alias, .member-row .m-note { grid-column: 1; }
  .member-row .del-member { grid-column: 2; grid-row: 1; }
  .usage-grid { grid-template-columns: 1fr; }
  /* 下タブバーの上に出す */
  #toast { bottom: calc(70px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); text-align: center; }
}

@media (max-width: 370px) {
  .brand-sub { display: none; }
}

/* 配車表画像（日ダッシュボードのサムネイル） */
.photo-card .dispatch-photo { display: block; width: 100%; max-height: 300px; object-fit: contain; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); cursor: zoom-in; }

/* 画像ライトボックス（全画面拡大） */
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(8,13,23,.92); cursor: zoom-out; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-s); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-close { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 999px; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 1.2rem; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,.26); }

/* フォロー先チップ（複数選択） */
.assign-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.assign-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-sf); color: var(--rec-name);
  border: 1px solid var(--accent); border-radius: 999px; padding: 5px 5px 5px 13px; font-size: .82rem; font-weight: 800;
  box-shadow: var(--shadow); }
.assign-chip .chip-del { border: none; background: transparent; color: inherit; opacity: .75; width: 26px; height: 26px; border-radius: 999px; cursor: pointer; font-size: .82rem; line-height: 1; padding: 0; }
.assign-chip .chip-del:hover { opacity: 1; background: var(--danger); color: #fff; }
.none-yet { margin: 6px 0; }
/* すでに付けた先。薄くして押せなくするだけだと何が書いてあるか読めないので、
   「済」の印を付けて、文字は読める濃さのまま沈ませる */
.route-rec[disabled] { cursor: default; background: var(--surface-3); border-color: var(--border);
  color: var(--muted); box-shadow: none; }
.route-rec[disabled] b { color: var(--muted); }
.route-rec[disabled] .rec-sur, .route-rec[disabled] .near-badge,
.route-rec[disabled] .dup-badge, .route-rec[disabled] .move-badge { display: none; }
.route-rec[disabled]::after { content: "済"; position: absolute; top: 6px; right: 8px;
  font-size: .62rem; font-weight: 800; color: var(--ok-text); }
.route-rec { position: relative; }
.past-badge { color: var(--ok); font-size: .62rem; font-weight: 800; }
.learned-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 7px 10px; font-size: .76rem; color: var(--text-mid); margin: 6px 0; line-height: 1.5; }
.near-badge { color: var(--warn); font-size: .62rem; font-weight: 800; }
/* 別の浮き要員がすでに付けている先。禁止ではなく、重なっていることの知らせ */
.dup-badge { color: var(--area); font-size: .62rem; font-weight: 800; }
/* サイクル便（C3=17:45着車）。浮きだが自分の便を持っている人 */
.cycle-chip { display: inline-block; background: var(--area-bg); color: var(--area); border-radius: 999px;
  padding: 1px 8px; font-size: .68rem; font-weight: 800; white-space: nowrap; }

/* 荷物のかたよりの要約（統計の下の1行） */
.balance-note { margin: -4px 2px 12px; padding: 9px 12px; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .8rem; line-height: 1.6; color: var(--text-mid); }
.balance-note b { color: var(--accent); font-size: .92rem; }

/* 荷物量の棒グラフと「平均の線」。誰が平均を超えているかをひと目で見せる */
.m-bar { position: absolute; left: 0; bottom: 1px; height: 4px; border-radius: 999px;
  background: var(--border-2); pointer-events: none; }
.mrow.is-over .m-bar { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.mrow.is-heavy .m-bar { background: linear-gradient(90deg, #f0a350, var(--warn)); height: 5px; }
/* 棒の下地。どこまでが満杯か分かるように薄いレールを敷く */
.compact-list .mrow::after { content: ""; position: absolute; left: 0; right: 0; bottom: 1px; height: 4px;
  border-radius: 999px; background: var(--surface-3); z-index: -1; }
.compact-list .mrow { isolation: isolate; }
.m-avgline { position: absolute; bottom: -1px; width: 2px; height: 8px; border-radius: 1px;
  background: var(--text-mid); opacity: .55; pointer-events: none; }
/* 平均を超えている分（渡せる量） */
.m-sur { font-style: normal; display: inline-block; margin-left: 5px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent-sf); color: var(--accent);
  font-size: .66rem; font-weight: 800; vertical-align: middle; }
.mrow.is-heavy .m-sur { background: var(--tint-warn); color: var(--warn-text); }

/* 浮き要員の「受け持ち見込み」メーター */
.float-load { display: flex; align-items: center; gap: 9px; margin: 7px 0 2px; flex-wrap: wrap; }
.fl-bar { flex: 1 1 120px; min-width: 90px; height: 8px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); overflow: hidden; }
.fl-bar i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .35s var(--ease); }
.float-load.enough .fl-bar i { background: linear-gradient(90deg, #34d399, var(--ok)); }
@media (prefers-reduced-motion: reduce) { .fl-bar i { transition: none; } }
.float-load.enough .fl-bar i { background: var(--ok); }
.fl-text { flex: 0 0 auto; font-size: .74rem; color: var(--text-mid); font-weight: 700; }
.fl-text b { color: var(--accent); font-size: .86rem; }
.float-load.enough .fl-text b { color: var(--ok-text); }
.fl-ok { font-size: .7rem !important; }

/* エリアの重み（同じ個数でも手間が違うエリア） */
.m-weight { font-style: normal; font-size: .7rem; font-weight: 800; color: var(--warn-text);
  background: var(--tint-warn); border-radius: 999px; padding: 1px 7px; margin-left: 5px; white-space: nowrap; }
.w-badge { color: var(--warn-text); font-size: .62rem; font-weight: 800; }
/* いま付けている先からの移動時間 */
.move-badge { color: var(--area); font-size: .62rem; font-weight: 800; }
/* エリアの重みの編集行 */
.area-w-row { display: grid; grid-template-columns: minmax(0, 1fr) 6em auto; gap: 6px; align-items: center; margin-bottom: 7px; }
.area-w-row .inp { padding: 8px 9px; font-size: .85rem; }
.area-w-row .aw-del { color: var(--danger); }
.area-w-row .aw-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (max-width: 560px) { .area-w-row { grid-template-columns: minmax(0, 1fr) 5.5em auto; } }

/* 候補ボタン: 個数をいちばん大きく（数優先の並びに見た目を合わせる） */
/* 手が要る候補は「暖色の面」にする。紫の氏名と色がぶつかってコントラストが落ちるため */
.route-rec.heavy { border-color: var(--warn); background: var(--tint-warn); }
.rec-sur { font-style: normal; display: inline-block; padding: 0 5px; border-radius: 999px;
  background: var(--accent-sf); color: var(--accent); font-size: .64rem; font-weight: 800; }
.route-rec.heavy .rec-sur { background: var(--surface); color: var(--warn-text); }

/* 担当状況の詰めた一覧（1人1行） */
.compact-list { padding: 8px 12px 10px; }
.area-group { padding: 8px 0; border-top: 1px solid var(--border); }
.area-group:first-child { border-top: none; padding-top: 2px; }
/* 見出しは上に貼り付いて、スクロール中もどのまとまりか分かるようにする */
.area-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline;
  justify-content: space-between; gap: 8px; margin: 0 -12px 4px; padding: 5px 12px;
  background: var(--surface); }
.area-head b { font-size: .8rem; font-weight: 800; letter-spacing: .01em; }
.area-head span { font-size: .7rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
/* position: relative は棒グラフ（.m-bar / .m-avgline）の基準。
   絶対配置なのでグリッドの列は増えない。下の padding は棒の置き場所。 */
.mrow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 4px 0 8px; }
/* 名前＝太く濃く／エリア＝色つきで目立たせる／個数＝いちばん強く
   エリア名は省略しない。幅が足りなければ折り返す（端末によって「日野市…」になるのを防ぐ） */
.m-name { font-size: .92rem; font-weight: 800; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.m-meta { font-size: .72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-area { font-style: normal; font-size: .74rem; font-weight: 700; color: var(--area); background: var(--area-bg);
  border-radius: 999px; padding: 2px 8px; margin-left: 6px; white-space: nowrap; }
.title-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sort-sel { min-height: 36px; padding: 4px 8px; font-size: .78rem; font-weight: 700; flex: 0 0 auto; max-width: 7.5em; }
.m-pkg { font-size: 1.12rem; font-weight: 900; color: var(--text); text-align: right; min-width: 2.8em;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mrow.is-over .m-pkg { color: var(--accent); }
.mrow.is-heavy .m-pkg { color: var(--warn-text); }
/* エリア見出しも色を合わせる */
.area-head b { color: var(--area); }

/* 折りたたみカード（LINEログ・配車表画像） */
details.fold > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: .92rem; font-weight: 800; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "▼"; font-size: .7rem; color: var(--muted); font-weight: 400; }
details.fold[open] > summary::after { content: "▲"; }
details.fold.card { padding: 12px 16px; }

/* マニュアルの画面写真 */
.man-shot { margin: 10px 0 4px; text-align: center; }
.man-shot img { width: 100%; max-width: 300px; border: 1px solid var(--border-2); border-radius: var(--radius-s);
  box-shadow: var(--shadow); background: var(--surface-2); }
/* 2画面を横に並べた図は幅いっぱいで見せる */
.man-shot img[data-shot="signup.jpg"] { max-width: 100%; }
.man-shot figcaption { font-size: .74rem; color: var(--muted); line-height: 1.6; margin-top: 6px; text-align: left; }

/* マニュアルの図解 */
.fig { margin: 10px 0; }
.fig-cap { font-size: .72rem; color: var(--muted); text-align: center; margin: 6px 0 0; }
.fig-tabbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fig-tab { border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2);
  padding: 9px 6px; text-align: center; }
.fig-tab.on { border-color: var(--accent); background: var(--accent-sf); }
.fig-tab b { display: block; font-size: .84rem; }
.fig-tab.on b { color: var(--accent); }
.fig-tab span { font-size: .66rem; color: var(--muted); }
.fig-tabbar .fig-cap { grid-column: 1 / -1; }
.fig-flow { display: grid; gap: 4px; }
.fig-step { display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 10px; font-size: .8rem; color: var(--text-mid); }
.fig-step.hi { background: var(--accent-sf); border-color: var(--accent); color: var(--text); }
.fig-step i { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 999px;
  background: var(--accent); color: #fff; font-style: normal; font-size: .68rem; font-weight: 800; }
.fig-cand { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 10px; align-items: start; }
.fig-btn { border: 1px solid var(--accent); background: var(--surface-2); border-radius: var(--radius-s); padding: 9px 10px; }
.fig-btn b { display: block; color: var(--accent); font-size: .82rem; }
.fig-btn span { display: block; font-size: .74rem; font-weight: 700; margin: 2px 0; }
.fig-btn small { font-size: .68rem; color: var(--muted); }
.fig-notes { margin: 0; padding-left: 1.1em; }
.fig-notes li { font-size: .74rem; color: var(--text-mid); line-height: 1.6; margin-bottom: 4px; }
@media (max-width: 560px) { .fig-cand { grid-template-columns: 1fr; } }

/* 補助ツールである旨の注意書き */
.assist-note { background: var(--accent-sf); border: 1px solid var(--accent); border-radius: var(--radius-s);
  padding: 10px 12px; font-size: .82rem; line-height: 1.6; color: var(--text-mid); margin: 10px 0 0; }
.assist-note b { color: var(--accent); }

/* 使い方マニュアル（本文はアプリ内に表示。スマホはPDFをiframe表示できないため） */
.manual-actions { margin-top: 12px; }
.manual-actions .btn { flex: 1 1 160px; }
.man-sec { padding: 14px 16px; }
.man-h { font-size: 1rem; font-weight: 800; color: var(--accent); margin: 0 0 6px; }
.man-sub { font-size: .88rem; font-weight: 800; margin: 12px 0 4px; color: var(--text); }
.man-p { font-size: .88rem; line-height: 1.75; color: var(--text-mid); margin: 0 0 8px; }
.man-tbl { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; margin-top: 6px; }
.man-row { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 1px; background: var(--border); }
.man-k { background: var(--surface-2); padding: 9px 10px; font-size: .8rem; font-weight: 800; color: var(--text); }
.man-v { background: var(--surface); padding: 9px 10px; font-size: .82rem; line-height: 1.65; color: var(--text-mid); }
@media (max-width: 560px) {
  .man-sec { padding: 12px; }
  .man-row { grid-template-columns: 1fr; }
  .man-k { padding: 7px 10px 4px; }
  .man-v { padding: 4px 10px 9px; }
}

/* 点呼チェッ君の出勤（参考） */
.tenko-card > summary .muted { font-weight: 700; margin-left: auto; margin-right: 8px; }
.tenko-diff { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 8px 10px; font-size: .8rem; color: var(--text-mid); margin: 6px 0; line-height: 1.5; }
.tenko-diff b { color: var(--warn); }
.tenko-diff.soft b { color: var(--muted); }
.tenko-list { margin-top: 8px; }
.tenko-list .mrow.is-off { opacity: .5; }
.tenko-st { font-size: .7rem !important; font-weight: 700; color: var(--muted) !important; }

/* 取りこぼし警告 */
.warn-card { border-color: var(--warn); box-shadow: 0 0 0 1px rgba(180,83,9,.15), var(--shadow); }
.warn-card h3 { color: var(--warn); }
.warn-card p { color: var(--text-mid); margin: 0; }

/* 手直し（抽出結果の編集） */
.edit-row { padding: 12px 0; border-top: 1px solid var(--border); }
.edit-row:first-child { border-top: none; padding-top: 4px; }
.edit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.edit-grid label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.edit-grid label.wide { grid-column: 1 / -1; }
.edit-grid label span { font-size: .68rem; color: var(--muted); font-weight: 700; }
.edit-grid .inp, .edit-grid .sel { width: 100%; }
.edit-row .e-del { margin-top: 8px; color: var(--danger); }
.edit-row .e-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.edit-actions { margin-top: 14px; }
.edit-actions .btn { flex: 1 1 140px; }
.follow-tools { margin-bottom: 6px; }
@media (max-width: 560px) {
  .edit-grid { grid-template-columns: 1fr 1fr; }
  .edit-row { padding: 14px 0; }
}

/* 利用者の承認（管理者） */
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.user-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.user-info .chip { align-self: flex-start; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-actions .user-del { color: var(--danger); }
.user-actions .user-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.user-row.is-pending { background: var(--accent-sf); border-radius: var(--radius-s); padding: 10px; margin-bottom: 6px; border-top: none; }
.pend-note { background: var(--accent-sf); color: var(--accent); border-radius: var(--radius-s); padding: 9px 12px; font-size: .84rem; font-weight: 700; margin: 4px 0 10px; }
.user-section { font-size: .72rem; font-weight: 800; color: var(--muted); margin-top: 12px; }
/* 承認待ちの人数バッジ */
.pend-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 800; line-height: 1; }
.mobile-more > summary .pend-dot { position: absolute; transform: translate(14px, -14px); }
.mobile-more > summary { position: relative; }
@media (max-width: 560px) { .assign-chip { font-size: .92rem; padding: 7px 7px 7px 15px; } .assign-chip .chip-del { width: 30px; height: 30px; } }


/* ============================================================
   v1.7 デザイン刷新の追加ぶん
   ============================================================ */

/* 今日のまとめ（総数を主役にしたカード） */
.hero { padding: 18px 16px 14px; border-color: transparent;
  background:
    linear-gradient(180deg, var(--hero-1), transparent 58%),
    linear-gradient(180deg, var(--surface), var(--surface));
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-line); }
.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero-num { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
.hero-num b { font-size: 2.6rem; font-weight: 900; letter-spacing: -.03em; line-height: 1;
  color: var(--text); font-variant-numeric: tabular-nums; }
.hero-num span { font-size: .9rem; font-weight: 800; color: var(--muted); }
.hero-side { text-align: right; flex: 0 0 auto; }
.hero-avg { font-size: .8rem; font-weight: 700; color: var(--text-mid); }
.hero-avg b { font-size: 1.15rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.hero-avg small { font-size: .72rem; font-weight: 800; color: var(--muted); margin-left: 1px; }
.hero-meta { font-size: .72rem; color: var(--muted); font-weight: 700; margin-top: 2px; }

/* かたよりがどれだけ解消できているか */
.hero-meter { margin-top: 12px; }
.hm-bar { height: 8px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border); overflow: hidden; }
.hm-bar i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s var(--ease); }
.hero-meter.done .hm-bar i { background: linear-gradient(90deg, #34d399, var(--ok)); }
.hm-text { margin-top: 5px; font-size: .74rem; font-weight: 700; color: var(--text-mid); }
.hm-text b { color: var(--accent); font-size: .86rem; font-variant-numeric: tabular-nums; }
.hero-meter.done .hm-text b { color: var(--ok-text); }
@media (prefers-reduced-motion: reduce) { .hm-bar i { transition: none; } }

.hero .balance-note { margin: 10px 0 0; padding: 9px 11px; background: var(--surface-2);
  border: 1px solid var(--border); box-shadow: none; }

/* 画面の切り替わり（うるさくならない程度に） */
#view { animation: view-in .26s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #view { animation: none; } }

/* 読み込み中の骨組み */
.skeleton { border-radius: var(--radius-s); background: var(--surface-3); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: sk 1.4s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
@keyframes sk { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* 押した感じ（カード内の主要ボタン） */
.follow-tools .btn, .edit-actions .btn, .manual-actions .btn { flex: 1 1 auto; }

/* PCナビの見た目を少し締める */
.nav-link { transition: background .16s var(--ease), color .16s var(--ease); }

@media (max-width: 560px) {
  .hero { padding: 14px 14px 12px; }
  .hero-num b { font-size: 2.3rem; }
  /* 下タブバー・キャラのぶんの余白（タブバー62＋キャラ62＋吹き出し） */
  #view { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
  .assist-fab-wrap { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .assist-sheet { bottom: calc(62px + env(safe-area-inset-bottom)); border-radius: var(--radius-l) var(--radius-l) 0 0; }
}


/* ============================================================
   v1.8 ガラス×奥行き ／ iPadの2列ダッシュボード
   ============================================================ */

/* --- 今日の画面の2列化 ---------------------------------------------------
   狭い画面では1列（並び順は従来どおり）。900px以上で「左=状況／右=組む」に分ける。
   マークアップ側は .day-cols > .col-main + .col-side（renderDay）。 */
.day-cols { display: grid; gap: 0; }
.col-main, .col-side { min-width: 0; }

@media (min-width: 900px) {
  #app { max-width: 1180px; }
  .day-cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  /* 右側は「組む」作業。左の一覧を見ながら触るので、上に貼り付けておく */
  .col-side { position: sticky; top: calc(var(--topbar-h, 96px) + 12px); }
  .pad { padding: 18px 20px 28px; }
  .daybar { margin-bottom: 16px; }
  /* 候補ボタンは列が狭くなるので2つ並び */
  .route-recs { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .route-recs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- 指で使う端末（iPad含む）は画面幅に関係なく大きく ------------------- */
@media (pointer: coarse) {
  .btn { min-height: 46px; padding: 11px 18px; font-size: .9rem; }
  .btn.sm { min-height: 40px; padding: 8px 14px; font-size: .82rem; }
  .sel, .inp { min-height: 44px; font-size: .95rem; }
  .sort-sel { min-height: 40px; }
  .guide-close { min-height: 40px; }
  .route-rec { min-height: 62px; padding: 10px 11px; }
  .assign-chip .chip-del { width: 30px; height: 30px; }
  .nav-link { padding: 10px 14px; font-size: .88rem; }
  .icon-btn { width: 44px; height: 44px; }
  .seg-btn { min-height: 44px; }
  .date-input { min-height: 44px; }
}

/* --- ガラスの仕上げ ------------------------------------------------------- */
/* 折りたたみカード・警告・浮きなしも、カードと同じ光の線を持たせる */
.card.accent { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-lg), inset 0 1px 0 var(--glass-line); }
.task-guide { box-shadow: var(--shadow-lg); }
.guide-head { backdrop-filter: saturate(140%) blur(8px); -webkit-backdrop-filter: saturate(140%) blur(8px); }

/* 浮き要員のカードもうっすらガラスに（中の数字は不透明の上に乗る） */
.float-row { position: relative; background:
    linear-gradient(180deg, var(--hero-2), transparent 60%), var(--surface-2);
  box-shadow: inset 0 1px 0 var(--glass-line); }

/* 話しかけるシートと下から出るメニューもガラス */
@supports (backdrop-filter: blur(1px)) {
  .assist-sheet, .mobile-menu-panel { background: var(--glass);
    backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); }
  .fab-say { background: var(--glass); backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px); }
}

/* 統計タイルは面を一段落として、カードの中で沈ませる */
.stat { background: var(--surface-3); border-color: transparent; }

/* エリア見出しの貼り付きは、ガラス下地だと透けるので不透明のまま保つ */
.area-head { background: var(--surface); }

/* --- 画面が広いときの読みやすさ ------------------------------------------ */
@media (min-width: 900px) {
  .hero-num b { font-size: 3rem; }
  .compact-list { padding: 10px 16px 12px; }
  .mrow { padding: 6px 0 10px; }
  .m-name { font-size: .96rem; }
  .m-pkg { font-size: 1.2rem; }
  /* 手直しは横に広い方が入力しやすい */
  .edit-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .edit-grid label.wide { grid-column: span 2; }
}

/* 説明は常時1行だけ。細かい話は「？」を押したときに出す（画面を文章で埋めないため） */
.help-fold { margin: 2px 0 10px; }
.help-fold > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: .8rem; font-weight: 800; color: var(--text-mid); }
.help-fold > summary::-webkit-details-marker { display: none; }
.help-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px;
  border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .66rem; font-weight: 800; }
.help-fold[open] > summary .help-mark { background: var(--accent); color: var(--on-accent); }
.help-fold > p { margin: 8px 0 0; }
.help-fold .learned-note { margin-top: 8px; }

/* 見出し右の「並び替え＋手直し」が375pxで数pxはみ出していた。
   縮まないように固定していたのが原因なので、縮める余地を与える。 */
.title-tools { flex: 0 1 auto; min-width: 0; }
.sort-sel { flex: 0 1 auto; min-width: 0; }
/* 「済」の候補は文字を沈ませすぎると読めない（4.15だった）ので中間色にする */
.route-rec[disabled] b, .route-rec[disabled] { color: var(--text-mid); }
