:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  font-size: 1.05rem;
}

main#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #051019;
  font-weight: 600;
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
}

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

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.card-link:hover {
  border-color: var(--accent);
}

h1 {
  font-size: 1.3rem;
  margin: 0 0 16px;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input,
select,
textarea {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fecaca;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 0.88rem;
}

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

.badge-ok {
  background: rgba(34, 197, 94, 0.18);
  color: var(--ok);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.18);
  color: var(--danger);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.row-main {
  min-width: 0;
}

.row-title {
  font-weight: 500;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

details.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  padding: 0;
}

details.section > summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

details.section > summary::-webkit-details-marker {
  display: none;
}

details.section .section-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.auth-card {
  max-width: 360px;
  margin: 40px auto;
}

.stat-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 8px 0;
}
