:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1b2230;
  --ink-soft: #5b6575;
  --ink-faint: #8b95a5;
  --line: #e3e7ee;
  --brand: #2f6bff;
  --brand-dark: #2050d8;
  --ok: #12864f;
  --ok-bg: #e5f6ec;
  --warn: #9a6400;
  --warn-bg: #fdf1da;
  --danger: #c2262d;
  --danger-bg: #fdeaea;
  --muted-bg: #eef0f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: #131a27;
  color: #cfd6e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  display: grid; place-items: center;
  font-size: 14px;
}
.brand-text { font-weight: 600; color: #fff; font-size: 14px; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: #b9c2d4;
  font-size: 13.5px;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--brand); color: #fff; font-weight: 600; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.me { display: flex; flex-direction: column; line-height: 1.3; }
.me strong { color: #fff; font-size: 13px; }
.me span { color: #8b95a9; font-size: 11.5px; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

/* ---------- page head ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.page-head .sub { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- panel ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: block;
}
.stat:hover { border-color: #c9d3e6; text-decoration: none; }
.stat .label { color: var(--ink-soft); font-size: 12.5px; }
.stat .value { font-size: 23px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; color: var(--ink); }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--ink-faint); }
.stat.is-danger .value { color: var(--danger); }
.stat.is-warn .value { color: var(--warn); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
table.grid th {
  background: #fafbfd;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 12.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.grid tbody tr:hover { background: #f7f9ff; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.wrap, table.grid th.wrap { white-space: normal; min-width: 180px; }
table.grid .row-deleted td { color: var(--ink-faint); text-decoration: line-through; }
table.grid tfoot td { padding: 10px 11px; background: #fafbfd; font-weight: 600; }

table.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.kv th, table.kv td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.kv th { width: 130px; background: #fafbfd; color: var(--ink-soft); font-weight: 600; }

.empty { padding: 34px 16px; text-align: center; color: var(--ink-faint); }

/* ---------- badge ---------- */
/* ---------- type tabs (서비스별 목록) ---------- */
.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.type-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.type-tab span {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--muted-bg);
  color: var(--ink-faint);
  font-size: 11.5px;
  font-weight: 650;
  text-align: center;
  line-height: 1.7;
}
.type-tab:hover { border-color: #c9d3e6; color: var(--ink); text-decoration: none; }
.type-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.type-tab.is-active span { background: rgba(255,255,255,.22); color: #fff; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--muted-bg); color: var(--ink-soft); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--ink-faint); }

input[type=text], input[type=password], input[type=date], input[type=number],
input[type=email], input[type=search], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d3d9e4;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7c869a 50%), linear-gradient(135deg, #7c869a 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.search-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.search-bar .actions { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-line { background: #fff; border-color: #d3d9e4; color: var(--ink); }
.btn-line:hover { background: #f4f6fa; color: var(--ink); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .18); color: #cfd6e4; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a51f25; }
.btn-danger-line { background: #fff; border-color: #eec3c5; color: var(--danger); }
.btn-danger-line:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------- flash ---------- */
.flash {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe6cf; }
.flash-err { background: var(--danger-bg); color: var(--danger); border-color: #f3c9cb; }
.flash-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb4; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #131a27; }
.login-card { width: 100%; max-width: 352px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-card h1 { margin: 0 0 4px; font-size: 19px; }
.login-card p.sub { margin: 0 0 20px; color: var(--ink-soft); font-size: 13px; }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; }

/* ---------- misc ---------- */
.muted { color: var(--ink-faint); }
.soft { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--muted-bg); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }
.pager { display: flex; gap: 4px; padding: 12px 16px; justify-content: center; flex-wrap: wrap; }
.pager a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); font-size: 12.5px; }
.pager a:hover { background: #f4f6fa; text-decoration: none; }
.pager a.is-current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }
details.inline-form { border: 1px dashed #ccd4e2; border-radius: 8px; padding: 10px 12px; background: #fbfcfe; }
details.inline-form summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--brand); }
details.inline-form[open] summary { margin-bottom: 10px; }

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; overflow-x: auto; }
  .main { padding: 16px 14px 50px; }
}
