:root{
  --bg:#0f172a;
  --panel:#111827;
  --panel2:#1f2937;
  --border:#334155;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --accent:#38bdf8;
  --danger:#ef4444;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:Inter,system-ui,Segoe UI,Roboto,sans-serif;background:#020617;color:var(--text);overflow:hidden}
#app{height:100vh;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 14px;border-bottom:1px solid var(--border);background:#020617;flex:0 0 auto}
.brand{font-weight:700;white-space:nowrap;display:flex;align-items:center;gap:10px}
.version-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;border:1px solid rgba(56,189,248,.35);background:rgba(14,165,233,.12);color:#7dd3fc;font-size:12px;font-weight:700;letter-spacing:.04em}
.version-badge{cursor:pointer}
.version-badge:hover,.version-badge:focus{background:rgba(14,165,233,.2);outline:none}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:flex-end}
.toolbar-group{display:flex;gap:8px;flex-wrap:wrap;align-items:center;padding-left:10px;border-left:1px solid rgba(148,163,184,.18)}
.toolbar-group:first-child{padding-left:0;border-left:0}
.tool-btn{background:#0b1220}
.tool-btn-pages{background:#172554;border-color:#1d4ed8}
.tool-btn-arrange{background:#1f2937;border-color:#475569}
.tool-btn-data{background:#0f3b2f;border-color:#0f766e}
.tool-btn.is-active{background:#0f172a;border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.28) inset;color:#bae6fd}
button,select,input,textarea{font:inherit}
button,select,input{border:1px solid var(--border);background:#0f172a;color:var(--text);border-radius:8px;padding:8px 10px}
button{cursor:pointer}
button:hover{background:#162033}
button.is-active{border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.28) inset;color:#bae6fd}
label{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--text);font-size:14px}
input[type="checkbox"]{width:auto}
.main{flex:1 1 auto;min-height:0;display:grid;gap:12px;padding:12px;overflow:hidden}
.four-col{--col1:360px;--col4:352px;grid-template-columns:var(--col1) 8px minmax(0,1fr) 8px var(--col4)}
.sidebar{min-height:0;display:flex;flex-direction:column;gap:12px;overflow:auto}
.sidebar.left{display:grid;grid-template-rows:auto minmax(0,1fr);align-content:start;overflow:hidden}
.workspace-wrap{min-height:0;display:flex;flex-direction:column;gap:8px;overflow:hidden}
.workspace-toolbar{flex:0 0 auto;color:var(--muted);font-size:13px;padding:0 4px}
.workspace{position:relative;flex:1 1 auto;min-height:0;border:1px solid var(--border);background:#0b1220;border-radius:14px;overflow:auto;padding:8px;display:block}
.stage{position:relative;background:#fff;box-shadow:0 20px 60px rgba(0,0,0,.35);transform-origin:top left;margin:0}
.hidden{display:none !important}
.panel{background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:12px}
.panel h3{margin:0 0 10px 0;font-size:15px}
.panel-heading-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.panel-heading-row h3{margin:0}
.panel-heading-tools{display:flex;align-items:center;gap:10px}
.panel-heading-meta{font-size:12px;color:var(--muted)}
.panel-toggle-btn{padding:5px 9px;font-size:12px}
.action-panel-shell{min-height:0;display:flex;flex-direction:column}
.action-panel-shell.collapsed .action-content{display:none}
.action-content{min-height:0;overflow:auto}
.action-view{display:none}
.action-view.active{display:block}
.content-accordion{display:flex;flex-direction:column;gap:10px}
.content-box{border:1px solid var(--border);border-radius:12px;background:#0b1220;padding:10px}
.content-box-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.content-box-head strong{font-size:13px}
.content-box-body{margin-top:10px;display:flex;flex-direction:column;gap:10px}
.left-properties-shell{min-height:0;display:flex;flex-direction:column;overflow:hidden}
.page-preview-shell{display:flex;flex-direction:column;gap:8px}
.page-preview-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(84px,1fr));gap:8px}
.page-preview-card{padding:10px;border:1px solid var(--border);border-radius:10px;background:#0b1220;cursor:pointer;text-align:left}
.page-preview-card.active{border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.3) inset}
.page-preview-card strong{display:block;font-size:13px;margin-bottom:4px}
.page-preview-meta{font-size:12px;color:var(--muted)}
.palette,.template-list{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.palette button,.template-list button{padding:10px}
.layer-list{display:flex;flex-direction:column;gap:6px;overflow:auto;padding:4px}
.layer-list.grow{max-height:none;flex:1 1 auto}
.overlay-layer-section{margin-bottom:10px;padding:10px;border:1px solid rgba(56,189,248,.24);border-radius:12px;background:rgba(14,165,233,.08)}
.overlay-layer-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.overlay-layer-title{font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#7dd3fc;margin-bottom:8px}
.overlay-layer-head .overlay-layer-title{margin-bottom:0}
.overlay-layer-section.is-collapsed .layer-list{display:none}
.layer-item{padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:#0b1220;font-size:13px;cursor:pointer;display:flex;justify-content:space-between;gap:8px}
.layer-item.selected{box-shadow:0 0 0 2px var(--accent)}
.layer-item[draggable="true"]{cursor:grab}
.layer-item.is-dragging{opacity:.55;cursor:grabbing}
.layer-item.drop-before{box-shadow:inset 0 3px 0 #38bdf8}
.layer-item.drop-after{box-shadow:inset 0 -3px 0 #38bdf8}
.layer-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.layer-title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.layer-meta{color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.layer-actions{display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
.layer-actions button{padding:4px 8px;font-size:12px}
.layer-toolbar{display:flex;gap:6px;flex-wrap:wrap}
.layer-toolbar button{padding:6px 10px}
.fixed-height{height:100%;min-height:0;display:flex;flex-direction:column}
.properties-content{flex:1 1 auto;min-height:0;overflow:auto}
.log-panel{height:180px;min-height:180px;display:flex;flex-direction:column}
.log-panel.collapsed{height:auto;min-height:0}
.log-content{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
.log-panel.collapsed .log-content{display:none}
.log-list{display:flex;flex-direction:column;gap:8px;overflow:auto;flex:1 1 auto;min-height:0;max-height:100px}
.log-item{padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#0b1220;font-size:12px;line-height:1.45}
.log-item time{display:block;color:var(--muted);font-size:11px;margin-bottom:4px}
.log-item.debug{border-color:#475569}
.log-empty{color:var(--muted);padding:8px 2px;font-size:12px}
.property-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.property-grid .full{grid-column:1 / -1}
.property-grid input,.property-grid textarea,.property-grid select{width:100%}
.property-grid textarea{min-height:110px;resize:vertical}
.sidebar.left .property-grid,
.left-properties-shell .property-grid{grid-template-columns:1fr}
.sidebar.left .property-grid label:not(.full):not(.color-field),
.left-properties-shell .property-grid label:not(.full):not(.color-field){display:grid;grid-template-columns:minmax(110px,42%) minmax(0,1fr);align-items:center;justify-content:stretch;gap:10px}
.sidebar.left .property-grid label.full,
.left-properties-shell .property-grid label.full,
.sidebar.left .property-grid label.color-field,
.left-properties-shell .property-grid label.color-field{align-items:flex-start;flex-direction:column}
.sidebar.left .property-grid label > input,
.sidebar.left .property-grid label > select,
.sidebar.left .property-grid label > textarea,
.left-properties-shell .property-grid label > input,
.left-properties-shell .property-grid label > select,
.left-properties-shell .property-grid label > textarea{width:100%}
.empty-state{color:var(--muted);padding:8px 2px}
.bottom-panels{flex:0 0 280px;display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:0 12px 12px 12px;min-height:0}
.bottom{display:flex;flex-direction:column;min-height:0}
.bottom-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.bottom-header h3{margin:0;font-size:15px}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.bottom textarea{flex:1 1 auto;min-height:0;width:100%;resize:none;border:1px solid var(--border);background:#020617;color:#cbd5e1;border-radius:10px;padding:10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
.toast{position:fixed;right:14px;bottom:14px;background:#111827;border:1px solid var(--border);padding:10px 14px;border-radius:10px;max-width:420px;box-shadow:0 10px 30px rgba(0,0,0,.35);z-index:1200}
.modal{position:fixed;inset:0;z-index:400}
.modal-backdrop{position:absolute;inset:0;background:rgba(2,6,23,.72);backdrop-filter:blur(4px)}
.modal-dialog{position:relative;max-width:980px;max-height:min(86vh,940px);margin:4vh auto 0 auto;background:#111827;border:1px solid var(--border);border-radius:18px;box-shadow:0 30px 80px rgba(0,0,0,.45);display:flex;flex-direction:column;overflow:hidden}
.modal-dialog-wide{max-width:min(1320px,calc(100vw - 48px))}
.modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px;border-bottom:1px solid var(--border);background:#0b1220}
.modal-header h3{margin:0;font-size:18px}
.modal-subtitle{margin-top:4px;color:var(--muted);font-size:13px}
.modal-body{padding:20px;overflow:auto;display:flex;flex-direction:column;gap:14px}
.modal-tab-row{display:flex;gap:8px;flex-wrap:wrap;padding-bottom:2px}
.modal-tab-btn{background:#0b1220;border-color:#334155}
.modal-tab-btn.is-active{background:#0f172a;border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.28) inset;color:#bae6fd}
.modal-tab-panel{display:none;flex-direction:column;gap:14px}
.modal-tab-panel.is-active{display:flex}
.changelog-entry{padding:14px 16px;border:1px solid var(--border);border-radius:14px;background:#0b1220}
.changelog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.changelog-version{font-weight:700;color:#7dd3fc}
.changelog-date{font-size:12px;color:var(--muted)}
.changelog-list{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:8px;color:#dbe4ee}
.stage-object{position:absolute;user-select:none;font-family:"Roboto Condensed","Segoe UI",sans-serif}
.stage-object.selected{outline:2px solid #0ea5e9;outline-offset:1px}
.stage-object.multi-selected{outline:2px dashed #22c55e;outline-offset:1px}
.stage-object.is-hidden-object{opacity:.4;filter:saturate(.6)}
.stage-object.is-locked-object::after{content:"lock";position:absolute;right:4px;top:4px;font-family:"Material Symbols Outlined","Segoe UI Symbol",sans-serif;font-size:11px;font-weight:normal;line-height:1;padding:2px 4px;border-radius:999px;background:rgba(15,23,42,.85);color:#f8fafc;border:1px solid rgba(148,163,184,.4);font-feature-settings:"liga";-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
.handle{position:absolute;width:10px;height:10px;background:#0ea5e9;border:1px solid white;border-radius:50%;z-index:20}
.handle.nw{left:-5px;top:-5px;cursor:nwse-resize}
.handle.ne{right:-5px;top:-5px;cursor:nesw-resize}
.handle.sw{left:-5px;bottom:-5px;cursor:nesw-resize}
.handle.se{right:-5px;bottom:-5px;cursor:nwse-resize}
.grid-bg{background-image:linear-gradient(to right, rgba(148,163,184,0.18) 1px, transparent 1px),linear-gradient(to bottom, rgba(148,163,184,0.18) 1px, transparent 1px)}
.object-box{width:100%;height:100%;display:flex;align-items:center;overflow:hidden}
.object-label{white-space:pre-wrap}
.object-button{justify-content:center;font-weight:600}
.object-text-flow{width:100%}
.object-image-placeholder{flex-direction:column;justify-content:center;gap:8px;padding:10px;background:repeating-linear-gradient(135deg, rgba(148,163,184,.12), rgba(148,163,184,.12) 10px, rgba(15,23,42,.18) 10px, rgba(15,23,42,.18) 20px);border:1px dashed rgba(148,163,184,.45);color:#cbd5e1;text-align:center}
.object-image-placeholder-badge{display:inline-flex;align-items:center;justify-content:center;align-self:center;max-width:100%;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#fde68a;background:rgba(146,64,14,.32);border:1px solid rgba(245,158,11,.45);border-radius:999px;padding:4px 8px}
.object-image-placeholder-name{width:100%;font-size:12px;font-weight:700;color:#e2e8f0;overflow-wrap:anywhere;word-break:break-word}
.object-image-placeholder-path{width:100%;font-size:11px;line-height:1.35;color:#94a3b8;overflow-wrap:anywhere;word-break:break-word}
.object-image-placeholder-icon{font-size:24px;line-height:1;color:#cbd5e1;font-variation-settings:'FILL' 0,'wght' 300,'GRAD' 0,'opsz' 24}
.object-image-placeholder.is-compact{gap:6px;padding:6px}
.object-image-placeholder.is-compact .object-image-placeholder-badge{font-size:9px;padding:2px 6px}
.object-image-placeholder.is-compact .object-image-placeholder-name{font-size:11px;line-height:1.25}
.object-image-placeholder.is-tiny{padding:4px;gap:4px}
.object-image-placeholder.is-tiny .object-image-placeholder-icon{font-size:18px}
.object-switch-track{position:relative;width:64px;height:32px;border-radius:999px;background:#334155;margin:auto}
.object-switch-thumb{position:absolute;left:4px;top:4px;width:24px;height:24px;border-radius:50%;background:white}
.object-checkbox{display:flex;align-items:center;gap:8px;padding:6px}
.object-checkbox-box{width:18px;height:18px;border:2px solid currentColor;border-radius:4px}
.object-bar-track{position:relative;height:14px;border-radius:999px;background:#334155;width:85%;margin:auto}
.object-bar-fill{position:absolute;left:0;top:0;bottom:0;border-radius:999px;background:#38bdf8;width:40%}
.object-slider{justify-content:center;align-items:center}
.object-slider .object-bar-track{height:14px}
.object-slider.is-vertical .object-bar-track{width:14px;height:85%}
.object-slider-knob{position:absolute;width:20px;height:20px;border-radius:50%;background:#f8fafc;box-shadow:0 2px 8px rgba(15,23,42,.4)}
.object-dropdown,.object-roller{margin:auto;border:1px solid #64748b;border-radius:8px;padding:6px 10px;background:rgba(15,23,42,.35);min-width:70%}
.object-arc,.object-radial,.object-spinner,.object-led-wrap,.object-tabview,.object-tab,.object-btnmatrix,.object-msgbox,.object-cpicker{justify-content:center;align-items:center;position:relative}
.object-arc-svg{width:100%;height:100%}
.object-arc-track{fill:none;stroke:#334155;stroke-width:10;stroke-linecap:round}
.object-arc-indicator{fill:none;stroke:#38bdf8;stroke-width:10;stroke-linecap:round}
.object-arc-value,.object-radial-value{position:absolute;inset:auto 0 14%;text-align:center;font-size:12px;font-weight:700;color:#e2e8f0}
.object-linemeter,.object-gauge{position:relative;width:100%;height:100%}
.object-linemeter-tick,.object-gauge-tick{position:absolute;left:50%;top:50%;width:4px;height:18px;border-radius:999px;background:#475569;transform-origin:50% calc(100% + 28px)}
.object-linemeter-tick.is-active,.object-gauge-tick.is-active{background:#38bdf8}
.object-gauge-needle{position:absolute;left:50%;top:24%;width:3px;height:34%;background:#f8fafc;border-radius:999px;transform-origin:50% 100%}
.object-gauge-cap{position:absolute;left:50%;top:50%;width:10px;height:10px;background:#f8fafc;border-radius:50%;transform:translate(-50%,-50%)}
.object-tabview{flex-direction:column;gap:10px;padding:10px}
.object-tabview-tabs{display:flex;flex-wrap:wrap;gap:6px;width:100%}
.object-tabview-panel{width:100%;flex:1;border:1px solid #334155;border-radius:10px;background:rgba(15,23,42,.25)}
.object-tab-pill{display:inline-flex;align-items:center;justify-content:center;padding:4px 10px;border-radius:999px;border:1px solid #475569;background:rgba(15,23,42,.45);font-size:11px}
.object-tab-pill.is-active{background:#2563eb;border-color:#1d4ed8;color:#fff}
.object-cpicker-scale{width:100%;height:100%;border-radius:inherit}
.object-cpicker.is-circular .object-cpicker-scale{border-radius:50%}
.object-cpicker-inner{position:absolute;width:42%;height:42%;border-radius:50%;border:2px solid rgba(255,255,255,.9);box-shadow:0 2px 8px rgba(15,23,42,.35)}
.object-spinner-ring{width:70%;height:70%;border-radius:50%;border:6px solid #334155;border-top-color:#38bdf8}
.object-led{width:65%;height:65%;border-radius:50%;box-shadow:0 0 18px currentColor, 0 0 32px rgba(34,197,94,.35)}
.object-btnmatrix{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:8px}
.object-btnmatrix-cell{display:flex;align-items:center;justify-content:center;border:1px solid #475569;border-radius:8px;padding:6px;background:rgba(15,23,42,.35);font-size:11px;text-align:center}
.object-btnmatrix-cell.is-active{background:#2563eb;border-color:#1d4ed8;color:#fff}
.object-msgbox{flex-direction:column;justify-content:space-between;padding:10px;gap:10px}
.object-msgbox-text{width:100%;font-size:12px;line-height:1.35;text-align:center}
.object-msgbox-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;width:100%}
.object-msgbox-btn{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;background:#2563eb;color:#fff;font-size:11px}
.object-qrcode{padding:0;background:transparent;color:inherit;pointer-events:none;align-items:center;justify-content:center}
.object-qrcode *{pointer-events:none}
.object-qrcode-frame{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:0;background:transparent}
.object-qrcode-frame svg{display:block;width:100%;height:100%}
.hint{color:var(--muted);font-size:12px;margin-top:8px;line-height:1.4}
.asset-actions{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}
.asset-list{display:flex;flex-direction:column;gap:6px;max-height:260px;overflow:auto}
.asset-item{padding:8px;border:1px solid var(--border);border-radius:8px;background:#0b1220;cursor:pointer;font-size:12px;line-height:1.35;display:grid;grid-template-columns:48px minmax(0,1fr);gap:8px;align-items:center}
.asset-item.active{outline:2px solid var(--accent)}
.asset-thumb{width:48px;height:40px;border-radius:6px;overflow:hidden;background:#020617;border:1px solid var(--border)}
.asset-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.asset-name{font-weight:600;font-size:13px}
.asset-path{color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;word-break:break-all}
.asset-actions-inline{grid-column:1 / -1;display:flex;gap:6px;flex-wrap:wrap}
.import-editor-shell{display:grid;grid-template-columns:72px minmax(0,1fr);border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#020617;flex:0 0 auto}
.import-editor-mount{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#020617;flex:0 0 auto}
.import-line-gutter{background:#0b1220;border-right:1px solid var(--border);overflow:hidden;padding:10px 0}
.import-line-gutter-content{will-change:transform}
.import-line-row{display:grid;grid-template-columns:18px 1fr;align-items:center;gap:8px;padding:0 10px;height:22px;font:12px/22px ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--muted);width:100%;border:0;background:transparent;border-radius:0;cursor:pointer;text-align:left}
.import-line-row:hover,.import-line-row.is-active{background:rgba(56,189,248,.12)}
.import-line-marker{width:10px;height:10px;border-radius:999px;background:#334155;display:block}
.import-line-row.ok .import-line-marker{background:#16a34a}
.import-line-row.warn .import-line-marker{background:#f59e0b}
.import-line-row.error .import-line-marker{background:#ef4444}
.import-line-row.empty .import-line-marker{background:transparent}
.import-line-row.empty .import-line-number{visibility:hidden}
.import-line-number{justify-self:end}
.import-editor-area{display:block;width:100%;min-height:min(60vh,560px);resize:none;border:0;border-radius:0;background:#020617;color:#cbd5e1;padding:10px 12px;font:12px/22px ui-monospace,SFMono-Regular,Menlo,monospace;tab-size:2;overflow-y:hidden;overflow-x:auto;white-space:pre;word-break:normal;scrollbar-gutter:stable both-edges}
.import-copy-fallback{width:100%;min-height:180px;resize:vertical;border:1px solid var(--border);background:#020617;color:#cbd5e1;border-radius:10px;padding:10px;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace}
.import-collapsible{flex:0 0 auto}
.import-collapsible-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.import-collapsible-head strong{margin:0}
.import-collapsible-body{margin-top:10px;max-height:240px;overflow:auto}
.ha-entity-list{display:flex;flex-direction:column;gap:6px;max-height:220px;overflow:auto;margin-top:10px}
.ha-entity-item{padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:#0b1220;font-size:12px;line-height:1.4}
.ha-entity-item strong{display:block;font-size:13px;margin-bottom:2px}
.ha-entity-item.active{border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.24) inset}
.filter-chip-row{display:flex;gap:8px;flex-wrap:wrap}
.filter-chip{padding:6px 10px;font-size:12px}
.binding-panel{padding:12px;border:1px solid var(--border);border-radius:12px;background:#0b1220}
.binding-summary{grid-column:1 / -1;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#0b1220;font-size:12px;line-height:1.45}
.binding-chip{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;background:rgba(56,189,248,.14);border:1px solid rgba(56,189,248,.25);margin-right:6px;margin-bottom:6px;color:#bae6fd}
.ha-binding-grid{display:grid;grid-template-columns:1fr;gap:10px}
.ha-binding-card{padding:12px;border:1px solid var(--border);border-radius:12px;background:#020617}
.ha-binding-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.ha-binding-card-title{font-weight:700}
.ha-binding-card-hint{font-size:12px;line-height:1.45;color:var(--muted);margin-top:4px}
.ha-binding-card-current{margin-top:10px;padding:9px 10px;border-radius:10px;background:#0b1220;border:1px solid rgba(148,163,184,.18);font-size:12px;line-height:1.4;word-break:break-word}
.ha-binding-modal-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(320px,.95fr);gap:16px;align-items:start}
.ha-binding-modal-main,.ha-binding-modal-side{display:flex;flex-direction:column;gap:12px;min-height:0}
.ha-binding-preview{padding:12px;border:1px solid var(--border);border-radius:12px;background:#020617}
.ha-binding-preview-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px;font-size:12px;color:var(--muted)}
.ha-binding-preview-stage{display:flex;align-items:center;justify-content:center;min-height:160px;padding:16px;border-radius:12px;border:1px dashed rgba(148,163,184,.24);background:linear-gradient(180deg,rgba(15,23,42,.9),rgba(2,6,23,.9))}
.ha-binding-preview-object{position:relative !important;left:auto !important;top:auto !important;flex:0 0 auto;box-shadow:0 14px 30px rgba(0,0,0,.28);overflow:hidden}
.publish-layout{display:grid;grid-template-columns:minmax(320px,.9fr) minmax(0,1.4fr);gap:16px;align-items:start}
.publish-assets-panel,.publish-preview-panel{display:flex;flex-direction:column;gap:10px;min-height:0}
.publish-asset-list{display:flex;flex-direction:column;gap:8px;max-height:min(58vh,620px);overflow:auto}
.publish-asset-item{display:grid;grid-template-columns:56px minmax(0,1fr);gap:10px;align-items:start;padding:10px;border:1px solid var(--border);border-radius:12px;background:#0b1220}
.publish-asset-thumb{width:56px;height:48px;border-radius:8px;overflow:hidden;background:#020617;border:1px solid var(--border);display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:11px}
.publish-asset-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.publish-asset-meta{display:flex;flex-direction:column;gap:8px;min-width:0}
.publish-asset-name{font-weight:700;font-size:13px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.publish-asset-path{font-size:12px;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;word-break:break-all}
.publish-preview-pages{display:flex;gap:8px;flex-wrap:wrap}
.publish-preview-page-btn{padding:6px 10px;font-size:12px}
.publish-preview-page-btn.is-active{border-color:#38bdf8;box-shadow:0 0 0 1px rgba(56,189,248,.28) inset;color:#bae6fd}
.publish-svg-shell{display:flex;align-items:center;justify-content:center;min-height:220px;padding:12px;border:1px solid var(--border);border-radius:12px;background:linear-gradient(180deg,#111827,#020617);overflow:auto}
.publish-preview-viewport{position:relative;display:block;flex:0 0 auto}
.publish-preview-stage{position:relative;display:block;border-radius:10px;box-shadow:0 18px 34px rgba(0,0,0,.34);background:#0f172a;overflow:hidden;transform-origin:top left;flex:0 0 auto}
.publish-preview-object{position:absolute;box-sizing:border-box;user-select:none}
.publish-preview-area{min-height:min(58vh,620px);height:min(58vh,620px);resize:vertical;overflow:auto}
.publish-settings-grid #publishDescription{min-height:84px;height:84px;max-height:84px;resize:none}
.publish-report-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px}
.publish-report-item{padding:8px 10px;border-radius:10px;background:#020617;border:1px solid rgba(148,163,184,.16);font-size:12px}
.publish-report-item strong{display:block;color:#e2e8f0;margin-bottom:2px}
.publish-index-entry{padding:10px 12px;border-radius:10px;background:#020617;border:1px solid rgba(148,163,184,.16);font-size:12px;line-height:1.5;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-word}
.gallery-package-list{display:flex;flex-direction:column;gap:8px;max-height:min(58vh,620px);overflow:auto}
.gallery-package-item{padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:#0b1220;display:flex;flex-direction:column;gap:8px}
.gallery-package-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.gallery-package-title{font-weight:700}
.gallery-package-meta{font-size:12px;color:var(--muted);line-height:1.45}
.gallery-package-actions{display:flex;gap:8px;flex-wrap:wrap}
.gallery-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;background:rgba(56,189,248,.12);border:1px solid rgba(56,189,248,.28);color:#bae6fd}
.gallery-submission-row{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.gallery-submission-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:700;border:1px solid rgba(148,163,184,.24)}
.gallery-submission-none{background:rgba(148,163,184,.08);color:#cbd5e1}
.gallery-submission-pending{background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.28);color:#fde68a}
.gallery-submission-duplicate{background:rgba(56,189,248,.12);border-color:rgba(56,189,248,.28);color:#bae6fd}
.gallery-submission-failed{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.28);color:#fecaca}
.action-view[data-action-panel='gallery'] .gallery-package-list{max-height:min(28vh,320px)}
.selection-box{position:absolute;border:1px dashed var(--accent);background:rgba(56,189,248,.08);pointer-events:none;z-index:100}
.guide{position:absolute;pointer-events:none;z-index:90;background:rgba(34,197,94,.8)}
.guide-x{width:1px;top:0;bottom:0}
.guide-y{height:1px;left:0;right:0}
.minimap{height:120px;border:1px solid var(--border);border-radius:12px;background:#0b1220;position:relative;overflow:hidden;flex:0 0 auto}
.minimap-stage{position:absolute;border:1px solid rgba(148,163,184,.4);background:white}
.minimap-obj{position:absolute;background:rgba(56,189,248,.45);border:1px solid rgba(56,189,248,.75)}
.minimap-obj.sel{background:rgba(34,197,94,.55);border-color:rgba(34,197,94,.95)}
.validation-item{padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#0b1220;font-size:12px;line-height:1.4;margin-bottom:8px}
.validation-item.warn{border-color:#92400e;background:#1c1917}
.validation-item.error{border-color:#7f1d1d;background:#1f1113}
.validation-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;cursor:pointer}
.validation-title{font-weight:600}
.validation-badge{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.validation-meta{display:none;margin-top:8px;padding-top:8px;border-top:1px solid rgba(148,163,184,.18);color:#cbd5e1}
.validation-item.is-open .validation-meta{display:block}
.validation-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.validation-actions button{padding:6px 10px;font-size:12px}
.validation-editor{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;margin-top:10px}
.validation-editor label{align-items:flex-start;flex-direction:column;font-size:12px}
.validation-editor input{width:100%}
.validation-editor button{align-self:end}
.import-option{justify-content:flex-start;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#0b1220}
.import-option input[type="checkbox"]{margin:0}
.import-issue-summary{display:flex;gap:10px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.import-issue-summary strong{color:var(--text)}
.import-line-detail-content{display:flex;flex-direction:column;gap:8px}
.spacer-xs{height:8px}
.import-line-detail-entry{padding:8px 10px;border:1px solid rgba(148,163,184,.18);border-radius:8px;background:#020617}
.import-line-detail-entry.ok{border-color:#14532d;background:#052e16}
.import-line-detail-entry.warn{border-color:#92400e;background:#1c1917}
.import-line-detail-entry.error{border-color:#7f1d1d;background:#1f1113}
.property-inline-actions{display:flex;justify-content:flex-end}
.property-text-preview{padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#0b1220}
.property-text-preview-label{font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#93c5fd;margin-bottom:8px}
.property-text-preview-body{min-height:32px;display:flex;white-space:pre-wrap;word-break:break-word}
.icon-picker-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.icon-picker-item{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:10px 12px;text-align:left}
.icon-picker-preview{font-size:24px;line-height:1}
.material-symbols-outlined{font-family:"Material Symbols Outlined";font-weight:normal;font-style:normal;font-size:1em;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased}
.ohd-symbol{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;min-width:1em}
.icon-picker-label{font-weight:600}
.icon-picker-code{font-size:12px;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.section-title{grid-column:1 / -1;color:#93c5fd;font-weight:700;font-size:12px;text-transform:uppercase;letter-spacing:.04em;margin-top:8px}
code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.zoom-controls{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center;margin-top:8px}
.zoom-controls button{padding:8px 12px;font-weight:700}
#zoomMode{width:100%}
.object-line-svg{display:block;width:100%;height:100%;overflow:visible}
.column-resizer{width:8px;cursor:col-resize;background:transparent;border-radius:8px;position:relative}
.column-resizer:hover,.column-resizer.active{background:rgba(56,189,248,.18)}
.column-resizer::after{content:"";position:absolute;left:3px;top:10px;bottom:10px;width:2px;background:rgba(148,163,184,.35);border-radius:999px}
.middle-right,.right{min-width:0}
#resetViewBtn{width:100%;margin-top:10px}
.top-gap{margin-top:10px}
.mqtt-grid label{align-items:flex-start;flex-direction:column}
.mqtt-broker-row{display:grid;grid-template-columns:auto minmax(0,1fr) 92px;gap:8px;width:100%;align-items:center}
.mqtt-broker-prefix{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:0 10px;border:1px solid var(--border);border-radius:8px;background:#0b1220;color:var(--muted);white-space:nowrap}
.mqtt-broker-row input{width:100%}
.ha-inline-toggle{display:flex;align-items:center;justify-content:space-between;gap:12px}
.ha-inline-toggle span{font-weight:600}
@media (max-width: 1100px){
  .publish-layout{grid-template-columns:1fr}
  .ha-binding-modal-grid{grid-template-columns:1fr}
}
.color-field{align-items:flex-start;flex-direction:column}
.sidebar.left .mqtt-grid label:not(.full),
.left-properties-shell .mqtt-grid label:not(.full){display:grid;grid-template-columns:minmax(110px,42%) minmax(0,1fr);align-items:center;justify-content:stretch;gap:10px}
.color-input-row{display:grid;grid-template-columns:minmax(0,1fr) 52px;gap:8px;width:100%}
.color-input-row input[type="color"]{padding:2px;height:38px}
@media (max-width:1450px){.four-col{--col1:320px;--col4:308px}}
@media (max-width:1200px){.four-col{--col1:280px;--col4:264px}}
@media (max-width:1080px){
  html,body{overflow:auto}
  #app{height:auto;min-height:100vh}
  .main{overflow:visible}
  .four-col{grid-template-columns:minmax(0,1fr);grid-auto-rows:auto}
  .column-resizer{display:none}
  .sidebar,.workspace-wrap{overflow:visible}
  .properties-content{min-height:240px}
  .action-panel-shell{flex:0 0 auto}
  .modal-dialog{margin:4vh 12px 0 12px;max-width:none}
}
@media (max-width:720px){
  .topbar{align-items:flex-start}
  .toolbar{width:100%;justify-content:flex-start}
  .toolbar-group{width:100%;padding-left:0;border-left:0}
  .palette,.template-list,.property-grid{grid-template-columns:1fr}
  .asset-item{grid-template-columns:56px minmax(0,1fr)}
  .asset-actions-inline{grid-column:1 / -1;flex-direction:row}
  .layer-item{flex-direction:column}
  .layer-actions{justify-content:flex-start}
}


.properties-content,
.layer-list.grow{
  padding-right: 12px;
  scrollbar-gutter: stable;
}


.guide{
  position:absolute;
  pointer-events:none;
  z-index:90;
  background:rgba(34,197,94,.95);
  box-shadow:0 0 0 1px rgba(34,197,94,.18), 0 0 8px rgba(34,197,94,.25);
}
.guide::after{
  content:attr(data-label);
  position:absolute;
  font:600 10px/1 Inter,system-ui,sans-serif;
  color:#052e16;
  background:rgba(187,247,208,.96);
  border:1px solid rgba(34,197,94,.55);
  border-radius:999px;
  padding:2px 6px;
  white-space:nowrap;
}
.guide-x::after{
  top:-10px;
  left:6px;
}
.guide-y::after{
  top:6px;
  left:-10px;
}


.bottom-actions{
  margin-bottom:2px;
}
.nudge-grid{
  display:grid;
  grid-template-columns:repeat(3, 44px);
  grid-template-rows:repeat(2, 36px);
  gap:8px;
  justify-content:start;
  align-content:start;
}
.nudge-grid button{
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.nudge-grid button[data-nudge="up"]{ grid-column:2; grid-row:1; }
.nudge-grid button[data-nudge="left"]{ grid-column:1; grid-row:2; }
.nudge-grid button[data-nudge="right"]{ grid-column:3; grid-row:2; }
.nudge-grid button[data-nudge="down"]{ grid-column:2; grid-row:2; }


.asset-list,
.asset-item{
  min-width: 0;
}
.asset-item{
  display:grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap:10px;
  align-items:center;
}
.asset-item .asset-name,
.asset-name,
.asset-path{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.asset-meta{
  min-width:0;
  overflow:hidden;
}

.modal-body textarea:not(.import-editor-area):not(.publish-preview-area){
  min-height:min(60vh,560px);
}


.mqtt-infobox{
  margin-top:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#0b1220;
  font-size:12px;
  line-height:1.45;
}
.mqtt-infobox strong{
  display:block;
  margin-bottom:4px;
  color:var(--text);
}
.mqtt-infobox a{
  color:#93c5fd;
  text-decoration:underline;
}
.mqtt-infobox a:hover{
  color:#bfdbfe;
}
.mqtt-infobox.ok{ border-color:#14532d; background:#052e16; color:#d1fae5; }
.mqtt-infobox.warn{ border-color:#7c2d12; background:#431407; color:#ffedd5; }
.mqtt-infobox.info{ border-color:#334155; background:#0b1220; color:#cbd5e1; }

button:disabled{
  opacity:.5;
  cursor:not-allowed;
}
button:disabled:hover{
  background:#0f172a;
}
