/*
 * style.css — core application styles
 * Dropdown-specific styles have been extracted to dropdown.css.
 * Load dropdown.css alongside this file.
 */

@font-face {
 font-family: 'classy';
 src: url('https://vkfonts.storage.googleapis.com/classy.woff2') format('woff2');
 font-weight: normal;
 font-style: normal;
}
:root {
 --bg: #f5fbf9;
 --bg2: #ecf8f4;
 --s1: #ffffff;
 --s2: #eef7f4;
 --s3: #dcefe9;
 --s4: #b7d9cf;
 --txt: #0d1c19;
 --txt2: #45655d;
 --muted: #6c8c84;
 --bd: rgba(0, 145, 108, 0.08);
 --bd2: rgba(0, 145, 108, 0.14);
 --bd3: rgba(0, 145, 108, 0.20);
 --acc: #00c28a;
 --acc2: #00a8b8;
 --acc-g: linear-gradient(135deg,#00c28a 0%,#00a8b8 100%);
 --acc-d: rgba(0,194,138,0.10);
 --green: #1aa86f;
 --amber: #7dcfba;
 --red: #d84d61;
 --cyan: #2aa8c8;
 --font: 'classy', sans-serif;
 --mono: 'Source Code Pro', monospace;
 --r: 12px;
 --r-sm: 8px;
 --r-lg: 18px;
 --r-xl: 24px;
 --r-pill: 500px;
 --nm-out: 5px 5px 14px rgba(15, 31, 28, 0.08), -2px -2px 8px rgba(255,255,255,0.85);
 --nm-deep: 8px 8px 20px rgba(15, 31, 28, 0.10), -3px -3px 12px rgba(255,255,255,0.88);
 --nm-in: inset 3px 3px 8px rgba(15, 31, 28, 0.06), inset -2px -2px 6px rgba(255,255,255,0.92);
 --nm-btn: 2px 2px 7px rgba(15, 31, 28, 0.08), -1px -1px 4px rgba(255,255,255,0.92);
 --glass-bg: rgba(255,255,255,0.78);
 --glass-bd: rgba(0, 145, 108, 0.10);
 --topbar-h: 64px;
 --t: 0.18s cubic-bezier(0.2,0.8,0.2,1);
}
* {
 box-sizing: border-box;
 margin: 0;
 padding: 0;
 -webkit-tap-highlight-color: transparent;
 -webkit-font-smoothing: antialiased;
}
html {
 scroll-behavior: smooth;
}
::-webkit-scrollbar {
 width: 3px;
 height: 3px;
}
::-webkit-scrollbar-track {
 background: transparent;
}
::-webkit-scrollbar-thumb {
 background: var(--s4);
 border-radius: 4px;
}
::selection {
 background: rgba(0,245,200,0.25);
 color: var(--txt);
}
body {
 background: var(--bg);
 color: var(--txt);
 font-family: var(--font);
 font-size: 14px;
 min-height: 100vh;
 transition: background var(--t),color var(--t);
}
html {
 color-scheme: light;
}
.mi {
 font-family: 'Material Symbols Rounded';
 font-variation-settings: 'FILL' 0,'wght' 300,'GRAD' 0,'opsz' 20;
 font-size: 20px;
 line-height: 1;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 flex-shrink: 0;
 user-select: none;
}
.mi-sm {
 font-size: 16px;
}
.mi-lg {
 font-size: 24px;
}
.mi-xl {
 font-size: 30px;
}
.topbar {
 position: fixed;
 top: 18px;
 left: 50%;
 transform: translateX(-50%);
 height: var(--topbar-h);
 background: var(--glass-bg);
 border: 1px solid var(--glass-bd);
 border-radius: var(--r-pill);
 display: flex;
 align-items: center;
 padding: 8px 10px;
 gap: 6px;
 z-index: 9000;
 box-shadow: var(--nm-deep);
 overflow: hidden;
 transition: background var(--t),border-color var(--t),box-shadow var(--t);
}
.tb-btn {
 min-width: 58px;
 height: 46px;
 padding: 0 14px;
 border-radius: var(--r-pill);
 border: 1px solid transparent;
 background: transparent;
 color: var(--txt2);
 cursor: pointer;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 gap: 2px;
 line-height: 1;
 transition: background var(--t),color var(--t),box-shadow var(--t),transform var(--t),border-color var(--t);
 font-family: var(--font);
 font-size: 9px;
 letter-spacing: 0.02em;
 user-select: none;
 box-sizing: border-box;
}
.tb-btn:hover {
 color: var(--txt);
}
.tb-btn.active {
 color: var(--acc);
 background: var(--acc-d);
 border-color: var(--bd2);
 box-shadow: var(--nm-in);
}
.tb-btn .mi {
 font-size: 20px;
}
.tb-divider {
 width: 1px;
 height: 28px;
 background: var(--bd2);
 margin: 0 3px;
 flex-shrink: 0;
}
.page {
 padding-top: calc(var(--topbar-h) + 68px);
 padding-bottom: 72px;
 min-height: 100vh;
}

/* ─── SIDEBAR (About / Contact / Install) ────────────────────── */
.sidebar-backdrop {
 position: fixed;
 inset: 0;
 background: rgba(0,0,0,0.35);
 opacity: 0;
 pointer-events: none;
 transition: opacity var(--t);
 z-index: 9100;
}
.sidebar-backdrop.open {
 opacity: 1;
 pointer-events: auto;
}
.sidebar {
 position: fixed;
 top: 0;
 right: 0;
 bottom: 0;
 width: min(280px, 82vw);
 background: var(--s1);
 border-left: 1px solid var(--bd2);
 box-shadow: var(--nm-deep);
 z-index: 9200;
 display: flex;
 flex-direction: column;
 padding: 18px 14px;
 gap: 6px;
 transform: translateX(100%);
 transition: transform var(--t);
 overflow-y: auto;
}
.sidebar.open {
 transform: translateX(0);
}
.sidebar-hdr {
 display: flex;
 align-items: center;
 justify-content: space-between;
 margin-bottom: 10px;
}
.sidebar-title {
 font-size: 12px;
 letter-spacing: 0.1em;
 text-transform: uppercase;
 color: var(--muted);
}
.sidebar-close-btn {
 width: 32px;
 height: 32px;
 border-radius: var(--r-pill);
 border: 1px solid var(--bd2);
 background: var(--s2);
 color: var(--txt2);
 cursor: pointer;
 display: flex;
 align-items: center;
 justify-content: center;
}
.sidebar-link {
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 12px 14px;
 border-radius: var(--r-sm);
 border: 1px solid transparent;
 background: transparent;
 color: var(--txt2);
 font-family: var(--font);
 font-size: 13px;
 cursor: pointer;
 transition: background var(--t), color var(--t), border-color var(--t);
 text-align: left;
}
.sidebar-link:hover {
 background: var(--s2);
 color: var(--txt);
}
.sidebar-link.active {
 color: var(--acc);
 background: var(--acc-d);
 border-color: var(--bd2);
}
.sidebar-link .mi {
 font-size: 18px;
}
.section {
 display: none;
 max-width: 700px;
 margin: 0 auto;
 padding: 0 16px;
 animation: fadeUp .3s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
.section.active {
 display: block;
}
@keyframes fadeUp {
 from {
 opacity: 0;
 transform: translateY(16px);
 }
 to {
 opacity: 1;
 transform: translateY(0);
 }
}
.page-hero {
 padding: 4px 0 28px;
}
.page-title {
 font-size: 30px;
 font-weight: 400;
 line-height: 1.15;
 margin-bottom: 8px;
 background: var(--acc-g);
 -webkit-background-clip: text;
 -webkit-text-fill-color: transparent;
 background-clip: text;
}
.page-sub {
 font-size: 13px;
 color: var(--txt2);
 line-height: 1.7;
}
.sec-label {
 font-size: 10px;
 font-weight: 400;
 letter-spacing: 0.14em;
 text-transform: uppercase;
 color: var(--acc);
 display: flex;
 align-items: center;
 gap: 8px;
 margin-bottom: 16px;
}
.sec-label::after {
 content: '';
 flex: 1;
 height: 1px;
 background: linear-gradient(to right,var(--bd2),transparent);
}
.nm-surface {
 background: var(--s1);
 border-radius: var(--r-lg);
 box-shadow: var(--nm-out);
 padding: 20px;
 margin-bottom: 20px;
 transition: background var(--t),box-shadow var(--t);
 border-left: 0;
}
.nm-inset {
 background: var(--bg2);
 border-radius: var(--r);
 box-shadow: var(--nm-in);
 padding: 14px 16px;
 transition: background var(--t),box-shadow var(--t);
}
.stat-strip {
 display: flex;
 flex-wrap: wrap;
 gap: 8px;
 margin-bottom: 24px;
}
.stat-pill {
 display: inline-flex;
 align-items: center;
 gap: 6px;
 padding: 7px 13px;
 border-radius: var(--r-pill);
 font-size: 12px;
 background: var(--s2);
 border: 1px solid var(--bd2);
 box-shadow: var(--nm-btn);
 color: var(--txt2);
 transition: all var(--t);
}
.stat-pill .sv {
 color: var(--txt);
 font-weight: 400;
}
.counters {
 display: grid;
 grid-template-columns: 1fr 1fr;
 gap: 10px;
 margin-bottom: 24px;
}
.counter {
 background: var(--s1);
 border-radius: var(--r);
 box-shadow: var(--nm-out);
 padding: 14px;
 display: flex;
 align-items: flex-start;
 gap: 11px;
 transition: box-shadow var(--t);
 border-left: 0;
}
.counter:hover {
 box-shadow: var(--nm-deep);
}
.c-icon {
 width: 34px;
 height: 34px;
 border-radius: 9px;
 flex-shrink: 0;
 display: flex;
 align-items: center;
 justify-content: center;
}
.c-icon.pur {
 background: rgba(0,245,200,0.12);
 color: var(--acc);
}
.c-icon.grn {
 background: rgba(74,222,128,0.1);
 color: var(--green);
}
.c-icon.amb {
 background: rgba(251,191,36,0.1);
 color: var(--amber);
}
.c-icon.red {
 background: rgba(248,113,113,0.1);
 color: var(--red);
}
.c-icon.cyn {
 background: rgba(103,232,249,0.1);
 color: var(--cyan);
}
.c-icon.pnk {
 background: rgba(244,114,182,0.1);
 color: var(--acc2);
}
.c-label {
 font-size: 11px;
 color: var(--txt2);
 margin-bottom: 2px;
 line-height: 1.4;
}
.c-val {
 font-size: 13px;
 font-weight: 400;
 color: var(--txt);
}
.feat-row {
 display: flex;
 align-items: flex-start;
 gap: 14px;
 padding: 15px 0;
 border-bottom: 1px solid var(--bd);
}
.feat-row:first-child {
 padding-top: 0;
}
.feat-row:last-child {
 border-bottom: none;
 padding-bottom: 0;
}
.feat-icon {
 width: 40px;
 height: 40px;
 border-radius: 11px;
 flex-shrink: 0;
 display: flex;
 align-items: center;
 justify-content: center;
 background: var(--acc-d);
 color: var(--acc);
 box-shadow: var(--nm-btn);
}
.feat-t {
 font-size: 13px;
 font-weight: 400;
 color: var(--txt);
 margin-bottom: 3px;
}
.feat-d {
 font-size: 12px;
 color: var(--txt2);
 line-height: 1.6;
}
.price-row {
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: 12px;
 padding: 11px 0;
 border-bottom: 1px solid var(--bd);
}
.price-row:last-child {
 border-bottom: none;
}
.price-lbl {
 font-size: 12px;
 color: var(--txt2);
}
.price-val {
 font-size: 12px;
 color: var(--txt);
 font-family: var(--mono);
 flex-shrink: 0;
 text-align: right;
}
.plan-pill {
 display: inline-flex;
 align-items: center;
 gap: 6px;
 padding: 8px 14px;
 border-radius: var(--r-pill);
 font-size: 12px;
 background: var(--s2);
 border: 1px solid var(--bd2);
 box-shadow: var(--nm-btn);
 margin: 0 6px 8px 0;
}
.plan-pill.super {
 background: var(--acc-d);
 border-color: rgba(0,245,200,0.25);
 color: var(--acc);
}
.table-wrap {
 overflow-x: auto;
}
.data-table {
 width: 100%;
 border-collapse: separate;
 border-spacing: 0 10px;
}
.data-table th {
 font-size: 10px;
 font-weight: 400;
 letter-spacing: 0.12em;
 text-transform: uppercase;
 color: var(--txt2);
 text-align: left;
 padding: 0 10px 6px;
}
.data-table td {
 background: var(--s2);
 border: 1px solid var(--bd2);
 padding: 10px 12px;
 vertical-align: top;
 font-size: 12px;
 color: var(--txt);
 font-weight: 400;
}
.data-table td:first-child {
 border-radius: 10px 0 0 10px;
}
.data-table td:last-child {
 border-radius: 0 10px 10px 0;
}
.data-table .sub {
 display: block;
 color: var(--txt2);
 font-size: 11px;
 line-height: 1.45;
 margin-top: 4px;
}
.data-table .mono {
 font-family: var(--mono);
 color: var(--cyan);
}
.data-table .ok {
 color: var(--green);
}
.data-table .warn {
 color: var(--amber);
}
.data-table .danger {
 color: var(--red);
}
.data-table th.consumption-head {
 color: var(--red);
}
.data-table td.consumption-cell {
 background: rgba(216,77,97,0.12);
 border-color: rgba(216,77,97,0.26);
 color: var(--red);
 font-family: var(--mono);
}
.btn {
 display: inline-flex;
 align-items: center;
 gap: 5px;
 padding: 8px 14px;
 border-radius: var(--r-sm);
 border: 1px solid var(--bd2);
 background: var(--s2);
 color: var(--txt);
 font-family: var(--font);
 font-size: 13px;
 cursor: pointer;
 box-shadow: var(--nm-btn);
 transition: all var(--t);
 white-space: nowrap;
 user-select: none;
}
.btn:hover {
 color: var(--acc);
 border-color: rgba(0,245,200,0.3);
 box-shadow: var(--nm-out);
}
.btn:active {
 box-shadow: var(--nm-in);
}
.btn-primary {
 background: var(--acc-d);
 border-color: rgba(0,245,200,0.28);
 color: var(--acc);
}
.btn-primary:hover {
 background: rgba(0,245,200,0.16);
 border-color: var(--acc);
}
.btn-ghost {
 background: transparent;
 border-color: transparent;
 box-shadow: none;
}
.btn-ghost:hover {
 background: var(--s2);
 border-color: var(--bd);
 box-shadow: var(--nm-btn);
}
.btn-danger {
 color: var(--red);
 border-color: rgba(248,113,113,0.2);
 background: rgba(248,113,113,0.05);
}
.btn-danger:hover {
 background: rgba(248,113,113,0.1);
 border-color: var(--red);
 color: var(--red);
}
.btn-green {
 color: var(--green);
 border-color: rgba(74,222,128,0.2);
 background: rgba(74,222,128,0.05);
}
.btn-green:hover {
 background: rgba(74,222,128,0.1);
 border-color: var(--green);
}
.btn-sm {
 padding: 6px 10px;
 font-size: 12px;
}
.btn-xs {
 padding: 2px 7px;
 font-size: 11px;
 border-radius: 5px;
}
.btn-active {
 background: var(--acc-d) !important;
 border-color: var(--acc) !important;
 color: var(--acc) !important;
}
.btn-cta {
 display: inline-flex;
 align-items: center;
 gap: 8px;
 padding: 13px 28px;
 border-radius: var(--r-pill);
 background: var(--acc-g);
 color: #fff;
 border: none;
 font-family: var(--font);
 font-size: 14px;
 cursor: pointer;
 text-decoration: none;
 box-shadow: 0 6px 22px rgba(0,245,200,0.38);
 transition: opacity var(--t),box-shadow var(--t);
}
.btn-cta:hover {
 opacity: .88;
 box-shadow: 0 8px 30px rgba(0,245,200,0.48);
}
.badge {
 display: inline-flex;
 align-items: center;
 gap: 4px;
 padding: 3px 10px;
 border-radius: 20px;
 font-size: 11px;
 font-family: var(--mono);
 background: rgba(0,245,200,0.08);
 border: 1px solid rgba(0,245,200,0.2);
 color: var(--acc);
}
.badge-rm {
 cursor: pointer;
 opacity: .4;
 font-family: var(--font);
 font-size: 13px;
 line-height: 1;
 padding: 0 1px;
 transition: opacity .12s,color .12s;
}
.badge-rm:hover {
 opacity: 1;
 color: var(--red);
}
.badge-green {
 background: rgba(74,222,128,0.08);
 border-color: rgba(74,222,128,0.22);
 color: var(--green);
}
.badge-cyan {
 background: rgba(103,232,249,0.08);
 border-color: rgba(103,232,249,0.22);
 color: var(--cyan);
}
.badge-amber {
 background: rgba(251,191,36,0.08);
 border-color: rgba(251,191,36,0.22);
 color: var(--amber);
}
.badge-pink {
 background: rgba(244,114,182,0.08);
 border-color: rgba(244,114,182,0.22);
 color: var(--acc2);
}
.card-empty {
 font-size: 12px;
 color: var(--txt);
 font-style: normal;
 opacity: .72;
}
.url-wrap {
 margin-bottom: 20px;
}
.ub-card {
 background: var(--s1);
 border-radius: var(--r-lg);
 box-shadow: var(--nm-out);
 overflow: hidden;
}
.ub-card-hd {
 display: flex;
 justify-content: space-between;
 align-items: center;
 padding: 12px 16px;
 background: var(--s2);
 border-bottom: 1px solid var(--bd2);
 cursor: pointer;
 user-select: none;
}
.ub-mode-switch {
 display: flex;
 align-items: center;
 gap: 7px;
 font-size: 13px;
 padding: 6px 10px;
 border-radius: var(--r-sm);
 transition: background var(--t), color var(--t);
 background: var(--s3);
 color: var(--acc);
}
.ub-mode-switch .mi {
 color: var(--acc);
}
.ub-mode-switch .ub-mode-swap-icon {
 color: var(--txt2);
 margin-left: 2px;
}
.ub-chevron-icon {
 color: var(--txt2);
 transition: transform 0.12s cubic-bezier(0.2,0,0,1);
 flex-shrink: 0;
}
.ub-card-hd.open .ub-chevron-icon {
 transform: rotate(180deg);
}
.ub-card-hd.closed .ub-chevron-icon {
 transform: rotate(0deg);
}
.ub-content-wrap {
 overflow: hidden;
 transform-origin: top;
 transform: scaleY(1);
 opacity: 1;
 transition: transform 0.12s cubic-bezier(0.2,0,0,1), opacity 0.1s cubic-bezier(0.2,0,0,1);
 will-change: transform, opacity;
}
.ub-content-wrap.collapsed {
 transform: scaleY(0);
 opacity: 0;
 height: 0;
}
.ub-content-area {
 padding: 14px 16px 10px;
}
.ub-btn-bar {
 display: flex;
 align-items: center;
 gap: 7px;
 flex-wrap: wrap;
 padding: 11px 16px;
 border-top: 1px solid var(--bd);
}
.ub-toast {
 position: fixed;
 bottom: 28px;
 left: 50%;
 transform: translateX(-50%);
 background: var(--txt);
 color: var(--bg);
 padding: 9px 20px;
 border-radius: var(--r-pill);
 font-size: 12px;
 font-family: var(--font);
 opacity: 0;
 pointer-events: none;
 z-index: 20000;
 white-space: nowrap;
 box-shadow: 0 6px 22px rgba(0,0,0,0.22);
}
.ub-toast.show {
 opacity: 1;
}
textarea.url-box {
 font-family: var(--mono);
 font-size: 12px;
 color: var(--cyan);
 background: transparent;
 border: none;
 outline: none;
 width: 100%;
 resize: none;
 line-height: 1.7;
 word-break: break-all;
 min-height: 72px;
 max-height: 1500px;
 overflow-y: auto;
 caret-color: transparent;
 cursor: default;
 display: block;
}
textarea.url-box.decoded {
 /* same color as encoded — no override needed */
}
.url-len {
 font-size: 11px;
 color: var(--muted);
 margin-left: auto;
 font-family: var(--mono);
}
.ub-grid {
 display: grid;
 grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
 gap: 12px;
}
.ub-block {
 background: var(--s1);
 border-radius: var(--r);
 box-shadow: var(--nm-out);
 padding: 14px;
 transition: box-shadow var(--t);
 border-left: 0;
}
.ub-block-hd {
 display: flex;
 align-items: center;
 justify-content: space-between;
 margin-bottom: 10px;
}
.ub-block-title {
 font-size: 11px;
 color: var(--txt2);
 display: flex;
 align-items: center;
 gap: 5px;
}
.ub-block-body {
 display: flex;
 flex-wrap: wrap;
 gap: 5px;
 align-items: center;
 min-height: 26px;
}
.ov {
 position: fixed;
 inset: 0;
 background: rgba(0,0,0,0.62);
 z-index: 10000;
 display: flex;
 align-items: flex-start;
 justify-content: center;
 padding: 6vh 16px 20px;
 opacity: 0;
 pointer-events: none;
 transition: opacity .15s;
 overflow-y: auto;
}
.ov.on {
 opacity: 1;
 pointer-events: all;
}
.modal {
 background: var(--s1);
 border: 1px solid var(--bd2);
 border-radius: var(--r-xl);
 width: 100%;
 max-width: 480px;
 box-shadow: 0 24px 60px rgba(0,0,0,0.55);
 border-left: 0;
}
.modal-lg {
 max-width: 600px;
}
.modal-xl {
 max-width: 740px;
}
.m-hd {
 padding: 16px 20px 13px;
 border-bottom: 1px solid var(--bd);
 display: flex;
 align-items: center;
 justify-content: space-between;
}
.m-title {
 font-size: 15px;
 display: flex;
 align-items: center;
 gap: 8px;
 color: var(--txt);
 font-weight: 400;
}
.m-close {
 width: 30px;
 height: 30px;
 border-radius: var(--r-sm);
 border: 1px solid var(--bd2);
 background: var(--s3);
 color: var(--txt);
 cursor: pointer;
 display: flex;
 align-items: center;
 justify-content: center;
 box-shadow: var(--nm-btn);
 transition: all var(--t);
}
.m-close:hover {
 background: rgba(248,113,113,0.1);
 border-color: var(--red);
 color: var(--red);
}
.m-body {
 padding: 16px 20px;
}
.m-ft {
 padding: 12px 20px;
 border-top: 1px solid var(--bd);
 display: flex;
 gap: 7px;
 justify-content: flex-end;
}
.fg {
 margin-bottom: 14px;
}
.fg:last-child {
 margin-bottom: 0;
}
.fl {
 font-size: 11px;
 color: var(--txt);
 margin-bottom: 5px;
 display: block;
}
.fi {
 width: 100%;
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r-sm);
 color: var(--txt);
 padding: 9px 13px;
 font-size: 13px;
 outline: none;
 box-shadow: var(--nm-in);
 transition: border-color var(--t),box-shadow var(--t);
 font-family: var(--font);
}
.fi:focus {
 border-color: rgba(0,245,200,0.4);
 box-shadow: var(--nm-in),0 0 0 2px rgba(0,245,200,0.08);
}
.fi::placeholder {
 color: var(--txt2);
}
.fi-mono {
 font-family: var(--mono);
 font-size: 12px;
}
.fi-num {
 font-family: var(--mono);
}
.hint {
 font-size: 11px;
 color: var(--txt);
 margin-top: 4px;
 line-height: 1.5;
 opacity: .82;
}
.tgl {
 position: relative;
 width: 38px;
 height: 21px;
 cursor: pointer;
 flex-shrink: 0;
}
.tgl input {
 display: none;
}
.tgl-sl {
 position: absolute;
 inset: 0;
 border-radius: 20px;
 background: var(--s3);
 border: 1px solid var(--bd2);
 box-shadow: var(--nm-in);
 transition: background .2s,border-color .2s;
}
.tgl-sl::after {
 content: '';
 position: absolute;
 top: 3px;
 left: 3px;
 width: 13px;
 height: 13px;
 border-radius: 50%;
 background: var(--muted);
 transition: transform .2s,background .2s;
 box-shadow: 1px 1px 4px rgba(0,0,0,0.35);
}
.tgl input:checked + .tgl-sl {
 background: rgba(0,245,200,0.14);
 border-color: var(--acc);
}
.tgl input:checked + .tgl-sl::after {
 transform: translateX(17px);
 background: var(--acc);
}
.tgl-row {
 display: flex;
 align-items: center;
 justify-content: space-between;
 padding: 9px 0;
 border-bottom: 1px solid var(--bd);
}
.tgl-row:last-child {
 border-bottom: none;
}
.filter-toggle-row {
 display: flex;
 align-items: center;
 justify-content: space-between;
 padding: 10px 0;
 border-bottom: 1px solid var(--bd);
}
.filter-toggle-row:last-child {
 border-bottom: none;
}
.tgl-info .tl {
 font-size: 13px;
 color: var(--txt);
}
.tgl-info .td {
 font-size: 11px;
 color: var(--muted);
 margin-top: 1px;
 font-family: var(--mono);
}
.tabs {
 display: flex;
 border-radius: var(--r-sm);
 padding: 3px;
 gap: 2px;
 margin-bottom: 13px;
}
.tab {
 flex: 1;
 text-align: center;
 padding: 7px 6px;
 border-radius: 500px;
 font-size: 12px;
 cursor: pointer;
 transition: all var(--t);
 color: var(--txt2);
 user-select: none;
}
.tab.on {
 background: var(--s2);
 box-shadow: var(--nm-btn);
 color: var(--acc);
   box-shadow:
      4px 4px 10px rgba(15,31,28,0.10),
      -2px -2px 7px rgba(255,255,255,0.95),
      inset 0 0 0 1px rgba(0,194,138,0.10),
      0 0 0 1px rgba(255,255,255,0.55);
}
.mb-preview {
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r);
 padding: 12px 14px;
 font-family: var(--mono);
 font-size: 14px;
 color: var(--cyan);
 min-height: 42px;
 word-break: break-all;
 box-shadow: var(--nm-in);
}
.mb-row {
 display: grid;
 grid-template-columns: 1fr 1fr;
 gap: 10px;
}
.expr-disp {
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r-sm);
 padding: 11px;
 font-family: var(--mono);
 font-size: 12px;
 color: var(--txt2);
 min-height: 52px;
 word-break: break-all;
 line-height: 1.7;
 margin-bottom: 10px;
 box-shadow: var(--nm-in);
}
.expr-disp.has-content {
 color: var(--cyan);
 border-color: rgba(103,232,249,0.3);
}
.op-grid {
 display: grid;
 grid-template-columns: repeat(6,1fr);
 gap: 4px;
 margin-bottom: 8px;
}
.op-btn {
 padding: 8px 4px;
 text-align: center;
 border-radius: var(--r-sm);
 background: var(--s2);
 border: 1px solid var(--bd);
 color: var(--txt);
 font-size: 12px;
 cursor: pointer;
 box-shadow: var(--nm-btn);
 transition: all var(--t);
 user-select: none;
 font-family: var(--mono);
 line-height: 1;
}
.op-btn:hover {
 color: var(--acc);
 border-color: rgba(0,245,200,0.3);
}
.op-btn:active {
 box-shadow: var(--nm-in);
}
.op-btn.op-danger:hover {
 color: var(--red);
 border-color: var(--red);
 background: rgba(248,113,113,0.08);
}
.expr-tags {
 display: flex;
 flex-wrap: wrap;
 gap: 5px;
 margin-bottom: 8px;
}
.divider {
 height: 1px;
 background: var(--bd);
 margin: 14px 0;
}
.section-label {
 font-size: 11px;
 color: var(--txt2);
 margin-bottom: 5px;
}
.date-btn {
 display: flex;
 align-items: center;
 gap: 9px;
 width: 100%;
 box-sizing: border-box;
 padding: 9px 13px;
 color: var(--txt2);
 font-family: var(--font);
 font-size: 13px;
 line-height: 1.2;
 text-align: left;
 appearance: none;
 -webkit-appearance: none;
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r-sm);
 cursor: pointer;
 box-shadow: var(--nm-in);
 transition: border-color var(--t);
 user-select: none;
 min-height: 40px;
}
.date-btn:hover {
 border-color: var(--acc);
}
.date-btn.set {
 border-color: rgba(103,232,249,.5);
}
.date-btn .dv {
 font-family: var(--mono);
 font-size: 12px;
 color: var(--cyan);
}
.date-grid {
 display: grid;
 grid-template-columns: 1fr 1fr;
 gap: 10px;
}
.ccm-badge {
 background: rgba(251,191,36,0.07);
 border: 1px solid rgba(251,191,36,0.22);
 border-radius: var(--r-sm);
 padding: 8px 12px;
 font-size: 12px;
 color: var(--amber);
}
.info-block {
 background: var(--bg2);
 border: 1px solid var(--bd);
 border-radius: var(--r-sm);
 padding: 9px 12px;
 box-shadow: var(--nm-in);
 border-left: 0;
}
.row {
 display: flex;
 align-items: center;
 gap: 7px;
}
.grow {
 flex: 1;
}
.ms-wrap {
 margin-top: 8px;
 border: 1px solid var(--bd2);
 border-radius: var(--r-sm);
 background: var(--bg2);
 overflow: hidden;
 box-shadow: var(--nm-in);
}
.ms-opt {
 display: flex;
 align-items: center;
 gap: 9px;
 padding: 9px 12px;
 cursor: pointer;
 transition: background .08s;
 border-bottom: 1px solid var(--bd);
 font-size: 12px;
 font-family: var(--mono);
 user-select: none;
}
.ms-opt:last-child {
 border-bottom: none;
}
.ms-opt:hover {
 background: var(--acc-d);
}
.ms-opt.selected {
 background: rgba(0,245,200,.1);
 color: var(--acc);
}
.ms-check {
 width: 14px;
 height: 14px;
 border-radius: 3px;
 border: 1px solid var(--bd2);
 background: var(--s3);
 flex-shrink: 0;
 display: flex;
 align-items: center;
 justify-content: center;
 font-size: 10px;
 transition: all .1s;
}
.ms-opt.selected .ms-check {
 background: var(--acc-d);
 border-color: var(--acc);
 color: var(--acc);
}
#_dp {
 position: fixed;
 top: -999px;
 left: -999px;
 opacity: 0;
 pointer-events: none;
 width: 1px;
 height: 1px;
}
.contact-hero {
 text-align: center;
 padding: 20px 0 28px;
}
.contact-ava {
 width: 76px;
 height: 76px;
 border-radius: 50%;
 margin: 0 auto 16px;
 background: var(--acc-d);
 border: 2px solid rgba(0,245,200,0.22);
 box-shadow: var(--nm-out);
 display: flex;
 align-items: center;
 justify-content: center;
 color: var(--acc);
}
.contact-name {
 font-size: 21px;
 font-weight: 400;
 color: var(--txt);
 margin-bottom: 3px;
}
.contact-handle {
 font-size: 13px;
 color: var(--txt2);
 margin-bottom: 22px;
}
.cf-rows {
 margin-top: 4px;
}
.cf-row {
 display: flex;
 align-items: center;
 gap: 13px;
 padding: 14px 0;
 border-bottom: 1px solid var(--bd);
}
.cf-row:last-child {
 border-bottom: none;
}
.cf-ic {
 width: 36px;
 height: 36px;
 border-radius: 10px;
 background: var(--s2);
 box-shadow: var(--nm-btn);
 display: flex;
 align-items: center;
 justify-content: center;
 color: var(--txt2);
 flex-shrink: 0;
}
.cf-lbl {
 font-size: 11px;
 color: var(--txt2);
 margin-bottom: 2px;
}
.cf-val {
 font-size: 13px;
 color: var(--txt);
 font-family: var(--mono);
}
.cf-val a {
 color: var(--acc);
 text-decoration: none;
}
.cf-val a:hover {
 text-decoration: underline;
}
.subject-nm {
 background: var(--bg2);
 border-radius: var(--r);
 box-shadow: var(--nm-in);
 padding: 11px 14px;
 font-family: var(--mono);
 font-size: 12px;
 color: var(--cyan);
 margin-top: 7px;
 user-select: all;
 cursor: text;
}
.callout {
 background: var(--s1);
 border-radius: var(--r);
 box-shadow: var(--nm-out);
 padding: 14px 16px;
 margin-top: 16px;
 display: flex;
 gap: 12px;
 align-items: flex-start;
 border: 1px solid var(--bd2);
}
.callout .mi {
 color: var(--acc);
 flex-shrink: 0;
 margin-top: 1px;
}
.callout p {
 font-size: 12px;
 color: var(--txt2);
 line-height: 1.65;
}
@media(max-width:520px) {
 .topbar {
  padding: 5px 8px;
 }
 .tb-btn {
  width: 46px;
  height: 46px;
  font-size: 8px;
 }
 .counters, .ub-grid, .mb-row, .date-grid {
  grid-template-columns: 1fr;
 }
}
.ms-search {
 display: block;
 width: 100%;
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r-pill);
 color: var(--txt);
 padding: 7px 14px;
 font-size: 12px;
 outline: none;
 font-family: var(--font);
 box-shadow: var(--nm-in);
 margin-bottom: 6px;
 transition: border-color var(--t);
}
.ms-search:focus {
 border-color: var(--acc);
}
.m-body textarea {
 min-height: 100px;
 margin-top: 3px;
 font-size: 13px;
 word-break: break-all;
 resize: vertical;
 width: 100%;
 box-sizing: border-box;
 color: #171717;
 background: var(--bg2);
 border: 1px solid var(--bd2);
 border-radius: var(--r-sm);
 font-family: var(--mono);
}
.m-body textarea:focus {
 border-color: rgba(0, 245, 200, 0.4);
 box-shadow: var(--nm-in), 0 0 0 2px rgba(0, 245, 200, 0.08);
}
.m-body textarea::placeholder {
 color: var(--txt2);
}
html.loading,
body.loading {
 overflow: hidden;
 background: var(--bg);
}
body.loading .page,
body.loading .topbar,
body.loading #_dp,
body.loading stitch {
 visibility: hidden;
}
#page-loader {
 position: fixed;
 inset: 0;
 z-index: 999999;
 display: flex;
 align-items: center;
 justify-content: center;
 background: var(--bg);
 opacity: 1;
 visibility: visible;
 transition: opacity .35s ease, visibility .35s ease;
 pointer-events: all;
}
#page-loader.hidden {
 opacity: 0;
 visibility: hidden;
 pointer-events: none;
}
.loading-container {
 position: absolute;
 top: 50%;
 left: 50%;
 transform: translate(-50%, -50%);
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 opacity: 1;
 transition: opacity .2s;
 pointer-events: none;
 width: 100%;
 height: 100%;
}
.loading-bars {
 display: inline-flex;
 gap: 4px;
 align-items: center;
 height: 17px;
 margin-bottom: 3px;
}
.loading-bar {
 width: 3px;
 background: var(--acc);
 border-radius: 2px;
 animation: loading-pulse 1.2s infinite;
}
.loading-bar:nth-child(1) {
 height: 5px;
 background: var(--acc2);
 animation-delay: -0.2s;
}
.loading-bar:nth-child(2) {
 height: 9px;
 background: var(--acc);
 animation-delay: -.1s;
}
.loading-bar:nth-child(3) {
 height: 5px;
 background: var(--acc2);
 animation-delay: 0s;
}
@keyframes loading-pulse {
 0%, 40%, 100% { opacity: .25; }
 20% { opacity: 1; }
}
.epick-subtopbar {
  position: sticky;
  top: calc(18px + var(--topbar-h) + 6px);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-bd);
  border-radius: var(--r-pill);
  box-shadow: var(--nm-btn);
  margin: 0 auto 24px;
  width: fit-content;
}
.epick-subtab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1;
  user-select: none;
  transition: background var(--t), color var(--t), box-shadow var(--t), border-color var(--t);
}
.epick-subtab:hover {
  color: var(--txt);
}
.epick-subtab.active {
  color: var(--acc);
  background: var(--acc-d);
  border-color: var(--bd2);
  box-shadow: var(--nm-in);
}
.epick-field-lbl {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt2);
  margin-bottom: 6px;
}
.epick-input {
  display: block;
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-sm);
  color: var(--txt);
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  box-shadow: var(--nm-in);
  transition: border-color var(--t);
  box-sizing: border-box;
}
.epick-input:focus {
  border-color: var(--acc);
}
select.epick-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}
select.epick-input:focus {
  border-color: var(--acc);
}
input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}
.epick-fetch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--bd2);
  background: var(--acc-d);
  color: var(--acc);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  box-shadow: var(--nm-btn);
  transition: all var(--t);
  user-select: none;
}
.epick-fetch-btn:hover {
  background: rgba(0,194,138,0.18);
  border-color: var(--acc);
  box-shadow: var(--nm-deep);
}
.epick-fetch-btn:active {
  box-shadow: var(--nm-in);
  transform: scale(0.99);
}
@media (max-width: 520px) {
  .epick-subtopbar {
    top: calc(18px + var(--topbar-h) + 4px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   NEW STYLES FOR BUILDER REVAMP
   ═══════════════════════════════════════════════════════════════ */

/* ── Section Info Panel ── */
.section-info-panel {
  padding: 0 0 24px;
  animation: fadeUp .25s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
.section-info-panel .page-title {
  font-size: 24px;
}
.section-info-panel .page-sub {
  font-size: 12px;
}

/* ── Builder Subtopbar ── */
.builder-subtopbar {
  position: sticky;
  top: calc(18px + var(--topbar-h) + 6px);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-bd);
  border-radius: var(--r-pill);
  box-shadow: var(--nm-btn);
  margin: 0 auto 20px;
  max-width: calc(100% - 16px);
  width: fit-content;
  transition: top 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
.builder-subtab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1;
  user-select: none;
  transition: background var(--t), color var(--t), box-shadow var(--t), border-color var(--t);
}
.builder-subtab:hover {
  color: var(--txt);
}
.builder-subtab.active {
  color: var(--acc);
  background: var(--acc-d);
  border-color: var(--bd2);
  box-shadow: var(--nm-in);
}

/* ── Chevron in subtopbar ── */
.bst-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  transition: all var(--t);
  margin-right: 2px;
}
.bst-chevron:hover {
  background: var(--s2);
  color: var(--txt);
}
.bst-chevron.active {
  background: var(--acc-d);
  color: var(--acc);
  border-color: var(--bd2);
  box-shadow: var(--nm-in);
}
.bst-chevron.active .mi {
  transform: rotate(180deg);
}
.bst-chevron .mi {
  transition: transform .2s;
}

/* ── Cloud sync icon ── */
.bst-cloud {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  transition: all var(--t);
  margin-left: 2px;
}
.bst-cloud:hover {
  background: var(--s2);
  color: var(--txt);
}
.bst-cloud.unsync {
  color: var(--red);
  background: rgba(216,77,97,0.08);
  border-color: rgba(216,77,97,0.2);
}
.bst-cloud.unsync:hover {
  background: rgba(216,77,97,0.14);
  color: var(--red);
}
.bst-cloud.syncing .mi {
  animation: cloudFloat 1.2s ease-in-out infinite;
}
@keyframes cloudFloat {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-4px); }
  70%       { transform: translateY(2px); }
}

