/* 技工物チェック v0.3 — clean cyberpunk / 近未来の業務端末
   色は theme.js の CSS変数のみ参照（ここには色をハードコードしない）。
   var(--x, fallback) の fallback は「万一 theme.js 前」に暗いままにするための最小値。 */

:root {
  --bg: #0b0e14; --bg2: #111722;
  --surface: rgba(255,255,255,0.045);
  --line: rgba(255,255,255,0.09); --line-strong: rgba(255,255,255,0.16);
  --ink: #e7eaf0; --ink-soft: #aab2c0; --muted: #7c8696;
  --accent: #38e0d2; --accent-ink: #062521; --accent-glow: rgba(56,224,210,0.28);
  --violet: #9d7bff; --magenta: #ff5db1;

  --r: 14px; --r-sm: 11px; --tap: 48px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wheel-item-h: 42px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg, #0b0e14);
  color: var(--ink, #e7eaf0);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image: var(--page-tint, none);
  background-attachment: fixed;
}

/* ===== ヘッダー ===== */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg, rgba(11,14,20,0.72));
  -webkit-backdrop-filter: saturate(1.3) blur(12px);
  backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(56,224,210,0.10);
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  display: flex; align-items: baseline; gap: 8px;
}
.app-header h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: 0.06em; }
.app-header .ver { font: 12px var(--mono); color: var(--accent); letter-spacing: 0.08em; }
.net-badge {
  margin-left: auto; align-self: center;
  font: 10px var(--mono); letter-spacing: 0.14em;
  color: var(--magenta); border: 1px solid var(--magenta);
  padding: 2px 8px; border-radius: 999px;
}
.gear-btn {
  margin-left: 10px; align-self: center;
  width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-soft); font-size: 16px; line-height: 1;
}
.net-badge + .gear-btn { margin-left: 8px; }
.net-badge[hidden] + .gear-btn { margin-left: auto; }

/* ===== 画面共通 ===== */
main { padding: 16px 15px 96px; max-width: 640px; margin: 0 auto; }
#qForm, #pmForm, #setRoster, #dataPrint { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }

.note {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 12px; border-radius: var(--r-sm); padding: 10px 12px; margin: 2px 0 18px;
}
.hint { font-size: 11.5px; color: var(--muted); margin: 6px 0 10px; }
.edit-banner {
  background: rgba(56,224,210,0.08); border: 1px solid rgba(56,224,210,0.30); color: var(--accent);
  font-weight: 600; border-radius: var(--r-sm); padding: 9px 12px; margin: 2px 0 12px; font-size: 13px;
}

/* ===== フォーム部品 ===== */
.field { margin-bottom: 22px; }
.field > label, .field > .label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--muted);
  margin-bottom: 8px; letter-spacing: 0.06em; text-transform: none;
}

input[type="text"], input[type="date"], input[type="number"], textarea, select {
  width: 100%; min-height: var(--tap);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 11px 13px;
  font: inherit; background: var(--bg2); color: var(--ink);
  -webkit-appearance: none; appearance: none;
  transition: border-color .12s, box-shadow .12s;
}
input[type="date"] { font-variant-numeric: tabular-nums; }
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px -6px var(--accent-glow);
}

/* チップ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  min-height: var(--tap); padding: 9px 15px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); font: inherit;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.chips button.on {
  background: rgba(56,224,210,0.12); border-color: var(--accent);
  color: var(--ink); font-weight: 600;
  box-shadow: 0 0 16px -6px var(--accent-glow);
}
.chips button.system { border-style: dashed; color: var(--muted); }
.chips button.system.on {
  background: var(--surface); border-style: solid; border-color: var(--line-strong); color: var(--ink);
  box-shadow: none;
}

/* ===== 点検数ホイール ===== */
.wheel {
  position: relative; height: calc(var(--wheel-item-h) * 5);
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--bg2); overflow: hidden;
}
.wheel-scroll {
  height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.wheel-scroll::-webkit-scrollbar { display: none; }
.wheel-pad { height: calc(var(--wheel-item-h) * 2); }
.wheel-item {
  display: block; width: 100%; height: var(--wheel-item-h);
  border: none; background: none; color: var(--muted);
  font: 20px var(--mono); scroll-snap-align: center;
  transition: color .1s, transform .1s;
}
.wheel-item.is-center { color: var(--accent); font-size: 24px; font-weight: 700; }
.wheel-item.wheel-unset { color: var(--muted); }
.wheel-item.wheel-unset.is-center { color: var(--magenta); }
.wheel-marker {
  position: absolute; left: 8px; right: 8px; top: 50%; height: var(--wheel-item-h);
  transform: translateY(-50%); pointer-events: none;
  border-top: 1px solid rgba(56,224,210,0.35); border-bottom: 1px solid rgba(56,224,210,0.35);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--accent); font: 18px var(--mono); padding: 0 10px;
}
.wheel-mask { position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 40px -10px rgba(0,0,0,0.6); }
.linkbtn {
  border: none; background: none; color: var(--accent); font: inherit; font-size: 13px;
  padding: 8px 2px; text-decoration: underline; text-underline-offset: 3px;
}
#qWheelTypeBox { display: inline-flex; gap: 8px; align-items: center; margin-left: 8px; }
#qWheelTypeInput { width: 100px; min-height: 40px; }

