/**
 * MIZAN - Stylesheet
 * ==================
 * Fintech-inspired design with emerald/slate color palette.
 * Mobile-first, accessible, and WordPress-compatible.
 * 
 * @version 1.0.0
 */

/* ─────────────────────────────────────────────────────────────
   CSS VARIABLES
   ───────────────────────────────────────────────────────────── */
:root {
  /* Primary Colors - Emerald */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-900: #064e3b;

  /* Neutral Colors - Slate */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semantic Colors */
  --color-primary: var(--emerald-800);
  --color-primary-light: var(--emerald-700);
  --color-primary-dark: var(--emerald-900);
  --color-accent: var(--emerald-700);
  --color-text: var(--slate-800);
  --color-text-light: var(--slate-600);
  --color-text-muted: var(--slate-500);
  --color-bg: var(--slate-50);
  --color-bg-white: #ffffff;
  --color-border: var(--slate-200);
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-success: var(--emerald-500);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Libre Baskerville', 'Charter', Georgia, serif;
  --font-arabic: 'Noto Sans Arabic', 'Amiri', serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-card: 0 1px 3px rgba(15,23,42,0.06), 0 4px 20px rgba(15,23,42,0.05);
  --shadow-card-hover: 0 2px 6px rgba(15,23,42,0.08), 0 8px 28px rgba(15,23,42,0.08);

  /* Display / Serif font (Libre Baskerville — already loaded for PDF) */
  --font-display: 'Libre Baskerville', 'Charter', Georgia, serif;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ─────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

.mizan-app, #mizan-app, #app {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mizan-app *, #mizan-app * {
  margin: 0;
  padding: 0;
}

/* NOTE: #app * intentionally excluded — its high specificity (1,0,0) would
   override all class-based padding rules (0,1,0) throughout the stylesheet */

/* Focus canvas — centers the work at a comfortable reading width */
.focus-canvas {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ─────────────────────────────────────────────────────────────
   ANIMATIONS
   ───────────────────────────────────────────────────────────── */
@keyframes toastSlideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes toastSlideDown {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, 100%); opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ─────────────────────────────────────────────────────────────
   HEADER
   ───────────────────────────────────────────────────────────── */
/* 3-zone header: brand | cmd-k trigger | nav */
.mizan-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 var(--space-6);
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-shadow: 0 1px 0 rgba(15,23,42,0.07);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-700) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}

.brand-text h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 0.6875rem;
  color: var(--slate-400);
  letter-spacing: 0.01em;
  display: block;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .brand-text span { display: none; }
}

/* Centre zone — Cmd+K trigger pill */
.header-center {
  display: flex;
  justify-content: center;
}

.cmd-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--slate-50);
  border: none;
  box-shadow: 0 0 0 1px var(--slate-200), 0 1px 3px rgba(15,23,42,0.05);
  border-radius: var(--radius-full);
  color: var(--slate-400);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  cursor: pointer;
  width: 200px;
  transition: all var(--transition-fast);
}

.cmd-trigger:hover {
  background: var(--color-bg-white);
  color: var(--slate-600);
  box-shadow: 0 0 0 1px var(--slate-300), 0 2px 6px rgba(15,23,42,0.08);
}

.cmd-trigger svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.cmd-trigger kbd {
  margin-left: auto;
  font-size: 0.625rem;
  font-family: var(--font-sans);
  background: var(--slate-100);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--slate-400);
  border: 1px solid var(--slate-200);
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.nav-link {
  background: none;
  border: none;
  color: var(--slate-500);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}

.nav-link:hover {
  color: var(--slate-900);
  background: var(--slate-100);
}

.nav-link--reset {
  color: var(--slate-400);
  font-size: 0.75rem;
  font-weight: 400;
}

.nav-link--reset:hover {
  color: var(--color-error);
  background: #fff1f2;
}

/* ─────────────────────────────────────────────────────────────
   COMMAND PALETTE
   ───────────────────────────────────────────────────────────── */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  animation: fadeIn 150ms ease;
}

.cmd-palette {
  position: fixed;
  top: 15vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  background: var(--color-bg-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 9001;
  animation: slideUp 150ms ease;
}

.cmd-search-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  box-shadow: 0 1px 0 rgba(15,23,42,0.05);
}

.cmd-search-row svg {
  flex-shrink: 0;
  color: var(--slate-400);
}

.cmd-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
}

.cmd-input::placeholder {
  color: var(--slate-400);
}

.cmd-results {
  max-height: 320px;
  overflow-y: auto;
  padding-bottom: var(--space-2);
}

.cmd-results:empty::after {
  content: 'No results';
  display: block;
  padding: var(--space-6);
  text-align: center;
  color: var(--slate-400);
  font-size: 0.875rem;
}

.cmd-section-label {
  padding: var(--space-3) var(--space-5) var(--space-1);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text);
  transition: background var(--transition-fast);
}

.cmd-item:hover,
.cmd-item.active {
  background: var(--slate-50);
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.cmd-item-label {
  flex: 1;
}

.cmd-item-hint {
  font-size: 0.75rem;
  color: var(--slate-400);
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--color-text);
  box-shadow: 0 0 0 1px var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-200);
  box-shadow: 0 0 0 1px var(--slate-300);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slate-100);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--color-text-light);
}

.btn-icon:hover {
  background: var(--slate-200);
  color: var(--color-error);
}

/* Ghost button — borderless, text-only */
.btn-ghost {
  background: transparent;
  color: var(--slate-600);
  border: none;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}
.btn-ghost:hover {
  color: var(--slate-900);
  text-decoration-color: var(--slate-300);
  background: transparent;
  transform: none;
  box-shadow: none;
}

/* ─────────────────────────────────────────────────────────────
   SEGMENTED CONTROL
   ───────────────────────────────────────────────────────────── */
.segmented-control {
  display: inline-flex;
  background: var(--slate-100);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}
.segmented-control--full {
  display: flex;
  width: 100%;
}
.seg-option {
  flex: 1;
  padding: 7px 18px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--slate-600);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-align: center;
  font-family: var(--font-sans);
}
.seg-option:hover { color: var(--slate-800); }
.seg-option.active {
  background: #fff;
  color: var(--slate-900);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15,23,42,0.12);
}

/* ─────────────────────────────────────────────────────────────
   COUNTER CONTROL
   ───────────────────────────────────────────────────────────── */
.counter-control {
  display: inline-flex;
  align-items: center;
  background: var(--emerald-700);
  border-radius: var(--radius-full);
  overflow: hidden;
  gap: 0;
}
.counter-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  line-height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-user-select: none;
}
.counter-btn:hover { background: rgba(255,255,255,0.18); }
.counter-value {
  min-width: 24px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   HERO SECTION
   ───────────────────────────────────────────────────────────── */
.mizan-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 72px 24px 64px;
  max-width: 600px;
  margin: 0 auto;
}

