/* =====================================================================
   Boltify theme for Xedap SDUI CMS
   Reference: https://boltify.omtanke.studio/sales (React + Tailwind admin)
   - Urbanist, 13px base, zinc neutrals, soft blue brand accent, blue actions
   - Light only: layouts set <html data-theme="light">. The dark tokens
     below are kept unused in case a dark mode is wanted later.
   Loaded AFTER app.css (and any page @push('head') styles) so it wins
   without touching existing class names.
   ===================================================================== */

/* ---------- tokens ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;            /* zinc-950: content canvas + cards */
  --side: #18181b;          /* zinc-900: sidebar, header, frame */
  --card: #09090b;
  --panel-2: #18181b;       /* tiles, inputs, inner panels */
  --hover: rgba(113, 113, 122, .15);
  --line: rgba(113, 113, 122, .25);
  --line-strong: #27272a;   /* zinc-800 */
  --input: #18181b;
  --input-line: #3f3f46;    /* zinc-700 */
  --th: rgba(24, 24, 27, .9);
  --text: #e4e4e7;          /* zinc-200 */
  --text-strong: #fafafa;
  --muted: #71717a;         /* zinc-500 */
  --muted-2: #a1a1aa;       /* zinc-400 */
  --brand: #dbeafe;         /* soft blue (blue-100) */
  --brand-strong: #60a5fa;  /* blue-400: lines/accents */
  --brand-ink: #1d4ed8;     /* blue-700 text/icons on --brand */
  --primary: #3b82f6;       /* blue-500 */
  --primary-2: #2563eb;
  --primary-soft: rgba(59, 130, 246, .15);
  --ok: #10b981; --ok-soft: rgba(16, 185, 129, .12);
  --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .12);
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .12);
  --violet: #8b5cf6; --violet-soft: rgba(139, 92, 246, .14);
  --sky: #0ea5e9; --sky-soft: rgba(14, 165, 233, .14);
  --rose: #f43f5e; --rose-soft: rgba(244, 63, 94, .14);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --radius: 12px;
  --canvas: #18181b;
  --canvas-dot: rgba(113, 113, 122, .25);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f4f4f5;          /* zinc-100 */
  --card: #ffffff;
  --panel-2: #f4f4f5;
  --hover: rgba(113, 113, 122, .1);
  --line: rgba(113, 113, 122, .18);
  --line-strong: #e4e4e7;
  --input: #f4f4f5;
  --input-line: #e4e4e7;
  --th: rgba(24, 24, 27, .05);
  --text: #27272a;
  --text-strong: #09090b;
  --muted: #71717a;
  --muted-2: #52525b;
  --primary-soft: rgba(59, 130, 246, .1);
  --ok: #059669; --ok-soft: rgba(16, 185, 129, .1);
  --danger: #dc2626; --danger-soft: rgba(239, 68, 68, .1);
  --warn: #d97706; --warn-soft: rgba(245, 158, 11, .12);
  --violet: #7c3aed; --sky: #0284c7; --rose: #e11d48;
  --shadow: 0 12px 32px rgba(24, 24, 27, .12);
  --canvas: #f4f4f5;
  --canvas-dot: #d4d4d8;
}

/* ---------- base ---------- */
html { font-size: 13px; }
body {
  font-family: Urbanist, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--side);
  -webkit-font-smoothing: antialiased;
}
b, strong, h1, h2, h3, h4 { color: var(--text-strong); }
.muted { color: var(--muted); }
::selection { background: rgba(96, 165, 250, .3); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---------- shell ---------- */
.app { background: var(--side); }
.sidebar {
  width: 260px;
  background: var(--side);
  border-right: 0;
  padding: 0 13px 0;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.brand {
  height: 64px;
  margin: 0 -13px 6px;
  padding: 0 20px;
  border-bottom: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text-strong);
  justify-content: space-between;
}
.brand .brand-name { display: flex; align-items: center; gap: 8px; }
.brand .brand-name small { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-top: 6px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand); color: var(--brand-ink);
  font-size: 15px;
}
.brand .collapse { color: var(--muted); font-size: 14px; }

