:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-hover: #eef1f4;
  --bg-active: #ddeafc;
  --fg: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --accent: #0969da;
  --accent-fg: #ffffff;
  --error: #d1242f;
  --ok: #1a7f37;
  --flash: #fff1b3;
  --warn: #d4a72c;
  --warn-text: #9a6700;
  --term-bg: #ffffff;
  --exec-bg: rgb(255 214 0 / .28);
  --exec-arrow: #bf8700;
  --crash-bg: rgb(209 36 47 / .12);
  --frame-bg: rgb(26 127 55 / .12);
  --bp: #d1242f;
  --bp-off: #8c959f;
  --changed: #bc4c00;
  --changed-bg: rgb(251 143 68 / .18);
  --ansi-red: #cf222e;
  --ansi-green: #116329;
  --ansi-yellow: #9a6700;
  --ansi-blue: #0550ae;
  --ansi-magenta: #8250df;
  --ansi-cyan: #1b7c83;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}
/* Dark colours: when the system is dark and the user did not choose light,
   or when the user chose dark (data-theme on <html>, from the settings). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117;
    --bg-soft: #151b23;
    --bg-hover: #1f2630;
    --bg-active: #1c2f4a;
    --fg: #e6edf3;
    --muted: #9198a1;
    --border: #3d444d;
    --accent: #4493f8;
    --accent-fg: #0d1117;
    --error: #f85149;
    --ok: #3fb950;
    --flash: #4a3f12;
    --warn: #d29922;
    --warn-text: #d29922;
    --term-bg: #0d1117;
    --exec-bg: rgb(210 153 34 / .25);
    --exec-arrow: #d29922;
    --crash-bg: rgb(248 81 73 / .16);
    --frame-bg: rgb(63 185 80 / .14);
    --bp: #f85149;
    --bp-off: #6e7681;
    --changed: #ffa657;
    --changed-bg: rgb(255 166 87 / .16);
    --ansi-red: #ff7b72;
    --ansi-green: #3fb950;
    --ansi-yellow: #d29922;
    --ansi-blue: #79c0ff;
    --ansi-magenta: #d2a8ff;
    --ansi-cyan: #39c5cf;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #151b23;
  --bg-hover: #1f2630;
  --bg-active: #1c2f4a;
  --fg: #e6edf3;
  --muted: #9198a1;
  --border: #3d444d;
  --accent: #4493f8;
  --accent-fg: #0d1117;
  --error: #f85149;
  --ok: #3fb950;
  --flash: #4a3f12;
  --warn: #d29922;
  --warn-text: #d29922;
  --term-bg: #0d1117;
  --exec-bg: rgb(210 153 34 / .25);
  --exec-arrow: #d29922;
  --crash-bg: rgb(248 81 73 / .16);
  --frame-bg: rgb(63 185 80 / .14);
  --bp: #f85149;
  --bp-off: #6e7681;
  --changed: #ffa657;
  --changed-bg: rgb(255 166 87 / .16);
  --ansi-red: #ff7b72;
  --ansi-green: #3fb950;
  --ansi-yellow: #d29922;
  --ansi-blue: #79c0ff;
  --ansi-magenta: #d2a8ff;
  --ansi-cyan: #39c5cf;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, sans-serif; background: var(--bg); color: var(--fg); }
[hidden] { display: none !important; }

button, select, input {
  font: inherit; color: inherit;
}
button, select, a.button {
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); cursor: pointer;
}
a.button { display: inline-flex; align-items: center; gap: 5px; color: var(--fg); text-decoration: none; font-size: 14px; }
button:hover:not([disabled]), a.button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
button.danger { color: var(--error); }
button.primary.danger { background: var(--error); border-color: var(--error); color: #fff; }
button.quiet { border-color: transparent; background: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- top bar */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.topbar .brand { font-weight: 700; margin-right: 2px; color: var(--fg); text-decoration: none; }
.topbar .project-name {
  font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-left: 10px; border-left: 1px solid var(--border);
}
.topbar .home-button { margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); }
.topbar form { margin: 0; }
.topbar select { max-width: 240px; }

main { padding: 16px; }

