:root {
  color-scheme: dark;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  --accent: #60cdff;
  --accent-hover: #82d6ff;
  --accent-fill: #0d2d3f;
  --page: #1c1c1e;
  --surface: #2c2c2e;
  --surface-alt: #242426;
  --line: #3a3a3c;
  --line-strong: #636366;
  --ink: #f2f2f7;
  --muted: #aeaeb2;
  --button-ink: #1c1c1e;
  --warning: #ffd60a;
  --warning-fill: #332e18;
  --error: #ff6b69;
  --error-fill: #351e20;
  color: var(--ink);
  background: var(--page);
}
:root[data-theme="light"] {
  color-scheme: light;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --accent-fill: #deecf9;
  --page: #fff;
  --surface: #faf9f8;
  --surface-alt: #f3f2f1;
  --line: #edebe9;
  --line-strong: #8a8886;
  --ink: #323130;
  --muted: #605e5c;
  --button-ink: #fff;
  --warning: #795b00;
  --warning-fill: #fff8df;
  --error: #a4262c;
  --error-fill: #fde7e9;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
.builder-page { min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border-radius: 4px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); cursor: pointer; text-decoration: none; font-weight: 600; font-size: 13px; min-height: 32px; }
button:hover:not(:disabled) { background: var(--surface-alt); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 10; background: var(--page); padding: 16px; }
.skip-link:focus { top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
header { background: #1b1b1f; color: #fff; flex-shrink: 0; border-bottom: 1px solid #ffffff12; }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; color: #fff; text-decoration: none; font-size: 15px; font-weight: 600; letter-spacing: -.15px; }
.brand-mark { width: 24px; height: 24px; flex-shrink: 0; color: #60cdff; }
.header-actions { flex-shrink: 0; }
.header-actions, nav { display: flex; align-items: center; gap: 8px; }
nav a, .source-link, .theme-toggle, .header-button { text-decoration: none; color: #ffffffcc; font-size: 13px; padding: 8px; border: 0; background: transparent; font-weight: 400; border-radius: 4px; }
nav a:hover, .source-link:hover, .theme-toggle:hover:not(:disabled), .header-button:hover { color: #fff; background: #ffffff12; }
.header-byline { color: #ffffffcc; font-size: 13px; padding: 8px; }
.header-divider { height: 24px; width: 1px; background: #ffffff33; margin: 0 8px; }
.page-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 12px 0 4px; flex-shrink: 0; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 600; }
.page-heading p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.builder-intro { color: var(--muted); font-size: 16px; margin: 12px 0 4px; flex-shrink: 0; }
.wip-banner { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.chip { display: inline-flex; border-radius: 4px; padding: 0 8px; font-size: 11px; font-weight: 600; }
.warning-chip { background: var(--warning-fill); color: var(--warning); }
.how-to { color: var(--ink); font-size: 14px; flex-shrink: 0; background: var(--accent-fill); border: 1px solid var(--accent); border-radius: 4px; padding: 8px 16px; margin-bottom: 8px; }
.how-to strong { color: var(--accent); }
.how-to ol { margin: 0 0 4px; padding-left: 20px; }
.how-to p { margin: 0 0 4px; }
#editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; gap: 12px; align-items: center; padding: 8px 0 12px; flex-shrink: 0; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
input[type="search"], select { color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 12px; height: 36px; font-size: 13px; }
input[type="search"] { width: 100%; padding-left: 40px; }
input::placeholder { color: var(--muted); opacity: 1; }
.filter-field { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.filter-field label { color: var(--muted); font-size: 13px; }
.filter-field select { min-width: 152px; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 352px; flex: 1; min-height: 0; border: 1px solid var(--line); border-bottom: 0; }
.tools-heading { display: flex; align-items: center; gap: 16px; }
.selection-count { color: var(--muted); font-size: .875rem; }
.selection-count strong { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.selection-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 12px; min-height: 48px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.panel-heading h2 { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.5; }
.quiet-button { min-height: 32px; padding: 4px 12px; font-size: 12px; font-weight: 400; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px; font-size: .875rem; color: var(--muted); background: var(--surface-alt); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tool-scroll { flex: 1; }
.tool-scroll:focus-visible { outline-offset: -3px; }
.tool-list { margin: 0; padding: 0; list-style: none; }
.tool { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tool:hover { background: var(--surface); }
.tool:focus-within { outline: 1px solid var(--accent); outline-offset: -1px; }
.tool.excluded { background: var(--accent-fill); box-shadow: inset 3px 0 0 var(--accent); }
.tool-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tool-top > div { min-width: 0; }
.tool-title { font-size: 1rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.rule-count { font-size: .875rem; color: var(--muted); margin-top: 0; }
.exclude-label { display: flex; align-items: center; justify-content: flex-end; gap: 8px; cursor: pointer; flex-shrink: 0; font-size: .875rem; color: var(--muted); min-height: 44px; min-width: 44px; padding: 8px; }
.exclude-label span { min-width: 48px; text-align: right; }
.excluded .exclude-label { color: var(--ink); }
input[type="checkbox"] { appearance: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 0; border: 2px solid var(--muted); border-radius: 4px; background: var(--page); color: var(--button-ink); cursor: pointer; flex-shrink: 0; }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { content: ""; width: 6px; height: 12px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
details { margin-top: 8px; overflow-wrap: anywhere; }
summary { width: fit-content; cursor: pointer; font-size: .875rem; color: var(--accent); min-height: 44px; padding: 8px 0; }
.tool details { margin-top: 0; }
.tool summary { font-size: .875rem; color: var(--muted); font-weight: 500; min-height: 32px; padding: 4px 0; }
.tool details[open] summary { color: var(--ink); }
.compact-rule-list { margin: 8px 0; padding: 8px 16px; list-style: none; background: var(--surface-alt); border-radius: 4px; }
.compact-rule-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 8px 0; overflow-wrap: anywhere; }
.compact-rule-list code, .rule-type { font-size: .875rem; }
.rule-type { color: var(--muted); }
.rule-list { margin: 8px 0; padding-left: 24px; }
.rule-list li { margin: 8px 0; overflow-wrap: anywhere; }
.rule-list code { font-size: .875rem; }
.shared-warning, .unclassified-warning { color: var(--warning); font-size: .875rem; margin: 8px 0 0; }
.ioc-count { margin-bottom: 0; }
.empty-state { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.export-panel { min-height: 0; min-width: 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--surface-alt); }
.export-content { flex: 1; padding: 8px; }
.selection-details { margin: 0 0 16px; }
.selection-details ul { margin: 8px 0; padding: 0; list-style: none; color: var(--muted); font-size: .875rem; }
.selection-details li { margin: 8px 0; overflow-wrap: anywhere; }
.export-card { padding: 8px; background: var(--page); border: 1px solid var(--line); border-radius: 4px; margin-bottom: 8px; }
.export-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
.file-badge { display: inline-block; color: var(--muted); background: var(--surface); padding: 0 8px; border-radius: 4px; font-size: 10px; }
.export-status { color: var(--muted); font-size: .875rem; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.output-description { color: var(--muted); font-size: 12px; margin: 0 0 4px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--button-ink); font-size: 13px; padding: 8px 16px; min-height: 40px; }
.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.export-card .primary { width: 100%; justify-content: space-between; }
.export-details { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.export-details summary { min-height: 32px; padding: 4px 0; }
.export-details p, .warning-details p { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.ioc-toggle { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; margin: 4px 0 0; min-height: 44px; }
.ioc-panel.enabled { border-color: var(--accent); }
.ioc-download { width: 100%; justify-content: center; }
.csv-list { list-style: none; margin: 8px 0 0; padding: 0; overflow: auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px; }
.csv-list li { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-alt); font-size: 12px; }
.csv-list input[type="checkbox"] { width: 16px; height: 16px; flex: none; }
.csv-list code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.csv-list .rule-type { color: var(--muted); font-size: 10px; }
.warning-details { background: var(--warning-fill); padding: 8px; border-radius: 4px; margin-top: 16px; }
.warning-details summary { color: var(--warning); }
.error { background: var(--error-fill); color: var(--error); border: 1px solid var(--error); border-radius: 4px; padding: 16px; margin: 16px 0; overflow-wrap: anywhere; font-size: 13px; }
footer { border-top: 1px solid var(--line); flex-shrink: 0; background: var(--page); }
.footer-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; font-size: 11px; color: var(--muted); }
.footer-content a { text-decoration: none; }
.footer-button { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; }
.footer-button:hover { text-decoration: underline; }
.footer-warning { color: var(--error); }
.help-page { min-height: 100dvh; display: flex; flex-direction: column; }
.help-layout { display: grid; grid-template-columns: 192px minmax(0, 960px); gap: 32px; padding-top: 24px; padding-bottom: 32px; flex: 1; align-items: start; }
.help-sidebar { position: sticky; top: 24px; }
.help-nav { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.help-nav h2 { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; padding: 8px; margin: 0 0 8px; }
.help-nav a { color: var(--muted); padding: 8px; }
.help-nav a:hover { color: var(--accent); background: var(--surface); }
.help-sections { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.help-sections a { border-left: 1px solid var(--line); border-radius: 0; margin-left: 8px; padding-left: 16px; font-size: 12px; }
.help-guide { min-width: 0; }
.help-guide .page-heading { padding-top: 0; }
.help-warning { border-left: 3px solid var(--warning); color: var(--warning); background: var(--warning-fill); padding: 12px 16px; margin: 16px 0 24px; font-size: 13px; }
.help-step { padding: 24px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.help-step h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.help-step p, .help-step ul { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
.help-step strong { color: var(--ink); font-weight: 600; }
.help-step li { margin: 8px 0; }
.help-step figure { margin: 16px 0 0; }
.help-step figure a { display: block; width: fit-content; max-width: 100%; }
.help-step img { display: block; width: auto; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
nav a[aria-current="page"] { color: #fff; background: #ffffff12; }
.help-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-fill); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
@media (min-width: 1600px) {
  .workbench { grid-template-columns: minmax(0, 1fr) 384px; }
}
@media (max-width: 1100px) {
  .container { padding: 0 16px; }
  .workbench { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 800px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .help-sidebar { position: static; }
  .help-nav { flex-direction: row; flex-wrap: wrap; gap: 0 8px; }
  .help-nav h2 { flex-basis: 100%; margin-bottom: 0; }
  .help-sections { margin-top: 16px; padding-top: 8px; }
  .help-sections a { border-left: 0; margin-left: 0; padding-left: 8px; }
  .builder-page { height: auto; min-height: 100dvh; overflow: visible; }
  .page-main { flex: 1; }
  .header-content { gap: 8px; }
  .header-actions { gap: 0; }
  .header-divider, .source-link, .header-byline { display: none; }
  nav a, .theme-toggle, .header-button { padding: 8px; font-size: 12px; }
  h1 { font-size: 22px; }
  .workbench { grid-template-columns: minmax(0, 1fr); border-bottom: 1px solid var(--line); }
  .selection-panel { min-height: 480px; }
  .export-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .export-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; overflow: visible; }
  .selection-details { grid-column: 1 / -1; margin: 0; }
  .export-card { margin: 0; }
  footer { margin-top: 16px; }
}
@media (max-width: 560px) {
  .brand { font-size: 13px; gap: 4px; }
  .brand-mark { width: 20px; height: 20px; }
  .header-content, .header-actions { flex-wrap: wrap; flex-shrink: 1; }
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .search-field { flex-basis: 100%; }
  .filter-field { width: 100%; }
  .filter-field select { flex: 1; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .selection-panel { min-height: 400px; }
  .exclude-label span { display: inline; }
  .tool-top { gap: 8px; }
  .export-panel { grid-column: 1; }
  .export-content { grid-template-columns: minmax(0, 1fr); }
  .footer-content { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  button, select { min-height: 32px; }
}
@media (pointer: coarse) {
  .exclude-label { min-height: 44px; min-width: 44px; justify-content: flex-end; }
  .tool summary, .export-details summary { min-height: 44px; padding: 8px 0; }
}
@media (max-width: 400px) {
  .download-nav { display: none; }
}
@media (forced-colors: active) {
  input[type="checkbox"] { appearance: auto; border: revert; background: revert; color: revert; }
  input[type="checkbox"]:checked { background: revert; border-color: revert; }
  input[type="checkbox"]:checked::after { content: none; }
  .tool.excluded { box-shadow: none; }
}
:root {
  --tok-comment: #6a9955;
  --tok-string: #ce9178;
  --tok-num: #b5cea8;
  --tok-keyword: #569cd6;
  --tok-table: #4ec9b0;
  --tok-var: #9cdcfe;
  --tok-op: #c8c8c8;
}
:root[data-theme="light"] {
  --tok-comment: #008000;
  --tok-string: #a31515;
  --tok-num: #098658;
  --tok-keyword: #0000ff;
  --tok-table: #267f99;
  --tok-var: #001080;
  --tok-op: #000000;
}
.kql-open { width: 100%; justify-content: space-between; border-color: var(--line-strong); margin-bottom: 16px; }
.kql-open:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.modal { padding: 0; border: 0; background: transparent; color: inherit; width: calc(100% - 48px); max-width: 880px; overflow: visible; }
.modal::backdrop { background: #000000b3; }
.modal-dialog { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; max-height: 90dvh; display: flex; flex-direction: column; padding: 20px; box-shadow: 0 24px 64px #00000080; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.modal-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-close { min-height: 32px; min-width: 32px; padding: 0; font-size: 20px; line-height: 1; }
.modal-desc { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.kql-code { margin: 0; flex: 1; min-height: 0; overflow: auto; background: var(--page); border: 1px solid var(--line); border-radius: 6px; padding: 16px; font-family: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre; tab-size: 4; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.tok-comment { color: var(--tok-comment); }
.tok-string { color: var(--tok-string); }
.tok-num { color: var(--tok-num); }
.tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.tok-table { color: var(--tok-table); }
.tok-var { color: var(--tok-var); }
.tok-op { color: var(--tok-op); }

/* Changelog page */
.changelog-main { max-width: 960px; padding-top: 24px; padding-bottom: 32px; width: 100%; }
.changelog-entry { border-top: 1px solid var(--line); padding: 16px 0; }
.changelog-entry h2 { font-size: 16px; margin: 0 0 4px; }
.changelog-entry > p { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.changelog-date { color: var(--muted); font-weight: 400; }
.changelog-products { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.changelog-products > li { padding: 6px 0; }
.changelog-new { color: var(--accent); font-size: 12px; }
.changelog-items { list-style: none; margin: 4px 0 0 16px; padding: 0; color: var(--muted); }
.changelog-item { overflow-wrap: anywhere; }
.changelog-note { font-size: 13px; margin: 0 0 8px; }
