/* ROBERIN house calculator (appropriate price) - The New workspace (20260714a)
 * Scope: .tn-hc-* only. Gate baked in: container gap (#22/#37), flipping tokens (#8),
 * aligned rows (#2/#35), distinct dark buttons (#14), padded card components use
 * .tn-hc-tool .component (0,2,0) so the reset can't eat padding (#37). */

.tn-hc-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  color: #1a1208;
  -webkit-text-fill-color: currentColor;
}

.tn-hc-page,
.tn-hc-page * {
  box-sizing: border-box;
}

.tn-hc-tool {
  --hc-ink: #1a1208;
  --hc-muted: #5a4a30;
  --hc-line: #b8a888;
  --hc-soft: #ddd4be;
  --hc-paper: #faf6ee;
  --hc-wash: #f5efdf;
  --hc-surface: rgba(255, 252, 244, 0.74);
  --hc-card: rgba(255, 252, 244, 0.5);
  --hc-band-bg: rgba(255, 252, 244, 0.4);
  --hc-accent: #c44a00;
  --hc-track: rgba(184, 168, 136, 0.22);
  --hc-btn-sec-bg: #ede6d4;
  --hc-btn-sec-hover: #dfd4bb;
  --hc-btn-sec-text: #1a1208;
  --hc-btn-pri-bg: #1a1208;
  --hc-btn-pri-hover: #c44a00;
  --hc-btn-pri-text: #faf6ee;
  --hc-state: #4f7a3e;
  margin: 0 auto 18px;
  border-top: 2px solid var(--hc-ink);
  border-bottom: 1px solid var(--hc-line);
  background: linear-gradient(180deg, var(--hc-paper), var(--hc-wash));
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
}

