/* ============================================
   Astrape.AI — Design System
   Light, calm, premium enterprise. Warm off-white
   ground, white elevated cards, midnight-navy text.
   Electric lime is reserved for primary actions,
   active states and progress; soft indigo marks AI.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: light;

  /* Surfaces */
  --bg-primary: #f6f5f1;       /* warm off-white page ground */
  --bg-secondary: #fbfaf7;     /* quiet panel headers, rails */
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf6;
  --bg-elevated: #f3f2ed;      /* chips, tags, subtle fills */
  --bg-input: #ffffff;
  --bg-sunken: #f0efe9;

  /* Borders */
  --border: #e8e6df;
  --border-hover: #d9d6cc;
  --border-strong: #c8c4b8;

  /* Text */
  --text-primary: #0b1533;     /* deep midnight navy */
  --text-secondary: #4a5470;
  --text-muted: #8b91a3;

  /* Accent — Astrape electric lime. Fill only; use --accent-ink for text. */
  --accent: #c6f432;
  --accent-hover: #b8ea1c;
  --accent-text: #0b1533;
  --accent-ink: #4d7c0f;
  --accent-soft: rgba(198, 244, 50, 0.22);
  --accent-border: rgba(122, 166, 15, 0.45);

  /* AI — soft indigo/violet, used sparingly for AI moments */
  --ai: #6d5dfc;
  --ai-ink: #5243e0;
  --ai-soft: rgba(109, 93, 252, 0.08);
  --ai-border: rgba(109, 93, 252, 0.24);

  /* Legacy tokens — kept so existing HTML keeps rendering */
  --accent-1: var(--accent);
  --accent-2: var(--accent);
  --accent-3: var(--text-primary);
  --accent-gradient: var(--accent);
  --accent-glow: none;

  /* Semantic */
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.09);
  --warning: #c27803;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.07);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.08);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows — extremely soft */
  --shadow-sm: 0 1px 2px rgba(11, 21, 51, 0.04);
  --shadow-md: 0 1px 2px rgba(11, 21, 51, 0.04), 0 8px 24px -10px rgba(11, 21, 51, 0.08);
  --shadow-lg: 0 2px 6px rgba(11, 21, 51, 0.04), 0 24px 48px -16px rgba(11, 21, 51, 0.18);

  --transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  --font: 'Inter', 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 14px;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before { content: none; }

a { color: inherit; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.05rem 0.35rem;
}

hr { border: none; border-top: 1px solid var(--border); }

/* ── Typography ── */
h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
h3 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.012em; }
h4 { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.005em; }

.gradient-text {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-primary);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.82em;
  font-variant-numeric: tabular-nums;
}

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

/* ── Icons (thin line) ── */
.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ── Cards ── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  white-space: nowrap;
  letter-spacing: -0.005em;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent-border);
}

.btn::after { content: none; }
.btn:disabled { cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 1px 2px rgba(77, 124, 15, 0.18);
}

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

.btn-primary:disabled { opacity: 0.55; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-secondary:disabled { opacity: 0.45; }

/* Text-style button for tertiary actions */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Destructive: subtle until hovered */
.btn-danger {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: rgba(217, 45, 32, 0.35);
  color: var(--danger);
}

/* AI-flavoured button */
.btn-ai {
  background: var(--ai-soft);
  color: var(--ai-ink);
  border-color: var(--ai-border);
}

.btn-ai:hover { background: rgba(109, 93, 252, 0.13); }

.btn-sm { min-height: 32px; padding: 0.35rem 0.75rem; font-size: 0.78rem; border-radius: var(--radius-sm); }
.btn-lg { min-height: 48px; padding: 0.8rem 1.4rem; font-size: 0.95rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ── Inputs ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

.helper, .input-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.45;
  transition: var(--transition);
  outline: none;
  box-shadow: var(--shadow-sm);
}

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

.input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--bg-input);
}

.input::placeholder { color: var(--text-muted); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}

textarea.input {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font);
}

input[type="file"].input {
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
}

input[type="file"].input::file-selector-button {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] { accent-color: #7aa60f; }

/* Progressive disclosure */
details.disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

details.disclosure > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}

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

details.disclosure > summary .summary-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}

details.disclosure > summary::after {
  content: '';
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

details.disclosure[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }

details.disclosure > .disclosure-body {
  padding: 0.25rem 1.1rem 1.1rem;
  display: grid;
  gap: 1rem;
}

/* ── Layout ── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

/* Logo mark: navy tile with a lime bolt. Pages keep a "⚡" character inside
   .logo — it's hidden and the mark is drawn with pseudo-elements. */
.navbar-brand .logo {
  width: 28px;
  height: 28px;
  background: var(--text-primary);
  border-radius: 8px;
  display: inline-block;
  position: relative;
  font-size: 0;
  color: transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.navbar-brand .logo::before {
  content: '';
  position: absolute;
  inset: 6px 7px;
  background: var(--accent);
  clip-path: polygon(40% 0, 100% 0, 60% 50%, 100% 50%, 0 100%, 40% 50%, 0 50%);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Grid ── */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Badges / status pills ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  line-height: 1.5;
  text-transform: none;
  white-space: nowrap;
}

.badge-live {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.22);
}

.badge-live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.badge-draft {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.22);
}

