/* 日報ノート — やさしいライトテーマ(生成り・墨・深緑) */
:root {
  --bg: #fdf9f3;          /* 生成り */
  --surface: #ffffff;
  --surface-2: #f5f0e7;   /* 入力欄・淡い面 */
  --line: #ece5d9;
  --text: #2a2a28;        /* 墨 */
  --muted: #69655d;
  --accent: #1f6f68;      /* 深緑 */
  --head: #2a9d63;        /* ヘッダー帯(アイコンの緑に合わせた少し明るい緑) */
  --accent-dark: #185a54;
  --accent-ink: #ffffff;
  --accent-soft: #e2efeb;
  --p-green: #e3f1e8;     /* パステル: 淡い緑 */
  --p-blue: #e5ecf0;      /* パステル: 淡い青灰 */
  --p-yellow: #fbf0d2;    /* パステル: 淡い黄 */
  --warn: #8a5a0b;
  --warn-soft: #fbf0d2;
  --danger: #b0453a;
  --badge: #e0704f;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(70, 55, 30, 0.05), 0 8px 24px rgba(70, 55, 30, 0.07);
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
}

/* ---- ホームのヘッダー帯 ---- */
.home-head {
  position: relative;
  margin: calc(-20px - var(--safe-t)) calc(50% - 50vw) 0;
  padding: calc(26px + var(--safe-t)) max(16px, calc(50vw - 224px)) 60px;
  background: var(--head);
  color: #fff;
  border-radius: 0 0 32px 32px;
}
.home-head .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-head .today { font-size: 15px; font-weight: 600; opacity: 0.95; }
.home-head .mnav { display: flex; align-items: center; gap: 4px; }
.home-head .mnav b { font-size: 16px; min-width: 7.2em; text-align: center; font-variant-numeric: tabular-nums; }
.home-head .icon-btn { background: rgba(255, 255, 255, 0.16); color: #fff; }
.home-head .icon-btn:active { background: rgba(255, 255, 255, 0.28); }
.hero-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.mascot { width: 96px; height: 96px; object-fit: contain; flex: none; }
.home-head .mascot { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)); }
.mascot.bob { animation: bob 2.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.bubble {
  position: relative; flex: 1; min-width: 0;
  background: #fff; color: var(--text);
  border-radius: 20px; padding: 12px 16px;
  font-size: 17px; font-weight: 700; line-height: 1.45;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
}
.bubble::before {
  content: ""; position: absolute; left: -9px; top: 50%; margin-top: -9px;
  border: 9px solid transparent; border-left: 0; border-right-color: #fff;
}
.bubble small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* ---- 見出し(ホーム以外) ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 2px 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.page-head h1 .mascot { width: 42px; height: 42px; }
.page-head .sub { color: var(--accent-dark); background: var(--accent-soft); font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
/* 月の切り替えは、切り替わるカードの真上に置く */
.sec-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 8px; }
.sec-nav h2 { margin: 0 6px; }
.sec-nav .mnav { display: flex; align-items: center; gap: 4px; }
.sec-nav .mnav b { font-size: 16px; min-width: 6.2em; text-align: center; font-variant-numeric: tabular-nums; }
h2 { font-size: 16px; font-weight: 700; color: var(--text); margin: 30px 6px 12px; letter-spacing: 0.03em; }

/* ---- カード ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 8px 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big-num { font-size: 36px; font-weight: 800; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.big-num .unit { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.num { font-variant-numeric: tabular-nums; }

/* ---- つぎにやること ---- */
.card.next { position: relative; margin-top: -40px; padding: 22px 20px 20px; }
.next-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.06em; }
.next-title { font-size: 22px; font-weight: 800; line-height: 1.4; }
.next-sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 16px 0 6px; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width 0.9s cubic-bezier(.2,.8,.2,1); }
.progress.warn i { background: #d9a23a; }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 18px; font-variant-numeric: tabular-nums; }
.steps { display: flex; gap: 6px; }
.steps span { color: var(--muted); }
.steps span.on { color: var(--accent); font-weight: 700; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); font-size: 15px; }
.mini-row .btn.small { min-height: 44px; background: #fff; }

/* ---- いまの状況(パステルカード) ---- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat {
  display: block; width: 100%; text-align: left; border: none;
  border-radius: var(--radius); padding: 18px 16px 16px; min-height: 140px;
  color: var(--text); box-shadow: 0 1px 2px rgba(70, 55, 30, 0.04);
  transition: transform 0.12s ease;
}
button.stat:active { transform: scale(0.98); }
.stat.green { background: var(--p-green); }
.stat.blue { background: var(--p-blue); }
.stat.yellow { background: var(--p-yellow); }
.stat .label { font-size: 13px; font-weight: 700; color: #4a4740; }
.stat .val { font-size: 28px; font-weight: 800; line-height: 1.25; margin-top: 8px; font-variant-numeric: tabular-nums; word-break: keep-all; }
.stat .val .unit { font-size: 14px; font-weight: 700; margin-left: 2px; color: #4a4740; }
.stat .foot { font-size: 12px; color: #55524b; margin-top: 6px; }
.stat .bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); overflow: hidden; margin-top: 10px; }
.stat .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.9s cubic-bezier(.2,.8,.2,1); }
.stamps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.stamps i { aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
.stamps i.on { background: var(--accent); }
.stamps i.future { background: rgba(255, 255, 255, 0.4); }
.stamps i.pop { animation: stampPop 0.6s cubic-bezier(.2,1.4,.4,1); }
@keyframes stampPop { 0% { transform: scale(0.2); opacity: 0; } 60% { transform: scale(1.5); opacity: 1; } 100% { transform: scale(1); } }
.stamps i.today { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- ボタン ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px;
  border: none; border-radius: 16px;
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 17px;
  width: 100%;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px rgba(31, 111, 104, 0.22); }
.btn.primary:active { background: var(--accent-dark); }
.btn.hero { min-height: 64px; font-size: 20px; border-radius: 20px; }
.btn.ghost { background: transparent; color: var(--muted); min-height: 44px; font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid rgba(176, 69, 58, 0.35); }
.btn.small { min-height: 44px; font-size: 15px; width: auto; padding: 0 16px; }
.btn:disabled { opacity: 0.4; box-shadow: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* ---- 今日カード ---- */
.today-status { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.today-status .t { font-size: 22px; font-weight: 800; }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.on { background: var(--accent-soft); color: var(--accent-dark); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.times { display: flex; gap: 10px; margin-bottom: 16px; }
.times div { flex: 1; background: var(--p-blue); border-radius: 16px; padding: 10px 14px; }
.times small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.times b { font-size: 26px; font-variant-numeric: tabular-nums; }

/* 完了アニメーション */
.done { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; text-align: center; }
.check { width: 64px; height: 64px; }
.check circle { fill: var(--accent-soft); }
.check path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 0.55s 0.1s ease-out forwards; }
.done.pop .check { animation: pop 0.45s cubic-bezier(.2,1.4,.4,1); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---- お知らせ ---- */
.notice { display: flex; gap: 12px; align-items: center; background: var(--p-yellow); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; font-size: 15px; }
.notice::before { content: "!"; flex: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--warn); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.notice.ok { background: var(--p-green); }

/* ---- 一覧の行 ---- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-size: 15px; }
.kv .k small { display: block; font-size: 12px; }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.kv.minus .v { color: var(--muted); }
.kv.sum { border-top: 1px solid var(--line); }
.kv.sum .k { color: var(--text); font-weight: 700; }
.kv.total { margin: 6px -12px 8px; padding: 16px 12px; border-radius: 16px; background: var(--p-green); border-bottom: none; }
.kv.total .k { color: var(--text); font-weight: 800; font-size: 17px; }
.kv.total .v { font-size: 26px; color: var(--accent-dark); }
.line-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; vertical-align: 1px; }

/* ---- フォーム ---- */
.field { margin-bottom: 18px; }
.field > label, .field > .label, .row.field label, .row .field > label { display: block; color: var(--muted); font-size: 14px; font-weight: 600; margin: 0 4px 8px; }
.row.field > div > label { display: block; color: var(--muted); font-size: 14px; font-weight: 600; margin: 0 4px 8px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 16px;
  padding: 12px 16px; font-size: 18px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: #a39d92; }
.input:focus { border-color: var(--accent); background: #fff; }
textarea.input { min-height: 88px; resize: vertical; font-size: 16px; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; font-variant-numeric: tabular-nums; }
.input.km { font-size: 28px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.with-unit { position: relative; }
.with-unit .u { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.with-unit .input { padding-right: 56px; }
input[type="date"].input { min-height: 52px; }
label.btn, .field > label.btn { cursor: pointer; display: flex; margin: 0; color: var(--text); font-size: 17px; font-weight: 700; }
.stack > * + label.btn { margin-top: 10px; }

/* セグメント */
.seg { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; }
.seg button { flex: 1; min-height: 48px; border: none; background: transparent; border-radius: 13px; color: var(--muted); font-weight: 700; transition: background .2s, color .2s; }
.seg button.on { background: #fff; color: var(--accent-dark); box-shadow: 0 2px 6px rgba(70, 55, 30, 0.10); }

/* チップ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--text); font-size: 15px; font-weight: 600; transition: background .15s, border-color .15s; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.chip.add { border-style: dashed; color: var(--accent-dark); background: transparent; }
.chip:active { transform: scale(0.96); }

/* ---- カレンダー ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 18px; font-weight: 800; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: none; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .dow { font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .dow.sun { color: var(--danger); }
.cal .dow.sat { color: #3a6a9a; }
.cal button { position: relative; min-height: 44px; border: none; border-radius: 14px; background: transparent; font-variant-numeric: tabular-nums; font-size: 16px; }
.cal button.today { color: var(--accent); font-weight: 800; background: var(--accent-soft); }
.cal button.sel { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.cal button .dot { position: absolute; left: 50%; bottom: 4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); }
.cal button.off .dot { background: #b8b1a4; }
.cal button.sel .dot { background: var(--accent-ink); }

/* ---- 立替金リスト ---- */
.exp-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exp-item:last-child { border-bottom: none; }
.exp-item .main { flex: 1; min-width: 0; }
.exp-item .main .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.exp-item .main small { color: var(--muted); font-size: 13px; }
.exp-item .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.pdf-tag { display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--accent); }
.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex: none; border: none; padding: 0; }
.del { width: 44px; height: 44px; border: none; border-radius: 12px; background: transparent; color: var(--muted); font-size: 22px; flex: none; }
.del:active { background: var(--surface-2); }
.preview { white-space: pre-wrap; background: var(--surface-2); border-radius: 16px; padding: 14px 16px; font-size: 15px; font-family: inherit; font-variant-numeric: tabular-nums; margin: 0 0 12px; min-height: 52px; }

/* ---- 照合 ---- */
.result { margin-top: 14px; border-radius: 18px; padding: 18px; text-align: center; background: var(--surface-2); }
.result.ok { background: var(--p-green); }
.result.ok .h { color: var(--accent-dark); }
.result.ng { background: var(--p-yellow); }
.result.ng .h { color: var(--warn); }
.result .h { font-size: 22px; font-weight: 800; }

/* ---- フッター注記 ---- */
.disclaimer { text-align: center; color: var(--muted); font-size: 13px; margin: 32px 8px 0; }

/* ---- タブバー ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
  background: #fff;
  /* iPhoneで、スクロール中に固定バーがずれる/ちらつくのを避ける(ぼかしをやめ、専用レイヤーに載せる) */
  -webkit-transform: translateZ(0); transform: translateZ(0);
  box-shadow: 0 -4px 20px rgba(70, 55, 30, 0.08);
  border-radius: 22px 22px 0 0;
}
.tab { position: relative; flex: 1; max-width: 96px; border: none; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; min-height: 44px; }
.tab .ic { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent-dark); }
.tab.on .ic { background: var(--accent-soft); }
.tab .badge { position: absolute; top: 4px; left: 50%; margin-left: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--badge); border: 2px solid #fff; box-sizing: content-box; }
.tab .badge[hidden] { display: none; }

/* ---- トースト ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: #fff; font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 999px; transition: opacity .25s, transform .25s; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- 写真ビューア ---- */
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(30, 28, 24, .9); display: flex; align-items: center; justify-content: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 12px; }

.fade-in { animation: fadeIn .25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 400px) {
  .bubble { font-size: 15.5px; padding: 12px 14px; }
}
@media (max-width: 360px) {
  .stat .val { font-size: 23px; }
  .mascot { width: 80px; height: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* 1日の目安 */
.est { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 12px; }
.est b { font-size: 24px; font-weight: 800; color: var(--accent); }
.est span { font-size: 14px; font-weight: 700; color: var(--text); }
.est small { flex-basis: 100%; text-align: center; font-size: 12px; color: var(--muted); }

/* AIでPDFから読み取る */
.ai-card { padding-top: 6px; padding-bottom: 6px; }
.ai-card:has(.ai-steps) { padding-bottom: 20px; }
.ai-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 0; border: none; background: transparent; font-size: 17px; font-weight: 700; color: var(--text); text-align: left; }
.ai-chev svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; display: block; }
.ai-chev.open svg { transform: rotate(90deg); }
.ai-steps { margin: 6px 0 16px; padding-left: 1.6em; color: var(--text); font-size: 15px; line-height: 1.7; }
.ai-prompt { margin-top: 10px; min-height: 120px; font-size: 13px !important; color: var(--muted); }
.ai-link { display: inline-flex; align-items: center; text-decoration: none; }
.ai-row { border-radius: 16px; padding: 8px 12px 12px; margin-bottom: 10px; background: var(--surface-2); border: 1.5px solid transparent; }
.ai-row.ok { background: var(--p-green); }
.ai-row.warn { background: var(--warn-soft); border-color: rgba(138, 90, 11, 0.35); }
.ai-row.dup { background: var(--p-blue); }
.ai-row.ng { background: #f8e4e1; border-color: rgba(176, 69, 58, 0.35); }
.ai-head { display: flex; align-items: center; gap: 8px; }
.ai-head .del { margin-left: auto; width: 40px; height: 40px; }
.ai-check { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -8px; cursor: pointer; }
.ai-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.ai-check.off { cursor: default; }
.ai-tag { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #fff; }
.ai-row.warn .ai-tag { color: var(--warn); }
.ai-row.dup .ai-tag { color: var(--muted); }
.ai-row.ng .ai-tag { color: var(--danger); }
.ai-meta { font-weight: 700; font-size: 15px; margin: 2px 2px 8px; }
.ai-edit { display: flex; flex-direction: column; gap: 8px; }
.ai-edit .input { min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-size: 16px; background: #fff; }
.ai-route { display: flex; align-items: center; gap: 6px; }
.ai-route .input { flex: 1; min-width: 0; }
.ai-route span { color: var(--muted); flex: none; }
.ai-amt .input { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.ai-raw { font-size: 14px; word-break: break-all; margin: 2px 2px 4px; }
.ai-err { font-size: 13px; color: var(--danger); font-weight: 600; margin: 0 2px; }
.ai-note { margin: 14px 4px 0; font-size: 12.5px; line-height: 1.6; }

/* 個人情報の案内 */
.privacy { margin-top: 12px; border-radius: 14px; background: var(--surface-2); padding: 0 14px; }
.privacy summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 14px; color: var(--accent-dark); }
.privacy ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--text); }
.privacy li + li { margin-top: 6px; }

/* 赤い点の説明 */
.tab-legend { margin: 14px 6px 0; line-height: 1.6; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--badge); vertical-align: baseline; margin-right: 2px; }

/* 開始地点・終了地点(日報) */
.opt { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.place-field .input { font-size: 17px; }
.place-chips { margin-top: 8px; gap: 6px; }
.chip.small { min-height: 36px; padding: 0 12px; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 業務記録(日報)の出力 */
.wr-card { padding-bottom: 20px; }
html.wr-open, html.wr-open body { overflow: hidden; }
.wr-overlay { position: fixed; inset: 0; z-index: 40; background: #e9e4da; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 calc(24px + var(--safe-b)); }
.wr-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; background: #fff; box-shadow: 0 2px 10px rgba(70, 55, 30, 0.10); }
.wr-bar-t { font-weight: 800; font-size: 16px; }
.wr-hint { margin: 12px 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.wr-sheet { max-width: 760px; margin: 0 auto; background: #fff; color: #111; padding: 22px 16px 18px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); font-size: 13px; line-height: 1.45; }
@media (min-width: 560px) { .wr-sheet { margin: 0 16px; padding: 28px 24px 22px; } }
@media (min-width: 792px) { .wr-sheet { margin: 0 auto; } }
.wr-sheet h1 { font-size: 20px; font-weight: 800; text-align: center; margin: 0 0 4px; letter-spacing: 0.08em; }
.wr-month { text-align: center; font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.wr-month small { font-weight: 500; margin-left: 4px; }
.wr-sheet table { width: 100%; border-collapse: collapse; }
.wr-sheet th, .wr-sheet td { border: 1px solid #555; padding: 5px 6px; vertical-align: middle; }
.wr-sheet th { background: #f1efea; font-weight: 700; text-align: center; white-space: nowrap; }
.wr-info { margin-bottom: 12px; }
.wr-info th { width: 18%; }
.wr-info td { width: 32%; height: 30px; vertical-align: middle; overflow-wrap: anywhere; }
.wr-blank { display: block; min-height: 1.2em; }
.wr-table { table-layout: fixed; min-width: 700px; }
.wr-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wr-table thead th:nth-child(1), .wr-table thead th:nth-child(2) { width: 15%; }
.wr-table thead th:nth-child(3), .wr-table thead th:nth-child(4), .wr-table thead th:nth-child(7) { width: 16%; }
.wr-table thead th:nth-child(5), .wr-table thead th:nth-child(6) { width: 12%; }
.wr-table th small { display: block; font-size: 10px; font-weight: 500; }
.wr-table td b { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.wr-table td span { display: block; font-size: 12px; overflow-wrap: anywhere; }
.wr-date { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wr-date small { font-size: 11px; margin-left: 1px; }
.wr-center { text-align: center; }
.wr-area { font-size: 12px; overflow-wrap: anywhere; }
.wr-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wr-memo { font-size: 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
.wr-empty { text-align: center; color: #666; padding: 18px 6px !important; }
.wr-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
.wr-table tfoot th, .wr-table tfoot td { background: #f7f5f0; vertical-align: middle; }
.wr-table tfoot td b { display: inline; font-size: 15px; }
.wr-note { margin: 12px 0 0; font-size: 11px; color: #444; line-height: 1.6; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html.wr-open, html.wr-open body { background: #fff !important; overflow: visible !important; height: auto !important; }
  html.wr-open body { padding: 0 !important; }
  html.wr-open body > *:not(.wr-overlay) { display: none !important; } /* 出力ビューを開いているときだけ、それ以外を隠す */
  .wr-overlay { position: static; inset: auto; overflow: visible; background: #fff; padding: 0; }
  .wr-scroll { overflow: visible; }
  .wr-table { min-width: 0; table-layout: auto; }
  .wr-bar, .wr-hint { display: none !important; }
  .wr-sheet { max-width: none; margin: 0; padding: 0; box-shadow: none; font-size: 10.5pt; }
  .wr-sheet h1 { font-size: 16pt; }
  .wr-month { font-size: 12pt; }
  .wr-sheet th, .wr-sheet td { border-color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wr-table td span, .wr-memo { font-size: 9.5pt; }
  .wr-note { font-size: 8.5pt; }
  .wr-table tfoot { display: table-row-group; } /* 月合計はページごとに繰り返さず、表の最後にだけ出す */
  .wr-sheet th, .wr-sheet td { padding: 3px 5px; }
  .wr-sheet { line-height: 1.3; }
  /* 1か月分(最大31行)がA4一枚に収まるよう、地点は時刻と同じ行に並べ、行の高さを詰める */
  .wr-table td b, .wr-table td span { display: inline; }
  .wr-table td b { font-size: 10pt; }
  .wr-table td span { margin-left: 5px; font-size: 9pt; }
  .wr-table th small { display: inline; margin-left: 2px; font-size: 8pt; }
  /* 走行距離・立替金は、項目名と単位を2行に分けて、狭い列でも重ならないようにする */
  .wr-table thead th:nth-child(5) small, .wr-table thead th:nth-child(6) small { display: block; margin-left: 0; }
  .wr-sheet h1 { margin-bottom: 2px; }
  .wr-month { margin-bottom: 6px; }
  .wr-info { margin-bottom: 6px; }
  .wr-info td { height: 22px; }
  .wr-note { margin-top: 6px; }
  .wr-table thead th:nth-child(7) { width: 14%; min-width: 20mm; }
  /* 日付は少し小さく、見出しは必要なら折り返す(iPhoneの文字は幅が広めでも、はみ出さない) */
  .wr-date { font-size: 9.5pt; letter-spacing: -0.02em; }
  .wr-table thead th { white-space: normal; font-size: 9.5pt; }
  .wr-table thead th:nth-child(5), .wr-table thead th:nth-child(6) { white-space: nowrap; }
  /* 時刻と地点は1行に収める(長い地点名は「…」で省略)。行が増えて2ページになるのを防ぐ */
  .wr-table tbody td:not(.wr-memo) { white-space: nowrap; }
  .wr-table tbody td:nth-child(2) { max-width: 22mm; overflow: hidden; text-overflow: ellipsis; }
  .wr-dense th, .wr-dense td { padding: 1.5px 4px; }
  .wr-dense { line-height: 1.2; }
  .wr-dense .wr-table td b { font-size: 9.5pt; }
  .wr-dense .wr-table td span, .wr-dense .wr-memo, .wr-dense .wr-area { font-size: 8.5pt; }
}

/* 日報タブの保存ボタンは、走行距離のすぐ下に置く(打つ→押すの指の動きを短く) */
.day-actions { margin: 4px 0 20px; }

/* 日報タブの日付の行(◀ 日付 ▶)。カレンダーはタップで開く */
.day-nav { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.day-nav-label { flex: 1; min-height: 44px; border: none; border-radius: 14px; background: var(--surface); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: 0 1px 2px rgba(70, 55, 30, 0.04); }
.day-nav-label b { font-size: 18px; font-variant-numeric: tabular-nums; }
.day-nav-label small { font-size: 11px; color: var(--muted); }

/* 集計タブ: 受取額の行(タップで内訳を開閉) */
.sum-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 60px; padding: 8px 0; border: none; background: transparent; color: var(--text); font-size: 15px; font-weight: 700; text-align: left; }
.sum-toggle b { margin-left: auto; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

.wr-bar-btns { display: flex; gap: 8px; }
@media print { .wr-bar-btns { display: none !important; } }
