:root {
  --ink: #1f2937; --sub: #6b7280; --line: #e5e7eb; --bg: #f4f6f9; --card: #ffffff; --soft: #f1f5f9;
  --navy: #14532d; --navy2: #166534; --blue: #2563eb; --input: #fffbea;
  --ok: #047857; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e5e7eb; --sub: #9ca3af; --line: #374151; --bg: #111827; --card: #1f2937; --soft: #273244;
    --navy: #166534; --navy2: #4ade80; --blue: #60a5fa; --input: #2b2a1f;
    --ok: #34d399; --ok-bg: #064e3b; --warn: #fbbf24; --warn-bg: #3b2f0b; --bad: #f87171; --bad-bg: #3f1d1d;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Pretendard Variable", Pretendard, "맑은 고딕", sans-serif; font-size: 14px; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.hint { color: var(--sub); font-size: 12.5px; margin: 6px 0; line-height: 1.55; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 28px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: #fff; color: #14532d; display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.top h1 { margin: 0; font-size: 19px; }
.top p { margin: 2px 0 0; font-size: 12.5px; opacity: .85; }
.top-right { display: flex; gap: 8px; align-items: center; }
.top select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 7px 10px; }
.top select option { color: #111; }
.top .ghost { color: #fff; border-color: rgba(255,255,255,.35); }

.tabs { display: flex; gap: 4px; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 5; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--sub); padding: 13px 14px; font-weight: 700; white-space: nowrap; }
.tabs button.on { color: var(--navy2); border-bottom-color: var(--navy2); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 16px; }
.card { background: var(--card); border-radius: 14px; padding: 20px 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(15,23,42,.04); min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 17px; color: var(--navy2); }
.card h3 { margin: 18px 0 8px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

button { border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 9px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--navy2); border-color: var(--line); }
button.ghost:hover { background: var(--soft); filter: none; }
button.small { padding: 4px 10px; font-size: 12.5px; }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; color: var(--blue); padding: 2px 4px; font-weight: 600; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px dashed var(--line); border-radius: 14px; padding: 30px 16px; cursor: pointer; text-align: center; }
.drop.over { border-color: var(--blue); background: var(--soft); }
.drop-main { font-size: 16px; }
.drop-sub { color: var(--sub); font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--sub); font-weight: 600; font-size: 12.5px; background: var(--soft); position: sticky; top: 0; }
.scroll { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 10px; }
tr.total td { font-weight: 800; background: var(--soft); }
tr.sub td { color: var(--sub); }
td.line { width: 44px; color: var(--sub); font-weight: 700; }
td .where { display: block; color: var(--sub); font-size: 12px; margin-top: 2px; }

.big-result { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 4px; }
.stat { background: var(--soft); border-radius: 12px; padding: 14px 18px; min-width: 180px; flex: 1; }
.stat .k { color: var(--sub); font-size: 12.5px; }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.good .v { color: var(--ok); }
.stat.bad .v { color: var(--bad); }

.note { border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.55; margin: 8px 0; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.info { background: var(--soft); color: var(--ink); }

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 18px; margin: 4px 0 8px; }
.opt { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.opt small { display: block; color: var(--sub); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span { font-weight: 600; color: var(--sub); }
.field small { color: var(--sub); font-size: 11.5px; }
input[type=text], input[type=number], input:not([type]), select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--input); min-width: 0; }
input.money { text-align: right; }
.auto { font-size: 11.5px; color: var(--blue); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }

.check { border: 1px solid var(--line); border-left: 5px solid var(--sub); border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.check.risk { border-left-color: var(--bad); }
.check.save { border-left-color: var(--ok); }
.check .head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; font-size: 14.5px; }
.check .amt { color: var(--ok); font-weight: 800; }
.check.risk .amt { color: var(--bad); }
.check p { margin: 6px 0; color: var(--sub); line-height: 1.55; font-size: 13px; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--sub); font-weight: 600; margin-right: 6px; }
.tag.risk { background: var(--bad-bg); color: var(--bad); }
.tag.save { background: var(--ok-bg); color: var(--ok); }

.files li { margin: 6px 0; }
.files .who { color: var(--sub); font-size: 12.5px; }
.method.best td { background: var(--ok-bg); }
.method.off td { color: var(--sub); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.2); }
.dday { font-weight: 800; color: var(--navy2); min-width: 64px; display: inline-block; }

dialog { border: 0; border-radius: 14px; padding: 0; background: var(--card); color: var(--ink); max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg { padding: 22px; display: grid; gap: 10px; }
.dlg h3 { margin: 0 0 4px; }
.dlg label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.dlg-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .top { padding: 14px 16px; }
  .card { padding: 16px; }
  .stat .v { font-size: 19px; }
}