/* hero-visual (example calculation preview) stays hidden — clean single-col */
.hero-visual { display: none; }

.hero-content {
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
  box-shadow: 0 0 0 1px var(--emerald-200);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--slate-900);
  margin-bottom: 16px;
  letter-spacing: -0.025em;
  font-family: var(--font-display);
}

@media (min-width: 600px) {
  .hero-title { font-size: 3rem; }
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--slate-500);
  margin-bottom: 36px;
  line-height: 1.7;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
}

/* trust items row below CTAs */
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--slate-400);
}

.trust-icon {
  font-size: 0.875rem;
}

.calculation-preview {
  background: var(--color-bg-white);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
}

.preview-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  font-size: 0.875rem;
}

.preview-row + .preview-row {
  box-shadow: 0 -1px 0 rgba(15,23,42,0.05);
}

.preview-row .highlight {
  color: var(--color-primary);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────
   GUIDED CALCULATOR
   ───────────────────────────────────────────────────────────── */
.guided-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.step-progress {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--slate-200);
  transition: all var(--transition-base);
}

.progress-dot.active {
  background: var(--color-primary);
  transform: scale(1.2);
}

.progress-dot.completed {
  background: var(--emerald-400);
}

.step-card {
  background: var(--color-bg-white);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 8px 32px rgba(15,23,42,0.08);
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.step-question {
  font-size: 0.9375rem;
  color: var(--slate-500);
  margin-bottom: 24px;
  line-height: 1.6;
}

.step-hint {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.step-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-8);
}

/* ─────────────────────────────────────────────────────────────
   GENDER SELECTION
   ───────────────────────────────────────────────────────────── */
.gender-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.gender-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--slate-50);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 0 0 1.5px var(--slate-200);
  min-height: 96px;
  text-align: center;
}

.gender-card:hover {
  background: var(--color-bg-white);
  box-shadow: 0 0 0 1.5px var(--slate-300), 0 4px 16px rgba(15,23,42,0.07);
  transform: translateY(-1px);
}

.gender-card.active {
  background: var(--emerald-50);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.gender-icon {
  font-size: 2rem;
  line-height: 1;
}

.gender-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--slate-800);
  line-height: 1;
}

/* ─────────────────────────────────────────────────────────────
   MADHHAB SELECTION — Card Grid
   ───────────────────────────────────────────────────────────── */
.madhhab-section {
  margin-top: 24px;
}

.madhhab-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 520px) {
  .madhhab-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.madhhab-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 14px;
  background: var(--slate-50);
  border: none;
  border-radius: 12px;
  box-shadow: 0 0 0 1.5px var(--slate-200);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-family: var(--font-sans);
}

.madhhab-card:hover {
  background: var(--color-bg-white);
  box-shadow: 0 0 0 1.5px var(--slate-300), 0 3px 10px rgba(15,23,42,0.07);
}

.madhhab-card.active {
  background: var(--emerald-50);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.madhhab-card-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1.2;
}

.madhhab-card.active .madhhab-card-name {
  color: var(--color-primary);
}

.madhhab-card-desc {
  display: block;
  font-size: 0.6875rem;
  color: var(--slate-500);
  line-height: 1.4;
}

.madhhab-card.active .madhhab-card-desc {
  color: var(--emerald-700);
}

.madhhab-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

.mizan-main {
  background: var(--slate-50);
  min-height: calc(100vh - 60px);
}

.section-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-light);
  margin-bottom: var(--space-3);
}

.section-hint {
  margin-top: var(--space-2);
  font-size: 0.8125rem;
  color: var(--slate-500);
  min-height: 1.2em;
  transition: opacity var(--transition-fast);
}

.madhhab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* .madhhab-chip is now rendered inside .segmented-control as .seg-option.madhhab-chip */
/* Legacy fallback styles kept minimal */
.madhhab-chip {
  padding: var(--space-3) var(--space-5);
  background: var(--slate-100);
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.madhhab-chip:hover {
  background: var(--slate-200);
}

.madhhab-chip.active {
  background: var(--color-primary);
  color: white;
}

/* ─────────────────────────────────────────────────────────────
   FORM ELEMENTS
   ───────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-light);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--color-bg-white);
  box-shadow: 0 0 0 1px var(--slate-200);
  transition: box-shadow var(--transition-fast);
  font-family: var(--font-sans);
}

.form-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 4px var(--emerald-100);
}

.input-prefix {
  display: flex;
  align-items: center;
  box-shadow: 0 0 0 1px var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.input-prefix:focus-within {
  box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 4px var(--emerald-100);
}

.input-prefix .prefix {
  padding: var(--space-3) var(--space-4);
  background: var(--slate-50);
  color: var(--color-text-muted);
  font-weight: 500;
  border-right: none;
  box-shadow: 1px 0 0 var(--slate-200);
}

.input-prefix .form-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.input-prefix .form-input:focus {
  outline: none;
  box-shadow: none;
}

/* ─────────────────────────────────────────────────────────────
   ESTATE INPUTS
   ───────────────────────────────────────────────────────────── */
.estate-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.net-estate-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--emerald-50);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
}

.net-estate-preview span:first-child {
  font-weight: 500;
  color: var(--color-text-light);
}

.net-amount {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-primary);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────────────────────
   HEIR SELECTION
   ───────────────────────────────────────────────────────────── */
.heirs-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.heir-group {
  padding-bottom: var(--space-6);
  box-shadow: 0 1px 0 rgba(15,23,42,0.05);
}

.heir-group:last-child {
  box-shadow: none;
}

.group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.heir-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.heir-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--slate-100);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.heir-chip:hover:not(.blocked) {
  background: var(--slate-200);
}

.heir-chip.active {
  background: var(--color-primary);
  color: white;
}

.heir-chip.blocked {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--slate-100);
}

.chip-emoji {
  font-size: 1.25rem;
}

.chip-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.chip-count {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--color-primary-dark);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blocked-notice {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--slate-100);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ─────────────────────────────────────────────────────────────
   WASIYYAH SECTION
   ───────────────────────────────────────────────────────────── */
.wasiyyah-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.wasiyyah-intro {
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.wasiyyah-budget {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--slate-50);
  border-radius: var(--radius-lg);
}

.budget-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.budget-item.remaining {
  padding-top: var(--space-3);
  box-shadow: 0 -1px 0 rgba(15,23,42,0.06);
  font-weight: 600;
}

.budget-item.remaining span:last-child {
  color: var(--color-primary);
}

.wasiyyah-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wasiyyah-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: var(--space-3);
  align-items: center;
}

.wasiyyah-item input {
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: 0 0 0 1px var(--slate-200);
  background: var(--color-bg-white);
  font-family: var(--font-sans);
  transition: box-shadow var(--transition-fast);
}

.wasiyyah-item input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}

.conflict-warning {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--color-warning);
  background: #fffbeb;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
}

/* ─────────────────────────────────────────────────────────────
   RESULTS
   ───────────────────────────────────────────────────────────── */
.adjustment-banner {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  font-weight: 500;
  text-align: center;
}

.adjustment-banner.awl {
  background: #fffbeb;
  color: var(--color-warning);
  box-shadow: 0 0 0 1px #fcd34d;
}

.adjustment-banner.radd {
  background: var(--emerald-50);
  color: var(--emerald-700);
  box-shadow: 0 0 0 1px var(--emerald-200);
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-10);
}

.summary-card {
  background: var(--slate-50);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  text-align: center;
}

.summary-card.primary {
  background: var(--emerald-50);
}

.summary-card .card-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.summary-card .card-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-800);
}

.summary-card.primary .card-value {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.results-table-container {
  overflow-x: auto;
  margin-bottom: var(--space-8);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.results-table th {
  background: var(--slate-800);
  color: white;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
}

.results-table td {
  padding: var(--space-4) var(--space-4);
  box-shadow: 0 1px 0 rgba(15,23,42,0.04);
}

.results-table tr:nth-child(even) {
  background: var(--slate-50);
}

.heir-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.heir-emoji {
  font-size: 1.25rem;
}

.heir-name {
  font-weight: 500;
}

.heir-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.amount-cell {
  font-weight: 700;
  text-align: right;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}

/* Generic serif amount — reusable across result panels */
.result-amount {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* Simple Explanation */
.simple-explanation-toggle {
  margin-bottom: var(--space-6);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.toggle-label input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--slate-300);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-fast);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
}

.toggle-label input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

.simple-explanation {
  background: var(--emerald-50);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-8);
}

.simple-explanation h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--emerald-800);
}

.simple-explanation ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.simple-explanation li {
  font-size: 0.875rem;
  color: var(--color-text);
}

/* Evidence Panel */
.evidence-panel {
  background: var(--slate-50);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.evidence-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--slate-800);
}

.evidence-item {
  padding: var(--space-4);
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.evidence-item:last-child {
  margin-bottom: 0;
}

.evidence-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.evidence-share {
  font-weight: 600;
  color: var(--color-primary);
}

.evidence-reason {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: var(--space-1);
}

.evidence-ref {
  font-size: 0.75rem;
  color: var(--color-primary);
}

/* Results Actions */
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ─────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────── */
.mizan-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: var(--space-6);
  backdrop-filter: blur(4px);
}

.mizan-modal {
  background: var(--color-bg-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--slate-800);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
}

/* ─────────────────────────────────────────────────────────────
   AUTH MODAL
   ───────────────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-intro {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: var(--space-1);
}

/* Google OAuth button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: #fff;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--slate-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-google:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
  box-shadow: var(--shadow-md);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  margin: var(--space-1) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Method toggle — Magic link / 6-digit code */
.auth-method-toggle {
  display: flex;
  gap: var(--space-2);
  background: var(--slate-100);
  border-radius: var(--radius-lg);
  padding: 3px;
}

.auth-method-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-sans);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-lg) - 2px);
  color: var(--slate-500);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-method-btn.active {
  background: #fff;
  color: var(--slate-800);
  box-shadow: var(--shadow-sm);
}

.auth-method-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: calc(-1 * var(--space-2));
}

/* "Check inbox" / "Enter code" confirmation screens */
.auth-sent-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: var(--space-2);
}

.auth-sent-title {
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
  color: var(--slate-800);
  margin-bottom: var(--space-2);
}

.auth-sent-body {
  font-size: 0.9375rem;
  color: var(--slate-600);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.auth-sent-note {
  font-size: 0.8125rem;
  color: var(--slate-400);
  text-align: center;
}

.auth-text-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: inherit;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.auth-error {
  font-size: 0.8125rem;
  color: var(--color-error);
  text-align: center;
  padding: var(--space-2) var(--space-3);
  background: #fef2f2;
  border-radius: var(--radius-md);
}

/* OTP 6-digit input row */
.otp-input-row {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin: var(--space-2) 0;
}

.otp-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--slate-800);
  caret-color: var(--color-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.otp-digit:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.12);
}

.otp-digit:not(:placeholder-shown) {
  border-color: var(--slate-400);
}

@media (max-width: 400px) {
  .otp-digit {
    width: 40px;
    height: 48px;
    font-size: 1.25rem;
  }
}

/* Paywall Modal */
.paywall-content {
  text-align: center;
}

.paywall-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

.paywall-text {
  font-size: 1rem;
  color: var(--color-text-light);
  margin-bottom: var(--space-6);
}

.paywall-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.paywall-features {
  list-style: none;
  text-align: left;
  background: var(--slate-50);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.paywall-features li {
  padding: var(--space-2) 0;
  font-size: 0.875rem;
}

.paywall-note {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

/* ─────────────────────────────────────────────────────────────
   TRUST LAYER
   ───────────────────────────────────────────────────────────── */
.trust-layer {
  background: var(--color-bg-white);
  border-top: 1px solid var(--slate-100);
  padding: var(--space-16) var(--space-5);
}

.trust-inner {
  max-width: 600px;
  margin: 0 auto;
}

.trust-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--slate-900);
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.trust-intro {
  font-size: 0.9375rem;
  color: var(--slate-500);
  line-height: 1.75;
  margin-bottom: var(--space-10);
}

.trust-grid {
  display: grid;
  gap: 0;
  margin-bottom: var(--space-6);
}

.trust-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--slate-100);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
}

.trust-card:last-child {
  border-bottom: 1px solid var(--slate-100);
}

.trust-icon {
  font-size: 1.375rem;
  width: 36px;
  flex-shrink: 0;
  padding-top: 3px;
  text-align: center;
}

.trust-card-body {
  flex: 1;
}

.trust-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--slate-800);
}

.trust-card p {
  font-size: 0.875rem;
  color: var(--slate-500);
  line-height: 1.7;
}

.trust-scholarly {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--emerald-50), #f0fdf4);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 0 1px var(--emerald-100);
  margin-top: var(--space-2);
}

.trust-scholarly-icon {
  font-size: 1.375rem;
  width: 36px;
  flex-shrink: 0;
  padding-top: 3px;
  text-align: center;
}