/* ===== 2階層セレクタ ===== */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface);
}
.cat-head {
  width: 100%; text-align: left; font: inherit; font-weight: 600; color: var(--ink);
  background: transparent; border: none; padding: 13px 14px; min-height: var(--tap);
  display: flex; align-items: center; gap: 10px;
}
.cat-head .cat-dot {
  width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto;
  background: var(--c, var(--muted)); box-shadow: 0 0 10px -1px var(--c, transparent);
}
.cat-head .chev { margin-left: auto; color: var(--muted); transition: transform .15s; font-size: 18px; }
.cat.open .cat-head { background: rgba(255,255,255,0.03); }
.cat.open .cat-head .chev { transform: rotate(90deg); }
.cat.has-sel .cat-head { color: var(--c, var(--ink)); }
.cat-count {
  min-width: 22px; height: 22px; border-radius: 999px; padding: 0 7px;
  background: var(--c, var(--muted)); color: #0b0e14; font: 700 12px var(--mono);
  display: inline-flex; align-items: center; justify-content: center;
}
.cat-body { padding: 10px 12px 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }

/* 写真・メモの小項目 ＝ 単一選択チップ */
#pmCatList .sub {
  min-height: 44px; padding: 9px 13px; font: inherit;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-soft);
}
#pmCatList .sub.on {
  background: rgba(56,224,210,0.12); border-color: var(--accent); color: var(--ink); font-weight: 600;
}

/* 日次品質の小項目 ＝ その場でカウント（大項目色をアクセントに） */
#catList .cat-body { flex-direction: column; align-items: stretch; gap: 8px; }
#catList .sub {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--bg2);
  padding: 0 6px 0 0; min-height: 52px; overflow: hidden;
  transition: background .12s, border-color .12s;
}
#catList .sub.on {
  border-color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--bg2));
  box-shadow: inset 3px 0 0 var(--c, var(--accent));
}
#catList .sub-tap {
  flex: 1; text-align: left; border: none; background: none; font: inherit;
  padding: 14px 14px; min-height: 52px; color: var(--ink-soft);
}
#catList .sub.on .sub-tap { font-weight: 600; color: var(--ink); }
#catList .sub-ctrl { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
#catList .sub-minus, #catList .sub-plus {
  width: 42px; height: 42px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); font: 19px var(--mono); font-weight: 600; color: var(--ink);
}
#catList .sub-minus:active, #catList .sub-plus:active { background: rgba(255,255,255,0.08); }
#catList .sub-badge {
  min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px;
  background: var(--c, var(--accent)); color: #0b0e14; font: 700 13px var(--mono);
  display: inline-flex; align-items: center; justify-content: center;
}
#catList .sub-divider {
  font: 10px var(--mono); color: var(--muted); letter-spacing: 0.14em;
  padding: 8px 2px 2px; margin-top: 4px; border-top: 1px solid var(--line);
}
#catList .sub-divider:first-child { border-top: none; margin-top: 0; padding-top: 2px; }
.pick-head { display: flex; align-items: flex-start; gap: 10px; }
.pick-head .hint { flex: 1; }
.pick-head .linkbtn { flex: 0 0 auto; white-space: nowrap; }

/* カルテ番号系は廃止（v0.3）。受付日/お客様番号は通常の入力欄を使う */

