/* Semantic tokens are shared by the workspace, navigation, and appearance menu. */
:root {
  color-scheme: dark;
  --shell: #25282d;
  --page: #32363e;
  --panel: #383e47;
  --editor: #292d34;
  --text: #e3e7ed;
  --muted: #b7c0cd;
  --line: #525b68;
  --accent: #a8c7fa;
  --selected: #2b4466;
  --button: #a8c7fa;
  --on-button: #16335b;
  --ok: #9bd5b3;
  --error: #ffb4ab;
  --error-surface: #512c2c;
  --sidebar-width: 224px;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
  --sans: Arial, 'Segoe UI', sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --shell: #f0f4f9;
  --page: #ffffff;
  --panel: #f8fafd;
  --editor: #ffffff;
  --text: #202124;
  --muted: #59636f;
  --line: #c4cbd5;
  --accent: #1558ba;
  --selected: #d9e7fc;
  --button: #0b57d0;
  --on-button: #ffffff;
  --ok: #1b6e42;
  --error: #a32922;
  --error-surface: #fce8e6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--shell); color: var(--text); font: 13px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
button { background: transparent; border: 0; padding: 8px 12px; border-radius: 4px; }
button:hover, .sidebar a:hover { background: var(--selected); }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
[hidden], .hidden { display: none !important; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 12px; background: var(--page); }
.skip-link:focus { top: 8px; }
.topbar { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 16px; }
.brand { font-size: 20px; font-weight: 400; letter-spacing: -.4px; white-space: nowrap; }
.service-label { border-left: 1px solid var(--line); padding-left: 20px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.health { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.ok { background: var(--ok); }
.dot.down { background: var(--error); }
.settings { position: relative; }
.settings-panel { position: absolute; right: 0; top: 42px; width: 208px; max-width: calc(100vw - 32px); background: var(--page); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px #0002; padding: 12px 0; z-index: 20; }
.settings-panel fieldset { border: 0; padding: 0; margin: 0; }
.settings-panel legend { color: var(--muted); font-size: 12px; padding: 0 16px 8px; }
.settings-panel label { display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; }
.settings-panel label:hover { background: var(--panel); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex-shrink: 0; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar { padding: 14px 8px; min-width: 0; overflow: hidden; }
.sidebar-title { font-size: 14px; padding: 0 10px 20px; display: flex; align-items: center; gap: 10px; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar a { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 10px 12px; min-height: 40px; margin-bottom: 4px; border-radius: 0 22px 22px 0; color: var(--text); text-decoration: none; }
.sidebar a span { min-width: 0; overflow-wrap: anywhere; }
.sidebar a[aria-current="page"] { background: var(--selected); color: var(--accent); }
.nav-section { margin: 18px 12px 8px; font-size: 12px; color: var(--muted); }
.workspace { background: var(--page); border-radius: 18px 0 0 0; min-width: 0; }
.workspace:focus { outline: none; }
body[data-nav-collapsed] .app-shell { grid-template-columns: minmax(0, 1fr); }
body[data-nav-collapsed] .sidebar { display: none; }
.toolbar { padding: 14px 24px; min-height: 64px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line); }
h1 { font-size: 19px; font-weight: 400; margin: 0 14px 0 0; line-height: 1.3; }
h2 { font-size: 14px; font-weight: 500; margin: 0; }
.primary-button { background: var(--button); color: var(--on-button); border-radius: 18px; font-weight: 600; padding: 8px 16px; min-height: 36px; }
.primary-button:hover { background: var(--button); filter: brightness(.95); }
.text-button { color: var(--accent); }
.run-status { margin-left: auto; color: var(--muted); font-size: 12px; }
.work { padding: 24px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 28px; }
.editor-grid > section { min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 34px; margin-bottom: 12px; }
.mode-tabs { display: flex; align-items: center; gap: 4px; }
.mode-tabs button { padding: 4px 8px; font-size: 12px; color: var(--muted); }
.mode-tabs button.active { color: var(--accent); background: var(--selected); }
textarea#content { display: block; width: 100%; min-width: 0; min-height: 278px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--editor); resize: vertical; font: 12px/1.9 var(--mono); }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: 1; }
#dropzone { width: 100%; min-height: 278px; border: 1px dashed var(--line); border-radius: 4px; padding: 24px; background: var(--editor); color: var(--muted); }
#dropzone strong { display: block; font-weight: 500; color: var(--text); margin-bottom: 8px; }
#dropzone span { display: block; font-size: 12px; }
#dropzone.drag { border-color: var(--accent); background: var(--selected); }
.input-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.input-meta label { display: flex; gap: 6px; align-items: center; }
.input-meta select { border: 0; background: var(--editor); color: var(--muted); padding: 4px 2px; }
#input-size { margin-left: auto; }
#file-name { overflow-wrap: anywhere; max-width: 100%; }
.configuration h2 { margin: 4px 0 19px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; min-width: 0; }
.field > span { color: var(--muted); font-size: 12px; }
.field input, .field select { padding: 9px 10px; min-height: 38px; border: 1px solid var(--line); border-radius: 4px; background: var(--editor); min-width: 0; width: 100%; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.required-note { font-size: 11px; }
.field-note { color: var(--muted); font-size: 11px; line-height: 1.6; margin: -4px 0 16px; }
.field .field-note { margin: 0; }
.advanced { border-top: 1px solid var(--line); padding-top: 9px; }
.advanced summary { color: var(--accent); padding: 6px 0; }
.check { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 0; font-size: 12px; cursor: pointer; }
.check small { color: var(--muted); }
#obfuscate-first-row { margin-bottom: 8px; }
.output-section { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); gap: 18px; }
.tab { padding: 10px 0; font-size: 12px; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
#output-empty { min-height: 100px; padding: 24px 0; color: var(--muted); }
.pane { display: none; min-width: 0; }
.pane.active { display: block; }
.pane-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; }
.pane-meta > span { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.output-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.output-actions button { padding: 5px 9px; font-size: 12px; }
pre.output { min-height: 150px; max-height: 480px; overflow: auto; margin: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--editor); padding: 16px; font: 12px/1.8 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
#chain { color: var(--muted); font-size: 12px; }
#chain:not(:empty) { padding-top: 12px; }
.step-ok { color: var(--ok); }
.arrow { margin: 0 6px; }
.bottom-status { color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; margin-top: 16px; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 16px; }
#banner { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: min(680px, 90vw); padding: 14px 20px; border-radius: 8px; font-size: 13px; background: var(--error-surface); border: 1px solid var(--error); color: var(--error); z-index: 50; }
#banner.info { background: var(--selected); border-color: var(--accent); color: var(--text); }
.documentation { max-width: 1000px; }
.documentation > p { margin: 0 0 24px; color: var(--muted); max-width: 720px; }
.documentation h2 { margin: 28px 0 12px; }
.documentation pre { background: var(--editor); padding: 16px; border: 1px solid var(--line); border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { font-weight: 500; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
td code { overflow-wrap: anywhere; }
.api-key-field { max-width: 480px; margin-top: 8px; }
.text-link { text-decoration: none; }
.text-link:hover { text-decoration: underline; }
@media (max-width: 1000px) { .editor-grid { grid-template-columns: minmax(0, 1fr) minmax(220px, .9fr); gap: 24px; } }
@media (max-width: 840px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  body[data-nav-open] .sidebar { display: block; border-bottom: 1px solid var(--line); }
  .service-label { display: none; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .work { padding: 18px; }
  .toolbar { padding: 14px 18px; }
}
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 8px; }
  .brand { font-size: 17px; }
  .header-actions { gap: 4px; }
  .health { font-size: 11px; max-width: 72px; }
  .toolbar { gap: 10px; }
  h1 { width: 100%; margin: 0; }
  .tabs { gap: 12px; }
  textarea#content, .field input, .field select { font-size: 16px; }
  .sidebar a, button, summary, .settings-panel label { min-height: 44px; }
}
