:root {
  --otto-pink: #F74374;
  --otto-pink-dim: #f7437422;
  --cyan: #10C4E0;
  --cyan-dim: #10c4e018;
  --ink: #17181C;
  --dark-surface: #0B0F12;
  --sidebar-bg: #0E1117;
  --card-bg: #ffffff;
  --body-bg: #F4F5F7;
  --border: #E2E4E9;
  --text: #17181C;
  --text-secondary: #6B7080;
  --text-muted: #9CA3AF;
  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

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

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

/* ========== Login ========== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-surface);
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.login-brand h1 span {
  font-weight: 400;
  color: var(--text-secondary);
}

.login-error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.login-card input:focus {
  border-color: var(--otto-pink);
  box-shadow: 0 0 0 3px var(--otto-pink-dim);
}

.login-card button {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  background: var(--otto-pink);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.login-card button:hover { background: #e03365; }

/* ========== App layout ========== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 28px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.brand-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--otto-pink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.brand-text { display: flex; flex-direction: column; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #9CA3AF;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; background: rgba(247,67,116,0.12); }
.nav-item.active svg { color: var(--otto-pink); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-item.logout { color: #6B7080; }
.nav-item.logout:hover { color: #EF4444; }

/* ========== Content ========== */
.content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.content-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.header-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.content-body {
  padding: 28px 32px;
  max-width: 1200px;
}

/* ========== KPI Cards ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ========== Panels ========== */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
}

/* ========== Tables ========== */
.table-wrap { overflow-x: auto; }

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

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  background: #F9FAFB;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

table.compact td { padding: 8px 16px; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

/* ========== Grid ========== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

/* ========== Badges & Status ========== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #F3F4F6;
  color: var(--text-secondary);
}

.badge-openclaw { background: var(--cyan-dim); color: #0891B2; }
.badge-hermes { background: #F3E8FF; color: #7C3AED; }

.tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.tier-sandbox { background: #F3F4F6; color: #6B7080; }
.tier-starter { background: #DBEAFE; color: #1D4ED8; }
.tier-pro { background: var(--otto-pink-dim); color: var(--otto-pink); }
.tier-business { background: #FEF3C7; color: #B45309; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.status-running { background: #10B981; }
.status-dot.status-exited { background: #EF4444; }
.status-dot.status-restarting { background: #F59E0B; }
.status-dot.status-created { background: #6B7080; }
.status-dot.status-not { background: #D1D5DB; }

.status-healthy { color: #10B981; }
.status-degraded { color: #F59E0B; }
.status-unreachable { color: #EF4444; }

.health-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========== Info Lists ========== */
.info-list { padding: 12px 20px; }

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #F3F4F6;
}

.info-row:last-child { border-bottom: none; }

.info-key {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
}

.info-val {
  font-size: 13px;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.info-pre {
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-secondary);
  overflow-x: auto;
}

/* ========== Logs ========== */
.log-output {
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  color: #D1D5DB;
  background: var(--dark-surface);
  max-height: 500px;
  overflow-y: auto;
}

/* ========== Buttons ========== */
.btn-sm {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  color: var(--otto-pink);
  border: 1px solid var(--otto-pink);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm:hover {
  background: var(--otto-pink);
  color: white;
}

/* ========== Misc ========== */
.mono { font-family: var(--mono); font-size: 12px; }

.user-cell { display: flex; flex-direction: column; gap: 2px; }
.user-email { font-weight: 500; }
.user-username { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}

.back-link:hover { color: var(--otto-pink); }

.progress-bar {
  height: 4px;
  background: #F3F4F6;
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--otto-pink);
  border-radius: 2px;
  transition: width 0.3s;
}

.file-list {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-item {
  padding: 4px 10px;
  background: #F3F4F6;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.service-grid {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .content-body { padding: 16px; }
  .content-header { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