/* ===== 問題箇所タリー（上部一覧） ===== */
.tally { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.trow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--c, var(--accent));
  border-radius: var(--r-sm); padding: 10px 12px;
}
.trow-name { flex: 1 1 100%; font-weight: 600; font-size: 14px; color: var(--ink); }
.trow-stepper { display: flex; align-items: center; gap: 6px; }
.trow-stepper button {
  width: 40px; height: 40px; border-radius: 9px; font: 18px var(--mono); font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--bg2); color: var(--ink);
}
.trow-stepper input {
  width: 54px; height: 40px; text-align: center; border: 1px solid var(--line-strong);
  border-radius: 9px; font: 15px var(--mono); background: var(--bg2); min-height: 0; color: var(--ink);
}
.trow-x {
  margin-left: auto; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit;
}
.trow-note { flex: 1 1 100%; min-height: 40px; }

.today-count { font: 600 14px var(--mono); color: var(--ink-soft); margin: 10px 2px 0; letter-spacing: 0.02em; }
#qPicker { margin-top: 12px; }

/* ===== 今日のチェック ストリップ ===== */
.today-strip { margin: 0 0 18px; }
.today-strip .strip-label { font: 11px var(--mono); color: var(--muted); letter-spacing: 0.06em; }
.today-strip .strip-row {
  display: flex; gap: 8px; margin-top: 6px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.today-strip .strip-row::-webkit-scrollbar { display: none; }
.strip-chip {
  flex: 0 0 auto; min-height: 38px; padding: 6px 12px; border-radius: 999px;
  font: 12px var(--mono); border: 1px solid var(--line-strong); background: var(--surface);
  white-space: nowrap;
}
.strip-chip.done { color: var(--accent); border-color: rgba(56,224,210,0.4); }
.strip-chip.todo { color: var(--muted); }

/* ===== 設定 ===== */
.set-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.set-head h2 { font-size: 16px; font-weight: 650; margin: 0; flex: 1; text-align: center; }
.set-head .linkbtn { flex: 0 0 auto; }
.set-head :last-child { min-width: 44px; }
.set-menu-item {
  width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between;
  min-height: 54px; padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 600;
}
.set-menu-item span { color: var(--muted); font-size: 18px; }

.roster-list { display: flex; flex-direction: column; gap: 8px; }
.roster-row {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  padding: 8px 10px; min-height: 48px;
}
.roster-row.inactive { opacity: 0.5; }
.roster-row input { flex: 1; min-width: 0; min-height: 40px; }
.roster-row .roster-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.roster-row .roster-state { flex: 0 0 auto; font: 10px var(--mono); color: var(--muted); }
.roster-row .roster-id { flex: 0 0 auto; font: 10px var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.roster-toggle {
  flex: 0 0 auto; min-height: 38px; padding: 0 12px; border-radius: 8px; font: 12px var(--mono);
  border: 1px solid var(--line-strong); background: var(--bg2);
}
.roster-toggle.on { color: var(--accent); border-color: rgba(56,224,210,0.4); }
.roster-toggle.off { color: var(--magenta); border-color: var(--magenta); }

.edit-actions button.primary { flex: 1; }

/* ===== 写真サムネ ===== */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thumb {
  position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line-strong); background: var(--bg2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .th-x {
  position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 999px;
  border: none; background: rgba(0,0,0,0.6); color: #fff; font: 12px/1 sans-serif;
}
.filebtn { display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* ===== 下部の固定ボタン ===== */
.sticky-actions {
  position: fixed; left: 0; right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom) + var(--kb, 0px));
  background: var(--sticky-bg, rgba(11,14,20,0.9));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 -1px 0 var(--line), 0 -12px 28px rgba(0,0,0,0.4);
  padding: 12px 15px; display: flex; flex-direction: column; gap: 8px;
  max-width: 640px; margin: 0 auto;
}
button.primary {
  min-height: 52px; border: 1px solid var(--accent); border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 22px -6px var(--accent-glow);
  transition: transform .08s, filter .12s;
}
button.primary.wide { width: 100%; }
button.primary:active { filter: brightness(0.92); transform: translateY(1px); }
.edit-actions { display: flex; gap: 8px; }
button.danger {
  flex: 1; min-height: 48px; border: 1px solid var(--magenta);
  background: transparent; color: var(--magenta); border-radius: 12px; font: inherit; font-weight: 600;
}
button.ghost {
  min-height: 46px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); border-radius: 12px; font: inherit;
}
button.ghost.wide { width: 100%; }
.edit-actions button.ghost { flex: 1; }

/* ===== 一覧 / 写真ギャラリー ===== */
.filter { display: flex; gap: 8px; margin-bottom: 14px; }
.filter button {
  flex: 1; min-height: var(--tap); border: 1px solid var(--line-strong);
  background: var(--surface); border-radius: 12px; font: inherit; color: var(--ink-soft);
}
.filter button.on {
  background: rgba(56,224,210,0.12); border-color: var(--accent); color: var(--ink); font-weight: 600;
}
#pmNew { margin-bottom: 14px; }

.day-group { margin-bottom: 24px; }
.day-head {
  font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 0 2px 8px;
  padding-left: 10px; border-left: 3px solid var(--wd, var(--muted));
}
.day-summary {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  border-left: 3px solid var(--wd, var(--muted));
  padding: 12px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-soft);
}
.day-summary b { font: 650 15px var(--mono); color: var(--ink); }
.day-summary .rate { color: var(--accent); font-weight: 600; }
.day-summary .bd { color: var(--muted); margin-top: 5px; }

