/* =========================================================
   생활비 계산소 — 계산기 상세 페이지 공통 스타일
   (index/policy 외 모든 계산기 페이지가 공유)
   ========================================================= */

.page { padding-top: 30px; }

/* breadcrumb + title */
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-faint); margin-bottom: 14px; flex-wrap: wrap; }
.crumb a:hover { color: var(--navy); }
.crumb svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 800; }
.page-head .lead { margin-top: 9px; color: var(--ink-soft); font-size: 15.5px; max-width: 56ch; line-height: 1.6; }

/* layout */
.calc-layout { display: grid; grid-template-columns: 35fr 65fr; gap: 22px; align-items: start; }

/* section card */
.sec-card { padding: 24px; }
.sec-card + .sec-card { margin-top: 18px; }
.sec-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 20px; color: var(--navy-deep); }
.sec-title .badge {
  width: 26px; height: 26px; border-radius: 8px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
}

/* inputs */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 44px 11px 13px; font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--surface-2); text-align: right; font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s; -moz-appearance: textfield;
}
.input-wrap input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(76,125,240,.12); }
.input-wrap .unit { position: absolute; right: 13px; font-size: 13.5px; color: var(--ink-faint); pointer-events: none; }
.field.income input { background: var(--blue-soft); border-color: #d7e4fd; font-weight: 700; color: var(--navy-deep); }

/* select */
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 38px 11px 13px; font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--surface-2); appearance: none; -webkit-appearance: none; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.select-wrap select:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(76,125,240,.12); }
.select-wrap::after {
  content:""; position: absolute; right: 15px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}

/* segmented toggle (yes/no, 평일/주말) */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r);
  padding: 10px 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); transition: all .15s;
}
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg button:hover:not(.on) { border-color: #cfd6e6; color: var(--navy-deep); }

.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* tip card */
.tip-card { padding: 18px 20px; background: var(--surface-2); border-color: var(--line-2); }
.tip-card .sec-title { font-size: 15px; margin-bottom: 10px; }
.tip-card .sec-title svg { width: 17px; height: 17px; color: var(--orange); }
.tip-card p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }

