/* Phase 2b 공통 스타일 — WCAG 2.1 AA: 본문 대비 ≥ 4.5:1, 포커스 링 표시, 색+텍스트 병용 */
:root {
  --bg: #ffffff;
  --text: #1c1c1e;        /* 대비 16.1:1 */
  --muted: #55555c;       /* 대비 7.0:1 */
  --primary: #0b57d0;     /* 흰 배경 대비 6.5:1 */
  --primary-text: #ffffff;
  --error: #b3261e;       /* 대비 6.3:1 */
  --border: #c9c9ce;
  --surface: #f4f4f6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.login-wrap { max-width: 22rem; margin: 18vh auto 0; padding: 0 1rem; }
.login-wrap h1 { font-size: 1.4rem; text-align: center; }
.login-wrap form { display: flex; flex-direction: column; gap: .6rem; }
.login-wrap label { font-weight: 600; }
.login-wrap input {
  font-size: 1.05rem; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 8px;
}
.login-wrap button {
  font-size: 1.05rem; padding: .6rem; margin-top: .4rem;
  background: var(--primary); color: var(--primary-text);
  border: 0; border-radius: 8px; cursor: pointer;
}
.error { color: var(--error); font-weight: 600; margin: .2rem 0 0; }
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .8rem; }
code { background: var(--surface); padding: .1rem .3rem; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; }
.topbar nav { flex: 1; }
.topbar a { color: var(--primary); text-decoration: none; margin-right: .8rem; }
.topbar a:hover, .topbar a:focus-visible { text-decoration: underline; }
.topbar a.disabled { color: var(--muted); pointer-events: none; }
button.ghost {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .7rem; cursor: pointer; color: var(--text); font-size: .95rem;
}
.content { max-width: 60rem; margin: 0 auto; padding: 1rem; }

/* ─── W1 자산 편집 ─── */
.flash { padding: .6rem .8rem; border-radius: 8px; font-weight: 600; }
.flash-ok { background: #e6f4ea; color: #135723; border: 1px solid #7fbf8e; }
.flash-error { background: #fdecea; color: #93261f; border: 1px solid #e4a09b; }
.progress { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; margin: .8rem 0; }
.flow-box { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; margin: 1rem 0; }
.flow-box h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.flow-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.flow-form input[name="amount"] { width: 11rem; }
.flow-form input[name="note"] { width: 12rem; }
.account { margin: 1.4rem 0; }
.account h2 { font-size: 1.1rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: baseline; border-bottom: 2px solid var(--border); padding-bottom: .3rem; }
.badge { font-size: .82rem; color: var(--muted); font-weight: 600; }
.subtotal { font-size: .9rem; font-weight: 700; margin-left: auto; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .35rem .5rem; text-align: left; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface); position: sticky; top: 0; }
tbody th[scope="row"] { font-weight: 600; white-space: nowrap; }
td input, td select, .flow-form input {
  font-size: .95rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px;
}
td input[name^="qty_"], td input[name="new_qty"] { width: 7.5rem; }
td input[name^="val_"], td input[name="new_val"] { width: 9rem; }
.val-cell { white-space: nowrap; }
.val-cell .cur { color: var(--muted); font-size: .85rem; margin-right: .25rem; }
.krw { white-space: nowrap; font-variant-numeric: tabular-nums; }
.state { font-size: .82rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.state-confirmed { background: #e6f4ea; color: #135723; }
.state-draft { background: #fef3d9; color: #7a4c0f; }
.state-prefill { background: var(--surface); color: var(--muted); }
.state-empty { background: #fdecea; color: #93261f; }
.row-prefill input { background: #fbfbfd; }
.new-row input, .new-row select { background: #fbfff9; }
button { font-size: .95rem; padding: .45rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button.danger { background: none; border: 1px solid var(--border); color: var(--error); font-weight: 700; }
.actions { display: flex; gap: .6rem; margin: .6rem 0 0; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .88rem; }
.muted { color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: .3rem; }