.tn-hc-tool[data-house-state="safe"] { --hc-state: #4f7a3e; }
.tn-hc-tool[data-house-state="mid"] { --hc-state: #b08a1f; }
.tn-hc-tool[data-house-state="high"] { --hc-state: #c05a12; }
.tn-hc-tool[data-house-state="risk"] { --hc-state: #b3341a; }

.tn-hc-tool ul,
.tn-hc-tool ol,
.tn-hc-tool li,
.tn-hc-tool dd {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tn-hc-tool dl,
.tn-hc-tool dt,
.tn-hc-tool p {
  margin: 0;
  padding: 0;
}

.tn-hc-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  gap: 0;
  min-height: 420px;
}

.tn-hc-input,
.tn-hc-result {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.tn-hc-input {
  border-right: 1px solid var(--hc-line);
}

.tn-hc-pane-label {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 26px;
  border-bottom: 1px solid var(--hc-ink);
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tn-hc-fields {
  display: grid;
  gap: 14px;
}

.tn-hc-band {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--hc-soft);
  background: var(--hc-band-bg);
}

.tn-hc-band-label {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tn-hc-band-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tn-hc-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  border: 0;
  background: none;
}

.tn-hc-field > span,
.tn-hc-field-label {
  display: block;
  padding: 0;
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-hint {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-control {
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--hc-line);
  background: var(--hc-surface);
}

.tn-hc-control input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font: 700 15px/1 Georgia, "Times New Roman", serif;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  font-variant-numeric: tabular-nums lining-nums;
}

.tn-hc-control input:focus-visible {
  outline: 2px solid var(--hc-accent);
  outline-offset: -2px;
}

/* Faded example placeholders: empty inputs show the example number lightly (#40). */
.tn-hc-control input::placeholder {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  opacity: 0.5;
  font-weight: 600;
}
.tn-hc-control input::-webkit-input-placeholder {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  opacity: 0.5;
  font-weight: 600;
}
.tn-hc-control input:-ms-input-placeholder {
  color: var(--hc-muted);
  opacity: 0.5;
}

.tn-hc-control--suffix b {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--hc-soft);
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

/* Prefix currency chip variant for locales whose symbol leads the number ($ EN, Rp ID).
 * The <b> is placed before the input in DOM order; flex keeps it on the left. */
.tn-hc-control--prefix b {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--hc-soft);
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

.tn-hc-field--period {
  display: grid;
  gap: 5px;
}

.tn-hc-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tn-hc-preset {
  height: 34px;
  border: 1px solid var(--hc-soft);
  border-radius: 0;
  background: var(--hc-card);
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
}

.tn-hc-preset.is-active {
  border-color: var(--hc-ink);
  background: var(--hc-surface);
  box-shadow: inset 0 -2px 0 var(--hc-accent);
}

.tn-hc-preset:focus-visible { outline: 2px solid var(--hc-accent); outline-offset: 2px; }

.tn-hc-scenarios {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.tn-hc-scenario {
  height: 32px;
  border: 1px dashed var(--hc-line);
  border-radius: 0;
  background: transparent;
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
}

.tn-hc-scenario.is-active {
  border-style: solid;
  border-color: var(--hc-ink);
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
}

.tn-hc-scenario:focus-visible { outline: 2px solid var(--hc-accent); outline-offset: 2px; }

/* Command */
.tn-hc-command { display: grid; gap: 8px; }

.tn-hc-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tn-hc-actions > button {
  display: grid;
  place-items: center;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--hc-line);
  border-radius: 0;
  background: var(--hc-btn-sec-bg);
  color: var(--hc-btn-sec-text);
  -webkit-text-fill-color: var(--hc-btn-sec-text);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tn-hc-actions > button:hover { background: var(--hc-btn-sec-hover); }
.tn-hc-actions > button:focus-visible { outline: 2px solid var(--hc-accent); outline-offset: 2px; }

.tn-hc-actions > .tn-hc-primary {
  border-color: var(--hc-btn-pri-bg);
  background: var(--hc-btn-pri-bg);
  color: var(--hc-btn-pri-text);
  -webkit-text-fill-color: var(--hc-btn-pri-text);
}

.tn-hc-actions > .tn-hc-primary:hover {
  background: var(--hc-btn-pri-hover);
  border-color: var(--hc-btn-pri-hover);
}

.tn-hc-status {
  min-height: 18px;
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-status[data-state="error"] { color: #b3341a; -webkit-text-fill-color: #b3341a; }
.tn-hc-status[data-state="success"] { color: #3f6d2f; -webkit-text-fill-color: #3f6d2f; }

.tn-hc-error:not(:empty) {
  color: #b3341a;
  -webkit-text-fill-color: #b3341a;
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Result */
.tn-hc-main {
  display: grid;
  gap: 6px;
  padding: 16px 14px;
  border: 1px solid var(--hc-line);
  background: var(--hc-surface);
}

.tn-hc-main > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tn-hc-badge {
  padding: 2px 8px;
  border: 1px solid var(--hc-state);
  color: var(--hc-state);
  -webkit-text-fill-color: var(--hc-state);
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.tn-hc-main > strong {
  font: 700 clamp(26px, 5.4vw, 34px)/1.15 Georgia, "Times New Roman", serif;
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font-variant-numeric: tabular-nums lining-nums;
  overflow-wrap: anywhere;
}

.tn-hc-summary {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 500 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-style: normal;
}

.tn-hc-bars { display: grid; gap: 8px; }

.tn-hc-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.tn-hc-bar-name {
  display: flex;
  justify-content: space-between;
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-bar-name b { color: var(--hc-ink); -webkit-text-fill-color: var(--hc-ink); }

.tn-hc-bar-track {
  position: relative;
  display: block;
  block-size: 10px;
  border: 1px solid var(--hc-soft);
  background: var(--hc-track);
}

.tn-hc-bar-fill { display: block; block-size: 100%; inline-size: 0; transition: inline-size 0.2s ease; }
.tn-hc-bar-fill--dti { background: var(--hc-state); }
.tn-hc-bar-fill--surplus { background: #7a9a5c; }

.tn-hc-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tn-hc-metrics > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--hc-soft);
  background: var(--hc-card);
}

.tn-hc-metrics dt {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-metrics dd {
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font: 700 14px/1.25 Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums lining-nums;
  overflow-wrap: anywhere;
}

.tn-hc-detail {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--hc-soft);
  background: var(--hc-card);
}

.tn-hc-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tn-hc-detail-label {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tn-hc-detail-value {
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font: 700 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: right;
}

/* Advice card: padded div (safe from p reset); label + ul restored with tool scope (#37). */
.tn-hc-tool .tn-hc-advice {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--hc-soft);
  background: var(--hc-card);
}

.tn-hc-advice-label {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tn-hc-tool .tn-hc-advice #advice-content ul {
  display: grid;
  gap: 6px;
}

.tn-hc-tool .tn-hc-advice #advice-content li {
  position: relative;
  padding-left: 14px;
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
  font: 500 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tn-hc-tool .tn-hc-advice #advice-content li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--hc-accent);
  -webkit-text-fill-color: var(--hc-accent);
  font-weight: 700;
}

.tn-hc-disclaimer {
  color: var(--hc-muted);
  -webkit-text-fill-color: var(--hc-muted);
  font: 500 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Mobile */
@media (max-width: 720px) {
  .tn-hc-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .tn-hc-input { border-right: 0; border-bottom: 1px solid var(--hc-line); }
  .tn-hc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tn-hc-band-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Footer/testimonials/contact-form width parity with the fixed Article panel (ledger #16 / kill-list #5).
 * house postid 1427 was never added to the shared footer-alignment allowlist, so on mobile it fell back
 * to the global-sections default calc(100% - 20px) and sat 10px narrower / 5px off-left of the article
 * panel. Match the article panel width (calc(100% - 10px)); the shared dark-shell rule only sets
 * max-width, so width must be re-declared to beat the global-sections !important width. */
@media (max-width: 540px) {
  body.tn-hc-page-body :is(.cs-entry__footer, .cs-sight-testimonials, .cs-contact-form) {
    width: calc(100% - 10px) !important;
    max-width: calc(100% - 10px) !important;
  }
}

/* Dark / inverse / auto-dark (#8/#14) */
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-tool,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-hc-tool,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-hc-tool {
  --hc-ink: #efe6d2;
  --hc-muted: #c3b492;
  --hc-line: #6f6047;
  --hc-soft: #574a37;
  --hc-paper: #241d12;
  --hc-wash: #2c2417;
  --hc-surface: rgba(58, 48, 32, 0.5);
  --hc-card: rgba(58, 48, 32, 0.5);
  --hc-band-bg: rgba(58, 48, 32, 0.36);
  --hc-accent: #e8823f;
  --hc-track: rgba(120, 104, 74, 0.3);
  --hc-btn-sec-bg: #33291a;
  --hc-btn-sec-hover: #453720;
  --hc-btn-sec-text: #efe6d2;
  --hc-btn-pri-bg: #e8823f;
  --hc-btn-pri-hover: #f2a061;
  --hc-btn-pri-text: #241206;
  color: var(--hc-ink);
  -webkit-text-fill-color: var(--hc-ink);
}

body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-tool[data-house-state="safe"] { --hc-state: #86c06a; }
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-tool[data-house-state="mid"] { --hc-state: #e0b23f; }
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-tool[data-house-state="high"] { --hc-state: #f0904a; }
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-tool[data-house-state="risk"] { --hc-state: #ef6a52; }

body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-hc-bar-fill--surplus { background: #8fb06a; }

@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-hc-tool {
    --hc-ink: #efe6d2;
    --hc-muted: #c3b492;
    --hc-line: #6f6047;
    --hc-soft: #574a37;
    --hc-paper: #241d12;
    --hc-wash: #2c2417;
    --hc-surface: rgba(58, 48, 32, 0.5);
    --hc-card: rgba(58, 48, 32, 0.5);
    --hc-band-bg: rgba(58, 48, 32, 0.36);
    --hc-accent: #e8823f;
    --hc-track: rgba(120, 104, 74, 0.3);
    --hc-btn-sec-bg: #33291a;
    --hc-btn-sec-hover: #453720;
    --hc-btn-sec-text: #efe6d2;
    --hc-btn-pri-bg: #e8823f;
    --hc-btn-pri-hover: #f2a061;
    --hc-btn-pri-text: #241206;
    color: var(--hc-ink);
    -webkit-text-fill-color: var(--hc-ink);
  }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-hc-tool[data-house-state="mid"] { --hc-state: #e0b23f; }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-hc-tool[data-house-state="high"] { --hc-state: #f0904a; }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-hc-tool[data-house-state="risk"] { --hc-state: #ef6a52; }
}

/* 2026-07-25 — 규제 한도 행(DSR/LTV/스트레스 가산금리) 3필드 변형.
 * 기본 .tn-hc-band-grid 는 2열이라 3번째 필드가 혼자 다음 줄로 떨어졌다(라이브 QA 검출).
 * 720px 초과에서만 3열로 바꾸고, 720px 이하는 기존 1열 규칙을 그대로 상속한다. */
@media (min-width: 721px) {
  .tn-hc-band-grid--triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