/* ── Tertiary topbar ── */
.builder-tertiary {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-pill);
  box-shadow: var(--nm-btn);
  margin: -10px auto 16px;
  max-width: calc(100% - 16px);
  width: fit-content;
  animation: fadeUp .2s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
.bt-tert-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
  transition: all var(--t);
}
.bt-tert-btn:hover {
  color: var(--txt);
  background: var(--s3);
}
.bt-tert-btn.bt-back {
  padding: 5px 8px;
  background: var(--s3);
  border-color: var(--bd2);
}
.bt-tert-btn.bt-back:hover {
  background: var(--s4);
}

/* ── Secondary tertiary ── */
.builder-secondary-tertiary {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-pill);
  box-shadow: var(--nm-btn);
  margin: -10px auto 16px;
  max-width: calc(100% - 16px);
  width: fit-content;
  animation: fadeUp .2s cubic-bezier(0.2,0.8,0.2,1) forwards;
}

/* ── Search bar ── */
.builder-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-btn);
  margin: -10px auto 16px;
  animation: fadeUp .2s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
.builder-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--txt);
  font-family: var(--font);
  font-size: 13px;
}
.builder-search-input::placeholder {
  color: var(--muted);
}

/* ── Select bar ── */
.builder-select-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-lg);
  box-shadow: var(--nm-btn);
  margin: -10px auto 16px;
  animation: fadeUp .2s cubic-bezier(0.2,0.8,0.2,1) forwards;
}

