:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #14213d;
  --muted: #64748b;
  --line: #dce4ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #b42318;
  --shadow: 0 20px 50px rgba(32, 53, 90, 0.1);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--primary); }
a { color: var(--primary); }
h1, h2, p { margin-top: 0; }

.landing {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.17), transparent 38%),
    var(--bg);
}

.landing-card, .panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.landing-card {
  width: min(560px, 100%);
  padding: 48px;
}

.landing-card h1 { font-size: clamp(2rem, 8vw, 3.7rem); }
.landing-card p:not(.eyebrow) { color: var(--muted); margin-bottom: 28px; }

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.topbar h1 { margin-bottom: 0; font-size: 1.55rem; }

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.panel { padding: 28px; margin-bottom: 24px; }
.panel.narrow { width: min(480px, 100%); margin: 70px auto; }
.muted { margin-bottom: 0; color: var(--muted); }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tab-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}
.tab-button.active { background: var(--primary); color: #fff; }
.tab-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.14);
  text-align: center;
  font-size: 0.75rem;
}
.tab-button.active .tab-count { background: rgba(255, 255, 255, 0.2); }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.section-heading h2 { margin-bottom: 5px; }
.heading-actions, .created-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.created-actions {
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding: 14px;
  border-radius: 12px;
  background: #eff6ff;
}

.form { display: grid; gap: 18px; }
.grid-form { grid-template-columns: 1fr 1fr 150px auto; align-items: end; }
.grid-form .wide { grid-column: span 2; }

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.15);
  border-color: var(--primary);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #e8eef8;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { filter: brightness(0.97); }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { border-color: var(--line); background: transparent; }
.button.danger { color: var(--danger); background: #fff0ee; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 0.78rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; }
td a { display: block; max-width: 390px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }
.actions { display: flex; gap: 6px; }
.select-cell { width: 42px; text-align: center; }
.selected-row { background: #eff6ff; }

.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}
.badge.active { background: #dcfce7; color: #166534; }
.badge.disabled { background: #f1f5f9; color: #64748b; }
.badge.bot { background: #fff0ee; color: var(--danger); }
.badge.human { background: #dcfce7; color: #166534; }

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.metric span { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.metric strong { font-size: 1.8rem; }

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
.stats-list { display: grid; gap: 8px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #f8fafc;
}

.empty {
  padding: 50px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 48px));
  padding: 14px 18px;
  border-radius: 12px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); }
.hidden { display: none !important; }

@media (max-width: 760px) {
  .topbar { padding: 20px 16px; }
  .container { width: min(100% - 20px, 1200px); margin-top: 18px; }
  .panel { padding: 20px; border-radius: 15px; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .wide { grid-column: auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .analytics-cards, .analytics-grid { grid-template-columns: 1fr; }
  .landing-card { padding: 32px 24px; }
}
