/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
  /* Light theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Accent colors */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #8b5cf6;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  /* Organization colors */
  --org-bishopric: #6366f1;
  --org-elders: #3b82f6;
  --org-relief: #ec4899;
  --org-ym: #14b8a6;
  --org-yw: #f97316;
  --org-primary: #eab308;
  --org-sunday-school: #8b5cf6;
  --org-music: #06b6d4;
  --org-other: #64748b;

  /* 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);

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 80px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #475569;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border-color: #334155;
  --border-light: #1e293b;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   App Layout
   ======================================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-menu li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

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

.nav-link.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.badge {
  margin-left: auto;
  background: var(--accent-danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.nav-link.active .badge {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

.theme-toggle {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
}

/* ========================================
   Views
   ======================================== */
.view {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  margin-bottom: 32px;
}

.view-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.view-header .subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.header-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

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

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

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

.btn-success {
  background: var(--accent-success);
  color: white;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ========================================
   Form Elements
   ======================================== */
.search-box {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select-input {
  padding: 10px 36px 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* ========================================
   Dashboard Grid
   ======================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.org-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.org-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

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

.org-card-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.org-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.org-count {
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.org-card-body {
  padding: 16px 24px;
  max-height: 300px;
  overflow-y: auto;
}

.calling-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.calling-item:last-child {
  border-bottom: none;
}

.calling-info {
  flex: 1;
}

.calling-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.calling-member {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.calling-vacant {
  color: var(--accent-warning);
  font-style: italic;
}

.calling-actions {
  display: flex;
  gap: 4px;
}

/* ========================================
   Data Table
   ======================================== */
.members-table-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 16px 20px;
  background: var(--bg-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9375rem;
}

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

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

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

.member-name {
  font-weight: 500;
}

.member-callings {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.table-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   Callings View
   ======================================== */
.callings-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.callings-org-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.callings-org-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.callings-org-header:hover {
  background: var(--bg-hover);
}

.callings-org-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.callings-org-body {
  padding: 16px 0;
}

.callings-table {
  width: 100%;
}

.callings-table td {
  padding: 12px 24px;
  vertical-align: middle;
}

.callings-table tr {
  transition: background var(--transition-fast);
}

.callings-table tr:hover {
  background: var(--bg-tertiary);
}

/* Pending change indicators in callings table */
.callings-table tr.pending-release-row {
  background: rgba(245, 158, 11, 0.08);
}

.callings-table tr.pending-call-row {
  background: rgba(16, 185, 129, 0.08);
}

.release-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.new-calling-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-release {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-warning);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-new {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-success);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-calling {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-success);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.proposed-replacement {
  margin-top: 6px;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Reassignment display - shows both outgoing and incoming */
.reassignment-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Consistent styling for pending member rows (both release and call) */
.pending-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.incoming-arrow {
  color: var(--accent-success);
  font-weight: bold;
}

/* ========================================
   Pending Changes
   ======================================== */
.pending-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.pending-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.section-title {
  padding: 20px 24px;
  font-size: 1.125rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.section-title.releases .dot {
  background: var(--accent-warning);
}

.section-title.calls .dot {
  background: var(--accent-success);
}

.pending-list {
  padding: 16px 24px;
  min-height: 100px;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.pending-item:last-child {
  margin-bottom: 0;
}

.pending-info h4 {
  font-size: 0.9375rem;
  font-weight: 500;
}

.pending-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ========================================
   Export View
   ======================================== */
.export-preview {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 32px;
}

.export-section {
  margin-bottom: 32px;
}

.export-section:last-child {
  margin-bottom: 0;
}

.export-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.export-section.releases h2 {
  border-color: var(--accent-warning);
}

.export-section.calls h2 {
  border-color: var(--accent-success);
}

.export-list {
  list-style: none;
}

.export-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
}

.export-list li:last-child {
  border-bottom: none;
}

/* Export Tabs */
.export-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.export-tab {
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.export-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.export-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.export-content {
  display: none;
}

.export-content.active {
  display: block;
}

/* Sacrament Script Styles */
.sacrament-script {
  font-family: 'Georgia', 'Times New Roman', serif;
}

.script-header {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 16px;
}

.script-date {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9375rem;
}

.script-section {
  margin-bottom: 32px;
}

.script-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.script-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.script-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
}

.script-number {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent-primary);
  min-width: 28px;
}

.script-text {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Roster Export Styles */
.roster-export {
  font-family: var(--font-family);
}

.roster-header {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 16px;
}

.roster-date {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

.roster-count {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 0.875rem;
  font-weight: 500;
}

.roster-org {
  margin-bottom: 28px;
}

.roster-org:last-child {
  margin-bottom: 0;
}

.roster-org-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-primary);
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.roster-table td {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  font-size: 0.9375rem;
}

.roster-table tbody tr:hover {
  background: var(--bg-tertiary);
}

/* ========================================
   History View
   ======================================== */
.history-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-icon.release {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning);
}

.history-icon.call {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.history-icon svg {
  width: 20px;
  height: 20px;
}

.history-content {
  flex: 1;
}

.history-content h4 {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.history-content p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
}

.toast {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn var(--transition-normal);
  min-width: 300px;
}

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

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

.toast.warning {
  border-left-color: var(--accent-warning);
}

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

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {

  .sidebar,
  .header-actions,
  .calling-actions,
  .table-actions,
  .btn,
  .theme-toggle {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .export-preview {
    border: none;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .pending-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-actions {
    flex-wrap: wrap;
  }

  .search-box {
    max-width: 100%;
    order: 1;
    width: 100%;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }
}

/* ========================================
   Auth Overlay
   ======================================== */
.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 12px;
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.auth-error {
  color: var(--accent-danger);
  font-size: 0.875rem;
  min-height: 20px;
  margin-bottom: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ========================================
   Sidebar Identity
   ======================================== */
.ward-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.user-email {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.sidebar-footer-actions {
  display: flex;
  gap: 8px;
}