/* ── Cloud loader ── */
.builder-cloud-loader {
  height: 3px;
  background: var(--s3);
  border-radius: 2px;
  margin: -14px auto 16px;
  overflow: hidden;
  max-width: 200px;
}
.builder-cloud-loader-bar {
  height: 100%;
  width: 40%;
  background: var(--acc-g);
  border-radius: 2px;
  animation: cloudLoadSlide 1s ease-in-out infinite;
}
@keyframes cloudLoadSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(-100%); }
}

/* ── Blocks grid ── */
.builder-blocks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.builder-block-card:hover,
.builder-var-card:hover {
  box-shadow: var(--nm-deep);
}

/* ── Checkbox inside ub-card-hd (blocks + vars select mode) ── */
.builder-block-check,
.builder-var-check {
  display: none;
}
.builder-block-check.visible,
.builder-var-check.visible {
  display: flex;
  align-items: center;
}
.builder-block-check input[type="checkbox"],
.builder-var-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--bd2);
  background: var(--s3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .1s;
}
.builder-block-check input[type="checkbox"]:checked,
.builder-var-check input[type="checkbox"]:checked {
  background: var(--acc-d);
  border-color: var(--acc);
}
.builder-block-check input[type="checkbox"]:checked::after,
.builder-var-check input[type="checkbox"]:checked::after {
  content: '✓';
  font-size: 10px;
  color: var(--acc);
}

