/* ── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f11;
  --bg2:       #16161a;
  --bg3:       #1e1e24;
  --border:    rgba(255,255,255,.07);
  --border2:   rgba(255,255,255,.12);
  --text:      #e8e8ec;
  --text2:     #8b8b9a;
  --text3:     #55555f;
  --rose:      #e8607a;
  --rose-dim:  rgba(232,96,122,.15);
  --rose-glow: rgba(232,96,122,.35);
  --green:     #4ade80;
  --green-dim: rgba(74,222,128,.12);
  --amber:     #fbbf24;
  --amber-dim: rgba(251,191,36,.12);
  --blue:      #60a5fa;
  --blue-dim:  rgba(96,165,250,.12);
  --purple:    #a78bfa;
  --purple-dim:rgba(167,139,250,.12);
  --red:       #f87171;
  --red-dim:   rgba(248,113,113,.12);
  --radius:    10px;
  --sidebar:   240px;
  --font:      'Instrument Sans','Noto Sans KR',sans-serif;
  --mono:      'JetBrains Mono', monospace;
}

html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; overflow: hidden; }

/* ── Layout ─────────────────────────────────────────────── */
#app { display: flex; height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--rose), #c0405a);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; letter-spacing: .05em;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.logo-sub  { font-size: 10px; color: var(--text3); letter-spacing: .08em; text-transform: uppercase; margin-top: 1px; }

.nav-section { padding: 16px 12px 8px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10px; color: var(--text3); letter-spacing: .12em; text-transform: uppercase; padding: 0 8px; margin-bottom: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--text2); font-size: 13.5px; font-weight: 500;
  transition: all .18s; margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--rose-dim); color: var(--rose); }
.nav-item svg    { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--rose); color: white;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.admin-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg3);
}
.admin-avatar {
  width: 28px; height: 28px; border-radius: 99px;
  background: linear-gradient(135deg, var(--rose), #c0405a);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
}
.admin-name  { font-size: 13px; font-weight: 500; }
.admin-role  { font-size: 10px; color: var(--text3); }
.logout-btn  {
  margin-left: auto; padding: 4px 8px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border2);
  color: var(--text3); font-size: 11px; cursor: pointer; transition: all .18s; font-family: var(--font);
}
.logout-btn:hover { border-color: var(--rose); color: var(--rose); }

/* ── Main content ─────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  padding: 0 28px; height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── Cards ─────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; letter-spacing: .03em; }
.stat-value { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub   { font-size: 12px; color: var(--text3); display: flex; gap: 12px; margin-top: 4px; }
.sub-item   { display: flex; align-items: center; gap: 4px; }
.dot        { width: 6px; height: 6px; border-radius: 99px; flex-shrink: 0; }

/* ── Section ─────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.section-title { font-size: 16px; font-weight: 700; }

/* ── Toolbar / filters ─────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative; flex: 1; min-width: 180px;
}
.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text3); width: 15px; height: 15px; pointer-events: none;
}
input[type=text], input[type=number], input[type=email], input[type=password], textarea, select {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 13.5px;
  border-radius: 8px; outline: none; transition: border-color .18s;
}
input[type=text]:focus, input[type=number]:focus, input[type=email]:focus, input[type=password]:focus,
textarea:focus, select:focus { border-color: var(--rose); }
.search-input { width: 100%; padding: 8px 10px 8px 32px; }
.filter-select { padding: 8px 12px; cursor: pointer; }
.filter-select option { background: var(--bg2); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; border: none; font-family: var(--font);
  transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--rose); color: white; }
.btn-primary:hover { background: #d0455e; }
.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { border-color: var(--rose); color: var(--rose); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn svg { width: 14px; height: 14px; }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 11px 16px; text-align: left; font-size: 11.5px;
  font-weight: 600; color: var(--text3); letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
}
td {
  padding: 13px 16px; font-size: 13px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--text2); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-green   { background: var(--green-dim);  color: var(--green);  }
.badge-rose    { background: var(--rose-dim);    color: var(--rose);   }
.badge-amber   { background: var(--amber-dim);   color: var(--amber);  }
.badge-blue    { background: var(--blue-dim);    color: var(--blue);   }
.badge-purple  { background: var(--purple-dim);  color: var(--purple); }
.badge-red     { background: var(--red-dim);     color: var(--red);    }
.badge-neutral { background: rgba(255,255,255,.07); color: var(--text2); }
.badge-dot {
  width: 5px; height: 5px; border-radius: 99px; background: currentColor;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text2);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); font-size: 12px; font-family: var(--font);
  transition: all .18s;
}
.page-btn:hover      { border-color: var(--rose); color: var(--rose); }
.page-btn.active     { background: var(--rose); color: white; border-color: var(--rose); }
.page-btn:disabled   { opacity: .35; cursor: not-allowed; }

/* ── Status select inline ─────────────────────────────────── */
.status-row  { display: flex; align-items: center; gap: 8px; }
.status-sel  { padding: 5px 8px; border-radius: 7px; font-size: 12.5px; min-width: 110px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; width: 520px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px); overflow-y: auto;
  animation: slideUp .2s cubic-bezier(.16,1,.3,1);
}
@keyframes slideUp { from{transform:translateY(24px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-header {
  padding: 22px 24px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.modal-close:hover { border-color: var(--rose); color: var(--rose); }
.modal-body   { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Form ─────────────────────────────────────────────────── */
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: .04em; text-transform: uppercase; }
.form-input-full { width: 100%; padding: 9px 12px; }
.form-textarea { width: 100%; padding: 9px 12px; resize: vertical; min-height: 80px; }
.form-select  { width: 100%; padding: 9px 12px; cursor: pointer; }
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 40px; height: 22px; border-radius: 99px; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--border2);
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle.on { background: var(--rose); border-color: var(--rose); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 99px;
  background: white; transition: left .2s;
}
.toggle.on::after { left: 20px; }
.form-error { font-size: 12px; color: var(--rose); margin-top: 4px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert-bar {
  position: fixed; top: 20px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  max-width: 360px; border-left: 3px solid;
  animation: slideInRight .22s cubic-bezier(.16,1,.3,1);
  pointer-events: all;
  display: flex; align-items: center; gap: 10px;
}
@keyframes slideInRight { from{transform:translateX(30px);opacity:0} to{transform:translateX(0);opacity:1} }
.alert-success { background: #0a2a16; border-color: var(--green); color: var(--green); }
.alert-error   { background: #2a0a0a; border-color: var(--rose); color: var(--rose); }
.alert-info    { background: #0a1a2a; border-color: var(--blue); color: var(--blue); }

/* ── Login page ─────────────────────────────────────────────── */
#login-page {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 0;
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 40px 36px; width: 380px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--rose), #c0405a);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white; margin: 0 auto 12px;
  letter-spacing: .05em;
}
.login-title { font-size: 20px; font-weight: 700; }
.login-sub   { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  padding: 48px; text-align: center; color: var(--text3);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .3; }
.empty-state p   { font-size: 14px; }

/* ── Loading ─────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 99px;
  border: 2px solid var(--border2); border-top-color: var(--rose);
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row td { text-align: center; padding: 32px; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }
