/* Joblio theme system: preserve branded components, theme neutral surfaces only. */
:root {
  color-scheme: light;
  --theme-page: #f3f6fb;
  --theme-surface: #ffffff;
  --theme-surface-soft: #f7f9fc;
  --theme-ink: #102650;
  --theme-muted: #687897;
  --theme-line: #e4eaf3;
  --theme-input: #fafcff;
  --theme-blue: #2d63ff;
  --theme-toggle-bg: rgba(255,255,255,.86);
  --theme-toggle-border: rgba(16,38,80,.13);
  --theme-toggle-color: #17315f;
  --theme-shadow: 0 10px 28px rgba(31,55,95,.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-light: #071426;
  --bg-white: #0e2038;
  --text-dark: #eef5ff;
  --text-muted: #9fb0ca;
  --border-light: #29415f;
  --card: #0e2038;
  --bg: #071426;
  --muted: #9fb0ca;
  --ink: #eef5ff;
  --line: #29415f;
  --soft: #132944;
  --theme-page: #071426;
  --theme-surface: #0e2038;
  --theme-surface-soft: #132944;
  --theme-ink: #eef5ff;
  --theme-muted: #9fb0ca;
  --theme-line: #29415f;
  --theme-input: #0a1a30;
  --theme-blue: #75a4ff;
  --theme-toggle-bg: rgba(14,32,56,.82);
  --theme-toggle-border: rgba(159,176,202,.28);
  --theme-toggle-color: #dce9ff;
  --theme-shadow: 0 16px 38px rgba(0,0,0,.26);
}

html[data-theme="dark"] body:not(.joblio-home),
html[data-theme="dark"] :is(.dashboard-page,.about-page,.faq-page,.cv-enhancer-page,.apply-app,.company-select-page,.email-previews-page,.login-page,.signup-page,.admin-page) {
  background-color: var(--theme-page) !important;
  color: var(--theme-ink);
}

html[data-theme="dark"] .dashboard-overview-page {
  background: linear-gradient(180deg,#102c52 0,var(--theme-page) 500px) !important;
}

/* Navigation */
html[data-theme="dark"] :is(.main-header,.public-header,.profile-header,.admin-topbar,.home-header) {
  background: rgba(7,20,38,.88) !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-ink);
}
html[data-theme="dark"] :is(.header-nav,.public-nav,.admin-user,.home-actions) a:not(.btn):not(.btn-primary),
html[data-theme="dark"] :is(.brand,.admin-brand,.home-brand,.logo,.nav-link) { color: var(--theme-ink) !important; }
html[data-theme="dark"] :is(.dropdown-menu,.user-dropdown) { background: var(--theme-surface) !important; border-color: var(--theme-line) !important; }

/* Neutral cards and work areas. Deliberately excludes branded navy panels. */
html[data-theme="dark"] :is(
  .card,.application-card,.table-row,.form-card,.login-form-wrap,.signup-form-wrap,
  .modal-content,.faq-item,.principle-card,.team-card,.opportunity-card,.company-card,
  .preview-card,.template-card,.action-option,.stat-card,.profile-card,.form-section,
  .profile-strength,.home-stats>a,.home-panel,.directory-card,.detail-card,.candidate-hero,
  .metric-grid article,.surface,.quality,.search-bar,.job-card,.empty-state,.review-card,
  .pipeline>div,.rail,.cv-customize-panel,.cv-preview-panel,.cv-guidance-panel
) {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-ink) !important;
  box-shadow: var(--theme-shadow);
}

html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6) { color: var(--theme-ink); }
html[data-theme="dark"] :is(.muted,.text-muted,.subtitle,.section-subtitle,.summary-copy,.home-welcome>div>p:last-child,.section-head p,.view-head p,.field>label,.field small) { color: var(--theme-muted) !important; }
html[data-theme="dark"] a:not(.btn-primary):not(.export-button):not(.profile-submit) { text-decoration-color: currentColor; }

