*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ── SIDEBAR ── */
#sidebar {
  width: 248px;
  min-width: 248px;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 22px;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}
.brand svg { flex-shrink: 0; }

.nav-section {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}

nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-radius: 0;
  transition: color .15s, background .15s;
  cursor: pointer;
}
nav a:hover { color: var(--primary); background: rgba(98,88,240,.06); }
nav a.active { color: var(--primary); background: rgba(98,88,240,.1); font-weight: 600; }
nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-spacer { flex: 1; }

.status-bar {
  padding: 12px 20px;
  font-size: 11px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── MAIN ── */
#content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-title { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing:.04em; }
.kpi-value { font-size: 28px; font-weight: 700; font-family: var(--mono); }
.kpi-sub { font-size: 12px; color: var(--muted); }

/* ── CARDS ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 700; }

/* ── TABLES ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(98,88,240,.03); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── STATUS DOTS ── */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--running, .dot--online { background: var(--green); box-shadow: 0 0 0 3px rgba(31,184,102,.2); }
.dot--exited, .dot--offline { background: var(--muted); }
.dot--created { background: var(--blue); }
.dot--paused  { background: var(--amber); }
.dot--dead, .dot--error { background: var(--red); }
.dot--unknown { background: var(--muted); }

/* ── PROGRESS BAR ── */
.progress-wrap { background: var(--line); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.badge--green  { background: rgba(31,184,102,.12); color: var(--green); }
.badge--red    { background: rgba(239,95,91,.12);  color: var(--red); }
.badge--blue   { background: rgba(63,135,245,.12); color: var(--blue); }
.badge--amber  { background: rgba(240,164,41,.12); color: var(--amber); }
.badge--muted  { background: var(--line); color: var(--muted); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn--primary  { background: var(--primary); color: #fff; }
.btn--danger   { background: var(--red); color: #fff; }
.btn--ghost    { background: var(--line); color: var(--text); }
.btn--sm { padding: 4px 10px; font-size: 11px; }

/* ── SUBTABS ── */
.subtabs { display: flex; gap: 4px; margin-bottom: 20px; }
.subtab {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; background: transparent; border: none;
  color: var(--muted); transition: all .15s;
}
.subtab:hover { color: var(--primary); background: rgba(98,88,240,.06); }
.subtab.active { color: var(--primary); background: rgba(98,88,240,.1); }

/* ── HEATMAP ── */
.heatmap { display: flex; gap: 3px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--line);
}
.heatmap-cell[data-level="1"] { background: rgba(98,88,240,.25); }
.heatmap-cell[data-level="2"] { background: rgba(98,88,240,.5); }
.heatmap-cell[data-level="3"] { background: rgba(98,88,240,.75); }
.heatmap-cell[data-level="4"] { background: var(--primary); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,31,51,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20,24,60,.2);
  padding: 24px;
  min-width: 400px; max-width: 640px; width: 100%;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 20px; }
.log-output {
  background: #1c1f33; color: #e2e8f0;
  font-family: var(--mono); font-size: 12px;
  padding: 14px; border-radius: var(--radius-sm);
  height: 340px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}

/* ── TERMINAL ── */
#terminal-container {
  background: #1c1f33;
  border-radius: var(--radius);
  padding: 4px;
  height: calc(100vh - 140px);
}

/* ── NODE CARDS ── */
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.node-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.node-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.node-name { font-weight: 700; font-size: 15px; }
.node-ip { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; font-family: var(--font);
  background: var(--bg); color: var(--text);
  outline: none; transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; font-family: var(--mono); }

/* ── SEARCH ── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px;
  margin-bottom: 16px;
}
.search-bar input { border: none; outline: none; background: transparent; font-size: 13px; flex: 1; color: var(--text); }

/* ── MISC ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { margin: 0 auto 12px; display: block; opacity: .4; }
.row { display: flex; gap: 16px; }
.row > * { flex: 1; }
.text-muted { color: var(--muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-primary { color: var(--primary); }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* 토스트 알림 */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); min-width: 200px;
  animation: slideIn .2s ease;
}
.toast--success { background: var(--green); color: #fff; }
.toast--error   { background: var(--red); color: #fff; }
.toast--info    { background: var(--primary); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }
