/* 
 * TalimOS - Multi-Tenant Academy Financial Operating System
 * Linear & Supabase Inspired Clean Architecture & Design System
 */

:root,
[data-theme="dark"] {
  --theme-mode: dark;

  /* Linear Obsidian Canvas */
  --bg-main: #090a0f;
  --bg-surface: #0e1017;
  --bg-card: #12151e;
  --bg-card-hover: #171b26;
  --bg-input: #0b0d13;
  --bg-modal: #121520;
  --bg-glass: rgba(14, 16, 23, 0.85);
  --bg-subtle: rgba(255, 255, 255, 0.03);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(16, 185, 129, 0.35);

  --text-primary: #f4f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;
  --text-faint: #475569;

  /* Platform Signature: Supabase Mint / Emerald */
  --brand-primary: #10b981;
  --brand-primary-hover: #059669;
  --brand-primary-soft: rgba(16, 185, 129, 0.12);
  --brand-primary-glow: rgba(16, 185, 129, 0.25);

  /* Meaningful Clusters */
  --cluster-collection: #10b981;
  --cluster-collection-bg: rgba(16, 185, 129, 0.1);
  --cluster-collection-border: rgba(16, 185, 129, 0.25);

  --cluster-payroll: #6366f1;
  --cluster-payroll-bg: rgba(99, 102, 241, 0.1);
  --cluster-payroll-border: rgba(99, 102, 241, 0.25);

  --cluster-academy: #8b5cf6;
  --cluster-academy-bg: rgba(139, 92, 246, 0.1);
  --cluster-academy-border: rgba(139, 92, 246, 0.25);

  --cluster-dues: #f59e0b;
  --cluster-dues-bg: rgba(245, 158, 11, 0.1);
  --cluster-dues-border: rgba(245, 158, 11, 0.25);

  --cluster-alert: #f43f5e;
  --cluster-alert-bg: rgba(244, 63, 94, 0.1);
  --cluster-alert-border: rgba(244, 63, 94, 0.25);

  /* Legacy mappings for backward compatibility */
  --accent-primary: var(--brand-primary);
  --accent-primary-hover: var(--brand-primary-hover);
  --accent-primary-glow: var(--brand-primary-glow);
  --platform-accent: var(--brand-primary);
  --platform-accent-hover: var(--brand-primary-hover);
  --platform-accent-glow: var(--brand-primary-glow);
  --accent-teacher: var(--cluster-collection);
  --accent-teacher-glow: var(--cluster-collection-bg);
  --accent-academy: var(--cluster-dues);
  --accent-academy-glow: var(--cluster-dues-bg);
  --accent-danger: var(--cluster-alert);
  --accent-danger-glow: var(--cluster-alert-bg);

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.7);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --theme-mode: light;

  /* Linear Slate/Daylight Canvas */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --bg-modal: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-subtle: #f1f5f9;

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-hover: #cbd5e1;
  --border-highlight: rgba(16, 185, 129, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Platform Signature: Supabase Mint / Emerald */
  --brand-primary: #059669;
  --brand-primary-hover: #047857;
  --brand-primary-soft: rgba(5, 150, 105, 0.1);
  --brand-primary-glow: rgba(5, 150, 105, 0.2);

  /* Meaningful Clusters */
  --cluster-collection: #059669;
  --cluster-collection-bg: rgba(5, 150, 105, 0.08);
  --cluster-collection-border: rgba(5, 150, 105, 0.2);

  --cluster-payroll: #4f46e5;
  --cluster-payroll-bg: rgba(79, 70, 229, 0.08);
  --cluster-payroll-border: rgba(79, 70, 229, 0.2);

  --cluster-academy: #7c3aed;
  --cluster-academy-bg: rgba(124, 58, 237, 0.08);
  --cluster-academy-border: rgba(124, 58, 237, 0.2);

  --cluster-dues: #d97706;
  --cluster-dues-bg: rgba(217, 119, 6, 0.08);
  --cluster-dues-border: rgba(217, 119, 6, 0.2);

  --cluster-alert: #e11d48;
  --cluster-alert-bg: rgba(225, 29, 72, 0.08);
  --cluster-alert-border: rgba(225, 29, 72, 0.2);

  /* Legacy mappings */
  --accent-primary: var(--brand-primary);
  --accent-primary-hover: var(--brand-primary-hover);
  --accent-primary-glow: var(--brand-primary-glow);
  --platform-accent: var(--brand-primary);
  --platform-accent-hover: var(--brand-primary-hover);
  --platform-accent-glow: var(--brand-primary-glow);
  --accent-teacher: var(--cluster-collection);
  --accent-teacher-glow: var(--cluster-collection-bg);
  --accent-academy: var(--cluster-dues);
  --accent-academy-glow: var(--cluster-dues-bg);
  --accent-danger: var(--cluster-alert);
  --accent-danger-glow: var(--cluster-alert-bg);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #25334d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}

/* App Container Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.brand {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-box {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}
.brand-logo-box .lucide {
  width: 20px;
  height: 20px;
}

.brand-info {
  flex: 1;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.platform-title {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.platform-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.platform-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Active Organization Selector Card */
.org-context-card {
  margin: 0 14px 12px;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: var(--transition-fast);
}
.org-context-card:hover {
  border-color: var(--border-highlight);
}
.org-context-meta {
  flex: 1;
  min-width: 0;
}
.org-context-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.org-badge-pill {
  font-size: 0.6rem;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--brand-primary);
  font-weight: 700;
}
.org-context-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tenant-switch-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.tenant-switch-btn:hover {
  color: var(--brand-primary);
  background: var(--bg-subtle);
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 18px 6px;
}

