/* ==========================================================================
   Typography & Core Design Tokens
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #f5f5f7;                /* Soft, off-white background */
  --card: #ffffff;              /* Pure white container card */
  --text: #1d1d1f;              /* Deep charcoal/black for primary text */
  --muted: #86868b;             /* Elegant gray for secondary/muted text */
  --line: rgba(0, 0, 0, 0.08);  /* Hairline borders (8% opacity) */
  --line-subtle: rgba(0, 0, 0, 0.04); /* Hairline borders (4% opacity) */
  --brand: #0071e3;             /* Refined, vibrant blue accent */
  --brand-light: rgba(0, 113, 227, 0.05);
  --brand-strong: #005bb5;
  --danger: #ff453a;            /* Clean, soft red */
  --success: #34c759;           /* Clean, soft green */
  
  /* System Elevations & Layering */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.06);
  --shadow-premium: 0 24px 60px rgba(0, 0, 0, 0.03);
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-tactile: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 0;
}

/* ==========================================================================
   Common Interactive Elements
   ========================================================================== */

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

input,
select,
button {
  font-family: inherit;
  outline: none;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.02);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition-tactile);
}

input:focus,
select:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

/* Premium Button Styles */
button, .btn {
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-tactile);
  font-family: inherit;
  outline: none;
  text-decoration: none;
}

button:hover, .btn:hover {
  background: var(--brand-strong);
}

button:active, .btn:active {
  transform: scale(0.96);
}

/* Secondary & Danger variants */
button.secondary, .btn.secondary {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  border: 1px solid transparent;
}
button.secondary:hover, .btn.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

button.danger, .btn.danger {
  background: var(--danger);
  color: #ffffff;
}
button.danger:hover, .btn.danger:hover {
  background: #e03e3e;
}

/* Specific spacious styling for primary submit triggers and wizard steps */
#login-btn,
.btn-submit,
.wizard-navigation button,
button[type="submit"]:not(.form-inline button):not(.form-section-body button):not(#policy-filters button):not(#branch-errors-filters button):not(#admin-branch-activity-filters button):not(#admin-branch-errors-filters button) {
  padding: 12px 28px !important;
  border-radius: 980px !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
}

/* Compact overrides for inline elements, tables, action lists, close buttons */
td button,
.table-wrap button,
.version-action-btn,
.edit-user-btn, .delete-user-btn,
.edit-branch-btn, .delete-branch-btn,
.view-branch-logs-btn, .view-branch-activity-btn,
.modal-close-btn, .nudge-btn,
.btn-sm,
.builder-advanced-settings-btn {
  padding: 5px 10px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  height: auto !important;
  width: auto !important;
  gap: 4px !important;
}

/* Ensure circular action buttons remain circular */
.version-action-btn,
.modal-close-btn,
.nudge-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ==========================================================================
   Layout Containers & Page Sections
   ========================================================================== */

.dashboard-page {
  padding: 32px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 18px 28px;
  border-radius: 20px;
  border: 1px solid var(--line-subtle);
  box-shadow: var(--shadow-sm);
}

.topbar h1 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header & Tab navigation switcher (Branch Dashboard inline style) */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  background: rgba(0, 0, 0, 0.02);
  padding: 6px;
  border-radius: 14px;
  width: fit-content;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 13.5px;
  box-shadow: none;
  cursor: pointer;
  transition: var(--transition-tactile);
}

.tab:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
}

.tab.active {
  background: var(--card);
  color: var(--brand);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Page Panels */
.panel {
  display: none;
  background: var(--card);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-premium);
}

.panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 32px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}

.form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  background: rgba(0, 0, 0, 0.01);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--line-subtle);
}

/* ==========================================================================
   Clean Tables (No gridlines style)
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  background: var(--card);
}

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

th,
td {
  padding: 18px 24px;
  text-align: right;
  border-bottom: 1px solid var(--line-subtle);
  font-size: 14px;
}

th {
  background: rgba(0, 0, 0, 0.01);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  border-bottom: 1px solid var(--line-subtle);
}

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

tr:hover td {
  background: #fafafa;
  transition: background 0.2s ease;
}

/* Table Actions Layout and Ghost Styles */
td.actions {
  text-align: center !important;
  min-width: 60px !important;
  width: 60px !important;
  padding: 10px 14px !important;
  border-bottom: inherit !important; /* Keep table borders intact */
  overflow: visible !important;
}

/* Premium Actions Dropdown Menu */
.actions-dropdown {
  position: relative;
  display: inline-block;
}

