:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --panel: #fffaf3;
  --text: #1e293b;
  --muted: #6b7280;
  --line: #eadfce;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --accent: #f97316;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --soft: #f1e8ff;
  --shadow: 0 22px 70px rgba(88, 63, 34, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.18), transparent 26rem),
    radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.16), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
.is-busy { cursor: wait !important; }
.hidden { display: none !important; }

.app-view { min-height: 100vh; }
.panel {
  background: rgba(255, 250, 243, 0.94);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
}
.topbar h1 { margin: 0; letter-spacing: -0.06em; }

label { display: grid; gap: 8px; font-weight: 800; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line);
  border-radius: 16px; padding: 13px 15px;
  background: white; color: var(--text);
}
textarea {
  min-height: 320px; margin-top: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px; resize: vertical;
}

.user-panel, .profile-actions, .section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.auth-message { color: var(--danger); margin: 0; }

.button, .tab, a.button { border: 0; cursor: pointer; text-decoration: none; transition: 0.18s ease; }
.button { border-radius: 999px; padding: 11px 16px; font-weight: 900; }
.button.primary { color: white; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.button.primary:hover { filter: brightness(0.95); }
.button.secondary { color: var(--primary); background: var(--soft); }
.button.ghost { color: var(--primary); background: white; border: 1px solid var(--line); }
.button.danger { color: white; background: var(--danger); }

.topbar {
  max-width: 1180px; margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 30px) 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
main { max-width: 1180px; margin: 0 auto 112px; padding: 0 clamp(18px, 4vw, 30px); }
.panel { padding: 22px; margin-bottom: 18px; }

.eyebrow {
  margin: 0 0 8px; color: var(--primary);
  font-size: 12px; font-weight: 950; letter-spacing: 0.12em; text-transform: uppercase;
}
.muted, .label { color: var(--muted); }

.pill, .tag {
  display: inline-flex; width: fit-content; align-items: center;
  border-radius: 999px; padding: 7px 11px;
  background: var(--soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 950;
}

.admin-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; }
.admin-wide { grid-column: 1 / -1; }

.toggle-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 18px; }
.toggle-row input { width: auto; }

.user-list { display: grid; gap: 10px; margin-top: 16px; }
.user-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: white;
}
.user-row span { display: block; margin-top: 4px; font-size: 13px; }

.crud-list { display: grid; gap: 10px; margin-top: 16px; }
.crud-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: white;
}
.crud-row span { display: block; margin-top: 4px; font-size: 13px; }
.crud-add-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.crud-add-row input { flex: 1; min-width: 160px; }

@keyframes spin { to { transform: rotate(360deg); } }
.is-busy::after {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-left: 0.5em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 999px; animation: spin 0.8s linear infinite;
}

@media (max-width: 900px) {
  .topbar, .admin-grid { grid-template-columns: 1fr; }
  .topbar, .section-title { align-items: flex-start; flex-direction: column; }
}
