/* Cleaner Desk V7 — Custom CSS */
/* All theme variables, print styles, animations, and overrides */

/* ── Font Smoothing & Native System Font Stack (Zero Network Dependency) ── */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; box-sizing: border-box; }
body {
  font-family: "Aptos", "SF Pro Text", "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-feature-settings: "cv02","cv03","cv04","cv11";
  text-rendering: optimizeLegibility;
  font-size: 15.2px;
  line-height: 1.5;
}
.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── Scrollbars ────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ── Vue Cloak ─────────────────────────────────────────── */
[v-cloak] { display: none !important; }

/* ── Sidebar Transition ────────────────────────────────── */
.sidebar-transition { transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1); }

/* ── Tooltip System ────────────────────────────────────── */
.has-tooltip { position: relative; }
.tooltip-bubble { display:none; position:absolute; left:100%; top:50%; transform:translateY(-50%); margin-left:10px; white-space:nowrap; z-index:60; pointer-events:none; }
.has-tooltip:hover .tooltip-bubble { display: block; }

/* ── 5 Dashboard Color Themes ──────────────────────────── */
:root, [data-theme="emerald"] {
  --primary-50: #f0fdf4; --primary-100: #dcfce7; --primary-200: #bbf7d0;
  --primary-300: #86efac; --primary-400: #4ade80;
  --primary-500: #22c55e; --primary-600: #16a34a; --primary-700: #15803d;
  --primary-800: #166534; --primary-900: #14532d; --primary-950: #052e16;
  --theme-ring: rgba(22,163,74,0.35); --theme-hex: #15803d;
}
[data-theme="ocean"] {
  --primary-50: #eff6ff; --primary-100: #dbeafe; --primary-200: #bfdbfe;
  --primary-300: #93c5fd; --primary-400: #60a5fa;
  --primary-500: #3b82f6; --primary-600: #2563eb; --primary-700: #1d4ed8;
  --primary-800: #1e40af; --primary-900: #1e3a8a; --primary-950: #172554;
  --theme-ring: rgba(37,99,235,0.35); --theme-hex: #1d4ed8;
}
[data-theme="slate"] {
  --primary-50: #f8fafc; --primary-100: #f1f5f9; --primary-200: #e2e8f0;
  --primary-300: #cbd5e1; --primary-400: #94a3b8;
  --primary-500: #64748b; --primary-600: #475569; --primary-700: #334155;
  --primary-800: #1e293b; --primary-900: #0f172a; --primary-950: #020617;
  --theme-ring: rgba(71,85,105,0.35); --theme-hex: #334155;
}
[data-theme="amber"] {
  --primary-50: #fffbeb; --primary-100: #fef3c7; --primary-200: #fde68a;
  --primary-300: #fcd34d; --primary-400: #fbbf24;
  --primary-500: #f59e0b; --primary-600: #d97706; --primary-700: #b45309;
  --primary-800: #92400e; --primary-900: #78350f; --primary-950: #451a03;
  --theme-ring: rgba(217,119,6,0.35); --theme-hex: #b45309;
}
[data-theme="violet"] {
  --primary-50: #faf5ff; --primary-100: #f3e8ff; --primary-200: #e9d5ff;
  --primary-300: #d8b4fe; --primary-400: #c084fc;
  --primary-500: #a855f7; --primary-600: #9333ea; --primary-700: #7e22ce;
  --primary-800: #6b21a8; --primary-900: #581c87; --primary-950: #3b0764;
  --theme-ring: rgba(147,51,234,0.35); --theme-hex: #7e22ce;
}

/* ── Theme Active Card ─────────────────────────────────── */
.theme-active-card { border-color: var(--primary-600) !important; background-color: var(--primary-50) !important; }
.dark .theme-active-card { background-color: rgba(0,0,0,0.4) !important; }

