/*
===============================================================================
  ZYNOQ DESIGN SYSTEM - v1.0
  Master stylesheet for all Zynoq templates
  Location: /css/zynoq.css
===============================================================================
*/

/* ========== CSS VARIABLES (design tokens) ========== */
:root {
  /* Brand colours */
  --zq-primary: #0F3F87;
  --zq-primary-dark: #0A2F66;
  --zq-primary-light: #E8EFFA;
  --zq-accent: #F39F0D;
  --zq-accent-dark: #E88800;
  --zq-accent-light: #FEF3E0;

  /* Semantic */
  --zq-success: #10B981;
  --zq-success-light: #D1FAE5;
  --zq-danger: #EF4444;
  --zq-danger-light: #FEE2E2;
  --zq-warning: #F59E0B;
  --zq-warning-light: #FEF3C7;
  --zq-info: #3B82F6;
  --zq-info-light: #DBEAFE;

  /* Neutrals */
  --zq-bg: #F7F8FB;
  --zq-surface: #FFFFFF;
  --zq-border: #E5E9F0;
  --zq-border-strong: #CBD4E0;
  --zq-text-primary: #1A2744;
  --zq-text-secondary: #5A6785;
  --zq-text-muted: #8B95AB;

  /* Pipeline stage colours */
  --stage-enquiry: #94A3B8;
  --stage-opportunity: #10B981;
  --stage-followup: #3B82F6;
  --stage-hold: #F59E0B;
  --stage-won: #EF4444;
  --stage-lost: #8B5CF6;
  --stage-disqualified: #6B7280;

  /* Lead temperature */
  --hot: #EF4444;
  --warm: #F59E0B;
  --cold: #3B82F6;

  /* Worth Amount Color */
  --zq-worth-color: var(--zq-primary);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 63, 135, 0.04), 0 1px 1px rgba(15, 63, 135, 0.03);
  --shadow-md: 0 4px 12px rgba(15, 63, 135, 0.06), 0 2px 4px rgba(15, 63, 135, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 63, 135, 0.08), 0 4px 12px rgba(15, 63, 135, 0.05);

  /* Typography */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Selection & Hover */
  --zq-selection-bg: #bfdbfe;
  --zq-hover-bg: #ebf3ff;
}

/* ========== DARK MODE OVERRIDES ========== */
[data-theme="dark"] {
  color-scheme: dark;
  --zq-primary-light: #1B2B4F;
  --zq-accent-light: #3A2A0F;

  --zq-success-light: #0E3B2C;
  --zq-danger-light: #3D1818;
  --zq-warning-light: #3A2810;
  --zq-info-light: #15263F;

  --zq-bg: #0F1623;
  --zq-surface: #1A2333;
  --zq-border: #2A3344;
  --zq-border-strong: #3D4759;
  --zq-text-primary: #E8ECF3;
  --zq-text-secondary: #9AA5BC;
  --zq-text-muted: #6B7689;

  --zq-worth-color: #eda303;

  --zq-selection-bg: rgba(59, 130, 246, 0.15);
  --zq-hover-bg: rgba(255, 255, 255, 0.04);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ========== TOP HORIZONTAL NAV (combined with topbar — logo + nav + icons) ========== */
.zq-topnav {
  background: var(--zq-surface);
  border-bottom: 1px solid var(--zq-border);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 0;
  z-index: 39;
  height: 64px;
}

.zq-topnav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--zq-primary);
  letter-spacing: -0.02em;
  margin-right: var(--space-6);
  flex-shrink: 0;
}

[data-theme="dark"] .zq-topnav-logo { color: var(--zq-text-primary); }

.zq-topnav-spacer { flex: 1; }

.zq-topnav-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
  flex-shrink: 0;
}

.zq-topnav::-webkit-scrollbar { height: 0; }

.zq-topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--zq-text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: all 0.15s ease;
}



.zq-topnav-item.active {
  background: #eda303 !important;
  color: #111827 !important;
  border-radius: 8px;
}

.zq-topnav-item i { font-size: 14px; }

[data-theme="dark"] .zq-topnav-item.active {
  background: #eda303 !important;
  color: #111827 !important;
  border-radius: 8px;
}

/* Global Hover overrides - placed after active for precedence */
.zq-topnav-item:hover {
  background: var(--zq-primary-light) !important;
  color: var(--zq-primary) !important;
}

[data-theme="dark"] .zq-topnav-item:hover {
  background: #2A364E !important;
  color: #FFFFFF !important;
  border-radius: 8px;
}

/* Theme toggle button */
.zq-theme-toggle .bi-moon-fill { display: inline; }
.zq-theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .zq-theme-toggle .bi-moon-fill { display: none; }
[data-theme="dark"] .zq-theme-toggle .bi-sun-fill { display: inline; }

@media (max-width: 768px) {
  .zq-topnav { padding: 0 var(--space-4); }
  .zq-topnav-item { padding: 12px 12px; font-size: 13px; }
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--zq-text-primary);
  background: var(--zq-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--zq-primary); text-decoration: none; }
a:hover { color: var(--zq-primary-dark); }
button { font-family: inherit; cursor: pointer; }