.trust-scholarly h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--emerald-800);
  margin-bottom: var(--space-2);
}

.trust-scholarly p {
  font-size: 0.8125rem;
  color: var(--emerald-700);
  line-height: 1.7;
}

/* ─────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────── */
.mizan-footer {
  background: var(--slate-50);
  border-top: 1px solid var(--slate-100);
  padding: var(--space-12) var(--space-5) var(--space-8);
}

.footer-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer-brand-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-700) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.footer-tagline {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--slate-700);
  letter-spacing: -0.01em;
}

.footer-divider {
  width: 32px;
  height: 2px;
  background: var(--emerald-200);
  border-radius: 2px;
}

.footer-desc {
  font-size: 0.8125rem;
  color: var(--slate-500);
  line-height: 1.6;
}

.footer-legal {
  font-size: 0.75rem;
  color: var(--slate-400);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────────────────────── */
.mizan-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  animation: toastSlideUp 0.3s ease-out;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   WORDPRESS COMPATIBILITY
   ───────────────────────────────────────────────────────────── */
.mizan-wordpress-widget {
  all: initial;
  font-family: var(--font-sans);
}

.mizan-wordpress-widget * {
  all: revert;
  box-sizing: border-box;
}

/* Ensure styles override common WordPress theme styles */
.mizan-app h1, .mizan-app h2, .mizan-app h3, .mizan-app h4,
#mizan-app h1, #mizan-app h2, #mizan-app h3, #mizan-app h4 {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.mizan-app p, #mizan-app p {
  margin: 0;
  padding: 0;
}

.mizan-app button, #mizan-app button {
  border: none;
  background: none;
  cursor: pointer;
}

.mizan-app input, #mizan-app input {
  border: 1px solid var(--color-border);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mizan-header {
    padding: var(--space-3) var(--space-4);
  }

  .brand-text span {
    display: none;
  }

  .header-nav .nav-link {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .step-card {
    padding: var(--space-5);
  }

  .results-summary {
    grid-template-columns: 1fr;
  }

  .results-table th:nth-child(2),
  .results-table td:nth-child(2) {
    display: none;
  }

  .wasiyyah-item {
    grid-template-columns: 1fr;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────
   ACCESSIBILITY
   ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
.btn:focus-visible,
.form-input:focus-visible,
.heir-chip:focus-visible,
.madhhab-chip:focus-visible,
.gender-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000;
    --color-text-light: #000;
  }
}

/* Print styles */
@media print {
  .mizan-header,
  .mizan-footer,
  .step-navigation,
  .results-actions {
    display: none !important;
  }

  .step-card {
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* ═════════════════════════════════════════════════════════════
   MIZAN PRO V2 - ADDITIONAL STYLES
   Expert Mode, Validation Panel, Case Library
   ═════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   EXPERT MODE
   ───────────────────────────────────────────────────────────── */

.mizan-expert-mode {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.mizan-expert-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.mizan-expert-section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
}

.mizan-expert-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-md);
}

.mizan-heirs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.mizan-heir-input {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.mizan-heir-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.mizan-expert-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  padding-top: var(--spacing-lg);
}

/* ─────────────────────────────────────────────────────────────
   CASE LIBRARY
   ───────────────────────────────────────────────────────────── */

.mizan-library {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.mizan-library-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.mizan-library-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-sm);
}

.mizan-library-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
}

.mizan-library-search {
  max-width: 500px;
  margin: 0 auto var(--spacing-lg);
}

.mizan-library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-bottom: var(--spacing-lg);
}

.mizan-filter-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.mizan-filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.mizan-filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.mizan-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.mizan-case-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.mizan-case-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mizan-case-category {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-sm);
}

.mizan-case-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
}

.mizan-case-arabic {
  font-family: 'Noto Sans Arabic', serif;
  font-size: var(--font-size-base);
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

.mizan-case-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
}

.mizan-case-meta {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.mizan-case-madhhab,
.mizan-case-deceased {
  font-size: var(--font-size-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-background);
  border-radius: var(--radius-sm);
  color: var(--color-text-light);
}

/* ─────────────────────────────────────────────────────────────
   VALIDATION PANEL
   ───────────────────────────────────────────────────────────── */

.mizan-validation-section {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.mizan-validation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.mizan-validation-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
}

.mizan-validation-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.mizan-validation-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.mizan-stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
}

.mizan-stat-card.mizan-stat-success {
  border-color: var(--color-success);
}

.mizan-stat-card.mizan-stat-error {
  border-color: var(--color-error);
}

.mizan-stat-value {
  display: block;
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
}

.mizan-stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mizan-validation-results {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  max-height: 500px;
  overflow-y: auto;
}

.mizan-test-result {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-xs);
}

.mizan-test-result.mizan-test-passed {
  background: rgba(16, 185, 129, 0.1);
}

.mizan-test-result.mizan-test-failed {
  background: rgba(239, 68, 68, 0.1);
}

.mizan-test-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
}

.mizan-test-passed .mizan-test-icon {
  background: var(--color-success);
  color: white;
}

.mizan-test-failed .mizan-test-icon {
  background: var(--color-error);
  color: white;
}

.mizan-test-name {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.mizan-test-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
}

/* ─────────────────────────────────────────────────────────────
   ADDITIONAL UTILITY CLASSES
   ───────────────────────────────────────────────────────────── */

.mizan-btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-sm);
}

.mizan-btn-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: var(--font-size-lg);
}

.mizan-btn-danger {
  background: var(--color-error);
  color: white;
}

.mizan-btn-danger:hover {
  background: #dc2626;
}

.mizan-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.mizan-radio-group {
  display: flex;
  gap: var(--spacing-md);
}

.mizan-radio {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.mizan-radio input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}

.mizan-checkbox {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.mizan-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}

.mizan-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-light);
}

.mizan-loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-light);
}

/* ─────────────────────────────────────────────────────────────
   MY CASES VIEW
   ───────────────────────────────────────────────────────────── */

.mizan-cases-view {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.mizan-cases-view h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-lg);
}

.mizan-cases-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.mizan-case-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.mizan-case-name {
  flex: 1;
  font-weight: 500;
  color: var(--color-text);
}

.mizan-case-date {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

/* ─────────────────────────────────────────────────────────────
   MODE TOGGLE
   ───────────────────────────────────────────────────────────── */

.mizan-mode-toggle {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-sm);
  background: var(--color-background);
  border-radius: var(--radius-full);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.mizan-mode-btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-light);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.mizan-mode-btn:hover {
  color: var(--color-text);
}

.mizan-mode-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* ─────────────────────────────────────────────────────────────
   PAYWALL MODAL
   ───────────────────────────────────────────────────────────── */