.actions-dropdown-toggle {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid var(--line-subtle) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.actions-dropdown-toggle:hover {
  background: rgba(0, 0, 0, 0.07) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

.actions-dropdown.active .actions-dropdown-toggle {
  background: var(--brand-subtle) !important;
  color: var(--brand) !important;
  border-color: rgba(0, 113, 227, 0.15) !important;
}

.actions-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 16px -6px rgba(0,0,0,0.04);
  z-index: 100;
  min-width: 150px;
  padding: 6px;
  animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.actions-dropdown.active .actions-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.actions-dropdown-menu button,
.actions-dropdown-menu a {
  background: transparent !important;
  border: none !important;
  color: var(--text) !important;
  width: 100% !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  text-align: right !important; /* Arabic right alignment */
  border-radius: 8px !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  transition: background 0.15s ease;
}

.actions-dropdown-menu button:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* Danger actions inside dropdown */
.actions-dropdown-menu button.danger {
  color: var(--danger) !important;
}
.actions-dropdown-menu button.danger:hover {
  background: rgba(255, 69, 58, 0.08) !important;
}

/* Primary/Brand actions inside dropdown */
.actions-dropdown-menu button.primary,
.actions-dropdown-menu button[data-action="resubmit"] {
  color: var(--brand) !important;
}
.actions-dropdown-menu button.primary:hover,
.actions-dropdown-menu button[data-action="resubmit"]:hover {
  background: rgba(0, 113, 227, 0.08) !important;
}

/* Dropdown animation */
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Make sure table wrapper shows overflow-y for dropdowns */
.table-wrap {
  overflow-x: auto;
  overflow-y: visible !important;
}

/* Base style for table actions */
td.actions button,
.table-wrap td button {
  padding: 5px 10px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  background: rgba(0, 0, 0, 0.03) !important;
  color: var(--text) !important;
  border: 1px solid var(--line-subtle) !important;
  box-shadow: none !important;
  height: auto !important;
  width: auto !important;
  margin: 2px 0 !important;
}

td.actions button:hover,
.table-wrap td button:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

/* Danger actions (Error details, Delete) */
td.actions button.danger,
.table-wrap td button.danger {
  background: rgba(255, 69, 58, 0.06) !important;
  color: var(--danger) !important;
  border-color: rgba(255, 69, 58, 0.15) !important;
}

td.actions button.danger:hover,
.table-wrap td button.danger:hover {
  background: rgba(255, 69, 58, 0.1) !important;
  border-color: rgba(255, 69, 58, 0.25) !important;
}

/* Resubmit/Success primary actions */
td.actions button[data-action="resubmit"],
.table-wrap td button.btn-workflow-transition {
  background: rgba(0, 113, 227, 0.06) !important;
  color: var(--brand) !important;
  border-color: rgba(0, 113, 227, 0.15) !important;
}

td.actions button[data-action="resubmit"]:hover,
.table-wrap td button.btn-workflow-transition:hover {
  background: rgba(0, 113, 227, 0.1) !important;
  border-color: rgba(0, 113, 227, 0.25) !important;
}

/* ==========================================================================
   Toast Notification Popups
   ========================================================================== */

.toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  background: var(--text);
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 980px;
  opacity: 0;
  transform: translateY(16px);
  transition: var(--transition-tactile);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  font-size: 14px;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Dynamic Policy Wizard & Progress Indicators
   ========================================================================== */

.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 36px;
  position: relative;
  background: rgba(0, 0, 0, 0.015);
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--line-subtle);
}

.stepper .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  position: relative;
  flex: 1;
}

.stepper .step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 500;
  font-size: 13px;
  border: 2px solid var(--card);
  transition: var(--transition-tactile);
}

.stepper .step-label {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  transition: var(--transition-tactile);
}

.stepper .step-line {
  height: 2px;
  background: var(--line-subtle);
  flex-grow: 1;
  position: relative;
  top: -15px;
  margin: 0 -24px;
  z-index: 1;
  transition: var(--transition-tactile);
}

