:root { color-scheme: dark; }

html,
body,
.orbit-app,
.orbit-auth,
.bg-aurora {
  color: #f4f6fa !important;
  background:
    radial-gradient(58% 46% at 4% -10%, rgba(100,92,255,.20), transparent 62%),
    radial-gradient(48% 38% at 102% 0%, rgba(36,220,211,.11), transparent 64%),
    radial-gradient(44% 32% at 64% 110%, rgba(147,80,255,.08), transparent 68%),
    #090c14 !important;
}

html, body { min-height: 100%; }
::-webkit-scrollbar-thumb { background: #333a48; }
::-webkit-scrollbar-thumb:hover { background: #464f60; }

.orbit-app .card,
.orbit-auth .card,
.orbit-app .glass,
.orbit-app .glass-solid,
.orbit-auth .glass,
.orbit-auth .glass-solid,
.orbit-app [class*="bg-white"],
.orbit-auth [class*="bg-white"] {
  color: #f4f6fa !important;
  background: linear-gradient(155deg, rgba(24,29,41,.98), rgba(17,21,30,.98)) !important;
  border-color: #2a303b !important;
  box-shadow: 0 16px 38px -30px rgba(0,0,0,.85) !important;
}

/* Full-height drawers used arbitrary light backgrounds, so generic
   bg-white rules could not reach them. Keep their whole surface dark. */
#leadDetailPanel,
#aiWorkspacePanel,
.prospect-focus-shell {
  color: #e7eaf1 !important;
  background: #0f131b !important;
  border-color: #2a303b !important;
}

#leadDetailPanel,
#aiWorkspacePanel {
  border-left: 1px solid #2a303b !important;
  box-shadow: -22px 0 50px -32px rgba(0,0,0,.95) !important;
}

#leadDetailContent {
  color: #e7eaf1 !important;
}

#leadDetailOverlay > div:first-child {
  background: rgba(3,5,9,.72) !important;
}

.orbit-app > .flex > aside,
.orbit-sidebar {
  color: #e7eaf1 !important;
  background: linear-gradient(180deg, rgba(17,21,31,.99), rgba(12,15,23,.99)) !important;
  border-color: #292f3a !important;
  box-shadow: 18px 0 44px -38px rgba(0,0,0,.9) !important;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100dvh;
  align-self: flex-start;
  overflow: hidden;
}

.orbit-sidebar > nav { min-height: 0; overscroll-behavior: contain; }
.orbit-sidebar__footer { flex: none; }