.menu-search {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 12px;
  color: var(--muted);
}
.menu-search input::placeholder { color: var(--muted); }
.kbd { border-color: var(--line); background: transparent; color: var(--muted); border-radius: 6px; }

/* Boltify-style 2x2 quick tiles */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.quick-grid a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 8px; border-radius: var(--radius);
  background: var(--bg); color: var(--muted);
  font-size: 12.5px; transition: background .2s, color .2s;
}
.quick-grid a i { font-size: 17px; }
.quick-grid a:hover { color: var(--text-strong); background: var(--hover); }
.quick-grid a.active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.quick-grid a.active:hover { background: color-mix(in srgb, var(--brand) 75%, transparent); }

.nav-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.4px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 4px;
  padding: 4px 12px;
}
.nav a {
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.nav a i { color: inherit; width: 18px; font-size: 14px; }
.nav a:hover { background: transparent; color: var(--text-strong); }
.nav a.active { background: transparent; border-color: var(--line-strong); color: var(--text-strong); font-weight: 500; }
.nav a.active i { color: inherit; }
.nav a .count {
  background: var(--brand); color: var(--brand-ink);
  border-radius: 8px; padding: 1px 8px; font-weight: 600;
}

.side-foot {
  margin: auto -13px 0; padding: 10px 13px 12px;
  position: sticky; bottom: 0; background: var(--side);
}
.side-foot .side-icons { display: flex; justify-content: space-between; padding: 6px 4px 10px; }
.side-foot .side-icons a, .side-foot .side-icons button {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); background: none; border: 0; cursor: pointer;
}
.side-foot .side-icons a:hover, .side-foot .side-icons button:hover { color: var(--text-strong); background: var(--hover); }
.side-foot .side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: var(--radius); background: var(--bg); color: var(--muted);
}
.side-foot .side-user b { display: block; font-weight: 600; font-size: 13px; }
.side-foot .side-user small { font-size: 11.5px; }

/* main column framed like Boltify (sidebar color wraps the canvas) */
.main {
  background: var(--bg);
  border-right: 13px solid var(--side);
  min-height: 100vh;
}
.topbar {
  height: auto;
  min-height: 48px;
  margin: 8px 8px 0;
  padding: 10px 16px;
  top: 8px;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--side) 75%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .05);
}
.topbar .crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.topbar .crumb a:hover { color: var(--text-strong); }
.topbar .crumb .sep { opacity: .6; }
.topbar .crumb .cur { color: var(--text-strong); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.topbar .search { background: transparent; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.pill {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; font-weight: 500;
}
.pill:hover { border-color: color-mix(in srgb, var(--muted) 60%, transparent); color: var(--text-strong); }
.icon-btn { color: var(--muted); border-radius: 10px; width: 34px; height: 34px; }
.icon-btn:hover { background: var(--hover); color: var(--text-strong); }
.icon-btn .dot { background: var(--danger); top: 3px; right: 3px; }
.user { color: var(--text-strong); font-weight: 600; }
.user small { color: var(--muted); }
.avatar { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--brand-ink); font-weight: 700; }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="light"] .theme-toggle .fa-sun { display: inline-block; }
:root[data-theme="light"] .theme-toggle .fa-moon { display: none; }

.content { padding: 20px 20px 48px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 700; color: var(--text-strong); }
.page-head h1 i { color: var(--muted); }
.page-head .sub { color: var(--muted); }

