/* Theme Builder — Admin UI */
.tb-dashboard { max-width:900px; }
.tb-header { margin-bottom:1.5rem; } .tb-header h2 { margin:0 0 .25rem; } .tb-header .muted { color:var(--adam-muted,#64748b); }
.tb-header-row { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.tb-flash { padding:.75rem 1rem; border-radius:8px; margin-bottom:1rem; font-size:.9rem; }
.tb-flash-success { background:#dcfce7; color:#166534; border:1px solid #bbf7d0; }
.tb-flash-error { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; }
.tb-create { background:var(--adam-card,#fff); border:1px solid var(--adam-border,#e2e8f0); border-radius:12px; padding:1.25rem; margin-bottom:1.5rem; }
.tb-create h3 { margin:0 0 1rem; font-size:1.1rem; }
.tb-form .tb-form-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin-bottom:.75rem; }
.tb-field { margin-bottom:.75rem; } .tb-field label { display:block; font-weight:600; font-size:.85rem; margin-bottom:.25rem; }
.tb-field input,.tb-field select,.tb-field textarea { width:100%; padding:.5rem .75rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:8px; font-size:.9rem; background:var(--adam-bg,#fff); color:var(--adam-text,#0b1220); }
.tb-field small { color:var(--adam-muted,#64748b); font-size:.75rem; }
.tb-themes h3 { margin:0 0 1rem; }
.tb-theme-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:1rem; }
.tb-theme-card { background:var(--adam-card,#fff); border:1px solid var(--adam-border,#e2e8f0); border-radius:12px; padding:1rem; }
.tb-theme-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.5rem; }
.tb-theme-card-header h4 { margin:0; font-size:1rem; } .tb-version { font-size:.75rem; color:var(--adam-muted,#64748b); }
.tb-theme-desc { font-size:.85rem; color:var(--adam-muted,#64748b); margin:0 0 .75rem; }
.tb-theme-meta { display:flex; gap:.5rem; margin-bottom:.75rem; flex-wrap:wrap; }
.tb-badge { display:inline-block; padding:.15rem .5rem; border-radius:999px; font-size:.7rem; font-weight:600; }
.tb-badge-both { background:#dbeafe; color:#1e40af; } .tb-badge-light { background:#fef9c3; color:#854d0e; } .tb-badge-dark { background:#1e293b; color:#e2e8f0; }
.tb-files { font-size:.75rem; color:var(--adam-muted,#64748b); } .tb-status { font-size:.75rem; font-weight:600; }
.tb-complete { color:#166534; } .tb-incomplete { color:#b45309; }
.tb-theme-actions { display:flex; gap:.35rem; flex-wrap:wrap; }
.tb-export-form { display:inline-flex; margin:0; }
.btn { display:inline-block; padding:.4rem .8rem; border-radius:8px; font-size:.85rem; font-weight:600; cursor:pointer; border:1px solid transparent; text-decoration:none; text-align:center; }
.btn-primary { background:var(--adam-accent,#00A89E); color:#fff; border-color:var(--adam-accent,#00A89E); }
.tb-dashboard .btn-primary,.tb-editor .btn-primary,.tb-installed .btn-primary { background:var(--adam-primary-gradient,var(--adam-accent,#00A89E)); color:#fff; border-color:transparent; box-shadow:0 5px 14px rgba(185,28,28,.16); transition:background .15s ease,box-shadow .15s ease,transform .15s ease; }
.tb-dashboard .btn-primary:hover,.tb-editor .btn-primary:hover,.tb-installed .btn-primary:hover { background:var(--adam-primary-gradient-hover,#991b1b); color:#fff; opacity:1; transform:translateY(-1px); box-shadow:0 8px 18px rgba(185,28,28,.24); }
.tb-dashboard .btn-primary:focus-visible,.tb-editor .btn-primary:focus-visible,.tb-installed .btn-primary:focus-visible { outline:3px solid var(--adam-focus,rgba(220,38,38,.22)); outline-offset:2px; }
.btn-outline { background:transparent; color:var(--adam-text,#0b1220); border-color:var(--adam-border,#e2e8f0); } .btn-outline:hover { background:var(--adam-surface,#f8fafc); }
.btn-danger { background:#fee2e2; color:#991b1b; border-color:#fecaca; } .btn-danger:hover { background:#fecaca; }
.btn-sm { padding:.25rem .6rem; font-size:.8rem; } .btn:disabled { opacity:.5; cursor:not-allowed; }
.badge { display:inline-block; padding:.1rem .4rem; background:var(--adam-accent,#00A89E); color:#fff; border-radius:999px; font-size:.7rem; font-weight:700; }
.tb-editor { display:flex; flex-direction:column; height:calc(100vh - 120px); }
.tb-editor-topbar { display:flex; align-items:center; gap:1rem; padding:.5rem 0; border-bottom:1px solid var(--adam-border,#e2e8f0); margin-bottom:.5rem; }
.tb-editor-topbar h3 { margin:0; flex:1; font-size:1rem; } .tb-editor-actions { display:flex; gap:.35rem; }
.tb-editor-main { display:grid; grid-template-columns:200px 1fr 280px; gap:.5rem; flex:1; min-height:0; transition:grid-template-columns .2s ease; position:relative; }
.tb-editor-main.slots-collapsed { grid-template-columns:0px 1fr 280px; }
.tb-editor-main.vars-collapsed { grid-template-columns:200px 1fr 0px; }
.tb-editor-main.slots-collapsed.vars-collapsed { grid-template-columns:0px 1fr 0px; }
.tb-editor-main.both-collapsed { grid-template-columns:0px 1fr 0px; }
.tb-editor-sidebar { overflow-y:auto; overflow-x:hidden; border-right:1px solid var(--adam-border,#e2e8f0); padding-right:.5rem; transition:opacity .2s ease,padding .2s ease; }
.slots-collapsed .tb-editor-sidebar { opacity:0; padding:0; pointer-events:none; width:0; overflow:hidden; }
.tb-sidebar-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:.35rem; }
.tb-sidebar-header h4 { margin:0; }
.tb-collapse-btn { background:none; border:none; cursor:pointer; font-size:1rem; color:var(--adam-muted,#64748b); padding:.1rem .3rem; border-radius:4px; line-height:1; }
.tb-collapse-btn:hover { background:var(--adam-surface,#f8fafc); color:var(--adam-text,#0b1220); }
.tb-sidebar-section h4 { font-size:.8rem; text-transform:uppercase; color:var(--adam-muted,#64748b); margin:0 0 .5rem; }
.tb-slot-list { list-style:none; margin:0; padding:0; } .tb-slot-list li { margin-bottom:2px; }
.tb-slot-link { display:flex; align-items:center; gap:.4rem; padding:.35rem .5rem; border-radius:6px; font-size:.85rem; color:var(--adam-text,#0b1220); text-decoration:none; }
.tb-slot-link:hover { background:var(--adam-surface,#f8fafc); } .tb-slot-link.active { background:var(--adam-accent,#00A89E); color:#fff; }
.tb-slot-link.done .tb-slot-status { color:#22c55e; } .tb-slot-link.active.done .tb-slot-status { color:#bbf7d0; } .tb-slot-status { font-size:.7rem; }
.tb-editor-code { display:flex; flex-direction:column; min-height:0; transition:flex .2s ease; }

/* Floating restore buttons for collapsed panels */
.tb-restore-btn { position:absolute; top:50%; transform:translateY(-50%); z-index:10; background:var(--adam-card,#fff); border:1px solid var(--adam-border,#e2e8f0); padding:.5rem .3rem; cursor:pointer; font-size:.9rem; color:var(--adam-accent,#00A89E); display:none; writing-mode:vertical-rl; letter-spacing:.1em; box-shadow:2px 0 8px rgba(0,0,0,.1); line-height:1; width:fit-content; }
.tb-restore-slots { left:0; border-radius:0 6px 6px 0; border-left:none; }
.tb-restore-vars { right:0; border-radius:6px 0 0 6px; border-right:none; box-shadow:-2px 0 8px rgba(0,0,0,.1); }
.slots-collapsed .tb-restore-slots { display:block; }
.vars-collapsed .tb-restore-vars { display:block; }
.tb-restore-btn:hover { background:var(--adam-accent,#00A89E); color:#fff; }
.tb-code-header { display:flex; justify-content:space-between; align-items:center; padding:.35rem .5rem; background:var(--adam-surface,#f8fafc); border:1px solid var(--adam-border,#e2e8f0); border-bottom:none; border-radius:8px 8px 0 0; font-size:.8rem; }
.tb-code-file { font-family:monospace; color:var(--adam-muted,#64748b); } .tb-code-slot { font-weight:600; }
.tb-editor-code .CodeMirror { border:1px solid var(--adam-border,#e2e8f0); border-radius:0 0 8px 8px; flex:1; }
.tb-editor-ref { overflow-y:auto; overflow-x:hidden; border-left:1px solid var(--adam-border,#e2e8f0); padding-left:.5rem; font-size:.8rem; transition:opacity .2s ease,padding .2s ease; }
.vars-collapsed .tb-editor-ref { opacity:0; padding:0; pointer-events:none; width:0; overflow:hidden; }
.tb-ref-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:.35rem; }
.tb-ref-header h4 { margin:0; }
.tb-editor-ref h4 { font-size:.8rem; text-transform:uppercase; color:var(--adam-muted,#64748b); margin:0 0 .5rem; display:none; }
.tb-ref-header h4 { display:block; }
.tb-var-ref h4 { margin-top:1rem; } .tb-var-list { list-style:none; margin:0; padding:0; } .tb-var-list li { padding:.35rem 0; border-bottom:1px solid var(--adam-border,#f1f5f9); }
.tb-var-list code { background:var(--adam-surface,#f1f5f9); padding:.1rem .3rem; border-radius:4px; font-size:.75rem; }
.tb-var-type { font-size:.7rem; color:var(--adam-accent,#00A89E); font-weight:600; } .tb-var-list small { color:var(--adam-muted,#64748b); font-size:.7rem; }
.tb-preview-panel { position:fixed; bottom:0; left:0; right:0; height:50vh; background:var(--adam-bg,#fff); border-top:2px solid var(--adam-accent,#00A89E); z-index:1000; display:flex; flex-direction:column; box-shadow:0 -4px 20px rgba(0,0,0,.15); }
.tb-preview-header { display:flex; justify-content:space-between; align-items:center; padding:.5rem 1rem; border-bottom:1px solid var(--adam-border,#e2e8f0); } .tb-preview-header h4 { margin:0; }
.tb-preview-controls { display:flex; gap:.35rem; align-items:center; } .tb-preview-controls select { padding:.25rem .5rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:6px; font-size:.8rem; }
.tb-preview-frame { flex:1; border:none; width:100%; transition:width .2s ease, max-width .2s ease; }
.tb-preview-frame.vt-desktop { width:100%; max-width:100%; }
.tb-preview-frame.vt-tablet { width:768px; max-width:100%; margin:0 auto; }
.tb-preview-frame.vt-mobile { width:375px; max-width:100%; margin:0 auto; }
.tb-viewport-btns { display:flex; gap:0; border:1px solid var(--adam-border,#e2e8f0); border-radius:6px; overflow:hidden; }
.tb-viewport-btn { padding:.25rem .6rem; font-size:.75rem; font-weight:600; border:none; border-right:1px solid var(--adam-border,#e2e8f0); background:transparent; cursor:pointer; color:var(--adam-text,#0b1220); }
.tb-viewport-btn:last-child { border-right:none; }
.tb-viewport-btn.active { background:var(--adam-accent,#00A89E); color:#fff; }
.tb-viewport-btn:hover:not(.active) { background:var(--adam-surface,#f8fafc); }
.tb-modal { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; z-index:2000; }
.tb-modal-content { background:var(--adam-bg,#fff); border-radius:12px; width:90%; max-width:600px; max-height:80vh; display:flex; flex-direction:column; }
.tb-modal-wide { max-width:900px; }
.tb-modal-header { display:flex; justify-content:space-between; align-items:center; padding:1rem; border-bottom:1px solid var(--adam-border,#e2e8f0); } .tb-modal-header h4 { margin:0; }
.tb-modal-close { background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--adam-muted,#64748b); }
.tb-modal-body { padding:1rem; overflow-y:auto; flex:1; } .tb-modal-footer { padding:1rem; border-top:1px solid var(--adam-border,#e2e8f0); display:flex; gap:.5rem; justify-content:flex-end; }
.tb-asset-tabs { display:flex; gap:.25rem; margin-bottom:.5rem; }
.tb-asset-tab { padding:.35rem .75rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:6px; background:transparent; cursor:pointer; font-size:.8rem; font-family:monospace; }
.tb-asset-tab.active { background:var(--adam-accent,#00A89E); color:#fff; border-color:var(--adam-accent,#00A89E); }

/* Installed theme inspector */
.tb-installed { display:flex; flex-direction:column; min-height:calc(100vh - 120px); }
.tb-installed-list { max-width:1100px; }
.tb-installed-topbar { margin-bottom:.75rem; }
.tb-installed-title { flex:1; min-width:0; }
.tb-installed-title h3 { margin:0 0 .15rem; }
.tb-installed-title code { color:var(--adam-muted,#64748b); font-size:.75rem; }
.tb-inspector-notice { padding:.65rem .8rem; margin-bottom:.75rem; border:1px solid #bae6fd; border-radius:8px; background:#f0f9ff; color:#0c4a6e; font-size:.82rem; }
.tb-inspector-notice.is-editable { border-color:#86efac; background:#f0fdf4; color:#14532d; }
.tb-inspector-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.5rem; margin-bottom:.75rem; }
.tb-inspector-stats div { padding:.65rem .8rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:8px; background:var(--adam-card,#fff); }
.tb-inspector-stats strong { display:block; font-size:1.15rem; }
.tb-inspector-stats span { color:var(--adam-muted,#64748b); font-size:.72rem; text-transform:uppercase; letter-spacing:.04em; }
.tb-owner-map { margin-bottom:.75rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:10px; background:var(--adam-card,#fff); overflow:hidden; }
.tb-owner-map-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; padding:.8rem .9rem; border-bottom:1px solid var(--adam-border,#e2e8f0); }
.tb-owner-map-heading h4 { margin:0; font-size:.9rem; }
.tb-owner-map-heading p { margin:.2rem 0 0; color:var(--adam-muted,#64748b); font-size:.75rem; }
.tb-owner-map-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.tb-owner-card { min-width:0; padding:.85rem .9rem; }
.tb-owner-card + .tb-owner-card { border-left:1px solid var(--adam-border,#e2e8f0); }
.tb-owner-card > header { display:flex; align-items:center; justify-content:space-between; gap:.75rem; margin-bottom:.65rem; }
.tb-owner-card > header span { display:block; color:var(--adam-muted,#64748b); font-size:.65rem; text-transform:uppercase; letter-spacing:.06em; }
.tb-owner-card > header h5 { margin:.15rem 0 0; font-size:.82rem; }
.tb-owner-card > header > strong { font-size:1.25rem; }
.tb-owner-list { display:grid; gap:.5rem; max-height:360px; overflow:auto; padding-right:.2rem; }
.tb-owner-item { padding:.6rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:7px; background:var(--adam-surface,#f8fafc); }
.tb-owner-item-title { display:flex; align-items:baseline; justify-content:space-between; gap:.6rem; min-width:0; }
.tb-owner-item-title a { color:var(--adam-accent,#00A89E); text-decoration:none; }
.tb-owner-item-title strong { font-size:.78rem; }
.tb-owner-item-title code { max-width:55%; overflow:hidden; color:var(--adam-muted,#64748b); font-size:.65rem; text-overflow:ellipsis; white-space:nowrap; }
.tb-owner-meta { display:flex; flex-wrap:wrap; gap:.3rem .65rem; margin-top:.3rem; color:var(--adam-muted,#64748b); font-size:.67rem; }
.tb-owner-actions { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:.5rem; }
.tb-owner-empty,.tb-owner-note { margin:.5rem 0 0; color:var(--adam-muted,#64748b); font-size:.7rem; }
.tb-owner-dependencies { display:grid; gap:.25rem; margin-top:.45rem; }
.tb-owner-dependencies a { display:flex; justify-content:space-between; gap:.5rem; color:var(--adam-accent,#00A89E); font-size:.68rem; text-decoration:none; }
.tb-owner-dependencies span { overflow-wrap:anywhere; }
.tb-owner-dependencies small { flex:none; color:var(--adam-muted,#64748b); }
.tb-inspector-main { display:grid; grid-template-columns:240px minmax(0,1fr) 230px; min-height:520px; border:1px solid var(--adam-border,#e2e8f0); border-radius:10px; overflow:hidden; background:var(--adam-card,#fff); }
.tb-inspector-files,.tb-inspector-details { min-width:0; overflow:auto; padding:.75rem; background:var(--adam-surface,#f8fafc); }
.tb-inspector-files { border-right:1px solid var(--adam-border,#e2e8f0); }
.tb-inspector-details { border-left:1px solid var(--adam-border,#e2e8f0); font-size:.78rem; }
.tb-inspector-files section + section { margin-top:1rem; }
.tb-inspector-files h4,.tb-inspector-details h4 { margin:0 0 .45rem; color:var(--adam-muted,#64748b); font-size:.68rem; text-transform:uppercase; letter-spacing:.06em; }
.tb-inspector-files h4 span { float:right; }
.tb-inspector-files ul,.tb-dependency-list { margin:0; padding:0; list-style:none; }
.tb-inspector-files li { margin-bottom:2px; }
.tb-inspector-files a { display:block; padding:.35rem .45rem; border-radius:6px; color:var(--adam-text,#0b1220); text-decoration:none; overflow:hidden; }
.tb-inspector-files a:hover { background:var(--adam-hover,#e2e8f0); }
.tb-inspector-files a.active { background:var(--adam-accent,#00A89E); color:#fff; }
.tb-inspector-files a span,.tb-inspector-files a small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tb-inspector-files a span { font:600 .77rem ui-monospace,SFMono-Regular,Menlo,monospace; }
.tb-inspector-files a small { margin-top:.1rem; color:var(--adam-muted,#64748b); font-size:.65rem; }
.tb-inspector-files a.active small { color:rgba(255,255,255,.75); }
.tb-inspector-source { min-width:0; display:flex; flex-direction:column; background:#fff; }
.tb-inspector-source .tb-code-header { border:0; border-bottom:1px solid var(--adam-border,#e2e8f0); border-radius:0; }
.tb-inspector-source .CodeMirror { flex:1; font-size:.82rem; }
.tb-inspector-details dl { display:grid; grid-template-columns:auto 1fr; gap:.3rem .65rem; margin:0 0 1rem; }
.tb-inspector-details dt { color:var(--adam-muted,#64748b); }
.tb-inspector-details dd { margin:0; overflow-wrap:anywhere; }
.tb-inspector-details h4:not(:first-child) { margin-top:1rem; }
.tb-inspector-hash { display:block; overflow-wrap:anywhere; font-size:.68rem; }
.tb-dependency-list li + li { margin-top:.3rem; }
.tb-dependency-list a { color:var(--adam-accent,#00A89E); overflow-wrap:anywhere; }
.tb-inspector-badge { display:inline-block; padding:.15rem .45rem; border-radius:999px; font-size:.68rem; font-weight:700; }
.tb-inspector-badge.is-active { background:#dcfce7; color:#166534; }
.tb-inspector-badge.is-system { background:#e0e7ff; color:#3730a3; }
.tb-inspector-badge.is-store { background:#fef3c7; color:#92400e; }
.tb-inspector-badge.is-fork { background:#ede9fe; color:#5b21b6; }
.tb-inspector-badge.is-dirty { background:#ffedd5; color:#9a3412; }
.tb-inspector-badge.is-clean { background:#dcfce7; color:#166534; }
.tb-inspector-badge.is-upstream { background:#fee2e2; color:#991b1b; }
.tb-risk-check { display:block; margin:.8rem 0; line-height:1.45; }
.tb-risk-check input { margin-right:.4rem; }
.tb-revision-list { list-style:none; margin:0; padding:0; display:grid; gap:.5rem; }
.tb-revision-list li { display:grid; grid-template-columns:1fr auto; gap:.15rem .5rem; align-items:center; padding:.55rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:6px; }
.tb-revision-list small { grid-column:1; color:var(--adam-text-muted,#64748b); }
.tb-revision-list .btn { grid-column:2; grid-row:1 / span 2; }
.tb-inspector-error { color:#b91c1c; font-size:.75rem; }
.tb-theme-card-error { border-color:#fecaca; }
.tb-inspector-empty { padding:2rem; border:1px dashed var(--adam-border,#e2e8f0); border-radius:10px; color:var(--adam-muted,#64748b); text-align:center; }
.tb-slot-matrix { margin-top:.75rem; border:1px solid var(--adam-border,#e2e8f0); border-radius:8px; background:var(--adam-card,#fff); }
.tb-slot-matrix summary { padding:.7rem .8rem; cursor:pointer; font-weight:600; font-size:.82rem; }
.tb-slot-matrix summary .muted { color:var(--adam-muted,#64748b); font-weight:400; }
.tb-slot-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; border-top:1px solid var(--adam-border,#e2e8f0); background:var(--adam-border,#e2e8f0); }
.tb-slot-grid > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.15rem .5rem; padding:.6rem .7rem; background:var(--adam-card,#fff); }
.tb-slot-grid code { font-size:.75rem; }
.tb-slot-grid small { grid-column:1; color:var(--adam-muted,#64748b); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tb-slot-state { grid-column:2; grid-row:1 / span 2; align-self:center; padding:.12rem .4rem; border-radius:999px; font-size:.65rem; font-weight:700; text-decoration:none; }
.tb-slot-state.is-physical { background:#dcfce7; color:#166534; }
.tb-slot-state.is-inherited { background:#e0f2fe; color:#075985; }
.tb-slot-state.is-missing { background:#fee2e2; color:#991b1b; }

/* Fold gutter */
.CodeMirror-foldmarker { color:#00A89E; text-shadow:none; font-family:inherit; }
.CodeMirror-foldgutter { width:.7em; }
.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded { cursor:pointer; }
.CodeMirror-foldgutter-open:after { content:"▾"; }
.CodeMirror-foldgutter-folded:after { content:"▸"; }

/* Dark theme */
html.theme-dark .tb-editor-sidebar,
html:not(.theme-light):not(.theme-dark) .tb-editor-sidebar { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-editor-ref,
html:not(.theme-light):not(.theme-dark) .tb-editor-ref { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-slot-link:hover,
html:not(.theme-light):not(.theme-dark) .tb-slot-link:hover { background:var(--adam-hover,rgba(255,255,255,.06)); }
html.theme-dark .tb-code-header,
html:not(.theme-light):not(.theme-dark) .tb-code-header { background:var(--adam-surface-3,#16202e); border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-editor-code .CodeMirror,
html:not(.theme-light):not(.theme-dark) .tb-editor-code .CodeMirror { border-color:var(--adam-border,#1f2a35); }
/* CodeMirror dark mode handled by JS — toggles cm-s-dracula / cm-s-light */
html.theme-dark .tb-collapse-btn,
html:not(.theme-light):not(.theme-dark) .tb-collapse-btn { color:var(--adam-muted,#9ca3af); }
html.theme-dark .tb-collapse-btn:hover,
html:not(.theme-light):not(.theme-dark) .tb-collapse-btn:hover { background:var(--adam-hover,rgba(255,255,255,.06)); color:var(--adam-text,#e6eef6); }
html.theme-dark .tb-var-list li,
html:not(.theme-light):not(.theme-dark) .tb-var-list li { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-var-list code,
html:not(.theme-light):not(.theme-dark) .tb-var-list code { background:var(--adam-surface-3,#16202e); color:var(--adam-text,#e6eef6); }
html.theme-dark .tb-var-list small,
html:not(.theme-light):not(.theme-dark) .tb-var-list small { color:var(--adam-muted,#9ca3af); }
html.theme-dark .tb-var-type,
html:not(.theme-light):not(.theme-dark) .tb-var-type { color:var(--adam-accent,#fca5a5); }
html.theme-dark .tb-field input,html.theme-dark .tb-field select,html.theme-dark .tb-field textarea,
html:not(.theme-light):not(.theme-dark) .tb-field input,html:not(.theme-light):not(.theme-dark) .tb-field select,html:not(.theme-light):not(.theme-dark) .tb-field textarea { color-scheme:dark; }
html.theme-dark .tb-preview-header,
html:not(.theme-light):not(.theme-dark) .tb-preview-header { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-preview-controls select,
html:not(.theme-light):not(.theme-dark) .tb-preview-controls select { border-color:var(--adam-border,#1f2a35); background:var(--adam-bg,#071022); color:var(--adam-text,#e6eef6); }
html.theme-dark .tb-restore-btn,
html:not(.theme-light):not(.theme-dark) .tb-restore-btn { background:var(--adam-card,#0e1620); border-color:var(--adam-border,#1f2a35); color:var(--adam-accent,#fca5a5); }
html.theme-dark .tb-restore-btn:hover,
html:not(.theme-light):not(.theme-dark) .tb-restore-btn:hover { background:var(--adam-accent,#fca5a5); color:var(--adam-bg,#071022); }
html.theme-dark .tb-viewport-btns,
html:not(.theme-light):not(.theme-dark) .tb-viewport-btns { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-viewport-btn,
html:not(.theme-light):not(.theme-dark) .tb-viewport-btn { color:var(--adam-text,#e6eef6); border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-viewport-btn:hover:not(.active),
html:not(.theme-light):not(.theme-dark) .tb-viewport-btn:hover:not(.active) { background:var(--adam-hover,rgba(255,255,255,.06)); }
html.theme-dark .tb-modal-content,
html:not(.theme-light):not(.theme-dark) .tb-modal-content { background:var(--adam-bg,#071022); border:1px solid var(--adam-border,#1f2a35); }
html.theme-dark .tb-modal-header,
html:not(.theme-light):not(.theme-dark) .tb-modal-header { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-modal-footer,
html:not(.theme-light):not(.theme-dark) .tb-modal-footer { border-color:var(--adam-border,#1f2a35); }
html.theme-dark .tb-modal-close,
html:not(.theme-light):not(.theme-dark) .tb-modal-close { color:var(--adam-muted,#9ca3af); }
html.theme-dark .btn-outline,
html:not(.theme-light):not(.theme-dark) .btn-outline { color:var(--adam-text,#e6eef6); border-color:var(--adam-border,#1f2a35); }
html.theme-dark .btn-outline:hover,
html:not(.theme-light):not(.theme-dark) .btn-outline:hover { background:var(--adam-hover,rgba(255,255,255,.06)); }
html.theme-dark .tb-asset-tab,
html:not(.theme-light):not(.theme-dark) .tb-asset-tab { border-color:var(--adam-border,#1f2a35); color:var(--adam-text,#e6eef6); }
html.theme-dark .CodeMirror-foldmarker,
html:not(.theme-light):not(.theme-dark) .CodeMirror-foldmarker { color:var(--adam-accent,#fca5a5); }
html.theme-dark .CodeMirror-foldgutter-open:after,
html.theme-dark .CodeMirror-foldgutter-folded:after,
html:not(.theme-light):not(.theme-dark) .CodeMirror-foldgutter-open:after,
html:not(.theme-light):not(.theme-dark) .CodeMirror-foldgutter-folded:after { color:var(--adam-muted,#9ca3af); }

/* Responsive — tablet / narrow */
@media(max-width:1100px){
  .tb-editor-main { grid-template-columns:160px 1fr 240px; }
  .tb-inspector-main { grid-template-columns:200px minmax(0,1fr); }
  .tb-inspector-details { grid-column:1 / -1; border-left:0; border-top:1px solid var(--adam-border,#e2e8f0); }
  .tb-slot-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:900px){
  .tb-editor-main { display:flex; flex-direction:column; }
  .tb-editor-main .tb-editor-sidebar,.tb-editor-main .tb-editor-ref { display:block; width:auto; opacity:1; padding:0; pointer-events:auto; overflow:auto; border:0; }
  .tb-editor-main .tb-editor-sidebar,.tb-editor-main .tb-editor-code,.tb-editor-main .tb-editor-ref { flex:0 0 auto; border-bottom:1px solid var(--adam-border,#e2e8f0); }
  .tb-editor-main:not([data-mobile-panel="slots"]) #tb-slots-content,
  .tb-editor-main:not([data-mobile-panel="code"]) #tb-code-content,
  .tb-editor-main:not([data-mobile-panel="vars"]) #tb-vars-content { display:none; }
  .tb-editor-main[data-mobile-panel="code"] .tb-editor-code { flex:1 1 auto; min-height:0; }
  .tb-editor-main[data-mobile-panel="slots"] .tb-editor-sidebar,
  .tb-editor-main[data-mobile-panel="vars"] .tb-editor-ref { max-height:50vh; }
  .tb-editor-sidebar .tb-sidebar-header,.tb-editor-ref .tb-ref-header,.tb-code-header { min-height:42px; padding:.5rem; margin:0; }
  .tb-restore-btn { display:none !important; }
  .tb-editor-topbar { flex-wrap:wrap; }
  .tb-editor-actions { flex-wrap:wrap; }
}
/* Mobile portrait — stacked layout */
@media(max-width:600px){
  .tb-editor { height:auto; min-height:100vh; }
  .tb-editor-main { display:flex; flex-direction:column; min-height:0; }
  .tb-editor-main[data-mobile-panel="code"] .tb-editor-code { flex:1; min-height:60vh; }
  .tb-editor-topbar { gap:.5rem; padding:.35rem 0; }
  .tb-editor-topbar h3 { font-size:.9rem; }
  .tb-editor-actions { gap:.25rem; }
  .btn { padding:.3rem .6rem; font-size:.8rem; }
  .tb-theme-grid { grid-template-columns:1fr; }
  .tb-form .tb-form-row { grid-template-columns:1fr; }
  .tb-code-header { font-size:.75rem; }
  .tb-header-row,.tb-installed-topbar { align-items:stretch; flex-direction:column; }
  .tb-inspector-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tb-owner-map-grid { grid-template-columns:1fr; }
  .tb-owner-card + .tb-owner-card { border-left:0; border-top:1px solid var(--adam-border,#e2e8f0); }
  .tb-owner-item-title { align-items:flex-start; flex-direction:column; gap:.15rem; }
  .tb-owner-item-title code { max-width:100%; }
  .tb-inspector-main { display:flex; flex-direction:column; }
  .tb-inspector-files { max-height:260px; border-right:0; border-bottom:1px solid var(--adam-border,#e2e8f0); }
  .tb-inspector-source { min-height:65vh; }
  .tb-inspector-details { border-left:0; }
  .tb-slot-grid { grid-template-columns:1fr; }
}
