/* Outer application shell. The invoice iframe owns its existing theme. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --shell-bg: #121e32;
    --shell-surface: #192a43;
    --shell-raised: #223956;
    --shell-text: #eef3fc;
    --shell-muted: #b9c6d8;
    --shell-link: #9ec1ff;
    --shell-line: #7386a1;
    --dafni-border: var(--shell-line);
    color: var(--shell-text); background: var(--shell-bg);
  }
  body { background: var(--shell-bg); color: var(--shell-text); }
  .account-card, body.support-open .account-card, body>.card,
  #entry-profile-menu, #account dialog, #team-confirm, #platform-confirm {
    background: var(--shell-surface); color: var(--shell-text); border-color: var(--shell-line);
  }
  #account p, #account li, #account small, #account dt,
  #account .eyebrow, #account .admin-section-status,
  #admin-content .settings-group>h2, #admin-content .settings-info-label,
  #account .support-muted, #account .platform-muted, #account time,
  #company-billing .billing-facts dt, #account .tabs a, #setup-panel #setup-heading-status,
  footer, .demo-toolbar span, .early, .eyebrow, #home p { color: var(--shell-muted); }
  #account :is(input,select,textarea), #company-email textarea,
  #account .support-surface :is(input,select,textarea) {
    color: var(--shell-text); background: var(--shell-bg); border-color: var(--shell-line);
    caret-color: var(--shell-link);
  }
  #account :is(input,textarea)::placeholder { color: var(--shell-muted); opacity: 1; }
  #account :is(input,select,textarea):disabled { background: var(--shell-raised); }
  #account button:not(.primary), #account .button:not(.primary),
  #entry-profile-menu button, #team-confirm button:not(.primary), #platform-confirm button:not(.primary) {
    color: var(--shell-text); background: var(--shell-raised); border-color: var(--shell-line);
  }
  #account button:not(.primary):hover:not(:disabled) { background: #304d70; }
  #account a:not(.primary), #account .settings-info, #account .support-row button,
  #entry-profile-menu #logout, #home h1 em { color: var(--shell-link); }
  #account .primary, #account button.primary { background: #2257cc; color: #fff; border-color: #9ec1ff; }
  #account .primary:hover:not(:disabled) { background: #1945a5; }
  #account .support-surface { --support-ink: var(--shell-text); --support-blue: #2257cc; }
  #company-billing, #platform-content {
    --billing-ink: var(--shell-text); --billing-surface: var(--shell-surface);
    --billing-accent: var(--shell-link); --billing-line: var(--shell-line);
  }
  #account .badge, .environment-banner, #package-lifecycle,
  #account .support-state, #account .support-surface details,
  #admin-content .settings-help, #setup-panel .setup-help[open],
  #account .template-preview, #account .wa-help-text,
  #account .company-choice:has(input:checked),
  #company-billing label.package-card:has(input:checked),
  #account .admin-disclosure>summary:hover, #account th {
    background: var(--shell-raised); color: var(--shell-text); border-color: var(--shell-line);
  }
  #admin-content .settings-help small { color: var(--shell-text); }
  #company-billing label.package-card { border-color: var(--shell-line); }
  #company-billing label.package-card:has(input:checked) { border-color: var(--shell-link); }
  #account .setup, #account .remove-confirm, #account .support-message.internal {
    background: #3b3020; color: #f1d59a !important; border-color: #d8b576;
  }
  #account .setup-callout { background: #193b35; color: #b3e6d4; border-color: #79b9a3; }
  #account .billing-error, #account [role=alert]:not(:empty),
  #whatsapp-templates .wa-check-failure, #whatsapp-templates .wa-workflow-indicator.attention { color: #ffb4ab; }
  #whatsapp-templates .wa-check-success, #whatsapp-templates .wa-workflow-indicator.ready { color: #83dca5; }
  #account :is(button,a,input,select,textarea,summary):focus-visible,
  #entry-profile :focus-visible { outline: 3px solid var(--shell-link); outline-offset: 3px; }
  #account input:is([type=radio],[type=checkbox]) { accent-color: var(--shell-link); }
  #account ::selection, #company-billing ::selection { background: #9ec1ff; color: #121e32; }
  #account dialog::backdrop, #team-confirm::backdrop { background: #060e1bcc; }
}
