:root {
  color-scheme: light;
  --ink: #30302f;
  --muted: #707070;
  --line: #dfe1e4;
  --soft-line: #eceeef;
  --canvas: #f1f1f1;
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --sidebar: #f4f5f6;
  --control-border: #cfd2d6;
  --hover: #eceef1;
  --selection: #eef3fa;
  --brand: #d62b2b;
  --brand-dark: #b51f1f;
  --accent: #143961;
  --accent-dark: #0e2b4b;
  --danger: #c73838;
  --danger-soft: #fff0f0;
  --danger-line: #edbcbc;
  --success: #187957;
  --success-soft: #eaf7f1;
  --success-line: #b9decf;
  --warning-soft: #fff7e9;
  --warning-ink: #6b4b1f;
  --auth-brand-bg: #f1f1f1;
  --auth-brand-ink: #4a4a49;
  --auth-brand-muted: #707070;
  --code-bg: #fafbfc;
  --toast-bg: #30302f;
  --overlay: rgba(20, 24, 30, 0.5);
  --method-post: #a4531d;
  --method-mutate: #6854a3;
  --json-key: #a23c73;
  --json-string: #13704d;
  --json-number: #1f5fa8;
  --json-boolean: #6851a0;
  --json-null: #a34c2e;
  --variable-token: #146dcc;
  --shadow: 0 16px 40px rgba(30, 35, 42, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f0f0f1;
  --muted: #a9abb0;
  --line: #3a3c42;
  --soft-line: #2c2e33;
  --canvas: #101114;
  --surface: #18191d;
  --surface-alt: #202126;
  --sidebar: #15171a;
  --control-border: #484b52;
  --hover: #27292e;
  --selection: #1d2b3a;
  --brand: #ef5151;
  --brand-dark: #c83a3a;
  --accent: #5f93ca;
  --accent-dark: #477caf;
  --danger: #ff6d72;
  --danger-soft: #3b2023;
  --danger-line: #6b353a;
  --success: #55c895;
  --success-soft: #17372b;
  --success-line: #285d49;
  --warning-soft: #342b1d;
  --warning-ink: #eac98d;
  --auth-brand-bg: #121316;
  --auth-brand-ink: #f0f0f1;
  --auth-brand-muted: #b4b5b8;
  --code-bg: #14161a;
  --toast-bg: #2a2c31;
  --overlay: rgba(0, 0, 0, 0.7);
  --method-post: #e79a63;
  --method-mutate: #bca1ee;
  --json-key: #ee82bd;
  --json-string: #63d5a3;
  --json-number: #79b7f4;
  --json-boolean: #c7a5ff;
  --json-null: #f2a37e;
  --variable-token: #59a7ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset: 1px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.auth-view { min-height: 100%; display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr); background: var(--surface); }
.auth-brand { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--auth-brand-ink); background: var(--auth-brand-bg); border-right: 1px solid var(--line); }
.auth-brand-copy { width: min(420px, 100%); }
.brand-logo { display: block; object-fit: contain; }
.auth-logo { width: min(360px, 100%); height: auto; margin-bottom: 34px; }
.auth-brand strong { display: block; font-size: 1.7rem; font-weight: 720; }
.auth-brand p { margin: 4px 0 0; color: var(--auth-brand-muted); }
.auth-panel { position: relative; width: min(440px, calc(100% - 48px)); margin: auto; }
.auth-theme-toggle { position: fixed; top: 18px; right: 18px; }
.login-heading { margin-bottom: 28px; }
.login-heading h1 { margin: 2px 0 4px; font-size: 1.6rem; }
.login-heading p { margin: 0; color: var(--muted); }
.auth-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-size: 0.875rem; font-weight: 650; color: var(--ink); }
input, select, textarea { width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--control-border); border-radius: 5px; }
input, select { min-height: 42px; padding: 8px 11px; }
textarea { resize: vertical; padding: 12px; }
.form-error { min-height: 24px; color: var(--danger); margin: 14px 0 0; font-size: 0.9rem; }