.stepper .step.active .step-icon {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.stepper .step.active .step-label {
  color: var(--text);
  font-weight: 600;
}

.stepper .step-line.active {
  background: var(--brand);
}

/* Form Wizard Cards */
.wizard-form .wizard-step {
  display: none;
}

.wizard-form .wizard-step.active {
  display: block;
  animation: fadeIn 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.step-card {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.step-card h3 {
  margin-top: 0;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line-subtle);
  padding-bottom: 16px;
  font-weight: 600;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px;
}

@media (max-width: 992px) {
  .fields-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .fields-grid { grid-template-columns: 1fr; }
}

/* Wizard Buttons Container */
.wizard-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  background: rgba(0, 0, 0, 0.015);
  padding: 18px 28px;
  border-radius: 20px;
  border: 1px solid var(--line-subtle);
}

.wizard-navigation button {
  padding: 12px 32px;
  border-radius: 980px;
}

.wizard-navigation .btn-prev {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line-subtle);
}

.wizard-navigation .btn-prev:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
}

.wizard-navigation .btn-prev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Inputs Read-only overrides */
.readonly-input {
  background: #fafafa !important;
  color: var(--muted) !important;
  border-style: solid !important;
  border-color: var(--line) !important;
  cursor: not-allowed;
}

/* Cost Totals Layout */
.fields-grid-cost {
  grid-template-columns: repeat(2, 1fr) !important;
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .fields-grid-cost { grid-template-columns: 1fr !important; }
}

.total-label {
  grid-column: span 2;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

@media (max-width: 640px) {
  .total-label { grid-column: span 1; }
}

.total-cost-input {
  font-size: 1.8rem !important;
  font-weight: 700 !important;
  color: var(--success) !important;
  background: rgba(52, 199, 89, 0.05) !important;
  border: 1px solid rgba(52, 199, 89, 0.2) !important;
  text-align: center;
  padding: 16px !important;
  border-radius: 12px !important;
}

/* ==========================================================================
   Modal Dialog Layouts & Backdrop Filters
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 24px;
}

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

.modal-content {
  background: var(--card);
  padding: 36px 28px;
  border-radius: 24px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  position: relative;
  direction: rtl;
  animation: scaleUpModal 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  font-weight: 700;
  font-size: 1.2rem;
}

.modal-close-btn {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: var(--transition-tactile);
  padding: 0;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

@keyframes scaleUpModal {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Timeline (Logs Diagnostic tool)
   ========================================================================== */

.timeline {
  position: relative;
  padding: 10px 0;
  list-style: none;
  margin: 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
  right: 20px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
  padding-right: 48px;
  direction: rtl;
}

.timeline-badge {
  position: absolute;
  top: 0;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  border: 3px solid var(--card);
  z-index: 2;
}

.timeline-item.success .timeline-badge {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
}

.timeline-item.danger .timeline-badge {
  background: rgba(255, 69, 58, 0.1);
  color: var(--danger);
}

.timeline-item.warning .timeline-badge {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

.timeline-panel {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.timeline-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.timeline-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.timeline-time {
  font-size: 11px;
  color: var(--muted);
}

.timeline-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.timeline-code-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.timeline-code-btn:hover {
  text-decoration: underline;
}

.timeline-code-block {
  display: none;
  background: #1c1c1e;
  color: #58a6ff;
  padding: 14px;
  border-radius: 10px;
  font-family: monospace;
  font-size: 12px;
  overflow-x: auto;
  margin-top: 10px;
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-code-block.active {
  display: block;
}

/* ==========================================================================
   Sleek Stats Cards (Reports/SaaS Style)
   ========================================================================== */

.reports-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.reports-header h2 {
  margin: 0 !important;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-weight: 600;
  color: var(--muted);
}

.filter-group select {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: #ffffff;
  cursor: pointer;
  min-width: 180px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  align-items: center;
  padding: 28px;
  border-radius: 20px;
  background: #ffffff !important;
  color: var(--text) !important;
  border: 1px solid var(--line-subtle);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-tactile);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  display: none; /* Strip decorative background reflections */
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 26px;
  margin-left: 20px;
  opacity: 1;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.daily-card .stat-icon {
  color: var(--brand) !important;
  background: var(--brand-light);
}

.monthly-card .stat-icon {
  color: var(--success) !important;
  background: rgba(52, 199, 89, 0.08);
}

.yearly-card .stat-icon {
  color: #ff9500 !important;
  background: rgba(255, 149, 0, 0.08);
}

.stat-info {
  flex-grow: 1;
}

.stat-info h3 {
  margin: 0 0 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.stat-value {
  margin: 0 0 6px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.stat-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.reports-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
}

.breakdown-card {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.breakdown-card h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-weight: 700;
}

.sync-status-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sync-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-item-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.sync-bar-bg {
  height: 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 99px;
  overflow: hidden;
}

.sync-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.sync-bar-success { background: var(--success); }
.sync-bar-failed { background: var(--danger); }
.sync-bar-pending { background: #ff9500; }

.branch-perf-row:hover {
  background-color: #fafafa;
}

/* ==========================================================================
   Policy Document Canvas Visual Template Editor
   ========================================================================== */

.editor-modal-content {
  max-width: 1200px !important;
  width: 95vw !important;
  height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 24px !important;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.editor-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

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

.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #f5f5f7;
  direction: rtl;
}

.editor-canvas-container {
  flex: 1;
  padding: 32px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.editor-canvas {
  position: relative;
  width: 600px;
  aspect-ratio: 210 / 297;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  user-select: none;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.editor-sidebar {
  width: 360px;
  background: var(--card);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 24px;
  gap: 24px;
  direction: rtl;
}

.editor-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-top: 20px !important;
  margin-bottom: 14px !important;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  text-align: right;
  direction: rtl;
}

/* Draggable Overlays Canvas markers */
.draggable-item {
  position: absolute;
  cursor: move;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: rgba(0, 113, 227, 0.08);
  outline: 1px dashed var(--brand);
  outline-offset: 2px;
  color: var(--brand);
  white-space: nowrap;
  user-select: none;
  z-index: 10;
  direction: rtl;
  line-height: 1.2;
}

.draggable-item.active {
  background: rgba(52, 199, 89, 0.12) !important;
  outline: 2px solid var(--success) !important;
  outline-offset: 2px;
  box-shadow: 0 0 12px rgba(52, 199, 89, 0.2);
  z-index: 20;
}

.draggable-item.preview-mode {
  background: transparent !important;
  outline: 1px dashed transparent !important;
  box-shadow: none !important;
  cursor: move !important;
  padding: 0 !important;
}

.draggable-item.preview-mode:hover {
  outline: 1px dashed rgba(0, 113, 227, 0.4) !important;
  background: rgba(0, 113, 227, 0.04) !important;
  outline-offset: 2px;
}

.draggable-item.preview-mode.active {
  outline: 1px solid var(--success) !important;
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.3) !important;
  outline-offset: 2px;
}

.qr-code-draggable {
  position: absolute;
  cursor: move;
  outline: 2px dashed #af52de;
  outline-offset: -2px;
  background: rgba(175, 82, 222, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #af52de;
  z-index: 15;
  border: none !important;
}

.qr-code-draggable.active {
  outline: 2px solid var(--success) !important;
  outline-offset: -2px;
  background: rgba(52, 199, 89, 0.12) !important;
  border: none !important;
}

.qr-code-draggable.preview-mode {
  outline: 2px dashed transparent !important;
  background: transparent !important;
  cursor: move !important;
  border: none !important;
}

.qr-code-draggable.preview-mode:hover {
  outline: 1.5px dashed rgba(175, 82, 222, 0.4) !important;
  background: rgba(175, 82, 222, 0.04) !important;
  outline-offset: -1.5px;
  border: none !important;
}

.qr-code-draggable.preview-mode.active {
  outline: 2px solid var(--success) !important;
  outline-offset: -2px;
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.3) !important;
  border: none !important;
}

/* Canvas Fields & Versions Layout */
.sidebar-fields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  min-height: 180px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg);
}

.sidebar-versions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  min-height: 120px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--bg);
  scrollbar-width: thin;
}

.fields-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text) !important;
  cursor: pointer;
  transition: var(--transition-tactile);
  text-align: right;
}

