/* Light mode for the carrier portal pages. Dark is the original look; these
   rules only apply when <html data-theme="light"> is set by theme.js. */
html[data-theme=light] { color-scheme: light; }
html[data-theme=light] body { background: #f7f7fa; color: #17131e; }
html[data-theme=light] :where(main, .portal-header, .auth-main, .legal) a { color: #5b21b6; }
html[data-theme=light] .brand { color: #17131e; }
html[data-theme=light] .portal-header { border-bottom-color: #ded9e8; background: #fff; }
html[data-theme=light] .eyebrow,
html[data-theme=light] .recommended-tag { color: #6d28d9; }
html[data-theme=light] .skip-link { background: #17131e; color: #fff; }

/* Muted text */
html[data-theme=light] .billing,
html[data-theme=light] .fee-note,
html[data-theme=light] .portal-start-intro > p:last-child,
html[data-theme=light] .portal-panel > p,
html[data-theme=light] .question-description,
html[data-theme=light] .service-option-description,
html[data-theme=light] .service-option-perk,
html[data-theme=light] .dash-muted,
html[data-theme=light] .deadline-detail,
html[data-theme=light] .order-meta,
html[data-theme=light] .order-item-price,
html[data-theme=light] .order-checklist,
html[data-theme=light] .catalog-option small,
html[data-theme=light] .ft-connections small,
html[data-theme=light] .ft-progress li,
html[data-theme=light] .ft-miles,
html[data-theme=light] .ft-copy dt,
html[data-theme=light] .doc-name small,
html[data-theme=light] .doc-empty,
html[data-theme=light] .upload-hint { color: #5b5368; }
html[data-theme=light] .portal-status,
html[data-theme=light] .question-progress,
html[data-theme=light] .ft-steps,
html[data-theme=light] .notice { color: #2e2639; }

/* Cards and panels */
html[data-theme=light] .service-card,
html[data-theme=light] .portal-panel,
html[data-theme=light] .order-card { background: #fff; border-color: #ded9e8; box-shadow: 0 2px 8px rgba(25,23,36,.05); }
html[data-theme=light] .service-option,
html[data-theme=light] .ft-connect,
html[data-theme=light] .ft-drop,
html[data-theme=light] .ft-record { background: #fbfaff; border-color: #ded9e8; }
html[data-theme=light] .ft-drop { border-color: #c4b8d6; }
html[data-theme=light] .ft-record.needs { border-color: #d97706; }
html[data-theme=light] .service-option.recommended,
html[data-theme=light] .dash-callout,
html[data-theme=light] .ft-schedule { border-color: #a78bfa; background: #f3eeff; }
html[data-theme=light] .question-choice,
html[data-theme=light] .catalog-option { border-color: #d4cbe2; }
html[data-theme=light] .question-choice:has(input:checked),
html[data-theme=light] .catalog-option:has(input:checked),
html[data-theme=light] .ft-drop.dragging { background: #f3eeff; border-color: #7c3aed; }
html[data-theme=light] .notice,
html[data-theme=light] fieldset { border-color: #c4b8d6; }
html[data-theme=light] .ft-waiting { border-color: #a78bfa; }

/* Divider lines */
html[data-theme=light] .deadline-list li,
html[data-theme=light] .order-items > li,
html[data-theme=light] .ft-connections li,
html[data-theme=light] .ft-list li,
html[data-theme=light] .doc-list li,
html[data-theme=light] .upload-form { border-top-color: #e6e1ee; }

/* Form fields */
html[data-theme=light] .question-fieldset input[type=number],
html[data-theme=light] .dash-form input:not([type=checkbox]),
html[data-theme=light] .dash-form textarea,
html[data-theme=light] .dash-form select,
html[data-theme=light] .ft-connect select,
html[data-theme=light] .ft-fields select,
html[data-theme=light] .ft-fields input,
html[data-theme=light] .upload-form select,
html[data-theme=light] .upload-form input[type=file],
html[data-theme=light] .ft-copy code { background: #fff; color: #17131e; border-color: #b9aecb; }
html[data-theme=light] .ft-fields label.missing input,
html[data-theme=light] .ft-fields label.missing select { border-color: #d97706; box-shadow: 0 0 0 1px #d97706; }
html[data-theme=light] .ft-fields label.missing > span::after { color: #92400e; }

/* Buttons */
html[data-theme=light] .primary-button,
html[data-theme=light] .button { background: #6d28d9; border-color: #6d28d9; color: #fff; }
html[data-theme=light] .primary-button:hover { background: #5b21b6; }
html[data-theme=light] .secondary-button { color: #2e2639; border-color: #8f80a6; }
html[data-theme=light] .link-button { color: #5b21b6; border-color: #b9aecb; }
html[data-theme=light] .link-button:hover { background: #f3eeff; }

/* Progress */
html[data-theme=light] .progress-track { background: #e6e1ee; }

/* Status colours */
html[data-theme=light] .pill { color: #4c1d95; border-color: #c4b8d6; }
html[data-theme=light] .pill.overdue { background: #ffe4e6; border-color: #e11d48; color: #881337; }
html[data-theme=light] .pill.soon,
html[data-theme=light] .pill.status-review { background: #fef3c7; border-color: #d97706; color: #78350f; }
html[data-theme=light] .pill.later,
html[data-theme=light] .pill.status-done { background: #dcfce7; border-color: #16a34a; color: #14532d; }
html[data-theme=light] .dash-result.ok,
html[data-theme=light] .ft-progress li.ok,
html[data-theme=light] .upload-result.ok { color: #15803d; }
html[data-theme=light] .dash-result.err,
html[data-theme=light] .ft-progress li.err,
html[data-theme=light] .upload-result.err,
html[data-theme=light] .form-error { color: #b91c1c; }
html[data-theme=light] .ft-warn { color: #92400e; }

/* Focus rings */
html[data-theme=light] :focus-visible { outline-color: #6d28d9 !important; }

/* Footer stays dark in both modes (brand band). */

/* Toggle button */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid #76658b; background: transparent; color: inherit; font: inherit; font-size: .9rem; cursor: pointer; }
.theme-toggle:hover { background: rgba(167,139,250,.15); }
.theme-toggle:focus-visible { outline: 3px solid #d8b4fe; outline-offset: 3px; }
html[data-theme=light] .theme-toggle { border-color: #8f80a6; }

/* ===== Dark mode for pages that are light by design ===== */
/* Sign-in, sign-up, account */
html[data-theme=dark] body.auth-page { background: #08080e; color: #f8f8fb; }
html[data-theme=dark] .auth-card { background: #14121e; border-color: #3e354e; }
html[data-theme=dark] .auth-card a:not(.auth-button) { color: #ddd0ff; }
html[data-theme=dark] .auth-page input:not(#auth-widget *) { background: #0d0b12; color: #fff; border: 1px solid #68517e; }

/* New business setup and admin pages (app theme) */
html[data-theme=dark] body.app-theme {
  --app-workspace: #08080e; --app-surface: #14121e; --app-text: #f8f8fb; --app-muted: #c8bfd5;
  --app-purple: #b580ff; --app-purple-soft: #241a31; --app-border: #3e354e;
  --app-success: #86efac; --app-warning: #fcd34d; --app-error: #fca5a5;
  --app-shadow: none; --text: #f8f8fb; --text-dim: #c8bfd5; --text-faint: #c8bfd5; --border: #3e354e;
  background: var(--app-workspace); color: var(--app-text);
}
html[data-theme=dark] body.app-theme .primary-button { background: #7130cc; border-color: #7130cc; color: #fff; }
html[data-theme=dark] body.app-theme .notice { background: #422006; border-color: #f59e0b; color: #fef3c7; }
html[data-theme=dark] body.app-theme input:not([type=checkbox]):not([type=radio]),
html[data-theme=dark] body.app-theme select,
html[data-theme=dark] body.app-theme textarea { background: #0d0b12; color: #fff; border-color: #68517e; }
html[data-theme=dark] body.app-admin th { color: #f8f8fb; }

/* Simple help, readiness check and thank-you pages */
html[data-theme=dark] body.plain-page { background: #08080e; color: #f8f8fb; }
html[data-theme=dark] body.plain-page a:not(.cta):not(.cta-btn) { color: #ddd0ff; }
html[data-theme=dark] body.plain-page .note { background: #422006; color: #fef3c7; }
html[data-theme=dark] body.plain-page .service-card { background: #14121e; border-color: #3e354e; }
html[data-theme=dark] body.plain-page .service-price { color: #d8b4fe; }
html[data-theme=dark] body.plain-page input,
html[data-theme=dark] body.plain-page select,
html[data-theme=dark] body.plain-page textarea { background: #0d0b12; color: #fff; border: 1px solid #68517e; }
html[data-theme=dark] body.plain-page button { background: #7130cc; }

/* Floating toggle for pages without a header menu */
.theme-toggle.floating { position: fixed; right: 16px; bottom: 16px; z-index: 1000; background: #14121e; color: #f8f8fb; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
html[data-theme=light] .theme-toggle.floating { background: #fff; color: #17131e; }
/* Marketing nav: keep one line; icon-only toggle */
body > nav .theme-toggle { margin-left: 16px; flex: none; }
.theme-toggle.compact { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 1.05rem; border-radius: 50%; }
body > nav .nav-links { gap: clamp(14px, 1.8vw, 36px); }
body > nav .nav-links a, body > nav .nav-cta { white-space: nowrap; }
@media (max-width: 1200px) { body > nav { padding-left: 24px !important; padding-right: 24px !important; } }
.auth-header .theme-toggle { color: #fff; border-color: rgba(255,255,255,.4); }
/* Narrower screens: drop duplicate links so the top bar stays on one line */
@media (max-width: 1180px) {
  body > nav a[data-auth-link][href="/sign-up"],
  body > nav .nav-links a[href="/fmcsa-motus-verification-help"]:not(.nav-cta) { display: none !important; }
}
@media (max-width: 1040px) {
  body > nav .nav-links a.nav-cta { display: none !important; }
  body > nav .nav-links a[href="/fmcsa-motus-verification-help"]:not(.nav-cta) { display: inline !important; }
}

/* Phone menu (☰): built by theme.js on narrow screens */
.menu-toggle { display: none; }
@media (max-width: 768px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: 8px; border-radius: 10px; border: 1px solid #76658b; background: transparent; color: inherit; font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
  .menu-toggle:focus-visible { outline: 3px solid #d8b4fe; outline-offset: 3px; }
  .portal-header.has-menu { position: relative; flex-wrap: nowrap; }
  .portal-header.has-menu > .brand { margin-right: auto; }
  .portal-header.has-menu .site-menu { display: none; }
  .has-menu.menu-open .site-menu { display: flex !important; flex-direction: column; align-items: stretch; gap: 0 !important; position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; max-height: calc(100vh - 80px); overflow-y: auto; padding: 8px 16px 16px; background: #0d0b14; border-bottom: 1px solid #363140; box-shadow: 0 12px 24px rgba(0,0,0,.4); }
  body > nav.has-menu.menu-open .site-menu > a:not([hidden]), .has-menu.menu-open .site-menu > a:not([hidden]) { display: block !important; padding: 14px 4px !important; font-size: 1rem !important; color: #f8f8fb !important; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
  .has-menu.menu-open .site-menu { list-style: none; margin: 0; }
  .has-menu.menu-open .site-menu > li { display: block !important; margin: 0; }
  .has-menu.menu-open .site-menu > li > a:not([hidden]) { display: block !important; padding: 14px 4px !important; font-size: 1rem !important; color: #f8f8fb !important; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
  html[data-theme=light] .has-menu.menu-open .site-menu > li > a:not([hidden]) { color: #17131e !important; border-bottom-color: #ded9e8; }
  .has-menu.menu-open .site-menu > a.nav-cta:not([hidden]) { margin-top: 12px; padding: 14px 16px !important; text-align: center; border: 0; border-radius: 8px; }
  .has-menu.menu-open .site-menu > .theme-toggle { align-self: flex-start; margin-top: 12px; }
  html[data-theme=light] .menu-toggle { border-color: #8f80a6; }
  html[data-theme=light] .has-menu.menu-open .site-menu { background: #ffffff; border-bottom-color: #ded9e8; box-shadow: 0 12px 24px rgba(23,19,30,.12); }
  html[data-theme=light] .has-menu.menu-open .site-menu > a:not([hidden]):not(.nav-cta) { color: #17131e !important; border-bottom-color: #ded9e8; }
  /* Small phones: the hero right below repeats this button, so drop it from the crowded bar */
  @media (max-width: 420px) { body > nav.has-menu > .nav-cta { display: none !important; } }
}
