/* =========================================================
   estimate.html（無料査定・概算シミュレーター・査定フォーム）
   接頭辞 .p-estimate- ／ base.css のトークンと部品だけで組む
   ========================================================= */

.p-estimate [id] { scroll-margin-top: 24px; }

/* ---------- 冒頭：左に写真・右に色面（アンカーの売却ページ冒頭） ---------- */
.p-estimate-hero { display: grid; grid-template-columns: minmax(0, 1fr); }
.p-estimate-hero__img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--taupe-2); }
.p-estimate-hero__in { padding: 0 16px 48px; }
.p-estimate-hero__panel .c-crumbs { color: var(--ink); } /* ink-2 はセージ面で 4.45:1＝AA 未満のため */
.p-estimate-hero__body { padding-top: 8px; }
.p-estimate-hero__lead { margin-top: 20px; max-width: 30em; }
.p-estimate-hero__links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 28px; }
@media (min-width: 768px) {
  .p-estimate-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(520px, auto); }
  /* 写真の枠は行の高さに従う（枠に aspect-ratio を付けない＝WebKit の3点セットを避ける） */
  .p-estimate-hero__media { position: relative; overflow: hidden; }
  .p-estimate-hero__img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; aspect-ratio: auto; }
  .p-estimate-hero__panel { display: flex; }
  /* 右列の左端から 705px＝コンテナの半分。右端がコンテナの右端と揃う */
  .p-estimate-hero__in { width: 100%; max-width: 705px; display: flex; flex-direction: column; padding: 0 32px 56px 56px; }
  .p-estimate-hero__body { margin: auto 0; padding-top: 24px; }
}
@media (min-width: 1200px) { .p-estimate-hero { grid-template-rows: minmax(600px, auto); } }
@media (min-width: 1360px) { .p-estimate-hero__in { padding-right: 40px; } }

/* ---------- シミュレーター ---------- */
.p-estimate-sim__head { margin-bottom: 32px; }
@media (min-width: 768px) { .p-estimate-sim__head { margin-bottom: 40px; } }

.p-estimate-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line-2); margin-bottom: 32px; }
@media (min-width: 768px) { .p-estimate-tabs { gap: 40px; margin-bottom: 48px; } }
.p-estimate-tab {
  position: relative; min-height: 48px; padding: 12px 0;
  font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--ink-2);
  transition: color .3s var(--ease);
}
.p-estimate-tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.p-estimate-tab:hover, .p-estimate-tab[aria-selected="true"] { color: var(--ink); }
.p-estimate-tab[aria-selected="true"]::after { transform: scaleX(1); }
.p-estimate-tab:focus-visible { outline-offset: 0; }

/* 入力（左 1〜12列）と査定書（右 14〜23列） */
@media (min-width: 768px) {
  .p-estimate-inputs { grid-column: 1 / 13; }
  .p-estimate-side { grid-column: 14 / 24; position: -webkit-sticky; position: sticky; top: calc(var(--util-h) + var(--head-h) + 24px); }
}

.p-estimate-group { border: 0; margin: 0; padding: 24px 0 28px; min-width: 0; border-top: 1px solid var(--line); }
.p-estimate-group:first-child { border-top: 0; padding-top: 0; }
.p-estimate-group:last-child { padding-bottom: 0; }
/* legend を float して下に余白を取る（legend に margin が効かない対策） */
.p-estimate-legend { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-size: 15px; font-weight: 500; line-height: 1.5; }
.p-estimate-legend + * { clear: both; }
.p-estimate-hint { margin-top: 12px; }
.p-estimate-textbtn {
  margin-left: .6em; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  transition: opacity .3s var(--ease);
}
.p-estimate-textbtn:hover { opacity: .6; }