.fields-list-item span,
.fields-list-item strong {
  color: var(--text);
}

.fields-list-item:hover {
  background: var(--brand-light);
  border-color: var(--brand);
}

.fields-list-item.selected {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

.fields-list-item.selected,
.fields-list-item.selected span,
.fields-list-item.selected strong {
  color: #ffffff !important;
}

.fields-list-item.selected .field-coords {
  color: rgba(255, 255, 255, 0.8) !important;
}

.field-coords {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}

.field-config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.field-config-form label {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.nudge-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 120px;
  margin: 0 auto;
}

.nudge-btn {
  background: rgba(0, 0, 0, 0.04);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-tactile);
}

.nudge-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.nudge-btn:active {
  background: rgba(0, 0, 0, 0.15);
  transform: scale(0.92);
}

.nudge-up { grid-column: 2; }
.nudge-left { grid-column: 1; grid-row: 2; }
.nudge-right { grid-column: 3; grid-row: 2; }
.nudge-down { grid-column: 2; grid-row: 3; }

.font-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upload-label-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-tactile);
  gap: 8px;
}

.upload-label-btn:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
}

.upload-input-hidden {
  display: none;
}

/* ── Snapshots History Items ────────────────────────────── */
.version-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-subtle);
  background: var(--card);
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-tactile);
}

