/* 임대플랜 스타일. 토큰과 규칙은 design.md를 따른다. */

/* ---------- 토큰 ---------- */
:root {
  /* color */
  --ink: #181d26;          /* 제목, 금액, 주 버튼 배경, 결론 카드 배경 */
  --ink-active: #0d1218;   /* 주 버튼 누름 */
  --body: #333840;         /* 일반 글 */
  --muted: #6b7079;        /* 날짜, 조건, 보조 수치 */
  --faint: #9297a0;        /* 비활성, 자리표시 */
  --hairline: #dddddd;     /* 테두리, 구분선 */
  --canvas: #ffffff;       /* 페이지, 카드 */
  --soft: #f8fafc;         /* 강조 카드, 선택된 칩 배경 */
  --strong: #e0e2e6;       /* 중립 태그, 진행 막대 바탕 */
  --alert: #aa2d00;        /* 마감 지남, 삭제, 위험 */
  --alert-soft: #f5e9d4;   /* 경고 띠 배경 */
  --focus: #458fff;        /* 키보드 포커스, 입력 포커스 */

  /* type */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;

  /* space (4px 단위) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s12: 48px;

  /* radius */
  --r-sm: 6px;   /* 입력, 칩 */
  --r-md: 10px;  /* 카드 */
  --r-lg: 12px;  /* 버튼, 결론 카드 */
}

/* ---------- 기본 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--soft); color: var(--body); font: 400 15px/1.5 var(--font); word-break: keep-all; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }

.app { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--canvas); display: flex; flex-direction: column; }
main { flex: 1; padding: var(--s6) var(--s5) var(--s12); display: flex; flex-direction: column; gap: var(--s6); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.two > *, .actions > * { min-width: 0; }

/* ---------- 글자 ---------- */
.t-display { font-size: 28px; font-weight: 500; line-height: 1.25; color: var(--ink); white-space: pre-line; }
.t-title { font-size: 20px; font-weight: 500; line-height: 1.35; color: var(--ink); white-space: pre-line; }
.t-label { font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--ink); }
.t-body { font-size: 15px; }
.t-meta { font-size: 13px; color: var(--muted); }
.t-amount { font-size: 22px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.t-alert { color: var(--alert); }

/* ---------- 상단 ---------- */
.top { position: sticky; top: 0; z-index: 5; height: 56px; padding: 0 var(--s5); background: var(--canvas); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.top a, .top button { font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordmark { font-size: 17px !important; }
.top .back { display: flex; align-items: center; gap: var(--s1); min-width: 0; margin-left: -4px; }
.top .back span { overflow: hidden; text-overflow: ellipsis; }
.icon { width: 24px; height: 24px; flex: none; fill: currentColor; }
.tabs { position: sticky; top: 56px; z-index: 4; display: flex; background: var(--canvas); border-bottom: 1px solid var(--hairline); }
.tabs a { flex: 1; text-align: center; padding: var(--s3) 0; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

/* ---------- 버튼 ---------- */
.btn { display: block; width: 100%; min-height: 52px; padding: var(--s4) var(--s6); border-radius: var(--r-lg); font-size: 16px; font-weight: 500; text-align: center; }
.btn-primary { background: var(--ink); color: var(--canvas); }
.btn-primary:active { background: var(--ink-active); }
.btn-secondary { background: var(--canvas); color: var(--ink); border: 1px solid var(--hairline); }
.btn-secondary:active { background: var(--soft); }
.btn-text { width: auto; min-height: 44px; padding: var(--s3) 0; }
.btn-sm { width: auto; align-self: flex-start; min-height: 40px; padding: var(--s2) var(--s4); font-size: 14px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

/* ---------- 입력 ---------- */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > span:first-child { font-size: 14px; font-weight: 500; color: var(--ink); }
.input { display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s4); background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-sm); }
.input:focus-within { border-color: var(--focus); }
.input[aria-invalid=true] { border-color: var(--alert); }
.input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: var(--s3) 0; color: var(--ink); }
.input input::placeholder { color: var(--faint); }
.input i { font-style: normal; font-size: 14px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chip { display: block; min-height: 40px; padding: var(--s2) var(--s3); border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--canvas); font-size: 14px; color: var(--body); }
.chips input:checked + .chip, .chip[aria-pressed=true] { border-color: var(--ink); background: var(--soft); color: var(--ink); font-weight: 500; }
.chips input:focus-visible + .chip { outline: 2px solid var(--focus); outline-offset: 2px; }

.switch { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--ink); }
.switch input { width: 20px; height: 20px; accent-color: var(--ink); }

.slider { display: flex; flex-direction: column; gap: var(--s1); }
.slider .row { font-size: 14px; }
.slider b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 28px; accent-color: var(--ink); }