/* ========== LAYOUT ========== */
.zq-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.zq-content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.zq-main {
  padding: var(--space-6);
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ========== SIDEBAR (for inner pages) ========== */
.zq-sidebar {
  width: 240px;
  background: var(--zq-surface);
  border-right: 1px solid var(--zq-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 50;
}

.zq-sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--zq-border);
}

.zq-sidebar-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--zq-primary);
  letter-spacing: -0.02em;
}

.zq-logo-bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--zq-accent) 0%, var(--zq-accent-dark) 100%);
  color: white;
  border-radius: 8px;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(243, 159, 13, 0.3);
}

.zq-sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.zq-sidebar-section {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--zq-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.zq-sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--zq-text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
}

.zq-sidebar-item:hover {
  background: var(--zq-primary-light);
  color: var(--zq-primary);
}

.zq-sidebar-item.active {
  background: #eda303 !important;
  color: #111827 !important;
}

.zq-sidebar-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.zq-sidebar-badge {
  margin-left: auto;
  background: var(--zq-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.zq-sidebar-item.active .zq-sidebar-badge {
  background: rgba(255, 255, 255, 0.25);
}

.zq-sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--zq-border);
}

/* ========== TOP BAR ========== */
.zq-topbar {
  background: var(--zq-surface);
  border-bottom: 1px solid var(--zq-border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 40;
}

.zq-topbar-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--zq-border);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--zq-text-secondary);
}

.zq-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.zq-search input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 38px;
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-sm);
  background: var(--zq-bg);
  font-family: inherit;
  font-size: 13px;
  color: var(--zq-text-primary);
  transition: all 0.15s ease;
}

.zq-search input:focus {
  outline: none;
  border-color: var(--zq-primary);
  background: var(--zq-surface);
  box-shadow: 0 0 0 3px rgba(15, 63, 135, 0.08);
}

.zq-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--zq-text-muted);
  font-size: 14px;
}

.zq-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.zq-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--zq-border);
  background: var(--zq-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--zq-text-secondary);
  transition: all 0.15s ease;
  position: relative;
}

.zq-icon-btn:hover {
  background: var(--zq-primary-light);
  color: var(--zq-primary);
  border-color: var(--zq-primary-light);
}

.zq-btn-quick-add {
  background-color: #eda303 !important;
  color: #1A2744 !important; /* Brand dark/black */
  border-color: #eda303 !important;
}

.zq-btn-quick-add i {
  font-weight: 800 !important;
  -webkit-text-stroke: 1px #1A2744;
}

.zq-btn-quick-add:hover {
  background-color: var(--zq-primary-light) !important;
  border-color: var(--zq-primary-light) !important;
  color: var(--zq-primary) !important;
}

.zq-btn-quick-add:hover i {
  -webkit-text-stroke: 1px var(--zq-primary);
}

[data-theme="dark"] .zq-btn-quick-add:hover {
  background-color: #2A364E !important;
  border-color: #2A364E !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .zq-btn-quick-add:hover i {
  -webkit-text-stroke: 1px #FFFFFF;
}

.zq-badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--zq-danger);
  border-radius: 50%;
  border: 2px solid var(--zq-surface);
}

.zq-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--zq-primary) 0%, var(--zq-primary-dark) 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ========== PAGE HEADER ========== */
.zq-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.zq-page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
  color: var(--zq-text-primary);
}

.zq-page-subtitle {
  color: var(--zq-text-secondary);
  font-size: 14px;
  margin: 0;
}

.zq-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--zq-text-muted);
  margin-bottom: 6px;
}

.zq-breadcrumb a:hover { color: var(--zq-primary); }
.zq-breadcrumb i { font-size: 10px; }

/* ========== BUTTONS ========== */
.zq-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  font-family: var(--font-display);
}

.zq-btn-primary {
  background: var(--zq-primary);
  color: white;
}

.zq-btn-primary:hover {
  background: var(--zq-primary-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 63, 135, 0.25);
}

[data-theme="dark"] .zq-btn-primary:hover {
  background: #2563EB;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.zq-btn-secondary {
  background: var(--zq-surface);
  color: var(--zq-text-primary);
  border-color: var(--zq-border);
}

.zq-btn-secondary:hover {
  background: var(--zq-primary-light);
  border-color: var(--zq-primary-light);
  color: var(--zq-primary);
}

[data-theme="dark"] .zq-btn-secondary:hover {
  background: #25334D;
  border-color: #25334D;
  color: #FFFFFF;
}

.zq-btn-accent {
  background: var(--zq-accent);
  color: white;
}

.zq-btn-accent:hover {
  background: var(--zq-accent-dark);
  box-shadow: 0 4px 12px rgba(243, 159, 13, 0.3);
  color: white;
}

.zq-btn-danger {
  background: var(--zq-danger);
  color: white;
}

.zq-btn-danger:hover {
  background: #DC2626;
  color: white;
}

.zq-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.zq-btn-lg {
  padding: 12px 22px;
  font-size: 14.5px;
}

.zq-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.zq-btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
}

.zq-btn-icon-only i {
  font-size: 1.1rem;
  margin: 0;
}

