/* Colour tokens are shared by all screens. Existing colours remain the light
   fallbacks in each stylesheet; only screen output adopts the dark palette. */
html{color-scheme:light}
@media screen{
  html[data-theme="dark"]{
    color-scheme:dark;color:#e7edf7;background:#0e1724;
    --theme-ink:#e7edf7;--theme-muted:#b4c1d3;--theme-faint:#a1b3ca;
    --theme-surface:#152131;--theme-soft:#1c2c40;
    --theme-border:#35485f;--theme-border-strong:#627894;
    --theme-accent:#9bc8ff;--theme-success:#8bdcbd;--theme-warning:#f4cc85;--theme-danger:#ffb1b5;--theme-violet:#d7b5ff;
    --theme-surface-accent:#1b324b;--theme-surface-success:#18382f;--theme-surface-warning:#382e1c;--theme-surface-danger:#402731;--theme-surface-violet:#332b46;
    --theme-border-accent:#4d7196;--theme-border-success:#4d8273;--theme-border-warning:#8c734a;--theme-border-danger:#a16975;--theme-border-violet:#80679f;
    --navy:#101c2a;--muted:var(--theme-muted);--line:var(--theme-border);--paper:var(--theme-surface);--soft:#0e1724;
    --ax-ink:var(--theme-ink);--ax-muted:var(--theme-muted);--ax-line:var(--theme-border);--ax-teal:var(--theme-success);--ax-paper:var(--theme-surface);--ax-surface:var(--theme-soft);
  }
  html[data-theme="dark"] body{background:#0e1724}
  html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#a1b3ca;opacity:1}
  html[data-theme="dark"] :is(input,textarea){color:var(--theme-ink)}
  html[data-theme="dark"] :is(button,a,summary,input,select,textarea):focus-visible{outline-color:#a2cfec}
  html[data-theme="dark"] ::selection{background:#42638a;color:#fff}

  /* Native pickers can paint options in a separate window. Give the control
     and each row a solid colour pair instead of relying on the page behind it. */
  html[data-theme] select,
  html[data-theme] select :is(option,optgroup){
    color-scheme:inherit;
    color:var(--theme-ink,#17283b);
    background-color:var(--theme-surface,#fff);
  }
  html[data-theme] select option:checked{
    color:var(--theme-ink,#17283b);
    background-color:var(--theme-surface-accent,#d8eaff);
  }
  html[data-theme] select:disabled,
  html[data-theme] select :disabled{
    color:var(--theme-muted,#516479);
    background-color:var(--theme-soft,#edf1f5);
  }
  html[data-theme] select:focus-visible{
    outline:2px solid var(--theme-accent,#245b93);
    outline-offset:2px;
  }
}
@media screen and (forced-colors:active){
  html[data-theme] select,
  html[data-theme] select :is(option,optgroup){background-color:Field;color:FieldText}
  html[data-theme] select option:checked{background-color:Highlight;color:HighlightText}
  html[data-theme] select:disabled,
  html[data-theme] select :disabled{background-color:Field;color:GrayText}
  html[data-theme] select:focus-visible{outline-color:Highlight}
}
.ax-theme-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;min-width:44px;padding:7px 11px;border:1px solid var(--ax-line,#ccd9df);border-radius:9px;background:var(--ax-paper,#fff);color:var(--ax-ink,#17283b);font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.ax-theme-button:hover{background:var(--ax-surface,#f0f7f5)}
.ax-theme-button svg{width:18px;height:18px}

.ax-appearance-dialog {
  width:min(430px,calc(100% - 24px)); max-height:calc(100dvh - 24px);
  box-sizing:border-box; padding:clamp(16px,4vw,24px); overflow:auto;
  border:1px solid var(--ax-line,#d8e1e7); border-radius:16px;
  background:var(--ax-paper,#fff); color:var(--ax-ink,#17283b); box-shadow:0 18px 75px #0006;
}
.ax-appearance-dialog::backdrop { background:#071221b3 }
.ax-appearance-dialog header,.ax-appearance-dialog footer { display:flex; align-items:center; justify-content:space-between; gap:10px }
.ax-appearance-dialog header { margin-bottom:8px }
.ax-appearance-dialog h2 { margin:0; font-size:22px; line-height:1.25 }
.ax-appearance-close {
  min-width:44px; min-height:44px; font-size:25px; line-height:1; cursor:pointer;
  border:0; border-radius:8px; background:var(--ax-surface,#f5f7f8); color:inherit;
}
.ax-appearance-dialog fieldset { margin:16px 0 0; padding:0; border:0; min-width:0 }
.ax-appearance-dialog legend { margin:0 0 7px; padding:0; font-size:13px; font-weight:700; color:inherit }
.display-choices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px }
.display-choices[data-group="spacing"] { grid-template-columns:repeat(2,minmax(0,1fr)) }
.ax-appearance-dialog .display-choice {
  display:flex; flex-wrap:wrap; justify-content:center; align-items:center; align-content:center; gap:4px;
  min-height:44px; margin:0; padding:6px 3px; box-sizing:border-box; cursor:pointer;
  border:1px solid var(--ax-line,#d8e1e7); border-radius:9px; background:var(--ax-paper,#fff);
  color:inherit; font:inherit; font-size:13px; font-weight:600; text-align:center;
}
.display-choice:has(input:checked) { outline:2px solid var(--ax-teal,#176759); outline-offset:-2px; background:var(--theme-surface-success,#edf6f2) }
.display-choice:has(input:focus-visible) { box-shadow:0 0 0 3px var(--theme-border-accent,#5486b9) }
.ax-appearance-dialog .display-choice input { appearance:auto; width:14px; height:14px; min-height:0; margin:0; accent-color:var(--ax-teal,#176759) }
.display-swatch { display:flex; flex:0 0 84%; height:24px; margin:2px 0 4px; overflow:hidden; border:1px solid #8896a3; border-radius:4px; background:#eef2f6 }
.display-swatch i { width:18%; background:#152638 }
.display-swatch b { width:54%; height:8px; margin:6px; border-top:2px solid #697c8b; border-bottom:2px solid #bdc9d1 }
.display-swatch[data-preview="dark"] { background:#172639 }
.display-swatch[data-preview="dark"] b { border-color:#91a7bd }
.display-swatch[data-preview="system"] { background:linear-gradient(90deg,#eef2f6 50%,#172639 50%) }
.ax-appearance-dialog .ax-appearance-status { margin:14px 0 8px; color:var(--ax-muted,#516479); font-size:12px; line-height:1.5 }
.ax-appearance-dialog footer button { min-height:44px }
.ax-appearance-dialog footer .button { min-width:80px }
@media(max-width:800px) {
  .ax-theme-button { padding:6px 9px }
  .ax-top-actions { gap:6px }
}
@media(max-width:420px) { .ax-top-actions .ax-theme-button svg { display:none } }
@media(max-width:380px) { .ax-top-actions .ax-key-help { display:none } }

/* Only screen content responds to reading and spacing preferences. */
@media screen {
  html[data-reading-size="large"] { --ax-reading-font:18px }
  html[data-reading-size="largest"] { --ax-reading-font:20px }
  html:is([data-reading-size="large"],[data-reading-size="largest"]) #app
    :is(.focus-job .message-text,#composer-text,#intake-body,.email-plain,.ax-job strong,.email-list-row>strong,.case-card h3) {
    font-size:var(--ax-reading-font); line-height:1.55;
  }
  /* The mobile form baseline uses !important to prevent iOS focus zoom. */
  html:is([data-reading-size="large"],[data-reading-size="largest"]) #app :is(#composer-text,#intake-body) {
    font-size:var(--ax-reading-font)!important;
  }
  html[data-list-spacing="compact"] #app :is(.focused-home .ax-job,.ax-directory .ax-tile,.focused-home .ax-tile) {
    min-height:44px; padding:6px 10px;
  }
  html[data-list-spacing="compact"] #app .email-list-row { min-height:44px; padding:6px 10px }
  html[data-list-spacing="compact"] #app .email-list-row>strong { margin:3px 0 }
}
@media print{.ax-theme-button,.ax-appearance-dialog{display:none!important}html[data-theme],html[data-theme] body{color:#17283b;background:white;color-scheme:light}}
.ax-offline{max-width:540px;margin:12vh auto;padding:24px;font:16px/1.7 system-ui,sans-serif}
.ax-offline h1{font-size:28px;line-height:1.3}.ax-offline a{text-decoration:underline}
#workspace-update:not([hidden]){position:relative;z-index:4;padding:.65rem 1rem;background:#ffe5a1;color:#241b08;text-align:center;font-weight:600}
