:root {
  --bg: #f4f6f9; --panel: #fff; --line: #e3e7ee; --text: #1c2430; --muted: #6b7686;
  --brand: #1f3a68; --accent: #12a3a0; --danger: #d64545; --warn: #e0a100; --ok: #1b9a59;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }

/* 상단바 */
.top { display: flex; align-items: center; gap: 16px; background: var(--brand); color: #fff; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 5; }
.top .logo { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; }
.top .logo i { width: 10px; height: 22px; background: var(--accent); border-radius: 2px; display: inline-block; }
.top .who { margin-left: auto; font-size: 13px; opacity: .9; display: flex; gap: 12px; align-items: center; }
.top button { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.top button:hover { background: rgba(255,255,255,.25); }
.imp { background: var(--warn); color: #222; padding: 8px 20px; display: flex; gap: 12px; align-items: center; font-weight: 600; }
.imp button { margin-left: auto; }

/* 탭 */
.tabs { display: flex; gap: 4px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 14px 14px 12px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }
h2 { font-size: 18px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
h2 .sp { flex: 1; }
h3 { font-size: 15px; margin: 18px 0 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; letter-spacing: -0.5px; }
.stat span { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #c5ccd7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #e3f5ea; color: var(--ok); }
.badge.bad { background: #fbe7e7; color: var(--danger); }
.badge.warn { background: #fff4d6; color: #8a6400; }
.badge.blue { background: #e4ecf8; color: var(--brand); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #b9c0cb; }
.dot.on { background: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, monospace; letter-spacing: .5px; }
.code-big { font-family: Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--brand); }

/* 폼 */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b7d3f5; border-color: #7fa9de; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; max-height: 180px; overflow: auto; }
.checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.pick { border: 1px solid var(--line); border-radius: 7px; max-height: 240px; overflow: auto; }
.pick label { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick label:last-child { border-bottom: 0; }
.thumb { width: 36px; height: 64px; object-fit: cover; border-radius: 4px; background: #e9edf2; flex: none; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 20; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #222b38; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); }

/* 로그인 */
.login { max-width: 380px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login p { margin: 0 0 20px; color: var(--muted); }
.login .btn { width: 100%; padding: 10px; }

.progress { height: 6px; background: #e9edf2; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 10px; }
.bars div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; position: relative; }
.bars-label { display: flex; gap: 3px; font-size: 10px; color: var(--muted); }
.bars-label span { flex: 1; text-align: center; }
.warnbox { background: #fff7e0; border: 1px solid #f1d98a; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }

@media (max-width: 640px) {
  main { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .top .who span { display: none; }
}