/* ========== CARDS ========== */
.zq-card {
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.zq-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5);
  border-bottom: 1px solid var(--zq-border);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.zq-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--zq-text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.zq-card-subtitle {
  font-size: 12px;
  color: var(--zq-text-secondary);
  margin: 2px 0 0 0;
}

.zq-card-body { padding: var(--space-5); }
.zq-card-body.no-pad { padding: 0; }

/* ========== METRIC CARDS ========== */
.zq-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.zq-metric {
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all 0.2s ease;
}

.zq-metric:hover {
  border-color: var(--zq-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Dashboard Action Banners */
.zq-action-banner {
  grid-column: span 4;
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .zq-metrics { grid-template-columns: repeat(2, 1fr); }
  .zq-action-banner { grid-column: span 2; }
}

@media (max-width: 640px) {
  .zq-metrics { grid-template-columns: 1fr; }
  .zq-action-banner { grid-column: span 1; }
}

.zq-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.zq-metric-label {
  font-size: 13px;
  color: var(--zq-text-secondary);
  font-weight: 500;
}

.zq-metric-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.zq-metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--zq-text-primary);
  margin: 0 0 4px 0;
  line-height: 1.1;
}

.zq-metric-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.zq-metric-change.up { color: var(--zq-success); background: var(--zq-success-light); }
.zq-metric-change.down { color: var(--zq-danger); background: var(--zq-danger-light); }

/* ========== GRIDS ========== */
.zq-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); margin-bottom: var(--space-5); }
.zq-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-bottom: var(--space-5); }
.zq-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); margin-bottom: var(--space-5); }
.zq-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5); margin-bottom: var(--space-5); }
.zq-grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-5); margin-bottom: var(--space-5); }

/* ========== BADGES ========== */
.zq-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.zq-badge-hot { background: var(--zq-danger-light); color: var(--hot); }
.zq-badge-warm { background: var(--zq-warning-light); color: var(--warm); }
.zq-badge-cold { background: var(--zq-info-light); color: var(--cold); }
.zq-badge-high { background: var(--zq-danger-light); color: var(--zq-danger); }
.zq-badge-medium { background: var(--zq-warning-light); color: var(--zq-warning); }
.zq-badge-low { background: var(--zq-info-light); color: var(--zq-info); }
.zq-badge-success { background: var(--zq-success-light); color: var(--zq-success); }
.zq-badge-neutral { background: var(--zq-border); color: var(--zq-text-secondary); }

/* Pipeline stage badges */
.zq-stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--stage-color, var(--zq-primary));
  color: white;
}

/* ========== TABLES ========== */
.zq-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.zq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.zq-table thead th {
  text-align: left;
  padding: 12px var(--space-4);
  background: var(--zq-bg);
  color: var(--zq-text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--zq-border);
  white-space: nowrap;
}

.zq-table tbody td {
  padding: 14px var(--space-4);
  border-bottom: 1px solid var(--zq-border);
  color: var(--zq-text-primary);
  vertical-align: middle;
}

.zq-table tbody tr:last-child td { border-bottom: none; }
.zq-table tbody tr:hover { background: var(--zq-hover-bg); }

.zq-table-primary { font-weight: 600; color: var(--zq-text-primary); }
.zq-table-muted { color: var(--zq-text-muted); font-size: 12px; }

/* ========== FORMS ========== */
.zq-form-group {
  margin-bottom: var(--space-4);
}

.zq-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--zq-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zq-form-label .required { color: var(--zq-danger); margin-left: 2px; }

.zq-form-control {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-sm);
  background: var(--zq-surface);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--zq-text-primary);
  transition: all 0.15s ease;
}

.zq-form-control:focus {
  outline: none;
  border-color: var(--zq-primary);
  box-shadow: 0 0 0 3px rgba(15, 63, 135, 0.08);
}

textarea.zq-form-control {
  height: auto;
  min-height: 88px;
  padding: 12px 14px;
  resize: vertical;
}

.zq-form-help {
  font-size: 11.5px;
  color: var(--zq-text-muted);
  margin-top: 4px;
}

.zq-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.zq-form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.zq-form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* ========== GLOBAL RADIO BUTTONS ========== */
input[type="radio"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  border: 2px solid var(--zq-border-strong) !important;
  border-radius: 50% !important;
  outline: none !important;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  background-color: transparent !important;
  transition: all 0.2s ease;
  margin: 0 6px 0 0;
  display: inline-block;
}

input[type="radio"]:hover {
  border-color: var(--zq-primary) !important;
  background-color: var(--zq-primary-light) !important;
}

input[type="radio"]:checked {
  border-color: var(--zq-primary) !important;
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--zq-primary);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Radio / Checkbox groups */
.zq-radio-group {
  display: inline-flex;
  gap: var(--space-2);
}

.zq-radio-chip {
  padding: 8px 14px;
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--zq-text-secondary);
  background: var(--zq-surface);
  transition: all 0.15s ease;
}

.zq-radio-chip:hover {
  border-color: var(--zq-primary);
  color: var(--zq-primary);
}

.zq-radio-chip.active {
  background: var(--zq-primary);
  color: white;
  border-color: var(--zq-primary);
}

