:root {
  color-scheme: light dark;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #0ea5e9;
  --ok: #16a34a;
  --warn: #eab308;
  --border: #cbd5e1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 20% 0%, #dbeafe, #f1f5f9 40%);
  color: var(--text);
}
.shell {
  width: min(720px, 94vw);
  margin: 20px auto 40px;
}
.auth-shell {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  gap: 12px;
}
.app-shell { display: grid; gap: 12px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
h1 { margin: 0 0 4px 0; font-size: clamp(1.4rem, 3.8vw, 2rem); }
h2 { margin: 0 0 10px 0; font-size: 1rem; }
.muted { color: var(--muted); margin: 0; }
.tiny { font-size: 12px; color: var(--muted); }

label { font-size: 13px; color: var(--muted); }
input, textarea, select {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}
button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 600;
}
button.secondary { background: #334155; }
button.ghost {
  width: auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}
.user-manage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.mini-btn {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}
.mini-btn.danger {
  background: #dc2626;
}
.mini-btn.ok {
  background: #16a34a;
}
.list li.empty {
  color: var(--muted);
  font-style: italic;
}
.badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}
.badge.off {
  background: #e2e8f0;
  color: #475569;
}
.role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.role-badge {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.role-member { background: #dcfce7; color: #166534; border-color: #86efac; }
.role-supervisor { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.role-owner { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-title {
  margin: 8px 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hidden { display: none; }
.dev-link-wrap { margin-top: 6px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #111827;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
  }
  body { background: radial-gradient(circle at 20% 0%, #0f172a, #0b1220 45%); }
  .list li { background: #0f172a; }
}
