/* ── 리셋 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── 전체 레이아웃 ── */
:root {
  --bg:        #07090e;
  --surface:   #0f1319;
  --card:      #151b24;
  --border:    rgba(255,255,255,0.08);
  --text:      #e8edf5;
  --muted:     #8693a4;
  --accent:    #0a8fff;
  --cyan:      #3fe0ff;
  --success:   #18d99a;
  --warning:   #ffb020;
  --danger:    #ff5469;
  --sidebar-w: 240px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── 사이드바 ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 24px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo span {
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: var(--text);
  background: rgba(10,143,255,0.12);
  border-color: rgba(255,255,255,0.1);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.connect-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px dashed rgba(63,224,255,0.4);
  background: rgba(10,143,255,0.08);
  color: var(--cyan);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}

.connect-btn:hover {
  border-style: solid;
  box-shadow: 0 0 0 1px rgba(63,224,255,0.2), 0 4px 18px rgba(10,143,255,0.3);
}

/* ── 메인 영역 ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

#content {
  padding: 28px;
  flex: 1;
}

/* ── 카드 ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── 그리드 ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.flex-col { display: flex; flex-direction: column; gap: 16px; }

/* ── KPI 카드 ── */
.kpi-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-delta.up   { color: var(--success); background: rgba(24,217,154,0.12); }
.kpi-delta.down { color: var(--danger);  background: rgba(255,84,105,0.12); }

/* ── 뱃지 ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-success  { color: var(--success); background: rgba(24,217,154,0.12);  border: 1px solid rgba(24,217,154,0.25); }
.badge-warning  { color: var(--warning); background: rgba(255,176,32,0.12);  border: 1px solid rgba(255,176,32,0.25); }
.badge-accent   { color: var(--cyan);    background: rgba(10,143,255,0.12);  border: 1px solid rgba(63,224,255,0.3); }
.badge-neutral  { color: var(--muted);   background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); }

/* ── 폼 ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

input, select, textarea {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,143,255,0.15);
}

select option { background: var(--surface); }

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #18c0f3;
  box-shadow: 0 4px 18px rgba(10,143,255,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 테이블 ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 0 16px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

td.primary { color: var(--text); font-weight: 500; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 28px;
  width: 480px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── 토스트 ── */
#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  min-width: 300px;
  animation: slideIn 0.2s ease;
}

.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.error   { border-left: 3px solid var(--danger); }

.toast-title   { font-size: 14px; font-weight: 600; color: var(--text); }
.toast-message { font-size: 12px; color: var(--muted); margin-top: 2px; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── 빈 상태 ── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--muted);
  gap: 10px;
  text-align: center;
}

.empty-icon { font-size: 32px; opacity: 0.4; }
.empty-text { font-size: 14px; }

/* ── 로딩 ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
}