/* Toggle switch */
.zq-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.zq-switch input { opacity: 0; width: 0; height: 0; }

.zq-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--zq-border-strong);
  transition: 0.25s;
  border-radius: 22px;
}

.zq-switch-slider::before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.zq-switch input:checked + .zq-switch-slider { background: var(--zq-primary); }
.zq-switch input:checked + .zq-switch-slider::before { transform: translateX(18px); }

/* ========== LIST (followups, tasks etc) ========== */
.zq-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.zq-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--zq-border);
  transition: background 0.12s ease;
}

.zq-list-item:last-child { border-bottom: none; }
.zq-list-item:hover { background: var(--zq-hover-bg); }

.zq-list-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.zq-list-content { flex: 1; min-width: 0; }
.zq-list-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--zq-text-primary);
  margin: 0 0 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zq-list-meta {
  font-size: 12px;
  color: var(--zq-text-secondary);
  margin: 0;
}

.zq-list-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* ========== KANBAN BOARD ========== */
.zq-kanban {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-5);
  overflow-x: auto;
  min-height: 600px;
}

.zq-kanban-col {
  flex: 0 0 280px;
  background: var(--zq-bg);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}

.zq-kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  padding: 0 4px;
}

.zq-kanban-col-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--stage-color, var(--zq-primary));
}

.zq-kanban-col-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--zq-text-secondary);
  background: var(--zq-surface);
  padding: 2px 8px;
  border-radius: 20px;
}

.zq-kanban-col-total {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--zq-text-primary);
  font-family: var(--font-mono);
  margin-top: 6px;
  padding: 0 4px;
}

.zq-kanban-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
  max-height: 560px; /* Scroll after ~5 cards */
  overflow-y: auto;
  padding-right: 4px;
}

.zq-kanban-card {
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  cursor: grab;
  transition: all 0.15s ease;
}

.zq-kanban-card:hover {
  background: var(--zq-hover-bg);
  border-color: var(--zq-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.zq-kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--zq-text-primary);
  margin: 0 0 4px 0;
  line-height: 1.35;
}

.zq-kanban-card-client {
  font-size: 11.5px;
  color: var(--zq-text-secondary);
  margin: 0 0 var(--space-2) 0;
}

.zq-kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-2);
  border-top: 1px solid var(--zq-border);
}

.zq-kanban-card-value {
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--zq-worth-color);
}

/* ========== EMPTY STATE ========== */
.zq-empty {
  text-align: center;
  padding: var(--space-10) var(--space-5);
  color: var(--zq-text-secondary);
}

.zq-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--zq-primary-light);
  color: var(--zq-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: var(--space-4);
}

.zq-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--zq-text-primary);
  margin-bottom: 6px;
}

.zq-empty-text {
  font-size: 13px;
  color: var(--zq-text-secondary);
  max-width: 380px;
  margin: 0 auto var(--space-4);
  line-height: 1.55;
}

/* ========== TABS ========== */
.zq-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--zq-border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}

.zq-tab {
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--zq-text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.zq-tab:hover { color: var(--zq-primary); }

.zq-tab.active {
  color: var(--zq-primary);
  border-bottom-color: var(--zq-primary);
}

[data-theme="dark"] .zq-tab:hover,
[data-theme="dark"] .zq-tab.active {
  color: var(--zq-accent);
  border-bottom-color: var(--zq-accent);
}

/* ========== FILTERS BAR ========== */
.zq-filters {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  align-items: flex-end;
}

.zq-filters .zq-form-group { margin: 0; flex: 1; min-width: 150px; }

/* ========== PAGINATION ========== */
.zq-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--zq-border);
  background: var(--zq-bg);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.zq-pagination-info {
  font-size: 12.5px;
  color: var(--zq-text-secondary);
}

.zq-pagination-controls {
  display: flex;
  gap: 4px;
}

.zq-pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--zq-border);
  background: var(--zq-surface);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--zq-text-secondary);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zq-pagination-btn:hover {
  background: var(--zq-primary-light);
  color: var(--zq-primary);
  border-color: var(--zq-primary-light);
}

.zq-pagination-btn.active {
  background: var(--zq-primary);
  color: white;
  border-color: var(--zq-primary);
}

.zq-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== QUICK ACTIONS ========== */
.zq-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  padding: var(--space-5);
}

.zq-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  background: var(--zq-bg);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  color: var(--zq-text-primary);
  font-weight: 500;
  font-size: 12.5px;
  text-align: center;
}

.zq-quick-btn:hover {
  background: var(--zq-primary-light);
  border-color: var(--zq-primary);
  color: var(--zq-primary);
  transform: translateY(-1px);
}

.zq-quick-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--zq-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--zq-primary);
}

/* ========== CHARTS ========== */
.zq-chart-wrap {
  position: relative;
  height: 260px;
}

.zq-chart-wrap.tall { height: 340px; }

/* ========== PIPELINE SNAPSHOT ========== */
.zq-pipeline-snap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
  padding: var(--space-5);
}

.zq-pipe-stage {
  background: var(--zq-bg);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.zq-pipe-stage:hover {
  background: var(--zq-surface);
  border-color: var(--zq-border);
  box-shadow: var(--shadow-sm);
}

.zq-pipe-stage::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stage-color, var(--zq-primary));
}