/* ── Variable card ── */
.builder-var-card {
  /* styling inherited from .ub-card */
}
.builder-var-card:hover {
  box-shadow: var(--nm-deep);
}
.builder-var-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
/* .builder-var-check base/checkbox styling is defined once, combined with
   .builder-block-check, above — see "Checkbox inside ub-card-hd". */
.builder-var-name {
  flex: 1;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
}
.builder-var-date {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.builder-var-formula {
  background: var(--bg2);
  border: 1px solid var(--bd2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  word-break: break-all;
  box-shadow: var(--nm-in);
  margin-bottom: 10px;
}
.builder-var-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Empty state ── */
.builder-blocks-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 13px;
}
.builder-blocks-empty p {
  margin-top: 8px;
}

/* ── Sub-layout header ── */
.builder-sub-layout-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 4px 0;
}
.builder-sub-layout-name {
  font-size: 13px;
  color: var(--txt2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Notify modal ── */
#ov-notify .m-body {
  font-size: 13px;
  color: var(--txt2);
  line-height: 1.6;
}

/* ── Var delete warning modal ── */
#ov-vardelete .m-body {
  font-size: 13px;
  color: var(--txt2);
  line-height: 1.6;
}
#ov-vardelete .var-delete-block-list {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--r-sm);
  box-shadow: var(--nm-in);
  max-height: 120px;
  overflow-y: auto;
}
#ov-vardelete .var-delete-block-list li {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
  padding: 3px 0;
}