.rec {
  width: 100%; text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px;
  font: inherit; display: block;
}
.rec:active { background: rgba(255,255,255,0.06); }
.rec .rec-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec .rec-maker { font-weight: 650; font-size: 15px; color: var(--ink); }
.rec .rec-badge {
  font: 11px var(--mono); padding: 3px 9px; border-radius: 999px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong);
}
.rec .rec-badge.track { color: var(--violet); border-color: var(--violet); }
.rec .rec-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.rec .tg {
  font-size: 12px; padding: 3px 9px; border-radius: 7px;
  color: var(--c, var(--ink-soft));
  background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 45%, transparent);
}
.rec .rec-sub { font-size: 12px; color: var(--muted); margin-top: 8px; }
.rec .rec-memo { font-size: 14px; margin-top: 8px; white-space: pre-wrap; color: var(--ink-soft); }

/* 写真カード */
.pcard { display: flex; gap: 12px; }
.pcard .pc-thumb {
  width: 76px; height: 76px; border-radius: 10px; overflow: hidden; flex: 0 0 auto;
  border: 1px solid var(--line-strong); background: var(--bg2);
}
.pcard .pc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard .pc-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.pcard .pc-body { flex: 1; min-width: 0; }
.pcard .pc-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.empty { color: var(--muted); text-align: center; padding: 48px 0; }

/* 集計（全体／技工士別）カード */
.agg-card { margin-bottom: 14px; }
.agg-kpis { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.agg-kpi {
  flex: 1 1 auto; min-width: 78px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px; text-align: center;
}
.agg-kpi-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.agg-kpi-val { font: 650 16px var(--mono); color: var(--ink); }
.agg-kpi-val small { font: 400 11px var(--mono); color: var(--muted); margin-left: 1px; }
.agg-breakdown { margin-top: 12px; }
.agg-cat { margin-bottom: 8px; }
.agg-cat-head { font-size: 12.5px; font-weight: 650; color: var(--ink); margin-bottom: 3px; }
.agg-sub-row {
  display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft);
  padding: 2px 0 2px 14px;
}
.agg-sub-n { font: 600 12.5px var(--mono); color: var(--ink); }
.agg-empty { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ===== 下部ナビ ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg, rgba(11,14,20,0.92));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 0 rgba(56,224,210,0.08);
  display: flex; z-index: 20;
}
.bottom-nav button {
  flex: 1; border: none; background: none; font: inherit; font-size: 12.5px; color: var(--muted);
  letter-spacing: 0.04em;
}
.bottom-nav button.on { color: var(--accent); font-weight: 600; }

/* ===== トースト ===== */
.toast {
  position: fixed; left: 50%;
  bottom: calc(140px + env(safe-area-inset-bottom) + var(--kb, 0px));
  transform: translateX(-50%);
  background: #060a10; border: 1px solid var(--line-strong);
  color: var(--ink); padding: 11px 18px; border-radius: 12px;
  font-size: 13.5px; z-index: 60; max-width: 88%; text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55), 0 0 22px -8px var(--accent-glow);
}