.zq-pipe-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--zq-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.zq-pipe-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--zq-text-primary);
  margin-bottom: 2px;
}

.zq-pipe-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--zq-text-primary);
  font-family: var(--font-mono);
}

/* ========== LOGIN/AUTH PAGES ========== */
.zq-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: linear-gradient(135deg, #E8EFFA 0%, #F7F8FB 50%, #FEF3E0 100%);
}

.zq-auth-card {
  background: var(--zq-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.zq-auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.zq-auth-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.zq-auth-subtitle {
  font-size: 13.5px;
  color: var(--zq-text-secondary);
  text-align: center;
  margin-bottom: var(--space-6);
}

/* ========== ALERT ========== */
.zq-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-4);
}

.zq-alert-success { background: var(--zq-success-light); color: #065F46; }
.zq-alert-warning { background: var(--zq-warning-light); color: #92400E; }
.zq-alert-danger { background: var(--zq-danger-light); color: #991B1B; }
.zq-alert-info { background: var(--zq-info-light); color: #1E40AF; }

/* ========== UTILITY ========== */
.zq-flex { display: flex; }
.zq-flex-between { display: flex; justify-content: space-between; align-items: center; }
.zq-flex-center { display: flex; align-items: center; }
.zq-gap-2 { gap: var(--space-2); }
.zq-gap-3 { gap: var(--space-3); }
.zq-mb-4 { margin-bottom: var(--space-4); }
.zq-mb-5 { margin-bottom: var(--space-5); }
.zq-text-center { text-align: center; }
.zq-text-right { text-align: right; }
.zq-text-muted { color: var(--zq-text-muted); }
.zq-text-sm { font-size: 12.5px; }

/* ========== MOBILE / TABLET RESPONSIVE ========== */
@media (max-width: 1200px) {
  .zq-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .zq-metrics { grid-template-columns: repeat(2, 1fr); }
  .zq-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .zq-pipeline-snap { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
  .zq-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .zq-sidebar.open {
    transform: translateX(0);
  }

  .zq-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 39, 68, 0.5);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
  }

  .zq-sidebar-backdrop.open {
    opacity: 1;
    visibility: visible;
  }

  .zq-topbar-mobile-toggle { display: inline-flex; }

  .zq-grid-2, .zq-grid-3, .zq-grid-2-1, .zq-grid-1-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .zq-form-row-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .zq-main { padding: var(--space-4); }
  .zq-topbar { padding: 0 var(--space-4); }
  .zq-search { max-width: none; }
  .zq-page-title { font-size: 22px; }
  .zq-page-header { flex-direction: column; align-items: stretch; }
  .zq-page-header .zq-btn { width: 100%; justify-content: center; }

  .zq-metrics { grid-template-columns: 1fr; }
  .zq-grid-4 { grid-template-columns: 1fr; }
  .zq-form-row, .zq-form-row-3, .zq-form-row-4 { grid-template-columns: 1fr; }
  .zq-pipeline-snap { grid-template-columns: repeat(2, 1fr); }
  .zq-quick-actions { grid-template-columns: repeat(2, 1fr); }

  .zq-auth-card { padding: var(--space-6); }

  .zq-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .zq-filters { flex-direction: column; align-items: stretch; }
  .zq-filters .zq-form-group { min-width: 0; }

  /* Hide less-important table columns on mobile */
  .zq-table-hide-mobile { display: none; }
  
  /* Drawer Mobile Optimizations */
  .modal.zq-modal-drawer .modal-dialog {
    max-width: 100% !important;
  }
  .zq-drawer-section {
    padding: var(--space-4) !important;
    margin-bottom: var(--space-4) !important;
  }
  .zq-drawer-section-title {
    font-size: 11px !important;
    margin-bottom: var(--space-3) !important;
}

  .zq-table-wrap {
    margin: 0 -8px; 
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
  }
  
  .zq-table-wrap::-webkit-scrollbar {
    display: block !important;
    height: 4px !important;
  }
  
  .modal.zq-modal-drawer .modal-header {
    padding: var(--space-3) var(--space-4) !important;
  }
  .modal.zq-modal-drawer .modal-footer {
    padding: var(--space-4) !important;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-3);
  }
  .modal.zq-modal-drawer .modal-footer .zq-btn {
    width: 100% !important;
    margin: 0 !important;
    justify-content: center;
    height: 44px;
  }

  .zq-form-control {
    height: 42px !important;
    font-size: 14px !important;
  }
  .zq-btn {
    height: 42px;
    font-size: 14px !important;
  }
}

@media (max-width: 480px) {
  .zq-pipeline-snap { grid-template-columns: 1fr; }
}

/* ========== PRINT ========== */
@media print {
  .zq-sidebar, .zq-topbar, .zq-topnav, .zq-btn, .zq-table-actions {
    display: none !important;
  }
  .zq-content-wrap { margin: 0; padding: 0; }
  .zq-card { border: none; box-shadow: none; }
}

/* ========== CUSTOM TABS ========== */
.zq-nav-tabs .nav-link {
  color: var(--zq-text-secondary) !important;
  border-bottom: 2px solid transparent !important;
  transition: all 0.2s ease;
}
.zq-nav-tabs .nav-link:hover {
  color: var(--zq-text-primary) !important;
}
.zq-nav-tabs .nav-link.active {
  color: #eda303 !important;
  border-bottom: 2px solid #eda303 !important;
}

/* ========== FLATPICKR ZYNOQ THEME ========== */
.flatpickr-calendar {
  background: var(--zq-surface) !important;
  border: 1px solid var(--zq-border) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--zq-text-primary) !important;
  width: 307px !important; /* Perfect width for 7 cols of 39px + padding */
}
.flatpickr-day { color: var(--zq-text-primary) !important; }
.flatpickr-day.nextMonthDay, .flatpickr-day.prevMonthDay { color: var(--zq-text-muted) !important; opacity: 0.5; }
.flatpickr-day:hover { background: var(--zq-bg) !important; }
.flatpickr-day.today { border-color: var(--zq-primary) !important; }
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--zq-primary) !important;
  border-color: var(--zq-primary) !important;
  color: #fff !important;
}
.flatpickr-months .flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday {
  background: var(--zq-surface) !important;
  color: var(--zq-text-primary) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: var(--zq-surface) !important;
    color: var(--zq-text-primary) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background: var(--zq-surface) !important;
    color: var(--zq-text-primary) !important;
}
.flatpickr-current-month input.cur-year {
    color: var(--zq-text-primary) !important;
}
.flatpickr-prev-month, .flatpickr-next-month {
    color: var(--zq-text-primary) !important;
    fill: var(--zq-text-primary) !important;
}
.flatpickr-prev-month svg, .flatpickr-next-month svg {
    fill: var(--zq-text-primary) !important;
}
.dayContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 307px !important;
    min-width: 307px !important;
}
.flatpickr-days {
    width: 307px !important;
}
.flatpickr-day {
    max-width: 39px !important;
    flex-basis: 14.2857% !important;
    height: 39px !important;
    line-height: 39px !important;
}
.flatpickr-weekdays {
    width: 307px !important;
}
span.flatpickr-weekday {
    flex-basis: 14.2857% !important;
    max-width: 14.2857% !important;
    width: 14.2857% !important;
}