.badge-ai {
  background: var(--ai-soft);
  color: var(--ai-ink);
  border-color: var(--ai-border);
}

.badge-role {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
  font-size: 0.72rem;
}

/* ── Department Group ── */
.dept-group { margin-bottom: 2rem; }

.dept-group h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  text-transform: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dept-group h3::before { content: none; }

/* ── App Card ── */
.app-card {
  cursor: pointer;
  position: relative;
}

.app-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.app-card .app-name {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.app-card .app-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 21, 51, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px) scale(0.99);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.modal-overlay.active .modal {
  transform: none;
  opacity: 1;
}

.modal h2 {
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table th,
.data-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid #efede7;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr { transition: background-color 120ms ease; }
.data-table tbody tr:hover td { background: var(--bg-card-hover); }

.data-table td.mono,
.data-table .mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Tables sitting directly in a card bleed to the card edge */
.glass-card > .data-table { margin: -0.5rem -0.25rem; width: calc(100% + 0.5rem); }

/* ── Row action menus (built by /assets/ui.js) ── */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
}

.row-menu { position: relative; display: inline-flex; }

.row-menu-trigger {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.row-menu-trigger:hover,
.row-menu.open .row-menu-trigger {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}

.row-menu-list {
  position: fixed;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  z-index: 1500;
  display: none;
  flex-direction: column;
}

.row-menu-list.open { display: flex; }

.row-menu-list .btn,
.row-menu-list a.btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  border: none;
  box-shadow: none;
  background: transparent;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.83rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
}

.row-menu-list .btn:hover { background: var(--bg-elevated); }

.row-menu-list .btn-danger { color: var(--danger); }
.row-menu-list .btn-danger:hover { background: var(--danger-soft); }

.row-menu-list .menu-sep {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.2rem;
}

/* ── Toggle Switch ── */
.toggle {
  position: relative;
  width: 38px;
  height: 22px;
  display: inline-block;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border: 1px solid var(--border-hover);
  border-radius: 22px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(11, 21, 51, 0.2);
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent-border);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ── Tab System ── */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
  margin-bottom: -1px;
  transition: var(--transition);
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.chip:hover { border-color: var(--border-hover); color: var(--text-primary); }

.chip.active,
.chip[aria-pressed="true"] {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
}

.chip .swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(11, 21, 51, 0.12);
}

/* ── Stepper ── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  counter-reset: step;
}

.stepper li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 0;
}

.stepper li:last-child { flex: 0 0 auto; }

.stepper li::after {
  content: '';
  flex: 1;
  height: 2px;
  min-width: 12px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 0.6rem;
}

.stepper li:last-child::after { content: none; }

.stepper .step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-hover);
  background: var(--bg-card);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.stepper li.done { color: var(--text-secondary); }
.stepper li.done .step-dot { background: var(--text-primary); border-color: var(--text-primary); color: var(--accent); }
.stepper li.done::after { background: var(--text-primary); }

.stepper li.current { color: var(--text-primary); }
.stepper li.current .step-dot {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-text);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

@media (max-width: 640px) {
  .stepper li .step-label { display: none; }
  .stepper li.current .step-label { display: inline; }
}

/* ── Progress ── */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms ease;
}

/* ── AI marker ── */
.ai-spark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ai-ink);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: slideIn 180ms ease-out, fadeOut 220ms ease-in 3s forwards;
  max-width: 380px;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

/* ── Animations — restrained ── */
@keyframes slideIn {
  from { transform: translateX(8px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-4px); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.fade-in-up { animation: fadeInUp 260ms ease-out both; }

.stagger-1 { animation-delay: 40ms; }
.stagger-2 { animation-delay: 80ms; }
.stagger-3 { animation-delay: 120ms; }
.stagger-4 { animation-delay: 160ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ── Loader ── */
.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(11, 21, 51, 0.18);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.empty-state .icon {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ── Access Level Checkboxes ── */
.access-level-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.access-level-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.84rem;
}

.access-level-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.access-level-item:has(input:checked) {
  border-color: var(--accent-border);
  background: rgba(198, 244, 50, 0.08);
}

.access-level-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
}

.access-level-item .label {
  font-size: 0.84rem;
  font-weight: 550;
}

.access-level-item .desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Scrollbar (subtle) ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }

/* ── Selection ── */
::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  .container { padding: 0 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .navbar { padding: 0.7rem 1rem; }
  .access-level-grid { grid-template-columns: 1fr; }
  .modal { padding: 1.35rem; border-radius: 16px; }
}

/* ── Utilities ── */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