/* 状態（S/A/B/C）＝記号と意味の2段 */
.p-estimate-choice--grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1200px) { .p-estimate-choice--grade { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.p-estimate-choice--grade label { display: block; }
.p-estimate-choice--grade span { display: flex; width: 100%; height: 100%; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 64px; padding: 10px 14px; }
.p-estimate-choice--grade b { font-family: "Inter", sans-serif; font-weight: 500; font-size: 16px; line-height: 1.2; letter-spacing: 0; }
.p-estimate-choice--grade small { font-size: 12px; line-height: 1.4; }

/* 査定書 */
.p-estimate-ledger .c-ledger__row { transition: opacity .35s var(--ease), transform .35s var(--ease); }
.p-estimate-ledger .c-ledger__row.is-enter { opacity: 0; transform: translateY(6px); transition: none; }
.p-estimate-row--sum .c-ledger__label { font-weight: 500; }
.p-estimate-row--sum { border-bottom-color: var(--ink); }
.p-estimate-ledger .c-ledger__total-label { flex-shrink: 0; }
.p-estimate-range { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; column-gap: .28em; margin-left: auto; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.p-estimate-range > span { white-space: nowrap; }
.p-estimate-range__sep { font-family: var(--f-serif); font-style: normal; font-weight: 400; }
@media (max-width: 767px) { .p-estimate-ledger .c-ledger__total-amt { font-size: 28px; } }
@media (min-width: 768px) and (max-width: 1199px) { .p-estimate-ledger .c-ledger__total-amt { font-size: 32px; } .p-estimate-ledger { padding: 28px 24px; } }
.p-estimate-apply { margin-top: 12px; }
@media (max-width: 767px) { .p-estimate-side { margin-top: 8px; } }

/* モードB：品位と重さ */
.p-estimate-gold .c-field + .c-field { margin-top: 20px; }
@media (min-width: 1024px) {
  .p-estimate-gold { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-items: start; }
  .p-estimate-gold .c-field + .c-field { margin-top: 0; }
}
.p-estimate-unit { position: relative; }
.p-estimate-unit .c-input { padding-right: 44px; }
.p-estimate-unit__g { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--ink-2); pointer-events: none; }
.p-estimate-unit .c-input[aria-invalid="true"], .p-estimate-apply-form [aria-invalid="true"].c-input { border-color: var(--red); }

/* 単価表：PC は入力の下（左列の2段目）、SP は査定書の後ろ（DOM 順） */
.p-estimate-rates { margin-top: 8px; padding-top: 28px; border-top: 1px solid var(--line); }
@media (min-width: 768px) {
  #est-panel-b > .p-estimate-inputs { grid-row: 1; }
  .p-estimate-side--b { grid-row: 1 / span 2; }
  .p-estimate-rates { grid-column: 1 / 13; grid-row: 2; margin-top: 40px; }
}
.p-estimate-rates__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 16px; }
.p-estimate-rates__tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1024px) { .p-estimate-rates__tables { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; } }
.p-estimate-rates__table { font-size: 14px; line-height: 1.5; }
.p-estimate-rates__table th, .p-estimate-rates__table td { padding: 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.p-estimate-rates__table thead th { padding: 0 0 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); border-bottom-color: var(--line-2); }
.p-estimate-rates__table td { padding: 10px 0; }
.p-estimate-rates__table .is-num { text-align: right; font-family: "Inter", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.p-estimate-rates__table tbody th button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; text-align: left;
  font-family: "Inter", sans-serif; font-weight: 500; letter-spacing: 0;
}
.p-estimate-rates__table tbody th button::before {
  content: ""; width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%; flex-shrink: 0;
  transition: background-color .3s var(--ease);
}
.p-estimate-rates__table tbody th button:hover::before, .p-estimate-rates__table tr.is-current th button::before { background: currentColor; }
.p-estimate-rates__table tr.is-current td, .p-estimate-rates__table tr.is-current th { background: var(--taupe-3); }
.p-estimate-rates__table tr.is-current th button { padding-left: 8px; }
.p-estimate-rates__table tr.is-current td { padding-right: 8px; }
.p-estimate-rates__note { margin-top: 16px; }

