/* ==========================================================================
   Techneek Master Design System v2.0 Tokens & Theme Architecture
   Strict Charcoal (#1d2024) Single-Surface, 14px Root, 36px Control Plane
   ========================================================================== */

/* ---------- 1. Self-Hosted Typography ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 2. Design System Root Variables & Tokens ---------- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Dimensions & Shell Layout */
  --sidebar-width: 260px;
  --header-height: 70px;
  --max-content-width: 1300px;
  --control-height: 36px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px; /* Primary SaaS control plane radius */
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-drawer: -4px 0 24px rgba(0, 0, 0, 0.25);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

  /* Status Colors (Shared) */
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.12);
  --success-text: #22c55e;

  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.12);
  --warning-text: #f59e0b;

  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.12);
  --danger-text: #ef4444;

  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.12);
  --info-text: #38bdf8;

  /* Accent highlights */
  --accent-purple: #a855f7;
  --accent-sky: #38bdf8;
}

/* ---------- 3. Dark Theme (Default Techneek Charcoal #1d2024) ---------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Single-surface Charcoal Dark Mode */
  --surface: #1d2024;
  --bg-app: #1d2024;
  --bg-card: #1d2024;
  --bg-sidebar: #1d2024;
  --bg-header: #1d2024;
  --bg-hover: #262a30;
  --bg-active: #2f343b;

  /* Borders */
  --border-color: #2b2f36;
  --border-subtle: #242830;
  --border-strong: #383e47;

  /* Typography Colors */
  --text-primary: #f4f6fa;
  --text-secondary: #9ba3af;
  --text-muted: #6b7280;

  /* Brand Primary */
  --primary: #00ecc6;
  --primary-hover: #00d4b2;
  --primary-text: #0d1217;
  --primary-rgb: 0, 236, 198;
  --focus-ring: rgba(0, 236, 198, 0.4);

  /* Token Aliases for Cross-Template Compatibility */
  --border-primary: var(--border-color);
  --brand-primary: var(--primary);
  --surface-primary: var(--surface);
  --surface-secondary: var(--bg-hover);
  --bg-secondary: var(--bg-hover);
  --text-tertiary: var(--text-muted);
}

/* ---------- 4. Light Theme Override ---------- */
[data-theme="light"] {
  color-scheme: light;

  --surface: #ffffff;
  --bg-app: #f7f8fa;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  --bg-hover: #f3f4f6;
  --bg-active: #e5e7eb;

  /* Borders */
  --border-color: #e5e7eb;
  --border-subtle: #f3f4f6;
  --border-strong: #d1d5db;

  /* Typography Colors */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  /* Brand Primary */
  --primary: #0099b8;
  --primary-hover: #008099;
  --primary-text: #ffffff;

  /* Token Aliases for Cross-Template Compatibility */
  --border-primary: var(--border-color);
  --brand-primary: var(--primary);
  --surface-primary: var(--surface);
  --surface-secondary: var(--bg-hover);
  --bg-secondary: var(--bg-hover);
  --text-tertiary: var(--text-muted);
  --primary-rgb: 0, 153, 184;
  --focus-ring: rgba(0, 153, 184, 0.35);

  --success-text: #15803d;
  --warning-text: #b45309;
  --danger-text: #b91c1c;
  --info-text: #0369a1;

  --accent-purple: #7e22ce;
  --accent-sky: #0284c7;
}

/* ---------- 5. Base Typography & Resets ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px !important; /* CRITICAL: 14px SaaS base */
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Focus Visibility (Accessibility) */
:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* ---------- 6. App Shell Layout Structure ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-app);
}

/* Fixed 260px Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(4, 7, 15, 0.7);
  z-index: 35;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 0.2s ease;
}

body.sidebar-open {
  overflow: hidden;
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Fixed 70px Header */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* Max 1300px Page Container */
.page-container {
  max-width: var(--max-content-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.75rem;
  flex: 1;
}

/* ---------- 7. Navigation Items ---------- */
.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
  padding: 0 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
}

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

.nav-item.active,
.nav-item[aria-current="page"] {
  background-color: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
  border-color: var(--border-color);
}

.nav-more-details > summary::-webkit-details-marker {
  display: none;
}

.nav-more-details[open] summary .nav-more-icon {
  transform: rotate(180deg);
}