.version-history-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--line-subtle);
  transition: background 0.2s;
}

.version-history-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(0, 0, 0, 0.15);
}

.version-history-item.version-active {
  border-color: var(--brand);
  background: rgba(0, 113, 227, 0.02);
}

.version-history-item.version-active::before {
  background: var(--brand);
}

.version-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.version-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.version-date {
  font-size: 11px;
  color: var(--muted);
}

.version-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--success);
  background: rgba(52, 199, 89, 0.08);
  border: 1px solid rgba(52, 199, 89, 0.15);
  border-radius: 20px;
  padding: 2px 8px;
  margin-top: 4px;
  width: fit-content;
}

.version-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.version-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition-tactile);
  box-shadow: none;
  flex-shrink: 0;
}

.version-action-btn:hover {
  transform: scale(1.08);
  opacity: 0.95;
  box-shadow: var(--shadow-sm);
}

.version-action-btn:active {
  transform: scale(0.92);
}

.version-action-btn.preview-version-btn {
  background: var(--brand-light);
  color: var(--brand);
}

.version-action-btn.activate-version-btn {
  background: rgba(52, 199, 89, 0.08);
  color: var(--success);
}

.version-action-btn.delete-version-btn {
  background: rgba(255, 69, 58, 0.08);
  color: var(--danger);
}

/* Advanced Forms Accordions */
.form-section-card {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-tactile);
}

.form-section-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
}

.form-section-header {
  padding: 18px 24px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--line-subtle);
}

.form-section-header::after {
  content: "▼";
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.form-section-card.collapsed .form-section-header::after {
  transform: rotate(90deg);
}

.form-section-card.collapsed .form-section-body {
  display: none;
}

.form-section-body {
  padding: 24px;
}

.repeater-group-card {
  background: #fafafa;
  border: 1px dashed var(--line-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
}

.repeater-entries-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.repeater-entry-row {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.repeater-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line-subtle);
  padding-bottom: 10px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

/* Workflow Stage Status Badges */
.workflow-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 980px;
  font-size: 11.5px;
  font-weight: 700;
}

.workflow-badge.draft {
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
}

.workflow-badge.branch_review, .workflow-badge.review, .workflow-badge.pending_review {
  background: rgba(255, 149, 0, 0.08);
  color: #ff9500;
}

.workflow-badge.manager_approval {
  background: var(--brand-light);
  color: var(--brand);
}

.workflow-badge.active, .workflow-badge.approved {
  background: rgba(52, 199, 89, 0.08);
  color: var(--success);
}

.workflow-badge.rejected {
  background: rgba(255, 69, 58, 0.08);
  color: var(--danger);
}

.builder-advanced-settings-btn {
  color: var(--brand);
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.builder-advanced-settings-btn:hover {
  text-decoration: underline;
}

.builder-advanced-panel {
  background: #ffffff;
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  padding: 18px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   Premium Left Sidebar Grid Navigation (RTL Admin Layout)
   ========================================================================== */

/* Remove standard widths for Admin role */
/* Remove standard widths for Admin and System roles */
body.dashboard-page[data-role="admin"],
body.dashboard-page[data-role="system"],
body.dashboard-page[data-role="branch"] {
  max-width: none;
  padding: 0;
  margin: 0;
  background: var(--bg);
}

body.dashboard-page[data-role="admin"] .app-container,
body.dashboard-page[data-role="system"] .app-container,
body.dashboard-page[data-role="branch"] .app-container {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

/* Premium flat sidebar styling */
body.dashboard-page[data-role="admin"] .sidebar,
body.dashboard-page[data-role="system"] .sidebar,
body.dashboard-page[data-role="branch"] .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #1c1c1e; /* Deep Charcoal-black surface */
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  z-index: 100;
  overflow: hidden;
}

.sidebar-brand {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 24px;
  text-align: center;
}

.sidebar-brand h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-brand .badge {
  display: inline-block;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0, 113, 227, 0.2);
}

/* User avatar details block */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px;
  border-radius: 14px;
  margin-bottom: 28px;
  transition: var(--transition-tactile);
}

.profile-avatar {
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.05);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-inline-end: 4px;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.menu-category {
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 22px;
  margin-bottom: 8px;
  padding: 0 10px;
}

.menu-category:first-of-type {
  margin-top: 0;
}

/* Sidebar navigation buttons */
.sidebar-menu .tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: right;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-tactile);
  margin: 0;
  box-shadow: none;
}

