:root{--user-accent:#f2784b;--theme-headline:#10251f;--theme-subhead:#314b41;--theme-body:#17231e;--theme-muted:#52685e;--ui-scale:1}body{zoom:var(--ui-scale);color:var(--theme-body)}h1,h2,h3,h4,.lead-card b,.company-card b{color:var(--theme-headline)!important}.subhead,.hero p,.panel-copy,.lead-card p,.lead-card small,.profile>p{color:var(--theme-muted)!important}.signal,.eyebrow,.panel-kicker,.stat-label{color:var(--theme-subhead)!important}.primary-button,.save,.mast a.active,.lead-card.active,.guide,.primary,.progress i{background:var(--user-accent)!important}.theme-control{position:relative;z-index:9999;color:#fff;font:700 12px Trebuchet MS,sans-serif}.theme-control summary{cursor:pointer;list-style:none;padding:9px 13px;border:1px solid #ffffff44;border-radius:999px;background:#14221d;color:#fff}.theme-control[open] summary{border-radius:12px 12px 0 0}.theme-options{position:absolute;right:0;top:100%;width:250px;display:grid;gap:9px;padding:12px;background:#14221df8;border:1px solid #ffffff44;border-radius:12px 0 12px 12px;box-shadow:0 12px 35px #0006}.theme-options label{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;color:#fff!important}.theme-options input[type=color]{width:42px;height:30px;padding:2px;border:0;background:transparent}.theme-options input[type=range]{grid-column:1/-1;width:100%}.theme-options select,.theme-options button{padding:8px;border-radius:8px;background:#24362e;color:#fff;border:1px solid #ffffff44}
html[data-theme=dark]{color-scheme:dark}html[data-theme=dark] body{background:radial-gradient(circle at 90% 0,#503326 0,transparent 28%),#111a17!important;color:var(--theme-body)!important}html[data-theme=dark] .panel,html[data-theme=dark] .profile,html[data-theme=dark] .lead-list,html[data-theme=dark] .metric,html[data-theme=dark] .asset,html[data-theme=dark] .fact,html[data-theme=dark] .company-card,html[data-theme=dark] .tools,html[data-theme=dark] .inspector,html[data-theme=dark] .legacy details,html[data-theme=dark] .link-card,html[data-theme=dark] .template-item,html[data-theme=dark] #templateForm{background:#18241f!important;color:var(--theme-body)!important;border-color:#526158!important}html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea,html[data-theme=dark] button{background:#223029;color:#f7fbf8;border-color:#62766b}html[data-theme=dark] select option{background:#f8f4e9!important;color:#10251f!important}html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#b8c8c0!important;opacity:1}html[data-theme=dark] label{color:var(--theme-subhead)!important}html[data-theme=dark] .legacy summary{padding:14px 16px;background:#26372f!important;color:var(--theme-headline)!important;font-weight:800;cursor:pointer}html[data-theme=dark] .legacy details[open] summary{background:#31473d!important;border-bottom:1px solid #526158}html[data-theme=dark] .legacy details form{padding:4px 16px 16px}html[data-theme=dark] .quote-total{background:#31473d!important;color:#fff!important;border:1px solid #60766b}html[data-theme=dark] .quote-line{background:#1e2d27!important;color:#fff!important;border-color:#526158!important}html[data-theme=dark] .actions button:not(.primary),html[data-theme=dark] .actions a{background:#f7f3e9!important;color:#10251f!important;border-color:#f7f3e9!important}html[data-theme=dark] button.primary,html[data-theme=dark] button.save,html[data-theme=dark] .primary-button{color:#fff!important;text-shadow:0 1px 2px #000a;border:1px solid #ffffff55!important}html[data-theme=dark] a{color:#ffd27a}html[data-theme=dark] .page{background:#fff;color:#14221d}html[data-theme=dark] ::selection{background:#ffd166;color:#111}
@media(max-width:760px){.theme-options{position:fixed;right:10px;top:70px;width:min(280px,calc(100vw - 20px))}}@media print{.theme-control{display:none!important}body{zoom:1}}

/* Pair surface colors with text; keep authored paper and email content separate. */
@media screen {
  html[data-theme=dark] {--surface:#18241f;--text:#eef4ef;--input-bg:#223029;--card:#18241f;--paper:#111a17;--muted:#cbd8d0;--line:#71877a;--accent-contrast:var(--accent-ink,#10251f)}
  html[data-theme=dark] :is(.source-card,.preview-card,.destination-panel,.destination-browser,.profile-results,.profile-choice,.field-group,.update-policy,.confirm,.dictation-panel,.image-drop,.empty-state) {background:#18241f!important;color:#eef4ef!important;border-color:#71877a!important}
  html[data-theme=dark] :is(.profile-choice small,.profile-choice span,.report-hero p,.field-row,.image-drop span,.dictation-panel small) {color:#cbd8d0!important;opacity:1}
  html[data-theme=dark] .warning {background:#30291c!important;color:#ffe7b5!important}
  html[data-theme=dark] :is(th,td):first-child {background:#18241f;color:#eef4ef}
  html[data-theme=dark] tbody tr:hover {background:#31473d}
  html[data-theme=dark] :is(dialog,.profile-card,.email-field,.merge-choice,.merge-list,.conversation-item,.conversation-body,.conversation-editor,.history-entry,.attachment-card,.report-card,.report-filters,.profile-field-group,.guide,fieldset) {
    background:#18241f!important;color:var(--theme-body)!important;border-color:#71877a!important;
  }
  html[data-theme=dark] :is(input,select,textarea,button):not(.page *):not([contenteditable=true] *) {
    background:#223029!important;color:#f7fbf8!important;border-color:#71877a!important;
  }
  html[data-theme=dark] select option {background:#223029!important;color:#f7fbf8!important}
  html[data-theme=dark] :is(.actions a,.actions button:not(.primary),.merge-choice button) {background:#223029!important;color:#f7fbf8!important;border-color:#71877a!important}
  html[data-theme=dark] :is(.metric span,.conversation-item small,.attachment-card small,dialog small,.profile-card p,.email-field small) {color:#cbd8d0!important}
  html[data-theme=dark] :is(.primary-button,button.primary,button.save,.save,.mast a.active,.lead-card.active) {background:var(--user-accent)!important;color:var(--accent-ink,#10251f)!important;text-shadow:none!important}
  html[data-theme] .lead-card.active :is(b,p,small,.signal) {color:var(--accent-ink,#10251f)!important}
  html[data-theme=light] :is(dialog,.profile-card,.email-field,.merge-choice,.report-card) {background:#fffdf7;color:#17231e}
  html[data-theme=light] :is(.mast,.identity,#dashboardLogin,.theme-control) :is(h1,h2,h3,h4,label) {color:#f7f3e9!important}
  html[data-theme] .page :is(h1,h2,h3,h4,label) {color:inherit!important}
  html[data-theme] :is(button,a,input,select,textarea,summary):focus-visible {outline:3px solid #087fbd;outline-offset:3px}
  html[data-theme=dark] :is(button,a,input,select,textarea,summary):focus-visible {outline-color:#80d9ff}

  /* Keep every interactive screen on the same readable palette. Printable
     document canvases remain white below, but application surfaces do not. */
  html[data-theme=dark],html[data-theme=light] {
    --app-bg:#0b1411;
    --app-surface:#18241f;
    --app-surface-strong:#223029;
    --app-text:#f2f7f3;
    --app-muted:#c9d8cf;
    --app-line:#71877a;
    --app-link:#83d8ff;
    --app-heading:#f6faf7;
  }
  html[data-theme=light] {
    --app-bg:#dfe7e3;
    --app-surface:#e9efec;
    --app-surface-strong:#d8e3de;
    --app-text:#10251f;
    --app-muted:#314b41;
    --app-line:#71877a;
    --app-link:#075f86;
    --app-heading:#10251f;
  }
  html[data-theme] body {background:var(--app-bg)!important;color:var(--app-text)!important}
  html[data-theme] body :is(h1,h2,h3,h4,h5,h6,legend,strong,b,.eyebrow,.panel-kicker,.signal,.stat-label):not(:where(#richEmailBody *)) {
    color:var(--app-heading)!important;
    font-weight:800;
  }
  html[data-theme] body :is(p,li,dt,dd,span,small,label,figcaption,.subhead,.panel-copy,.lead-card p,.lead-card small):not(:where(#richEmailBody *)) {
    color:var(--app-muted)!important;
  }
  html[data-theme] body :is(a:not(.primary):not(.save):not(.button),.link,.text-link):not(:where(#richEmailBody *)) {color:var(--app-link)!important}
  html[data-theme] body :is(.panel,.profile,.lead-list,.metric,.asset,.fact,.company-card,.tools,.inspector,.legacy details,.link-card,.template-item,#templateForm,.source-card,.preview-card,.destination-panel,.destination-browser,.profile-results,.profile-choice,.field-group,.update-policy,.confirm,.dictation-panel,.image-drop,.empty-state,.report-card,.report-filters,.profile-field-group,.guide,fieldset,.conversation-item,.conversation-body,.conversation-editor,.history-entry,.attachment-card,.form-card,.card,.tile,.grid a):not(:where(#richEmailBody *)) {
    background:var(--app-surface)!important;
    color:var(--app-text)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is(.panel,.profile,.lead-list,.metric,.asset,.fact,.company-card,.tools,.inspector,.link-card,.template-item,.report-card,.report-filters,.form-card,.card,.tile,.grid a) :is(h1,h2,h3,h4,h5,h6,strong,b):not(:where(#richEmailBody *)) {
    color:var(--app-heading)!important;
  }
  html[data-theme] body :is(input,select,textarea,button) {
    background:var(--app-surface-strong)!important;
    color:var(--app-text)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is(input,textarea)::placeholder {color:var(--app-muted)!important;opacity:1}
  html[data-theme] body select option {background:var(--app-surface-strong)!important;color:var(--app-text)!important}
  html[data-theme] body :is(.primary,.primary-button,.save,.button-primary,.mast a.active,.lead-card.active,.progress i) {
    background:var(--user-accent)!important;
    color:var(--accent-ink,#10251f)!important;
  }
  html[data-theme] body :is(.hero,header.mast,.mast,.topbar,.site-header) {background:#10251f!important;color:#f2f7f3!important}
  html[data-theme] body :is(.hero,header.mast,.mast,.topbar,.site-header) :is(h1,h2,h3,h4,p,span,a,b,strong) {color:#f2f7f3!important}
  html[data-theme=light] body :is(.page,.pdf-page,.print-page) {background:#fff!important;color:#10251f!important}
  html[data-theme=light] body :is(.page,.pdf-page,.print-page) :is(h1,h2,h3,h4,h5,h6,p,span,label,b,strong) {color:inherit!important}
  html[data-theme=dark] body :is(.page,.pdf-page,.print-page) {background:#fff!important;color:#10251f!important}
  html[data-theme=dark] body :is(.page,.pdf-page,.print-page) :is(h1,h2,h3,h4,h5,h6,p,span,label,b,strong) {color:inherit!important}
  html[data-theme] body :is(dialog,.modal,.drawer,.popover,.dropdown-menu,.theme-options) {background:var(--app-surface)!important;color:var(--app-text)!important;border-color:var(--app-line)!important}
  html[data-theme] body :is(dialog,.modal,.drawer,.popover,.dropdown-menu,.theme-options) :is(h1,h2,h3,h4,h5,h6,p,span,label,b,strong):not(:where(#richEmailBody *)) {color:var(--app-text)!important}
  html[data-theme=dark] {
    --ink:#f2f7f3;--paper:#0b1411;--cream:#18241f;--forest:#10251f;
    --line:#71877a;--muted:#c9d8cf;--card:#18241f;--field:#223029;
  }
  html[data-theme=light] {
    --ink:#10251f;--paper:#dfe7e3;--cream:#e9efec;--forest:#10251f;
    --line:#71877a;--muted:#314b41;--card:#e9efec;--field:#d8e3de;
  }
  html[data-theme] body :is([class*="card"],[class*="panel"],[class*="tile"],[class*="modal"],[class*="dialog"],[class*="popover"],[class*="drawer"],[class*="field-group"],[class*="attachment"]) {
    background:var(--app-surface)!important;
    color:var(--app-text)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is([class*="card"],[class*="panel"],[class*="tile"],[class*="modal"],[class*="dialog"],[class*="popover"],[class*="drawer"],[class*="field-group"],[class*="attachment"]) :is(h1,h2,h3,h4,h5,h6,strong,b) {
    color:var(--app-heading)!important;
  }
  html[data-theme] body :is(footer,.footer,.status-bar,.toolbar,.editor-toolbar,.mode-tabs,.tabs,.filter-bar) {
    background:var(--app-surface)!important;
    color:var(--app-muted)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is(footer,.footer,.status-bar,.toolbar,.editor-toolbar,.mode-tabs,.tabs,.filter-bar) :is(h1,h2,h3,h4,h5,h6,p,span,label,b,strong) {color:var(--app-muted)!important}
  html[data-theme] body :is(button,a).secondary,
  html[data-theme] body :is(.actions a,.actions button:not(.primary),.button-row button:not(.primary)) {
    background:var(--app-surface-strong)!important;
    color:var(--app-text)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is(button,a):disabled {background:#27352f!important;color:#aabbb1!important;border-color:#50645a!important}
  html[data-theme] body :is(button,a,input,select,textarea,summary):focus-visible {outline:3px solid #80d9ff!important;outline-offset:3px}
  html[data-theme] body {font-family:"Segoe UI Variable","Segoe UI",-apple-system,BlinkMacSystemFont,sans-serif;letter-spacing:0}
  html[data-theme] body :is(h1,h2,h3,h4,h5,h6) {font-family:"Segoe UI Variable","Segoe UI",-apple-system,BlinkMacSystemFont,sans-serif;letter-spacing:-.025em}
  html[data-theme] body :is(.chat,.voice-panel,#messages,.assistant,.voice-transcript,.live-status,.consent,#chatForm,.contact-grid input,#chatMessage,#canvas,.loading,.error,.success,.form-shell,.form-stage) {
    background:var(--app-surface)!important;
    color:var(--app-text)!important;
    border-color:var(--app-line)!important;
  }
  html[data-theme] body :is(.chat,.voice-panel,#messages,.assistant,.voice-transcript,.live-status,.consent,#chatForm,.contact-grid input,#chatMessage,.loading,.error,.success,.form-shell,.form-stage) :is(h1,h2,h3,h4,p,span,small,label,b,strong) {color:var(--app-text)!important}
  html[data-theme] body :is(.customer,.chat header,footer) {background:#10251f!important;color:#f2f7f3!important}
}
.theme-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.theme-actions button{width:100%;font-size:12px}
/* Native dialog top layer avoids clipping by scrolling headers and panels. */
html[data-theme] body dialog.display-settings-dialog{position:fixed!important;inset:0!important;margin:auto!important;width:min(360px,calc(100vw - 24px))!important;max-height:calc(100dvh - 32px)!important;overflow:auto!important;box-sizing:border-box;z-index:2147483647;padding:16px;border:1px solid var(--app-line);border-radius:12px}
dialog.display-settings-dialog:not([open]){display:none!important}
dialog.display-settings-dialog::backdrop{background:#0008}
html[data-theme] body #main-crm-navigation a.owner-tool-link.active,
html[data-theme] body #main-crm-navigation a[aria-current=page]{background:#d6d6d6!important;color:#000!important;border-color:#999!important}
html[data-theme] body #profile :is(.document-builder,.order-builder,.sales-builder,.profile-head-actions) button{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:auto;min-height:36px;height:auto;margin:3px;padding:7px 10px;border:1px solid var(--app-line);border-radius:8px;font-size:12px!important;line-height:1.25;font-weight:600}
html[data-theme] body #profile :is(.document-builder,.order-builder,.sales-builder) button.save{background:#d6d6d6!important;color:#000!important;border-color:#999!important}
html[data-theme] body #profile .document-total{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