/* ── Topbar hidden state (tertiary open: topbar slides up, subtopbar takes its place) ── */
.topbar.hidden {
  transform: translateX(-50%) translateY(calc(-100% - 18px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.2,0.8,0.2,1), opacity 0.18s ease;
}
/* When primary topbar is hidden, subtopbar floats to the top and page content moves up */
#sec-builder.tertiary-active .builder-subtopbar {
  top: 18px;
  transition: top 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
.page {
  transition: padding-top 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
body.topbar-hidden .page {
  padding-top: 68px;
}

@media (max-width: 520px) {
  .builder-subtopbar {
    top: calc(18px + var(--topbar-h) + 4px);
    gap: 3px;
    padding: 4px;
  }
  .builder-subtab {
    padding: 5px 10px;
    font-size: 10px;
  }
  .builder-tertiary,
  .builder-secondary-tertiary {
    gap: 3px;
    padding: 4px;
  }
  .bt-tert-btn {
    padding: 4px 9px;
    font-size: 10px;
  }
  .builder-search-bar {
    gap: 6px;
    padding: 6px 10px;
  }
  .builder-select-bar {
    gap: 6px;
    padding: 6px 10px;
  }
}


/* ── Material icon on bst-chevron ── */
.bst-chevron .mi {
  font-size: 18px;
  transition: transform 0.2s cubic-bezier(0.2,0.8,0.2,1);
}
.bst-chevron.active .mi {
  transform: rotate(180deg);
}

/* ── Responsive search/select bars ── */
.builder-search-bar {
  max-width: calc(100% - 16px);
}
.builder-select-bar {
  max-width: calc(100% - 16px);
  flex-wrap: wrap;
}

/* ── Name / date pill buttons inside ub-card-hd (blocks + vars) ── */
/* Match ub-mode-switch exactly — same padding, bg, radius, color, no border */
.builder-block-card .ub-card-hd,
.builder-var-card .ub-card-hd {
  justify-content: flex-start;
  gap: 8px;
}
.ub-hd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--s3);
  color: var(--acc);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.ub-hd-btn .mi {
  color: var(--acc);
  font-size: 14px;
}
.ub-hd-btn .ub-hd-name-text {
  color: var(--acc);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ub-hd-btn--date {
  cursor: default;
  flex-shrink: 0;
}
/* Chevron pushed to right end */
.builder-block-card .ub-chevron-icon,
.builder-var-card .ub-chevron-icon {
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Cloud Upload Button ─────────────────────────────────────── */
#bst-cloud-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all var(--t);
  margin-left: 2px;
  /* default: clean/non-dirty = green */
  color: var(--green);
}
#bst-cloud-upload:hover {
  background: var(--s2);
}
/* dirty = red, matching .bst-cloud.unsync */
#bst-cloud-upload.dirty {
  color: var(--red);
  background: rgba(216,77,97,0.08);
  border-color: rgba(216,77,97,0.2);
}
#bst-cloud-upload.dirty:hover {
  background: rgba(216,77,97,0.14);
}
/* clean = green */
#bst-cloud-upload.clean {
  color: var(--green);
  background: rgba(26,168,111,0.08);
  border-color: rgba(26,168,111,0.2);
}
#bst-cloud-upload.clean:hover {
  background: rgba(26,168,111,0.14);
}
/* syncing: upload icon bounces up twice */
@keyframes cloud-upload-bounce {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(-5px); }
  50%  { transform: translateY(0); }
  75%  { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}
#bst-cloud-upload.syncing .mi {
  animation: cloud-upload-bounce 1.2s ease-in-out infinite;
}

/* ─── Cloud Download Button ───────────────────────────────────── */
#bst-cloud-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(42,168,200,0.2);
  background: rgba(42,168,200,0.08);
  color: var(--cyan);
  cursor: pointer;
  transition: all var(--t);
  margin-left: 2px;
}
#bst-cloud-download:hover {
  background: rgba(42,168,200,0.14);
}
/* downloading: download icon bounces down twice */
@keyframes cloud-download-bounce {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(5px); }
  50%  { transform: translateY(0); }
  75%  { transform: translateY(5px); }
  100% { transform: translateY(0); }
}
#bst-cloud-download.downloading .mi {
  animation: cloud-download-bounce 1.2s ease-in-out infinite;
}

