/* ═══════════════════════════════════════════════════════════════════════════
   DESIGN KIT — the structured utility layer (SaaS Phase 6, ADR-0005).

   The design TOKENS (colors, spacing, radius, shadows, fonts) live in
   style.css `:root` — this file layers the reusable structural classes on
   top of them so page templates carry NO inline `style={{}}` CSS.

   Rules:
   - A page template (app/(app)|(admin)/**.tsx) expresses layout ONLY through
     these classes (or a page-scoped class in style.css for true one-offs).
   - Raw hex values are banned here — always var(--token).
   - Spacing utilities are named by PIXEL value (.mb-16) — unambiguous and
     greppable; the pixel steps 4/8/12/16/20/24 are the only allowed values.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Visibility ── */
.hidden { display: none; }

/* ── Flex rows (align-center by default — the dominant page pattern) ── */
.row { display: flex; align-items: center; gap: 8px; }
.row-10 { gap: 10px; }
.row-12 { gap: 12px; }
.row-16 { gap: 16px; }
.row-top { align-items: flex-start; }
.row-wrap { flex-wrap: wrap; }
.row-inline { display: inline-flex; align-items: center; gap: 8px; }
.row-between { justify-content: space-between; }
.grow { flex: 1; }
.no-shrink { flex-shrink: 0; }

/* ── Spacing (pixel-named; steps 4/8/12/16/20/24 only) ── */
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-6 { margin-bottom: 6px; }
.mb-16 { margin-bottom: 16px; }
.mb-18 { margin-bottom: 18px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mr-8 { margin-right: 8px; }
.ml-8 { margin-left: 8px; }
.p-0 { padding: 0; }

/* ── Width ── */
.w-0 { width: 0; }
.w-full { width: 100%; }
.w-150 { width: 150px; }
.mw-380 { max-width: 380px; }
.mw-520 { max-width: 520px; }
.mw-720 { max-width: 720px; }
.mw-820 { max-width: 820px; }

/* ── Text ── */
.mono { font-family: var(--mono); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.emoji-lg { font-size: 20px; }
.text-xs { font-size: 11px; }
.text-md { font-size: 13px; }
.strong-sm { font-weight: 600; font-size: 13px; }
.fw-normal { font-weight: 400; }
.center { text-align: center; }
.pointer { cursor: pointer; }
.uppercase { text-transform: uppercase; }

/* ── Card anatomy (compose with .card / .card-title from style.css) ── */
/* Title directly followed by a description hugs it. */
.card-title.tight { margin-bottom: 4px; }
/* The muted intro paragraph under a card title. */
.card-desc { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
.card-desc a { color: var(--accent); }
/* A smaller bold sub-heading inside a card body. */
.card-subtitle { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
/* Muted intro paragraph inside a modal (resets the browser <p> margins). */
.modal-text { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; }
/* Vertical page of stacked cards (replaces per-card margin-bottom chains). */
.card-stack > * + * { margin-top: 24px; }

/* ── Form extras ── */
/* A label sitting inline in a .row (fixed rail width, no block spacing). */
.label-inline { width: 160px; margin-bottom: 0; flex-shrink: 0; }
/* Read-only mono value box (e.g. masked API-key hint). */
.hint-box {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 4px;
}
/* Checkbox grid (states/channels pickers). */
.grid-fill {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Identity ── */
.avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-name { font-size: 15px; font-weight: 600; }

/* ── Alert banners (card with a 3px accent rail; JS toggles display inline) ── */
.banner-warn { border-left: 3px solid var(--warning); }
.banner-danger { border-left: 3px solid var(--danger); }

/* ── Misc ── */
.spinner-sm { width: 12px; height: 12px; }

/* ── Feature section index (the read-only page map, top of each feature page) ── */
.section-index { margin-bottom: 16px; font-size: 12px; color: var(--text-dim); }
.section-index > summary { cursor: pointer; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); list-style: none; user-select: none; }
.section-index .si-note { opacity: 0.5; font-weight: 400; }
.section-index ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.section-index li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.si-num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.si-title { font-weight: 600; color: var(--text); }
.si-after { color: var(--warning); font-weight: 500; font-size: 11px; }
.si-sub { color: var(--text-dim); }
.si-dot { opacity: 0.4; }

/* ── Gated states (shared deny renderer, ui-states.js — Step 6.3) ── */
.gated-state { text-align: center; padding: 32px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-width: 480px; margin: 24px auto; box-shadow: var(--shadow); }
.gated-icon { font-size: 34px; margin-bottom: 10px; }
.gated-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.gated-detail { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }
.gated-steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; align-items: center; }
.gated-step { font-size: 13px; color: var(--accent); text-decoration: none; }
.gated-step:hover { text-decoration: underline; }
.gated-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* accent rail by severity */
.gated-not_in_plan, .gated-billing_locked, .gated-billing_read_only { border-left: 3px solid var(--danger); }
.gated-limit_reached, .gated-cooldown_active, .gated-too_large, .gated-onboarding_incomplete { border-left: 3px solid var(--warning); }

/* ── Impersonation banner (admin shell, Step 4.6) ── */
.imp-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: var(--warning); color: var(--text); display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; font-size: 13px; font-weight: 600; }
.imp-banner-btn { background: var(--text); color: var(--surface); border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ── Shell (Step 6.5) ── */
.lock-card { max-width: 520px; margin: 48px auto; text-align: center; }
.billing-banner {
  background: var(--warning); color: var(--text); font-size: 13px; font-weight: 500;
  padding: 8px 20px; text-align: center;
}
.billing-banner a { color: var(--text); text-decoration: underline; font-weight: 600; }

/* ── States ── */
.empty-state { text-align: center; padding: 40px; color: var(--text-dim); }