.mizan-paywall-modal .mizan-modal-content {
  max-width: 450px;
  text-align: center;
}

.mizan-paywall-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
}

.mizan-paywall-content h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-sm);
}

.mizan-paywall-price {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
}

.mizan-paywall-price span {
  font-size: var(--font-size-base);
  font-weight: 400;
  color: var(--color-text-light);
}

.mizan-paywall-features {
  list-style: none;
  padding: 0;
  margin: var(--spacing-lg) 0;
  text-align: left;
}

.mizan-paywall-features li {
  padding: var(--spacing-sm) 0;
  color: var(--color-text);
}

.mizan-paywall-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-top: var(--spacing-md);
}

/* =============================================================
   PIPELINE STATUS BAR
   Visible on the results step. Shows Saved → Paid → Download.
   BEM class names must match renderPipelineStatus() in app.js.
   ============================================================= */

.pipeline-status {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 24px;
  padding: 16px;
  background: var(--slate-50);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 13px;
}

/* Each step bubble */
.pipeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  color: var(--color-text-muted);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

/* Connector line between steps */
.pipeline-connector {
  width: 32px;
  height: 2px;
  flex-shrink: 0;
  background: var(--color-border);
  transition: background 0.3s;
}

.pipeline-connector--done {
  background: var(--color-primary);
}

/* Step icon circle */
.pipeline-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  background: var(--slate-200);
  color: var(--slate-500);
  transition: background 0.2s, color 0.2s;
}

.pipeline-label {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 12px;
}

.pipeline-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.3;
}

/* Active step — next action required */
.pipeline-step--active .pipeline-icon {
  background: var(--slate-800);
  color: #fff;
}

.pipeline-step--active .pipeline-label {
  color: var(--color-text);
  font-weight: 600;
}

.pipeline-step--active .pipeline-hint {
  color: var(--color-text-light);
}

/* Done step — completed */
.pipeline-step--done .pipeline-icon {
  background: var(--color-primary);
  color: #fff;
}

.pipeline-step--done .pipeline-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* Ready to download */
.pipeline-step--ready .pipeline-icon {
  background: var(--color-primary);
  color: #fff;
  animation: pipeline-pulse 1.8s ease-in-out infinite;
}

.pipeline-step--ready .pipeline-label {
  color: var(--color-primary);
  font-weight: 700;
}

.pipeline-step--ready .pipeline-hint {
  color: var(--color-primary);
  font-weight: 500;
}

@keyframes pipeline-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
}

/* Mobile: stack hints below labels cleanly */
@media (max-width: 480px) {
  .pipeline-status {
    padding: 12px 8px;
  }

  .pipeline-connector {
    width: 16px;
  }

  .pipeline-hint {
    display: none; /* hide hints on very small screens — icons tell the story */
  }
}

/* =============================================================
   PIPELINE CONFIRMATION MODAL
   Used in place of toast + paywall for decision-point messages.
   ============================================================= */

.pipeline-modal-body {
  padding: 4px 0 8px;
}

.pipeline-modal-message {
  font-size: 15px;
  color: var(--color-text-light);
  line-height: 1.6;
  margin-bottom: 24px;
}

.pipeline-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pipeline-modal-confirm {
  width: 100%;
}

.pipeline-modal-cancel {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}

.pipeline-modal-cancel:hover {
  color: var(--color-text);
}

/* Ghost button variant (used for Cancel) */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--color-text);
}

/* (trust layer styles — defined above) */

/* =============================================================
   LEGAL ACKNOWLEDGEMENT MODAL
   ============================================================= */

.legal-ack-body {
  padding: 4px 0;
}

.legal-ack-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.legal-ack-intro {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 16px;
  line-height: 1.6;
}

.legal-ack-list {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.legal-ack-list li {
  padding: 8px 0 8px 20px;
  position: relative;
  font-size: 13.5px;
  color: var(--color-text-light);
  line-height: 1.5;
  border-bottom: 1px solid var(--slate-100);
}

.legal-ack-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

.legal-ack-list li:last-child {
  border-bottom: none;
}

.legal-ack-checkbox {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--slate-50);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--color-text);
  line-height: 1.5;
}

.legal-ack-checkbox input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* =============================================================
   PAYWALL REDESIGN
   ============================================================= */

.paywall-what-you-get {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 14px;
}

.paywall-features-list {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.paywall-features-list li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13.5px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.paywall-features-list li:last-child {
  border-bottom: none;
}

.paywall-feature-icon {
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.paywall-price-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 20px 0 16px;
}

.paywall-price-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary);
}

.paywall-price-note {
  font-size: 13px;
  color: var(--color-text-muted);
}

.paywall-legal-note {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 12px;
  line-height: 1.5;
  text-align: center;
}

.paywall-secure-note {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 6px;
}

/* =============================================================
   PAYWALL — DELIVERY PROMISE LINE
   ============================================================= */

.paywall-delivery-promise {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.paywall-delivery-promise::before {
  content: '✓';
  font-weight: 800;
}

/* =============================================================
   EXPLAINABILITY LAYER — Reasoning & Verification Panel
   ============================================================= */

.explainability-panel {
  margin-top: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-radius: 12px;
  overflow: hidden;
}

.explainability-header {
  padding: 16px 20px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--color-border);
}

.explainability-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.explainability-intro {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Each heir — collapsible details/summary */
.reasoning-item {
  border-bottom: 1px solid var(--color-border);
}

.reasoning-item:last-of-type {
  border-bottom: none;
}

.reasoning-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}

.reasoning-summary::-webkit-details-marker { display: none; }

.reasoning-summary:hover {
  background: var(--slate-50);
}

.reasoning-item[open] .reasoning-summary {
  background: var(--slate-50);
  border-bottom: 1px solid var(--color-border);
}

.reasoning-summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reasoning-emoji {
  font-size: 18px;
}

.reasoning-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.reasoning-summary-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reasoning-share {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}

.reasoning-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.reasoning-chevron {
  font-size: 18px;
  color: var(--color-text-muted);
  transition: transform 0.2s;
  display: inline-block;
}

.reasoning-item[open] .reasoning-chevron {
  transform: rotate(90deg);
}

/* Expanded body */
.reasoning-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
}

.reasoning-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.reasoning-why p,
.reasoning-counterfactual p,
.reasoning-source p {
  font-size: 13.5px;
  color: var(--color-text-light);
  line-height: 1.6;
}

.reasoning-adjustment {
  background: var(--emerald-50);
  border-left: 3px solid var(--color-primary);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
}

.reasoning-adjustment--radd {
  background: #eff6ff;
  border-left-color: #3b82f6;
}