/* ===== 写真の全画面表示 ===== */
.photo-viewer {
  position: fixed; inset: 0; z-index: 100; background: rgba(3,5,8,0.96);
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.photo-viewer img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transition: transform .15s; transform-origin: center;
}
.photo-viewer.zoom img { transform: scale(2.2); }
.pv-close {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px;
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.5); color: #fff; font: 16px/1 sans-serif;
}

/* テーマに追従させる（cyber ハードコードの上書き） */
.cat-count, #catList .sub-badge { color: var(--bg); }
.filter button.on { background: var(--accent-soft, rgba(56,224,210,0.12)); }

/* ===== データ画面 ===== */
.data-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; min-height: 40px; padding: 0 12px; border-radius: 10px; font: 12px var(--mono);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
}
.seg button.on { background: var(--accent-soft, rgba(56,224,210,0.12)); border-color: var(--accent); color: var(--ink); font-weight: 700; }
.theme-seg button { letter-spacing: 0.1em; }
.data-sub button { font: 13px inherit; }

.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-grid button {
  min-height: 46px; border-radius: 10px; font: inherit;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
}
.preset-grid button.on { background: var(--accent-soft, rgba(56,224,210,0.12)); border-color: var(--accent); color: var(--ink); font-weight: 600; }

.range-row { display: flex; align-items: center; gap: 8px; }
.range-row span { color: var(--muted); }
.chk-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.chk-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink);
  min-height: 38px; padding: 4px 2px;
}
.chk-row input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.mono-tag { font: 10px var(--mono); color: var(--muted); letter-spacing: 0.1em; }

/* ===== 印刷プレビュー ===== */
.print-view {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  background: var(--bg);
}
.print-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: var(--header-bg, var(--bg)); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.print-bar .linkbtn { flex: 0 0 auto; }
.print-bar .mono-tag { flex: 1; }
.print-bar .primary { flex: 0 0 auto; min-height: 40px; padding: 0 16px; font-size: 14px; }
.print-body {
  max-width: 720px; margin: 0 auto; padding: 20px 18px 60px;
  color: var(--ink); background: var(--bg);
}

/* 印刷ビューの中身（cyber/official 両対応・var参照） */
.pr-title { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 18px; }
.pr-title h1 { font-size: 18px; margin: 0 0 4px; }
.pr-meta { font-size: 11px; color: var(--muted); }
.print-body h2 {
  font-size: 14px; margin: 22px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}
.print-body h3 { font-size: 12.5px; margin: 14px 0 5px; color: var(--ink-soft); }
.pr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pr-table th, .pr-table td { border: 1px solid var(--line-strong); padding: 6px 8px; text-align: left; }
.pr-table th { background: var(--bg2); font-weight: 600; }
.pr-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pr-table tr.pr-total td { font-weight: 700; background: var(--bg2); }
.pr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.pr-none { font-size: 12px; color: var(--muted); }
.pr-day { margin-bottom: 12px; break-inside: avoid; }
.pr-dayhead { font-size: 12px; font-weight: 600; border-left: 3px solid; padding-left: 8px; margin-bottom: 4px; }
.pr-drow { font-size: 12px; padding: 4px 0 4px 10px; }
.pr-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pr-tag { font-size: 11px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink-soft); }

.pr-photo-rec { break-inside: avoid; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px; margin-bottom: 12px; }
.pr-photo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.pr-photo-no { font: 700 12px var(--mono); }
.pr-photo-meta { font-size: 11px; color: var(--muted); }
.pr-photo-id { font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
.pr-photo-memo { font-size: 12.5px; white-space: pre-wrap; margin-bottom: 8px; }
.pr-photo-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-photo-imgs img {
  width: 46%; max-width: 260px; border: 1px solid var(--line-strong); border-radius: 4px;
  object-fit: contain; background: var(--bg2);
}

/* ===== 印刷（紙・PDF） ===== */
@media print {
  .app-header, .bottom-nav, .toast, #photoViewer, .screen, .no-print, .print-bar { display: none !important; }
  html, body { background: #fff !important; }
  .print-view { position: static !important; overflow: visible !important; background: #fff !important; }
  .print-view[hidden] { display: none !important; }
  .print-body { max-width: none; margin: 0; padding: 0; color: #000; }
  .pr-photo-imgs img { width: 44%; }
  @page { margin: 15mm; }
}