/* ========== GLOBAL CLOSE BUTTON FIX ========== */
.btn-close {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.05) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/16px auto no-repeat !important;
    border: none !important;
    border-radius: 10px !important;
    opacity: 0.6 !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    filter: none !important;
    cursor: pointer;
}
.btn-close:hover {
    opacity: 1 !important;
    background-color: var(--zq-danger) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") !important;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .btn-close {
    background: rgba(255, 255, 255, 0.1) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/16px auto no-repeat !important;
    opacity: 0.8 !important;
}
[data-theme="dark"] .btn-close:hover {
    background-color: var(--zq-danger) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") !important;
}

/* ========== MODAL SYSTEM (Standalone) ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1055;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: block;
}

/* ========== MODAL AS DRAWER (Slide from right) ========== */
.modal.zq-modal-drawer {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(2px) !important;
    padding: 0 !important;
}

.modal.zq-modal-drawer .modal-dialog {
    position: fixed;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    margin: 0 !important;
    height: 100vh !important;
    width: 100% !important;
    max-width: 600px !important;
    transform: translateX(100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: stretch;
    pointer-events: auto;
}

.modal.zq-modal-drawer.show .modal-dialog {
    transform: translateX(0) !important;
}

.modal.zq-modal-drawer .modal-content {
    border-radius: 0 !important;
    border: none !important;
    border-left: 1px solid var(--zq-border) !important;
    height: 100vh;
    background: var(--zq-surface) !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal.zq-modal-drawer form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal.zq-modal-drawer .modal-header {
    background: var(--zq-surface) !important;
    border-radius: 0;
    padding: 0.75rem 1.5rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--zq-border);
}

.modal.zq-modal-drawer .modal-body {
    overflow-y: auto;
    padding: 1rem 1.5rem;
    flex: 1;
    background: var(--zq-surface) !important;
}

.modal.zq-modal-drawer .modal-footer {
    background: var(--zq-surface) !important;
    border-radius: 0;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
    border-top: 1px solid var(--zq-border);
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: var(--zq-surface);
    background-clip: padding-box;
    border: 1px solid var(--zq-border);
    border-radius: 12px;
    outline: 0;
    box-shadow: var(--shadow-lg);
    color: var(--zq-text-primary);
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--zq-border);
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1.5rem;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.show { opacity: 0.5; }

/* ========== TIMELINE SYSTEM ========== */
.timeline {
    position: relative;
    padding: 0;
    list-style: none;
}

.timeline:before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 31px;
    width: 2px;
    background: var(--zq-border);
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: 1.5rem;
}

.timeline-indicator {
    position: absolute;
    left: 18px;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--zq-surface);
    border: 2px solid var(--zq-border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: var(--zq-text-secondary);
    font-size: 14px;
}

.timeline-event {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--zq-border);
    border-radius: 8px;
    padding: 1rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-indicator-primary { border-color: var(--zq-primary); color: var(--zq-primary); }
