:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --ok: #3dd68c;
  --err: #f07178;
  --border: #2a3544;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.header-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.header h1 { margin: 0; font-size: 1.25rem; }
.badge {
  background: #243044;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}
.nav { margin-top: 0.75rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.nav a { color: var(--accent); text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card.wide { grid-column: 1 / -1; }
.login-card { max-width: 420px; margin: 3rem auto; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }
label { display: block; margin: 0.75rem 0 0.25rem; font-size: 0.9rem; color: var(--muted); }
input[type=text], input[type=password] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111822;
  color: var(--text);
}
.small-input { width: auto; min-width: 140px; display: inline-block; }
.btn {
  margin-top: 1rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 6px;
  background: #334155;
  color: var(--text);
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: #7f1d1d; }
.btn.small { margin-top: 0; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.actions { white-space: normal; }
.actions form.inline { display: inline-block; margin: 0.15rem 0.25rem 0.15rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.alert.ok { background: #123524; color: var(--ok); }
.alert.error { background: #3a1a1a; color: var(--err); }
.hint { color: var(--muted); font-size: 0.9rem; }
.stats { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 120px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat span { display: block; font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.proj-list { columns: 2; }
@media (max-width: 600px) { .proj-list { columns: 1; } }

.header-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; width: 100%; }
.server-health-strip { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; position: relative; padding: 0.25rem 0; }
.sh-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); font-size: 11px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.sh-chip:hover { background: rgba(255,255,255,0.08); }
.sh-chip-label { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 9px; }
.sh-chip-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.sh-chip.ok { border-color: rgba(61,214,140,0.45); } .sh-chip.ok .sh-chip-value { color: var(--ok); }
.sh-chip.warn { border-color: rgba(240,113,120,0.35); } .sh-chip.warn .sh-chip-value { color: #f0c674; }
.sh-chip.critical { border-color: rgba(240,113,120,0.65); background: rgba(240,113,120,0.1); } .sh-chip.critical .sh-chip-value { color: var(--err); }
.server-health-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; min-width: min(420px, 92vw); max-width: 520px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); box-shadow: 0 12px 40px rgba(0,0,0,0.45); font-size: 12px; }
.server-health-popover.hidden { display: none; }
.server-health-popover h4 { margin: 0 0 8px; font-size: 13px; }
.sh-pop-section { margin-bottom: 10px; }
.sh-pop-section:last-child { margin-bottom: 0; }
.sh-alert-critical { color: var(--err); }
.sh-alert-warn { color: #f0c674; }
@media (max-width: 900px) { .sh-chip-label { display: none; } .server-health-strip { max-width: 100%; } }

.btn.small.primary { background: var(--accent); color: #fff; margin-top: 0; }
.cb-actions { min-width: 160px; vertical-align: middle; }

input[type=number], input[type=email] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111822;
  color: var(--text);
}
.page-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.page-header h2 { margin: 0; }
.ok-badge { background: #123524; color: var(--ok); }
.err-badge { background: #3a1a1a; color: var(--err); }
.quota-bar {
  position: relative;
  height: 22px;
  background: #111822;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 120px;
}
.quota-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.quota-bar.warn .quota-fill { background: #f0c674; }
.quota-bar.critical .quota-fill { background: var(--err); }
.quota-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}
.action-details { display: inline-block; margin: 0.15rem 0.25rem; }
.action-details summary { list-style: none; cursor: pointer; }
.action-details summary::-webkit-details-marker { display: none; }
.stack-form {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #111822;
  border-radius: 6px;
  border: 1px solid var(--border);
  min-width: 220px;
}
.stack-form label { margin-top: 0.5rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.form-actions .btn { margin-top: 0; }
.btn-cancel { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-cancel:hover { color: var(--text); border-color: var(--muted); }
.card form > .form-actions { margin-top: 1rem; }
.sensitive-label { color: #f0c674; font-weight: 600; }
.sensitive-input { border-color: #5c4a1f !important; }
.quota-form { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: flex-end; }
.quota-form .sensitive-input { min-width: 140px; flex: 1; }
.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--accent); }
.quick-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quick-links .btn { margin-top: 0; }
.feature-list { margin: 0; padding-left: 1.25rem; color: var(--muted); }
.feature-list li { margin: 0.35rem 0; }
.stat .online { color: var(--ok); }
.stat .offline { color: var(--err); }
.card h3 { margin-top: 0; font-size: 1rem; }
.hidden { display: none !important; }
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111822;
  color: var(--text);
}