.sidebar-menu .tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.sidebar-menu .tab.active {
  background: rgba(255, 255, 255, 0.08); /* Flat translucent highlight */
  color: #ffffff;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Main workspace area */
body.dashboard-page[data-role="admin"] .main-layout,
body.dashboard-page[data-role="system"] .main-layout,
body.dashboard-page[data-role="branch"] .main-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

body.dashboard-page[data-role="admin"] .main-layout > .topbar,
body.dashboard-page[data-role="system"] .main-layout > .topbar,
body.dashboard-page[data-role="branch"] .main-layout > .topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(245, 245, 247, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 0;
  border-radius: 0;
  border-inline: none;
  border-top: none;
  border-bottom: 1px solid var(--line);
  padding: 18px 40px;
  box-shadow: none;
}

body.dashboard-page[data-role="admin"] .app-container > main,
body.dashboard-page[data-role="system"] .app-container > main,
body.dashboard-page[data-role="branch"] .app-container > main {
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Navigation responsive grid stacking for tablets/mobiles */
@media (max-width: 1024px) {
  body.dashboard-page[data-role="admin"] .app-container,
  body.dashboard-page[data-role="system"] .app-container,
  body.dashboard-page[data-role="branch"] .app-container {
    grid-template-columns: 1fr;
  }

  body.dashboard-page[data-role="admin"] .sidebar,
  body.dashboard-page[data-role="system"] .sidebar,
  body.dashboard-page[data-role="branch"] .sidebar {
    position: relative;
    height: auto;
    width: 100%;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 20px;
  }

  body.dashboard-page[data-role="admin"] .sidebar-profile,
  body.dashboard-page[data-role="system"] .sidebar-profile,
  body.dashboard-page[data-role="branch"] .sidebar-profile {
    margin-bottom: 20px;
  }

  body.dashboard-page[data-role="admin"] .main-layout > .topbar,
  body.dashboard-page[data-role="system"] .main-layout > .topbar,
  body.dashboard-page[data-role="branch"] .main-layout > .topbar {
    position: relative;
    padding: 18px 24px;
  }

  body.dashboard-page[data-role="admin"] .app-container > main,
  body.dashboard-page[data-role="system"] .app-container > main,
  body.dashboard-page[data-role="branch"] .app-container > main {
    padding: 24px;
  }
}

/* Sidebar navigation icon transitions */
.sidebar-menu .tab i {
  width: 20px;
  font-size: 15px;
  text-align: center;
  margin-left: 10px;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s ease;
}

.sidebar-menu .tab:hover i {
  transform: scale(1.08) translateY(-0.5px);
  color: #ffffff;
}

.sidebar-menu .tab.active i {
  color: #ffffff;
}

.profile-avatar i {
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.3s ease;
}

.sidebar-profile:hover .profile-avatar i {
  color: var(--brand);
}

/* ==========================================================================
   Premium Glassmorphic Authentication Page
   ========================================================================== */

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at top right, rgba(0, 113, 227, 0.03), transparent 40%),
              radial-gradient(circle at bottom left, rgba(52, 199, 89, 0.02), transparent 40%),
              var(--bg);
  min-height: 100vh;
  margin: 0;
  padding: 24px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 28px;
  padding: 48px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.03),
              0 4px 12px rgba(0, 0, 0, 0.01);
  text-align: center;
  animation: scaleUpModal 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.auth-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  object-fit: contain;
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.auth-card p.muted {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
}

/* Auth forms grid overrides for premium spacing */
.auth-card .form-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: right;
}

.auth-card label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.auth-card input {
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--line-subtle);
  font-size: 15px;
}

.auth-card input:focus {
  background: #ffffff;
  border-color: var(--brand);
}

.auth-card button[type="submit"] {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.15);
}

.auth-card button[type="submit"]:hover {
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.25);
}

.auth-card .message {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  min-height: 20px;
}

/* Responsive adjustments for step wizards to prevent horizontal scroll on mobile */
@media (max-width: 768px) {
  .stepper {
    padding: 16px 12px !important;
    gap: 8px !important;
  }
  .stepper .step-label {
    display: none !important; /* Hide labels to conserve space */
  }
  .stepper .step-line {
    top: -16px !important;
    margin: 0 -8px !important;
  }
}

