:root {
  --green: #2f9e44; --green-d: #237a34; --green-bg: #eef8ef;
  --orange: #e8590c; --red: #d6336c; --blue: #1971c2;
  --line: #dfe3e8; --muted: #6b7280; --text: #1f2933; --bg: #f6f7f9; --card: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: inherit; }
.top { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 18px; text-decoration: none; }
.brand b { color: var(--green); }
.biz { color: var(--muted); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 12px; }
.layout { display: flex; min-height: calc(100vh - 52px); }
.side { width: 180px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 12px 0; }
.side a { display: block; padding: 11px 22px; text-decoration: none; color: #374151; border-left: 3px solid transparent; }
.side a:hover { background: var(--green-bg); }
.side a.active { color: var(--green); font-weight: 700; border-left-color: var(--green); background: var(--green-bg); }
.main { flex: 1; padding: 22px 28px 60px; max-width: 1280px; min-width: 0; }
h2 { font-size: 20px; margin: 0 0 16px; }
h3 { font-size: 16px; margin: 26px 0 10px; }

.tabs { display: flex; gap: 22px; border-bottom: 2px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 0; font-size: 15px; cursor: pointer; color: #374151; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pills button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.pills button.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

.box { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; }
.guide { list-style: none; padding: 0; margin: 0; }
.guide li { position: relative; padding: 5px 0 5px 14px; line-height: 1.6; }
.guide li::before { content: "•"; position: absolute; left: 0; color: var(--muted); }
.guide li.warn { color: var(--orange); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.alert { border-color: var(--orange); }
.kpi.alert .value { color: var(--orange); }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
th { background: var(--green-bg); font-weight: 600; color: #374151; white-space: nowrap; border-top: 2px solid var(--green); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: #fafafa; }
tr.excluded td { color: #aaa; text-decoration: line-through; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.table-wrap table th { border-top: 0; }
.table-wrap table { min-width: 960px; }
.table-wrap td:first-child, .table-wrap td:nth-child(2) { white-space: nowrap; }
.table-wrap td select { max-width: 190px; }
.formtable th { width: 180px; background: #f3f4f6; border-top: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.prov { background: #fff4e6; color: var(--orange); }
.badge.conf { background: var(--green-bg); color: var(--green); }
.badge.exc { background: #f1f3f5; color: #868e96; }
.badge.est { background: #e7f5ff; color: var(--blue); }

input, select, textarea { font: inherit; padding: 6px 9px; border: 1px solid #cfd4da; border-radius: 4px; background: #fff; }
input:focus, select:focus { outline: 2px solid #b2f2bb; border-color: var(--green); }
input.amt { text-align: right; width: 130px; }
.btn { font: inherit; border: 1px solid #cfd4da; background: #fff; padding: 7px 14px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f8f9fa; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--green-d); }
.btn.outline { color: var(--orange); border-color: var(--orange); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warnbox { background: #fff4e6; border: 1px solid #ffd8a8; color: #a14a0a; padding: 10px 14px; border-radius: 6px; margin: 8px 0; line-height: 1.6; }
.okbox { background: var(--green-bg); border: 1px solid #b2f2bb; color: var(--green-d); padding: 10px 14px; border-radius: 6px; margin: 8px 0; }
.deadline { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.dday { font-weight: 700; color: var(--green); min-width: 60px; text-align: right; }
.dday.soon { color: var(--red); }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.flow .step { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.flow .step b { display: block; color: var(--green); margin-bottom: 6px; }
.vatline td:first-child { padding-left: 24px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #212529; color: #fff; padding: 12px 18px; border-radius: 6px; max-width: 420px; z-index: 10; }
.toast.err { background: var(--red); }
details.box summary { cursor: pointer; font-weight: 600; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: auto; display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side a { padding: 12px 14px; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .side a.active { border-bottom-color: var(--green); }
  .main { padding: 16px; }
  .biz, .who { display: none; }
}
