:root {
  color-scheme: light;
  --bg: #f5f5fa; --panel: #fff; --panel-2: #f8f8fc; --text: #20202d; --muted: #6c6b7c;
  --border: #dedee8; --accent: #5b52e6; --accent-hover: #4a42cf; --accent-soft: #eeedff;
  --good: #168a62; --good-soft: #e8f8f1; --warn: #a46505; --warn-soft: #fff6df; --bad: #c23b4d; --bad-soft: #fff0f2;
  --editor: #fbfbfe; --gutter: #f1f1f7; --shadow: 0 14px 40px rgba(37, 34, 74, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-site-theme="dark"],
html[data-site-theme="dark"] body,
html[data-theme="dark"] .app,
html[data-site-theme="dark"] .app,
html[data-theme="dark"] .app-shell,
html[data-site-theme="dark"] .app-shell,
html[data-theme="dark"] .panel,
html[data-site-theme="dark"] .panel,
html[data-theme="dark"] .workspace,
html[data-site-theme="dark"] .workspace {
  background-color: #0c111b !important;
  color: #e8edf6 !important;
}

:root[data-theme="dark"], html[data-theme="dark"], html[data-site-theme="dark"] {
  color-scheme: dark;
  --bg: #11111a; --panel: #191923; --panel-2: #20202c; --text: #ededf5; --muted: #aaa9ba;
  --border: #353544; --accent: #8e87ff; --accent-hover: #aaa5ff; --accent-soft: #292748;
  --good: #66d7ac; --good-soft: #17392f; --warn: #f2bd62; --warn-soft: #3b2e17; --bad: #ff8495; --bad-soft: #422029;
  --editor: #15151e; --gutter: #1c1c27; --shadow: 0 14px 40px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; }
button, select, input { font: inherit; }
button, select, input, textarea { color: inherit; }
button { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 8px 12px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
button.primary:hover { background: var(--accent-hover); }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.topbar { height: 66px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; }
.brand img { border-radius: 8px; }
.brand h1 { font-size: 16px; line-height: 1.2; margin: 0; letter-spacing: -.2px; }
.brand p { color: var(--muted); font-size: 11px; margin: 1px 0 0; text-transform: uppercase; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.privacy-note { color: var(--muted); font-size: 12px; }
.privacy-note span { color: var(--good); }
.service-icon { position: relative; display: inline-block; flex: 0 0 auto; }
.service-icon-lock { width: 14px; height: 14px; color: var(--good); }
.service-icon-lock::before { position: absolute; left: 2px; bottom: 1px; width: 10px; height: 8px; border-radius: 3px; background: currentColor; content: ""; }
.service-icon-lock::after { position: absolute; left: 4px; top: 0; width: 6px; height: 7px; border: 2px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; content: ""; }
.service-icon-check { width: 13px; height: 10px; color: currentColor; }
.service-icon-check::before { position: absolute; left: 2px; top: 1px; width: 8px; height: 5px; border-bottom: 2px solid currentColor; border-left: 2px solid currentColor; content: ""; transform: rotate(-45deg); }
.service-icon-spark { width: 13px; height: 13px; color: currentColor; transform: rotate(45deg); }
.service-icon-spark::before, .service-icon-spark::after { position: absolute; left: 50%; top: 50%; border-radius: 2px; background: currentColor; content: ""; transform: translate(-50%, -50%); }
.service-icon-spark::before { width: 3px; height: 13px; }
.service-icon-spark::after { width: 13px; height: 3px; }
#theme-button::before { display: block; width: 14px; height: 14px; border-radius: 50%; box-shadow: -4px 2px 0 0 currentColor; content: ""; }
:root[data-theme="dark"] #theme-button::before { width: 9px; height: 9px; border: 2px solid currentColor; box-shadow: 0 -7px 0 -4px currentColor, 0 7px 0 -4px currentColor, -7px 0 0 -4px currentColor, 7px 0 0 -4px currentColor; }
.compact-field { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
select, input { background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; }
.icon-button { min-width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; font-weight: 700; }
.keyboard-shortcuts-icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#help-button { width: 34px; min-width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; line-height: 0; }
#help-button .keyboard-shortcuts-icon { margin: 0; }
.toolbar { min-height: 57px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 7px; overflow-x: auto; }
.toolbar button { white-space: nowrap; }
.toolbar-divider { height: 28px; width: 1px; background: var(--border); margin: 0 4px; }
.toolbar-spacer, .status-spacer { flex: 1; }
.agent-button { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); font-weight: 650; }
.workspace { min-height: 0; padding: 16px 20px 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 330px); gap: 14px; }
.editor-panel, .side-panel { min-height: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.editor-panel { display: grid; grid-template-rows: auto auto minmax(360px, 1fr) auto; }
.editor-heading { min-height: 37px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--border); }
.editor-heading span:last-child { text-transform: none; letter-spacing: 0; }
.editor-wrap { min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); background: var(--editor); overflow: hidden; }
.line-numbers, .highlight-layer, #yaml-editor { margin: 0; border: 0; font: 13px/1.65 "Cascadia Code", "SFMono-Regular", Consolas, monospace; tab-size: 2; }
.line-numbers { min-width: 48px; padding: 14px 11px; text-align: right; color: var(--muted); background: var(--gutter); border-right: 1px solid var(--border); user-select: none; overflow: hidden; }
.code-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.highlight-layer, #yaml-editor { position: absolute; inset: 0; width: 100%; height: 100%; padding: 14px 16px; overflow: auto; white-space: pre; }
.highlight-layer { pointer-events: none; color: var(--text); }
#yaml-editor { resize: none; background: transparent; color: transparent; caret-color: var(--text); -webkit-text-fill-color: transparent; outline: none; }
#yaml-editor::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); -webkit-text-fill-color: transparent; }
#yaml-editor::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); }
.editor-wrap.large-document .highlight-layer { display: none; }
.editor-wrap.large-document #yaml-editor { color: var(--text); -webkit-text-fill-color: var(--text); }
.tok-comment { color: #7a8394; font-style: italic; }.tok-key { color: #4b61c7; }.tok-string { color: #17815d; }.tok-number { color: #a15a13; }.tok-bool { color: #b44677; }.tok-anchor { color: #8255bd; }.tok-marker { color: #a46505; }
[data-theme="dark"] .tok-key { color: #9eaaff; } [data-theme="dark"] .tok-string { color: #70d7ae; } [data-theme="dark"] .tok-number { color: #f5b56e; } [data-theme="dark"] .tok-bool { color: #f390bd; } [data-theme="dark"] .tok-anchor { color: #c4a1f3; }
.search-bar { padding: 8px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.search-bar[hidden] { display: none; }.search-bar input { width: min(280px, 50vw); }.search-bar label { font-weight: 700; }.search-bar span { color: var(--muted); font-size: 12px; }
.statusbar { min-height: 35px; padding: 0 12px; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }.status-indicator { width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 50%; background: color-mix(in srgb, currentColor 20%, transparent); }.status.valid { color: var(--good); }.status.invalid { color: var(--bad); }.status.neutral { color: var(--muted); }
.side-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.tabs { min-height: 45px; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); font-weight: 700; }
.tabs button.active { color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; margin-left: 4px; padding: 0 5px; border-radius: 10px; background: var(--panel-2); font-size: 11px; }
.tab-panel { min-height: 0; overflow-y: auto; padding: 14px; }.tab-panel[hidden] { display: none; }
.empty-state { padding: 35px 18px 22px; text-align: center; color: var(--muted); }.empty-state h2 { color: var(--text); font-size: 15px; margin: 10px 0 6px; }.empty-state p { margin: 0; line-height: 1.5; }.empty-icon { width: 42px; height: 42px; margin: auto; display: grid; place-items: center; border-radius: 50%; background: var(--good-soft); color: var(--good); font-size: 20px; }
.issues-list, .history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.issue-item { border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: 8px; background: var(--panel-2); overflow: hidden; }.issue-item.error { border-left-color: var(--bad); }.issue-item button { width: 100%; padding: 10px; text-align: left; border: 0; background: transparent; }.issue-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.info-card { margin-top: 14px; padding: 11px; border-radius: 8px; background: var(--accent-soft); color: var(--muted); }.info-card strong { color: var(--accent); }.info-card p { margin: 4px 0 0; line-height: 1.45; }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }.text-button { border: 0; padding: 4px; color: var(--accent); background: transparent; }.empty-copy { color: var(--muted); text-align: center; padding: 30px 0; }
.secret-note { display: grid; gap: 3px; margin: 0 0 16px; padding: 10px; border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); border-radius: 8px; background: var(--warn-soft); color: var(--warn); }.secret-note span { font-size: 12px; line-height: 1.4; }
.history-item { border: 1px solid var(--border); border-radius: 8px; padding: 9px; }.history-item button { border: 0; padding: 3px; background: transparent; }.history-title { width: 100%; display: flex; justify-content: space-between; gap: 6px; text-align: left; }.history-preview { overflow: hidden; color: var(--muted); font: 11px/1.4 monospace; text-overflow: ellipsis; white-space: nowrap; }.history-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
dialog { width: min(520px, calc(100vw - 30px)); border: 1px solid var(--border); border-radius: 14px; padding: 22px; color: var(--text); background: var(--panel); box-shadow: 0 20px 70px rgba(0,0,0,.28); }dialog::backdrop { background: rgba(15, 14, 27, .55); backdrop-filter: blur(2px); }dialog h2 { margin: 0 35px 5px 0; font-size: 20px; }dialog > p { color: var(--muted); margin: 0 0 18px; }.dialog-close { position: absolute; right: 14px; top: 14px; }.sample-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }.sample-card { padding: 13px; text-align: left; background: var(--panel-2); }.sample-card strong, .sample-card span { display: block; }.sample-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }.dialog-field { display: grid; gap: 7px; font-weight: 700; }.dialog-actions { display: flex; gap: 8px; margin-top: 20px; }.shortcuts { margin: 0; }.shortcuts div { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--border); }.shortcuts dt { font-weight: 700; }.shortcuts dd { margin: 0; color: var(--muted); }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 11px 15px; border: 1px solid var(--border); border-radius: 9px; background: var(--text); color: var(--panel); box-shadow: var(--shadow); }.toast.error { background: var(--bad); color: #fff; }
.busy-overlay { position: fixed; z-index: 15; left: 50%; top: 80px; translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 20px; background: var(--text); color: var(--panel); box-shadow: var(--shadow); }.busy-overlay[hidden], .toast[hidden] { display: none; }.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }
.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; }
@media (max-width: 900px) { .privacy-note { display: none; }.workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(480px, 1fr) auto; }.side-panel { min-height: 280px; }.editor-panel { min-height: 480px; } }
@media (max-width: 620px) { .topbar { height: auto; min-height: 62px; padding: 9px 12px; align-items: flex-start; }.top-actions { gap: 6px; }.compact-field { font-size: 0; }.compact-field select { font-size: 12px; max-width: 100px; }.toolbar { padding: 8px 12px; }.workspace { padding: 10px; }.statusbar { gap: 8px; }.statusbar #cursor-position { display: none; }.sample-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