/* Pulsing Welcome Logo Animation */
@keyframes logoPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(0, 113, 227, 0));
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 15px rgba(0, 113, 227, 0.15));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(0, 113, 227, 0));
  }
}

.pulsing-logo {
  animation: logoPulse 3s infinite ease-in-out;
}

/* Welcome Section display states */
#welcome-section {
  display: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

#welcome-section.active {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 60vh !important;
  text-align: center !important;
  animation: fadeIn 0.8s ease-out !important;
}

/* macOS-style Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Soft light grey radial backlight glow behind the logo (macOS UI style) */
.loading-content::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(230, 230, 230, 0.85) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  z-index: 1;
  animation: bgPulse 2s infinite ease-in-out;
}

.loading-logo {
  position: relative;
  z-index: 2;
  width: 130px;
  height: auto;
  animation: loadingPulse 2s infinite ease-in-out;
}

@keyframes bgPulse {
  0% {
    transform: scale(0.8);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.95;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.4;
  }
}

@keyframes loadingPulse {
  0% {
    transform: scale(0.97);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.03));
  }
  50% {
    transform: scale(1.03);
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.08));
  }
  100% {
    transform: scale(0.97);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.03));
  }
}

/* ==========================================================================
   Advanced Business Intelligence Dashboard (macOS style)
   ========================================================================== */
.company-wide-only {
  display: none !important;
}
body[data-role="admin"] .company-wide-only,
body[data-role="system"] .company-wide-only {
  display: block !important;
}
div.company-wide-only,
section.company-wide-only {
  display: none; /* Javascript overrides display */
}

.kpi-card-modern {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-tactile);
}
.kpi-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.kpi-header i {
  font-size: 16px;
}
.kpi-card-modern h3 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 10px 0;
  color: var(--text);
  letter-spacing: -0.02em;
}
.kpi-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.growth-indicator {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 6px;
}
.growth-indicator.positive {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
}
.growth-indicator.negative {
  background: rgba(255, 69, 58, 0.1);
  color: var(--danger);
}
.period-text {
  color: var(--muted);
}
.bold-text {
  font-weight: 700;
  color: var(--text);
}

.color-brand { color: var(--brand); }
.color-success { color: var(--success); }
.color-danger { color: var(--danger); }
.color-orange { color: #ff9500; }
.color-purple { color: #af52de; }
.color-teal { color: #5ac8fa; }
.color-yellow { color: #ffcc00; }
.color-blue { color: #0071e3; }

.chart-card-modern, .analytics-card-modern {
  background: var(--card);
  border: 1px solid var(--line-subtle);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-tactile);
}
.chart-card-modern:hover, .analytics-card-modern:hover {
  box-shadow: var(--shadow-md);
}

.premium-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  text-align: right;
}
.premium-table th {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line-subtle);
  background: rgba(0, 0, 0, 0.01);
}
.premium-table td {
  padding: 14px;
  font-size: 13.5px;
  color: var(--text);
  border-bottom: 1px solid var(--line-subtle);
  transition: background 0.2s;
}
.premium-table tr:hover td {
  background: rgba(0, 113, 227, 0.02);
}

.issue-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.issue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.issue-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
.issue-desc {
  font-weight: 600;
  color: var(--text);
}
.issue-meta {
  font-size: 11.5px;
  color: var(--muted);
}

/* Claims Management Badges */
.badge-reported {
  background: rgba(0, 113, 227, 0.1);
  color: var(--brand);
}
.badge-under_investigation {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}
.badge-approved {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
}
.badge-rejected {
  background: rgba(255, 69, 58, 0.1);
  color: var(--danger);
}
.badge-settled {
  background: rgba(90, 200, 250, 0.1);
  color: #00a3e0;
}

/* Claims Stepper progress bar */
.claim-stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin: 24px 0;
  padding: 0 10px;
}
.claim-stepper::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--line-subtle);
  transform: translateY(-50%);
  z-index: 1;
}
.claim-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  position: relative;
  background: var(--card);
  padding: 0 12px;
}
.claim-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line-subtle);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.3s ease;
  border: 3px solid var(--card);
}
.claim-step.active .claim-step-circle {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.claim-step.completed .claim-step-circle {
  background: var(--success);
  color: #fff;
}
.claim-step-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
}
.claim-step.active .claim-step-label {
  color: var(--text);
  font-weight: 700;
}
.claim-step.completed .claim-step-label {
  color: var(--success);
}

