/* 補助金シミュレーター（営業用スマホアプリ）
 *
 * モバイルファースト。片手・親指操作を前提にタップ領域は最低44px。
 * CSPを厳格に保つため、インラインstyleは使わずここにクラスを定義する。
 */

:root {
  --brand: #1b5e3b; /* Lカート ブランドカラー（深緑） */
  --brand-dark: #133f28;
  --brand-light: #eef4f1;
  --brand-tint: #f4f9f7;
  --accent: #c98a1e;

  --ink: #1c2622;
  --ink-soft: #5b6b64;
  --ink-faint: #8a9891;

  --line: #dde5e1;
  --line-soft: #eaf0ed;
  --bg: #f2f5f4;
  --surface: #ffffff;

  --ok: #1e7a4d;
  --ok-bg: #e6f4ea;
  --ng: #c0392b;
  --ng-bg: #fdecea;
  --warn: #9a6508;
  --warn-bg: #fdf3e0;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 38, 34, 0.06), 0 6px 18px rgba(28, 38, 34, 0.07);

  --appbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(27, 94, 59, 0.12);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, "Noto Sans JP", system-ui,
    -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
}

.noscript {
  padding: 24px;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* アプリシェル                                                        */
/* ------------------------------------------------------------------ */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  background: var(--brand);
  color: #fff;
}

.appbar .bar-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar .bar-btn {
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
}

.appbar .bar-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.appbar .bar-btn.placeholder {
  visibility: hidden;
}

.view {
  padding: 16px 16px 24px;
}

/* 下部固定のアクションバー */
.actionbar:not(:empty) {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

/* ------------------------------------------------------------------ */
/* ボタン                                                              */
/* ------------------------------------------------------------------ */

.btn {
  flex: 1 1 auto;
  min-height: 50px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.ghost {
  flex: 0 0 auto;
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
  font-weight: 600;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.btn.danger {
  color: var(--ng);
  border-color: var(--ng-bg);
  background: var(--ng-bg);
}

/* ------------------------------------------------------------------ */
/* カード・共通パーツ                                                  */
/* ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 22px 0 10px;
  letter-spacing: 0.02em;
}

.section-title:first-child {
  margin-top: 0;
}

.lead {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.muted {
  color: var(--ink-faint);
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* ウィザード                                                          */
/* ------------------------------------------------------------------ */

.progress {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
}

.progress span {
  flex: 1 1 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.progress span.done {
  background: var(--brand);
}

.step-head {
  margin: 4px 0 18px;
}

.step-head .step-no {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.08em;
}

.step-head h2 {
  margin: 2px 0 6px;
  font-size: 22px;
  line-height: 1.4;
}

.step-head p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.field {
  margin-bottom: 18px;
}

.field > label,
.field .field-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
}

.field .sub {
  display: block;
  font-weight: normal;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.field .hint {
  display: block;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 6px;
  line-height: 1.55;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font-size: 17px; /* iOSで自動ズームしない下限 */
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27, 94, 59, 0.14);
}

/* 単位付き入力 */
.input-unit {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-unit input {
  text-align: right;
  font-weight: 700;
  font-size: 20px;
}

.input-unit .unit {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* 選択肢（大きなタップ領域） */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 56px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.option input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.option .opt-body {
  flex: 1 1 auto;
  min-width: 0;
}

.option .opt-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.option .opt-desc {
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-top: 2px;
}

.option.selected {
  border-color: var(--brand);
  background: var(--brand-tint);
}

/* 金額のクイック選択 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  min-height: 44px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

input[type="range"] {
  width: 100%;
  height: 44px;
  accent-color: var(--brand);
  background: transparent;
}

/* ------------------------------------------------------------------ */
/* 結果画面                                                            */
/* ------------------------------------------------------------------ */

.hero {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  text-align: center;
}

.hero .hero-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.hero .hero-amount {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  margin: 4px 0;
  letter-spacing: -0.02em;
}

.hero .hero-prog {
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.hero .hero-net {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

.hero .hero-net strong {
  font-size: 19px;
  margin-left: 4px;
}

.hero.empty {
  background: var(--surface);
  color: var(--ink-soft);
}

.hero.empty .hero-amount {
  color: var(--ink-faint);
  font-size: 26px;
}

/* 投資額スライダー */
.sim {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 6px;
  margin-bottom: 16px;
}

.sim-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sim-head .sim-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.sim-head .sim-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
}

.sim-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: -4px;
}

/* 制度カード */
.prog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.prog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}

.prog-head .prog-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
}

.prog-head .prog-sub {
  display: block;
  font-size: 12px;
  font-weight: normal;
  color: var(--ink-faint);
  margin-top: 1px;
}

.prog-head .prog-amount {
  flex: 0 0 auto;
  text-align: right;
}

.prog-head .prog-amount .a {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.2;
}

.prog-head .prog-amount .l {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
}

.prog.blocked .prog-head .prog-amount .a {
  color: var(--ink-faint);
  font-size: 16px;
}

.prog-figures {
  display: flex;
  border-top: 1px solid var(--line-soft);
}

.prog-figures div {
  flex: 1 1 0;
  padding: 10px 12px;
  text-align: center;
  border-right: 1px solid var(--line-soft);
}

.prog-figures div:last-child {
  border-right: none;
}

.prog-figures .f-label {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
}

.prog-figures .f-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-top: 1px;
}

/* 増額提案 */
.boosts {
  border-top: 1px solid var(--line-soft);
  background: #fffdf7;
  padding: 10px 16px 12px;
}

.boosts .boosts-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 6px;
}

.boost {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px dashed #eadfc4;
}

.boost:last-child {
  border-bottom: none;
}

.boost .b-delta {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.boost .b-body {
  flex: 1 1 auto;
  min-width: 0;
}

.boost .b-label {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
}

.boost .b-note {
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-top: 1px;
}

/* 折りたたみ */
details.fold {
  border-top: 1px solid var(--line-soft);
}

details.fold > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-dark);
  cursor: pointer;
  list-style: none;
}

