:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #22262f;
  --bg-input: #161922;
  --border: #2a2e3a;
  --text: #e1e4eb;
  --text-dim: #8b90a0;
  --accent: #6c8cff;
  --accent-hover: #8ba3ff;
  --green: #3dd68c;
  --yellow: #f5c542;
  --red: #f5564a;
  --orange: #f59e42;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-w: 220px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

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

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

nav { padding: 12px 0; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--accent); background: rgba(108, 140, 255, 0.08); border-right: 2px solid var(--accent); }
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

h2 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.stat { text-align: center; padding: 16px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green { background: rgba(61, 214, 140, 0.15); color: var(--green); }
.badge-yellow { background: rgba(245, 197, 66, 0.15); color: var(--yellow); }
.badge-red { background: rgba(245, 86, 74, 0.15); color: var(--red); }
.badge-dim { background: rgba(139, 144, 160, 0.15); color: var(--text-dim); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:hover td { background: var(--bg-hover); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(245, 86, 74, 0.1); }

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

input, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  width: 100%;
}

input:focus, select:focus { outline: none; border-color: var(--accent); }

label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }

.form-row { margin-bottom: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); }

.log-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 480px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 20;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s;
}

.log-panel.hidden { transform: translateX(100%); }

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

#log-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 440px;
  max-width: 90vw;
}

.modal h3 { margin-bottom: 16px; }

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  animation: slideIn 0.25s ease;
  max-width: 360px;
}

.toast-success { background: rgba(61, 214, 140, 0.15); border: 1px solid var(--green); color: var(--green); }
.toast-error { background: rgba(245, 86, 74, 0.15); border: 1px solid var(--red); color: var(--red); }
.toast-info { background: rgba(108, 140, 255, 0.15); border: 1px solid var(--accent); color: var(--accent); }

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

.loading { color: var(--text-dim); padding: 40px; text-align: center; }

.tenant-row { cursor: pointer; }
.tenant-detail { display: none; }
.tenant-detail.open { display: table-row; }
.tenant-detail td { padding: 16px 12px; background: var(--bg); }

.container-list { display: flex; flex-direction: column; gap: 4px; }
.container-item { display: flex; align-items: center; gap: 8px; font-size: 12px; font-family: var(--mono); }

.empty { padding: 40px; text-align: center; color: var(--text-dim); }

.ip-text { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── App shell / login ──────────────────────────────────────────────────── */

#app-shell { display: flex; flex: 1; }
#app-shell.hidden { display: none; }

.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.login-screen.hidden { display: none; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 360px;
  max-width: 90vw;
  text-align: center;
}

.login-card h1 { color: var(--accent); font-size: 26px; letter-spacing: -0.5px; }
.login-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}
.login-error { color: var(--red); font-size: 12px; min-height: 18px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-link { color: var(--text-dim); text-decoration: none; }
.sidebar-link:hover { color: var(--accent); }
.sidebar-link.hidden { display: none; }

.nav-badge {
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: auto;
}
.nav-badge.hidden { display: none; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