.timeline-indicator-success { border-color: var(--zq-success); color: var(--zq-success); }
.timeline-indicator-danger { border-color: var(--zq-danger); color: var(--zq-danger); }
.timeline-indicator-warning { border-color: var(--zq-warning); color: var(--zq-warning); }
.timeline-indicator-info { border-color: var(--zq-info); color: var(--zq-info); }
.timeline-indicator-dark { border-color: var(--zq-text-primary); color: var(--zq-text-primary); }

/* ========== TABS SYSTEM ========== */
.tab-pane {
    display: none !important;
}
.tab-pane.active,
.tab-pane.show.active {
    display: block !important;
}
.zq-tab.active {
    background-color: var(--zq-primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}
.zq-tab {
    transition: all 0.2s ease;
    border: 1px solid transparent !important;
}
.zq-tab:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--zq-border) !important;
}
/* ========== GRID SYSTEM (Simplified) ========== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}
.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 12px;
    padding-left: 12px;
}
.col-md-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
}
.col-md-6 {
    flex: 0 0 auto;
    width: 50%;
}
.col-md-8 {
    flex: 0 0 auto;
    width: 66.66666667%;
}
.col-md-12 {
    flex: 0 0 auto;
    width: 100%;
}

/* ========== DETAIL ITEMS ========== */
.detail-item {
    margin-bottom: 1rem;
}
.detail-label {
    display: block;
    font-size: 12px;
    color: var(--zq-text-muted);
    margin-bottom: 4px;
}
.detail-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--zq-text-primary);
}
.detail-item .form-control,
.detail-item .form-select {
    margin-top: 4px;
    background-color: rgba(255, 255, 255, 0.05);
}

/* ========== CUSTOM SCROLLBARS ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--zq-border-strong);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--zq-text-muted);
}

/* Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--zq-border-strong) transparent;
}

/* ========== DATATABLES ZYNOQ INTEGRATION ========== */
.dataTables_wrapper .zq-table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px !important;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 0 !important;
  color: var(--zq-text-secondary);
  font-size: 13px;
  display: inline-block;
}

.dataTables_wrapper .dataTables_filter {
  margin-left: auto;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--zq-surface);
  border: 1px solid var(--zq-border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: var(--zq-text-primary);
  margin: 0 8px;
  outline: none;
}

.dataTables_wrapper .dataTables_info {
  padding: 12px 16px !important;
  color: var(--zq-text-muted);
  font-size: 12px;
  float: left;
}

.dataTables_wrapper .dataTables_paginate {
  padding: 12px 16px !important;
  float: right;
}

.dataTables_wrapper .pagination,
.dataTables_wrapper .dataTables_paginate ul {
  display: flex !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 4px;
}

.dataTables_wrapper .page-item,
.dataTables_wrapper .paginate_button {
  display: block !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.dataTables_wrapper .page-link,
.dataTables_wrapper .paginate_button a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--zq-border) !important;
  background: var(--zq-surface) !important;
  color: var(--zq-text-secondary) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.dataTables_wrapper .page-item.active .page-link,
.dataTables_wrapper .paginate_button.current a {
  background: var(--zq-primary) !important;
  border-color: var(--zq-primary) !important;
  color: white !important;
}

.dataTables_wrapper .page-link:hover,
.dataTables_wrapper .paginate_button a:hover {
  background: var(--zq-primary-light) !important;
  color: var(--zq-primary) !important;
  border-color: var(--zq-primary-light) !important;
}

.zq-table-controls {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 16px 24px !important;
  border-bottom: 1px solid var(--zq-border) !important;
  gap: 16px !important;
}

.zq-table-controls .dataTables_length,
.zq-table-controls .dataTables_filter {
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
}

.zq-table-controls .dataTables_filter input {
  width: 250px !important;
  margin-left: 12px !important;
}

/* DataTable Action Buttons Styling */
.dt-action-buttons .zq-btn {
  margin-left: 8px !important;
}

/* DataTables Collection Dropdown Styling */
div.dt-button-collection {
  position: absolute !important;
  top: 45px !important;
  right: 0 !important;
  left: auto !important;
  width: 100px !important;
  background: var(--zq-surface) !important;
  border: 1px solid var(--zq-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  padding: 8px 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  animation: none !important;
}

/* Ensure the action buttons container doesn't constrain the dropdown */
.dt-action-buttons {
  position: relative !important;
  overflow: visible !important;
}

.card-header.flex-column.flex-md-row {
  overflow: visible !important;
}

div.dt-button-collection .zq-dropdown-item {
  margin: 2px 8px !important;
  padding: 8px 12px !important;
  border: none !important;
  background: transparent !important;
  width: calc(100% - 16px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  color: var(--zq-text-primary) !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  gap: 8px !important;
}

div.dt-button-collection .zq-dropdown-item:hover {
  background: var(--zq-primary-light) !important;
  color: var(--zq-primary) !important;
}

[data-theme="dark"] div.dt-button-collection .zq-dropdown-item:hover {
  background: #2A364E !important;
  color: #FFFFFF !important;
}

div.dt-button-background {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9998 !important;
  background: transparent !important;
}

/* DataTables Sorting Icons Fix - SVG Approach (Most Reliable) */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  background-image: none !important;
  position: relative !important;
  cursor: pointer !important;
}

/* Hide the pseudo-element boxes that appear due to font/encoding issues */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
  display: none !important;
  content: "" !important;
}