.reasoning-adjustment p {
  font-size: 13px;
  color: var(--color-text-light);
  line-height: 1.6;
}

.reasoning-counterfactual {
  background: var(--slate-50);
  border-radius: 6px;
  padding: 10px 12px;
}

.reasoning-reference {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--color-text-light);
}

/* Blocked heirs section */
.blocked-heirs-section {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--slate-50);
}

.blocked-heirs-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.blocked-heirs-intro {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.blocked-heir-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.blocked-heir-item:last-child { border-bottom: none; }

.blocked-heir-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.blocked-heir-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.blocked-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--slate-200);
  color: var(--slate-600);
  padding: 2px 8px;
  border-radius: 20px;
}

.blocked-reason {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.blocked-source {
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* Verification note */
.verification-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 20px;
  background: var(--emerald-50);
  border-top: 1px solid var(--emerald-200);
}

.verification-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }

.verification-note strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 3px;
}

.verification-note p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Mobile */
@media (max-width: 480px) {
  .reasoning-summary { padding: 12px 14px; }
  .reasoning-body { padding: 14px; }
  .reasoning-amount { display: none; }
}

/* =============================================================
   SHARE TYPE BADGE + DECISION PATH
   ============================================================= */

/* Share type badge — inline below heir name in summary */
.reasoning-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

.reasoning-type-badge--fard {
  background: var(--emerald-100);
  color: var(--emerald-800);
}

.reasoning-type-badge--asabah {
  background: var(--slate-100);
  color: var(--slate-700);
}

.reasoning-type-badge--fard_asabah {
  background: #eff6ff;
  color: #1d4ed8;
}

/* Share type detail block */
.reasoning-type-block {
  padding-bottom: 2px;
}

.reasoning-type-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reasoning-type-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text);
}

.reasoning-type-desc {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Decision path — ordered step list */
.reasoning-decision-path {
  background: var(--slate-50);
  border-radius: 8px;
  padding: 12px 14px;
}

.decision-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.decision-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.decision-step-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.decision-step--passed .decision-step-icon {
  background: var(--color-primary);
  color: #fff;
}

.decision-step--failed .decision-step-icon {
  background: var(--slate-300);
  color: var(--slate-600);
}

.decision-step-text {
  flex: 1;
}

/* Final step is the conclusion — make it stand out */
.decision-step:last-child .decision-step-text {
  font-weight: 600;
  color: var(--color-text);
}

.decision-step:last-child .decision-step-icon {
  background: var(--emerald-700);
}

/* =============================================================
   GOVERNANCE MODULE
   Blocked panel, gate warnings, transparency panel, risk badges
   ============================================================= */

/* ── Blocked panel ──────────────────────────────────────────── */
.governance-blocked-panel {
  text-align: center;
  padding: 32px 24px;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 12px;
  margin: 16px 0;
}

.blocked-icon { font-size: 40px; margin-bottom: 12px; }

.blocked-title {
  font-size: 17px;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 16px;
}

.blocked-reason {
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-align: left;
}

.blocked-message {
  font-size: 13.5px;
  color: #7f1d1d;
  line-height: 1.6;
  margin-bottom: 4px;
}

.blocked-source {
  font-size: 11.5px;
  color: #9ca3af;
}

.blocked-action {
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Gate alert banners ─────────────────────────────────────── */
.governance-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.governance-alert--warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.governance-alert--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.governance-alert--high {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: #7f1d1d;
}

.governance-alert--medium {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.governance-alert-icon { flex-shrink: 0; font-size: 14px; }

/* ── Governance notice (info, green) ────────────────────────── */
.governance-notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.governance-notice:last-child { border-bottom: none; }

.governance-notice-icon {
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Risk badge ─────────────────────────────────────────────── */
.risk-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
}

.risk-badge--low    { background: var(--emerald-100); color: var(--emerald-800); }
.risk-badge--medium { background: #fef3c7; color: #92400e; }
.risk-badge--high   { background: #fee2e2; color: #991b1b; }

/* ── Transparency panel ─────────────────────────────────────── */
.transparency-panel {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 28px;
}

.transparency-header {
  padding: 16px 20px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--color-border);
}

.transparency-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.transparency-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.transparency-summary {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.transparency-body { padding: 8px 0; }

.transparency-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}

.transparency-section:last-child { border-bottom: none; }

.transparency-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

/* Assumption list */
.assumption-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.assumption-list li {
  padding: 5px 0;
  font-size: 13px;
  color: var(--color-text-light);
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  gap: 8px;
}

.assumption-list li::before {
  content: '·';
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.assumption-list li:last-child { border-bottom: none; }

/* Calculation step list (scoped to avoid conflict with .step-progress .step-item) */
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}

.step-list .step-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0 8px 32px;
  border-bottom: 1px solid var(--slate-100);
  position: relative;
  counter-increment: step-counter;
}

.step-list .step-item::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 10px;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-list .step-item:last-child { border-bottom: none; }

.step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.step-detail {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Rules applied */
.rule-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--slate-100);
}

.rule-item:last-child { border-bottom: none; }

.rule-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.rule-detail {
  font-size: 12.5px;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* Disqualification items */
.disqualification-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-100);
}

.disqualification-item:last-child { border-bottom: none; }

.disqualification-heir {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 3px;
}

.disqualification-reason {
  font-size: 12.5px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.disqualification-source {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Footer */
.transparency-footer {
  padding: 14px 20px;
  background: var(--slate-50);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ═════════════════════════════════════════════════════════════
   REDESIGN OVERRIDES v2
   All rules here intentionally override earlier declarations.
   ═════════════════════════════════════════════════════════════ */

/* (hero compact overrides now consolidated in main hero block above) */

.btn-ghost {
  background: transparent;
  color: var(--color-text-light);
  border: 1px solid var(--slate-300);
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--color-text);
}

.preview-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin-bottom: var(--space-3);
}

.preview-neutral {
  color: var(--slate-600);
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   STEP PROGRESS — minimal pill-dot + connector
   ───────────────────────────────────────────────────────────── */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-10);
  padding: 0 var(--space-2);
  gap: 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--slate-200);
  margin-bottom: 14px; /* align with dot centre */
  min-width: 20px;
  max-width: 52px;
  transition: background var(--transition-base);
}

.step-connector.done {
  background: var(--emerald-300);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--slate-200);
  font-size: 0 !important;
  line-height: 0;
  overflow: hidden;
  transition: all var(--transition-base);
  flex-shrink: 0;
  color: transparent;
}

.step-item.active .step-dot {
  width: 24px;
  background: var(--color-primary);
  box-shadow: none;
}

.step-item.completed .step-dot {
  background: var(--emerald-400);
}