/* ─── Labs: strategy test URL box ─────────────────────────────── */
.labs-mint-box {
  background: rgba(0,194,138,0.08);
  border: 1px solid rgba(0,194,138,0.24);
  border-radius: var(--r);
  box-shadow: var(--nm-in);
  padding: 4px;
}
.labs-mint-textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px;
  outline: none;
}

/* ─── Labs: file upload — native <input type=file> chrome doesn't take
   the app's styling at all, so it's visually hidden and a themed <label>
   (same .epick-fetch-btn look every other Labs action button uses) is
   the actual clickable trigger. ──────────────────────────────────── */
.labs-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.labs-file-trigger {
  cursor: pointer;
}

/* ─── Labs: running-test progress bar ─────────────────────────── */
.labs-progress-track {
  position: relative;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--s3);
  box-shadow: var(--nm-in);
  overflow: hidden;
}
.labs-progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--acc-g);
  transition: width 0.5s linear;
}
.labs-progress-label {
  margin-top: 8px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
}

/* ─── Labs: overall + per-day strategy score ──────────────────── */
.labs-overall-score {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 500;
  text-align: center;
  line-height: 1.1;
}
.labs-overall-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-family: var(--mono);
}
.labs-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.labs-day-cell {
  border-radius: var(--r-sm);
  padding: 10px 6px;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  box-shadow: var(--nm-btn);
}
.labs-day-cell.labs-day-empty {
  background: var(--s3);
  color: var(--muted);
  text-shadow: none;
}
.labs-day-num {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 3px;
}
.labs-day-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.labs-day-sub {
  font-size: 9px;
  opacity: 0.75;
  margin-top: 2px;
  font-family: var(--mono);
}

/* DSL v2 expression writing assistant */
.expr-editor-wrap { position: relative; }
#expr-autocomplete {
  display:none;
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  right:0;
  z-index:40;
  max-height:260px;
  overflow:auto;
  background:var(--s1);
  border:1px solid var(--bd2);
  border-radius:var(--r-sm);
  box-shadow:0 14px 35px rgba(0,0,0,.38);
}
#expr-autocomplete.on { display:block; }
.expr-ac-item {
  display:grid;
  grid-template-columns:minmax(90px,1fr) auto;
  gap:10px;
  padding:8px 10px;
  cursor:pointer;
  border-bottom:1px solid var(--bd);
  font-family:var(--mono);
}
.expr-ac-item:last-child { border-bottom:0; }
.expr-ac-item:hover,.expr-ac-item.active { background:var(--s2); }
.expr-ac-name { color:var(--txt); font-size:12px; }
.expr-ac-meta { color:var(--txt2); font:10px var(--font); text-align:right; }
.expr-ac-desc { grid-column:1/-1; color:var(--txt2); font:10px/1.35 var(--font); }
.expr-ac-signature { grid-column:1/-1; color:var(--acc); font-size:10px; }

/* DSL v2.4 function workspace + reference helper */
.func-builder-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.dsl-func-editor { min-height:150px; resize:vertical; }
.dsl-live-preview { margin-top:10px; padding:10px 12px; border:1px solid var(--bd2); border-radius:var(--r-sm); background:var(--bg2); color:var(--txt2); font:11px/1.5 var(--mono); overflow:auto; }
.dsl-live-preview span { color:var(--muted); }
.dsl-live-preview strong { color:var(--cyan); font-weight:500; }
@media (max-width:600px) { .func-builder-grid { grid-template-columns:1fr; } }
/* live_style.css
 * All new CSS for the Live section + new scrollable topbar.
 * Append the contents of this file to style.css.
 * ─────────────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════════════
   NEW TOPBAR REGION
   Replaces .topbar / #primary-topbar
   ═══════════════════════════════════════════════════════════════════════ */

.topbar-region {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
.topbar-region.is-closed {
  transform: translateY(calc(-100% + 52px)); /* peek: chevron still visible */
}

.topbar-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface, #1a1a2e);
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Chevron collapse button */
.topbar-chevron {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted, #888);
  cursor: pointer;
  transition: background 0.15s, transform 0.28s;
}
.topbar-chevron:hover { background: var(--surface-2, rgba(255,255,255,0.06)); }
.topbar-region.is-closed .topbar-chevron { transform: rotate(180deg); }

/* Glass strip */
.glass-topbar {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface-2, rgba(255,255,255,0.04));
}

/* Scrollable icon row */
.icon-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 6px;
}
.icon-scroll::-webkit-scrollbar { display: none; }

