:root {
  font-family: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; line-height: 1.5; font-synthesis: none; color-scheme: light;
  --surface: #fff; --ink: #242424; --control: #fff; --control-ink: #242424;
  --muted: #616161; --line: #e0e0e0; --control-border: #8a8886;
  --accent: #005a9e; --primary: #0f6cbd; --primary-hover: #115ea3;
  --soft: #eff6fc; --bg: #f5f5f5; --hover: #f0f0f0;
  --error-bg: #fdf3f4; --error-ink: #a4262c; --success: #107c10;
  color: var(--ink); background: var(--surface);
}
/* System fallback during startup and on the help page. The Office theme wins
   once theme.js applies data-theme and the four actual host color variables. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --surface: #292929; --ink: #fff; --control: #292929; --control-ink: #fff;
    --muted: #c2c2c2; --line: #424242; --control-border: #858585;
    --accent: #75b6e7; --soft: #193b56; --bg: #1f1f1f; --hover: #3d3d3d;
    --error-bg: #442726; --error-ink: #f1bbbc; --success: #92c353;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #292929; --ink: #fff; --control: #292929; --control-ink: #fff;
  --muted: #c2c2c2; --line: #424242; --control-border: #858585;
  --accent: #75b6e7; --soft: #193b56; --bg: #1f1f1f; --hover: #3d3d3d;
  --error-bg: #442726; --error-ink: #f1bbbc; --success: #92c353;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, fieldset:disabled button { opacity: .5; cursor: not-allowed; }
button, a, input, select, textarea { outline-offset: 2px; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--accent); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
h3 { font-size: 14px; font-weight: 600; }
.muted { font-size: 13px; color: var(--muted); line-height: 1.5; }
.loading { padding: 24px; line-height: 1.6; }
.workspace { margin: 0 auto; }
.panel { background: var(--surface); min-height: 100vh; }
.panel-header { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.panel-heading { min-width: 0; }
.panel-header strong { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.panel-header strong span { white-space: nowrap; }
.brand-icon { width: 32px; height: 32px; display: grid; place-items: center; background: var(--soft); color: var(--accent); border-radius: 4px; flex-shrink: 0; }
.brand-icon svg { width: 24px; height: 24px; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.version { margin-left: auto; font-size: 11px; border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: var(--muted); }
.connection { display: flex; align-items: center; gap: 6px; padding: 6px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.connection button { margin-left: auto; font-size: 12px; }
.dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; flex-shrink: 0; }
.section { padding: 16px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.sender { font-size: 14px; font-weight: 600; margin-top: 12px; overflow-wrap: anywhere; }
.metadata { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.attachments { font-size: 12px; color: var(--muted); padding-top: 8px; overflow-wrap: anywhere; }
.section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 12px; }
.pill { font-size: 11px; padding: 1px 5px; border-radius: 4px; color: var(--muted); background: var(--bg); }
.owner { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.owner > div { min-width: 0; }
.owner strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--accent); border-radius: 50%; flex-shrink: 0; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.input-row { display: flex; gap: 8px; align-items: center; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid var(--control-border); border-radius: 4px; background: var(--control); color: var(--control-ink); padding: 5px 8px; }
select, input { min-height: 32px; }
.secondary, .suggestion { min-height: 32px; border: 1px solid var(--control-border); border-radius: 4px; padding: 5px 12px; background: var(--control); color: var(--control-ink); line-height: 20px; }
.secondary { white-space: nowrap; }
.secondary:not(:disabled):hover, .suggestion:not(:disabled):hover { background: var(--hover); color: var(--ink); }
.link-button { min-height: 28px; border: 0; background: transparent; color: var(--accent); font-size: 13px; padding: 3px 0; text-align: left; }
.link-button:not(:disabled):hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; background: var(--soft); color: var(--ink); overflow-wrap: anywhere; max-width: 100%; text-align: left; }
.chip span { margin-left: 6px; }
.reply-section .section-title { margin-bottom: 6px; }
.template-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.suggestion { font-size: 13px; padding-inline: 8px; text-align: left; }
textarea { display: block; resize: vertical; min-height: 112px; padding: 8px; line-height: 1.5; }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: 1; }
.primary { width: 100%; min-height: 32px; display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; border: 1px solid transparent; border-radius: 4px; padding: 5px 12px; background: var(--primary); color: #fff; font-weight: 600; }
.primary:not(:disabled):hover { background: var(--primary-hover); }
.footnote { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.panel-footer { display: flex; flex-wrap: wrap; gap: 4px; justify-content: space-between; padding: 12px 16px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.notice { margin: 12px 16px 0; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); font-size: 13px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.notice.error { background: var(--error-bg); color: var(--error-ink); }
.empty { padding-block: 40px; text-align: center; }
.empty .brand-icon { margin: 0 auto 16px; }
.empty h2 { margin-bottom: 8px; }
#ticket-metadata input { display: block; }
#ticket-metadata fieldset { min-width: 0; }
#ticket-metadata textarea { min-height: 80px; margin-bottom: 12px; }
#metadata-connect { margin-top: 12px; }
#ticket-metadata [role="status"]:not(:empty) { margin-top: 8px; }
.metadata-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; }
.help-page { max-width: 640px; margin: auto; }
.help-page h2 { margin-top: 20px; margin-bottom: 8px; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface); }
.demo-bar b { font-weight: 600; color: var(--ink); }
.workspace.demo { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; max-width: 1120px; padding: 40px 24px; }
.demo .panel { min-height: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.mail-preview { min-width: 0; padding-top: 24px; }
.mail-preview h1 { font-size: 32px; line-height: 1.25; font-weight: 600; margin: 16px 0; }
.intro { font-size: 14px; line-height: 1.6; color: var(--muted); }
.mail-window { margin-top: 24px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); overflow: hidden; }
.mail-toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.outlook-mark { font-size: 12px; font-weight: 700; background: #0f6cbd; color: white; padding: 4px 6px; border-radius: 3px; }
.count { margin-left: auto; color: var(--muted); font-size: 12px; }
.mail-list { display: flex; flex-direction: column; }
.mail-row { border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; padding: 12px 16px; border-left: 3px solid transparent; color: var(--ink); }
.mail-row.selected { background: var(--soft); border-left-color: var(--accent); }
.mail-row strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.mail-row span { font-size: 13px; }
.mail-content { padding: 20px 16px; }
.mail-content h2 { font-size: 18px; }
.mail-sender { font-size: 12px; color: var(--muted); margin: 8px 0 20px; overflow-wrap: anywhere; }
.mail-body { white-space: pre-wrap; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.demo-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.mail-preview > .footnote { max-width: 460px; margin-top: 16px; }
dialog { border: 1px solid var(--line); border-radius: 4px; max-width: 600px; width: calc(100% - 32px); padding: 24px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #0006; }
dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin-top: 20px; }
@media (max-width: 850px) {
  .workspace.demo { gap: 24px; padding: 24px 16px; grid-template-columns: minmax(0, 1fr) 340px; }
  .mail-preview h1 { font-size: 28px; }
  .mail-preview { padding-top: 12px; }
}
@media (max-width: 680px) {
  .workspace.demo { display: block; max-width: 460px; padding: 16px 12px; }
  .mail-preview { padding: 0 4px 24px; }
  .mail-preview h1 br { display: none; }
  .mail-content { display: none; }
  .demo-bar { padding: 12px 16px; }
  .demo-bar > span:last-child { display: none; }
}
@media (max-width: 340px) {
  .section, .panel-header { padding: 12px; }
  .panel-header { gap: 8px; }
  .connection { padding-inline: 12px; }
}
@media (forced-colors: active) {
  .primary, .chip, .brand-icon { border: 1px solid ButtonText; }
  .dot { background: CanvasText; }
  .mail-row.selected { border-left-color: Highlight; }
}