html[data-theme="dark"] :is(input,textarea,select,.select2-selection--single,.select2-dropdown) {
  background-color: var(--theme-input) !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-ink) !important;
}
html[data-theme="dark"] :is(input,textarea)::placeholder { color: #8093af !important; opacity: 1; }
html[data-theme="dark"] :is(table,tr,th,td) { border-color: var(--theme-line) !important; }
html[data-theme="dark"] th { background: var(--theme-surface-soft) !important; color: var(--theme-muted) !important; }
html[data-theme="dark"] td { background: var(--theme-surface) !important; color: var(--theme-ink); }

/* Workspace-specific neutral elements */
html[data-theme="dark"] .workspace-home-page { --home-ink:var(--theme-ink);--home-muted:var(--theme-muted);--home-line:var(--theme-line); }
html[data-theme="dark"] :is(.pipeline-visual>div,.quick-links a,.drop,.review-grid>aside,.answers>div) { background: var(--theme-surface-soft) !important; border-color: var(--theme-line) !important; }
html[data-theme="dark"] .strength-ring:after,
html[data-theme="dark"] .match-ring { background-color: var(--theme-surface) !important; }

/* Public homepage keeps its visual hierarchy while adopting dark surfaces. */
html[data-theme="dark"] .joblio-home {
  --home-bg:#071426;--home-surface:#0e2038;--home-ink:#eef5ff;--home-muted:#9fb0ca;--home-border:rgba(159,176,202,.18);
  background: radial-gradient(circle at 18% 3%,rgba(45,99,255,.18),transparent 30rem),radial-gradient(circle at 82% 8%,rgba(16,185,129,.12),transparent 28rem),linear-gradient(180deg,#071426 0%,#09192e 48%,#071426 100%) !important;
  color: var(--home-ink);
}
html[data-theme="dark"] .joblio-home :is(.product-card,.start-card,.trust-card,.feature-card,.workflow-card,.mock-window,.mini-mock,.final-cta) { background: rgba(14,32,56,.92) !important; border-color: var(--home-border) !important; }
html[data-theme="dark"] .joblio-home :is(.job-mini,.contact-card,.composer) { background: #132944 !important; border-color: var(--home-border) !important; color: var(--home-ink); }
html[data-theme="dark"] .joblio-home :is(.hero-subhead,.product-card p,.feature-card p,.start-card p,.trust-card p,.final-cta p) { color: var(--home-muted); }
html[data-theme="dark"] .joblio-home .hero::before { background: linear-gradient(135deg,rgba(36,76,145,.42),rgba(7,91,78,.36)); }
html[data-theme="dark"] .joblio-home .control-section { background: linear-gradient(135deg,rgba(36,76,145,.28),rgba(7,91,78,.24)); }
html[data-theme="dark"] .joblio-home .product-card::after { background: linear-gradient(180deg,transparent,#0e2038); }
html[data-theme="dark"] .joblio-home .btn-secondary,
html[data-theme="dark"] .joblio-home .eyebrow { background: rgba(14,32,56,.86); color:#8fb2ff; }

/* The CV document preview represents printable output and intentionally stays light. */
html[data-theme="dark"] :is(.template-preview,.mock-cv,.template-sheet) { color-scheme: light; }

/* Minimal brand-aligned theme control */
button.theme-toggle {
  align-items:center;appearance:none;background:transparent !important;border:0 !important;
  border-radius:999px;box-shadow:none !important;color:var(--theme-toggle-color);cursor:pointer;display:inline-flex;
  flex:0 0 auto;height:30px;justify-content:center;min-height:0;min-width:0;padding:0 !important;position:relative;transition:background .2s ease,border-color .2s ease,color .2s ease,transform .2s ease;width:30px;
}
button.theme-toggle:hover { color:#2d63ff;transform:translateY(-1px); }
.theme-toggle__icon { display:inline-grid;height:15px;place-items:center;width:15px; }
.theme-toggle__svg { display:block;fill:none;height:100%;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:100%; }
.theme-toggle:focus-visible { box-shadow:0 0 0 3px rgba(45,99,255,.24) !important;outline:none; }
@media (prefers-reduced-motion:reduce) { button.theme-toggle { transition:none; } }
@media (max-width:720px) { button.theme-toggle{height:30px;width:30px}.theme-toggle__icon{height:15px;width:15px} }