.icon-item {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted, #888);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  position: relative;
  transition: background 0.14s, color 0.14s;
  min-width: 52px;
}
.icon-item svg { width: 18px; height: 18px; stroke-width: 1.8; }
.icon-item:hover { background: var(--surface-2, rgba(255,255,255,0.06)); color: var(--text, #e0e0e0); }
.icon-item.active {
  color: var(--accent, #818cf8);
  background: var(--accent-muted, rgba(129,140,248,0.12));
}
.icon-item.active::after {
  content: '';
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 2px;
  border-radius: 999px;
  background: var(--accent, #818cf8);
}
.icon-label {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* Department separator in icon strip */
.icon-sep {
  flex-shrink: 0;
  width: 1px; height: 28px;
  background: var(--border, rgba(255,255,255,0.08));
  margin: 0 4px;
}

/* Live badge (pulsing dot on Live nav item) */
.icon-item[data-badge="live"]::before {
  content: '';
  position: absolute; top: 6px; right: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red, #f43f5e);
  animation: pulse-live 1.6s infinite;
}
.icon-item[data-badge="live"].live-active::before {
  background: #22c55e;
  animation: none;
}
@keyframes pulse-live {
  0%,100% { opacity: 1; transform: scale(1);    }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

/* Expand button */
.expand-button {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px; border: none;
  background: transparent;
  color: var(--muted, #888);
  cursor: pointer;
  transition: background 0.15s;
}
.expand-button:hover { background: var(--surface-2, rgba(255,255,255,0.06)); }

/* Scroll progress bar (below wrapper) */
.scroll-progress {
  position: relative;
  height: 2px;
  margin: 0 12px;
}
.scroll-progress-track {
  position: absolute; inset: 0;
  background: var(--border, rgba(255,255,255,0.06));
  border-radius: 999px;
}
.scroll-progress-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--accent, #818cf8);
  border-radius: 999px;
  width: 0;
  transition: width 0.1s;
}
.scroll-progress-thumb {
  position: absolute; top: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent, #818cf8);
  left: 0;
  transition: left 0.1s;
}

/* Gap spacer that pushes page content below the fixed topbar */
.topbar-gap {
  transition: height 0.28s cubic-bezier(.4,0,.2,1);
}

/* ── Full Navigation Expanded Panel ──────────────────────────────────── */
.navigation-expanded {
  display: none;
  position: fixed;
  inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s;
}
.navigation-expanded.is-open { opacity: 1; }

.navigation-expanded-header {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface, #1a1a2e);
  border-radius: 16px 16px 0 0;
  position: sticky; top: 0; z-index: 1;
}
.navigation-expanded-title {
  flex: 1; font-weight: 600; font-size: 15px; color: var(--text, #e0e0e0);
}
.navigation-expanded-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: transparent; color: var(--muted); cursor: pointer;
}
.navigation-expanded-close:hover {
  background: var(--surface-2, rgba(255,255,255,0.06));
}

.expanded-body {
  display: flex;
  height: calc(100vh - 57px);
  background: var(--surface, #1a1a2e);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.dept-list-pane {
  width: 120px; flex-shrink: 0;
  border-right: 1px solid var(--border, rgba(255,255,255,0.08));
  overflow-y: auto;
  padding: 8px;
}
.dept-list-item {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; border-radius: 10px; border: none;
  background: transparent; color: var(--muted); font-size: 11px;
  cursor: pointer; text-align: center; font-family: inherit;
  transition: background 0.14s, color 0.14s;
}
.dept-list-item svg { width: 18px; height: 18px; stroke-width: 1.6; }
.dept-list-item:hover { background: var(--surface-2); color: var(--text); }
.dept-list-item.active { color: var(--accent, #818cf8); background: var(--accent-muted, rgba(129,140,248,0.12)); }

.icon-list-pane {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.icon-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; border: none;
  background: transparent; color: var(--text, #e0e0e0);
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: background 0.14s;
  text-align: left; width: 100%;
}
.icon-list-item svg { width: 16px; height: 16px; stroke-width: 1.8; color: var(--muted); flex-shrink: 0; }
.icon-list-item:hover { background: var(--surface-2); }
.icon-list-item.active { color: var(--accent); }

/* Mobile: expanded panel goes full-width */
@media (max-width: 480px) {
  .expanded-body { max-width: 100%; border-radius: 0; }
}


/* ═══════════════════════════════════════════════════════════════════════
   LIVE SECTION
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Status bar ──────────────────────────────────────────────────────── */
.live-status-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius, 12px); margin-bottom: 12px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0; transition: background .3s;
}
.live-dot-connecting { background: #f59e0b; animation: pulse-live 1s infinite; }
.live-dot-connected  { background: #22c55e; }
.live-dot-disconnected { background: var(--muted); }
.live-dot-error      { background: #f43f5e; }

.live-status-text {
  font-size: 13px; font-weight: 600; color: var(--text); min-width: 90px;
}
.live-stat {
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.live-stat-sep { opacity: 0.3; }

/* ── Two-column layout ───────────────────────────────────────────────── */
.live-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .live-layout { grid-template-columns: 1fr; }
}

.live-col-config { display: flex; flex-direction: column; gap: 12px; }
.live-col-results { display: flex; flex-direction: column; gap: 12px; }

/* ── Generic live panel ──────────────────────────────────────────────── */
.live-panel { border-radius: var(--radius, 12px); }
.live-label { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.live-condition-preview {
  font-family: var(--mono, monospace); font-size: 12px;
  background: var(--surface-2); border-radius: 8px;
  padding: 10px 12px; margin-top: 10px;
  white-space: pre-wrap; word-break: break-all; color: var(--text);
  min-height: 36px;
}

.live-textarea {
  width: 100%; box-sizing: border-box;
  resize: vertical; font-family: var(--mono, monospace); font-size: 12px;
}

.live-condition-direct { margin-top: 10px; }

.live-tf-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; flex-wrap: wrap;
}
.live-tf-select { max-width: 120px; }

.live-signal-row { display: flex; align-items: center; gap: 8px; }
.live-signal-input { flex: 1; }
.live-icon-buy { color: #22c55e; }
.live-icon-fav { color: #f59e0b; }

/* Live columns list */
.live-col-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.live-col-label { width: 80px; flex-shrink: 0; }
.live-col-expr  { flex: 1; }
.live-col-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }

/* ── Results toolbar ─────────────────────────────────────────────────── */
.live-results-toolbar { border-radius: var(--radius, 12px); }

/* ── Card grid ───────────────────────────────────────────────────────── */
.live-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));  /* U9 fix */
  gap: 8px;
}
@media (max-width: 600px) { .live-results-grid { grid-template-columns: 1fr; } }

.live-result-card {
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s;
}
.live-result-card.is-buy { border-color: rgba(34,197,94,.5); }
.live-result-card.is-fav { border-color: rgba(245,158,11,.5); }

.lrc-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.lrc-sym { font-weight: 700; font-size: 14px; color: var(--text); flex: 1; }
.lrc-badges { display: flex; gap: 2px; }
.lrc-change { font-size: 12px; font-weight: 600; white-space: nowrap; }

.lrc-ohlc {
  display: flex; gap: 10px; font-size: 11px; color: var(--muted);
  font-family: var(--mono, monospace); flex-wrap: wrap;
}
.lrc-ohlc strong { color: var(--text); }

.lrc-cols {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px; font-size: 11px; color: var(--text);
}
.lrc-col-item em { color: var(--muted); font-style: normal; margin-right: 2px; }

/* ── Table view ──────────────────────────────────────────────────────── */
.live-results-table-wrap { overflow-x: auto; border-radius: 10px; }
.live-results-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; font-family: var(--mono, monospace);
}
.live-results-table th {
  text-align: left; padding: 8px 10px;
  background: var(--surface-2); color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.live-results-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.live-results-table tr:last-child td { border-bottom: none; }
.live-results-table tr:hover td { background: var(--surface-2); }
.lrc-sym-td { font-weight: 700; }

/* ── Positive / negative colours ─────────────────────────────────────── */
.live-pos { color: #22c55e; }
.live-neg { color: #f43f5e; }

/* ── Signal chip rows ────────────────────────────────────────────────── */
.live-signals-surface { border-radius: var(--radius, 12px); }
.live-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.live-chip {
  padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.chip-buy { background: rgba(34,197,94,.12); color: #22c55e; }
.chip-fav { background: rgba(245,158,11,.12); color: #f59e0b; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.live-badge {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.live-badge-primary { background: var(--accent-muted, rgba(129,140,248,.12)); color: var(--accent, #818cf8); }
.live-badge-green   { background: rgba(34,197,94,.12);  color: #22c55e; }
.live-badge-amber   { background: rgba(245,158,11,.12); color: #f59e0b; }

/* ── Builder card: timeframe chip + live button ──────────────────────── */
.card-tf-btn {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 3px 8px;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
  cursor: pointer;
}
.card-tf-label { font-family: var(--mono, monospace); font-size: 11px; }
.card-live-btn {
  display: inline-flex; align-items: center;
  padding: 4px 6px; border-radius: 6px; border: none;
  background: rgba(34,197,94,.1); color: #22c55e; cursor: pointer;
}
.card-live-btn:hover { background: rgba(34,197,94,.2); }

/* ── Empty state ─────────────────────────────────────────────────────── */
.live-empty {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  padding: 40px 20px; color: var(--muted);
  font-size: 13px; text-align: center;
}

/* ── Mobile safety ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .live-status-bar { gap: 8px; padding: 8px 10px; }
  .live-stat, .live-eval-rate { width: 100%; margin-left: 0; }
  .live-results-grid { grid-template-columns: 1fr; }
  .lrc-ohlc { gap: 6px; }
  .topbar-wrapper { padding: 6px 8px; }
  .icon-item { min-width: 44px; padding: 5px 7px; }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
  .topbar-region { padding-left: max(0px, env(safe-area-inset-left));
                   padding-right: max(0px, env(safe-area-inset-right)); }
}
/* dsl-editor.css — append to style.css */

/* ═══════════════════════════════════════════════════════════════════
   Z-INDEX SCALE (canonical — override any conflicting declarations)
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --z-base:        0;
  --z-subtopbar:   10;
  --z-dropdown:    50;
  --z-topbar:      100;
  --z-toast:       150;
  --z-modal-old:   200;   /* legacy .ov modals, being phased out */
  --z-dse:         400;   /* DSL editor overlay */
  --z-vidura:      450;   /* Vidura AI panel */
  --z-loading:     500;
}

/* ═══════════════════════════════════════════════════════════════════
   DSL EDITOR OVERLAY
   ═══════════════════════════════════════════════════════════════════ */

.dse-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-dse);
  display: flex;
  flex-direction: column;
  background: var(--bg, #0f0f18);
  overflow: hidden;
  /* Entry animation */
  animation: dse-slide-in 0.22s cubic-bezier(.4,0,.2,1);
}
@keyframes dse-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.dse-topbar-wrap {
  flex-shrink: 0;
  position: relative;
}
.dse-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
  background: var(--surface, #1a1a2e);
}

/* Scrollable tab strip */
.dse-tab-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  min-width: 0;
}
.dse-tab-scroll::-webkit-scrollbar { display: none; }
.dse-tab-sep { flex-shrink: 0; width: 1px; height: 22px;
               background: var(--border, rgba(255,255,255,0.1)); margin: 0 4px; }

.dse-tab {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: 8px; border: none;
  background: transparent;
  color: var(--muted, #777);
  font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, color .14s;
}
.dse-tab svg { width: 14px; height: 14px; stroke-width: 2; flex-shrink: 0; }
.dse-tab:hover { background: var(--surface-2, rgba(255,255,255,0.05)); color: var(--text, #e0e0e0); }
.dse-tab.active {
  background: var(--accent-muted, rgba(129,140,248,0.14));
  color: var(--accent, #818cf8);
}

/* Action buttons (right side of topbar) */
.dse-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dse-action-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  border-radius: 8px; border: none;
  background: transparent;
  color: var(--muted, #777);
  font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.dse-action-btn svg { width: 15px; height: 15px; stroke-width: 2; }
.dse-action-btn:hover { background: var(--surface-2); color: var(--text, #e0e0e0); }

.dse-label { white-space: nowrap; }
@media (max-width: 500px) { .dse-label { display: none; } }

.dse-apply-btn {
  background: var(--accent-muted, rgba(129,140,248,0.14));
  color: var(--accent, #818cf8);
}
.dse-apply-btn:hover { background: var(--accent, #818cf8); color: #fff; }
.dse-close-btn:hover { background: rgba(244,63,94,0.12); color: #f43f5e; }

.dse-vidura-btn.active {
  background: linear-gradient(135deg,
    rgba(34,197,94,0.18),
    rgba(129,140,248,0.18));
  color: #86efac;
}

/* ── Metrics dropdown panel ──────────────────────────────────────── */
.dse-metrics-panel {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 10;
  background: var(--surface, #1a1a2e);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.dse-metrics-search {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px; font-family: inherit;
  outline: none; margin-bottom: 10px;
}
.dse-metrics-search:focus { border-color: var(--accent, #818cf8); }
.dse-metrics-grid {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 180px; overflow-y: auto;
}
.dse-metric-chip {
  padding: 4px 11px; border-radius: 6px; border: none;
  background: var(--surface-2); color: var(--text);
  font-size: 12px; font-family: var(--mono, monospace);
  cursor: pointer;
  transition: background .13s;
}
.dse-metric-chip:hover { background: var(--accent-muted); color: var(--accent); }
.dse-metric-chip.is-fn { color: var(--accent-2, #34d399); }

/* ── Body layout ─────────────────────────────────────────────────── */
.dse-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}
.dse-editor-pane {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.dse-editor-meta {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 4px;
  font-size: 11px; color: var(--muted);
  flex-shrink: 0;
}
.dse-mode-label { font-weight: 600; color: var(--text); }
.dse-char-count { margin-left: auto; }
.dse-validity { font-size: 11px; }
.dse-validity.ok  { color: #22c55e; }
.dse-validity.err { color: #f43f5e; }

/* CodeMirror container — fills the pane */
.dse-cm-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.dse-cm-wrap .CodeMirror {
  height: 100% !important;
  font-family: 'Source Code Pro', 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 14px !important;
  line-height: 1.65 !important;
  background: transparent !important;
  color: var(--text, #e0e0e0) !important;
  padding: 10px 0;
}
.dse-cm-wrap .CodeMirror-scroll { padding: 0 14px; box-sizing: border-box; }
.dse-cm-wrap .CodeMirror-cursor { border-left: 2px solid var(--accent, #818cf8) !important; }
/* DSL syntax highlighting */
.cm-klines-keyword  { color: #818cf8; font-weight: 600; }   /* and or not */
.cm-klines-fn       { color: #34d399; }                     /* sma rsi ema … */
.cm-klines-field    { color: #f0abfc; }                     /* close open high low volume */
.cm-klines-number   { color: #fb923c; }
.cm-klines-op       { color: #94a3b8; }                     /* > < = */
.cm-klines-paren    { color: #e2e8f0; }
.cm-klines-var      { color: #fbbf24; font-style: italic; } /* let-vars */
.cm-klines-err      { text-decoration: underline wavy #f43f5e; }

/* Token tooltip */
.dse-token-tip {
  position: absolute; z-index: 20;
  background: var(--surface, #1e1e2e);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px;
  font-size: 12px; max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: none;
}
.dse-token-tip-name { font-weight: 700; color: var(--text); margin-bottom: 3px; }
.dse-token-tip-sig  { font-family: var(--mono, monospace); color: var(--accent); font-size: 11px; }
.dse-token-tip-desc { color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* ── Reference panel ─────────────────────────────────────────────── */
.dse-ref-panel {
  width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
@media (max-width: 640px) {
  .dse-ref-panel {
    position: absolute; inset: 0; width: 100%; z-index: 5;
    border-left: none;
  }
}
.dse-ref-header {
  display: flex; align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dse-ref-title { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.dse-ref-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: transparent; color: var(--muted); cursor: pointer;
}
.dse-ref-close:hover { background: var(--surface-2); }
.dse-ref-close svg { width: 14px; height: 14px; }
.dse-ref-tabs {
  display: flex; gap: 2px; padding: 6px 8px; flex-shrink: 0;
}
.dse-ref-tab {
  flex: 1; padding: 5px 6px; border-radius: 6px; border: none;
  background: transparent; color: var(--muted);
  font-size: 11px; font-family: inherit; font-weight: 500; cursor: pointer;
  transition: background .13s, color .13s;
}
.dse-ref-tab.active { background: var(--accent-muted); color: var(--accent); }
.dse-ref-body {
  flex: 1; overflow-y: auto; padding: 8px;
  font-size: 12px; color: var(--text);
}
.dse-ref-section { margin-bottom: 14px; }
.dse-ref-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.dse-ref-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; margin-bottom: 2px;
  transition: background .13s;
}
.dse-ref-item:hover { background: var(--surface-2); }
.dse-ref-item-name { font-family: var(--mono); color: var(--accent); font-size: 12px; }
.dse-ref-item-desc { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ── Bottom bar: operator/field chips ────────────────────────────── */
.dse-bottom-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 8px;
}
.dse-chip-scroll {
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  /* U11 fix: fade gradient to signal more chips off-screen */
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
          mask-image: linear-gradient(to right, black 85%, transparent 100%);
}
.dse-chip-scroll::-webkit-scrollbar { display: none; }
.dse-chip {
  flex-shrink: 0;
  padding: 4px 10px; border-radius: 6px; border: none;
  background: var(--surface-2); color: var(--text);
  font-size: 12px; font-family: var(--mono, monospace);
  cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.dse-chip:hover { background: var(--accent-muted); color: var(--accent); }
.dse-chip-fn { color: #34d399; }
.dse-chip-fn:hover { background: rgba(52,211,153,0.12); }
.dse-chip-sep { flex-shrink: 0; width: 1px; height: 18px;
                background: var(--border); margin: 0 2px; }

/* ── DSL Autocomplete dropdown ───────────────────────────────────── */
.dse-ac {
  position: fixed; z-index: calc(var(--z-dse) + 5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 200px; max-width: 320px;
  max-height: 220px; overflow-y: auto;
  font-size: 13px;
}
.dse-ac-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 12px; cursor: pointer;
  transition: background .1s;
}
.dse-ac-item:hover, .dse-ac-item.selected {
  background: var(--accent-muted, rgba(129,140,248,0.14));
}
.dse-ac-name {
  font-family: var(--mono, monospace); font-weight: 600;
  color: var(--text); flex-shrink: 0;
}
.dse-ac-name mark { background: transparent; color: var(--accent); font-weight: 800; }
.dse-ac-sig  { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.dse-ac-type { font-size: 10px; color: var(--accent-2, #34d399);
               margin-left: auto; flex-shrink: 0; }


/* ═══════════════════════════════════════════════════════════════════
   VIDURA AI PANEL
   Floats inside (or next to) the DSL editor overlay.
   ═══════════════════════════════════════════════════════════════════ */
.vidura-panel {
  position: fixed;
  bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));  /* U10 fix */
  right: 16px;
  width: 360px;
  max-height: calc(100vh - 120px);
  z-index: var(--z-vidura);
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: vidura-appear 0.2s cubic-bezier(.4,0,.2,1);
}
@keyframes vidura-appear {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
@media (max-width: 480px) {
  .vidura-panel {
    bottom: 0; right: 0; left: 0; width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
  }
}

.vidura-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg,
    rgba(52,211,153,0.07), rgba(129,140,248,0.07));
}
.vidura-glyph {
  font-size: 18px; color: #86efac;
  font-weight: 700; flex-shrink: 0;
}
.vidura-title { font-size: 14px; font-weight: 700; color: var(--text); }
.vidura-sub   { font-size: 11px; color: var(--muted); margin-left: 2px; }
.vidura-close {
  margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
}
.vidura-close:hover { background: var(--surface-2); }
.vidura-close svg { width: 14px; height: 14px; }

.vidura-chat {
  flex: 1; overflow-y: auto;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.vidura-bubble {
  padding: 9px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.5;
  max-width: 92%;
}
.vidura-bot {
  background: var(--surface-2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.vidura-user {
  background: var(--accent-muted, rgba(129,140,248,0.15));
  color: var(--text);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.vidura-result {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.2);
  color: #86efac;
  font-family: var(--mono, monospace); font-size: 12px;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  word-break: break-all;
}
.vidura-bubble em { color: var(--muted); font-style: normal; font-size: 12px; }

/* Ink vanish/appear (ported from dexkit voldemort) */
.vidura-ink-wrap.ink-vanish {
  -webkit-mask-image: linear-gradient(to right, transparent 45%, black 50%, black 55%);
          mask-image: linear-gradient(to right, transparent 45%, black 50%, black 55%);
  -webkit-mask-size: 300% 100%; mask-size: 300% 100%;
  animation: diaryVanish 1.6s ease-in-out forwards;
}
.vidura-ink-wrap.ink-appear {
  -webkit-mask-image: linear-gradient(to right, black 45%, transparent 50%, transparent 55%);
          mask-image: linear-gradient(to right, black 45%, transparent 50%, transparent 55%);
  -webkit-mask-size: 300% 100%; mask-size: 300% 100%;
  animation: diaryAppear 1.6s ease-in-out forwards;
}
@keyframes diaryVanish {
  0%   { -webkit-mask-position:100% 0; mask-position:100% 0; }
  100% { -webkit-mask-position:0%   0; mask-position:0%   0; }
}
@keyframes diaryAppear {
  0%   { -webkit-mask-position:100% 0; mask-position:100% 0; }
  100% { -webkit-mask-position:0%   0; mask-position:0%   0; }
}

.vidura-loading {
  padding: 12px 14px; flex-shrink: 0;
}
.vidura-thinking { font-size: 12px; color: var(--muted); }
.vidura-dots { display: inline-flex; gap: 4px; margin-right: 8px; }
.vidura-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent, #818cf8);
  animation: dot-bounce 1.2s infinite;
}
.vidura-dots span:nth-child(2) { animation-delay: .2s; }
.vidura-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-bounce {
  0%,80%,100% { transform: scale(1);   opacity: .5; }
  40%          { transform: scale(1.4); opacity: 1;  }
}

.vidura-input-row {
  display: flex; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.vidura-textarea {
  flex: 1; resize: none;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  color: var(--text); font-size: 13px; font-family: inherit;
  outline: none; line-height: 1.5;
}
.vidura-textarea:focus { border-color: var(--accent, #818cf8); }
.vidura-send {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px; border: none;
  background: var(--accent-muted); color: var(--accent); cursor: pointer;
  flex-shrink: 0; align-self: flex-end;
  transition: background .13s;
}
.vidura-send:hover { background: var(--accent); color: #fff; }
.vidura-send svg { width: 15px; height: 15px; }
.vidura-footer {
  padding: 4px 14px 10px;
  font-size: 10px; color: var(--muted); text-align: center; flex-shrink: 0;
}

/* ── Vidura button active glow (topbar) ──────────────────────────── */
#dse-vidura-btn.active {
  background: linear-gradient(135deg, rgba(52,211,153,0.15), rgba(129,140,248,0.15));
  color: #86efac;
}

/* ── Builder card patches (audit fixes) ──────────────────────────── */
/* Remove "insert number" — just add display:none to #insert-num-btn */
#insert-num-btn, .btn-insert-num { display: none !important; }

/* Subtopbar: scrollable, no clip */
.builder-subtopbar {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  flex-wrap: nowrap !important;
}
.builder-subtopbar::-webkit-scrollbar { display: none; }

/* Single ctx bar replaces all the fragmented tertiary bars */
#builder-ctx-bar {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px;
  overflow-x: auto; scrollbar-width: none;
}
#builder-ctx-bar::-webkit-scrollbar { display: none; }

/* Card action overflow menu */
.card-action-overflow {
  position: relative;
}
.card-overflow-menu {
  display: none;
  position: absolute; top: 100%; right: 0; z-index: var(--z-dropdown);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 4px;
}
.card-action-overflow.open .card-overflow-menu { display: block; }
.card-overflow-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px; border: none;
  width: 100%; background: transparent;
  color: var(--text); font-size: 12px; font-family: inherit;
  cursor: pointer;
  transition: background .12s;
}
.card-overflow-item:hover { background: var(--surface-2); }
.card-overflow-item svg { width: 13px; height: 13px; color: var(--muted); }