.step-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--slate-400);
  text-align: center;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.step-item.active .step-label {
  color: var(--slate-700);
  font-weight: 600;
}

.step-item.completed .step-label {
  color: var(--emerald-600);
}

/* ─────────────────────────────────────────────────────────────
   NAV BUTTON POLISH
   ───────────────────────────────────────────────────────────── */
.btn-nav {
  padding: var(--space-3) var(--space-6);
  font-size: 0.9rem;
  gap: var(--space-2);
}

.nav-arrow {
  display: inline-block;
  transition: transform var(--transition-fast);
}

#step-next:hover .nav-arrow { transform: translateX(3px); }
#step-prev:hover .nav-arrow { transform: translateX(-3px); }

/* ─────────────────────────────────────────────────────────────
   GENDER STEP — add check indicator
   ───────────────────────────────────────────────────────────── */
.gender-card {
  position: relative;
}

.gender-check {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─────────────────────────────────────────────────────────────
   MADHHAB — card layout instead of pills
   ───────────────────────────────────────────────────────────── */
.madhhab-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .madhhab-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.madhhab-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-4) var(--space-3);
  background: var(--slate-50);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.madhhab-card:hover {
  border-color: var(--slate-300);
  background: var(--slate-100);
}

.madhhab-card.active {
  border-color: var(--color-primary);
  background: var(--emerald-50);
}

.madhhab-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-800);
}

.madhhab-desc {
  font-size: 0.7rem;
  color: var(--slate-500);
  line-height: 1.4;
}

.madhhab-check {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─────────────────────────────────────────────────────────────
   HEIR SELECTION — full redesign
   ───────────────────────────────────────────────────────────── */

/* Usage hint at the top */
.heirs-usage-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--slate-500);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
}

.hint-dot {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Selected summary bar */
.heirs-selected-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-200);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald-700);
  white-space: nowrap;
}

.summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.summary-pill {
  font-size: 0.8rem;
  color: var(--emerald-800);
  background: var(--emerald-100);
  border-radius: var(--radius-full);
  padding: 2px var(--space-3);
  font-weight: 500;
}

/* Group header with icon */
.group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.group-icon {
  font-size: 1rem;
}

.group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
}

/* Group active state */
.heir-group--has-selection {
  border-left: 3px solid var(--emerald-400);
  padding-left: var(--space-3);
}

/* Heir chips — redesigned */
.heir-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-white);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-width: 140px;
  text-align: left;
}

.heir-chip:hover:not(.blocked) {
  border-color: var(--emerald-400);
  background: var(--emerald-50);
}

.heir-chip.active {
  background: var(--emerald-50);
  border-color: var(--color-primary);
  color: var(--emerald-900);
}

.heir-chip.blocked {
  opacity: 0.38;
  cursor: not-allowed;
  background: var(--slate-50);
  border-color: var(--slate-200);
}

.chip-emoji {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.chip-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heir-chip.active .chip-name {
  color: var(--emerald-800);
}

.chip-blocked-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Count badge — prominent, replaces the tiny corner circle */
.chip-count-badge {
  width: 26px;
  height: 26px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* "+" add icon on unselected chips */
.chip-add-icon {
  width: 22px;
  height: 22px;
  background: var(--slate-200);
  color: var(--slate-500);
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.heir-chip:hover:not(.blocked) .chip-add-icon {
  background: var(--emerald-200);
  color: var(--emerald-700);
}

/* Blocked notice — improved */
.blocked-notice {
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  font-size: 0.825rem;
  color: #92400e;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.blocked-notice-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.blocked-notice p {
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE TWEAKS FOR REDESIGNED HEIRS STEP
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .heir-chip {
    min-width: 0;
    flex: 1 1 calc(50% - var(--space-2));
  }

  .heir-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .madhhab-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 360px) {
  .heir-chip {
    flex: 1 1 100%;
  }
}

/* ─────────────────────────────────────────────────────────────
   STEP CARD — slightly less padding on mobile
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .step-card {
    padding: var(--space-5) var(--space-5);
  }

  .step-label {
    display: none;
  }

  .step-dot {
    width: 8px;
    height: 8px;
    font-size: 0;
  }

  .step-item.active .step-dot {
    width: 20px;
  }
}

/* ─────────────────────────────────────────────────────────────
   UTILITY DRAWER (Fiqh reasoning panel — slides in from right)
   ───────────────────────────────────────────────────────────── */
.utility-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100vh;
  background: var(--color-bg-white);
  box-shadow: var(--shadow-xl);
  z-index: 500;
  transition: right var(--transition-slow);
  overflow-y: auto;
  padding: var(--space-10) var(--space-6) var(--space-8);
}

.utility-drawer.open {
  right: 0;
}

.utility-drawer-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: var(--slate-100);
  border: none;
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-600);
  transition: background var(--transition-fast);
}

.utility-drawer-close:hover {
  background: var(--slate-200);
}

.utility-drawer-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  background: var(--emerald-50);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  margin-bottom: var(--space-3);
}

.utility-drawer h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-5);
  color: var(--slate-800);
  line-height: 1.3;
}

.utility-drawer p {
  font-family: var(--font-serif);
  line-height: 1.8;
  color: var(--slate-600);
  font-size: 0.9375rem;
  margin-bottom: var(--space-4);
}

.utility-drawer .drawer-verse {
  background: var(--slate-50);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--slate-700);
  margin: var(--space-4) 0;
  font-size: 0.9rem;
  line-height: 1.75;
}

.utility-drawer .drawer-source {
  font-size: 0.75rem;
  color: var(--slate-400);
  font-family: var(--font-sans);
  margin-top: var(--space-1);
}

@media (max-width: 480px) {
  .utility-drawer {
    width: 100vw;
    right: -100vw;
  }
}

/* ─────────────────────────────────────────────────────────────
   SKELETON LOADERS
   ───────────────────────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--slate-100) 25%,
    var(--slate-50)  50%,
    var(--slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-2);
  width: 100%;
}

.skeleton-text.short { width: 60%; }

.skeleton-card {
  height: 120px;
  margin-bottom: var(--space-4);
}

.skeleton-loader {
  padding: var(--space-8) var(--space-6);
}

/* ─────────────────────────────────────────────────────────────
   INPUT FOCUS DIMMING
   ───────────────────────────────────────────────────────────── */
.form-group:focus-within {
  position: relative;
  z-index: 2;
}

.guided-container.has-focus::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.15);
  z-index: 1;
  pointer-events: none;
  animation: fadeIn 200ms ease;
}

/* ─────────────────────────────────────────────────────────────
   RESULTS — SERIF AUTHORITY
   ───────────────────────────────────────────────────────────── */