/* ---- Results ---- */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.sum { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 15px; background: var(--surface-2); }
.sum .k { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; margin-bottom: 8px; }
.sum .v { font-size: 21px; font-weight: 800; color: var(--navy-deep); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sum .v small { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-left: 1px; }
.sum.is-green  { background: var(--green-soft);  border-color: #cdeadd; } .sum.is-green .v  { color: var(--green); }
.sum.is-orange { background: var(--orange-soft); border-color: #f4dfc1; } .sum.is-orange .v { color: var(--orange); }
.sum.is-red    { background: var(--red-soft);    border-color: #f3cfca; } .sum.is-red .v    { color: var(--red); }
.sum.is-blue   { background: var(--blue-soft);   border-color: #d7e4fd; } .sum.is-blue .v   { color: var(--blue); }

/* sub panel inside results */
.rpanel { border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px 20px; }
.rpanel + .rpanel { margin-top: 16px; }
.rpanel h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 16px; color: var(--navy-deep); }

/* chart */
.chart-row { display: grid; grid-template-columns: 190px 1fr; gap: 26px; align-items: center; }
.donut-wrap { position: relative; width: 190px; height: 190px; }
.donut { width: 100%; height: 100%; border-radius: 50%; transition: background .4s; }
.donut-hole {
  position: absolute; inset: 44px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2);
  display: grid; place-content: center; text-align: center;
}
.donut-hole .lbl { font-size: 11.5px; color: var(--ink-faint); }
.donut-hole .tot { font-size: 18px; font-weight: 800; color: var(--navy-deep); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; min-width: 0; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .ln { font-weight: 600; color: var(--ink); white-space: nowrap; }
.legend .pct { margin-left: auto; padding-left: 10px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.legend .amt { width: 92px; text-align: right; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* table */
.tbl-scroll { overflow-x: auto; }
table.detail { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 460px; }
table.detail th, table.detail td { padding: 10px 12px; text-align: left; white-space: nowrap; }
table.detail thead th { font-size: 12px; color: var(--ink-faint); font-weight: 600; border-bottom: 1px solid var(--line); }
table.detail td { border-bottom: 1px solid var(--line-2); color: var(--ink); }
table.detail .r { text-align: right; font-variant-numeric: tabular-nums; }
table.detail tr:last-child td { border-bottom: none; }
table.detail tr.total td { font-weight: 700; color: var(--navy-deep); border-top: 1px solid var(--line); background: var(--surface-2); }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.tag.fixed { background: #e8ebf5; color: var(--navy); }
.tag.var   { background: var(--green-soft); color: var(--green); }
.tag.req   { background: var(--red-soft); color: var(--red); }
.tag.opt   { background: var(--surface-3); color: var(--ink-faint); }
.tag.warn  { background: var(--orange-soft); color: var(--orange); }

/* interpretation */
.interpret { background: var(--orange-soft); border: 1px solid #f4dfc1; border-radius: var(--r); padding: 18px 20px; }
.interpret h4 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 14px; color: #8a5a16; }
.interpret h4 svg { width: 17px; height: 17px; }
.interpret .lead-line { font-size: 14px; color: #7a4f15; line-height: 1.6; margin-bottom: 14px; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 9px; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.checks svg { width: 16px; height: 16px; color: var(--green); flex: none; margin-top: 2px; }

.result-bottom { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.result-bottom .rpanel { min-width: 0; }

/* output buttons */
.out-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line); }
.out-actions .btn { flex: 1; min-width: 130px; }
.print-help { margin-top: 10px; font-size: 12px; color: var(--ink-faint); line-height: 1.5; }
.print-report { display: none; }

/* ad placeholder */
.ad-slot {
  margin-top: 40px; background: var(--surface-3); border: 1px dashed #cdd3dd; border-radius: var(--r-lg);
  min-height: 116px; display: grid; place-items: center; text-align: center; cursor: default;
}
.ad-slot .ad-label { font-size: 12px; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.ad-slot .ad-sub { font-size: 11px; color: #aab1be; margin-top: 4px; }

/* content sections (SEO) */
.content-sections { margin-top: 48px; }
.content-sections .ctitle { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.content-sections .csub { color: var(--ink-faint); font-size: 14px; margin-bottom: 24px; }
.csec { padding: 24px 26px; }
.csec + .csec { margin-top: 16px; }
.csec h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 14px; color: var(--navy-deep); }
.csec h3 .n { width: 26px; height: 26px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.csec p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; }
.csec p + p { margin-top: 10px; }
.csec ul.bullets { display: flex; flex-direction: column; gap: 9px; }
.csec ul.bullets li { position: relative; padding-left: 18px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }
.csec ul.bullets li::before { content:""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 2px; background: var(--blue); }
.csec dl.defs dt { font-weight: 700; color: var(--ink); font-size: 14.5px; margin-top: 14px; }
.csec dl.defs dt:first-child { margin-top: 0; }
.csec dl.defs dd { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }

/* FAQ */
.faq details { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; background: var(--surface-2); overflow: hidden; }
.faq summary { list-style: none; cursor: pointer; padding: 15px 18px; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 10px; color: var(--navy-deep); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .q { width: 22px; height: 22px; border-radius: 6px; background: #fff; border: 1px solid var(--line); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.faq summary .chev { margin-left: auto; transition: transform .2s; }
.faq summary .chev svg { width: 18px; height: 18px; color: var(--ink-faint); }
.faq details[open] summary .chev { transform: rotate(180deg); }
.faq details .a { padding: 0 18px 16px 50px; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }

/* related calculators */
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rel-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); transition: all .15s; }
.rel-card:hover { background: #fff; border-color: #cfd6e6; box-shadow: var(--shadow-sm); }
.rel-card .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.rel-card .ico svg { width: 19px; height: 19px; }
.rel-card .t { font-size: 14px; font-weight: 600; color: var(--navy-deep); }
.rel-card .d { font-size: 12px; color: var(--ink-faint); }
.rel-card .arr { margin-left: auto; color: var(--ink-faint); }
.rel-card .arr svg { width: 16px; height: 16px; }
.t-blue{background:var(--blue-soft);color:var(--blue);} .t-green{background:var(--green-soft);color:var(--green);}
.t-orange{background:var(--orange-soft);color:var(--orange);} .t-navy{background:#e8ebf5;color:var(--navy);}
.t-teal{background:#e3f3f4;color:#2f9aa6;} .t-purple{background:#efe9f8;color:#7a59c0;} .t-red{background:var(--red-soft);color:var(--red);}

/* responsive */
@media (max-width: 980px) {
  .calc-layout { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .chart-row { grid-template-columns: 1fr; justify-items: center; gap: 18px; }
  .legend { width: 100%; }
  .legend li { flex-wrap: wrap; row-gap: 4px; }
  .legend .amt { width: auto; }
  .result-bottom { grid-template-columns: 1fr; }
  .out-actions .btn { flex: 1 1 100%; }
  .page-head .btn { width: 100%; }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  html,
  body {
    background: #fff !important;
  }

  body {
    color: #111827 !important;
    font-size: 12px !important;
  }

  .site-header,
  .crumb,
  .page-head,
  .calc-layout,
  .calc-left,
  .calc-right,
  .out-actions,
  .ad-slot,
  .content-sections,
  .site-footer,
  .tip-card,
  .btn,
  .hamburger,
  .icon-btn,
  .print-help,
  .socials {
    display: none !important;
  }

  .wrap,
  .page {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card,
  .sec-card,
  .rpanel,
  .interpret {
    box-shadow: none !important;
  }

  .print-report {
    display: block !important;
    color: #111827 !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  .print-report * {
    box-sizing: border-box;
  }

  .print-report-head {
    border-bottom: 2px solid #111827;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .print-brand {
    font-size: 13px;
    font-weight: 800;
    color: #1f2d52;
    margin-bottom: 5px;
  }

  .print-report h1 {
    font-size: 21px !important;
    margin: 0 0 5px !important;
    color: #111827 !important;
  }

  .print-report .print-meta {
    font-size: 11px;
    color: #6b7280;
    margin: 2px 0;
  }

  .print-section {
    margin-top: 12px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-section h2 {
    font-size: 14px !important;
    margin: 0 0 6px !important;
    color: #111827 !important;
  }

  .print-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .print-summary-card {
    border: 1px solid #d8dee8;
    border-radius: 8px;
    padding: 8px 9px;
    background: #fff;
  }

  .print-summary-card .k {
    font-size: 10.5px;
    color: #6b7280;
    margin-bottom: 3px;
  }

  .print-summary-card .v {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.8px;
  }

  .print-table th,
  .print-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 5px 7px;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    background: #f5f7fa;
    font-weight: 700;
    color: #374151;
  }

  .print-table td.r,
  .print-table th.r {
    text-align: right;
  }

  .print-table tr.total td {
    font-weight: 700;
    background: #f9fafb;
  }

  .print-interpret {
    border: 1px solid #ead7b7;
    background: #fffaf0;
    border-radius: 8px;
    padding: 8px 10px;
  }

  .print-interpret p {
    margin: 0 0 6px;
  }

  .print-interpret ul {
    margin: 0;
    padding-left: 18px;
  }

  .print-interpret li {
    margin-bottom: 3px;
  }

  .print-note {
    margin-top: 14px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 10.5px;
    color: #4b5563;
    line-height: 1.55;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a[href]::after {
    content: "";
  }
}