/* Claims Timeline comments */
.claim-notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding: 4px;
  margin-top: 10px;
}
.claim-note-card {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
}
.claim-note-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.claim-note-content {
  color: var(--text);
  line-height: 1.4;
}

/* Print and PDF Export Stylesheet */
@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Cairo', system-ui, sans-serif !important;
  }
  
  /* Hide interface elements that shouldn't be printed */
  .sidebar,
  .topbar,
  .tabs,
  #reports-refresh-btn,
  .filter-bar,
  .no-print,
  .action-menu,
  .dropdown,
  button,
  .btn,
  .pagination-container,
  .toast,
  .modal {
    display: none !important;
  }
  
  /* Force main content container to take full width and clear margins */
  .main-content,
  main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  
  /* Make sure only the active reports panel is displayed and others are hidden */
  .panel {
    display: none !important;
  }
  
  .panel#overview-reports.active,
  .panel#overview-reports {
    display: block !important;
    width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Style dashboard widgets cleanly for printing */
  .kpi-card-modern,
  .chart-card-modern,
  .analytics-card-modern,
  .card {
    border: 1px solid #e0e0e0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-bottom: 16px !important;
    padding: 16px !important;
    border-radius: 12px !important;
  }
  
  /* Re-format grid systems to fit the page horizontally */
  .kpis-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  
  .charts-grid-modern {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
  }
  
  .leaderboards-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
  }
  
  /* Audit logs and data tables formatting */
  .premium-table,
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 11px !important;
  }
  
  .premium-table th,
  table th {
    background: #f5f5f5 !important;
    color: #000000 !important;
    border-bottom: 2px solid #333333 !important;
    padding: 8px !important;
  }
  
  .premium-table td,
  table td {
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 8px !important;
    color: #333333 !important;
  }
  
  /* Prevent table rows from breaking awkwardly across pages */
  tr {
    keep-together: always !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  
  /* Typography optimization for print */
  h2, h3, h4 {
    color: #000000 !important;
    margin-top: 0 !important;
  }
  
  /* Ensure charts rendering scale holds up */
  canvas {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Sidebar menu accordion styling */
.menu-category.clickable-category {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: color 0.2s ease !important;
  margin-top: 22px !important;
  margin-bottom: 8px !important;
  padding: 0 10px !important;
}
.menu-category.clickable-category:hover {
  color: #ffffff !important;
}
.menu-category.clickable-category:first-of-type {
  margin-top: 0 !important;
}
.menu-category.clickable-category .arrow-icon {
  font-size: 10px !important;
  transition: transform 0.2s ease !important;
  transform: rotate(90deg) !important; /* Points left in RTL when closed */
}
.menu-category.clickable-category.open .arrow-icon {
  transform: rotate(0deg) !important; /* Points down when open */
}

/* Category icon and title alignments */
.category-title-wrapper {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}
.category-title-wrapper .category-icon {
  font-size: 14px !important;
  opacity: 0.95 !important;
  width: 18px !important;
  text-align: center !important;
}

/* Category items container - robust toggling */
.menu-category-items {
  display: none !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin-top: 0 !important;
}
.menu-category-items.open {
  display: flex !important;
  margin-top: 6px !important;
}

/* Ensure topbar is positioned relatively so that absolute centering is correct */
.topbar {
  position: relative !important;
}

/* Topbar profile pill card - absolute centering */
.topbar-profile {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding: 6px 14px !important;
  border-radius: 12px !important;
  transition: var(--transition-tactile) !important;
  direction: rtl !important;
}
.topbar-profile:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}
.topbar-profile .profile-avatar {
  font-size: 1.2rem !important;
  background: rgba(0, 0, 0, 0.05) !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}
.topbar-profile .profile-avatar i {
  color: rgba(0, 0, 0, 0.5) !important;
  transition: color 0.3s ease !important;
}
.topbar-profile:hover .profile-avatar i {
  color: var(--brand) !important;
}
.topbar-profile .profile-info {
  display: flex !important;
  flex-direction: column !important;
  text-align: right !important;
}
.topbar-profile .profile-info span {
  line-height: 1.2 !important;
}

/* Sidebar nested subcategories styling */
.subcategory-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 8px 12px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  margin-bottom: 4px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  color: rgba(255, 255, 255, 0.75) !important;
}

.subcategory-header:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.subcategory-header span {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.subcategory-header .sub-arrow {
  color: rgba(255, 255, 255, 0.4) !important;
}

.subcategory-header:hover .sub-arrow {
  color: #ffffff !important;
}