/* Default sortable state (Up/Down arrows) */
table.dataTable thead .sorting {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center right 8px !important;
  background-size: 12px !important;
  padding-right: 30px !important;
}

/* Ascending state (Blue Up arrow) */
table.dataTable thead .sorting_asc {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center right 8px !important;
  background-size: 12px !important;
  padding-right: 30px !important;
}

/* Descending state (Blue Down arrow) */
table.dataTable thead .sorting_desc {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center right 8px !important;
  background-size: 12px !important;
  padding-right: 30px !important;
}

/* Ensure disabled/non-sortable columns have no icon */
table.dataTable thead .sorting_disabled {
  background-image: none !important;
  padding-right: 12px !important;
}
/* ========== DRAWER SYSTEM ========== */
.zq-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 500px;
  height: 100%;
  background: var(--zq-surface);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--zq-border);
}
.zq-drawer.show {
  right: 0 !important;
}
.zq-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1999;
  display: none;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}
.zq-drawer-backdrop.show {
  display: block !important;
  opacity: 1 !important;
}
.zq-drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--zq-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.zq-drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--zq-text-primary);
  margin: 0;
}
.zq-drawer-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}
.zq-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--zq-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--zq-surface);
}

/* SweetAlert2 Theme Sync */
.swal2-container {
  z-index: 999999 !important;
}
.swal2-actions .zq-btn {
  margin: 0 6px !important;
}
.swal2-popup {
  background: var(--zq-surface) !important;
  color: var(--zq-text-primary) !important;
  border: 1px solid var(--zq-border) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
}
.swal2-title {
  color: var(--zq-text-primary) !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.swal2-html-container {
  color: var(--zq-text-secondary) !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.swal2-success-circular-line-left, 
.swal2-success-circular-line-right, 
.swal2-success-fix {
  background-color: var(--zq-surface) !important;
}

/* Flatpickr Month Clipping Fix */
.flatpickr-calendar {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.flatpickr-month {
  height: 42px !important;
}

.flatpickr-current-month {
  padding: 6px 0 0 0 !important;
  height: 42px !important;
}

.flatpickr-monthDropdown-months, 
.flatpickr-current-month .cur-month {
  font-weight: 700 !important;
  padding: 0 !important;
  height: auto !important;
  line-height: 1.8 !important;
}

.flatpickr-current-month .numInputWrapper {
  padding: 0 !important;
}




.flatpickr-current-month input.cur-year {
  font-weight: 700 !important;
}

/* ========== MASTER MODULE SIDEBAR ========== */
.zq-master-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 64px);
  width: 100%;
}

.zq-sidebar {
  width: 260px;
  background: var(--zq-surface);
  border-right: 1px solid var(--zq-border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

[data-theme="dark"] .zq-sidebar {
  background: rgba(26, 35, 51, 0.8);
  backdrop-filter: blur(10px);
}

.zq-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 var(--space-3);
}

.zq-sidebar-section {
  font-size: 11px;
  font-weight: 800;
  color: var(--zq-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.zq-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--zq-text-secondary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.zq-sidebar-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.zq-sidebar-item:hover {
  background: var(--zq-primary-light);
  color: var(--zq-primary);
}

[data-theme="dark"] .zq-sidebar-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #60A5FA;
}

.zq-sidebar-item.active {
  background: var(--zq-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 63, 135, 0.2);
}

[data-theme="dark"] .zq-sidebar-item.active {
  background: var(--zq-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.zq-sidebar-item.active i {
  color: white !important;
}

.zq-master-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-6);
  background: var(--zq-bg);
}

/* Custom Validation Bubble */
.zq-validation-bubble {
  position: absolute;
  background: #EF4444;
  color: #FFFFFF;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  z-index: 99999999 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  white-space: nowrap;
  animation: zq-bubble-in 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="dark"] .zq-validation-bubble {
  background: #F87171;
  color: #000;
}

.zq-validation-bubble::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 15px;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: rotate(45deg);
}

@keyframes zq-bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.is-invalid {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

[data-theme="dark"] .is-invalid {
  border-color: #F87171 !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1) !important;
}

/* ========== COMPACT TABLE (Used in Drawers) ========== */
.zq-table-compact {
    width: 100%;
    border-collapse: collapse;
}

.zq-table-compact th {
    font-size: 11px;
    font-weight: 700;
    color: var(--zq-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 15px;
    border-bottom: 1px solid var(--zq-border);
    text-align: left;
}

.zq-table-compact tr {
    border-bottom: 1px solid var(--zq-border);
    transition: background 0.15s ease;
}

.zq-table-compact tr:last-child {
    border-bottom: none;
}

.zq-table-compact tr:hover {
    background: var(--zq-hover-bg);
}

[data-theme="dark"] .zq-table-compact tr:hover {
    background: var(--zq-hover-bg);
}

.zq-table-compact td {
    padding: 12px 15px;
    vertical-align: middle;
}




