:root {
  --bg: #0b0f1a;
  --panel: #111827;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --accent: #2f6cff;
  --accent-dark: #1f4fce;
  --line: #1f2937;
  --soft: #0f172a;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.bg-soft {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(47, 108, 255, 0.15), transparent 45%),
    radial-gradient(circle at top right, rgba(31, 79, 206, 0.12), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: #0b1220;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 1px;
}

h1 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 1px;
}

.nav {
  display: flex;
  gap: 18px;
}

.nav-item {
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.nav-item.active {
  color: var(--accent);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button,
.file-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

button.ghost,
.file-btn.ghost {
  background: #0f172a;
  color: var(--ink);
  border-color: var(--line);
}

.file-btn input {
  display: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #0f172a;
}

.dashboard,
.campaign {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 32px 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

input[type="search"],
select,
input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #0f172a;
  color: var(--ink);
}

.filter-panel {
  padding: 16px 20px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.quick-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-group button {
  background: #0f172a;
  color: var(--ink);
  border-color: var(--line);
}

.quick-group button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #0f172a;
  box-shadow: var(--shadow);
}

.kpi-card .label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-card .value {
  font-size: 22px;
  font-weight: 700;
}

.chart-panel {
  padding: 18px;
  height: 380px;
}

.chart-panel canvas {
  width: 100%;
  height: 100% !important;
  max-height: 320px;
  display: block;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.mapping-item {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.mapping-item label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.empty {
  text-align: center;
  padding: 80px 20px;
}

.hidden {
  display: none;
}

.campaign-head {
  padding: 12px 20px;
}

.campaign-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
}

.campaign-title select {
  font-size: 16px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--ink);
}

.campaign-actions {
  display: flex;
  gap: 8px;
}

.campaign-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.campaign-tabs button {
  border: none;
  background: var(--soft);
  padding: 12px 10px;
  font-weight: 600;
  color: var(--ink);
}

.campaign-tabs button.active {
  background: #1f2937;
  color: white;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff7a00;
  color: white;
  font-size: 11px;
  margin-left: 6px;
  padding: 0 6px;
}

.content-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.content-head h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.table-wrap {
  border-top: 1px solid #8e96a3;
  margin-top: 12px;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

.table thead th {
  text-align: left;
  padding: 10px 8px;
  background: #0f172a;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid #111827;
}

.table tbody tr:hover {
  background: #0f172a;
}

.table tbody tr.active-row {
  background: #f1f0ff;
}

.table tfoot td {
  padding: 10px 8px;
  font-weight: 700;
  background: #0f172a;
}

.text-right {
  text-align: right;
}

.keyword-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.keyword-actions input {
  flex: 1;
}

.action-group {
  display: flex;
  gap: 8px;
}

.action-btn {
  background: rgba(47, 108, 255, 0.15);
  color: #7fb0ff;
  border-color: rgba(47, 108, 255, 0.35);
}

.action-btn.secondary {
  background: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
  border-color: rgba(14, 165, 233, 0.3);
}

.table-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
  }

  .nav {
    flex-wrap: wrap;
  }

  .campaign-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
