:root {
  --navy: #16324f;
  --navy-2: #24507a;
  --accent: #f2a93b;
  --accent-ink: #4a2d00;
  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #6b7686;
  --line: #dde2ea;
  --ok: #1f8a5b;
  --warn: #c2541b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 4px 14px rgba(16, 30, 54, .06);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

/* ---------- 上部バー・下部ナビ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.topbar h1 { font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
.topbar-right { display: flex; gap: 8px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(242, 169, 59, .25); margin: 0 4px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; }
.icon-btn:active { background: rgba(255, 255, 255, .15); }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; text-align: center; padding: 13px 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.bottom-nav a.active { color: var(--navy); box-shadow: inset 0 3px 0 var(--accent); }

/* ---------- ページ ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; display: flex; flex-direction: column; gap: 14px; }
.fx-page { padding-bottom: 110px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h3 { font-size: 15px; }
.step { display: flex; align-items: center; gap: 8px; }
.step b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; }
.section-head h2 { font-size: 16px; }
.section-head small { color: var(--muted); font-weight: 400; }
.grow { flex: 1; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-gap { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.hint { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.unit-line { margin: -4px 0 0; font-size: 14px; font-weight: 700; color: var(--navy-2); }
.unit-line:empty { display: none; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; background: rgba(255, 255, 255, .6); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty.small { padding: 14px; font-size: 13px; }
.why { text-align: left; margin: 8px 0 0; padding-left: 18px; }
.notice { background: #fff7e8; border: 1px solid #f6d9a6; color: #6b4a12; border-radius: 12px; padding: 10px 12px; font-size: 13px; }

/* ---------- 入力 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 700; color: #3d4a5c; }
input:not([type=file]), textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fbfcfd;
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(36, 80, 122, .15); background: #fff; }
.search { background: #fff !important; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .btn { white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .08s;
}
.btn:active { transform: scale(.98); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { padding: 15px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger-ghost { color: var(--warn); border-color: transparent; background: transparent; }
.topbar .btn.danger-ghost { color: #ffd2bd; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.chips.small .chip { padding: 5px 10px; font-size: 12.5px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
.toggle .knob { width: 30px; height: 18px; border-radius: 9px; background: #cfd6e0; position: relative; transition: background .15s; }
.toggle .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { border-color: var(--navy-2); }
.toggle.on .knob { background: var(--navy-2); }
.toggle.on .knob::after { left: 14px; }

.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; width: max-content; }
.stepper button { width: 48px; height: 44px; border: 0; background: #f4f6f9; font-size: 22px; cursor: pointer; }
.stepper output { min-width: 56px; text-align: center; font-size: 18px; font-weight: 700; }

/* ---------- 写真枠 ---------- */
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-slot {
  position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: repeating-linear-gradient(45deg, #f5f7fa, #f5f7fa 10px, #eef1f5 10px, #eef1f5 20px);
  border: 2px dashed #c4ccd8;
}
.photo-slot.big { aspect-ratio: 4 / 3; max-height: 360px; }
.photo-slot.has { border: 0; background: #000; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot.big.has img { object-fit: contain; }
.ph-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--navy-2); font-weight: 700; font-size: 13px; text-align: center; padding: 8px; }
.ph-del {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.ph-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; font-size: 11.5px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }

/* ---------- カード ---------- */
.card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.card.dim, .dim { opacity: .55; }
#list, #fx-list { display: flex; flex-direction: column; gap: 10px; }
.thumb { width: 62px; height: 62px; flex: none; border-radius: 10px; object-fit: cover; background: #e9edf2; }
.thumb.prod { object-fit: contain; background: #fff; border: 1px solid var(--line); }
.thumb-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8a96a8; }
.thumb-ph small { font-size: 9px; margin-top: -2px; max-width: 100%; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-ph.q { font-size: 22px; font-weight: 700; color: var(--warn); background: #fdf0e9; }
.fx-card { gap: 8px; }
.fx-card .thumb { width: 54px; height: 54px; }
.fx-del {
  flex: none; align-self: center; padding: 8px 10px; border-radius: 9px; cursor: pointer;
  border: 1.5px solid #f3c9b4; background: #fff7f3; color: var(--warn); font-size: 12px; font-weight: 700;
}
.fx-no { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; }
.fx-arrow { color: var(--accent); flex: none; display: flex; }
.fx-arrow svg { width: 18px; height: 18px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e7ecf3; color: var(--navy); white-space: nowrap; }
.badge.best { background: var(--accent); color: var(--accent-ink); }
.badge.warn { background: #fde6d8; color: var(--warn); }
.st-提案済 { background: #e2f0ff; color: #1859a5; }
.st-受注 { background: #dff5ea; color: var(--ok); }
.st-失注 { background: #eee; color: #888; }
.flag { display: inline-block; margin: 2px 4px 0 0; padding: 1px 7px; border-radius: 6px; background: #fde6d8; color: var(--warn); font-size: 11px; font-weight: 600; }
.flag.soft { background: #edf0f4; color: var(--muted); }

/* 提案候補 */
#sugg { display: flex; flex-direction: column; gap: 8px; }
.sugg-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px; cursor: pointer;
  background: #fff; border: 2px solid var(--line); border-radius: 13px; transition: border-color .15s, background .15s;
}
.sugg-card .check { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); color: transparent; font-weight: 900; }
.sugg-card.selected { border-color: var(--navy-2); background: #f1f6fc; }
.sugg-card.selected .check { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.sugg-card.static { cursor: default; }

/* 下部の操作バー */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.action-bar .btn { padding: 14px 10px; }

/* モーダル */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 35, .45); display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--bg); width: 100%; max-width: 760px; max-height: 88vh; border-radius: 18px 18px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.modal-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 100;
  background: rgba(20, 30, 45, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 提案画面 ---------- */
.present { max-width: 900px; margin: 0 auto; padding: 16px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.pz-cover {
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: 18px; padding: 22px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; position: relative; overflow: hidden;
}
.pz-cover::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(rgba(242, 169, 59, .55), transparent 70%); }
.pz-title small { color: var(--accent); font-weight: 700; letter-spacing: .08em; }
.pz-title h1 { font-size: 24px; margin: 4px 0; }
.pz-title p { margin: 0; opacity: .85; font-size: 14px; }
.pz-meta { font-size: 13px; text-align: right; align-self: flex-end; opacity: .95; position: relative; z-index: 1; }
.pz-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pz-photos:empty { display: none; }
.pz-photos figure, .pz-compare figure { margin: 0; }
.pz-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; display: block; }
.pz-photos figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pz-intro { background: #fff; border-radius: 14px; padding: 14px 16px; font-size: 13.5px; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.pz-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.pz-summary div { flex: 1; min-width: 120px; background: #fff; border-radius: 14px; padding: 12px; text-align: center; box-shadow: var(--shadow); font-size: 12px; color: var(--muted); }
.pz-summary b { display: block; font-size: 24px; color: var(--navy); }
.pz-item { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px; break-inside: avoid; }
.pz-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pz-item-head .muted { font-size: 13px; }
.pz-no { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 700; }
.pz-compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.pz-compare img, .pz-noimg { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: #eef1f5; display: grid; place-items: center; color: #9aa5b5; font-size: 12px; }
.pz-note { margin: 10px 0 0; color: #d0261d; font-size: 12px; font-weight: 700; line-height: 1.5; }
.pz-intro { position: relative; }
.pz-edit { display: flex; margin: 10px 0 0 auto; }
.work-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 6px; margin-bottom: 6px; }
.work-row input { padding: 9px 10px; }
.work-total { display: flex; justify-content: space-between; padding: 8px 4px; font-size: 14px; }
.work-total b { font-size: 17px; color: var(--navy); }
.modal-box textarea { min-height: 180px; }
.pz-new img, .pz-new .pz-noimg { object-fit: contain; background: #fafbfc; border: 1px solid var(--line); }
.pz-compare figcaption { font-size: 13px; margin-top: 6px; }
.pz-compare figcaption b { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 6px; background: #e7ecf3; font-size: 11px; color: var(--navy); }
.pz-new figcaption b { background: var(--accent); color: var(--accent-ink); }
.pz-arrow { display: flex; flex-direction: column; align-items: center; color: var(--accent); padding-top: 40%; }
.pz-arrow small { font-size: 10px; font-weight: 700; }
.pz-price { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.pz-price b { font-size: 18px; color: var(--navy); }
.pz-est { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px; break-inside: avoid; border-top: 4px solid var(--navy); }
.pz-est h3 { font-size: 16px; margin-bottom: 8px; }
.pz-est table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pz-est td { padding: 7px 4px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.pz-est td small { display: block; color: var(--muted); font-size: 11px; }
.pz-est .num { text-align: right; white-space: nowrap; }
.pz-est tr.sub td { font-weight: 700; background: #f6f8fb; }
.pz-est tr.grand td { font-weight: 800; font-size: 18px; color: var(--navy); border-bottom: 0; border-top: 2px solid var(--navy); padding-top: 10px; }
.pz-est p { margin: 8px 0 0; }
.hide-price .price { display: none !important; }
.topbar-right .btn.sm:not(.accent) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.pz-others { background: #fff; border-radius: 14px; padding: 14px 16px; font-size: 13px; }
.pz-others h3 { font-size: 14px; }
.pz-others ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.pz-disclaimer { font-size: 11.5px; color: var(--muted); text-align: center; }

@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pz-title h1 { font-size: 20px; }
  .pz-meta { text-align: left; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .no-print, .bottom-nav, #toast, .modal { display: none !important; }
  .pz-note { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .present { max-width: none; padding: 0; gap: 10px; }
  .pz-cover, .pz-no, .pz-compare figcaption b, .pz-summary b { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pz-item, .pz-intro, .pz-summary div, .pz-est { box-shadow: none; border: 1px solid var(--line); }
  .pz-compare img, .pz-noimg { aspect-ratio: 4 / 3; max-height: 60mm; }
}