/* SP：査定書が見えない間の小さな帯（下部固定バーの上） */
.p-estimate-peek { display: none; }
@media (max-width: 767px) {
  .p-estimate-peek {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
    position: fixed; left: 0; right: 0; z-index: 89;
    bottom: calc(var(--sp-bar-h) + env(safe-area-inset-bottom, 0px));
    min-height: 48px; padding: 8px 16px;
    background: var(--taupe-3); border-top: 1px solid var(--line-2);
    font-size: 12.5px; line-height: 1.4;
    transform: translateY(100%); opacity: 0; visibility: hidden;
    transition: transform .35s var(--ease), opacity .35s var(--ease), visibility 0s linear .35s;
  }
  .p-estimate-peek.is-show { transform: none; opacity: 1; visibility: visible; transition: transform .35s var(--ease), opacity .35s var(--ease), visibility 0s; }
  .p-estimate-peek__label { color: var(--ink-2); }
  .p-estimate-peek__amt { font-family: var(--f-latin); font-style: italic; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .p-estimate-peek__go { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
}
html.is-shot .p-estimate-peek { display: none !important; }

/* ---------- 3つの窓口（罫で区切った3行） ---------- */
.p-estimate-ch__list { border-top: 1px solid var(--line-2); }
.p-estimate-ch__row { display: grid; gap: 12px; padding: 28px 0; border-bottom: 1px solid var(--line-2); }
.p-estimate-ch__name { font-family: var(--f-serif); font-weight: 400; font-size: 24px; line-height: 1.3; letter-spacing: .04em; }
.p-estimate-ch__name small { display: block; margin-top: 6px; font-family: var(--f-sans); font-size: 13px; font-weight: 500; letter-spacing: .02em; line-height: 1.5; }
.p-estimate-ch__text { font-size: 14px; line-height: 1.8; }
.p-estimate-ch__text .c-note { margin-top: 4px; }
.p-estimate-ch__act { margin-top: 8px; }
@media (min-width: 768px) {
  .p-estimate-ch__row { grid-template-columns: repeat(23, minmax(0, 1fr)); gap: 0; align-items: center; padding: 32px 0; }
  .p-estimate-ch__name { grid-column: 1 / 7; font-size: 28px; }
  .p-estimate-ch__text { grid-column: 8 / 17; }
  .p-estimate-ch__act { grid-column: 18 / 24; justify-self: end; margin-top: 0; }
}
@media (max-width: 767px) { .p-estimate-ch__act .c-btn { width: 100%; } }

/* ---------- 査定のお申し込み（左に説明・右にフォーム） ---------- */
@media (min-width: 768px) {
  .p-estimate-form__intro { grid-column: 1 / 10; }
  .p-estimate-form__main { grid-column: 12 / 24; }
}
.p-estimate-form__sub { margin-top: 32px; }
.p-estimate-after { margin-top: 16px; border-top: 1px solid var(--line); counter-reset: est-after; }
.p-estimate-after li { display: grid; grid-template-columns: 28px minmax(0, 1fr); padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.p-estimate-after li::before { counter-increment: est-after; content: counter(est-after); grid-row: 1 / span 2; font-family: "Inter", sans-serif; font-size: 13px; line-height: 1.9; color: var(--ink); }
.p-estimate-after b { display: block; font-weight: 500; color: var(--ink); }
.p-estimate-form__privacy { margin-top: 20px; }
.p-estimate-form__privacy a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.p-estimate-filled { margin-bottom: 20px; padding: 12px 14px; background: var(--taupe-3); border: 1px solid var(--line-2); color: var(--ink); }
.p-estimate-filled:focus { outline: none; }
.p-estimate-apply-form > * + * { margin-top: 24px; }
.p-estimate-apply-form > .p-estimate-filled + * { margin-top: 0; }
.p-estimate-apply-form .c-field + .c-field { margin-top: 24px; }
.p-estimate-pair { display: grid; gap: 24px; align-items: start; }
.p-estimate-apply-form .c-field { align-content: start; }
.p-estimate-pair .c-field + .c-field { margin-top: 0; }
@media (min-width: 1024px) { .p-estimate-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.p-estimate-fs { border: 0; margin-left: 0; margin-right: 0; margin-bottom: 0; padding: 0; min-width: 0; }
.p-estimate-fs > legend { float: left; width: 100%; padding: 0; margin: 0 0 8px; }
.p-estimate-fs > legend + * { clear: both; }
.p-estimate-opt { font-size: 12px; font-weight: 400; }
.p-estimate-apply-form .c-error { margin-top: -2px; }
.p-estimate-fs .c-error { margin-top: 8px; }
.p-estimate-fs[aria-invalid="true"] .c-choice span { border-color: var(--red); }

.p-estimate-file { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; cursor: pointer; }
.p-estimate-file:focus-within .p-estimate-file__btn { outline: 2px solid var(--ink); outline-offset: 3px; }
.p-estimate-file:hover .p-estimate-file__btn { background: var(--ink); color: #fff; }
.p-estimate-file__count { font-size: 13px; color: var(--ink-2); }
.p-estimate-files { font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.p-estimate-files:empty { display: none; }
.p-estimate-files li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.p-estimate-files li:first-child { border-top: 1px solid var(--line); }

.p-estimate-agree .c-check a { text-decoration: underline; text-underline-offset: 3px; }
.p-estimate-agree .c-req { margin-left: 8px; }
.p-estimate-agree .c-error { margin-top: 0; }
.p-estimate-submit { margin-top: 32px; min-width: 240px; }
@media (max-width: 767px) { .p-estimate-submit { width: 100%; } }

/* 疑似送信の完了表示 */
.p-estimate-done { padding: 28px 20px 32px; background: var(--taupe-3); border: 1px solid var(--line-2); }
@media (min-width: 768px) { .p-estimate-done { padding: 36px 36px 40px; } }
.p-estimate-done:focus { outline: none; }
.p-estimate-done__title { line-height: 1.6; }
.p-estimate-done__lead { margin-top: 8px; }
.p-estimate-done__table { margin-top: 24px; }
.p-estimate-done__table th, .p-estimate-done__table td { border-color: var(--line-2); }
.p-estimate-done__table th { width: 8.5em; padding-right: 16px; white-space: nowrap; }
.p-estimate-done__table td { white-space: pre-wrap; overflow-wrap: anywhere; }
.p-estimate-done__back { margin-top: 28px; }