/* ---------- hero / dashboard ---------- */
.hero {
  background:
    radial-gradient(600px 220px at 100% 0%, rgba(96, 165, 250, .16), transparent 60%),
    var(--panel-2);
  color: var(--text-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.hero:after { border-color: var(--line); box-shadow: 0 0 0 30px rgba(113, 113, 122, .04); }
.hero h2 { color: var(--text-strong); font-weight: 800; font-size: 20px; }
.hero small { color: var(--muted); opacity: 1; }
.hero .ava { background: var(--brand); color: var(--brand-ink); }
.hero .chip { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 10px; }

/* ---------- cards ---------- */
.grid { gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.section-title { color: var(--text-strong); font-weight: 700; }
.section-title:before { background: var(--brand-strong); }

.stat { border-top: 1px solid var(--line); }
.stat .val { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -.01em; }
.stat .ic { border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); }
.stat.blue .ic { background: var(--primary-soft); color: var(--primary); }
.stat.amber .ic { background: var(--warn-soft); color: var(--warn); }
.stat.violet .ic { background: var(--violet-soft); color: var(--violet); }
.stat.rose .ic { background: var(--rose-soft); color: var(--rose); }

.tile, .lvl {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .2s;
}
a.tile:hover, a.lvl:hover { border-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.tile .lbl { color: var(--muted); }
.tile .big, .lvl b { font-weight: 800; color: var(--text-strong); }
.lvl-arrow { color: var(--muted); }
.progress { background: var(--line); }
.progress > span { background: var(--primary); }

/* ---------- buttons ---------- */
.btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-weight: 500;
  transition: border-color .2s, background .2s, color .2s;
}
.btn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--muted) 60%, transparent); color: var(--text-strong); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; }
.btn.sm { border-radius: 8px; }

/* ---------- badges ---------- */
.badge, .role-badge, .pstat, .role-chip {
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
}
.badge { background: var(--hover); color: var(--muted-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

.pstat.live { background: var(--ok-soft); color: var(--ok); }
.pstat.live i { background: var(--ok); }
.pstat.changed { background: var(--warn-soft); color: var(--warn); }
.pstat.changed i { background: var(--warn); }
.pstat.never { background: var(--hover); color: var(--muted-2); }
.pstat.never i { background: var(--muted); }
.pstat.off { background: var(--danger-soft); color: var(--danger); }
.pstat.off i { background: var(--danger); }

.role-badge.admin { background: var(--violet-soft); color: var(--violet); }
.role-badge.publisher { background: var(--ok-soft); color: var(--ok); }
.role-badge.editor { background: var(--primary-soft); color: var(--primary); }
.role-badge.viewer, .role-chip { background: var(--hover); color: var(--muted-2); }

/* ---------- table ---------- */
table.tbl { border-collapse: separate; border-spacing: 0; }
.tbl th {
  background: var(--th);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 0;
}
.tbl thead th:first-child { border-radius: 8px 0 0 8px; }
.tbl thead th:last-child { border-radius: 0 8px 8px 0; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--hover) 50%, transparent); }

/* ---------- forms ---------- */
.field label { color: var(--muted-2); font-weight: 500; }
.input, .field input, .field select, .field textarea,
.cond input, .cond select, .frow input, .frow select,
textarea.json-ed, .pf input, .pf select, .pf textarea {
  background: var(--input);
  border: 1px solid var(--input-line);
  border-radius: 8px;
  color: var(--text-strong);
  transition: border-color .2s, box-shadow .2s;
}
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: var(--primary); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus,
.cond input:focus, .cond select:focus, .frow input:focus, .frow select:focus, textarea.json-ed:focus,
.pf input:focus, .pf select:focus, .pf textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: 0;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
select option { background: var(--side); color: var(--text); }