/* ---------- 카드 ---------- */
.card { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); }
a.card:active { background: var(--soft); }
.card-best { background: var(--soft); border-color: var(--ink); }
.card-off { background: var(--soft); border-style: dashed; }
.card-off .t-label { color: var(--faint); }
.card-alert { border-color: var(--alert); }
.hero { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s6); background: var(--ink); color: var(--canvas); border-radius: var(--r-lg); }
.hero .t-title { color: var(--canvas); }
.hero .t-meta, .hero p { color: #c9ccd2; }
.band { padding: var(--s3) var(--s4); background: var(--alert-soft); color: var(--alert); border-radius: var(--r-md); font-size: 14px; font-weight: 500; }
.list { display: flex; flex-direction: column; }
.list > * { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: var(--s3) 0; border-bottom: 1px solid var(--hairline); color: var(--ink); }
.list-title { display: flex; align-items: center; gap: var(--s2); }
.meta { display: flex; flex-direction: column; gap: 2px; padding-top: var(--s2); border-top: 1px solid var(--hairline); font-size: 13px; color: var(--muted); }

.tag { flex: none; padding: 2px var(--s2); border-radius: var(--r-sm); background: var(--strong); color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag-alert { background: var(--alert); color: var(--canvas); }
.hero .tag { background: #ffffff1f; color: var(--canvas); }

.bar { height: 4px; border-radius: 2px; background: var(--strong); overflow: hidden; }
.bar > div { height: 100%; background: var(--ink); transition: width .2s; }

details.card > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; color: var(--ink); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; font-size: 18px; line-height: 1; }
details.card[open] > summary::after { content: "−"; }
details.card[open] { gap: var(--s4); }

/* ---------- 타임라인 ---------- */
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 24px 1fr; column-gap: var(--s3); }
.step-line { display: flex; flex-direction: column; align-items: center; }
.step-line::after { content: ""; flex: 1; width: 1px; background: var(--hairline); min-height: var(--s4); }
.step:last-child .step-line::after { display: none; }
.dot { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px solid var(--hairline); background: var(--canvas); color: var(--canvas); font-size: 12px; display: grid; place-items: center; }
.dot[aria-pressed=true] { background: var(--ink); border-color: var(--ink); }
.step-now .dot { border: 7px solid var(--ink); }
.step-alert .dot { border-color: var(--alert); }
.step-alert .dot[aria-pressed=true] { background: var(--alert); }
.step-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 var(--s6); }
.step-done .step-body .t-label { color: var(--faint); }
.step-alert .step-body .t-label { color: var(--alert); }
.step-body .btn { margin-top: var(--s2); }

/* ---------- 문자 ---------- */
.msg { padding: var(--s4); background: var(--soft); border-radius: var(--r-md); font-size: 15px; line-height: 1.7; color: var(--ink); white-space: pre-wrap; }

/* ---------- 시트, 토스트, 바닥 ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: #181d2699; }
.sheet { width: 100%; max-width: 480px; padding: var(--s6) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); background: var(--canvas); border-radius: var(--r-lg) var(--r-lg) 0 0; display: flex; flex-direction: column; gap: var(--s4); }
.toast { position: fixed; left: 50%; bottom: var(--s8); z-index: 30; transform: translate(-50%, 12px); padding: var(--s2) var(--s4); background: var(--ink); color: var(--canvas); border-radius: var(--r-sm); font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
footer { padding: var(--s6) var(--s5) var(--s8); font-size: 12px; color: var(--faint); }