.primary, .secondary, .run-button { min-height: 38px; border-radius: 5px; border: 1px solid transparent; padding: 7px 14px; font-weight: 680; }
.primary, .secondary { text-decoration: none; }
.primary { color: white; background: var(--brand); border-color: var(--brand); }
.primary:hover { background: var(--brand-dark); }
.secondary { color: var(--ink); background: var(--surface); border-color: var(--control-border); }
.secondary:hover { background: var(--hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.wide { width: 100%; min-height: 44px; }
.command { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.command img, .run-button img { width: 17px; height: 17px; }
.primary.command img, .run-button img { filter: brightness(0) invert(1); }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; }
.icon-button:hover { background: var(--hover); border-color: var(--line); }
.icon-button img { width: 18px; height: 18px; }
.danger-button:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.danger-button img { filter: invert(27%) sepia(44%) saturate(1701%) hue-rotate(319deg) brightness(91%) contrast(88%); }

.app-view { height: 100%; min-height: 620px; display: grid; grid-template-rows: 56px minmax(0, 1fr); overflow: hidden; }
.topbar { height: 56px; display: flex; align-items: center; gap: 22px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.compact-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.compact-brand strong { font-size: 0.97rem; }
.compact-logo { width: 126px; height: 23px; }
.workspace-switcher { display: flex; align-items: center; gap: 5px; min-width: 230px; }
.workspace-switcher select { min-height: 36px; height: 36px; border-color: transparent; background: var(--surface-alt); font-weight: 650; }
.environment-switcher { display: flex; align-items: center; gap: 4px; min-width: 170px; }
.environment-switcher select { min-height: 36px; height: 36px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--selection); color: var(--accent); font-size: 0.82rem; font-weight: 720; }
.site-switcher { display: flex; align-items: center; gap: 4px; min-width: 170px; }
.site-switcher select { min-height: 36px; height: 36px; border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); color: var(--ink); font-size: 0.82rem; font-weight: 720; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.workspace-layout { min-height: 0; display: grid; grid-template-columns: 270px minmax(480px, 1fr) 290px; overflow: hidden; }
.sidebar, .activity-panel { min-height: 0; overflow: auto; background: var(--sidebar); }
.sidebar { border-right: 1px solid var(--line); }
.activity-panel { border-left: 1px solid var(--line); background: var(--surface-alt); }
.panel-heading { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-heading strong, .response-heading strong { display: block; font-size: 0.94rem; }
.panel-heading-actions { display: flex; align-items: center; gap: 3px; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--muted); font-size: 0.72rem; font-weight: 760; text-transform: uppercase; }
.request-search { position: relative; display: block; padding: 10px 12px 4px; }
.request-search img { position: absolute; left: 23px; top: 21px; width: 16px; height: 16px; opacity: 0.58; pointer-events: none; }
.request-search input { min-height: 36px; padding: 7px 10px 7px 34px; background: color-mix(in srgb, var(--surface) 78%, transparent); font-size: 0.8rem; font-weight: 500; }
.collection-tree { padding: 10px 8px 40px; }
.collection-block + .collection-block { margin-top: 12px; }
.collection-title, .folder-title { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.collection-title { padding: 8px; font-weight: 730; }
.folder-title { padding: 6px 8px 6px calc(20px + var(--tree-indent, 0px)); color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.collection-title img, .folder-title img { width: 16px; height: 16px; }
.collection-title .tree-chevron, .folder-title .tree-chevron { width: 13px; height: 13px; flex: 0 0 auto; opacity: 0.7; }
.collection-title > span:not(.tree-count), .folder-title > span:not(.tree-count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { min-width: 20px; margin-left: auto; color: var(--muted); font-size: 0.68rem; font-weight: 700; text-align: right; }
.collection-content, .folder-contents, .folder-requests { min-width: 0; }
.request-link { width: 100%; min-height: 34px; display: grid; grid-template-columns: 43px minmax(0,1fr); align-items: center; gap: 4px; padding: 5px 9px 5px calc(26px + var(--tree-indent, 0px)); border: 0; border-radius: 4px; background: transparent; text-align: left; }
.request-link:hover { background: color-mix(in srgb, var(--surface) 78%, transparent); }
.request-link.active { background: var(--surface); box-shadow: inset 3px 0 var(--brand); }
.request-link[draggable="true"] { cursor: grab; }
.request-link.dragging { opacity: 0.38; }
.collection-title.drag-over, .folder-title.drag-over, .request-link.drag-over { background: var(--selection); box-shadow: inset 3px 0 var(--accent); }
.request-link .method { font-size: 0.68rem; font-weight: 800; color: var(--brand); }
.request-link .method.post { color: var(--method-post); }
.request-link .method.patch, .request-link .method.put { color: var(--method-mutate); }
.request-link .method.delete { color: var(--danger); }
.request-link .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }
.tree-empty { margin: 18px 10px; color: var(--muted); text-align: center; font-size: 0.82rem; }

.request-surface { min-width: 0; min-height: 0; overflow: auto; background: var(--surface); }
.empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; padding: 36px; text-align: center; }
.empty-state img { width: 48px; height: 48px; padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-alt); }
.empty-state h1 { margin: 18px 0 6px; font-size: 1.35rem; }
.empty-state p { max-width: 430px; margin: 0 0 20px; color: var(--muted); }
.empty-actions { display: flex; gap: 8px; }
.request-editor { min-height: 100%; display: grid; grid-template-rows: auto auto auto auto minmax(210px, 1fr); }
.editor-titlebar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 18px; border-bottom: 1px solid var(--soft-line); }
.request-identity { min-width: 0; }
.folder-label { display: block; color: var(--muted); font-size: 0.75rem; }
.request-name { min-height: 30px; padding: 2px 0; border: 0; border-radius: 0; font-size: 1.1rem; font-weight: 720; }
.editor-actions { display: flex; align-items: center; gap: 10px; }
.save-state { color: var(--muted); font-size: 0.78rem; }
.request-line { display: grid; grid-template-columns: 102px minmax(0,1fr) 150px 112px; gap: 8px; padding: 14px 18px; }
.execution-target-select { min-width: 0; font-size: 0.8rem; }
.method-select { min-height: 44px; font-weight: 800; color: var(--brand); }
.url-input { min-height: 44px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.88rem; }
.variable-highlight-field { position: relative; min-width: 0; width: 100%; }
.variable-highlight-layer { position: absolute; inset: 0; z-index: 0; overflow: hidden; margin: 0; border: 1px solid transparent; border-radius: 5px; color: var(--ink); background: var(--surface); white-space: pre; pointer-events: none; }
.variable-highlight-field.code-highlight .variable-highlight-layer { background: var(--code-bg); }
.variable-highlight-field:has(textarea) .variable-highlight-layer { white-space: pre-wrap; overflow-wrap: break-word; }
.variable-highlight-input { position: relative; z-index: 1; color: transparent !important; background: transparent !important; caret-color: var(--ink); }
.variable-highlight-input::placeholder { color: var(--muted); opacity: 0.78; }
.variable-highlight-input::selection { color: transparent; background: color-mix(in srgb, var(--variable-token) 28%, transparent); }
.editable-variable-token { color: var(--variable-token); font-weight: 650; text-decoration-line: underline; text-decoration-style: dotted; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.run-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: white; background: var(--accent); border-color: var(--accent); }
.run-button:hover { background: var(--accent-dark); }
.run-button[disabled] { opacity: 0.65; cursor: wait; }
.editor-tabs { display: flex; gap: 2px; padding: 0 18px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.editor-tab { min-height: 40px; padding: 8px 13px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 0.85rem; }
.editor-tab.active { color: var(--ink); border-color: var(--brand); font-weight: 700; }
.count-badge { display: inline-block; min-width: 19px; padding: 1px 5px; margin-left: 3px; border-radius: 8px; background: var(--hover); font-size: 0.7rem; }
.script-state-dot { width: 7px; height: 7px; display: inline-block; margin-left: 4px; border-radius: 50%; background: var(--success); }
.tab-panels { min-height: 210px; border-bottom: 1px solid var(--line); }
.tab-panel { height: 100%; min-height: 210px; padding: 15px 18px; }
.field-header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.field-header label { font-size: 0.82rem; }
.field-header span { color: var(--muted); font-size: 0.75rem; }
.field-header code { font-size: inherit; }
.code-editor { min-height: 148px; resize: vertical; background: var(--code-bg); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; line-height: 1.55; tab-size: 2; }
.generated-headers-section { margin-bottom: 16px; border: 1px solid var(--soft-line); }
.generated-headers-heading { min-height: 36px; display: flex; align-items: center; gap: 7px; padding: 7px 11px; background: var(--surface-alt); border-bottom: 1px solid var(--soft-line); font-size: 0.78rem; }
.generated-headers { display: grid; }
.generated-headers > div { min-height: 35px; display: grid; grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 7px 11px; border-bottom: 1px solid var(--soft-line); font-size: 0.78rem; }
.generated-headers > div:last-child { border-bottom: 0; }
.generated-headers strong { font-weight: 650; }
.generated-headers code { overflow: hidden; color: var(--brand-dark); text-overflow: ellipsis; white-space: nowrap; }
.body-panel { display: grid; grid-template-columns: 190px minmax(0,1fr); grid-template-rows: auto 1fr; gap: 12px 16px; }
.body-panel .field-header { grid-column: 2; margin: 0; align-items: end; }
.body-editor { grid-column: 2; min-height: 135px; }
.variable-highlight-field.body-editor textarea { min-height: 135px; }
.authorization-panel { align-content: start; }
.authorization-type { width: min(280px, 100%); }
.auth-fields { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--soft-line); }
.auth-fields > label { max-width: 720px; }
.auth-fields input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.84rem; }
.auth-grid { display: grid; grid-template-columns: minmax(180px, 1fr) 190px; gap: 12px; }
.auth-grid .auth-value-field { grid-column: 1 / -1; }
.scripts-panel { padding: 0; }
.script-toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 10px; border-bottom: 1px solid var(--soft-line); background: var(--surface-alt); }
.script-toolbar > span { color: var(--muted); font-size: 0.72rem; }
.script-mode { display: inline-flex; padding: 2px; border: 1px solid var(--control-border); border-radius: 5px; background: var(--surface); }
.script-mode button { min-height: 30px; padding: 4px 10px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 0.78rem; }
.script-mode button.active { color: var(--ink); background: var(--selection); font-weight: 700; }
.script-editor-shell { min-height: 245px; background: var(--code-bg); }
.script-editor { width: 100%; min-height: 245px; border: 0; border-radius: 0; color: var(--ink); background: var(--code-bg); line-height: 1.65; }
.script-editor-shell .CodeMirror { height: 245px; color: var(--ink); background: var(--code-bg); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; line-height: 1.65; }
.script-editor-shell .CodeMirror-gutters { border-right-color: var(--soft-line); background: var(--surface-alt); }
.script-editor-shell .CodeMirror-linenumber { color: var(--muted); }
.script-editor-shell .CodeMirror-cursor { border-left-color: var(--ink); }
.script-editor-shell .CodeMirror-selected { background: var(--selection); }
.script-editor-shell .cm-keyword, .script-editor-shell .cm-operator { color: var(--json-boolean); }
.script-editor-shell .cm-def, .script-editor-shell .cm-variable, .script-editor-shell .cm-variable-2, .script-editor-shell .cm-property { color: var(--json-number); }
.script-editor-shell .cm-string, .script-editor-shell .cm-string-2 { color: var(--json-string); }
.script-editor-shell .cm-number, .script-editor-shell .cm-atom { color: var(--json-null); }
.script-editor-shell .cm-comment { color: var(--muted); font-style: italic; }
.script-help { margin: 0; padding: 9px 12px; color: var(--muted); border-top: 1px solid var(--soft-line); background: var(--surface-alt); font-size: 0.75rem; }
.tests-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.tests-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
.tests-list { display: grid; gap: 7px; }
.test-row { display: grid; grid-template-columns: 130px 1fr 125px 1fr 36px; gap: 7px; align-items: center; }
.test-row input, .test-row select { min-height: 36px; font-size: 0.8rem; }
.test-row .icon-button { width: 36px; height: 36px; }
.response-panel { min-height: 210px; background: var(--surface-alt); }
.response-heading { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--soft-line); }
.response-meta { display: flex; gap: 9px; color: var(--muted); font-size: 0.78rem; }
.response-meta span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.test-results { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
.test-result { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-line); }
.test-result.pass { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.response-body { min-height: 120px; max-height: 340px; overflow: auto; margin: 0; padding: 14px 18px 24px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; line-height: 1.55; }
.response-body.json-highlight { white-space: pre; overflow-wrap: normal; }
.json-key { color: var(--json-key); font-weight: 650; }
.json-string { color: var(--json-string); }
.json-number { color: var(--json-number); }
.json-boolean { color: var(--json-boolean); font-weight: 650; }
.json-null { color: var(--json-null); font-weight: 650; }

.activity-list { padding: 8px 14px 30px; }
.activity-empty { padding: 22px 6px; color: var(--muted); font-size: 0.82rem; }
.activity-item { width: 100%; padding: 11px 4px; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--soft-line); text-align: left; }
.activity-item:hover { background: var(--hover); }
.activity-item > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.activity-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }
.activity-item p { margin: 4px 0 0; color: var(--muted); font-size: 0.75rem; }
.status-pill { padding: 2px 6px; color: var(--success); background: var(--success-soft); border-radius: 4px; font-size: 0.7rem; font-weight: 800; }
.status-pill.error { color: var(--danger); background: var(--danger-soft); }