.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-radius: var(--radius); }
.flash.err { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- dialogs & menus ---------- */
dialog {
  background: var(--side);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(9, 9, 11, .6); backdrop-filter: blur(4px); }
dialog .mh { border-bottom-color: var(--line); color: var(--text-strong); font-weight: 700; }
dialog .mf { border-top-color: var(--line); }

.user-dd, .more .menu, .dd-menu {
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.user-dd button, .more .menu a, .more .menu button, .dd-menu a, .dd-menu button { color: var(--text); }
.user-dd button:hover, .more .menu a:hover, .more .menu button:hover, .dd-menu a:hover, .dd-menu button:hover { background: var(--hover); color: var(--text-strong); }

.readonly-note { background: var(--panel-2); border-color: var(--line); color: var(--text); border-radius: var(--radius); }
.notice { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--text); border-radius: var(--radius); }

/* ---------- publish guide ---------- */
.flow3 .st { background: var(--panel-2); border-color: var(--line); }
.flow3 .st p { color: var(--muted-2); }
.flow3 .st.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.flow3 .ar { color: var(--muted); }

/* ---------- component library / previews ---------- */
.empty { color: var(--muted); }
.comp-preview { background: #f4f4f5; }          /* SDUI previews stay on a light canvas */
.phone-mini { border-color: #27272a; background: #fff; }
.lib-tabs { background: var(--panel-2); border-color: var(--line); border-radius: var(--radius); }
.lib-tabs button { color: var(--muted); }
.lib-tabs button:hover { color: var(--text-strong); }
.lib-tabs button.on { background: var(--primary); color: #fff; }
.lib-tabs button .n { background: var(--hover); color: var(--muted-2); }
.lib-tabs button.on .n { background: rgba(255, 255, 255, .2); color: #fff; }
.lib-search { background: transparent; border-color: var(--line); }
.lib-search input { color: var(--text-strong); }
.cc { background: var(--card); border-color: var(--line); border-radius: var(--radius); }
.cc:hover { border-color: color-mix(in srgb, var(--muted) 60%, transparent); box-shadow: var(--shadow); }
.cc .pv { background: #f4f4f5 radial-gradient(#d4d4d8 1px, transparent 1px) 0 0/14px 14px; border-bottom-color: var(--line); }
.cc .props span { background: var(--hover); color: var(--muted-2); }
.cc .ft { background: var(--panel-2); border-top-color: var(--line); }
.cc .lv { box-shadow: none; border-radius: 8px; }
.lv.atom { background: #e0f2fe; color: #0369a1; }
.bulkbar { background: var(--side); color: var(--text-strong); border: 1px solid var(--line); box-shadow: var(--shadow); }
.bulkbar .btn { background: var(--bg); color: var(--text); }

/* ---------- variants / versions / samples page styles ---------- */
.v-card, .ver, .sm-item { background: var(--card); border-color: var(--line); border-radius: var(--radius); }
.v-card.def { border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: linear-gradient(180deg, var(--primary-soft), transparent 70%); }
.v-card.hit { outline-color: var(--ok); }
.ver.live { border-color: color-mix(in srgb, var(--ok) 55%, transparent); box-shadow: 0 0 0 3px var(--ok-soft); }
.ver.draft { border-color: color-mix(in srgb, var(--primary) 50%, transparent); background: var(--primary-soft); }
.ver .lock, .sec-title { color: var(--muted); }
.dot.rollback { background: var(--warn-soft); color: var(--warn); }
.dot.unpublish { background: var(--danger-soft); color: var(--danger); }
.flow { color: var(--text); }
code.k { background: var(--hover); color: var(--text-strong); }
.result { background: var(--ok-soft); color: var(--ok); }
.cond .and { color: var(--muted); }
.sm-item:hover { border-color: var(--primary); }
.sm-item .path { color: var(--muted-2); }
.path-input { background: var(--input); border-color: var(--input-line); border-radius: 8px; }
.path-input span { background: var(--panel-2); color: var(--muted); border-right-color: var(--input-line); }
.path-input input { background: transparent; color: var(--text-strong); }
.url-line { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.tabs-sm button { color: var(--muted); }
pre.dark { background: #0c0c0e; color: #e4e4e7; border: 1px solid var(--line); }
.copy-btn { background: #27272a; color: #d4d4d8; }
.dirty { color: var(--warn); }
:root:not([data-theme="light"]) .mth { background: var(--sky-soft); color: #38bdf8; }
:root:not([data-theme="light"]) .mth.POST { background: var(--ok-soft); color: #34d399; }
:root:not([data-theme="light"]) .mth.PUT, :root:not([data-theme="light"]) .mth.PATCH { background: var(--warn-soft); color: #fbbf24; }
:root:not([data-theme="light"]) .mth.DELETE { background: var(--danger-soft); color: #f87171; }
:root:not([data-theme="light"]) .lv.atom { background: #082f49; color: #7dd3fc; }
:root:not([data-theme="light"]) .lv.molecule { background: #2e1065; color: #c4b5fd; }
:root:not([data-theme="light"]) .lv.organism { background: #451a03; color: #fcd34d; }

/* ---------- dark: neutralise light inline colours used in views ---------- */
:root:not([data-theme="light"]) [style*="background:#fff;"],
:root:not([data-theme="light"]) [style*="background:#f3f5f8"],
:root:not([data-theme="light"]) [style*="background:#f3f4f6"],
:root:not([data-theme="light"]) [style*="background:#f1f3f6"] { background: var(--panel-2) !important; color: var(--text) !important; }
:root:not([data-theme="light"]) [style*="background:#e0f2fe"] { background: var(--sky-soft) !important; color: #38bdf8 !important; }
:root:not([data-theme="light"]) [style*="background:#ede9fe"] { background: var(--violet-soft) !important; color: #a78bfa !important; }
:root:not([data-theme="light"]) [style*="background:#fef3c7"] { background: var(--warn-soft) !important; color: #fbbf24 !important; }
:root:not([data-theme="light"]) [style*="background:#e7f6ec"],
:root:not([data-theme="light"]) [style*="background:#f0fdf4"] { background: var(--ok-soft) !important; color: #34d399 !important; }
:root:not([data-theme="light"]) [style*="background:#ffe4e6"] { background: var(--rose-soft) !important; color: #fb7185 !important; }
:root:not([data-theme="light"]) [style*="color:#374151"] { color: var(--text) !important; }
:root:not([data-theme="light"]) [style*="color:#6d28d9"] { color: #a78bfa !important; }
:root:not([data-theme="light"]) [style*="color:#b45309"] { color: #fbbf24 !important; }
/* component form preview keeps a white "device" so SDUI output reads correctly */
:root:not([data-theme="light"]) .stage[style*="background:#fff"] { background: #fff !important; color: #111 !important; }

/* =====================================================================
   Builder (screens/builder) — full-screen editor
   ===================================================================== */
body.builder { background: var(--bg); }
.b-top { background: var(--side); border-bottom: 1px solid var(--line); }
.logo-sm { background: var(--brand); color: var(--brand-ink); border-radius: 9px; }
.name-input { background: transparent; color: var(--text-strong); }
.name-input:hover, .name-input:focus { border-color: var(--input-line); }
.bt-meta .sep { color: var(--muted); }
.dotc { background: var(--muted); }
.dotc.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.variant-pick { border-color: var(--line); color: var(--muted); border-radius: 10px; }
.variant-pick select { color: var(--text-strong); }
.variant-pick a { color: var(--muted); }
.variant-pick a:hover { background: var(--hover); color: var(--text-strong); }
.bt-group { border-color: var(--line); }
.seg { background: var(--hover); border-radius: var(--radius); }
.seg button { color: var(--muted-2); }
.seg button.on { background: var(--primary); color: #fff; box-shadow: none; }
.b-left, .b-right { background: var(--side); }
.b-left { border-right-color: var(--line); }
.b-right { border-left-color: var(--line); }
.tabs { border-bottom-color: var(--line); }
.tabs button { color: var(--muted); }
.tabs button.on { color: var(--text-strong); border-color: var(--brand-strong); }
.b-search { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.b-search input { color: var(--text-strong); }
.b-hint { border-top-color: var(--line); }
.palette .grp { color: var(--muted); }
.pal-item { background: var(--bg); border-color: var(--line); color: var(--text); }
.pal-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.pal-item.molecule i { color: var(--violet); }
.pal-item.organism i { color: var(--warn); }
.b-center { background: var(--canvas) radial-gradient(var(--canvas-dot) 1px, transparent 1px) 0 0/18px 18px; }
.phone { border-color: #27272a; background: #fff; box-shadow: 0 30px 60px rgba(0, 0, 0, .45); }
.crumbs { color: var(--muted-2); }
.crumbs span { background: var(--side); border-color: var(--line); }
.layers ul { border-left-color: var(--line); }
.layer-row:hover { background: var(--hover); }
.layer-row.sel { background: var(--primary-soft); color: var(--primary); }
.layer-row i.t { color: var(--muted); }
.layer-row .tp, .layer-row .tg { color: var(--muted); }
.p-sec { border-bottom-color: var(--line); }
.p-sec h4, .pf label { color: var(--muted); }
.toast { background: var(--text-strong); color: var(--bg); }
.ctx-bar { background: var(--side); border-color: var(--line); box-shadow: none; }
.ctx-bar.live { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: var(--ok-soft); }
.ctx-text { color: var(--text); }
body.viewing-live .phone { border-color: #15803d; }
.pub-flow > div { border-color: var(--line); }
.pub-flow > div.new { border-color: var(--primary); background: var(--primary-soft); }
.pub-flow > i { color: var(--muted); }

/* =====================================================================
   Login (auth/login)
   ===================================================================== */
body.auth { background: var(--bg) !important; }
body.auth .login-side {
  background:
    radial-gradient(520px 320px at 0% 100%, rgba(96, 165, 250, .18), transparent 65%),
    var(--side);
  color: var(--text-strong);
  border-right: 1px solid var(--line);
}
body.auth .login-side:after { border-color: var(--line); box-shadow: 0 0 0 40px rgba(113, 113, 122, .04); }
body.auth .login-side p { color: var(--muted-2); opacity: 1; }
body.auth .login-side li i { background: var(--bg); border: 1px solid var(--line); color: var(--brand-ink); }
body.auth .login-side .brand { color: var(--text-strong) !important; justify-content: flex-start; gap: 10px; font-size: 20px; }
body.auth .login-side .brand .logo { background: var(--brand) !important; color: var(--brand-ink); }
body.auth .login-box {
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
}
body.auth .login-box h2 { font-weight: 800; }
body.auth .pw-wrap button { color: var(--muted); }

@media (max-width: 900px) {
  .main { border-right-width: 0; }
  .topbar { margin: 6px 6px 0; }
}

.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* keep the HTML `hidden` attribute working on flex elements (.btn etc.) */
[hidden] { display: none !important; }

/* sidebar: brand/search/tiles stay fixed, only the nav scrolls, footer never covers items */
.sidebar { overflow: hidden; }
.sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -13px; padding: 0 13px 8px; }
.side-foot { position: static; margin: 0 -13px; border-top: 1px solid var(--line); }

/* =====================================================================
   Builder: data dinamis (variables + @{nama})
   ===================================================================== */
.pf { position: relative; }
.dyn-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dyn-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  background: var(--primary-soft); color: var(--primary); border-radius: 7px; padding: 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer;
}
.dyn-btn:hover { border-style: solid; }
.dyn-preview { font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dyn-preview b { color: var(--text-strong); font-weight: 600; }
.dyn-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px;
}
.dyn-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dyn-h b { font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; }
.dyn-h b i { color: var(--primary); }
.dyn-h .icon-btn { width: 26px; height: 26px; }
.dyn-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0 0 8px; }
.dyn-note code, .dyn-item code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0 4px; }
.dyn-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin-bottom: 8px; }
.dyn-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; width: 100%;
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; cursor: pointer;
}
.dyn-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.dyn-item small { grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dyn-type { font-size: 10px; color: var(--muted); align-self: center; }
.dyn-empty { font-size: 11.5px; color: var(--muted); padding: 6px 2px; }
.dyn-new { border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: 8px; }
.dyn-new .btn { margin-top: 8px; width: 100%; justify-content: center; }
.dyn-sub { font-size: 11px; font-weight: 600; color: var(--text-strong); margin-bottom: 6px; }

.var-head, .var-row { display: grid; grid-template-columns: 1.2fr .9fr 1.2fr 28px; gap: 4px; align-items: center; }
.var-head { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }
.var-list { display: flex; flex-direction: column; gap: 6px; }
.var-row input, .var-row select {
  border: 1px solid var(--input-line); background: var(--input); color: var(--text-strong);
  border-radius: 7px; padding: 5px 6px; font-size: 11.5px; width: 100%; min-width: 0; outline: 0;
}
.var-row input:focus, .var-row select:focus { border-color: var(--primary); }
.var-row .icon-btn { width: 28px; height: 28px; color: var(--muted); }
.var-row .icon-btn:hover { color: var(--danger); }
.var-use { grid-column: 1 / -1; font-size: 10.5px; color: var(--muted); margin-top: -2px; }
.var-json { margin-top: 10px; font-size: 11.5px; }
.var-json summary { cursor: pointer; color: var(--muted); }

.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