/* --- login */
.login { max-width: 320px; margin: 10vh auto; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 8px; font-size: 1.4rem; }
.login label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.login input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.sso-button { flex-direction: column; justify-content: center; gap: 8px; padding: 14px 16px; font-size: 16px; }
.local-login { border-top: 1px solid var(--border); padding-top: 12px; }
.local-login summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }
.sso-debug { max-width: 900px; margin: 0 auto; }
.sso-debug h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.sso-debug dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.sso-debug dt { color: var(--muted); }
.sso-debug dd { margin: 0; }
.sso-debug table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 13px; }
.sso-debug th, .sso-debug td { text-align: left; vertical-align: top; padding: 3px 8px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.sso-debug th { width: 30%; font-weight: 600; }
.error { color: var(--error); }
.ok { color: var(--ok); }

/* --- projects page */
.projects-page { max-width: 1100px; margin: 0 auto; padding: 8px 0 32px; }
.projects-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.projects-head h1 { margin: 0; font-size: 1.5rem; }
.project-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.project-card {
  position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft);
  transition: border-color .15s, box-shadow .15s;
}
.project-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgb(0 0 0 / .08); }
.project-card .project-open { display: block; flex: 1; padding: 14px 76px 14px 16px; color: inherit; text-decoration: none; }
.project-card .project-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.project-card .project-open h2 { margin: 0 0 4px; font-size: 1.1rem; overflow-wrap: anywhere; }
.project-meta { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.project-files { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.project-files li {
  font: 12px var(--mono); padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-files li.more { font-family: system-ui, sans-serif; color: var(--muted); border-style: dashed; }
.projects-actions { display: flex; align-items: center; gap: 8px; }
.trash-link svg { flex-shrink: 0; }
.projects-intro { color: var(--muted); margin: -8px 0 16px; }
.notice { color: var(--ok); }
.project-card.trashed { opacity: .92; }
.project-card.trashed .project-open { padding-right: 16px; padding-bottom: 6px; }
.project-card-actions { display: flex; gap: 8px; padding: 0 16px 14px; }
.trash-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px;
  background: var(--crash-bg); border-bottom: 1px solid var(--error); font-size: 14px;
}
.project-card-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; }
.icon-button { padding: 4px; line-height: 0; color: var(--muted); border-radius: 6px; }
.icon-button:hover { color: var(--accent); border-color: var(--accent) !important; background: var(--bg); }
.project-delete:hover { color: var(--error); border-color: var(--error) !important; }

/* Table view: one compact row per project, its actions on the right. */
.project-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.project-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.project-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px;
  padding: 6px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.project-table td { padding: 5px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.project-table tbody tr:last-child td { border-bottom: 0; }
.project-table tbody tr:hover { background: var(--bg-hover); }
.project-name-cell { font-weight: 600; overflow-wrap: anywhere; }
.project-name-cell a { color: var(--fg); text-decoration: none; }
.project-name-cell a:hover { color: var(--accent); text-decoration: underline; }
.project-files-cell { color: var(--muted); }
.project-files-cell code { font: 12px var(--mono); color: var(--fg); }
.project-files-cell .more { padding-left: 2px; cursor: help; }
.project-when { color: var(--muted); white-space: nowrap; }
.project-row-actions { text-align: right; white-space: nowrap; width: 1%; }
.project-row-actions button + button { margin-left: 4px; }
.view-switch { display: inline-flex; }
.view-switch button { border-radius: 0; font-size: 13px; }
.view-switch button:first-child { border-radius: 6px 0 0 6px; }
.view-switch button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.view-switch button[aria-pressed="true"] { background: var(--bg-active); border-color: var(--accent); position: relative; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- settings page */
.settings-page { max-width: 760px; margin: 0 auto; padding: 8px 0 32px; }
.settings-form section { border: 1px solid var(--border); border-radius: 10px; padding: 4px 18px 16px; margin-bottom: 16px; background: var(--bg-soft); }
.settings-form h2 { font-size: 1.1rem; margin: 14px 0 6px; }
.settings-note { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.settings-field { border: 0; padding: 0; margin: 0 0 14px; }
.settings-field > label, .settings-field legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.settings-field select { min-width: 110px; }
/* Nothing / Warning / Error on one line. */
.settings-levels > div { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.settings-levels .settings-note { margin: 4px 0 0; }
.settings-field label:has(input[type=radio]) { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; }
.settings-field ul.errorlist { color: var(--error); margin: 4px 0 0; padding-left: 18px; }
.settings-preview { height: 290px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.settings-actions { display: flex; gap: 8px; }
.settings-status { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.settings-status.ok { color: var(--ok); }
.settings-status.error { color: var(--error); }
.topbar .settings-link { font-size: 13px; padding: 2px 9px; }

/* --- IDE page layout */
body.ide-page { display: flex; flex-direction: column; overflow: hidden; }
body.ide-page main { flex: 1; min-height: 0; padding: 0; display: flex; flex-direction: column; }
.ide { flex: 1; min-height: 0; display: flex; }
.empty { margin: 15vh auto; text-align: center; color: var(--muted); }
.empty h1 { color: var(--fg); font-size: 1.4rem; }

.gutter { background: var(--border); background-clip: content-box; flex-shrink: 0; }
.gutter.gutter-horizontal { cursor: col-resize; padding: 0 2px; }
.gutter.gutter-vertical { cursor: row-resize; padding: 2px 0; }
.gutter:hover { background-color: var(--accent); }

/* --- sidebar */
.sidebar { display: flex; flex-direction: column; min-width: 0; background: var(--bg-soft); }
.pane-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: space-between;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.pane-title { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 4px; }
.tools button { padding: 1px 7px; font-size: 12px; }
.current-folder {
  padding: 4px 10px; font: 12px var(--mono); color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.current-folder::before { content: "Current folder: "; font-family: system-ui, sans-serif; }
.tree-wrap { flex: 1; min-height: 0; overflow: auto; padding: 4px 0; }
.show-all { padding: 6px 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree .row {
  display: flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.tree .row:hover { background: var(--bg-hover); }
.tree .row .twisty { width: 12px; flex-shrink: 0; color: var(--muted); font-size: 11px; }
.tree .row .name { overflow: hidden; text-overflow: ellipsis; }
.tree .row.root .name { font-weight: 600; }
.tree .row.current { background: var(--bg-active); }
.tree .row.active .name { color: var(--accent); font-weight: 600; }
.tree .row.special { color: var(--muted); font-style: italic; }
.tree .row .tag { font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-style: normal; }
.tree .row.note { color: var(--muted); font-size: 12px; cursor: default; }
.tree .row.flash { animation: flash 3s ease-out; }
.tree .row.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--bg-active); }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }

/* --- editor area */
.main { display: flex; flex-direction: column; min-width: 0; }
.editor-area { display: flex; flex-direction: column; min-height: 0; position: relative; }
.tabs { display: flex; overflow-x: auto; background: var(--bg-soft); border-bottom: 1px solid var(--border); flex-shrink: 0; min-height: 31px; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px;
  border-right: 1px solid var(--border); cursor: pointer; white-space: nowrap; color: var(--muted);
}
.tab.active { background: var(--bg); color: var(--fg); box-shadow: inset 0 2px 0 var(--accent); }
.tab-folder { font-size: 12px; color: var(--muted); }
.tab-close { border: 0; background: transparent; padding: 0 4px; line-height: 1; color: var(--muted); }
.tab-close:hover { color: var(--fg); background: var(--bg-hover); }
.tab.dirty .tab-close { color: var(--fg); }
.banner { padding: 6px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--border); font-size: 13px; }
.banner a { color: var(--accent); }
.impersonation-banner { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--flash); color: var(--warn-text); border-bottom-color: var(--warn); }
.editor { flex: 1; min-height: 0; }
.hex { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 8px 12px; font: 13px/1.5 var(--mono); }
.placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 16px; text-align: center; }

.bottom { display: flex; flex-direction: column; min-height: 0; }
.bottom-tabs .tab { padding-right: 12px; gap: 6px; }
.badge { font-size: 11px; line-height: 16px; min-width: 18px; padding: 0 5px; border-radius: 9px; text-align: center; color: #fff; }
.badge.error { background: var(--error); }
.badge.warn { background: var(--warn); color: #1f2328; }

.compiler-output {
  flex: 1; min-height: 0; overflow: auto; padding: 8px 12px;
  font: 13px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.compiler-output .muted { color: var(--muted); font-family: system-ui, sans-serif; white-space: normal; }
.compiler-output .error { color: var(--error); }
.compiler-output .cmd { color: var(--fg); margin-bottom: 6px; }
.compiler-output .cmd-dir { color: var(--muted); }
.compiler-output a.loc { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
.compiler-output a.loc:hover { color: var(--accent); text-decoration-style: solid; }
.compiler-output .summary { margin-top: 8px; font-family: system-ui, sans-serif; font-weight: 600; }
.compiler-output .summary .muted { font-weight: 400; }
.compiler-output .summary.ok { color: var(--ok); }
.compiler-output .summary.warn { color: var(--warn-text); }
.compiler-output .summary.fail { color: var(--error); }
/* gcc's colours */
.b { font-weight: 700; }
.c-red { color: var(--ansi-red); }
.c-green { color: var(--ansi-green); }
.c-yellow { color: var(--ansi-yellow); }
.c-blue { color: var(--ansi-blue); }
.c-magenta { color: var(--ansi-magenta); }
.c-cyan { color: var(--ansi-cyan); }

.terminal { flex: 1; min-height: 0; padding: 4px 0 0 8px; background: var(--term-bg); }
.terminal .xterm { height: 100%; }

.debug-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.debug-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.debug-hex { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.debug-tools button { font-size: 13px; padding: 2px 9px; }
.debug-tools button:disabled { opacity: .4; cursor: default; }
.debug-status { font-size: 13px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.debug-status a { color: var(--accent); font-family: var(--mono); }
.debug-status .crash { color: var(--error); font-weight: 600; }
.debug-status .stack { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.debug-bar.crash { background: var(--crash-bg); border-bottom-color: var(--error); }
/* Monaco: the line where the program is paused */
.monaco-editor .exec-line { background: var(--exec-bg); }
.monaco-editor .exec-line.crash { background: var(--crash-bg); }
.monaco-editor .exec-arrow::before { content: "➜"; color: var(--exec-arrow); font-weight: 700; }
.monaco-editor .exec-arrow.crash::before { content: "✖"; color: var(--error); }
.monaco-editor .frame-line { background: var(--frame-bg); }
.monaco-editor .frame-arrow::before { content: "↳"; color: var(--ok); font-weight: 700; }
/* Breakpoints in the glyph margin */
.monaco-editor .bp-glyph { cursor: pointer; }
.monaco-editor .bp-glyph::before {
  content: ""; display: block; width: 10px; height: 10px; margin: 4px 0 0 5px;
  border-radius: 50%; background: var(--bp);
}
.monaco-editor .bp-glyph.conditional::before { border-radius: 2px; transform: rotate(45deg) scale(.9); }
.monaco-editor .bp-glyph.disabled::before { background: transparent; border: 2px solid var(--bp-off); width: 6px; height: 6px; }
.monaco-editor .bp-glyph.error::before { background: transparent; border: 2px dashed var(--muted); width: 6px; height: 6px; }
.monaco-editor .margin-view-overlays .cgmr { cursor: pointer; }

/* --- debug panel (right) */
.debug-panel { min-width: 0; overflow: auto; background: var(--bg-soft); font-size: 13px; }
.dp-section { border-bottom: 1px solid var(--border); }
.dp-section > summary {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer;
  list-style: none; user-select: none; position: sticky; top: 0; background: var(--bg-soft); z-index: 1;
}
.dp-section > summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.dp-section[open] > summary::before { content: "▾"; }
.dp-title { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dp-frame { font: 12px var(--mono); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dp-head-button { margin-left: auto; font-size: 12px; padding: 0 6px; }
.dp-sub { padding: 4px 8px 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dp-note { padding: 2px 10px 6px; color: var(--muted); font-size: 12px; }
.dp-input { width: calc(100% - 16px); margin: 2px 8px 4px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); font: 12px var(--mono); }
.var-list { list-style: none; margin: 0; padding: 0 0 2px; }
.var-row { display: flex; align-items: baseline; gap: 0; padding: 1px 8px 1px 4px; font: 12.5px/1.6 var(--mono); white-space: nowrap; }
.var-row:hover { background: var(--bg-hover); }
.var-row .twisty { width: 14px; flex-shrink: 0; color: var(--muted); font-size: 11px; text-align: center; }
.var-name { color: var(--fg); }
.var-type { color: var(--muted); }
.var-eq { color: var(--muted); white-space: pre; }
.var-value { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.var-value.changed { color: var(--changed); background: var(--changed-bg); border-radius: 3px; font-weight: 600; }
.var-value.uninit { color: var(--muted); font-style: italic; }
.var-tag { margin-left: 6px; font: 11px system-ui, sans-serif; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.var-remove { margin-left: auto; padding: 0 4px; color: var(--muted); }
.var-row.more { font-family: system-ui, sans-serif; font-size: 12px; }
.var-row.more a { color: var(--accent); }
.stack-list { list-style: none; margin: 0; padding: 0 0 4px; }
.stack-row { display: flex; gap: 8px; padding: 2px 10px; cursor: pointer; font: 12.5px var(--mono); }
.stack-row:hover { background: var(--bg-hover); }
.stack-row.selected { background: var(--bg-active); }
.stack-row.nosource { color: var(--muted); }
.stack-level { color: var(--muted); }
.stack-loc { margin-left: auto; color: var(--muted); }
.bp-list { list-style: none; margin: 0; padding: 0 0 4px; }
.bp-row { display: flex; align-items: center; gap: 6px; padding: 1px 8px; font-size: 12.5px; }
.bp-row:hover { background: var(--bg-hover); }
.bp-loc { color: var(--accent); font-family: var(--mono); }
.bp-row.disabled .bp-loc { color: var(--muted); }
.bp-cond { font-family: var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-hits { color: var(--muted); font-size: 12px; }
.bp-error { color: var(--error); font-size: 12px; }

.args-toggle { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.args-toggle[aria-expanded="true"] { background: var(--bg-active); border-color: var(--accent); }
.args-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.args-bar label { font-weight: 600; font-size: 13px; }
.args-field {
  display: flex; align-items: center; flex: 1 1 360px; max-width: 720px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.args-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.args-prog { padding: 0 2px 0 8px; color: var(--muted); font: 13px var(--mono); white-space: nowrap; }
.args-field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 4px 6px; font: 13px var(--mono); }
.args-field input:focus-visible { outline: none; }
.args-field button { padding: 0 8px; align-self: stretch; border-radius: 0 6px 6px 0; }
.args-help { font-size: 12px; color: var(--muted); }
.args-help code { font-family: var(--mono); }
.args-menu { max-height: 50vh; overflow: auto; }
.args-menu .menu-row { display: flex; align-items: center; }
.args-menu .menu-row .use { flex: 1; font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.args-menu .menu-row .remove { flex: 0; color: var(--muted); }
.args-menu .empty-note { padding: 4px 10px; color: var(--muted); }

.run-tools { display: flex; align-items: center; gap: 6px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border); }
.run-tools button:disabled { opacity: .45; cursor: default; }
.run-status { color: var(--muted); font-size: 13px; }

.statusbar {
  display: flex; justify-content: space-between; gap: 12px; padding: 2px 12px;
  border-top: 1px solid var(--border); background: var(--bg-soft); font-size: 12px; color: var(--muted);
}
.statusbar #status-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- dialogs and menus */
.dialog {
  border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; min-width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px); background: var(--bg); color: var(--fg); box-shadow: 0 12px 32px rgb(0 0 0 / .25);
}
.dialog::backdrop { background: rgb(0 0 0 / .35); }
.dialog form { margin: 0; }
.dialog h2 { margin: 0 0 10px; font-size: 1.05rem; overflow-wrap: anywhere; }
.dialog-message { white-space: pre-line; color: var(--muted); margin: 0 0 12px; max-height: 40vh; overflow: auto; overflow-wrap: anywhere; }
.dialog-input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); margin-bottom: 14px; font-family: var(--mono); }
.dialog-input { margin-bottom: 6px; }
.dialog-input[aria-invalid="true"] { border-color: var(--error); }
.dialog-hint { margin: 0 0 10px; color: var(--error); font-size: 13px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dialog-buttons button:disabled { opacity: .45; cursor: default; }

.menu {
  position: fixed; z-index: 100; min-width: 180px; padding: 4px; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}
.menu button { border: 0; border-radius: 4px; text-align: left; padding: 4px 10px; background: transparent; }
.menu button:hover:not([disabled]), .menu button:focus-visible { background: var(--bg-hover); outline: none; }
.menu button[disabled] { color: var(--muted); cursor: default; }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--border); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .topbar select { max-width: 50vw; }
}