.nav-links {
  list-style: none;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.nav-item button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item button.active {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item button.active .nav-icon {
  color: var(--brand-primary);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.nav-icon .lucide {
  width: 16px;
  height: 16px;
}

.nav-item button:hover .nav-icon {
  color: var(--text-primary);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.policy-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.74rem;
}

.policy-badge-title {
  color: var(--text-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.policy-badge-item {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  margin-top: 3px;
}

.policy-badge-item span.highlight {
  color: var(--brand-primary);
  font-weight: 600;
}

/* Main Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
  transition: background-color var(--transition-normal);
}

/* Top Header Bar */
.top-header {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.page-title h2 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-title p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.tenant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.tenant-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 0 6px var(--brand-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme Toggle Button (Light/Dark) */
.icon-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.icon-toggle-btn .lucide {
  width: 16px;
  height: 16px;
}

/* Language Toggle Button */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.lang-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

/* Month Picker Container */
.month-picker-container {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  gap: 2px;
}

.month-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.month-btn .lucide {
  width: 14px;
  height: 14px;
}
.month-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.current-month-display {
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Content Area */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* View Containers */
.view-panel {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.view-panel.active {
  display: block;
}

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

/* Policy Rules Banner (Minimal & Subtle Linear Design) */
.policy-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.policy-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.banner-col {
  flex: 1;
  min-width: 240px;
}

.banner-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.banner-title .lucide {
  width: 14px;
  height: 14px;
  color: var(--brand-primary);
}

.rule-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rule-chip strong {
  color: var(--text-primary);
}

.chip-t {
  color: var(--cluster-collection);
  font-weight: 600;
}

.chip-a {
  color: var(--cluster-academy);
  font-weight: 600;
}

.formula-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cluster-alert);
  display: inline-block;
  line-height: 1.4;
}

/* KPI Cards Grid (Meaningful Clusters) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* Cluster color indicators */
.kpi-card.blue {
  border-left: 3px solid var(--cluster-payroll);
}
.kpi-card.blue .kpi-icon {
  background: var(--cluster-payroll-bg);
  color: var(--cluster-payroll);
}

.kpi-card.emerald {
  border-left: 3px solid var(--cluster-collection);
}
.kpi-card.emerald .kpi-icon {
  background: var(--cluster-collection-bg);
  color: var(--cluster-collection);
}

.kpi-card.amber {
  border-left: 3px solid var(--cluster-academy);
}
.kpi-card.amber .kpi-icon {
  background: var(--cluster-academy-bg);
  color: var(--cluster-academy);
}

.kpi-card.rose {
  border-left: 3px solid var(--cluster-alert);
}
.kpi-card.rose .kpi-icon {
  background: var(--cluster-alert-bg);
  color: var(--cluster-alert);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon .lucide {
  width: 16px;
  height: 16px;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.kpi-subtext {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Distribution Split Progress Bar */
.split-bar-container {
  margin-top: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  height: 6px;
  display: flex;
  overflow: hidden;
}

.split-bar-teacher {
  background: var(--cluster-payroll);
  height: 100%;
  transition: width 0.4s ease;
}

.split-bar-academy {
  background: var(--cluster-academy);
  height: 100%;
  transition: width 0.4s ease;
}

/* Class Level Overview Cards */
.classes-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.class-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.class-badge {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-c9  { background: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-c10 { background: rgba(6, 182, 212, 0.12); color: #06b6d4; border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-c11 { background: rgba(99, 102, 241, 0.12); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.25); }
.badge-c12 { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.25); }

.class-rate-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.class-stats-row {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-item .stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-item .stat-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Panels, Tables, Controls */
.content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Search and Filters */
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.84rem;
  min-width: 220px;
  outline: none;
  transition: var(--transition-fast);
}

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

.search-input:focus {
  border-color: var(--platform-accent);
  box-shadow: 0 0 0 3px var(--platform-accent-glow);
}

.select-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.84rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.select-dropdown:focus {
  border-color: var(--platform-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
  text-decoration: none;
  line-height: 1.4;
}

.btn .lucide {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--platform-accent);
  color: #ffffff;
  border-color: var(--platform-accent);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: var(--platform-accent-hover);
  border-color: var(--platform-accent-hover);
  box-shadow: 0 2px 8px var(--platform-accent-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--cluster-collection);
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.btn-danger {
  background: var(--cluster-alert);
  color: #ffffff;
}

.btn-danger:hover {
  background: #e11d48;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-paid {
  background: var(--cluster-collection-bg);
  color: var(--cluster-collection);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-unpaid {
  background: var(--cluster-alert-bg);
  color: var(--cluster-alert);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.status-partial {
  background: var(--cluster-academy-bg);
  color: var(--cluster-academy);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-draft {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.status-approved {
  background: var(--cluster-payroll-bg);
  color: var(--cluster-payroll);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Currency and Calculations */
.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.amount.teacher { color: var(--cluster-payroll); }
.amount.academy { color: var(--cluster-academy); }
.amount.deduction { color: var(--cluster-alert); }
.amount.net { color: var(--platform-accent); font-weight: 700; }

/* Tabs inside panel */
.panel-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.panel-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.panel-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.panel-tab-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
}

/* Attendance Grid */
.attendance-table th, .attendance-table td {
  text-align: center;
  padding: 8px 6px;
}

.att-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.att-P { background: var(--cluster-collection-bg); color: var(--cluster-collection); border: 1px solid rgba(16, 185, 129, 0.3); }
.att-A { background: var(--cluster-alert-bg); color: var(--cluster-alert); border: 1px solid rgba(244, 63, 94, 0.3); }
.att-L { background: var(--cluster-academy-bg); color: var(--cluster-academy); border: 1px solid rgba(245, 158, 11, 0.3); }
.att-none { background: var(--bg-subtle); color: var(--text-muted); border: 1px dashed var(--border-color); }

.att-dot:hover {
  transform: scale(1.1);
}

/* Modal Windows */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.15s ease-out;
}

.modal-content.wide {
  max-width: 850px;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--platform-accent);
  box-shadow: 0 0 0 3px var(--platform-accent-glow);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Live Distribution Calculator Box in Modal */
.calc-preview-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 14px;
}

.calc-preview-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--platform-accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--text-secondary);
}

.calc-row.highlight {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 6px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 0.84rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Printable Slip & Voucher Styles */
@media screen {
  .print-only {
    display: none;
  }
}

/* Modal sizing for 3-part vertical voucher */
.modal-content.modal-voucher-3part {
  max-width: 880px !important;
  width: 95vw !important;
}

.voucher-preview-banner {
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.voucher-preview-banner .banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #e2e8f0;
}

.voucher-preview-banner .banner-badge {
  background: #2563eb;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Vertical 3-Part Voucher Container */
.voucher-vertical-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
  color: #0f172a;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
  max-width: 840px;
}

/* Individual Horizontal Voucher Slip */
.voucher-horizontal-card {
  background: #ffffff;
  border: 1.5px solid #0f172a;
  border-radius: 6px;
  padding: 7px 12px;
  box-sizing: border-box;
  font-family: Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Top Header in Slip */
.vh-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 4px;
  margin-bottom: 5px;
}

.vh-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vh-emblem {
  font-size: 18px;
}

.vh-academy-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #0f172a;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.15;
}

.vh-academy-sub {
  font-size: 8.5px;
  color: #475569;
  margin: 1px 0 0;
}

.vh-copy-tag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vh-copy-pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2.5px 10px;
  border-radius: 4px;
  color: #ffffff;
}

.vh-copy-pill.badge-bank {
  background: #0f172a;
}

.vh-copy-pill.badge-academy {
  background: #1d4ed8;
}

.vh-copy-pill.badge-student {
  background: #047857;
}

.vh-challan-ref {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Two-Column Body Grid: Left Meta / Right Table */
.vh-body-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 4px;
}

/* Meta Data Box */
.vh-meta-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 9.5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.vh-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}

.vh-meta-item {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vh-meta-item span {
  color: #475569;
}

.vh-meta-item strong {
  color: #0f172a;
}

.vh-due-text {
  color: #b91c1c !important;
  font-weight: 800;
}

.vh-rules-note {
  font-size: 7.5px;
  color: #64748b;
  margin-top: 3px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 2px;
}

/* Particulars Table */
.vh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

.vh-table th {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 5px;
  font-size: 8.5px;
  text-transform: uppercase;
  color: #334155;
  text-align: left;
}

.vh-table td {
  border: 1px solid #e2e8f0;
  padding: 1.5px 5px;
  color: #1e293b;
}

.vh-total-row td {
  font-weight: 700;
  background: #f8fafc;
  border-top: 1.5px solid #0f172a !important;
}

.vh-paid-row td {
  color: #047857 !important;
  font-weight: 600;
}

.vh-balance-row td {
  font-weight: 800;
  font-size: 10px;
}

.vh-balance-row.unpaid td {
  color: #dc2626 !important;
  background: #fef2f2;
}

.vh-balance-row.cleared td {
  color: #047857 !important;
  background: #f0fdf4;
}

/* Bottom Footer Row: Stamp & Signatures */
.vh-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 3px;
  margin-top: 1px;
}

.vh-status-stamp {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 1.5px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.vh-status-stamp.status-paid {
  border: 1px dashed #059669;
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
}

.vh-status-stamp.status-unpaid {
  border: 1px dashed #dc2626;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
}

.vh-status-stamp.status-partial {
  border: 1px dashed #d97706;
  color: #d97706;
  background: rgba(245, 158, 11, 0.08);
}

.vh-sig-block {
  text-align: center;
}

.vh-sig-line {
  display: inline-block;
  border-top: 1px solid #0f172a;
  width: 150px;
  font-size: 8px;
  font-weight: 600;
  color: #1e293b;
  padding-top: 1px;
}

/* Horizontal Cutting Divider Between Copies */
.voucher-h-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #64748b;
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 3px 0;
  user-select: none;
}

.voucher-h-divider .divider-text {
  letter-spacing: 2px;
  font-size: 8.5px;
  font-weight: 700;
  color: #94a3b8;
}

/* ========================================================= */
/* 2-PART OFFICIAL VOUCHER (ACADEMY COPY & STUDENT COPY)    */
/* ========================================================= */
.voucher-2part-container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voucher-card-2part {
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #0f172a;
  border-radius: 6px;
  padding: 12px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.v2-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.v2-branding {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-emblem {
  font-size: 24px;
}

.v2-academy-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #0f172a;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.2;
}

.v2-academy-sub {
  font-size: 9.5px;
  color: #475569;
  margin: 2px 0 0;
}

.v2-copy-tag {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 4px;
  color: #ffffff;
}

.v2-copy-pill.badge-academy {
  background: #1e40af;
}

.v2-copy-pill.badge-student {
  background: #065f46;
}

.v2-challan-ref {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
}

.v2-body-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 8px;
}

.v2-meta-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.v2-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.v2-meta-item {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-meta-item span {
  color: #475569;
}

.v2-meta-item strong {
  color: #0f172a;
}

.v2-due-text {
  color: #dc2626 !important;
  font-weight: 800;
}

.v2-rules-note {
  font-size: 8px;
  color: #64748b;
  margin-top: 6px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 4px;
  line-height: 1.3;
}

.v2-table-box {
  display: flex;
  flex-direction: column;
}

.v2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.v2-table th {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  font-size: 9px;
  text-transform: uppercase;
  color: #1e293b;
  text-align: left;
}

.v2-table td {
  border: 1px solid #e2e8f0;
  padding: 2.5px 8px;
  color: #1e293b;
}

.v2-feehead-row td {
  background: #ffffff;
}

.v2-feehead-val {
  text-align: right;
  font-weight: 600;
}

.v2-discount-row td {
  color: #b45309 !important;
  background: #fffbeb;
}

.v2-total-row td {
  font-weight: 800;
  background: #f1f5f9;
  border-top: 1.5px solid #0f172a !important;
  font-size: 10.5px;
}

.v2-paid-row td {
  color: #047857 !important;
  font-weight: 700;
  background: #f0fdf4;
}

.v2-balance-row td {
  font-weight: 800;
  font-size: 11px;
}

.v2-balance-row.unpaid td {
  color: #dc2626 !important;
  background: #fef2f2;
}

.v2-balance-row.cleared td {
  color: #047857 !important;
  background: #f0fdf4;
}

.v2-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
}

.v2-status-stamp {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2.5px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.v2-status-stamp.status-paid {
  border: 1.5px dashed #059669;
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
}

.v2-status-stamp.status-unpaid {
  border: 1.5px dashed #dc2626;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
}

.v2-status-stamp.status-partial {
  border: 1.5px dashed #d97706;
  color: #d97706;
  background: rgba(245, 158, 11, 0.08);
}

.v2-sig-block {
  text-align: center;
}

.v2-sig-line {
  display: inline-block;
  border-top: 1px solid #0f172a;
  width: 160px;
  font-size: 9px;
  font-weight: 600;
  color: #1e293b;
  padding-top: 2px;
}

.voucher-h-divider-2part {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #64748b;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 0;
  user-select: none;
}

.voucher-h-divider-2part .divider-text {
  letter-spacing: 3px;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
}

/* Standard Single Slip Container (Admission Cards & Salary Slips) */
.slip-container {
  background: #ffffff;
  color: #1e293b;
  border: 2px solid #0f172a;
  border-radius: 8px;
  padding: 24px;
  margin: 0 auto;
  max-width: 750px;
}

.slip-header {
  text-align: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.slip-header h2 {
  font-size: 22px;
  color: #0f172a;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.slip-header p {
  font-size: 12px;
  color: #475569;
}

.slip-title-badge {
  display: inline-block;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 4px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.slip-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.slip-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}

.slip-table th {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  text-align: left;
}

.slip-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
}

.slip-total-row {
  font-weight: bold;
  background: #f8fafc;
}

.slip-footer {
  margin-top: 36px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding-top: 24px;
}

.slip-signature-line {
  border-top: 1px solid #000;
  width: 180px;
  text-align: center;
  padding-top: 6px;
}

/* Master Print Media Styles (A4 Portrait Optimization) */
@media print {
  @page {
    size: portrait;
    margin: 4mm 5mm;
  }

  html, body {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .sidebar, .top-header, .btn, .header-actions, .modal-header, .modal-footer, .close-btn, #toast-container, .voucher-preview-banner {
    display: none !important;
  }

  .app-layout,
  .main-wrapper,
  .view-panel {
    display: none !important;
  }

  .modal-overlay:not(#modal-print),
  .modal-overlay:not(.open) {
    display: none !important;
  }

  #modal-print.modal-overlay.open {
    position: static !important;
    display: block !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: auto !important;
  }

  .modal-content {
    position: static !important;
    display: block !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
    animation: none !important;
  }

  .modal-body {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }

  .print-area {
    position: static !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
  }

  /* Force 2 horizontal slips on ONE SINGLE Portrait A4 sheet */
  .voucher-2part-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    break-inside: avoid !important;
    height: 286mm !important;
    max-height: 286mm !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  .voucher-card-2part {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1.5px solid #000000 !important;
    padding: 6px 12px !important;
    background: #ffffff !important;
    height: 135mm !important;
    max-height: 135mm !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }

  .voucher-h-divider-2part {
    display: flex !important;
    margin: 2mm 0 !important;
  }

  /* Backward compatibility for 3-part slips */
  .voucher-vertical-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    break-inside: avoid !important;
    height: 286mm !important;
    max-height: 286mm !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  .voucher-horizontal-card {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1.5px solid #000000 !important;
    padding: 4px 8px !important;
    background: #ffffff !important;
    height: 89mm !important;
    max-height: 89mm !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }

  .voucher-h-divider {
    display: flex !important;
    margin: 1mm 0 !important;
  }

  .slip-container {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 2px solid #000000 !important;
  }
}

/* Auto-Gen ID Badge & Student Form Enhancements */
.badge-auto-pill {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tariff-subject-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s, background 0.2s;
}

.tariff-subject-card:hover {
  border-color: var(--border-highlight);
  background: rgba(30, 41, 59, 0.6);
}

.tariff-preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.tariff-preset-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: #60a5fa;
}

.student-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  font-weight: 700;
}

/* ============================================================== */
/* PHASE 3 ENHANCEMENTS: TENANT BADGE, I18N, WIZARD & CHARTS       */
/* ============================================================== */

/* Tenant Indicator Badge */
.tenant-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.tenant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--platform-accent);
  box-shadow: 0 0 6px var(--platform-accent-glow);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Teacher Salary Type Badges */
.badge-salary-pct {
  background: var(--cluster-collection-bg);
  color: var(--cluster-collection);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-salary-fixed {
  background: var(--cluster-payroll-bg);
  color: var(--cluster-payroll);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Setup Wizard Stepper */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 8px;
}
.wizard-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.wizard-step-node .step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.wizard-step-node.active .step-circle {
  background: var(--platform-accent);
  border-color: var(--platform-accent);
  color: #ffffff;
  box-shadow: 0 0 10px var(--platform-accent-glow);
}
.wizard-step-node.completed .step-circle {
  background: var(--cluster-collection);
  border-color: var(--cluster-collection);
  color: #ffffff;
}
.wizard-step-node .step-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}
.wizard-step-node.active .step-name {
  color: var(--text-primary);
  font-weight: 600;
}
.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 8px 16px 8px;
}
.wizard-step-line.completed {
  background: var(--cluster-collection);
}

.wizard-step-pane {
  display: none;
}
.wizard-step-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.class-fee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.class-fee-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s;
}
.class-fee-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.class-fee-card-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Financial Visualizer Charts on Dashboard */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.chart-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-card-title .lucide {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.chart-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bar-track {
  width: 100%;
  height: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}
.bar-fill-collected {
  background: var(--cluster-collection);
  height: 100%;
  transition: width 0.6s ease-in-out;
}
.bar-fill-outstanding {
  background: var(--cluster-academy);
  height: 100%;
  transition: width 0.6s ease-in-out;
}
.bar-fill-teacher {
  background: var(--cluster-payroll);
  height: 100%;
  transition: width 0.6s ease-in-out;
}
.bar-fill-academy {
  background: var(--cluster-retained);
  height: 100%;
  transition: width 0.6s ease-in-out;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

/* ============================================================== */
/* RTL & URDU TYPOGRAPHY OVERRIDES ([dir="rtl"])                  */
/* ============================================================== */
[dir="rtl"] {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  text-align: right;
}
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
}
[dir="rtl"] .brand {
  flex-direction: row-reverse;
  text-align: right;
}
[dir="rtl"] .brand-icon {
  margin-right: 0;
  margin-left: 12px;
}
[dir="rtl"] .nav-btn {
  flex-direction: row-reverse;
  text-align: right;
}
[dir="rtl"] .nav-icon {
  margin-right: 0;
  margin-left: 10px;
}
[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}
[dir="rtl"] .month-picker-container {
  flex-direction: row-reverse;
}
[dir="rtl"] .close-btn {
  left: 20px;
  right: auto;
}
[dir="rtl"] .panel-actions {
  flex-direction: row-reverse;
}
[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
  text-align: right;
}
[dir="rtl"] .data-table th:last-child,
[dir="rtl"] .data-table td:last-child {
  text-align: left;
}
[dir="rtl"] .calc-preview-title {
  flex-direction: row-reverse;
}
[dir="rtl"] .toast {
  right: auto;
  left: 24px;
}

/* Tenant Badge Interactive Switcher Button */
.tenant-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.tenant-badge-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
  box-shadow: 0 0 8px var(--brand-primary-soft);
}

/* Multi-Org Switcher Modal Cards */
.org-switcher-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.org-switcher-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
}
.org-switcher-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.org-switcher-card.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.role-badge.owner {
  background: rgba(16, 185, 129, 0.15);
  color: var(--brand-primary);
}
.role-badge.admin {
  background: rgba(99, 102, 241, 0.15);
  color: var(--cluster-payroll);
}
.role-badge.accountant {
  background: rgba(245, 158, 11, 0.15);
  color: var(--cluster-dues);
}
.role-badge.teacher {
  background: rgba(139, 92, 246, 0.15);
  color: var(--cluster-academy);
}

/* Auth Modal Tabs & Elements */
.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.auth-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  font-family: inherit;
}
.auth-tab-btn:hover {
  color: var(--text-primary);
}
.auth-tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
}
.auth-pane {
  display: none;
}
.auth-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

/* Action Table Buttons */
.table-btn-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.btn-table-action {
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.btn-table-action:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn-table-action.danger:hover {
  background: rgba(244, 63, 94, 0.12);
  color: var(--cluster-alert);
  border-color: var(--cluster-alert);
}
.btn-table-action.success:hover {
  background: rgba(16, 185, 129, 0.12);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* Role Selector Header Pill */
.role-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}
.role-pill-badge:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.role-select-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.role-select-input option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* SaaS Billing UI Components */
.saas-billing-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .saas-billing-grid {
    grid-template-columns: 1fr;
  }
}

.jazzcash-card {
  background: var(--bg-card);
  border: 1px solid rgba(225, 29, 72, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.jazzcash-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #e11d48, #f59e0b);
}
.jazzcash-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(225, 29, 72, 0.12);
  color: #f43f5e;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  border: 1px solid rgba(225, 29, 72, 0.25);
}
.jazzcash-acc-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 16px 0;
}
.jazzcash-number-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.jazzcash-steps {
  list-style: none;
  padding: 0;
  margin: 14px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jazzcash-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.step-number {
  background: var(--bg-surface);
  color: var(--platform-accent);
  border: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.72rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* SMTP Setup Guide Styles */
.smtp-guide-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
}
.smtp-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.smtp-tab-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.smtp-tab-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--brand-primary);
}
.smtp-param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
  font-size: 0.82rem;
}
.smtp-param-label {
  color: var(--text-muted);
  font-weight: 500;
}
.smtp-param-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

/* Role Restricted Guard */
.role-hidden {
  display: none !important;
}


