:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e8eef7;
  --muted: #93a4bc;
  --accent: #4f8cff;
  --accent-hover: #3d78e8;
  --success: #3ecf8e;
  --warning: #f5a623;
  --danger: #ff6b6b;
  --border: #2f4058;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

.login-card {
  max-width: 420px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel h2,
.panel h3 {
  margin: 0 0 0.75rem;
}

.muted {
  color: var(--muted);
}

.field-hint {
  font-size: 0.8rem;
}

.error {
  color: var(--danger);
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.env-card {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem;
}

.env-card h3 {
  margin-top: 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.ok { background: rgba(62, 207, 142, 0.2); color: var(--success); }
.badge.warn { background: rgba(245, 166, 35, 0.2); color: var(--warning); }
.badge.err { background: rgba(255, 107, 107, 0.2); color: var(--danger); }

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

textarea {
  resize: vertical;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.secondary:hover {
  background: var(--surface-2);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.inline-2 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-stack {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.status-box {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--surface-2);
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.list li:hover,
.list li.active {
  background: var(--surface-2);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

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

a.app-link {
  color: var(--accent);
}