.orbit-sidebar__brand,
.orbit-sidebar__footer { border-color: #292f3a !important; }
.orbit-sidebar__brand { position: relative; }
.orbit-sidebar__brand::after {
  content: ''; position: absolute; left: 4px; right: 4px; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, rgba(66,232,224,.5), rgba(119,117,255,.42), transparent);
}
.orbit-sidebar__label { color: #72798b !important; }
.orbit-sidebar .nav-item { color: #9ca2b1; }
.orbit-sidebar .nav-item:hover { color: #eef0f5 !important; background: #20252f !important; }
.orbit-sidebar .nav-item.active {
  color: #d9dcff !important;
  background: linear-gradient(90deg, rgba(82,84,184,.34), rgba(38,43,72,.52)) !important;
  box-shadow: inset 2px 0 #7775ff, 0 10px 22px -20px rgba(119,117,255,.9);
}
.orbit-sidebar .nav-item > svg { color: #8b92a3 !important; background: #20252f !important; }
.orbit-sidebar .nav-item.active > svg { color: #9da0ff !important; background: #30345d !important; }
.orbit-sidebar .nav-item [id^="navCount_"] { color: #aeb4c2 !important; background: #252b35 !important; }

.orbit-app .input-field,
.orbit-auth .input-field,
.orbit-app input,
.orbit-app textarea,
.orbit-app select,
.orbit-auth input {
  color: #edf0f5 !important;
  background-color: #11151d !important;
  border-color: #303744 !important;
}
.orbit-app input::placeholder,
.orbit-app textarea::placeholder,
.orbit-auth input::placeholder { color: #6f7688 !important; }
.orbit-app .input-field:focus,
.orbit-auth .input-field:focus,
.orbit-app input:focus,
.orbit-app textarea:focus,
.orbit-app select:focus {
  background-color: #141923 !important;
  border-color: #7377ff !important;
  box-shadow: 0 0 0 4px rgba(99,102,241,.16) !important;
}

.orbit-app .btn-ghost,
.orbit-auth .btn-ghost,
.orbit-app button[class*="border-line"] {
  color: #d8dce6 !important;
  background: #1a1f29 !important;
  border-color: #303744 !important;
}
.orbit-app .btn-ghost:hover,
.orbit-auth .btn-ghost:hover { background: #232a36 !important; border-color: #444d5d !important; }

.orbit-app .btn-primary,
.orbit-auth .btn-primary {
  background: linear-gradient(135deg, #4f63ed 0%, #745cff 62%, #9759eb 100%) !important;
  box-shadow: 0 12px 28px -14px rgba(116,92,255,.85) !important;
}
.orbit-app .btn-primary:hover,
.orbit-auth .btn-primary:hover {
  box-shadow: 0 16px 34px -14px rgba(66,232,224,.25), 0 14px 30px -14px rgba(116,92,255,.9) !important;
}

.orbit-app #pageTitle,
.orbit-app h1,
.orbit-app h2,
.orbit-app h3,
.orbit-app h4,
.orbit-app h5,
.orbit-auth h1,
.orbit-auth h2,
.orbit-panel__head h4,
.orbit-metric__value,
.orbit-metric__label,
.orbit-stage-list button strong,
.orbit-empty h5,
.orbit-activity strong,
.orbit-analytics-head h3,
.orbit-funnel strong,
.orbit-health-grid strong,
.orbit-category-table > div > span:last-child,
.prospect-hero h3,
.prospect-card h4,
.prospect-social-stats strong,
.prospect-focus-profile h2,
.prospect-focus-card__head h3,
.prospect-focus-intel strong,
.prospect-focus-done h3,
.ws-md .ws-md-h1,
.ws-md .ws-md-h2,
.ws-md .ws-md-h3,
.ws-md .ws-md-h4 { color: #f1f3f7 !important; }

.orbit-app #pageSubtitle,
.orbit-metric__note,
.orbit-empty p,
.orbit-activity small,
.orbit-analytics-head > div > p:last-child,
.orbit-funnel small,
.orbit-health-grid small,
.prospect-hero p:last-child,
.prospect-card__top p,
.prospect-social-stats small,
.prospect-focus-profile p,
.prospect-focus-done p { color: #8f96a7 !important; }

.orbit-metric,
.orbit-agenda__row,
.orbit-stage-list button,
.orbit-health-grid button,
.prospect-hero,
.prospect-filter,
.prospect-card,
.prospect-focus-shell,
.prospect-focus-head,
.prospect-focus-card,
.prospect-focus-nav,
.prospect-contact-list > a,
.prospect-focus-notes textarea,
.prospect-focus-notes input,
.prospect-focus-intel span,
.prospect-social-stats div,
.prospect-card__actions a,
.prospect-card__actions button,
.orbit-period,
.ws-menu {
  color: #d8dce6 !important;
  background: #171b24 !important;
  border-color: #2a303b !important;
}

.orbit-agenda__row--late { background: #2b171d !important; border-color: #552834 !important; }
.focus-task,
.focus-notes button,
.focus-summary > div:not(.orbit-panel__head) { color:#d8dce6; background:#171b24; border-color:#2a303b; }
.focus-task:hover { background:#1d222d; border-color:#363d49; }
.focus-task--late { background:#2b171d; border-color:#552834; }
.focus-task__body strong,
.focus-notes strong,
.focus-summary > div:not(.orbit-panel__head) span { color:#f1f3f7; }
.focus-task__body small,
.focus-notes small,
.focus-summary > div:not(.orbit-panel__head) p { color:#8f96a7; }
.focus-notes button > span:first-child { background:#24234a; color:#8f82ff; }
.progress-track,
.orbit-stagebar,
.prospect-scoreline,
.orbit-funnel em,
.orbit-category-table em { background: #282e39 !important; }
.palette-row[data-highlighted="true"],
.ws-conv-row.pinned,
.ws-menu-item:hover { background: #242a36 !important; }
.skeleton { background: linear-gradient(90deg,#1b202a 25%,#262c37 37%,#1b202a 63%); background-size: 400% 100%; }

.orbit-auth::before { opacity: .18; }
.orbit-auth .card { background: rgba(23,27,36,.96) !important; }

@media (prefers-color-scheme: light) {
  :root { color-scheme: dark; }
}
html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
img, video, canvas, svg { max-width: 100%; }
.main, main, #mainContent { min-width: 0; max-width: 100%; overflow-x: hidden; }

/* Responsive shell safety. Keep the application usable in narrow PWA windows. */
.orbit-v2,
.orbit-v2 > section,
.orbit-panel,
.orbit-command,
#viewRoot { min-width: 0; max-width: 100%; }
.orbit-panel,
.orbit-command,
.orbit-metric { overflow: hidden; }
.orbit-metric > div:last-child,
.orbit-panel__head > div,
.orbit-agenda__row,
.orbit-agenda__row > div { min-width: 0; }
.orbit-metric__label,
.orbit-metric__note,
.orbit-panel__head h4 { overflow-wrap: anywhere; }

@media (max-width: 1535px) {
  .orbit-sidebar { display: none !important; }
  .orbit-mobile-topbar { display: flex !important; }
  .orbit-mobile-nav:not(.hidden) { display: block !important; }
}

.orbit-mobile-topbar {
  padding-top: max(0.75rem, env(safe-area-inset-top));
}

@media (max-width: 639px) {
  .orbit-v2 { gap: 14px !important; }
  .orbit-command { padding: 18px 16px !important; border-radius: 18px; }
  .orbit-command__glow { right: -180px; }
  .orbit-command__primary,
  .orbit-command__secondary { flex: 1 1 150px; }
  .orbit-metric { min-height: 0; padding: 14px; }
  .orbit-metric__value { white-space: normal; overflow-wrap: anywhere; }
  .orbit-panel { padding: 15px; border-radius: 18px; }
  .orbit-panel__head { min-width: 0; gap: 8px; }
  .orbit-link { flex: none; }
  .orbit-health-grid { grid-template-columns: 1fr; }
  .orbit-category-table { width: 100%; overflow-x: auto; }
  .orbit-category-table__head,
  .orbit-category-table > div { min-width: 430px; }
}

/* Citadel Command theme. Deliberately sharper and more operational than
   Terra: graphite surfaces, electric blue actions and restrained orange
   urgency cues. */
html,
body,
.orbit-app,
.orbit-auth,
.bg-aurora {
  background:
    linear-gradient(rgba(72,153,211,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72,153,211,.02) 1px, transparent 1px),
    radial-gradient(55% 40% at 100% -8%, rgba(42,157,220,.13), transparent 65%),
    #090e13 !important;
  background-size: 54px 54px, 54px 54px, auto, auto !important;
}

.orbit-app .card,
.orbit-auth .card,
.orbit-app .glass,
.orbit-app .glass-solid,
.orbit-auth .glass,
.orbit-auth .glass-solid,
.orbit-app [class*="bg-white"],
.orbit-auth [class*="bg-white"] {
  background: #121a22 !important;
  border-color: #263441 !important;
  border-radius: 15px !important;
  box-shadow: 0 14px 32px -28px rgba(0,0,0,.95) !important;
}

.orbit-app > .flex > aside,
.orbit-sidebar {
  background: #0b1118 !important;
  border-color: #22303c !important;
}
.orbit-sidebar__brand,
.orbit-sidebar__footer { border-color: #22303c !important; }
.orbit-sidebar__brand::after {
  background: linear-gradient(90deg, #2aa8e6, rgba(42,168,230,.24), transparent) !important;
}
.orbit-sidebar__quick,
.orbit-app .btn-primary,
.orbit-auth .btn-primary {
  background: #147eb7 !important;
  box-shadow: 0 12px 25px -16px rgba(42,168,230,.85) !important;
}
.orbit-sidebar__quick:hover,
.orbit-app .btn-primary:hover,
.orbit-auth .btn-primary:hover { background: #1994d2 !important; }
.orbit-app .btn-ai,
.orbit-auth .btn-ai,
.grad-ai,
.grad-brand { background: linear-gradient(135deg,#137db4,#20a3df) !important; }
.orbit-sidebar .nav-item.active {
  color: #dff4ff !important;
  background: #142838 !important;
  box-shadow: inset 2px 0 #35b8f1 !important;
}
.orbit-sidebar .nav-item.active > svg { color:#69cdf7 !important; background:#18384b !important; }
.orbit-sidebar .nav-item:hover { background:#14202a !important; }
.orbit-sidebar .nav-item > svg { background:#151f29 !important; }

.orbit-app .input-field:focus,
.orbit-auth .input-field:focus,
.orbit-app input:focus,
.orbit-app textarea:focus,
.orbit-app select:focus {
  border-color:#2aa8e6 !important;
  box-shadow:0 0 0 3px rgba(42,168,230,.13) !important;
}
.orbit-command {
  border-color:#274961 !important;
  background:linear-gradient(118deg,#101a23 0%,#142b3a 62%,#17435b 100%) !important;
  box-shadow:0 22px 46px -36px rgba(24,130,184,.7) !important;
}
.orbit-command__glow { background:radial-gradient(circle,rgba(53,184,241,.18),transparent 68%) !important; }
.focus-day-switch button.active {
  background:#1689c3 !important;
  box-shadow:0 9px 18px -12px rgba(42,168,230,.9) !important;
}
.orbit-link,
.grad-text { color:#54c3f2 !important; }
.focus-notes button > span:first-child { background:#153246 !important; color:#69cdf7 !important; }
.orbit-count,
.orbit-soft-label { background:#153246 !important; color:#69cdf7 !important; }
.focus-task--late,
.orbit-agenda__row--late { background:#291a16 !important; border-color:#5a3424 !important; }
