/* v2.0.9.18: Theme and accessibility polish. UI chrome only; UML SVG objects are deliberately not recolored. */
:root{--ui-focus:#69d9ff;--ui-on-accent:#061c2e;--ui-canvas-ink:#20364f;--ui-canvas-contrast:#e2ebf4;--ui-danger:#f7a6b3;--ui-success:#80eac7;--ui-control-min:36px}
html[data-ui-theme=light]{--ui-focus:#075e9c;--ui-on-accent:#fff;--ui-canvas-ink:#19364f;--ui-canvas-contrast:#d4e4f2;--ui-danger:#9d2343;--ui-success:#08744d}
html[data-ui-theme=purple]{--ui-focus:#ddcbff;--ui-on-accent:#16132a;--ui-canvas-ink:#25334e;--ui-canvas-contrast:#d6e1f4;--ui-danger:#ffb4be;--ui-success:#91e3ca}
html[data-ui-theme=emerald]{--ui-focus:#a9ffdb;--ui-on-accent:#092b23;--ui-canvas-ink:#174034;--ui-canvas-contrast:#d4eee5;--ui-danger:#ffb4b4;--ui-success:#a4f6d0}
/* typography and controls: preserve readable Thai/English fallbacks */
html[data-ui-theme] body,html[data-ui-theme] .app,html[data-ui-theme] dialog,html[data-ui-theme] .top,html[data-ui-theme] .panel{font-family:Inter,Sarabun,"Noto Sans Thai",system-ui,sans-serif;font-size:14px;line-height:1.5}
html[data-ui-theme] button,html[data-ui-theme] input,html[data-ui-theme] select,html[data-ui-theme] textarea{font:inherit;line-height:1.4;max-width:100%}
html[data-ui-theme] button,html[data-ui-theme] select{min-height:var(--ui-control-min)}
html[data-ui-theme] .left small,html[data-ui-theme] .right small,html[data-ui-theme] .bottom,html[data-ui-theme] .appearance-help{font-size:max(12px,0.78rem);line-height:1.5}
html[data-ui-theme] :where(button,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid var(--ui-focus)!important;outline-offset:2px!important}
html[data-ui-theme] :where(button,[role=button],summary){-webkit-tap-highlight-color:transparent}
html[data-ui-theme] .top .row-label,html[data-ui-theme] .top .brand,html[data-ui-theme] .left .up-phase,html[data-ui-theme] .right label{color:var(--ui-text)!important}
html[data-ui-theme] .top button.active,html[data-ui-theme] .top button[aria-pressed=true],html[data-ui-theme] .left button.active,html[data-ui-theme] .network-mode-toggle button.active{color:var(--ui-on-accent)!important;background:var(--ui-accent)!important}
html[data-ui-theme] :where(.left,.right,.top,.bottom) :where(button,summary,input,select,textarea):disabled{opacity:.65}
html[data-ui-theme] :where(.left,.right,.top,.bottom) :where(button,summary):hover:not(:disabled){border-color:var(--ui-focus)!important}
html[data-ui-theme] .tip,html[data-ui-theme] .inspector-help,html[data-ui-theme] .inspector-section,html[data-ui-theme] .project-explorer{line-height:1.6}
html[data-ui-theme] .right :where(input,select,textarea),html[data-ui-theme] .appearance-dialog :where(input,select){width:100%;min-width:0}
/* dialogs, including accessibility for change type, preview, validation and welcome */
html[data-ui-theme] dialog{color:var(--ui-text)!important;border-color:var(--ui-border)!important;max-width:calc(100vw - 24px);max-height:calc(100dvh - 28px);overflow:auto;overscroll-behavior:contain}
html[data-ui-theme] dialog::backdrop{background:rgba(3,10,20,.68)}
html[data-ui-theme] dialog :where(button,input,select,textarea){color:var(--ui-text);border-color:var(--ui-border)}
html[data-ui-theme] dialog :where(p,small,label,legend){line-height:1.6}
html[data-ui-theme] .appearance-dialog{width:min(510px,calc(100vw - 24px));max-height:min(85dvh,780px)}
html[data-ui-theme] .appearance-choice{font-size:13px;line-height:1.45;min-height:50px;word-break:normal;overflow-wrap:anywhere}
html[data-ui-theme] .appearance-choice[aria-pressed=true]{outline:3px solid var(--ui-focus);outline-offset:-3px}
html[data-ui-theme] .appearance-choice:focus-visible{outline-offset:2px!important}
html[data-ui-theme] .appearance-opts label{font-size:14px;color:var(--ui-text)}
html[data-ui-theme] .appearance-grid-ctrl{display:flex;align-items:center;gap:10px}
html[data-ui-theme] .appearance-grid-ctrl input{width:18px;height:18px;min-width:18px}
/* canvas/background: change grid & chrome, never the model node or link paint */
html[data-ui-theme] .work{background-color:var(--canvas-bg)!important;scrollbar-color:var(--ui-border) var(--canvas-bg)}
html[data-ui-theme] :is(.canvas-scroll-hint,.canvas-context-label){color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-ui-theme] .minimap{background-color:var(--canvas-bg)!important;border:2px solid var(--ui-border)!important;box-shadow:0 5px 18px var(--ui-shadow)!important;max-width:min(216px,36vw)}
/* prevent theme from coloring UML SVG icons/edges; keep diagram content theme-independent */
html[data-ui-theme] .edge-floating,html[data-ui-theme] .editor-context{max-width:min(560px,calc(100vw - 24px));color:var(--ui-text)!important}
html[data-ui-theme] .edge-floating button{min-height:32px}
@media(max-width:760px){html[data-ui-theme] .appearance-shell{padding:15px}html[data-ui-theme] dialog{max-height:calc(100dvh - 20px)}html[data-ui-theme] .minimap{max-width:145px}html[data-ui-theme] .appearance-grid{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){html[data-ui-theme] *,html[data-ui-theme] *::before,html[data-ui-theme] *::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}