dialog { width: min(620px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 7px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
#membersDialog, #usersDialog { width: min(820px, calc(100% - 30px)); }
.agents-dialog { width: min(720px, calc(100% - 30px)); }
.history-dialog { width: min(980px, calc(100% - 30px)); }
dialog[open] { position: fixed; inset: 0; z-index: 30; margin: auto; }
body:has(dialog[open])::before { content: ""; position: fixed; inset: 0; z-index: 29; background: var(--overlay); }
dialog::backdrop { background: var(--overlay); }
.dialog-form { display: grid; gap: 20px; padding: 22px; }
.compact-dialog { width: 100%; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin: 0; font-size: 1.25rem; }
.dialog-heading-actions { display: flex; align-items: center; gap: 3px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.request-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; }
.dialog-hint { margin: -4px 0 0; color: var(--muted); font-size: 0.8rem; }
.history-dialog-content { gap: 14px; }
.history-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.history-meta span { padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface-alt); font-size: 0.76rem; }
.history-error { margin: 0; padding: 10px 12px; color: var(--danger); background: var(--danger-soft); border-left: 3px solid var(--danger); font-size: 0.84rem; }
.history-tests { padding: 0; }
.history-response-grid { min-height: 300px; display: grid; grid-template-columns: minmax(190px, 0.75fr) minmax(190px, 0.75fr) minmax(260px, 1.35fr); gap: 14px; }
.history-code-section { min-width: 0; }
.history-code-section .field-header { margin-bottom: 7px; }
.history-code { height: 330px; min-height: 330px; max-height: 330px; border: 1px solid var(--soft-line); background: var(--surface-alt); }
.file-drop { min-height: 170px; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 22px; border: 1px dashed var(--control-border); background: var(--surface-alt); text-align: center; cursor: pointer; }
.file-drop:hover { border-color: var(--brand); }
.file-drop img { width: 30px; height: 30px; }
.file-drop span { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.notice { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--warning-soft); color: var(--warning-ink); font-size: 0.85rem; }
.dialog-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 0.82rem; }
.agent-list { display: grid; border-top: 1px solid var(--line); }
.agent-empty { margin: 0; padding: 20px 4px; color: var(--muted); font-size: 0.84rem; }
.agent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--soft-line); }
.agent-row-copy { min-width: 0; }
.agent-row-copy strong, .agent-row-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row-copy span { margin-top: 3px; color: var(--muted); font-size: 0.74rem; }
.agent-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.agent-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.agent-status.online { color: var(--success); }
.agent-status.online::before { background: var(--success); }
.agent-pairing { display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-alt); }
.pairing-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; }
.pairing-code-row > span:first-child { color: var(--muted); font-size: 0.76rem; }
.pairing-code-row strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.2rem; letter-spacing: 0; }
.pairing-code-row .dialog-subtitle { grid-column: 1 / -1; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; }
.copy-field input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.76rem; }
.agent-dialog-actions { justify-content: space-between; }
.create-user-form { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; gap: 8px; }
.create-user-form input, .create-user-form button { min-width: 0; }
.admin-only-message { margin: 0; padding: 11px 12px; color: var(--muted); background: var(--surface-alt); border-left: 3px solid var(--line); font-size: 0.82rem; }
.member-list { max-height: 360px; overflow: auto; border-top: 1px solid var(--line); }
.member-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--soft-line); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: var(--accent); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.member-copy { min-width: 0; flex: 1; }
.member-copy strong, .member-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-copy strong { font-size: 0.86rem; }
.member-copy span { color: var(--muted); font-size: 0.75rem; }
.role-label { color: var(--muted); font-size: 0.75rem; text-transform: capitalize; }
.pending-label { color: var(--accent); font-size: 0.72rem; font-weight: 700; }
.access-role { width: 140px; min-height: 36px; font-size: 0.82rem; }
.account-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.78rem; }
.account-state input { width: 38px; height: 20px; min-height: 20px; accent-color: var(--brand); }
.user-actions { display: flex; align-items: center; gap: 8px; }
.inactive-user { opacity: 0.58; }
.environment-dialog { width: 100%; }
#environmentDialog { width: min(920px, calc(100% - 30px)); }
.environment-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.environment-search { position: relative; width: min(360px, 100%); }
.environment-search img { position: absolute; top: 13px; left: 11px; width: 16px; height: 16px; opacity: 0.6; }
.environment-search input { padding-left: 35px; }
.environment-table { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.environment-table-head, .environment-variable-row { display: grid; grid-template-columns: minmax(150px, 0.9fr) 145px minmax(180px, 1.25fr) 38px; gap: 0; align-items: center; }
.environment-table-head { min-height: 34px; color: var(--muted); background: var(--surface-alt); font-size: 0.72rem; font-weight: 700; }
.environment-table-head span { padding: 7px 10px; }
.environment-variable-row { border-top: 1px solid var(--soft-line); }
.environment-variable-row > input, .environment-variable-row > select { min-height: 41px; border: 0; border-right: 1px solid var(--soft-line); border-radius: 0; background: transparent; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; }
.environment-variable-row > select { font-family: inherit; }
.environment-variable-row .icon-button { margin: auto; }
.variable-popover { position: fixed; z-index: 40; width: min(325px, calc(100vw - 24px)); display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.variable-popover-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.variable-popover-heading strong { display: block; margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.9rem; }
.variable-popover label { gap: 4px; color: var(--muted); font-size: 0.72rem; }
.variable-popover input, .variable-popover select { color: var(--ink); font-size: 0.82rem; }
.copy-environment { display: flex; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 9px; font-weight: 500; }
.copy-environment input { width: 18px; height: 18px; min-height: 18px; accent-color: var(--brand); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(390px, calc(100% - 36px)); padding: 11px 14px; border-radius: 5px; color: white; background: var(--toast-bg); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 150ms ease, transform 150ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.mobile-only { display: none; }

:root[data-theme="dark"] .brand-logo { padding: 4px 7px; border-radius: 4px; background: #ffffff; }
:root[data-theme="dark"] img[src^="/icons/"] { filter: brightness(0) invert(0.9); }
:root[data-theme="dark"] .primary.command img,
:root[data-theme="dark"] .run-button img { filter: brightness(0) invert(1); }
:root[data-theme="dark"] .danger-button img { filter: invert(62%) sepia(50%) saturate(2370%) hue-rotate(319deg) brightness(102%) contrast(101%); }

@media (max-width: 1180px) {
  .workspace-layout { grid-template-columns: 250px minmax(460px, 1fr); }
  .activity-panel { display: none; }
  .topbar-actions .secondary.command { font-size: 0; width: 36px; padding: 0; }
  .topbar-actions .secondary.command img { margin: 0; }
}

@media (max-width: 800px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-brand { min-height: 180px; padding: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-logo { width: min(290px, 88%); margin-bottom: 20px; }
  .app-view { min-height: 100%; }
  .compact-brand strong { display: none; }
  .compact-logo { width: 94px; height: 20px; }
  .workspace-switcher { min-width: 0; flex: 1; }
  .environment-switcher { min-width: 112px; max-width: 145px; }
  .site-switcher { min-width: 112px; max-width: 145px; }
  .topbar { gap: 8px; }
  .topbar-actions .command { display: inline-flex; width: 36px; padding: 0; font-size: 0; }
  .topbar-actions #importButton, .topbar-actions #environmentButton { display: none; }
  .mobile-only { display: inline-grid; }
  .workspace-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 10; top: 56px; bottom: 0; left: 0; width: min(310px, 88vw); transform: translateX(-102%); box-shadow: var(--shadow); transition: transform 170ms ease; }
  .sidebar.open { transform: translateX(0); }
  .request-line { grid-template-columns: 88px minmax(0,1fr); }
  .execution-target-select { grid-column: 1 / 2; }
  .run-button { grid-column: 2 / 3; }
  .editor-titlebar { align-items: flex-start; }
  .editor-actions .save-state { display: none; }
  .editor-actions .command { width: 36px; padding: 0; font-size: 0; }
  .body-panel { display: block; }
  .body-panel > * + * { margin-top: 12px; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-grid .auth-value-field { grid-column: auto; }
  .test-row { grid-template-columns: 1fr 1fr 36px; }
  .test-row .test-path, .test-row .test-expected { grid-column: span 1; }
  .environment-toolbar { align-items: stretch; flex-direction: column; }
  .environment-search { width: 100%; }
  .environment-table { overflow-x: auto; }
  .environment-table-head, .environment-variable-row { min-width: 650px; }
  .create-user-form { grid-template-columns: 1fr; }
  .request-form-grid { grid-template-columns: 1fr; }
  .history-response-grid { grid-template-columns: 1fr; }
  .history-code { height: 240px; min-height: 240px; max-height: 240px; }
}