/* ── Profit Guard Status Colors ────────────────────────── */
.profit-guard-healthy { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.profit-guard-caution { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.profit-guard-low     { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.dark .profit-guard-healthy { color: #4ade80; background: #052e16; border-color: #166534; }
.dark .profit-guard-caution { color: #fbbf24; background: #451a03; border-color: #92400e; }
.dark .profit-guard-low     { color: #f87171; background: #450a0a; border-color: #991b1b; }

/* ── Status Badge Colors ───────────────────────────────── */
.status-draft        { background:#f1f5f9; color:#475569; }
.status-sent         { background:#dbeafe; color:#1d4ed8; }
.status-accepted     { background:#dcfce7; color:#15803d; }
.status-declined     { background:#fee2e2; color:#dc2626; }
.status-expired      { background:#fef3c7; color:#b45309; }
.status-converted    { background:#f3e8ff; color:#7e22ce; }
.status-scheduled    { background:#dbeafe; color:#1d4ed8; }
.status-completed    { background:#dcfce7; color:#15803d; }
.status-cancelled    { background:#f1f5f9; color:#475569; }
.status-paid         { background:#dcfce7; color:#15803d; }
.status-overdue      { background:#fee2e2; color:#dc2626; }
.status-partially_paid { background:#fef3c7; color:#b45309; }
.status-void         { background:#f1f5f9; color:#475569; }
.dark .status-draft        { background:#1e293b; color:#94a3b8; }
.dark .status-sent         { background:#1e3a8a; color:#93c5fd; }
.dark .status-accepted, .dark .status-paid, .dark .status-completed { background:#052e16; color:#4ade80; }
.dark .status-declined     { background:#450a0a; color:#f87171; }
.dark .status-expired, .dark .status-partially_paid { background:#451a03; color:#fbbf24; }
.dark .status-converted    { background:#3b0764; color:#d8b4fe; }
.dark .status-overdue      { background:#450a0a; color:#f87171; }
.dark .status-cancelled, .dark .status-void { background:#0f172a; color:#cbd5e1; }

/* ── Animations ────────────────────────────────────────── */
@keyframes slideInRight { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes fadeIn        { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn       { from { opacity:0; transform:scale(0.96); } to { opacity:1; transform:scale(1); } }
.animate-slide-in { animation: slideInRight 0.2s ease-out; }
.animate-fade-in  { animation: fadeIn 0.15s ease-out; }
.animate-scale-in { animation: scaleIn 0.18s ease-out; }

/* ── Onboarding Step Indicator ─────────────────────────── */
.step-indicator { width: 28px; height: 28px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; }
.step-active    { background: var(--primary-700); color: white; }
.step-done      { background: var(--primary-100); color: var(--primary-700); }
.step-pending   { background: #e2e8f0; color: #94a3b8; }
.dark .step-done    { background: var(--primary-950); color: var(--primary-400); }
.dark .step-pending { background: #1e293b; color: #cbd5e1; }

/* ── Calendar Grid ─────────────────────────────────────── */
.calendar-day { min-height: 80px; }
.calendar-day.today { background: var(--primary-50); border-color: var(--primary-300); }
.dark .calendar-day.today { background: var(--primary-950); border-color: var(--primary-800); }
.calendar-job-chip { font-size:10px; padding: 2px 6px; border-radius:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }

/* ── Settings Readability ───────────────────────────────── */
.cq-settings-page > div:not(:first-child) {
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
.dark .cq-settings-page > div:not(:first-child) {
  border-color: #334155 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
.cq-settings-page h4 {
  margin: -0.25rem -0.25rem 0.75rem;
  padding: 0.65rem 0.85rem !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #334155 !important;
}
.dark .cq-settings-page h4 {
  border-color: #334155 !important;
  background: #0f172a;
  color: #e2e8f0 !important;
}

.cq-compact-tables table.cq-responsive-table th,
.cq-compact-tables table.cq-responsive-table td {
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
}

/* ── Invoice Print Styles ──────────────────────────────── */
@media print {
  body * { visibility: hidden !important; }
  #printable-area, #printable-area * { visibility: visible !important; }
  #printable-area { position: absolute; left: 0; top: 0; width: 100%; padding: 24px !important; margin: 0 !important; }
  .no-print { display: none !important; }
}

/* ── Mobile Bottom Nav ─────────────────────────────────── */
@media (max-width: 1023px) {
  .mobile-bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; }
}

/* ── Table Responsive ──────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 600px; }

/* ── Quote Template Print ──────────────────────────────── */
.quote-print-area { max-width: 720px; margin: 0 auto; }

/* ── Checklist Item ────────────────────────────────────── */
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 11px; }

/* ── Demo Mode Banner ──────────────────────────────────── */
.demo-banner { background: repeating-linear-gradient(45deg, #fef3c7, #fef3c7 10px, #fde68a 10px, #fde68a 20px); }

/* ── Calibrator Insight Cards ──────────────────────────── */
.insight-info    { border-left: 3px solid #3b82f6; background: #eff6ff; }
.insight-warning { border-left: 3px solid #f59e0b; background: #fffbeb; }
.insight-action  { border-left: 3px solid #ef4444; background: #fef2f2; }
.dark .insight-info    { background: #1e3a8a20; border-color: #3b82f6; }
.dark .insight-warning { background: #451a0320; border-color: #f59e0b; }
.dark .insight-action  { background: #45090920; border-color: #ef4444; }

/* ── Input Focus Ring ──────────────────────────────────── */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--theme-ring);
  border-color: var(--primary-600) !important;
}

/* ── Button Variants ───────────────────────────────────── */
.btn-primary { background: var(--primary-700); color: white; }
.btn-primary:hover { background: var(--primary-600); }
.dark .btn-primary { background: var(--primary-600); }
.dark .btn-primary:hover { background: var(--primary-500); }

/* ── V7 Readability, depth, and dark-mode system ───────── */
:root {
  color-scheme: light;
  --cq-canvas: #f6f8fa;
  --cq-ink: #172033;
  --cq-muted: #526174;
  --cq-border: #d7dee7;
  --cq-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 28px rgba(15, 23, 42, 0.075);
}

.dark {
  color-scheme: dark;
  --cq-canvas: #08111f;
  --cq-ink: #f4f7fb;
  --cq-muted: #c2ccda;
  --cq-border: #334155;
  --cq-card-shadow: 0 1px 1px rgba(255,255,255,0.04), 0 14px 34px rgba(0,0,0,0.34);
}

body { background: var(--cq-canvas) !important; color: var(--cq-ink); }

/* Tailwind's smallest utilities are too small for daily field use. */
.text-xs { font-size: 0.875rem !important; line-height: 1.35rem !important; }
.text-\[10px\], .text-\[11px\] { font-size: 0.8125rem !important; line-height: 1.15rem !important; }

.bg-white.rounded-2xl.border,
.bg-white.rounded-xl.border,
.bg-white.rounded-3xl.border {
  border-color: var(--cq-border) !important;
  box-shadow: var(--cq-card-shadow) !important;
}

.dark .bg-slate-900:not([class*="dark:bg-"]) { background-color: #111c2e !important; }
.dark .bg-slate-950:not([class*="dark:bg-"]) { background-color: #08111f !important; }
.dark .bg-slate-50:not([class*="dark:bg-"]),
.dark .bg-slate-100:not([class*="dark:bg-"]) { background-color: #1d2a3d !important; }
.dark .bg-slate-950\/70,
.dark .bg-slate-950\/60,
.dark .bg-slate-950\/50,
.dark .bg-slate-950\/40 { background-color: rgba(8, 17, 31, 0.82) !important; }
.dark .bg-slate-800 { background-color: #1d2a3d !important; }
.dark .border-slate-800 { border-color: #334155 !important; }
.dark .border-slate-700 { border-color: #475569 !important; }
.dark .divide-slate-800 > :not([hidden]) ~ :not([hidden]) { border-color: #334155 !important; }

html.dark body .text-slate-300, html.dark body .dark\:text-slate-300 { color: #e2e8f0 !important; }
html.dark body .text-slate-400, html.dark body .dark\:text-slate-400 { color: #c2ccda !important; }
html.dark body .text-slate-500, html.dark body .dark\:text-slate-500 { color: #b5c0cf !important; }
html.dark body .text-slate-600, html.dark body .dark\:text-slate-600 { color: #cbd5e1 !important; }
html.dark body .text-slate-700, html.dark body .text-slate-800, html.dark body .text-slate-900 { color: #f1f5f9 !important; }
html.dark body .dark\:text-forest-400 { color: var(--primary-400) !important; }
.dark .placeholder-slate-400::placeholder,
.dark input::placeholder,
.dark textarea::placeholder { color: #94a3b8 !important; opacity: 1; }
.dark input, .dark select, .dark textarea { color: #f8fafc; }

button, input, select { min-height: 40px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; }
button { font-weight: 600; }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--primary-600) !important;
  outline-offset: 2px !important;
}

.calendar-job-chip { font-size: 12px; padding: 4px 7px; }
.checklist-item { font-size: 13px; padding: 6px 0; }

.cq-kpi-card { min-height: 132px; }
.cq-kpi-value { font-size: clamp(1.55rem, 2vw, 2rem); line-height: 1.15; }
.cq-action-label { display: none; }
.cq-secondary-strip { box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.cq-mobile-list { display: none; }
.cq-job-kpi {
  min-height: 108px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.cq-job-kpi-label {
  display: block;
  color: var(--cq-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cq-job-kpi-value {
  display: block;
  color: var(--cq-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(1.35rem, 1.8vw, 1.75rem);
  font-weight: 800;
  line-height: 1.1;
}
.cq-job-kpi p {
  margin: 0;
  color: var(--cq-muted);
  font-size: 13px;
  line-height: 1.25rem;
}
.cq-job-kpi-profit .cq-job-kpi-label,
.cq-job-kpi-profit .cq-job-kpi-value { color: var(--primary-700); }
.dark .cq-job-kpi-profit .cq-job-kpi-label,
.dark .cq-job-kpi-profit .cq-job-kpi-value { color: var(--primary-400); }
.cq-job-toolbar { align-items: center; }
.cq-jobs-table th { white-space: nowrap; }
.cq-jobs-table tbody tr { transition: background-color .15s ease, box-shadow .15s ease; }
.cq-jobs-table tbody tr:hover { box-shadow: inset 3px 0 0 var(--primary-600); }
.cq-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cq-icon-action {
  min-width: 36px;
  min-height: 36px;
  padding: 8px;
  border-radius: 10px;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cq-icon-action:hover { background: #f1f5f9; color: #0f172a; }
.dark .cq-icon-action { color: #cbd5e1; }
.dark .cq-icon-action:hover { background: #1d2a3d; color: #f8fafc; }
.cq-icon-danger { color: #e11d48; }
.cq-icon-danger:hover { background: #fff1f2; color: #be123c; }
.dark .cq-icon-danger { color: #fb7185; }
.dark .cq-icon-danger:hover { background: #450a0a; color: #fda4af; }
.cq-empty-state {
  padding: 40px 16px;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--cq-muted);
  text-align: center;
}
.cq-empty-state strong { color: var(--cq-ink); }

.fixed.inset-0 > .bg-white.rounded-3xl,
.fixed.inset-0 > .dark\:bg-slate-900.rounded-3xl {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

@media (max-width: 639px) {
  body { font-size: 16px; }
  button, input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
  .table-scroll.cq-desktop-table { display: none; }
  .cq-mobile-list { display: grid; gap: 12px; padding: 12px; }
  .cq-mobile-record {
    border: 1px solid var(--cq-border);
    border-radius: 14px;
    padding: 16px;
    background: white;
    box-shadow: var(--cq-card-shadow);
  }
  .dark .cq-mobile-record { background: #111c2e; }
  .cq-mobile-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 14px; }
  .cq-mobile-actions > button { width: 100%; }
  .calendar-month-view { display: none !important; }
  .table-scroll:has(.cq-responsive-table) { overflow: visible; }
  .cq-responsive-table { display: block; min-width: 0 !important; }
  .cq-responsive-table thead { display: none; }
  .cq-responsive-table tbody { display: grid; gap: 12px; padding: 12px; }
  .cq-responsive-table tbody tr {
    display: block;
    border: 1px solid var(--cq-border);
    border-radius: 14px;
    padding: 10px 14px;
    background: white;
    box-shadow: var(--cq-card-shadow);
  }
  .dark .cq-responsive-table tbody tr { background: #111c2e; }
  .cq-responsive-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 42px;
    padding: 8px 0 !important;
    text-align: right !important;
    border-bottom: 1px solid #e2e8f0;
  }
  .dark .cq-responsive-table tbody td { border-color: #334155; }
  .cq-responsive-table tbody td::before {
    content: attr(data-label);
    color: var(--cq-muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
  }
  .cq-responsive-table tbody td:last-child {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px !important;
    border-bottom: 0;
  }
  .cq-responsive-table .cq-action-label { display: inline; }
  .cq-responsive-table tbody td:last-child button { display: inline-flex; align-items: center; gap: 5px; padding-inline: 10px; }
  .cq-responsive-table tbody td:last-child::before { display: none; }
  .cq-row-actions { width: 100%; justify-content: stretch !important; flex-wrap: wrap; }
  .cq-row-actions > button { flex: 1 1 auto; justify-content: center; }
  .cq-jobs-table tbody td:nth-child(2) {
    display: block;
    text-align: left !important;
  }
  .cq-jobs-table tbody td:nth-child(2)::before {
    display: block;
    margin-bottom: 4px;
  }
  main { padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; }
  .fixed.inset-0 { padding: 8px !important; }
  .fixed.inset-0 > .bg-white.rounded-3xl,
  .fixed.inset-0 > .dark\:bg-slate-900.rounded-3xl {
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page { margin: 12mm; }
  #printable-area { color: #172033 !important; background: white !important; }
}

/* Tailwind's browser runtime appends utilities after this file; the app id keeps
   dark-mode contrast authoritative without touching document print colors. */
html.dark body #app [class*="text-slate-"] { color: #e2e8f0 !important; }
html.dark body #app [class~="text-slate-400"],
html.dark body #app [class~="text-slate-500"],
html.dark body #app [class~="text-slate-600"],
html.dark body #app [class*="dark:text-slate-400"],
html.dark body #app [class*="dark:text-slate-500"],
html.dark body #app [class*="dark:text-slate-600"] { color: #c2ccda !important; }
html.dark body #app [class*="dark:text-slate-900"] { color: #0f172a !important; }
html.dark body #app [aria-current="page"] { background: var(--primary-800) !important; color: white !important; }
html.dark body #app .text-rose-600 { color: #fb7185 !important; }
html.dark body #app .text-forest-700 { color: var(--primary-400) !important; }
html.dark body #app [class*="dark:bg-forest-950"] { background-color: var(--primary-950) !important; }

/* Cleaner Desk reference restyle */
:root {
  --primary-50: #eff6ff; --primary-100: #dbeafe; --primary-200: #bfdbfe;
  --primary-300: #93c5fd; --primary-400: #60a5fa;
  --primary-500: #2563eb; --primary-600: #176bff; --primary-700: #0b6ff6;
  --primary-800: #0759d8; --primary-900: #0b3b8c; --primary-950: #081e3c;
  --theme-ring: rgba(20, 110, 245, 0.28); --theme-hex: #146ef5;
  --cq-canvas: #f7faff;
  --cq-shell-soft: #eaf2ff;
  --cq-ink: #07143a;
  --cq-muted: #52648b;
  --cq-border: #d9e3ef;
  --cq-card-shadow: 0 18px 44px rgba(15, 35, 72, 0.07);
}
[data-theme="emerald"] {
  --primary-50: #f0fdf4; --primary-100: #dcfce7; --primary-200: #bbf7d0;
  --primary-300: #86efac; --primary-400: #4ade80; --primary-500: #22c55e;
  --primary-600: #16a34a; --primary-700: #15803d; --primary-800: #166534;
  --primary-900: #14532d; --primary-950: #052e16; --theme-ring: rgba(22,163,74,0.35);
  --cq-canvas: #f6fdf8; --cq-shell-soft: #e7f8ed; --cq-border: #cfe8d8;
}
[data-theme="ocean"] {
  --primary-50: #eff6ff; --primary-100: #dbeafe; --primary-200: #bfdbfe;
  --primary-300: #93c5fd; --primary-400: #60a5fa; --primary-500: #3b82f6;
  --primary-600: #2563eb; --primary-700: #1d4ed8; --primary-800: #1e40af;
  --primary-900: #1e3a8a; --primary-950: #172554; --theme-ring: rgba(37,99,235,0.35);
  --cq-canvas: #f7faff; --cq-shell-soft: #eaf2ff; --cq-border: #d9e3ef;
}
[data-theme="slate"] {
  --primary-50: #f8fafc; --primary-100: #f1f5f9; --primary-200: #e2e8f0;
  --primary-300: #cbd5e1; --primary-400: #94a3b8; --primary-500: #64748b;
  --primary-600: #475569; --primary-700: #334155; --primary-800: #1e293b;
  --primary-900: #0f172a; --primary-950: #020617; --theme-ring: rgba(71,85,105,0.35);
  --cq-canvas: #f8fafc; --cq-shell-soft: #edf2f7; --cq-border: #d8e0ea;
}
[data-theme="amber"] {
  --primary-50: #fffbeb; --primary-100: #fef3c7; --primary-200: #fde68a;
  --primary-300: #fcd34d; --primary-400: #fbbf24; --primary-500: #f59e0b;
  --primary-600: #d97706; --primary-700: #b45309; --primary-800: #92400e;
  --primary-900: #78350f; --primary-950: #451a03; --theme-ring: rgba(217,119,6,0.35);
  --cq-canvas: #fffaf0; --cq-shell-soft: #fff0c7; --cq-border: #f2d89c;
}
[data-theme="violet"] {
  --primary-50: #faf5ff; --primary-100: #f3e8ff; --primary-200: #e9d5ff;
  --primary-300: #d8b4fe; --primary-400: #c084fc; --primary-500: #a855f7;
  --primary-600: #9333ea; --primary-700: #7e22ce; --primary-800: #6b21a8;
  --primary-900: #581c87; --primary-950: #3b0764; --theme-ring: rgba(147,51,234,0.35);
  --cq-canvas: #fbf7ff; --cq-shell-soft: #f2e7ff; --cq-border: #dfcdf7;
}

body,
#app {
  background:
    radial-gradient(circle at 70% 0%, var(--cq-shell-soft), transparent 34rem),
    var(--cq-canvas) !important;
  color: var(--cq-ink) !important;
}
html,
body,
#app {
  max-width: 100%;
  overflow-x: hidden;
}

#app > aside {
  width: 17.25rem !important;
  background: linear-gradient(180deg, var(--primary-950) 0%, var(--primary-900) 56%, #07111f 100%) !important;
  border-right: 0 !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08), 18px 0 48px rgba(10, 27, 56, 0.08);
}
#app > aside[class~="w-20"] {
  width: 5rem !important;
}
#app > aside[class~="w-64"] {
  width: 17.25rem !important;
}
#app > aside :is(h1, span, div, button) { color: rgba(255, 255, 255, 0.82) !important; }
#app > aside h1 { color: #ffffff !important; font-size: 1.18rem !important; }
#app > aside > div:first-child {
  height: 6.25rem !important;
  border-bottom: 0 !important;
  padding: 1.5rem 1.5rem 1rem !important;
}
#app > aside .brand-mark-box {
  width: 2.75rem !important;
  height: 2.75rem !important;
  border-radius: 0.875rem !important;
  background: #0B192E !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.45rem !important;
  overflow: hidden !important;
}
#app > aside .brand-mark-box img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
#app > aside .sidebar-toggle-btn {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 0.75rem !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.35rem !important;
  transition: all 0.15s ease !important;
}
#app > aside .sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}
#app > aside .flex-1 {
  padding: 0.2rem 0.85rem 0.75rem !important;
}
#app > aside [class*="uppercase"] {
  color: rgba(255, 255, 255, 0.36) !important;
  letter-spacing: 0.08em !important;
}
#app > aside button {
  height: 2.8rem !important;
  border-radius: 0.55rem !important;
  padding-inline: 1rem !important;
  margin-block: 0.16rem !important;
  font-size: 0.98rem !important;
  background: transparent !important;
}
#app > aside svg {
  display: block !important;
  opacity: 0.95;
  stroke: currentColor !important;
}
#app > aside button:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
#app > aside button[aria-current="page"] {
  background: linear-gradient(180deg, var(--primary-600), var(--primary-700)) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 24px var(--theme-ring) !important;
}
#app > aside button[aria-current="page"] * { color: #ffffff !important; }
#app > aside > div:last-child {
  border-top-color: rgba(255, 255, 255, 0.16) !important;
  margin: 0 1rem 1rem !important;
  padding-top: 0.8rem !important;
}

#app header {
  height: 5.9rem !important;
  margin: 1.15rem 2.7rem 0 !important;
  padding: 0.9rem 1rem !important;
  background: rgba(255, 255, 255, 0.78) !important;
  border-bottom: 0 !important;
  border: 1px solid #d6e1f0 !important;
  border-radius: 1.1rem !important;
  box-shadow: 0 18px 42px rgba(15, 35, 72, 0.08) !important;
  backdrop-filter: blur(14px);
  gap: 1rem !important;
}
.dark #app header {
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: #263750 !important;
}
#app header > .cq-title-block {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 24rem;
}
#app header h2 {
  font-size: clamp(1.55rem, 2.25vw, 2.05rem) !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  color: #07143a !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
#app header p { display: none !important; }
.cq-header-search {
  flex: 1 1 20rem !important;
  min-width: min(20rem, 30vw) !important;
  max-width: 26rem !important;
  height: 2.9rem !important;
  border-radius: 0.85rem !important;
  border-color: #d4dfed !important;
  background: #f8fbff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8) !important;
  color: #63759d !important;
  font-weight: 500 !important;
}
.cq-header-search > span {
  min-width: 0 !important;
}
.cq-header-search > span > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#app header .cq-header-actions {
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 0.55rem !important;
}
#app header .cq-sample-actions {
  height: 2.9rem !important;
  padding: 0.25rem !important;
  border: 1px solid #d8e3f2 !important;
  border-radius: 0.9rem !important;
  background: #f7fbff !important;
}
#app header .cq-sample-pill {
  height: 2.35rem !important;
  padding-inline: 0.75rem !important;
  border: 0 !important;
  background: #eaf2ff !important;
  color: var(--primary-800) !important;
  border-radius: 0.7rem !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}
#app header .cq-sample-pill span:first-child {
  background: var(--primary-600) !important;
}
#app header .cq-clear-demo-btn {
  height: 2.35rem !important;
  padding-inline: 0.75rem !important;
  border: 0 !important;
  background: transparent !important;
  color: #526174 !important;
  box-shadow: none !important;
  border-radius: 0.7rem !important;
  white-space: nowrap !important;
}
#app header .cq-clear-demo-btn:hover {
  background: #eef4fb !important;
  color: #07143a !important;
}
#app header .cq-primary-action,
#app header .cq-secondary-action,
#app header .cq-mobile-search {
  height: 2.9rem !important;
  border-radius: 0.85rem !important;
  padding-inline: 1rem !important;
  font-size: 0.82rem !important;
  box-shadow: none !important;
  white-space: nowrap !important;
}
#app header .cq-user-chip {
  display: none !important;
}

@media (max-width: 1280px) {
  #app header {
    gap: 0.75rem !important;
  }
  .cq-header-search {
    display: none !important;
  }
  #app header > .cq-title-block {
    max-width: none;
  }
}
#app header .bg-forest-700 {
  background: var(--primary-700) !important;
}
#app header .border {
  border-color: var(--cq-border) !important;
  background: #ffffff !important;
}

#app main {
  padding: 1.05rem 2.7rem 2.7rem !important;
  background: transparent !important;
  min-width: 0;
}
#app main > div {
  max-width: 1440px;
  margin-inline: auto;
}

#app main .bg-white.rounded-2xl.border,
#app main .bg-white.rounded-xl.border,
#app main .bg-white.rounded-3xl.border,
#app main .bg-slate-50.rounded-2xl.border,
#app main .bg-slate-50.rounded-xl.border {
  border-color: var(--cq-border) !important;
  border-radius: 0.65rem !important;
  background: color-mix(in srgb, white 90%, var(--primary-50)) !important;
  box-shadow: var(--cq-card-shadow) !important;
}

.cq-kpi-card {
  min-height: 8.25rem !important;
  padding: 1.45rem 1.4rem !important;
}
.cq-kpi-card .cq-kpi-value {
  font-size: clamp(1.75rem, 2.35vw, 2.15rem) !important;
  color: #07143a !important;
}
.cq-kpi-card .text-xs:first-child,
.cq-kpi-card .text-slate-500 {
  color: #586b95 !important;
}
.cq-kpi-card i {
  color: var(--primary-600) !important;
}

.cq-secondary-strip {
  border-color: #d9e3ef !important;
  border-radius: 0.65rem !important;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 0 12px 28px rgba(15, 35, 72, 0.045) !important;
}
.cq-secondary-strip > div {
  min-height: 3.25rem !important;
  padding-block: 0.85rem !important;
}
.cq-dashboard-main-grid {
  align-items: start;
}
.cq-dashboard-left > .bg-white,
.cq-dashboard-right > .bg-white {
  padding: 1.45rem !important;
}
.cq-dashboard-left > .bg-white:first-child {
  min-height: 20rem;
}
.cq-dashboard-left h3,
.cq-dashboard-right h3 {
  font-size: 1.55rem !important;
  color: #07143a !important;
  letter-spacing: 0 !important;
}
.cq-dashboard-left .border-b,
.cq-dashboard-right .border-b {
  border-bottom-color: #e0e8f2 !important;
}

#app main :is(input, select, textarea) {
  border-color: #d4dfed !important;
  border-radius: 0.65rem !important;
  background: #fbfdff !important;
}
#app main button {
  border-radius: 0.65rem !important;
}
#app main .bg-forest-700,
#app main .bg-forest-600 {
  background: var(--primary-700) !important;
}
#app main .text-forest-700,
#app main .text-forest-600,
#app main .text-forest-400 {
  color: var(--primary-700) !important;
}
#app main .bg-forest-50 {
  background: var(--primary-50) !important;
}

#app .bg-forest-700,
#app .bg-forest-600,
#app .hover\:bg-forest-600:hover,
#app .hover\:bg-forest-500:hover {
  background-color: var(--primary-700) !important;
}
#app .bg-forest-50,
#app .bg-forest-100,
#app .dark\:bg-forest-950\/30,
#app .dark\:bg-forest-950\/40,
#app .dark\:bg-forest-950\/50,
#app .dark\:bg-forest-950 {
  background-color: var(--primary-50) !important;
}
#app .text-forest-900,
#app .text-forest-800,
#app .text-forest-700,
#app .text-forest-600,
#app .text-forest-400,
#app .dark\:text-forest-400,
#app .dark\:text-forest-300,
#app .dark\:text-forest-200 {
  color: var(--primary-700) !important;
}
#app .border-forest-600,
#app .border-forest-500,
#app .border-forest-300,
#app .border-forest-200,
#app .border-forest-100,
#app .dark\:border-forest-900,
#app .dark\:border-forest-800 {
  border-color: var(--primary-300) !important;
}
#app .ring-forest-600\/30,
#app .ring-forest-600\/20 {
  --tw-ring-color: var(--theme-ring) !important;
}
#app input[type="checkbox"],
#app input[type="radio"] {
  accent-color: var(--primary-700);
}

.cq-settings-page {
  display: grid;
  gap: 1.25rem;
}
.cq-settings-page > div:not(:first-child) {
  border: 1px solid var(--cq-border) !important;
  border-radius: 0.75rem !important;
  background: #ffffff !important;
  box-shadow: 0 16px 34px rgba(15, 35, 72, 0.06) !important;
}
.cq-settings-page h4 {
  margin: -0.25rem -0.25rem 1rem !important;
  border: 0 !important;
  border-bottom: 1px solid #e0e8f2 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--primary-900) !important;
  font-size: 0.88rem !important;
}

/* Final polish scale and density */
html { font-size: 95%; }
#app .space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem !important; }
#app .space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.05rem !important; }
#app main .p-6 { padding: 1.25rem !important; }
#app main .p-5 { padding: 1.15rem !important; }
#app main .p-4 { padding: 0.95rem !important; }
.cq-job-kpi { min-height: 6rem !important; padding: 1rem 1.15rem !important; }
.cq-job-kpi-value { font-size: 1.55rem !important; }
.cq-empty-state {
  min-height: 7.25rem !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem !important;
  color: #7a8aa7 !important;
}
.cq-dashboard-right .cq-empty-state,
.cq-dashboard-left .cq-empty-state {
  min-height: 6.5rem !important;
}
.cq-empty-state i {
  color: var(--primary-600) !important;
}
#app main .bg-white.rounded-2xl.border:hover {
  border-color: var(--primary-200) !important;
}
.cq-action-label {
  display: inline !important;
}
.cq-icon-action,
#app main td button[title*="Edit"],
#app main td button[title*="Delete"] {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 1023px) {
  #app {
    width: 100vw;
  }
  #app header {
    height: auto !important;
    margin: 0.8rem 1rem 0 !important;
    padding: 0.85rem !important;
    flex-wrap: wrap;
    gap: 0.75rem !important;
  }
  #app header > .cq-title-block {
    flex: 1 1 auto;
    min-width: 0;
  }
  .cq-header-actions {
    flex: 0 0 auto;
    max-width: 100%;
    gap: 0.45rem;
  }
  .cq-mobile-search {
    display: inline-flex !important;
  }
  #app header button {
    white-space: nowrap;
  }
  #app header h2 {
    font-size: 1.55rem !important;
  }
  #app main {
    width: 100%;
    padding: 0.75rem 1rem 2rem !important;
  }
  #app main > div {
    width: 100%;
    max-width: 100%;
  }
  #app main .inline-flex.rounded-xl {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app main .inline-flex.rounded-xl > button {
    flex: 0 0 auto;
  }
  .cq-secondary-strip > div {
    justify-content: flex-start !important;
  }
}

@media (max-width: 767px) {
  .cq-onboarding-modal {
    max-width: calc(100vw - 1rem) !important;
    padding: 1rem !important;
    border-radius: 1rem !important;
    overflow: visible;
  }
  .cq-onboarding-progress {
    flex-wrap: wrap;
    row-gap: 0.5rem !important;
  }
  .cq-onboarding-progress .step-indicator {
    width: 1.75rem;
    height: 1.75rem;
  }
  .cq-onboarding-progress > .flex-1 {
    order: 2;
    flex-basis: 100%;
    margin-left: 0 !important;
  }
  .cq-onboarding-progress > button {
    margin-left: auto !important;
  }
  #app header {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    margin: 1.1rem 1rem 2rem !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none;
    gap: 1rem !important;
    overflow: visible !important;
  }
  #app header > .cq-title-block {
    padding-inline: 0.25rem;
  }
  #app header > div:first-child {
    width: 100% !important;
  }
  .cq-header-actions {
    width: 100% !important;
    margin-left: 0 !important;
    display: grid !important;
    grid-template-columns: 0.85fr minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 0.5rem !important;
    position: static !important;
  }
  .cq-sample-actions {
    display: none !important;
  }
  .cq-header-actions > * {
    margin-left: 0 !important;
  }
  .cq-mobile-search {
    width: 100% !important;
    padding-inline: 0.55rem !important;
    gap: 0.35rem;
  }
  #app header .cq-primary-action,
  #app header .cq-secondary-action,
  #app header .cq-mobile-search {
    min-height: 2.85rem !important;
  }
  .cq-mobile-search-label {
    display: inline !important;
  }
  .cq-dashboard-kpis,
  #app main .grid.grid-cols-1.min-\[390px\]\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
  .cq-dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }
  .cq-dashboard-kpis .cq-kpi-card {
    min-height: 5.6rem !important;
    padding: 0.85rem !important;
    border-radius: 0.9rem !important;
    gap: 0.25rem !important;
  }
  .cq-dashboard-kpis .cq-kpi-card .cq-kpi-value {
    font-size: 1.35rem !important;
    line-height: 1.55rem !important;
  }
  .cq-dashboard-kpis .cq-kpi-card .text-xs {
    line-height: 1.1rem !important;
  }
  #app main .flex,
  #app main .grid,
  #app main table,
  #app main input,
  #app main select,
  #app main textarea {
    max-width: 100% !important;
  }
  #app main .rounded-2xl,
  #app main .rounded-xl {
    min-width: 0 !important;
  }
  #app main .inline-flex.rounded-xl {
    width: 100% !important;
    justify-content: flex-start !important;
  }
  .cq-timeframe-filter > div:first-child {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .cq-timeframe-filter .inline-flex.rounded-xl {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
    overflow: visible !important;
  }
  .cq-timeframe-filter .inline-flex.rounded-xl > button {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 430px) {
  .cq-dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  #app header {
    align-items: flex-start !important;
    margin-bottom: 2rem !important;
  }
  .cq-header-actions {
    flex-basis: 100%;
    width: 100% !important;
    margin-left: 0 !important;
    display: grid !important;
    grid-template-columns: 0.85fr minmax(0, 1fr) minmax(0, 1fr) !important;
  }
  .cq-header-actions > button {
    width: 100%;
    padding-inline: 0.55rem !important;
  }
  #app main .flex.items-center.gap-2 {
    min-width: 0;
  }
  #app main .bg-white,
  #app main .bg-slate-50 {
    max-width: 100%;
  }
  .cq-dashboard-kpis .cq-kpi-card { min-height: 5.6rem !important; }
  .cq-dashboard-kpis .cq-kpi-card .cq-kpi-value { font-size: 1.35rem !important; }
  .cq-dashboard-left h3,
  .cq-dashboard-right h3 {
    font-size: 1.25rem !important;
  }
  .cq-secondary-strip {
    overflow: hidden;
  }
  .cq-secondary-strip span {
    overflow-wrap: anywhere;
  }
}