.results-table {
  font-family: var(--font-serif);
}

.evidence-panel,
.explainability-content {
  font-family: var(--font-serif);
}

/* "Why?" button on heir rows */
.why-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--color-primary);
  background: var(--emerald-50);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
  margin-left: var(--space-2);
}

.why-btn:hover {
  background: var(--emerald-100);
}

/* ─────────────────────────────────────────────────────────────
   HEADER — RESPONSIVE COLLAPSE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mizan-header {
    grid-template-columns: 1fr 1fr;
  }

  .header-center {
    display: none;
  }

  .brand-text span {
    display: none;
  }
}

/* ── Input validator ────────────────────────────────────────── */
.validation-errors-panel {
  background: #fee2e2; border: 1px solid #fca5a5;
  border-radius: 6px; padding: 12px 16px; margin-bottom: 16px;
}
.validation-errors-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.validation-errors-list { margin: 0; padding-left: 20px; }

.validation-warnings-panel {
  background: #fef9c3; border: 1px solid #fde047;
  border-radius: 6px; padding: 8px 12px; margin-bottom: 8px;
  font-size: 0.85em;
}
.validation-warnings-label { font-weight: 600; margin-right: 4px; }
.validation-warnings-list { margin: 4px 0 0; padding-left: 20px; }

/* ── Confidence banner ──────────────────────────────────────── */
.confidence-banner {
  border-radius: 6px; padding: 10px 14px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.confidence-banner--green  { background: #dcfce7; border: 1px solid #86efac; }
.confidence-banner--blue   { background: #dbeafe; border: 1px solid #93c5fd; }
.confidence-banner--amber  { background: #fef3c7; border: 1px solid #fcd34d; }
.confidence-banner--red    { background: #fee2e2; border: 1px solid #fca5a5; }
.confidence-banner--unsafe {
  position: sticky; top: 0; z-index: 100;
  background: #dc2626; color: #fff;
  border: 1px solid #b91c1c;
  padding: 12px 16px; border-radius: 6px; margin-bottom: 12px;
}
.confidence-badge { font-weight: 700; font-size: 0.8em; padding: 2px 8px; border-radius: 99px; }
.confidence-badge--green  { background: #16a34a; color: #fff; }
.confidence-badge--blue   { background: #2563eb; color: #fff; }
.confidence-badge--amber  { background: #d97706; color: #fff; }
.confidence-badge--red    { background: #dc2626; color: #fff; }
.confidence-msg { font-size: 0.9em; color: #374151; }
.confidence-banner--unsafe .confidence-msg { color: inherit; }

/* ── Unsafe result subduing ─────────────────────────────────── */
.results-table-container--unsafe { opacity: 0.65; border: 2px solid #fca5a5; border-radius: 6px; }

/* ── Scholar panel ──────────────────────────────────────────── */
.scholar-panel { margin-top: 24px; border: 1px solid #e5e7eb; border-radius: 6px; }
.scholar-panel-summary {
  padding: 12px 16px; cursor: pointer; font-weight: 600;
  background: #f9fafb; border-radius: 6px;
}
.scholar-panel-body { padding: 16px; }
.scholar-msg { padding: 8px 12px; border-radius: 4px; margin-bottom: 8px; }
.scholar-msg--alert   { background: #fee2e2; }
.scholar-msg--warning { background: #fef3c7; }
.scholar-msg--info    { background: #dbeafe; }
.scholar-summary-label, .scholar-rules-label { font-weight: 600; font-size: 0.85em; color: #6b7280; display: block; margin-bottom: 4px; }
.scholar-rule-item { margin-bottom: 8px; }
.scholar-rule-badge { font-size: 0.75em; padding: 1px 6px; border-radius: 99px; background: #e5e7eb; margin-right: 4px; }
.scholar-rule-badge--FARD       { background: #dbeafe; color: #1e40af; }
.scholar-rule-badge--ASABAH     { background: #d1fae5; color: #065f46; }
.scholar-rule-badge--BLOCKING   { background: #fee2e2; color: #991b1b; }
.scholar-rule-badge--DISPUTED   { background: #fef3c7; color: #92400e; }
.scholar-rule-badge--ADJUSTMENT { background: #ede9fe; color: #5b21b6; }
.scholar-rule-body { padding: 8px 12px 4px; font-size: 0.9em; }
.scholar-user-messages { margin-bottom: 12px; }
.scholar-madhhab { font-size: 0.85em; margin: 4px 0 0 8px; }
.validation-errors-icon { color: #dc2626; font-size: 1.1em; }

/* ── Case detail strip (results view) ─────────────────────── */
.case-detail-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #475569;
}
.case-detail-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.case-detail-ref { font-weight: 600; color: #1e293b; font-family: monospace; }
.case-detail-date { color: #64748b; }
.case-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Case badges (shared: strip + history modal) ────────────── */
.case-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid currentColor;
}
.case-badge--paid   { color: #059669; background: #f0fdf4; }
.case-badge--unpaid { color: #94a3b8; background: #f1f5f9; }

/* ── History modal skeletons and layout ─────────────────────── */
.case-skeleton {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.case-skeleton:last-child { border-bottom: none; }
.cases-error { padding: 16px 0; text-align: center; }
.cases-error-msg { margin-bottom: 12px; color: #ef4444; }
.cases-empty { padding: 24px 0; text-align: center; color: #94a3b8; }
.cases-list { display: flex; flex-direction: column; gap: 0; }
.case-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
  flex-wrap: wrap;
}
.case-item:last-child { border-bottom: none; }
.case-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}
.case-date { font-weight: 500; color: #1e293b; }
.case-separator { color: #cbd5e1; }
.case-actions { flex-shrink: 0; }

/* ── Legal pages ─────────────────────────────────────────────── */
.legal-page {
  min-height: 100vh;
  background: #f8fafc;
  font-family: 'Inter', system-ui, sans-serif;
}
.legal-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.legal-logo {
  font-size: 22px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 700;
}
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 14px;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}
.legal-back:hover { background: #f1f5f9; color: #334155; }
.legal-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.legal-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px;
}
.legal-content .legal-updated {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 36px;
}
.legal-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 32px 0 10px;
}
.legal-content p, .legal-content li {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.7;
  margin: 0 0 12px;
}
.legal-content ul {
  padding-left: 20px;
  margin: 0 0 12px;
}
.legal-content a {
  color: #2563eb;
  text-decoration: underline;
}
.legal-content a:hover { color: #1d4ed8; }

/* ── Footer links ─────────────────────────────────────────────── */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  margin-top: 8px;
}
.footer-links a {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
}
.footer-links a:hover { color: #64748b; text-decoration: underline; }