/* ---------- 8. Uniform 36px Control Plane (Buttons & Inputs) ---------- */
.control-36,
.btn,
.form-input {
  height: var(--control-height);
  min-height: var(--control-height);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-family: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.875rem;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn {
  cursor: pointer;
  border: 1px solid transparent;
  gap: 0.5rem;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

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

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

.btn-icon {
  width: var(--control-height);
  padding: 0;
}

.form-input {
  width: 100%;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.form-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* ---------- 9. Cards, Badges, & Indicators ---------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info-text);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-neutral {
  background-color: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-primary {
  background-color: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.badge-sm {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}

.badge-md {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
}

.badge-lg {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
}

/* StatCard Component */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.stat-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-card-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-hover);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.stat-card-body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-trend-up {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.stat-trend-down {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.stat-trend-neutral {
  background-color: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.stat-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stat-card-sparkline {
  display: flex;
  align-items: center;
  max-height: 24px;
}

/* Form Controls & 36px Control Plane */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.required-indicator {
  color: var(--danger-text);
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-control-36 {
  width: 100%;
  height: var(--control-height) !important;
  min-height: var(--control-height) !important;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0 0.75rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-control-36:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--primary);
}

.form-control-36.has-leading-icon {
  padding-left: 2.25rem;
}

.form-control-36.has-trailing-icon {
  padding-right: 2.25rem;
}

.textarea-control {
  height: auto;
  min-height: 80px;
  padding: 0.5rem 0.75rem;
  line-height: 1.4;
  resize: vertical;
}

.w-36 {
  width: 9rem;
}

.w-40 {
  width: 10rem;
}

.job-video-preview {
  max-width: 320px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.job-video-player {
  width: 100%;
  display: block;
}

.input-leading-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.input-trailing-icon {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.form-control-36.is-invalid {
  border-color: var(--danger-text);
}

.form-error {
  font-size: 0.72rem;
  color: var(--danger-text);
  margin-top: 0.2rem;
}

.form-helper {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* DataTable Component */
.data-table-container,
.table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
}

.data-table,
.table-modern {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.data-table th,
.table-modern th {
  padding: 0.65rem 1rem;
  background-color: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table th.sortable-th,
.table-modern th.sortable-th {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable-th:hover,
.table-modern th.sortable-th:hover {
  color: var(--text-primary);
  background-color: var(--bg-active);
}

.data-table th .sort-icon,
.table-modern th .sort-icon {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.data-table td,
.table-modern td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 400;
  vertical-align: middle;
}

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

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

.empty-row td.empty-cell {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.empty-icon {
  font-size: 2rem;
  color: var(--text-muted);
}

.empty-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Toast Notification Component */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: toastSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon-wrapper {
  font-size: 1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-content {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.toast-message {
  margin: 0;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: color 0.15s ease;
}

.toast-close-btn:hover {
  color: var(--text-primary);
}

/* SlideOver Drawer Component */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 60;
  transition: opacity 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-drawer);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

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

.drawer-panel {
  max-width: 480px;
  width: 100%;
}

.drawer-panel-sm {
  max-width: 400px;
  width: 100%;
}

.table-toolbar-filter {
  min-width: 140px;
}

.table-toolbar-filter-sm {
  min-width: 130px;
}

.table-toolbar-filter-lg {
  min-width: 180px;
}

.drawer-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
}

.drawer-header-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.drawer-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drawer-description {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.drawer-close-btn:hover {
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-footer {
  display: none;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  gap: 0.5rem;
  justify-content: flex-end;
  background-color: var(--bg-card);
  flex-shrink: 0;
}

/* Confirm Dialog Component (Zero Browser Popups) */
.confirm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 80;
  transition: opacity 0.2s ease;
}

.confirm-backdrop.open,
.confirm-backdrop:not([hidden]):not([aria-hidden="true"]) {
  display: block;
}

.confirm-backdrop[hidden],
.confirm-dialog[hidden],
.confirm-backdrop[aria-hidden="true"]:not(.open),
.confirm-dialog[aria-hidden="true"]:not(.open) {
  display: none !important;
}

.confirm-dialog {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 440px;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  z-index: 90;
  outline: none;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-dialog.open,
.confirm-dialog:not([hidden]):not([aria-hidden="true"]) {
  display: block;
}

@keyframes modalScaleIn {
  from {
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.confirm-dialog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.confirm-dialog-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.confirm-dialog-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.confirm-dialog-icon-wrapper.danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.confirm-dialog-icon-wrapper.warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.confirm-dialog-icon-wrapper.info,
.confirm-dialog-icon-wrapper.primary {
  background-color: var(--bg-hover);
  color: var(--primary);
  border: 1px solid var(--border-color);
}

.confirm-dialog-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.confirm-dialog-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.confirm-dialog-message {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.confirm-dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ⌘K Command Palette Modal */
.cmd-k-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 60;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.cmd-k-backdrop.open {
  display: flex;
}

.cmd-k-dialog {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
}

.cmd-k-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.cmd-k-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
}

.cmd-k-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem;
}

.cmd-k-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
}

.cmd-k-item:hover,
.cmd-k-item.selected {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* ---------- 10. Responsive Mobile Collapse (<1024px) ---------- */
@media (max-width: 1023px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    display: block;
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-toggle {
    display: flex !important;
  }
}

@media (min-width: 1024px) {
  .mobile-toggle {
    display: none !important;
  }
}

/* ---------- 11. Standard Page Header Component ---------- */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-header-content {
  display: flex;
  flex-direction: column;
}

.page-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-header-subtitle {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-header-badge {
  display: inline-flex;
  align-items: center;
}

/* ---------- 12. Standard Section Headers ---------- */
.section-header {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ---------- 13. Component Kit: Form Controls & 36px Elements ---------- */
.form-control-36 {
  height: var(--control-height);
  min-height: var(--control-height);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.825rem;
  font-family: inherit;
  padding: 0 0.75rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-36:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.7rem;
  color: var(--danger-text);
  margin-top: 0.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

/* ---------- 14. Standard Table Toolbar ---------- */
.table-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .table-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.table-search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.table-search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

.table-search-input {
  height: var(--control-height);
  padding-left: 2.25rem !important;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.825rem;
  width: 100%;
}

.table-search-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* ---------- 15. Standard Empty, Loading, and Error States ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  background-color: var(--bg-hover);
  margin: 1rem 0;
}

.empty-state-icon {
  font-size: 2.25rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.empty-state-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.empty-state-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.empty-state-action {
  margin-top: 0.5rem;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 0.75rem;
  color: var(--text-muted);
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(220, 38, 38, 0.3);
  background-color: var(--danger-bg);
  margin: 1rem 0;
}

.error-state-icon {
  font-size: 2rem;
  color: var(--danger-text);
  margin-bottom: 0.75rem;
}

.error-state-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.error-state-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: 1rem;
}

/* ---------- 16. Standard Auth Shell Layout ---------- */
.auth-shell {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background-color: var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 2.25rem 2rem;
}

.auth-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
  background: transparent;
}

.auth-logo-img {
  height: 36px;
  max-width: 165px;
  width: auto;
  object-fit: contain;
  background: transparent;
  display: block;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-body {
  margin-bottom: 1.5rem;
}

.auth-footer {
  text-align: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.785rem;
  color: var(--text-muted);
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.auth-link:hover {
  text-decoration: underline;
}

/* ---------- 17. Shell & Navigation Classes (Zero Inline Styles) ---------- */
.sidebar-brand {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, #0099b8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0d1217;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 0 12px rgba(0, 236, 198, 0.35);
}

.sidebar-brand-full-logo {
  height: 26px;
  max-width: 130px;
  width: auto;
  object-fit: contain;
  background: transparent;
  display: block;
}

/* Dual Logo Display Architecture */
.theme-logo-dark {
  display: block !important;
}
.theme-logo-light {
  display: none !important;
}

[data-theme="light"] .theme-logo-dark {
  display: none !important;
}
[data-theme="light"] .theme-logo-light {
  display: block !important;
}

.sidebar-brand-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sidebar-badge {
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

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

.sidebar-footer-info {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sidebar-footer-highlight {
  color: var(--success-text);
  font-weight: 600;
}

.sidebar-icon {
  width: 18px;
  text-align: center;
  display: inline-block;
}

.sidebar-more-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  margin-bottom: 0.25rem;
}

.sidebar-more-chevron {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
}

/* Header utility classes */
.header-wrapper-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-mobile-btn {
  width: 36px;
  height: 36px;
  padding: 0;
}

.header-breadcrumbs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
}

.header-breadcrumb-muted {
  color: var(--text-muted);
}

.header-breadcrumb-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.header-breadcrumb-current {
  font-weight: 600;
  color: var(--text-primary);
}

.header-wrapper-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-search-trigger {
  gap: 0.75rem;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.header-pulse-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
}

.header-pulse-status {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-pulse-highlight {
  color: var(--primary);
  font-weight: 600;
}

.header-logout-form {
  margin: 0;
}

.header-logout-btn {
  font-size: 0.75rem;
}

/* Color utility classes (Tokens only) */
.text-brand { color: var(--primary); }
.text-brand-contrast { color: var(--primary-text); }
.bg-brand { background-color: var(--primary); }
.text-success { color: var(--success-text); }
.bg-success { background-color: var(--success-bg); }
.text-warning { color: var(--warning-text); }
.bg-warning { background-color: var(--warning-bg); }
.text-danger { color: var(--danger-text); }
.bg-danger { background-color: var(--danger-bg); }
.text-info { color: var(--info-text); }
.bg-info { background-color: var(--info-bg); }
.text-purple { color: var(--accent-purple); }
.text-sky { color: var(--accent-sky); }
.text-primary,
.text-primary-var { color: var(--text-primary); }
.text-secondary,
.text-secondary-var { color: var(--text-secondary); }
.text-muted,
.text-muted-var { color: var(--text-muted); }

.card-danger {
  border-color: var(--danger);
  background-color: var(--danger-bg);
}

.card-success {
  border-color: var(--success);
  background-color: var(--success-bg);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  border: 1px solid transparent;
}

.alert-danger {
  border-color: var(--danger);
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.alert-success {
  border-color: var(--success);
  background-color: var(--success-bg);
  color: var(--success-text);
}

/* Display & Visibility helpers */
.display-none { display: none !important; }
.hidden-box { display: none; }

/* Theme Switcher Pill */
.theme-switcher-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.theme-btn {
  flex: 1;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.theme-btn.active {
  color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* Command Palette Helpers */
.cmdk-input-icon {
  color: var(--text-muted);
  font-size: 14px;
}

.cmdk-kbd {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Metric Filter Cards */
.card-metric-filter {
  padding: 0.875rem 1rem;
  text-decoration: none;
  border-left-width: 3px;
  border-left-style: solid;
  transition: all 0.15s ease;
}

.card-border-booked { border-left-color: var(--success-text); }
.card-border-qualified { border-left-color: var(--primary); }
.card-border-new { border-left-color: var(--info-text); }
.card-border-default { border-left-color: var(--border-color); }

/* Chat & Transcript Drawer Helper Classes */
.chat-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.chat-row-inbound {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-row-outbound {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.chat-bubble-inbound {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  line-height: 1.4;
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.chat-bubble-outbound {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  line-height: 1.4;
  background-color: rgba(var(--primary-rgb), 0.15);
  color: var(--text-primary);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.chat-notes-textarea {
  height: 80px;
  padding: 0.5rem;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.divider-subtle {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1rem 0;
}

/* Inbox Split Pane & Messages */
.inbox-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  min-height: 600px;
  height: calc(100vh - 220px);
}

@media (max-width: 768px) {
  .inbox-split {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background-color: rgba(13, 18, 23, 0.4);
}

.chat-bubble-human {
  max-width: 75%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.45;
  background-color: var(--warning-bg);
  color: var(--text-primary);
  border: 1px solid rgba(217, 119, 6, 0.4);
}

.inbox-reply-box {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--surface);
}

.inbox-reply-textarea {
  height: 60px;
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
  resize: none;
  width: 100%;
}

/* Progress Bar Component */
progress.progress-bar {
  width: 100%;
  height: 6px;
  appearance: none;
  border: none;
  border-radius: var(--radius-full);
  background-color: var(--bg-hover);
  overflow: hidden;
  display: block;
}

progress.progress-bar::-webkit-progress-bar {
  background-color: var(--bg-hover);
  border-radius: var(--radius-full);
}

progress.progress-bar::-webkit-progress-value {
  background-color: var(--primary);
  border-radius: var(--radius-full);
}

progress.progress-bar::-moz-progress-bar {
  background-color: var(--primary);
  border-radius: var(--radius-full);
}

/* Client Portal Classes */
.portal-body {
  min-height: 100vh;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card);
  backdrop-filter: blur(8px);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-logo-box {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--primary);
  color: var(--bg-app);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-brand-title {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.portal-brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.portal-nav {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .portal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  .portal-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .portal-main {
    padding: 1.25rem 1rem;
  }
}

.portal-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
}

.portal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.portal-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.portal-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.portal-section-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.portal-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.375rem;
}

.portal-funnel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.portal-funnel-cost {
  margin-left: auto;
}

.portal-calendar-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.portal-calendar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.portal-calendar-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.portal-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.25rem 0;
}

.portal-calendar-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: flex-end;
}

.portal-social-actions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.portal-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.portal-card-security {
  max-width: 500px;
}

.portal-cell-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.portal-cell-code-sm {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.portal-cell-bold {
  font-weight: 600;
  color: var(--text-primary);
}

.portal-table-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.portal-table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.375rem;
  align-items: center;
}

/* Fallback: Prevent Tailwind .border and uncompiled neutral border utilities from defaulting to currentColor (white) */
.border,
.border-t,
.border-b,
.border-l,
.border-r {
  border-color: var(--border-color);
}
.border-neutral-700,
.border-neutral-800,
.border-neutral-900 {
  border-color: var(--border-color) !important;
}

/* Responsive grid & column span helpers */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

.gap-8 { gap: 2rem; }

.tab-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  outline: none;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
}

/* Modern Segmented Tab Menu Selector */
.tab-menu-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.3125rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  overflow-x: auto;
}

.tab-menu-nav .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-bottom: 0;
  border-bottom: 1px solid transparent;
  outline: none;
}

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

.tab-menu-nav .tab-btn.active {
  color: var(--text-primary) !important;
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Overlay, Drawer & Modal Utility Architecture
   Ensures 100% solid, non-transparent surfaces and solid backdrop overlays
   ========================================================================== */

/* Positional & Placement Utilities */
.fixed { position: fixed !important; }
.absolute { position: absolute !important; }
.relative { position: relative !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.inset-y-0 { top: 0 !important; bottom: 0 !important; }
.top-0 { top: 0 !important; }
.right-0 { right: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.left-0 { left: 0 !important; }
.top-1\/2 { top: 50% !important; }
.left-1\/2 { left: 50% !important; }
.-translate-x-1\/2 { transform: translateX(-50%) !important; }
.-translate-y-1\/2 { transform: translateY(-50%) !important; }
.-translate-x-1\/2.-translate-y-1\/2 { transform: translate(-50%, -50%) !important; }
.translate-x-full { transform: translateX(100%) !important; }
.translate-x-0 { transform: translateX(0) !important; }

/* Z-Index Hierarchy */
.z-10 { z-index: 10 !important; }
.z-20 { z-index: 20 !important; }
.z-30 { z-index: 30 !important; }
.z-40 { z-index: 40 !important; }
.z-50 { z-index: 50 !important; }
.z-60 { z-index: 60 !important; }
.z-70 { z-index: 70 !important; }
.z-80 { z-index: 80 !important; }
.z-90 { z-index: 90 !important; }
.z-100 { z-index: 100 !important; }

/* Sizing, Flex & Overflow */
.max-w-xs { max-width: 20rem !important; }
.max-w-sm { max-width: 24rem !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-lg { max-width: 32rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-2xl { max-width: 42rem !important; }
.w-full { width: 100% !important; }
.overflow-y-auto { overflow-y: auto !important; }
.shadow-2xl { box-shadow: var(--shadow-modal) !important; }

/* Solid, Opaque Surfaces (Zero Transparency Bug) */
.bg-surface,
.bg-card,
.bg-surface-primary,
[class*="bg-[var(--surface)"],
[class*="bg-[var(--bg-card)"],
[class*="bg-[var(--surface-primary)"] {
  background-color: var(--surface) !important;
  color: var(--text-primary);
}

.bg-surface-secondary,
[class*="bg-[var(--surface-secondary)"],
[class*="bg-[var(--bg-secondary)"] {
  background-color: var(--bg-hover) !important;
}

[class*="bg-[var(--bg-hover)"] {
  background-color: var(--bg-hover) !important;
}

.bg-neutral-900 {
  background-color: #17191c !important;
}

.bg-neutral-950 {
  background-color: #0e1012 !important;
}

/* Backdrops */
.backdrop-blur-sm,
.backdrop-blur {
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

.bg-black\/60,
.bg-black\/70,
.bg-black\/75,
.bg-black\/80 {
  background-color: rgba(0, 0, 0, 0.75) !important;
}

/* Explicit Slide-Over Drawers, Modals & Backdrops Architecture */
#drawer-create-deal,
#drawer-create-company,
#drawer-deal-detail,
#drawer-upload,
#drawer-inspect,
#drawer-invite,
#drawer-edit,
#drawer-macros,
#modal-close-thread,
#preview-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 70 !important;
}

.drawer-backdrop,
.drawer-overlay,
.modal-backdrop,
#brand-kit-backdrop,
#invite-drawer-backdrop,
#create-client-backdrop,
#settings-drawer-backdrop,
#edit-drawer-backdrop,
#schedule-drawer-backdrop,
#preview-modal-backdrop,
#developer-backdrop,
#diff-drawer-backdrop,
#backdrop-upload,
#backdrop-inspect,
#backdrop-create-deal,
#backdrop-create-company,
#backdrop-deal-detail,
#backdrop-invite,
#backdrop-edit,
#backdrop-close-modal,
#backdrop-macros {
  position: fixed !important;
  inset: 0 !important;
  background-color: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  z-index: 60 !important;
}

.drawer-panel-surface,
.slide-over-drawer,
#brand-kit-drawer,
#invite-drawer,
#create-client-drawer,
#client-settings-drawer,
#edit-drawer,
#schedule-drawer,
#diff-drawer,
#drawer-create-key,
#drawer-create-webhook,
#drawer-create-rule,
#drawer-create-deal > div:last-child,
#drawer-create-company > div:last-child,
#drawer-deal-detail > div:last-child,
#drawer-upload > div:last-child,
#drawer-inspect > div:last-child,
#drawer-invite > div:last-child,
#drawer-edit > div:last-child,
#drawer-macros > div:last-child {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  background-color: var(--surface) !important;
  border-left: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-drawer) !important;
  z-index: 70 !important;
  opacity: 1 !important;
  overflow-y: auto !important;
}

.slide-over-drawer {
  width: 100% !important;
  max-width: 32rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.slide-over-drawer.hidden {
  display: none !important;
}

/* Modals (centered popups) */
#preview-modal > div,
#modal-close-thread > div:last-child,
.modal-dialog-surface {
  position: relative !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-modal) !important;
  z-index: 70 !important;
  opacity: 1 !important;
}

/* Wrapper-style drawers (e.g. in campaigns.html, billing.html) */
#new-campaign-drawer,
#scale-budget-drawer,
#new-subscription-drawer,
.drawer:has(.drawer-panel),
.drawer:has(.drawer-panel-sm),
.drawer:has(.drawer-overlay) {
  position: fixed !important;
  inset: 0 !important;
  max-width: none !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  display: none !important;
  z-index: 70 !important;
}

#new-campaign-drawer.open,
#scale-budget-drawer.open,
#new-subscription-drawer.open,
.drawer:has(.drawer-panel).open,
.drawer:has(.drawer-panel-sm).open,
.drawer:has(.drawer-overlay).open {
  display: block !important;
}

.drawer-panel {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 32rem !important;
  background-color: var(--surface) !important;
  border-left: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-drawer) !important;
  z-index: 70 !important;
  opacity: 1 !important;
  overflow-y: auto !important;
}

.drawer-panel-sm {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 26rem !important;
  background-color: var(--surface) !important;
  border-left: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-drawer) !important;
  z-index: 70 !important;
  opacity: 1 !important;
  overflow-y: auto !important;
}

/* Form input elements inside drawers */
.input,
input.input,
textarea.input,
select.input {
  width: 100%;
  background-color: var(--bg-app) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm);
  color: var(--text-primary) !important;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.input:focus,
input.input:focus,
textarea.input:focus,
select.input:focus {
  border-color: var(--primary) !important;
  outline: none;
  box-shadow: 0 0 0 1px var(--primary);
}
