/* Shared page and assistant palette. Light is the initial theme. */
:root {
  --chat-bg: #fff;
  --chat-header: #fbfaf7;
  --chat-message: #f0f1f2;
  --chat-user: #fff0e5;
  --chat-line: #d8dce0;
  --chat-input: #fff;
  --chat-action: #a83f0d;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0 5px 5px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
.theme-switch-label { font-size: 12px; font-weight: 600; }
.theme-switch-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #737d86;
  border-radius: 99px;
  background: #404951;
}
.theme-switch-track svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 1.7; }
.theme-switch-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px #0003;
}
.theme-switch[aria-checked="true"] .theme-switch-thumb { transform: translateX(26px); background: #ffad7e; }
.theme-switch[aria-checked="true"] .theme-switch-track { border-color: #f49c65; background: #62351f; }
.theme-switch:focus-visible { outline: 2px solid #ffad7e; outline-offset: 3px; border-radius: 10px; }
.theme-toolbar { display: flex; justify-content: flex-end; width: min(calc(100% - 32px), 1180px); margin: 12px auto 0; }
.theme-toolbar .theme-switch { color: var(--ink); }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11171c;
  --bg-soft: #171e24;
  --surface: #1c242c;
  --surface-soft: #222c35;
  --ink: #f0f2f4;
  --muted: #b3bec8;
  --line: rgba(213, 224, 234, 0.16);
  --brand: #f6a06b;
  --brand-strong: #ffb282;
  --brand-soft: rgba(244, 125, 53, 0.13);
  --accent: #e2e8ed;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  --chat-bg: #1c242c;
  --chat-header: #222c35;
  --chat-message: #2b3641;
  --chat-user: #56321f;
  --chat-line: #465461;
  --chat-input: #151c22;
  --chat-action: #ffb282;
}
html[data-theme="dark"] body {
  background: radial-gradient(ellipse at top left, rgba(244, 125, 53, 0.05), transparent 45%), linear-gradient(180deg, var(--bg), var(--bg-soft));
}
html[data-theme="dark"] .topbar { background: rgba(20, 26, 32, 0.97); }
html[data-theme="dark"] .section-soft { background: rgba(255, 255, 255, 0.018); border-color: var(--line); }
html[data-theme="dark"] :is(.hero-grid, .industry-summary, .metric-strip div, .service-card, .proof-panel, .info-card, .scenario-card, .step-card, .contact-card, .contact-side, .support-card, .faq-item, .footer-inner, .policy-content) {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] :is(.service-card-accent, .info-card-accent, .service-detail-cta) {
  background: linear-gradient(145deg, rgba(244, 125, 53, 0.10), transparent 70%), var(--surface);
  border-color: rgba(246, 160, 107, 0.25);
}
html[data-theme="dark"] :is(.industry-summary-point, .support-strip, .contact-point, .document-card) { background: var(--surface-soft); border-color: var(--line); }
html[data-theme="dark"] :is(.hero-media, .hero-panel) { background: var(--surface-soft); border-color: var(--line); }
html[data-theme="dark"] .hero-headline-note { color: var(--muted); }
html[data-theme="dark"] .button-primary { background: linear-gradient(135deg, #c94c12, #a83f0d); color: #fff; }
html[data-theme="dark"] .button-secondary { background: var(--surface-soft); color: var(--ink) !important; box-shadow: none; }
html[data-theme="dark"] :is(.directory-note, .service-detail-note) { background: linear-gradient(145deg, #293640, #1c2831); border: 1px solid var(--line); }
html[data-theme="dark"] :is(.field input, .field select, .field textarea) { background: var(--chat-input); color: var(--ink); border-color: var(--chat-line); }
html[data-theme="dark"] :is(.field input, .field textarea)::placeholder { color: #98a5b1; opacity: 1; }
html[data-theme="dark"] .form-status.is-success { color: #7ed7ad; }
html[data-theme="dark"] .skip-link { background: #35414c; color: #fff; }
/* Document scans and client marks retain their original white backing. */
html[data-theme="dark"] .logo-box { border-color: #47515a; }

.assistant-widget { font-family: inherit; color: var(--ink); }
.assistant-toggle, .assistant-form button {
  background: linear-gradient(135deg, #c94c12, #a83f0d);
  color: #fff;
}
.assistant-toggle { box-shadow: 0 8px 24px rgba(168, 63, 13, 0.24); }
.assistant-panel { width: min(390px, calc(100vw - 48px)); background: var(--chat-bg); border-color: var(--chat-line); box-shadow: 0 18px 48px rgba(23, 29, 35, 0.20); }
.assistant-header { background: var(--chat-header); border-bottom: 1px solid var(--chat-line); }
.assistant-header span { color: var(--chat-action); }
.assistant-close { color: var(--ink); }
.assistant-info { color: var(--muted); background: var(--chat-header); border-color: var(--chat-line); }
.assistant-message { background: var(--chat-message); color: var(--ink); }
.assistant-message-user { background: var(--chat-user); color: var(--ink); }
.assistant-message a, .assistant-links a, .assistant-status, .assistant-status button { color: var(--chat-action); }
.assistant-chips button, .assistant-actions button { color: var(--ink); border-color: var(--chat-line); background: var(--chat-header); }
.assistant-form textarea { background: var(--chat-input); color: var(--ink); border-color: var(--chat-line); }
.assistant-form textarea::placeholder { color: var(--muted); opacity: 1; }
.assistant-widget :focus-visible { outline-color: var(--chat-action); }

@media (min-width: 1141px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; }
  .topbar-nav { gap: 14px; }
}
@media (min-width: 761px) and (max-width: 1250px) { .theme-switch-label { display: none; } }
@media (min-width: 761px) and (max-width: 1140px) {
  .topbar-inner > .brand { grid-column: 1; grid-row: 1; justify-self: start; }
  .topbar-inner > .theme-switch { grid-column: 1; grid-row: 1; justify-self: end; }
}
@media (max-width: 760px) {
  .topbar-inner > .brand { grid-column: 1; grid-row: 1; }
  .topbar-inner > .theme-switch { grid-column: 2; grid-row: 1; justify-self: end; }
  .topbar-inner > .theme-switch .theme-switch-label { display: none; }
  .topbar-inner > .topbar-actions { grid-column: 1 / -1; grid-row: 2; }
  .topbar-inner > .menu-toggle { grid-column: 1 / -1; grid-row: 3; }
  .topbar-inner > .mobile-nav { grid-column: 1 / -1; grid-row: 4; }
}
@media (prefers-reduced-motion: no-preference) {
  .theme-switch-thumb { transition: transform 160ms ease, background-color 160ms ease; }
}
