:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6eb; --text: #1f2430; --muted: #6b7280;
  --brand: #1f6feb; --brand-weak: #e8f0fe; --ok: #15803d; --ok-weak: #dcfce7; --bad: #b91c1c; --bad-weak: #fee2e2;
  --warn: #b45309; --warn-weak: #fef3c7; --side: #1b2130;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.side { width: 210px; background: var(--side); color: #cfd6e4; flex-shrink: 0; padding: 18px 10px; }
.side .brand { display: block; color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.side nav a { display: flex; align-items: center; gap: 8px; color: #cfd6e4; padding: 9px 10px; border-radius: 6px; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side nav a.on { background: var(--brand); color: #fff; }
.side .ic { width: 20px; text-align: center; }
.nav-sep { font-size: 12px; color: #7d879c; padding: 16px 10px 6px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 24px; }
.top h1 { font-size: 18px; margin: 0; flex: 1; }
.who { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.exp { background: var(--brand-weak); color: var(--brand); padding: 2px 8px; border-radius: 10px; }
.exp.warn { background: var(--warn-weak); color: var(--warn); }
.menu-btn { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.content { padding: 20px 24px 60px; }
.flash { margin: 14px 24px 0; background: var(--ok-weak); color: var(--ok); border-radius: 6px; padding: 10px 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h2 .sub { font-size: 12px; color: var(--muted); font-weight: normal; }
.card h3 { font-size: 14px; margin: 16px 0 8px; }
.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > .card { flex: 1; min-width: 300px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
th { background: #f9fafb; font-weight: 600; font-size: 13px; color: #374151; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: #f9fafb; }
tr.dup td { color: var(--bad); }
tr:hover td { background: #fafbfc; }
table.compact th, table.compact td { padding: 5px 8px; }

form.inline { display: inline; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=email], input[type=search], select, textarea {
  border: 1px solid #cfd4dc; border-radius: 6px; padding: 7px 9px; font: inherit; background: #fff; color: var(--text);
}
textarea { width: 100%; min-height: 120px; }
input.money, input.num { text-align: right; }
.btn, button { display: inline-block; border: 1px solid #cfd4dc; background: #fff; color: var(--text); padding: 7px 12px; border-radius: 6px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover, button:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary, button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover, button.primary:hover { background: #195cc4; }
.btn.danger, button.danger { color: var(--bad); border-color: #f1b4b4; }
.btn.sm, button.sm { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }

.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; align-items: center; max-width: 760px; }
.form-grid label.l { color: #374151; font-weight: 600; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; }
.error { background: var(--bad-weak); color: var(--bad); padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.note { background: var(--warn-weak); color: #7c4a03; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.info { background: var(--brand-weak); color: #1e4fa8; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f3; color: #374151; white-space: nowrap; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.bad { background: var(--bad-weak); color: var(--bad); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.blue { background: var(--brand-weak); color: var(--brand); }
.up { color: var(--bad); }
.down { color: var(--brand); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.bar { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.bar > span.ok { background: var(--ok); }
.chart-box { position: relative; height: 280px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 32px; width: 100%; max-width: 380px; }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box label { display: block; margin: 14px 0 4px; font-weight: 600; }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 18px; padding: 10px; }

.grade-box { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.grade { font-size: 28px; font-weight: 800; }
.score-ring { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; }

@media (max-width: 800px) {
  .side { position: fixed; left: -220px; top: 0; bottom: 0; z-index: 10; transition: left .2s; }
  .side.open { left: 0; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .row > .card { min-width: 0; }
}