details.fold > summary::-webkit-details-marker {
  display: none;
}

details.fold > summary::after {
  content: "＋";
  margin-left: auto;
  color: var(--ink-faint);
  font-weight: normal;
}

details.fold[open] > summary::after {
  content: "−";
}

details.fold .fold-body {
  padding: 0 16px 14px;
  font-size: 13.5px;
}

/* 金額内訳 */
table.money {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.money th,
table.money td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-weight: normal;
  color: var(--ink-soft);
}

table.money td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

table.money tr.total th,
table.money tr.total td {
  font-weight: 800;
  color: var(--ink);
  border-bottom: none;
  padding-top: 10px;
}

table.money tr.deduct td {
  color: var(--brand);
}

/* 要件チェック */
ul.reqs {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.reqs > li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.55;
}

ul.reqs > li:last-child {
  border-bottom: none;
}

ul.reqs .mark {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  font-weight: 800;
}

ul.reqs .mark.ok {
  color: var(--ok);
}
ul.reqs .mark.ng {
  color: var(--ng);
}
ul.reqs .mark.todo {
  color: var(--warn);
}

ul.reqs .r-detail {
  display: block;
  font-size: 11.5px;
  color: var(--ink-faint);
}

ul.reqs .r-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

ul.reqs .r-toggle.is-ng {
  background: var(--ng-bg);
  border-color: var(--ng-bg);
  color: var(--ng);
}

