:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #191f28; --muted: #5f6b7a; --line: #e2e6eb;
  --primary: #1b64da; --primary-text: #ffffff; --ok: #12784a; --ok-bg: #e6f4ec; --warn: #8a5a00; --warn-bg: #fdf3dc;
  --err: #b42318; --err-bg: #fdecea; --paper: #5b3cc4; --paper-bg: #efeafd; --pos: #c62828; --neg: #1565c0; --focus: #1b64da;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317; --surface: #1a1f26; --text: #e8ebef; --muted: #9aa5b1; --line: #2c333c;
    --primary: #4d8af0; --primary-text: #0b1220; --ok: #6fd3a0; --ok-bg: #12301f; --warn: #f2c46b; --warn-bg: #352a10;
    --err: #ff8a80; --err-bg: #3a1714; --paper: #b9a6ff; --paper-bg: #2a2147; --pos: #ff7a7a; --neg: #7ab4ff; --focus: #8ab4ff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 0; }
.brand { font-weight: 700; letter-spacing: .02em; }
.user { margin-left: auto; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; white-space: nowrap; }
nav ul { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
nav a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--text); white-space: nowrap; }
nav a[aria-current="page"] { background: var(--surface); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
main:focus { outline: none; }

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; min-width: 0; }
.grid .card { margin: 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; margin: 0; }
.badge-paper { background: var(--paper-bg); color: var(--paper); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.pos { color: var(--pos); } .neg { color: var(--neg); }

.btn { display: inline-block; font: inherit; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-small { padding: 6px 10px; min-height: 36px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form { display: grid; gap: 8px; }
.form label { font-weight: 600; }
.form input[type=email], .form input[type=password], .form input:not([type]) { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; min-height: 44px; }
.form-error { color: var(--err); min-height: 1.4em; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
legend { font-weight: 600; padding: 0 4px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 400 !important; }
.choice:last-child { border-bottom: 0; }
.choice input { margin-top: 5px; width: 20px; height: 20px; }
.choice-body { display: grid; gap: 2px; }

.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.state { padding: 16px; border-radius: 10px; margin: 0; }
.state p { margin: .25rem 0 0; }
.state-loading { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.state-empty { background: var(--bg); }
.state-error { background: var(--err-bg); color: var(--err); }
.state-error .btn { margin-top: 8px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.banner { padding: 10px 12px; border-radius: 10px; background: var(--bg); margin: 0 0 12px; }
.banner-ok { background: var(--ok-bg); color: var(--ok); }
.banner-warn, .banner-stale { background: var(--warn-bg); color: var(--warn); }
.banner[hidden] { display: none; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 420px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .925rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 600; }

.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0 16px; }
.stepper li { padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .875rem; }
.stepper li.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.stepper li[aria-current] { border-color: var(--primary); font-weight: 600; }
.recommendation ul { padding-left: 1.2rem; }
.risks li { color: var(--warn); }
.advanced { margin: 12px 0; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
.advanced summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details > summary { cursor: pointer; }

/* Phones: the whole menu stays visible (wraps) and table rows become cards so no column is hidden. */
@media (max-width: 600px) {
  nav ul { flex-wrap: wrap; overflow-x: visible; }
  nav a { padding: 8px 10px; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; white-space: normal; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
}
.mock-banner { position: sticky; top: 0; z-index: 20; background: var(--warn-bg); color: var(--warn); text-align: center; font-weight: 700; padding: 6px 12px; }