/* メッセージ */
.msg {
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.msg:last-child {
  margin-bottom: 0;
}

.msg.ng {
  background: var(--ng-bg);
  color: #8c2b20;
}
.msg.warn {
  background: var(--warn-bg);
  color: #7a5008;
}
.msg.info {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.msg ul {
  margin: 5px 0 0;
  padding-left: 18px;
}

.msg li + li {
  margin-top: 3px;
}

/* ------------------------------------------------------------------ */
/* 商談一覧（ホーム）                                                  */
/* ------------------------------------------------------------------ */

.case {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.case:last-child {
  border-bottom: none;
}

.case .c-body {
  flex: 1 1 auto;
  min-width: 0;
}

.case .c-name {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case .c-meta {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 1px;
}

.case .c-amount {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand);
}

.case .c-chev {
  flex: 0 0 auto;
  color: var(--ink-faint);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
}

.empty-state .es-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 10px;
}

/* 免責 */
.disclaimer {
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.65;
  padding: 4px 2px 0;
}

.disclaimer a {
  color: var(--brand);
}

.sources {
  margin: 8px 0 0;
  padding-left: 18px;
}

.sources li {
  margin-bottom: 3px;
}

/* ------------------------------------------------------------------ */
/* トースト                                                            */
/* ------------------------------------------------------------------ */

/* クリップボードへのコピー用（画面外に置く） */
.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 50;
  max-width: 90vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(28, 38, 34, 0.93);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ */
/* 画面が広いとき                                                      */
/* ------------------------------------------------------------------ */

@media (min-width: 620px) {
  .app {
    box-shadow: 0 0 0 1px var(--line);
    min-height: 100vh;
  }
  .view {
    padding: 20px 20px 28px;
  }
  .hero .hero-amount {
    font-size: 46px;
  }
}

/* ------------------------------------------------------------------ */
/* 印刷（結果を紙で残したいとき）                                      */
/* ------------------------------------------------------------------ */

@media print {
  .appbar,
  .actionbar,
  .sim input[type="range"],
  .toast {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .app {
    max-width: none;
    box-shadow: none;
  }
  .hero {
    background: #fff;
    color: var(--ink);
    border: 2px solid var(--brand);
  }
  .hero .hero-label,
  .hero .hero-prog,
  .hero .hero-net {
    color: var(--ink-soft);
  }
  .hero .hero-amount {
    color: var(--brand);
  }
  .prog,
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--line);
  }
  details.fold[open] .fold-body {
    display: block;
  }
}

/* ------------------------------------------------------------------ */
/* 偏りのない提示のためのパーツ                                        */
/* ------------------------------------------------------------------ */

/* 後払いであることをヒーローで示す */
.hero .hero-note {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.hero .hero-warn {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
  color: #ffe9c2;
  line-height: 1.5;
}

/* 目的に合致した制度のタグ */
.prog-name .tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 2px;
}

/* 毎年続くコスト */
.ongoing {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fdf6f4;
}

.ongoing .og-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ng);
}

.ongoing .og-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--ng);
  margin-left: auto;
}

.ongoing .og-note {
  flex: 1 0 100%;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

/* 増額提案に併記する継続コスト */
.boost .b-cost {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ng);
  line-height: 1.5;
  margin-top: 2px;
}

/* 注意点・リスク */
ul.risks {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.risks > li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.55;
}

ul.risks > li:last-child {
  border-bottom: none;
}

ul.risks .mark {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  font-weight: 800;
  color: var(--ink-faint);
}

ul.risks li.risk-high .mark {
  color: var(--ng);
}

ul.risks .risk-label {
  font-weight: 700;
}

ul.risks li.risk-high .risk-label {
  color: #8c2b20;
}

ul.risks .r-detail {
  display: block;
  font-size: 11.5px;
  font-weight: normal;
  color: var(--ink-faint);
  margin-top: 1px;
}

/* 要件の3状態トグル */
ul.reqs .r-toggle.is-unknown {
  background: var(--warn-bg);
  border-color: var(--warn-bg);
  color: var(--warn);
}

ul.reqs .r-toggle.is-yes {
  background: var(--ok-bg);
  border-color: var(--ok-bg);
  color: var(--ok);
}

ul.reqs .r-toggle.is-no {
  background: var(--ng-bg);
  border-color: var(--ng-bg);
  color: var(--ng);
}

/* ------------------------------------------------------------------ */
/* 順算 / 逆算 の切り替え                                              */
/* ------------------------------------------------------------------ */

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--line-soft);
}

.segmented .seg {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.segmented .seg.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(28, 38, 34, 0.12);
}

.sim .seg-select {
  min-height: 44px;
  font-size: 15px;
  margin-bottom: 6px;
}

.sim .sim-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-bottom: 8px;
}
