/* ========================================================================
   Config2 V3 — UI Redesign
   Ported from docs/design-v3/project/Home Redesign.html
   Scope: only pages that live under /v3/... (V3MainLayout applies .v3-app)
   ======================================================================== */

/* V3 CSS custom properties are scoped here.
   `.v3-app` covers the main layout. `.v3-dialog` covers Radzen dialogs —
   they render at <body> root, OUTSIDE `.v3-app`, so without this every
   `var(--*)` in dialog CSS resolves to empty (transparent backgrounds,
   unset colors). We opt every V3 dialog in via `CssClass="v3-dialog ..."`
   so the vars reach the dialog content and all its children. */
.v3-app,
.v3-dialog {
    /* Default to light native form controls; the dark theme overrides this. */
    color-scheme: light;
    /* Brand */
    --teal-900: #0B2A36;
    --teal-800: #113D4F;
    --teal-700: #1A536B;
    --teal-100: #E2ECEF;
    --teal-50:  #F1F6F7;
    /* Surfaces */
    --bg:       #FAFAF7;
    --surface:  #FFFFFF;
    --line:     #E6E4DD;
    --line-soft:#EFEDE6;
    --ink:      #141617;
    --ink-2:    #3A3F42;
    --ink-3:    #6C7176;
    --ink-4:    #9BA1A6;
    /* Accent */
    --amber:    #C8892A;
    --amber-50: #F7EFDE;
    --green:    #3C8F5B;
    --green-50: #E5F1EA;
    --red:      #B4482F;
    --red-50:   #F7E8E3;
    /* Radii + shadow */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --shadow: 0 1px 0 rgba(17,61,79,0.04), 0 1px 2px rgba(17,61,79,0.05);
    --shadow-hover: 0 2px 0 rgba(17,61,79,0.04), 0 8px 24px rgba(17,61,79,0.08);
    /* Fonts */
    --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    display: grid;
    grid-template-columns: var(--side-w, 240px) 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns 200ms ease;
}

.v3-app[data-theme="dark"] {
    /* Tell the browser to render native form-control UI (the <select> options
       popup, date pickers, scrollbars) in dark mode. Without this the option
       list renders light even though the closed control is themed dark. */
    color-scheme: dark;
    --teal-900: #E6EEF0;
    --teal-800: #D6E2E5;
    --teal-700: #BFCFD3;
    --teal-100: #1F3B46;
    --teal-50:  #16303A;
    --bg:       #0D1618;
    --surface:  #141F22;
    --line:     #253338;
    --line-soft:#1C292D;
    --ink:      #EDEFEE;
    --ink-2:    #C7CCCD;
    --ink-3:    #8E9699;
    --ink-4:    #5E676B;
    --amber-50: #3A2E18;
    --green-50: #16332A;
    --red-50:   #33201C;
    --shadow: 0 1px 0 rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.35);
    --shadow-hover: 0 2px 0 rgba(0,0,0,0.3), 0 10px 26px rgba(0,0,0,0.45);
}

.v3-app[data-sidebar="collapsed"] { --side-w: 64px; }

.v3-app *, .v3-app *::before, .v3-app *::after { box-sizing: border-box; }
.v3-app button { font: inherit; color: inherit; cursor: pointer; }
.v3-app a { color: inherit; text-decoration: none; }

.v3-app .mono { font-family: var(--mono); font-feature-settings: "ss01","cv11"; letter-spacing: -0.01em; }
.v3-app .num  { font-variant-numeric: tabular-nums; }

/* ===== Sidebar ===== */
.v3-side {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.v3-side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
.v3-side-brand .v3-logo { width: 28px; height: 28px; border-radius: 7px; background: var(--teal-800); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -0.02em; flex: none; }
.v3-app[data-theme="dark"] .v3-side-brand .v3-logo { background: var(--teal-100); color: var(--teal-900); }
.v3-side-brand .name { font-weight: 600; letter-spacing: -0.01em; font-size: 14px; white-space: nowrap; }
.v3-side-brand .name em { font-style: normal; color: var(--ink-3); font-weight: 400; margin-left: 6px; font-size: 12px; }

.v3-side-group { padding: 10px 8px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); white-space: nowrap; }
.v3-nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13.5px; white-space: nowrap; cursor: pointer; }
.v3-nav-item:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-nav-item.active { background: var(--teal-100); color: var(--teal-800); font-weight: 500; }
.v3-nav-item .icon { width: 16px; height: 16px; flex: none; }
.v3-nav-item .chev { margin-left: auto; color: var(--ink-4); font-size: 10px; }
.v3-nav-sub { display: flex; flex-direction: column; gap: 1px; padding-left: 22px; margin: 2px 0 4px; }
.v3-nav-sub .v3-nav-item { padding: 5px 10px; font-size: 13px; color: var(--ink-3); }

.v3-app[data-sidebar="collapsed"] .v3-side-brand .name,
.v3-app[data-sidebar="collapsed"] .v3-side-group,
.v3-app[data-sidebar="collapsed"] .v3-nav-item .label,
.v3-app[data-sidebar="collapsed"] .v3-nav-item .chev,
.v3-app[data-sidebar="collapsed"] .v3-nav-sub { display: none; }
.v3-app[data-sidebar="collapsed"] .v3-nav-item { justify-content: center; padding: 7px; }

.v3-side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }

/* ===== Main ===== */
.v3-main { min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; overflow-x: clip; }
/* overflow-x: clip (not hidden) — clips visually without making a scroll container,
   so position:absolute dropdowns inside are not clipped by the main scroll area */

.v3-topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    position: sticky; top: 0; z-index: 10;
}
.v3-topbar .crumb { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.v3-topbar .crumb b { color: var(--ink); font-weight: 500; }
.v3-topbar .spacer { flex: 1; }
.v3-topbar .search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: 6px 10px;
    width: 320px; color: var(--ink-3);
}
.v3-topbar .search input { background: transparent; border: 0; outline: 0; color: var(--ink); width: 100%; font: inherit; }
.v3-topbar .search .kbd { font-family: var(--mono); font-size: 11px; color: var(--ink-4); padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.v3-topbar .user { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-100); color: var(--teal-800); display: grid; place-items: center; font-size: 11px; font-weight: 600; border: 0; padding: 0; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.v3-topbar .user:hover { transform: scale(1.06); box-shadow: 0 0 0 2px var(--teal-100); }
.v3-topbar .user:focus-visible { outline: 2px solid var(--teal-700); outline-offset: 2px; }

.v3-content { padding: 28px 32px 60px; max-width: 1920px; margin: 0 auto; width: 100%; }

/* ===== Grid + density ===== */
.v3-grid { display: grid; gap: 16px; }
.v3-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.v3-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v3-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v3-grid.auto-fill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
[data-density="compact"]  .v3-grid { gap: 12px; }
[data-density="spacious"] .v3-grid { gap: 22px; }

/* Family color system */
.fam-air       { --fam: #2F8A9E; --fam-soft: #DDF0F3; --fam-deep: #0E4E5E; }
.fam-material  { --fam: #C8892A; --fam-soft: #F8EDD4; --fam-deep: #7A4E10; }
.fam-layouts   { --fam: #7A4A8F; --fam-soft: #EEE4F4; --fam-deep: #3E2252; }
.fam-vessels   { --fam: #3C8F5B; --fam-soft: #DFF1E4; --fam-deep: #1C5A33; }
.fam-thermal   { --fam: #B4482F; --fam-soft: #F5DED6; --fam-deep: #6A2614; }
.fam-doors     { --fam: #4E6CC9; --fam-soft: #DFE6FA; --fam-deep: #223A8E; }
.fam-samples   { --fam: #6C7176; --fam-soft: #E9E9E8; --fam-deep: #3A3F42; }
.v3-app[data-theme="dark"] .fam-air       { --fam-soft: #0F3038; }
.v3-app[data-theme="dark"] .fam-material  { --fam-soft: #3A2E16; }
.v3-app[data-theme="dark"] .fam-layouts   { --fam-soft: #2B1A38; }
.v3-app[data-theme="dark"] .fam-vessels   { --fam-soft: #153524; }
.v3-app[data-theme="dark"] .fam-thermal   { --fam-soft: #3A1B12; }
.v3-app[data-theme="dark"] .fam-doors     { --fam-soft: #1A224A; }
.v3-app[data-theme="dark"] .fam-samples   { --fam-soft: #242628; }

.v3-render {
    position: relative;
    background:
      radial-gradient(120% 100% at 30% 0%, color-mix(in oklab, var(--fam, var(--teal-800)) 18%, var(--surface)) 0%, var(--fam-soft, var(--teal-50)) 60%, color-mix(in oklab, var(--fam, var(--teal-800)) 6%, var(--surface)) 100%);
    border-radius: var(--r-md);
    overflow: hidden;
    aspect-ratio: 4/3;
    display: grid; place-items: center;
    border: 1px solid color-mix(in oklab, var(--fam, var(--teal-800)) 18%, var(--line));
}
.v3-render::before {
    content: ""; position: absolute; inset: 0;
    background:
      linear-gradient(color-mix(in oklab, var(--fam, var(--teal-800)) 10%, transparent) 1px, transparent 1px) 0 0 / 18px 18px,
      linear-gradient(90deg, color-mix(in oklab, var(--fam, var(--teal-800)) 10%, transparent) 1px, transparent 1px) 0 0 / 18px 18px;
    pointer-events: none; opacity: 0.5;
}
.v3-render svg { position: relative; z-index: 1; width: 72%; height: 72%; display: block; }
.v3-render svg * { stroke: var(--fam-deep, var(--teal-800)) !important; }
.v3-render-img {
    position: relative; z-index: 1;
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 10%;
    display: block;
}

.family-stripe { height: 3px; background: var(--fam, var(--teal-800)); border-radius: 3px 3px 0 0; }

/* Badges */
.v3-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.02em; border: 1px solid transparent; }
.badge-release     { background: var(--green-50);  color: var(--green);  border-color: var(--green); }
.badge-test        { background: var(--amber-50); color: var(--amber); border-color: var(--amber); }
.badge-design      { background: #CEE8FF; color: #1565C0; border-color: #90CAF9; }
.badge-definition  { background: #F2F2F2; color: #616161; border-color: #BDBDBD; }
.badge-inactive    { background: var(--red-50);   color: var(--red);   border-color: var(--red); }
.badge-archived    { background: #F5F5F5; color: #9E9E9E; border-color: #9E9E9E; }
.badge-external    { background: #F2E9E6; color: var(--red); border-color: #EAD7D1; }
.v3-app[data-theme="dark"] .badge-external { background: #30201C; color: #E59A82; border-color: #4A2E27; }

/* Buttons */
.v3-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background 120ms, border-color 120ms, transform 80ms; justify-content: center; white-space: nowrap; }
.v3-btn:hover { border-color: var(--ink-4); }
.v3-btn:active { transform: translateY(1px); }
.v3-btn.v3-btn-primary,
.v3-btn.v3-btn-primary:link,
.v3-btn.v3-btn-primary:visited { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.v3-btn.v3-btn-primary * { color: #fff; }
.v3-btn.v3-btn-primary:hover { background: var(--teal-900); border-color: var(--teal-900); color: #fff; }
.v3-app[data-theme="dark"] .v3-btn.v3-btn-primary,
.v3-app[data-theme="dark"] .v3-btn.v3-btn-primary * { background: var(--teal-100); color: var(--teal-900); border-color: var(--teal-100); }
/* Dark mode — elevate default button so it's visible against the dark surface */
.v3-app[data-theme="dark"] .v3-btn:not(.v3-btn-primary):not(.v3-btn-ghost):not(.v3-btn-danger) {
    background: color-mix(in oklab, var(--teal-100) 45%, var(--bg));
    border-color: var(--line);
}
.v3-app[data-theme="dark"] .v3-btn:not(.v3-btn-primary):not(.v3-btn-ghost):not(.v3-btn-danger):hover {
    background: var(--teal-100);
    border-color: var(--teal-700);
}
.v3-btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.v3-btn-ghost:hover { background: var(--teal-50); color: var(--teal-800); border-color: transparent; }
.v3-btn-sm { padding: 5px 10px; font-size: 12.5px; }
.v3-btn-icon { padding: 6px; }

/* Toolbar */
.v3-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.v3-toolbar .spacer { flex: 1; }

/* Elegant search input */
.v3-search {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    min-width: 280px;
    max-width: 360px;
    flex: 0 1 360px;
    padding: 0 10px 0 34px;
    height: 34px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-3);
    transition: border-color 140ms, box-shadow 140ms, background 140ms;
}
.v3-search:hover { border-color: var(--ink-4); }
.v3-search:focus-within {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-800) 15%, transparent);
    background: var(--surface);
}
.v3-app[data-theme="dark"] .v3-search:focus-within { border-color: var(--teal-100); box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-100) 20%, transparent); }
.v3-search .v3-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    display: inline-flex; color: var(--ink-4); pointer-events: none;
}
.v3-search:focus-within .v3-search-icon { color: var(--teal-800); }
.v3-app[data-theme="dark"] .v3-search:focus-within .v3-search-icon { color: var(--teal-100); }
.v3-search input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: 0;
    color: var(--ink); font: inherit; font-size: 13px;
    padding: 0;
}
.v3-search input::placeholder { color: var(--ink-4); }
.v3-search-clear {
    display: grid; place-items: center;
    width: 18px; height: 18px;
    padding: 0; border: 0; border-radius: 50%;
    background: var(--line-soft); color: var(--ink-3);
    font-size: 14px; line-height: 1; cursor: pointer;
    transition: background 120ms, color 120ms;
}
.v3-search-clear:hover { background: var(--ink-4); color: var(--surface); }

/* Loading + empty */
.v3-loading, .v3-empty {
    padding: 60px 20px; text-align: center;
    border: 1px dashed var(--line); border-radius: var(--r-md);
    color: var(--ink-3); background: var(--surface);
}
.v3-empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 16px; font-weight: 600; }
.v3-empty p  { margin: 0; font-size: 13px; }

/* Design-version switcher (pill in topbar) */
.v3-design-toggle { display: inline-flex; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.v3-design-toggle button {
    padding: 4px 12px; border: 0; background: transparent; color: var(--ink-3);
    border-radius: 999px; font-size: 12px; font-weight: 500; cursor: pointer;
    transition: background 120ms, color 120ms;
}
.v3-design-toggle button:hover { color: var(--ink); }
.v3-design-toggle button.on { background: var(--teal-800); color: #fff; }
.v3-app[data-theme="dark"] .v3-design-toggle button.on { background: var(--teal-100); color: var(--teal-900); }
.v3-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.v3-chip.on { border-color: var(--teal-800); color: var(--teal-800); background: var(--teal-50); }

/* Role-colored filter chips — tinted default, solid when selected */
.v3-chip.v3-chip-role.v3-role-viewer           { background: #EBEBEB; color: #3A3F42; border-color: #D4D4D2; }
.v3-chip.v3-chip-role.v3-role-viewer.on        { background: #6C7176; color: #fff;    border-color: #6C7176; }
.v3-chip.v3-chip-role.v3-role-adv-viewer       { background: #E4EBF0; color: #2C4A55; border-color: #C8D8E2; }
.v3-chip.v3-chip-role.v3-role-adv-viewer.on    { background: #4A6FA5; color: #fff;    border-color: #4A6FA5; }
.v3-chip.v3-chip-role.v3-role-configurator     { background: #DDF0EE; color: #1F5A52; border-color: #B8DEDA; }
.v3-chip.v3-chip-role.v3-role-configurator.on  { background: #2F8A9E; color: #fff;    border-color: #2F8A9E; }
.v3-chip.v3-chip-role.v3-role-adv-configurator      { background: #EBE4F6; color: #3E2252; border-color: #D5C8E8; }
.v3-chip.v3-chip-role.v3-role-adv-configurator.on   { background: #6D4A8F; color: #fff;    border-color: #6D4A8F; }
.v3-chip.v3-chip-role.v3-role-config-builder        { background: #DFF1E6; color: #1C5A33; border-color: #C0DECA; }
.v3-chip.v3-chip-role.v3-role-config-builder.on     { background: #3C8F5B; color: #fff;    border-color: #3C8F5B; }
.v3-chip.v3-chip-role.v3-role-admin            { background: #EDEAE3; color: #6E5A2A; border-color: #E0DACB; }
.v3-chip.v3-chip-role.v3-role-admin.on         { background: #C8892A; color: #fff;    border-color: #C8892A; }
/* Dark mode overrides */
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-viewer        { background: #242628; color: #B8BCBE; border-color: #323639; }
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-adv-viewer    { background: #1F2A30; color: #B6C9D2; border-color: #2C3A41; }
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-configurator  { background: #163029; color: #8FD3C5; border-color: #234038; }
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-adv-configurator { background: #2B1A38; color: #D4B8E0; border-color: #3D2852; }
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-config-builder { background: #15331F; color: #9BD5AC; border-color: #224A30; }
.v3-app[data-theme="dark"] .v3-chip.v3-chip-role.v3-role-admin         { background: #2A2518; color: #E9C88A; border-color: #3B3420; }
/* Keep dot visible on selected chips */
.v3-chip.v3-chip-role.on .v3-role-dot { background: rgba(255,255,255,0.7) !important; }

.v3-select-pill {
    padding: 6px 28px 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font: inherit; font-size: 13px; color: var(--ink); appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236C7176' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
}

/* Page heading */
.v3-h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.v3-lead { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; }

/* Product card */
.v3-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden; transition: box-shadow 180ms, transform 180ms;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.v3-card:hover { box-shadow: var(--shadow-hover); }
.v3-card .v3-render-wrap { position: relative; }
.v3-card .v3-render { aspect-ratio: 4/3; border-radius: 0; border: 0; border-bottom: 1px solid var(--line-soft); }
.v3-card .v3-ribbon { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.v3-card .v3-fav { position: absolute; top: 10px; right: 10px; z-index: 5; width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; display: grid; place-items: center; cursor: pointer; color: var(--ink-3); transition: color 120ms, border-color 120ms, background 120ms; pointer-events: auto; }
.v3-card .v3-fav > * { pointer-events: none; }
.v3-card .v3-fav:hover { color: var(--amber); border-color: var(--amber); }
.v3-card .v3-fav.on { color: var(--amber); border-color: var(--amber); background: var(--amber-50); }
.v3-card .v3-rn-icon { position: absolute; top: 44px; right: 10px; z-index: 5; width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; display: grid; place-items: center; cursor: pointer; color: var(--ink-3); transition: color 120ms, border-color 120ms, background 120ms; pointer-events: auto; }
.v3-card .v3-rn-icon > * { pointer-events: none; }
.v3-card .v3-rn-icon:hover { color: var(--teal-700); border-color: var(--teal-700); }
.v3-card .v3-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.v3-card h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.v3-card .pid { font-size: 11px; color: var(--ink-4); }
.v3-card .desc { margin: 4px 0 10px; font-size: 13px; color: var(--ink-3); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.v3-card .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-3); }
.v3-card .meta .sep { color: var(--ink-4); }
.v3-card .actions { display: flex; gap: 8px; margin-top: 14px; }
.v3-card .actions .v3-btn { flex: 1; }
.v3-card .name-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.v3-card .star-filled { color: var(--amber); }
.v3-card .star-empty  { color: var(--ink-4); }

/* Pager */
.v3-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 12px; }
.v3-pager .pages { display: flex; gap: 4px; align-items: center; }
.v3-pager .pages .v3-btn { min-width: 32px; }
.v3-pager-info { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.v3-pager-info b { color: var(--ink-2); font-weight: 600; }
.v3-pager-ellipsis { color: var(--ink-4); padding: 0 4px; font-size: 13px; }
.v3-pager-info .sep { margin: 0 6px; color: var(--ink-4); }
.v3-pager-info .muted { color: var(--ink-4); }
.v3-pager-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v3-pager-size { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin: 0; }
.v3-pager-size .v3-input { padding: 4px 26px 4px 8px; font-size: 12.5px; height: auto; min-height: 0; }
.v3-pager-size .v3-select-wrap { min-width: 0; }
.v3-pager-mode { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.v3-pager-mode .v3-btn { border: 0; border-radius: 0; padding: 4px 10px; font-size: 12px; }
.v3-pager-mode .v3-btn + .v3-btn { border-left: 1px solid var(--line); }
.v3-pager-mode .v3-btn.is-active { background: var(--teal-800); color: #fff; }
.v3-pager-mode .v3-btn.is-active:hover { background: var(--teal-700); color: #fff; }

/* Fade-in stagger */
@keyframes v3FadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.v3-fade-in > * { animation: v3FadeUp 360ms ease both; }
.v3-fade-in > *:nth-child(1) { animation-delay: 0ms; }
.v3-fade-in > *:nth-child(2) { animation-delay: 40ms; }
.v3-fade-in > *:nth-child(3) { animation-delay: 80ms; }
.v3-fade-in > *:nth-child(4) { animation-delay: 120ms; }
.v3-fade-in > *:nth-child(5) { animation-delay: 160ms; }
.v3-fade-in > *:nth-child(6) { animation-delay: 200ms; }
.v3-fade-in > *:nth-child(7) { animation-delay: 240ms; }
.v3-fade-in > *:nth-child(8) { animation-delay: 280ms; }

/* Stub pages */
.v3-stub { padding: 60px 20px; text-align: center; color: var(--ink-3); }
.v3-stub h2 { color: var(--ink); margin: 0 0 8px; font-size: 20px; font-weight: 600; }

/* ========================================================================
   Details page (V3)
   ======================================================================== */
.v3-app .v3-details-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.v3-app .v3-details-head h2 { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.v3-app .v3-details-head .sub { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.v3-app .v3-details-head .spacer { flex: 1; }

.v3-app .v3-details-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: stretch; }
@media (max-width: 1024px) {
    .v3-app .v3-details-grid { grid-template-columns: 1fr; align-items: start; }
}

.v3-app .v3-details-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.v3-app .v3-details-hero .hero-body { flex: 1; min-height: 0; overflow-y: auto; }
.v3-app .v3-details-main { display: flex; flex-direction: column; min-width: 0; }
.v3-app .v3-details-hero .hero-media { aspect-ratio: 4/3; background: var(--teal-50); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line-soft); }
.v3-app .v3-details-hero .hero-media img { width: 100%; height: 100%; object-fit: cover; }
.v3-app .v3-details-hero .hero-placeholder { font-size: 48px; font-weight: 600; color: var(--teal-800); letter-spacing: 0.02em; }
.v3-app .v3-details-hero .hero-body { padding: 16px 18px 18px; }
.v3-app .v3-details-hero h1 { margin: 0 0 2px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.v3-app .v3-details-hero .desc { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.v3-app .v3-details-hero .hero-actions { margin-top: 18px; }
.v3-app .v3-details-hero .hero-actions .v3-btn { width: 100%; justify-content: center; }
.v3-app .v3-details-hero .v3-field select { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 13px; }

/* ---- Import configurations dialog ---- */
.v3-app .v3-import-type-row { display: flex; gap: 8px; }
.v3-app .v3-import-type-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink-3); font-size: 13px; cursor: pointer; transition: border-color 120ms, background 120ms, color 120ms; }
.v3-app .v3-import-type-btn:hover { border-color: var(--teal-700); color: var(--ink); }
.v3-app .v3-import-type-btn.on { border-color: var(--teal-700); background: var(--teal-50); color: var(--teal-800); font-weight: 600; }
.v3-app .v3-import-type-btn .ext { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.v3-app .v3-import-type-btn.on .ext { color: var(--teal-700); }
.v3-app .v3-import-dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--r-md); background: var(--bg); overflow: hidden; transition: border-color 120ms, background 120ms; }
.v3-app .v3-import-dropzone:hover { border-color: var(--teal-700); background: var(--teal-50); }
.v3-app .v3-import-placeholder { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px 16px; color: var(--ink-3); font-size: 13.5px; pointer-events: none; }
.v3-app .v3-import-chosen { display: flex; align-items: center; gap: 8px; padding: 14px 16px; color: var(--ink); font-size: 13px; pointer-events: none; }
.v3-app .v3-import-chosen .name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-app .v3-import-chosen .size { color: var(--ink-4); font-size: 12px; font-family: var(--mono); flex-shrink: 0; }
.v3-app .v3-import-chosen svg { color: var(--green); flex-shrink: 0; }
.v3-app .v3-import-file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.v3-app .v3-import-error { margin-top: 12px; padding: 10px 12px; background: var(--red-50); border: 1px solid var(--red); border-radius: var(--r-sm); color: var(--red); font-size: 12.5px; line-height: 1.5; }

/* ---- Release Notes modal ---- */
.v3-app .v3-rn-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.v3-app .v3-rn-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.v3-app .v3-rn-row.editing { background: var(--teal-50); border-color: var(--teal-700); flex-direction: column; align-items: stretch; gap: 8px; }
.v3-app .v3-rn-row-actions { display: flex; gap: 6px; }
.v3-app .v3-rn-cat { font-size: 11px; font-weight: 600; color: var(--teal-700); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; min-width: 110px; }
.v3-app .v3-rn-note { flex: 1; font-size: 13px; color: var(--ink-2); }
.v3-app .v3-rn-inputs { display: flex; gap: 8px; align-items: center; }
.v3-app .v3-rn-add-form { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.v3-app .v3-rn-add-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.v3-app .v3-rn-warn { display: flex; align-items: flex-start; gap: 9px; margin-top: 8px; padding: 10px 13px; background: var(--amber-50); border: 1.5px solid var(--amber); border-radius: var(--r-md); }
.v3-app .v3-rn-warn svg { color: var(--amber); flex-shrink: 0; margin-top: 1px; width: 15px; height: 15px; }
.v3-app .v3-rn-warn span { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); font-weight: 500; }

.v3-app .v3-details-hero .v3-kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.v3-app .v3-details-hero .v3-kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v3-app .v3-details-hero .v3-kv .k { color: var(--ink-4); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.v3-app .v3-details-hero .v3-kv .v { color: var(--ink-2); font-size: 12.5px; word-break: break-word; line-height: 1.35; }


/* When the configurations table styles are reused inside a V3Modal, allow text to wrap */
.v3-app .v3-modal-card .v3-cfg-table .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 8px 14px; }
.v3-app .v3-modal-card .v3-cfg-table .col { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; line-height: 1.4; }

/* Parameters dialog table — used inside V3Modal for the configurator's parameters */
.v3-app .v3-params-table { max-height: 60vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.v3-app .v3-params-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; align-items: start; }
.v3-app .v3-params-row:last-child { border-bottom: 0; }
.v3-app .v3-params-row .col { min-width: 0; word-break: break-word; white-space: normal; line-height: 1.4; }
.v3-app .v3-params-row .col.mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.v3-app .v3-params-row.head { position: sticky; top: 0; background: var(--teal-50); color: var(--ink-3); font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; z-index: 1; }
.v3-app .v3-params-row.step { background: var(--teal-50); font-weight: 600; color: var(--teal-800); }
.v3-app .v3-params-row .param-name { padding-left: 16px; color: var(--ink-2); }

/* Configurations table */
.v3-app .v3-cfg-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.v3-app .v3-cfg-table .row { display: grid; grid-template-columns: 2fr 0.7fr 1fr 1.2fr 1fr 1.4fr; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }

/* RadzenDataGrid skinned to match the V3 card look */
.v3-app .v3-data-grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; font-size: 13px; }
.v3-app .v3-data-grid .rz-data-grid,
.v3-app .v3-data-grid .rz-grid-table-container,
.v3-app .v3-data-grid .rz-data-grid-data,
.v3-app .v3-data-grid .rz-grid-table { background: transparent; border: 0; }
.v3-app .v3-data-grid .rz-grid-table { font-family: var(--sans); border-collapse: separate; border-spacing: 0; width: 100%; }

/* Header — title row (no bottom border; filter row sits flush below it) */
.v3-app .v3-data-grid .rz-grid-table thead tr:first-child th { background: var(--teal-50); color: var(--ink-3); font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.07em; border: 0; padding: 10px 14px; }
.v3-app .v3-data-grid .rz-grid-table thead tr:first-child th .rz-cell-data { color: inherit; font-weight: inherit; }
.v3-app .v3-data-grid .rz-column-title { color: var(--ink-3); font-weight: 700; font-family: var(--sans); letter-spacing: 0.07em; }
.v3-app .v3-data-grid .rz-column-title-content { color: var(--ink-3) !important; font-weight: 700 !important; overflow: visible; text-overflow: clip; }
.v3-app .v3-data-grid .rz-column-title-content.rz-text-truncate { overflow: visible; text-overflow: clip; }
.v3-app .v3-data-grid .rz-grid-filter-icon,
.v3-app .v3-data-grid .rzi-filter,
.v3-app .v3-data-grid .rzi-grid-filter { display: none; } /* filter row already exposes the filter — no extra icon */
/* Hide sort icons by default; reveal on hover or when this column is sorted. */
.v3-app .v3-data-grid .rz-sortable-column .rz-sortable-column-icon { color: var(--ink-4); opacity: 0; font-size: 12px; margin-left: 4px; transition: opacity 120ms; pointer-events: none; }
.v3-app .v3-data-grid .rz-sortable-column:hover .rz-sortable-column-icon { opacity: 0.5; }
.v3-app .v3-data-grid .rz-sortable-column.rz-state-highlight .rz-sortable-column-icon,
.v3-app .v3-data-grid .rz-sortable-column-icon.rzi-sort-asc,
.v3-app .v3-data-grid .rz-sortable-column-icon.rzi-sort-desc { opacity: 1; color: var(--teal-800); }
/* Centre the title+icon group inside centered columns so the icon hugs the title. */
.v3-app .v3-data-grid .rz-grid-table thead th.rz-text-align-center > div,
.v3-app .v3-data-grid .rz-grid-table thead th.rz-text-align-center .rz-column-title { justify-content: center; }
.v3-app .v3-data-grid .rz-grid-table thead th.rz-text-align-right > div,
.v3-app .v3-data-grid .rz-grid-table thead th.rz-text-align-right .rz-column-title { justify-content: flex-end; }
.v3-app .v3-data-grid .rz-sortable-column.rz-state-highlight,
.v3-app .v3-data-grid .rz-sortable-column.rz-state-highlight .rz-column-title { color: var(--teal-800); }

/* Filter row — same teal-50 fill as header so they read as one block */
.v3-app .v3-data-grid .rz-grid-table thead tr:nth-child(2) th,
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter { background: var(--teal-50); border: 0 !important; padding: 0 10px 8px; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter input,
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-textbox,
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-dropdown,
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-numeric { width: 100%; height: 28px; min-height: 28px; font-size: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter input:focus,
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-dropdown:focus { border-color: var(--teal-800); box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-800) 18%, transparent); outline: none; }

/* Numeric filter — hide the spinner buttons entirely (filters are typed, not stepped) */
.v3-app .v3-data-grid .rz-grid-table thead .rz-numeric .rz-numeric-button { display: none !important; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-numeric { width: 100%; height: 28px; min-height: 28px; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-numeric .rz-numeric-input { width: 100% !important; height: 28px !important; min-height: 28px !important; padding: 0 8px !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; background: var(--surface) !important; font-size: 12px; }

/* Date filter button (rendered by RadzenDataGrid for DateTime columns) — match other filter inputs.
   Scoped to icon-only buttons so the numeric spinner buttons (which also carry .rz-button) are not matched. */
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter button.rz-button.rz-button-icon-only { background: var(--surface) !important; color: var(--ink-3) !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; box-shadow: none !important; width: 28px !important; height: 28px !important; min-width: 28px !important; min-height: 28px !important; padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter button.rz-button.rz-button-icon-only:hover { background: var(--teal-50) !important; border-color: var(--ink-4) !important; color: var(--teal-800) !important; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter button.rz-button.rz-button-icon-only .rzi { color: inherit; font-size: 14px; }
.v3-app .v3-data-grid .rz-grid-table thead .rz-cell-filter-label { display: inline-flex; align-items: center; }

/* Body rows — no vertical borders, generous padding, soft hover */
.v3-app .v3-data-grid .rz-grid-table tbody tr { background: transparent; border: 0; transition: background 0.12s ease; }
.v3-app .v3-data-grid .rz-grid-table tbody tr:hover,
.v3-app .v3-data-grid .rz-grid-table tbody tr.rz-state-hover { background: var(--teal-50); }
.v3-app .v3-data-grid .rz-grid-table tbody td { color: var(--ink); padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; }
.v3-app .v3-data-grid .rz-grid-table tbody tr:last-child td { border-bottom: 0; }

/* Pager — buttons match v3-btn-sm */
.v3-app .v3-data-grid .rz-pager { background: var(--surface); border-top: 1px solid var(--line-soft); border-bottom: 0; padding: 10px 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.v3-app .v3-data-grid .rz-pager .rz-pager-summary { color: var(--ink-3); font-size: 12.5px; margin-right: auto; }
.v3-app .v3-data-grid .rz-pager .rz-pager-element { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 500; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); transition: background 120ms, border-color 120ms, color 120ms; box-shadow: none; cursor: pointer; }
.v3-app .v3-data-grid .rz-pager .rz-pager-element:hover:not(.rz-state-disabled) { background: var(--teal-50); border-color: var(--ink-4); color: var(--ink); }
.v3-app .v3-data-grid .rz-pager .rz-pager-element.rz-state-active { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.v3-app .v3-data-grid .rz-pager .rz-pager-element.rz-state-active:hover { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.v3-app .v3-data-grid .rz-pager .rz-pager-element.rz-state-disabled,
.v3-app .v3-data-grid .rz-pager .rz-pager-element[disabled] { color: var(--ink-4); background: var(--surface); border-color: var(--line); opacity: 0.55; cursor: default; }
.v3-app .v3-data-grid .rz-pager .rz-pager-element .rz-pager-icon,
.v3-app .v3-data-grid .rz-pager .rz-pager-element .notranslate { color: inherit; }
.v3-app .v3-data-grid .rz-pager .rz-pager-pages { display: inline-flex; gap: 6px; }
.v3-app .v3-data-grid .rz-pager .rz-dropdown { height: 28px !important; min-height: 28px !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; background: var(--surface) !important; font-size: 12.5px; padding: 0 26px 0 10px !important; box-shadow: none !important; display: inline-flex !important; align-items: center !important; position: relative; }
.v3-app .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-label { color: var(--ink) !important; font-size: 12.5px !important; line-height: 28px !important; height: 28px !important; padding: 0 !important; margin: 0 !important; display: inline-flex !important; align-items: center !important; }
.v3-app .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-trigger { background: transparent !important; border: 0 !important; width: 22px !important; height: 28px !important; color: var(--ink-3) !important; right: 4px !important; top: 0 !important; align-items: center !important; justify-content: center !important; }
.v3-app .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-trigger .rz-dropdown-trigger-icon { color: var(--ink-3); }
.v3-app .v3-data-grid .rz-pager .rz-pagesize-text { color: var(--ink-3); font-size: 12.5px; align-self: center; }

/* Cell helpers */
.v3-app .v3-data-grid .v3-grid-link { background: none; border: 0; padding: 0; color: var(--teal-800); font-weight: 500; text-align: left; cursor: pointer; font-size: 13px; }
.v3-app .v3-data-grid .v3-grid-link:hover { text-decoration: underline; }
.v3-app .v3-data-grid .v3-grid-link.mono { font-family: var(--mono); font-size: 12.5px; }
.v3-app .v3-data-grid .v3-grid-warn { color: var(--amber); cursor: help; }
.v3-app .v3-data-grid .v3-grid-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.v3-app .v3-data-grid .v3-grid-actions .v3-btn { padding: 4px 8px; min-width: 28px; }
.v3-app .v3-data-grid .v3-grid-actions .v3-btn.danger { color: var(--red); }
.v3-app .v3-data-grid .v3-grid-actions .v3-btn.danger:hover { background: var(--red-50); border-color: var(--red); }
.v3-app .v3-data-grid .v3-grid-actions .v3-btn.danger { color: var(--red); }
.v3-app .v3-data-grid .v3-grid-actions .v3-btn.danger:hover { background: var(--red-50); border-color: var(--red); }
/* Dark mode — data grid structure */
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead tr:first-child th,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead tr:nth-child(2) th,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter { background: var(--teal-100); }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr:hover,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr.rz-state-hover { background: color-mix(in oklab, var(--teal-100) 55%, var(--surface)); }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody td { border-bottom-color: var(--line); }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager { border-top-color: var(--line); }

/* Dark mode — neutralise Radzen's hard-coded striped-table whites.
   Radzen ships its own theme CSS that paints `.rz-grid-table-striped` body
   cells white (and serves it from a CORS-blocked origin so we can't see it
   from devtools). Without `!important` here those rules win the cascade and
   the entire data area renders white-on-dark — which is the bug. We also
   re-assert the filter inputs and pager controls in dark colours so any
   `background: #fff` baked into Radzen's defaults can't sneak through. */
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr.rz-data-row,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr td { background: transparent !important; color: var(--ink); }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr:hover td,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table tbody tr.rz-state-hover td { background: color-mix(in oklab, var(--teal-100) 55%, var(--surface)) !important; }

/* Filter inputs in dark mode — Radzen otherwise paints them white with
   light-ink text, which is invisible against the dark filter row. */
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter input,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-textbox,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-dropdown,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-numeric,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-numeric-input { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-dropdown .rz-dropdown-label,
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter .rz-multiselect-label { color: var(--ink) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter button.rz-button.rz-button-icon-only { background: var(--surface) !important; color: var(--ink-2) !important; border-color: var(--line) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-grid-table thead .rz-cell-filter button.rz-button.rz-button-icon-only:hover { background: var(--teal-100) !important; color: var(--teal-800) !important; }

/* Pager in dark mode — buttons, dropdown and summary. */
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager { background: var(--surface); }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-pager-element { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-pager-element:hover:not(.rz-state-disabled) { background: var(--teal-100) !important; color: var(--ink) !important; border-color: var(--ink-4) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-pager-element.rz-state-active,
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-pager-element.rz-state-active:hover { background: var(--teal-100) !important; color: var(--ink) !important; border-color: var(--teal-100) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-pager-element.rz-state-disabled { color: var(--ink-4) !important; background: var(--surface) !important; border-color: var(--line) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-dropdown { background: var(--surface) !important; border-color: var(--line) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-label { color: var(--ink) !important; }
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-trigger,
.v3-app[data-theme="dark"] .v3-data-grid .rz-pager .rz-dropdown .rz-dropdown-trigger-icon { color: var(--ink-3) !important; }

/* Grid link cells: the default dark-blue link colour is unreadable on the
   dark surface in dark mode. Swap to the inverted teal scale. */
.v3-app[data-theme="dark"] .v3-data-grid .v3-grid-link { color: var(--teal-800); }
.v3-app[data-theme="dark"] .v3-data-grid .v3-grid-link.mono { color: var(--ink-2); }
/* Dark mode — cfg-table (hand-rolled grid used on Products detail) */
.v3-app[data-theme="dark"] .v3-cfg-table { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-cfg-table .row { border-bottom-color: var(--line); }
.v3-app[data-theme="dark"] .v3-cfg-table .row.head,
.v3-app[data-theme="dark"] .v3-cfg-table .row:not(.head):hover { background: var(--teal-100); }
.v3-app .v3-cfg-table .row:last-child { border-bottom: 0; }
.v3-app .v3-cfg-table .row.head { background: var(--teal-50); color: var(--ink-3); font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; padding: 8px 14px; }
.v3-app .v3-cfg-table .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-cfg-table .col { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.v3-app .v3-cfg-table .col.actions { display: flex; gap: 4px; justify-content: flex-end; }
.v3-app .v3-cfg-table .col.actions .v3-btn { padding: 4px 8px; min-width: 28px; }
.v3-app .v3-cfg-table .col.actions .v3-btn.danger { color: var(--red); }
.v3-app .v3-cfg-table .col.actions .v3-btn.danger:hover { background: var(--red-50); border-color: var(--red); }
.v3-app .v3-cfg-table .col .sub { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.v3-app .v3-cfg-table .col .link { background: none; border: 0; padding: 0; color: var(--teal-800); font-weight: 500; text-align: left; cursor: pointer; font-size: 13px; }
.v3-app .v3-cfg-table .col .link:hover { text-decoration: underline; }

@media (max-width: 900px) {
    .v3-app .v3-cfg-table .row { grid-template-columns: 1fr 1fr; }
    .v3-app .v3-cfg-table .row.head { display: none; }
    .v3-app .v3-cfg-table .col.actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Status badges used in configurations table */
.v3-app .v3-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 11px; font-weight: 600; border-radius: 999px; letter-spacing: 0.02em; border: 1px solid transparent; }
.v3-app .v3-badge-release    { background: var(--green-50);  color: var(--green);  border-color: var(--green); }
.v3-app .v3-badge-design     { background: #CEE8FF;  color: #1565C0;  border-color: #90CAF9; }
.v3-app .v3-badge-test       { background: var(--amber-50); color: var(--amber); border-color: var(--amber); }
.v3-app .v3-badge-definition { background: #F2F2F2;  color: #616161;  border-color: #BDBDBD; }
.v3-app .v3-badge-inactive   { background: var(--red-50);   color: var(--red);   border-color: var(--red); }
.v3-app .v3-badge-archived   { background: #F5F5F5;  color: #9E9E9E;  border-color: #9E9E9E; }
.v3-app .v3-badge-default    { background: var(--surface); color: var(--ink-3); border-color: var(--line); }
/* Dark mode overrides for statuses with hardcoded light-mode colours */
.v3-app[data-theme="dark"] .v3-badge-design     { background: #0E2040; color: #90CAF9; border-color: #1B3A6E; }
.v3-app[data-theme="dark"] .v3-badge-definition { background: #23272A; color: #B0B3B8; border-color: #3A3D42; }
.v3-app[data-theme="dark"] .v3-badge-archived   { background: #1E2022; color: #9E9E9E; border-color: #3A3D42; }
.v3-app[data-theme="dark"] .badge-design        { background: #0E2040; color: #90CAF9; border-color: #1B3A6E; }
.v3-app[data-theme="dark"] .badge-definition    { background: #23272A; color: #B0B3B8; border-color: #3A3D42; }
.v3-app[data-theme="dark"] .badge-archived      { background: #1E2022; color: #9E9E9E; border-color: #3A3D42; }

/* Scrim is only visible when the sidebar is a mobile drawer (see @media rules). */
.v3-side-scrim { display: none; }

/* ========================================================================
   Users page
   Ported from docs/design-v3/project/Users Redesign.html
   ======================================================================== */

/* Page header w/ actions */
.v3-page-h { display: flex; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.v3-page-h .v3-h1 { font-size: 28px; line-height: 1.1; }
.v3-page-h-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* Seat hero */
.v3-seat-hero {
    display: grid; grid-template-columns: 1fr 260px; gap: 24px;
    padding: 20px 22px;
    background:
      radial-gradient(120% 80% at 0% 0%, color-mix(in oklab, var(--teal-800) 8%, var(--surface)) 0%, var(--surface) 60%),
      var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.v3-seat-hero .main { min-width: 0; }
.v3-seat-hero .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.v3-eyebrow { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; font-weight: 600; }
.v3-seat-count { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.v3-seat-count .big { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; color: var(--teal-800); line-height: 1; }
.v3-app[data-theme="dark"] .v3-seat-count .big { color: var(--teal-100); }
.v3-seat-count .sep { font-size: 28px; color: var(--ink-4); font-weight: 300; }
.v3-seat-count .total { font-size: 22px; color: var(--ink-2); font-weight: 500; }
.v3-seat-count .unit { margin-left: 8px; color: var(--ink-3); font-size: 13px; }
.v3-seat-meta { display: flex; gap: 20px; align-items: flex-start; justify-content: flex-end; }

/* Vertical stat block: dot → count → label */
.v3-seat-stat { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.v3-seat-stat-num { font-size: 20px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; line-height: 1; }
.v3-seat-stat-num.muted { color: var(--ink-4); font-weight: 500; font-size: 16px; }
.v3-seat-stat-lbl { font-size: 10.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.v3-seat-stat.active .v3-seat-stat-num { color: #15803d; }
.v3-app[data-theme="dark"] .v3-seat-stat.active .v3-seat-stat-num { color: #4ade80; }
.v3-dot { width: 8px; height: 8px; min-width: 8px; min-height: 8px; border-radius: 50%; background: var(--ink-4); display: inline-block; flex-shrink: 0; }
.v3-dot-green { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25), 0 0 6px 1px rgba(34,197,94,0.35); }
.v3-dot-amber { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in oklab, var(--amber) 20%, transparent); }
.v3-dot-red   { background: var(--red); }

.v3-seat-bar { display: flex; gap: 2px; height: 10px; background: var(--line-soft); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.v3-seat-bar .seg { height: 100%; transition: flex 200ms; }
.v3-seat-legend { display: flex; flex-wrap: wrap; gap: 12px 20px; font-size: 12.5px; }
.v3-seat-legend .lg { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.v3-seat-legend .sw { width: 8px; height: 8px; border-radius: 2px; }
.v3-seat-legend .num { color: var(--ink-3); font-weight: 500; }

.v3-seat-hero .aside { border-left: 1px solid var(--line-soft); padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.v3-seat-hero .aside .v3-btn { justify-content: flex-start; }
.v3-seat-hero .note { margin-top: 6px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* Tabs */
.v3-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.v3-tab { padding: 10px 14px; background: transparent; border: 0; color: var(--ink-3); font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; }
.v3-tab:hover { color: var(--ink); }
.v3-tab.on { color: var(--teal-800); border-bottom-color: var(--teal-800); }
.v3-app[data-theme="dark"] .v3-tab.on { color: var(--teal-100); border-bottom-color: var(--teal-100); }
.v3-tab-count { background: var(--line-soft); color: var(--ink-2); padding: 1px 7px; font-size: 11px; border-radius: 999px; font-weight: 600; }
.v3-tab-count.amber { background: var(--amber-50); color: var(--amber); }

/* Filter bar */
.v3-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 14px; }
.v3-filter-bar .search { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; color: var(--ink-3); min-width: 280px; }
.v3-filter-bar .search input { background: transparent; border: 0; outline: 0; color: var(--ink); width: 100%; font: inherit; }
.v3-filter-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.v3-fg-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); font-weight: 600; margin-right: 2px; }
.v3-result-count { color: var(--ink-3); font-size: 12.5px; margin-left: auto; }

/* Avatar */
.v3-avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 600; letter-spacing: 0.01em; flex: none; text-transform: uppercase; width: 32px; height: 32px; font-size: 11.5px; color: #fff; background: var(--teal-700); }

/* Role pill — colors driven by role class so dark mode can override */
.v3-role-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid; font-weight: 500; white-space: nowrap; padding: 2px 10px; font-size: 12px; }
.v3-role-dot  { width: 6px; height: 6px; border-radius: 50%; }

.v3-role-admin    { background: #EDEAE3; color: #6E5A2A; border-color: #E0DACB; }
.v3-role-admin    .v3-role-dot { background: #C8892A; }
.v3-role-designer { background: #EEE4F4; color: #3E2252; border-color: #DACCE4; }
.v3-role-designer .v3-role-dot { background: #7A4A8F; }
.v3-role-engineer { background: #DDF0F3; color: #0E4E5E; border-color: #C6E1E5; }
.v3-role-engineer .v3-role-dot { background: #2F8A9E; }
.v3-role-sales    { background: #DFF1E4; color: #1C5A33; border-color: #C7E3CE; }
.v3-role-sales    .v3-role-dot { background: #3C8F5B; }
.v3-role-viewer   { background: #E9E9E8; color: #3A3F42; border-color: #D4D4D2; }
.v3-role-viewer   .v3-role-dot { background: #6C7176; }
.v3-role-external { background: #F5DED6; color: #6A2614; border-color: #EAD0C6; }
.v3-role-external .v3-role-dot { background: #B4482F; }

.v3-app[data-theme="dark"] .v3-role-admin    { background: #2A2518; color: #E9C88A; border-color: #3B3420; }
.v3-app[data-theme="dark"] .v3-role-designer { background: #2B1A38; color: #D4B8E0; border-color: #3D2852; }
.v3-app[data-theme="dark"] .v3-role-engineer { background: #0F3038; color: #9BD5E0; border-color: #1B4450; }
.v3-app[data-theme="dark"] .v3-role-sales    { background: #15331F; color: #9BD5AC; border-color: #224A30; }
.v3-app[data-theme="dark"] .v3-role-viewer   { background: #242628; color: #B8BCBE; border-color: #323639; }
.v3-app[data-theme="dark"] .v3-role-external { background: #3A1B12; color: #E59A82; border-color: #532A1E; }

/* Status text */
.v3-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.v3-status-on     { color: #1C5A33; }
.v3-status-on .v3-dot     { background: var(--green); box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 20%, transparent); }
.v3-app[data-theme="dark"] .v3-status-on { color: #9BD5AC; }
.v3-status-active { color: var(--ink-3); }
.v3-status-active .v3-dot { background: var(--ink-4); }
.v3-status-off    { color: var(--red); }
.v3-status-off .v3-dot    { background: var(--red); }

/* Auth tag */
.v3-auth-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-3); background: var(--bg); margin-right: 3px; font-weight: 500; }
.v3-auth-sso   { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-100); }
.v3-auth-2fa   { background: #E2F1E7; color: #1C5A33; border-color: color-mix(in oklab, var(--green) 25%, transparent); }
.v3-auth-local { background: var(--amber-50); color: #7A4E10; border-color: color-mix(in oklab, var(--amber) 25%, transparent); }
.v3-app[data-theme="dark"] .v3-auth-2fa   { color: #9BD5AC; background: #15331F; }
.v3-app[data-theme="dark"] .v3-auth-local { color: #E9C88A; }

/* Users table */
.v3-utable { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); }
.v3-utr { display: grid; grid-template-columns: 2.2fr 1.4fr 1.1fr 0.9fr 1fr 1.2fr 1.1fr 120px; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.v3-utr:last-child { border-bottom: 0; }
.v3-uthead { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); border-bottom: 1px solid var(--line); padding-top: 12px; padding-bottom: 12px; }
.v3-app[data-theme="dark"] .v3-uthead { background: color-mix(in oklab, var(--teal-100) 10%, var(--surface)); }
.v3-uth { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.v3-utd { min-width: 0; }
.v3-urow { cursor: pointer; transition: background 120ms; }
.v3-urow:hover { background: var(--teal-50); }
.v3-urow-off { opacity: 0.58; }
.v3-urow-off:hover { opacity: 0.85; }
.v3-u-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v3-u-user .body { min-width: 0; }
.v3-u-name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.v3-u-email { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-u-dept { color: var(--ink-2); font-size: 13px; }
.v3-u-last { color: var(--ink-2); font-size: 12.5px; }
.v3-u-configs { display: flex; align-items: center; gap: 8px; }
.v3-u-configs .n { font-weight: 600; color: var(--ink); min-width: 24px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.v3-mini-bar { flex: 1; height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; max-width: 80px; }
.v3-mini-bar > div { height: 100%; background: var(--teal-800); }
.v3-app[data-theme="dark"] .v3-mini-bar > div { background: var(--teal-100); }
.v3-u-actions { display: flex; justify-content: flex-end; gap: 2px; }
.v3-u-actions .v3-btn-icon { color: var(--ink-3); padding: 6px; }
.v3-u-actions .v3-btn-icon:hover { color: var(--ink); }
.v3-u-actions .v3-btn-icon.danger:hover  { color: var(--red); background: #F5DED6; border-color: transparent; }

/* Invitation table */
.v3-inv-tr, .v3-inv-th { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr 100px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.v3-inv-th { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.v3-inv-tr:last-child { border-bottom: 0; }
.v3-inv-mail { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-inv-by, .v3-inv-expire { color: var(--ink-3); font-size: 12px; }
.v3-inv-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
.v3-inv-pending  { color: #7A4E10; background: var(--amber-50); border-color: color-mix(in oklab, var(--amber) 30%, transparent); }
.v3-inv-pending .v3-dot  { background: var(--amber); }
.v3-inv-expired  { color: var(--red); background: #F5DED6; border-color: color-mix(in oklab, var(--red) 30%, transparent); }
.v3-inv-expired .v3-dot  { background: var(--red); }
.v3-inv-accepted { color: #1C5A33; background: #E2F1E7; border-color: color-mix(in oklab, var(--green) 30%, transparent); }
.v3-inv-accepted .v3-dot { background: var(--green); }
.v3-app[data-theme="dark"] .v3-inv-pending  { color: #E9C88A; background: #3A2E18; }
.v3-app[data-theme="dark"] .v3-inv-expired  { color: #E59A82; background: #3A1B12; }
.v3-app[data-theme="dark"] .v3-inv-accepted { color: #9BD5AC; background: #15331F; }
.v3-inv-actions { display: flex; gap: 2px; justify-content: flex-end; }

@media (max-width: 1100px) {
    .v3-seat-hero { grid-template-columns: 1fr; }
    .v3-seat-hero .aside { border-left: 0; border-top: 1px solid var(--line-soft); padding-left: 0; padding-top: 14px; }
}

/* ========================================================================
   Responsive — tablet + phone
   Breakpoints:
     <= 1200: 3 columns for product grid
     <= 900:  sidebar becomes off-canvas, topbar compacts, 2-col grid
     <= 600:  single column, tighter spacing, simplified topbar
   ======================================================================== */

@media (max-width: 1200px) {
    .v3-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .v3-content { padding: 24px 20px 60px; }
}

@media (max-width: 900px) {
    /* Collapse the app grid to a single column; sidebar becomes a drawer. */
    .v3-app { grid-template-columns: 1fr; }
    .v3-side {
        position: fixed; top: 0; left: 0;
        width: 280px; height: 100vh; z-index: 60;
        transform: translateX(-100%);
        transition: transform 220ms ease;
        box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    }
    .v3-app[data-sidebar="expanded"] .v3-side { transform: translateX(0); }
    /* Always show labels inside the drawer even when the app is in "collapsed" state. */
    .v3-app[data-sidebar="collapsed"] .v3-side { transform: translateX(-100%); }
    .v3-side-scrim {
        position: fixed; inset: 0;
        background: rgba(17,61,79,0.35);
        z-index: 50;
        animation: v3SideScrim 180ms ease;
    }
    .v3-app[data-theme="dark"] .v3-side-scrim { background: rgba(0,0,0,0.55); }
    .v3-app[data-sidebar="expanded"] .v3-side-scrim { display: block; }
    @keyframes v3SideScrim { from { opacity: 0; } to { opacity: 1; } }

    .v3-topbar { padding: 10px 14px; gap: 10px; }
    .v3-topbar .crumb { display: none; }
    .v3-topbar .v3-search { display: none; }
    .v3-topbar .kbd { display: none; }
    .v3-design-toggle button { padding: 4px 10px; font-size: 11.5px; }

    .v3-content { padding: 20px 14px 60px; max-width: 100%; }

    .v3-page-h { flex-direction: column; align-items: stretch; gap: 12px; }
    .v3-page-h-actions { margin-left: 0; }

    .v3-h1 { font-size: 22px; }
    .v3-page-h .v3-h1 { font-size: 24px; }

    .v3-grid.cols-4, .v3-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .v3-toolbar { gap: 8px; }
    .v3-search { min-width: 0; flex: 1 1 200px; }

    /* Users table becomes a stacked card list */
    .v3-utr { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
    .v3-uthead { display: none; }
    .v3-utd::before {
        content: attr(data-label);
        display: inline-block;
        font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
        color: var(--ink-4); font-weight: 600; margin-right: 8px;
    }
    .v3-u-user::before { content: none; }
    .v3-u-actions { justify-content: flex-start; }

    .v3-inv-th { display: none; }
    .v3-inv-tr { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
}

@media (max-width: 600px) {
    .v3-content { padding: 16px 12px 60px; }
    .v3-grid.cols-4, .v3-grid.cols-3, .v3-grid.cols-2 { grid-template-columns: 1fr; }

    .v3-toolbar { flex-wrap: wrap; }
    .v3-toolbar .spacer { display: none; }
    .v3-search { width: 100%; min-width: 0; }
    .v3-select-pill { flex: 1; min-width: 0; }

    .v3-topbar { gap: 8px; padding: 8px 10px; }
    .v3-topbar .user { width: 26px; height: 26px; font-size: 10px; }

    .v3-design-toggle button { padding: 3px 8px; font-size: 11px; }

    .v3-card .v3-render { aspect-ratio: 16/10; }
    .v3-card .actions { flex-wrap: wrap; }
    .v3-card .actions .v3-btn { flex: 1 1 100%; }

    .v3-seat-count .big { font-size: 32px; }
    .v3-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .v3-tab { white-space: nowrap; }

    .v3-pager { flex-direction: column; gap: 10px; align-items: center; }
}

/* Viewport safe-area (iPhone notch) */
.v3-app { padding-bottom: env(safe-area-inset-bottom); }

/* The V3 shell uses an inner scroll container (.v3-main). The sidebar and topbar
   stay fixed; only the content area scrolls. No body-level scroll override needed. */

/* ========================================================================
   V3 Configurator — scoped under .v3-cfg-root
   ======================================================================== */

.v3-cfg-root .v3-cfg-main {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Minimal colored-wash topbar */
.v3-cfg-root .v3-cfg-topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 20px;
    background: linear-gradient(90deg, var(--teal-50) 0%, var(--surface) 35%, var(--amber-50) 100%);
    border-bottom: 1px solid var(--line);
    flex: none;
    min-height: 56px;
}
.v3-cfg-root .back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--ink-3); background: transparent; border: 0; padding: 4px 6px; border-radius: 6px;
    cursor: pointer; flex: none;
}
.v3-cfg-root .back-link:hover { color: var(--teal-800); background: var(--teal-50); }
.v3-cfg-root .v3-cfg-topbar .sb-div { width: 1px; height: 18px; background: var(--line); }
.v3-cfg-root .v3-cfg-topbar .crumb { color: var(--ink-3); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.v3-cfg-root .v3-cfg-topbar .crumb b { color: var(--ink); font-weight: 500; }
.v3-cfg-root .v3-cfg-topbar .crumb b.accent { color: var(--teal-800); }
.v3-cfg-root .tree-show-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
    font-size: 12px; font-weight: 500;
    color: var(--teal-800); background: var(--teal-50); border: 1px solid var(--teal-100); border-radius: 6px;
    cursor: pointer; flex: none;
}
.v3-cfg-root .tree-show-btn:hover { background: var(--teal-100); }
.v3-cfg-root .v3-cfg-subbar .sb-title .tree-show-btn { margin-right: 4px; }
.v3-cfg-root .v3-cfg-topbar .spacer { flex: 1; }

/* Subbar */
.v3-cfg-root .v3-cfg-subbar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 20px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    flex: none; min-height: 49px;
}
.v3-cfg-root .v3-cfg-subbar .sb-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.v3-cfg-root .v3-cfg-subbar .sb-title h1 {
    margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
}
.v3-cfg-root .v3-cfg-subbar .sb-title .mono { font-family: var(--mono); color: var(--ink-4); font-size: 11.5px; }
.v3-cfg-root .v3-cfg-subbar .sb-title .rev {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--green);
    background: var(--green-50); padding: 2px 8px; border-radius: 999px; font-weight: 500;
}
.v3-cfg-root .v3-cfg-subbar .sb-title .rev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.v3-cfg-root .v3-cfg-subbar .sb-meta { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-cfg-root .v3-cfg-subbar .sb-meta .dot { margin: 0 8px; color: var(--ink-4); }
.v3-cfg-root .v3-cfg-subbar .sb-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.v3-cfg-root .v3-cfg-subbar .sb-actions .sb-div { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.v3-cfg-root .v3-cfg-subbar .sb-actions .v3-btn.danger { color: var(--red); }

/* Workspace: tree | canvas | rrail */
.v3-cfg-root .v3-cfg-workspace {
    display: grid;
    grid-template-columns: var(--tree-w, 248px) minmax(0, 1fr) var(--rail-w, 460px);
    flex: 1; min-height: 0;
    transition: grid-template-columns 220ms ease;
}
.v3-cfg-root .v3-cfg-workspace > .v3-cfg-tree   { grid-column: 1; }
.v3-cfg-root .v3-cfg-workspace > .v3-cfg-canvas { grid-column: 2; }
.v3-cfg-root .v3-cfg-workspace > .v3-cfg-rrail  { grid-column: 3; }
.v3-cfg-root .v3-cfg-workspace[data-tree="collapsed"] { grid-template-columns: 0 minmax(0, 1fr) var(--rail-w, 460px); }
.v3-cfg-root .v3-cfg-workspace[data-tree="collapsed"] .v3-cfg-tree { display: none; }
.v3-cfg-root .v3-cfg-workspace[data-rrail="collapsed"] { grid-template-columns: var(--tree-w, 248px) minmax(0, 1fr) 0; }
.v3-cfg-root .v3-cfg-workspace[data-rrail="collapsed"] .v3-cfg-rrail { display: none; }
.v3-cfg-root .v3-cfg-workspace[data-tree="collapsed"][data-rrail="collapsed"] { grid-template-columns: 0 minmax(0, 1fr) 0; }
.v3-cfg-root .v3-cfg-workspace[data-right="expanded-rail"] { grid-template-columns: 0 0 1fr; }
.v3-cfg-root .v3-cfg-workspace[data-right="expanded-rail"] .v3-cfg-tree { display: none; }
.v3-cfg-root .v3-cfg-workspace[data-right="expanded-rail"] .v3-cfg-canvas { visibility: hidden; overflow: hidden; }

/* Tree hide button */
.v3-cfg-root .v3-cfg-tree .tree-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.v3-cfg-root .v3-cfg-tree .tree-hide-btn { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; color: var(--ink-4); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.v3-cfg-root .v3-cfg-tree .tree-hide-btn:hover { background: var(--surf-2); color: var(--ink-2); }

/* Tree */
.v3-cfg-root .v3-cfg-tree {
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 18px 14px 18px 18px; overflow-y: auto; min-width: 0;
}
.v3-cfg-root .tree-h { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); margin: 0 0 12px; font-weight: 600; font-family: var(--mono); }
.v3-cfg-root .progress-bar { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.v3-cfg-root .progress-fill { height: 100%; background: var(--teal-800); transition: width 300ms; }
.v3-cfg-root[data-theme="dark"] .progress-fill { background: var(--teal-100); }
.v3-cfg-root .tree-group { margin-bottom: 14px; }
.v3-cfg-root .tree-group-h { display: flex; align-items: center; gap: 10px; padding: 6px 0 8px; font-size: 12px; color: var(--ink-3); font-weight: 600; cursor: pointer; }
.v3-cfg-root .tree-group-h .idx {
    width: 20px; height: 20px; border-radius: 50%; background: var(--teal-100); color: var(--teal-800);
    font-size: 11px; font-weight: 600; display: grid; place-items: center; flex: none; font-family: var(--mono);
}
.v3-cfg-root .tree-group.current .tree-group-h .idx { background: var(--teal-800); color: #fff; box-shadow: 0 0 0 4px var(--teal-50); }
.v3-cfg-root .tree-group-h .name { color: var(--ink-2); flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-cfg-root .tree-node {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 28px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.v3-cfg-root .tree-node::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.v3-cfg-root .tree-node::after  { content: ""; position: absolute; left: 9px; top: 14px; width: 10px; height: 1px; background: var(--line); }
.v3-cfg-root .tree-node:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-cfg-root .tree-node.active { background: var(--teal-100); color: var(--teal-800); font-weight: 500; }
.v3-cfg-root .tree-node .num { font-family: var(--mono); font-size: 11px; color: var(--ink-4); min-width: 28px; }
.v3-cfg-root .tree-node.active .num { color: var(--teal-800); }
.v3-cfg-root .tree-node .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.v3-cfg-root .tree-node .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; margin-left: auto; }
.v3-cfg-root .tree-node.done .dot { background: var(--green); }
.v3-cfg-root .tree-node.partial .dot { background: var(--amber); }
.v3-cfg-root .tree-node.current .dot { background: var(--teal-800); box-shadow: 0 0 0 3px var(--teal-100); }

/* Canvas */
.v3-cfg-root .v3-cfg-canvas { padding: 22px 28px 24px; overflow-y: auto; min-width: 0; }
.v3-cfg-root .canvas-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.v3-cfg-root .canvas-h h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.v3-cfg-root .canvas-h .num { font-family: var(--mono); color: var(--ink-4); font-size: 14px; }
.v3-cfg-root .canvas-sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 18px; }

/* Section card */
.v3-cfg-root .section-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    margin-bottom: 18px; overflow: hidden; box-shadow: var(--shadow);
    border-left: 3px solid var(--teal-800);
}
.v3-cfg-root .section-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, var(--teal-50), var(--surface));
}
.v3-cfg-root .section-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.v3-cfg-root .section-head h3 .num { font-family: var(--mono); color: var(--ink-4); font-size: 12px; }
.v3-cfg-root .section-head .count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); background: var(--bg); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-soft); }
.v3-cfg-root .section-head .col-picker { display: inline-flex; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin-left: auto; }
.v3-cfg-root .section-head .col-picker button { padding: 3px 8px; border: 0; background: transparent; color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); border-radius: 5px; cursor: pointer; }
.v3-cfg-root .section-head .col-picker button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
/* "D" button — "follow the .sdc design default". Active when no user override is set. */
.v3-cfg-root .section-head .col-picker button.d { margin-left: 2px; padding-left: 6px; padding-right: 6px; border-left: 1px solid var(--line-soft); }
.v3-cfg-root .section-head .col-picker button.d.on { background: var(--teal-50); color: var(--teal-800); }
.v3-cfg-root .section-body { padding: 18px; display: grid; gap: 16px 20px; }
.v3-cfg-root .section-body[data-cols="1"] { grid-template-columns: 1fr; }
.v3-cfg-root .section-body[data-cols="2"] { grid-template-columns: 1fr 1fr; }
.v3-cfg-root .section-body[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-cfg-root .section-body[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

/* Nested subgroup card — sits inside .section-body, spans full row so it
   isn't squeezed into a single grid column. Each deeper level loses the
   left teal accent and gains a slightly muted background for hierarchy. */
.v3-cfg-root .subsection-card {
    grid-column: 1 / -1;
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    border-left: 2px solid var(--teal-100);
    overflow: hidden;
}
.v3-cfg-root .subsection-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface);
}
.v3-cfg-root .subsection-head h4 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.v3-cfg-root .subsection-head h4 .num {
    font-family: var(--mono);
    color: var(--ink-4);
    font-size: 11px;
}
.v3-cfg-root .subsection-body { padding: 14px; display: grid; gap: 14px 18px; }
.v3-cfg-root .subsection-body[data-cols="1"] { grid-template-columns: 1fr; }
.v3-cfg-root .subsection-body[data-cols="2"] { grid-template-columns: 1fr 1fr; }
.v3-cfg-root .subsection-body[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-cfg-root .subsection-body[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.v3-cfg-root .subsection-card[data-depth="2"] { border-left-color: var(--teal-50); }
.v3-cfg-root .subsection-card[data-depth="2"] .subsection-head { background: var(--bg); }

/* Fields */
.v3-cfg-root .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v3-cfg-root .field-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.v3-cfg-root .field-h > .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.v3-cfg-root .field-h .info-btn { width: 16px; height: 16px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-4); padding: 0; border-radius: 3px; cursor: pointer; }
.v3-cfg-root .field-h .info-btn:hover { color: var(--teal-800); background: var(--teal-50); }
.v3-cfg-root .field-h .lock { margin-left: auto; color: var(--ink-4); display: inline-flex; }
.v3-cfg-root .field-h .lock.on { color: var(--amber); }
.v3-cfg-root .field-input {
    display: flex; align-items: stretch;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
    overflow: hidden;
}
.v3-cfg-root .field-input input,
.v3-cfg-root .field-input select {
    width: 100%; background: transparent; border: 0; outline: 0;
    padding: 8px 10px; font-size: 13.5px; min-width: 0; color: var(--ink);
}
.v3-cfg-root .field-input select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236C7176' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px;
}
.v3-cfg-root .field-input:focus-within { border-color: var(--teal-800); box-shadow: 0 0 0 3px var(--teal-50); }
/* Toggle widgets are self-contained pills — drop the surrounding input-box chrome. */
.v3-cfg-root .field-input:has(.toggle) { border: 0; background: transparent; overflow: visible; padding: 4px 0; }
.v3-cfg-root .field-input:has(.toggle):focus-within { box-shadow: none; }
/* sdc-only widgets are self-styled — strip the field-input border/background so the
   widget visuals (swatches, sliders, stars, checkbox rows, matrix grids, chips) read
   cleanly without the input-box chrome competing for attention. */
.v3-cfg-root .field-input:has(.v3-sdcr-swatches),
.v3-cfg-root .field-input:has(.v3-sdcr-slider),
.v3-cfg-root .field-input:has(.v3-sdcr-rating),
.v3-cfg-root .field-input:has(.v3-sdcr-checks),
.v3-cfg-root .field-input:has(.v3-sdcr-matrix-grid),
.v3-cfg-root .field-input:has(.v3-sdcr-chips),
.v3-cfg-root .field-input:has(.v3-sdcr-stepper),
.v3-cfg-root .field-input:has(.v3-sdcr-dim),
.v3-cfg-root .field-input:has(.v3-sdcr-single-check),
.v3-cfg-root .field-input:has(.v3-sdcr-radio),
.v3-cfg-root .field-input:has(.v3-sdcr-seg),
.v3-cfg-root .field-input:has(.v3-sdcr-img-radio),
.v3-cfg-root .field-input:has(.v3-sdcr-img-list),
.v3-cfg-root .field-input:has(.v3-sdcr-file),
.v3-cfg-root .field-input:has(.v3-sdcr-display-img),
.v3-cfg-root .field-input:has(.v3-sdcr-description) { border: 0; background: transparent; overflow: visible; padding: 4px 0; }
.v3-cfg-root .field-input:has(.v3-sdcr-swatches):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-slider):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-rating):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-checks):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-matrix-grid):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-chips):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-stepper):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-dim):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-single-check):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-radio):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-seg):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-img-radio):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-img-list):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-file):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-display-img):focus-within,
.v3-cfg-root .field-input:has(.v3-sdcr-description):focus-within { box-shadow: none; }
.v3-cfg-root .field-input.committed { border-color: var(--green); }
.v3-cfg-root .field-input.committed::before { content: ""; width: 3px; background: var(--green); }
/* Readonly fields are visually faded and fully non-interactive — even
   for SDC-rendered widgets (sliders, steppers, radios, etc.) that the
   chrome's `disabled` attribute can't reach. */
.v3-cfg-root .field-input.readonly {
    opacity: 0.65; background: var(--bg);
    pointer-events: none;
    cursor: not-allowed;
}
/* Suppress the mandatory red border + glow when the field is read-only —
   the user can't change it anyway, so flagging it as pending is misleading. */
.v3-cfg-root .field-input.readonly.mandatory-pending {
    border-color: var(--line);
    box-shadow: none;
}
.v3-cfg-root .field-input.readonly.mandatory-pending:focus-within {
    border-color: var(--line);
    box-shadow: none;
}
/* Hide the mandatory asterisk for read-only fields too. */
.v3-cfg-root .field:has(.field-input.readonly) .field-req { display: none; }
.v3-cfg-root .field-help { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.v3-cfg-root .field-error { font-size: 11px; color: var(--red); }

/* tc_unit — unit badge right-aligned inside the input wrapper */
.v3-cfg-root .field-input .field-unit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-4);
    border-left: 1px solid var(--line-soft);
    background: var(--bg);
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}
/* give the input a little breathing room when a unit badge is present */
.v3-cfg-root .field-input input.has-unit { padding-right: 6px; }

/* tc_textarea — full-width textarea inside the field-input wrapper */
.v3-cfg-root .field-input textarea {
    width: 100%;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 8px 10px;
    font-size: 13.5px;
    color: var(--ink);
    resize: vertical;
    min-height: 80px;
    font-family: var(--sans);
    line-height: 1.5;
}

/* Domain option color-coding — mirrors V2: green = possible, orange = possible with change, red = not possible.
   Colors apply to <option> entries in the open dropdown list AND to the <select> closed display
   so the selected value's compatibility is visible at a glance. */
.v3-cfg-root .field-input select option.opt-resolve  { background-color: var(--amber-50); color: var(--amber); }
.v3-cfg-root .field-input select option.opt-invalid  { background-color: var(--red-50);   color: var(--red); }
.v3-cfg-root .field-input select.opt-resolve         { background-color: var(--amber-50); color: var(--amber); }
.v3-cfg-root .field-input select.opt-invalid         { background-color: var(--red-50);   color: var(--red); }

/* tc_mandatory — red border when the field is mandatory and not yet committed */
.v3-cfg-root .field-input.mandatory-pending {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.v3-cfg-root .field-input.mandatory-pending:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Mandatory field label marker */
.v3-cfg-root .field-h .field-req {
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    margin-left: 2px;
    line-height: 1;
}

/* Lock button — mandatory urgent state */
.v3-cfg-root .field .lock.mandatory-lock {
    border-color: var(--red);
    color: var(--red);
    background: rgba(220, 38, 38, 0.06);
}
.v3-cfg-root .field .lock.mandatory-lock:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.12);
}
.v3-cfg-root .field.v3-cfg-image-field { display: block; padding: 0; background: transparent; border: 0; }
.v3-cfg-root .v3-cfg-image { display: block; width: 100%; max-height: 200px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; }

/* Field paired with its trailing image param(s) — one grid cell, image(s) stack
   directly beneath the field at any column count. */
.v3-cfg-root .field-with-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.v3-cfg-root .field-with-images .v3-cfg-image { max-height: 220px; }

/* Orphan image params (no preceding field) span the full grid row. */
.v3-cfg-root .section-body > .v3-cfg-image-field,
.v3-cfg-root .subsection-body > .v3-cfg-image-field {
    grid-column: 1 / -1;
}

/* Toggle */
.v3-cfg-root .toggle { position: relative; width: 40px; height: 22px; background: var(--line); border-radius: 999px; border: 0; padding: 0; transition: background 160ms; cursor: pointer; flex: none; }
.v3-cfg-root .toggle::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 160ms; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.v3-cfg-root .toggle.on { background: var(--teal-800); }
.v3-cfg-root .toggle.on::after { transform: translateX(18px); }

/* Action bar */
.v3-cfg-root .v3-cfg-action-bar {
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 28px; display: flex; align-items: center; gap: 10px;
    flex: none;
}
.v3-cfg-root .v3-cfg-action-bar .spacer { flex: 1; }
.v3-cfg-root .v3-cfg-action-bar .info { color: var(--ink-3); font-size: 12.5px; }

/* Right rail */
.v3-cfg-root .v3-cfg-rrail {
    background: var(--surface); border-left: 1px solid var(--line);
    display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}
/* Folder-style tabs: the active tab sits proud of the tab bar with rounded
   top corners and "cuts" the bottom border so it visually belongs to the
   content below. Inactive tabs are flush with the bar. */
.v3-cfg-root .rrail-tabs {
    display: flex; align-items: flex-end; gap: 2px;
    padding: 8px 10px 0; background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex: none;
}
.v3-cfg-root .rrail-tabs button {
    position: relative;
    padding: 8px 14px 9px; margin-bottom: -1px;
    background: transparent; border: 1px solid transparent;
    border-bottom-color: transparent;
    font-size: 12.5px; color: var(--ink-3);
    border-radius: 8px 8px 0 0;
    cursor: pointer; transition: color 120ms, background 120ms, border-color 120ms;
    display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.v3-cfg-root .rrail-tabs button .icon { width: 14px; height: 14px; }
.v3-cfg-root .rrail-tabs button:hover { color: var(--ink); background: rgba(0, 0, 0, 0.03); }
.v3-cfg-root .rrail-tabs button.on {
    color: var(--teal-800);
    background: var(--surface);
    border-color: var(--line);
    border-bottom-color: var(--surface);
}
.v3-cfg-root .rrail-tabs button.on:hover { background: var(--surface); }
.v3-cfg-root .rrail-tabs .rt-spacer { flex: 1; }
.v3-cfg-root .rrail-tabs .rt-expand {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0; margin: 0;
    /* The tab buttons bottom-anchor to the divider (align-items: flex-end on
       the bar). These action buttons should instead sit centred against the
       tab labels, so override the cross-axis alignment for them only. */
    align-self: center;
    border-radius: 6px; border: 1px solid var(--line);
    color: var(--ink-3); background: var(--bg); cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.v3-cfg-root .rrail-tabs .rt-expand:hover { color: var(--teal-800); border-color: var(--teal-800); background: var(--surface); }

/* Pill on/off switch used for "Committed only". Makes the toggle obviously
   pressable — a plain checkbox reads as static text next to the heading. */
.v3-cfg-root .v3-switch {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 3px 10px 3px 4px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 999px;
    color: var(--ink-3); font-size: 11.5px; font-weight: 500;
    cursor: pointer; user-select: none;
    transition: border-color 120ms, color 120ms, background 120ms;
}
.v3-cfg-root .v3-switch:hover { border-color: var(--teal-600, var(--teal-800)); color: var(--ink); }
.v3-cfg-root .v3-switch-track {
    position: relative; display: inline-block;
    width: 26px; height: 14px; border-radius: 999px;
    background: var(--line); transition: background 140ms;
    flex: none;
}
.v3-cfg-root .v3-switch-thumb {
    position: absolute; top: 1px; left: 1px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 140ms;
}
.v3-cfg-root .v3-switch.on { background: rgba(20, 170, 170, 0.12); border-color: var(--teal-800); color: var(--ink); }
.v3-cfg-root .v3-switch.on .v3-switch-track { background: var(--teal-800); }
.v3-cfg-root .v3-switch.on .v3-switch-thumb { transform: translateX(12px); }
.v3-cfg-root .v3-switch-label { line-height: 1; }
.v3-cfg-root .rrail-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; min-height: 0; }
/* Docs tab: fill the rail, let the iframe take remaining height so only
   the PDF viewer scrolls (not the rrail-body). */
.v3-cfg-root .rrail-body > .docs-tab { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.v3-cfg-root .docs-tab .docs-pdf { flex: 1; min-height: 240px; }
.v3-cfg-root .docs-tab .docs-pdf > iframe { width: 100%; height: 100%; display: block; border: 0; }

.v3-cfg-root .result-h { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.v3-cfg-root .result-h h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-3); }
.v3-cfg-root .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: v3cfgPulse 2.2s ease-in-out infinite; }
@keyframes v3cfgPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.v3-cfg-root .preview-3d {
    aspect-ratio: 4/3;
    background:
      linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 14px 14px,
      linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 14px 14px,
      var(--bg);
    border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 14px; position: relative;
    display: grid; place-items: center; overflow: hidden; min-height: 220px;
}
.v3-cfg-root .preview-3d .corner { position: absolute; font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.v3-cfg-root .preview-3d .corner.tl { top: 8px; left: 10px; }
.v3-cfg-root .preview-3d .corner.br { bottom: 8px; right: 10px; }

.v3-cfg-root .warn { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-sm); font-size: 12px; margin-bottom: 6px; }
.v3-cfg-root .warn.warn-amber { background: var(--amber-50); color: var(--amber); }
.v3-cfg-root .warn.warn-error { background: var(--red-50); color: var(--red); }
.v3-cfg-root .warn.warn-ok    { background: var(--green-50); color: var(--green); }

.v3-cfg-root .result-block { margin-bottom: 14px; }
.v3-cfg-root .result-block h4 {
    margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-4); font-family: var(--mono); display: flex; align-items: center; gap: 8px;
}
.v3-cfg-root .result-block h4::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* Flow sheet viewer (FlowSheetViewer.razor): native top bar + canvas fill. */
.v3-fsv-root { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.v3-fsv-bar {
    display: flex; align-items: center; justify-content: flex-end; gap: 6px;
    padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface);
    flex: 0 0 auto;
}
.v3-fsv-bar .v3-btn-icon { width: 28px; min-width: 28px; padding: 0; font-weight: 700; }
.v3-fsv-canvas { display: block; flex: 1 1 auto; min-height: 0; width: 100%; background: #fff; }

.v3-cfg-root .coming-soon {
    border: 1px dashed var(--line); border-radius: var(--r-md);
    padding: 28px 18px; text-align: center; color: var(--ink-3); font-size: 13px;
    background: var(--bg);
}
.v3-cfg-root .coming-soon h4 { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }

/* Pricing panel */
.v3-cfg-root .v3-cfg-pricing-empty,
.v3-cfg-root .v3-cfg-bom-empty {
    border: 1px dashed var(--line); border-radius: var(--r-md);
    padding: 14px; text-align: center; color: var(--ink-4); font-size: 12px;
    background: var(--bg);
}
.v3-cfg-root .v3-cfg-pricing-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.v3-cfg-root .v3-cfg-pricing-table td { padding: 6px 0; color: var(--ink-2); }
.v3-cfg-root .v3-cfg-pricing-table td.num { text-align: right; font-family: var(--mono); font-feature-settings: "tnum" 1; }
.v3-cfg-root .v3-cfg-pricing-table tr.markup.up td.num   { color: var(--amber); }
.v3-cfg-root .v3-cfg-pricing-table tr.markup.down td.num { color: var(--green); }
.v3-cfg-root .v3-cfg-pricing-table tr.total td {
    border-top: 1px solid var(--line);
    padding-top: 10px; font-size: 15px; font-weight: 600; color: var(--ink);
}
.v3-cfg-root .v3-cfg-pricing-table tr.total td.num { color: var(--teal-800); }
/* Per-contribution lines (one row per priced option / pricing rule). */
.v3-cfg-root .v3-cfg-pricing-table tr.line td {
    padding: 3px 0; font-size: 12.5px; color: var(--ink-3);
}
.v3-cfg-root .v3-cfg-pricing-table tr.line td.line-lbl {
    padding-left: 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 0; /* let table layout shrink to fit */
}
.v3-cfg-root .v3-cfg-pricing-table tr.line.up td.num   { color: var(--amber); }
.v3-cfg-root .v3-cfg-pricing-table tr.line.down td.num { color: var(--green); }
.v3-cfg-root .v3-cfg-pricing-table tr.subtotal td {
    border-top: 1px dashed var(--line-soft); padding-top: 6px;
}
.v3-cfg-root .v3-cfg-pricing-pct {
    display: inline-block; margin-left: 6px;
    padding: 1px 5px; border-radius: 999px;
    background: var(--surface); color: var(--ink-3);
    font-size: 10.5px; font-family: var(--mono);
}

/* BOM panel */
.v3-cfg-root .v3-cfg-bom-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.v3-cfg-root .v3-cfg-bom-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg); font-size: 12.5px; color: var(--ink-2);
}
.v3-cfg-root .v3-cfg-bom-list .dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--teal-800); flex-shrink: 0;
}
.v3-cfg-root .v3-cfg-bom-list .part { font-family: var(--mono); }

/* Loading & empty states */
.v3-cfg-root .v3-cfg-loading, .v3-cfg-root .v3-cfg-empty {
    flex: 1; display: grid; place-items: center; color: var(--ink-3); font-size: 14px;
}

/* Fade in */
@keyframes v3cfgFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.v3-cfg-root .fade-in > * { animation: v3cfgFade 300ms ease both; }
.v3-cfg-root .fade-in > *:nth-child(2) { animation-delay: 60ms; }
.v3-cfg-root .fade-in > *:nth-child(3) { animation-delay: 120ms; }
.v3-cfg-root .fade-in > *:nth-child(4) { animation-delay: 180ms; }

/* Right-rail Result tab: parameter table */
.v3-cfg-root .rrail-body .result-block-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.v3-cfg-root .rrail-body .result-block-h h4 { margin: 0; }

/* Docs tab */
.v3-cfg-root .docs-tab .docs-head { display: flex; align-items: flex-start; gap: 12px; }
.v3-cfg-root .docs-tab .docs-title { flex: 1; min-width: 0; }
.v3-cfg-root .docs-tab .docs-title h4 { margin: 0 0 2px; font-size: 14px; font-weight: 600; color: var(--ink); }
.v3-cfg-root .docs-tab .docs-title .sub { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.v3-cfg-root .docs-tab .docs-pdf { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.v3-cfg-root .docs-tab .docs-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.v3-cfg-root .docs-tab .docs-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: background 120ms, border-color 120ms, color 120ms; }
.v3-cfg-root .docs-tab .docs-chip:hover { border-color: var(--teal-600); color: var(--ink); }
.v3-cfg-root .docs-tab .docs-chip.on { background: rgba(20, 170, 170, 0.12); border-color: var(--teal-800); color: var(--ink); }
.v3-cfg-root .docs-tab .docs-chip-ic { font-size: 13px; line-height: 1; }
.v3-cfg-root .docs-tab .docs-chip-name { font-weight: 500; }
.v3-cfg-root .docs-tab .docs-chip-size { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.v3-cfg-root .result-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 11.5px; cursor: pointer; user-select: none; }
.v3-cfg-root .result-toggle input { accent-color: var(--teal-800); }
.v3-cfg-root .result-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.v3-cfg-root .result-table thead th { text-align: left; font-weight: 600; color: var(--ink-4); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; }
.v3-cfg-root .result-table th.ok, .v3-cfg-root .result-table td.ok { width: 24px; text-align: center; color: var(--green); }
.v3-cfg-root .result-table tbody td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: top; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-cfg-root .result-table tbody tr.committed { background: color-mix(in srgb, var(--green-50) 50%, transparent); }
.v3-cfg-root .result-table td.grp { color: var(--ink-4); font-size: 11px; }
.v3-cfg-root .result-table td.val { color: var(--ink); }

/* Modal */
.v3-modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 16, 0.42); display: grid; place-items: center; z-index: 1000; animation: v3modalFade 140ms ease-out; }
.v3-modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 60px rgba(0,0,0,0.25); max-height: calc(100vh - 48px); overflow: hidden; display: flex; flex-direction: column; animation: v3modalSlide 160ms ease-out; }
.v3-modal-card.sm { width: 360px; }
.v3-modal-card.md { width: 480px; }
.v3-modal-card.lg { width: 680px; }
.v3-modal-card.xl { width: min(1100px, 96vw); }
.v3-modal-card.xl .v3-modal-body { overflow: auto; }
.v3-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none; }
.v3-modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.v3-modal-close { background: transparent; border: 0; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.v3-modal-close:hover { background: var(--surf-2); color: var(--ink); }
.v3-modal-body { padding: 18px; overflow-y: auto; }
.v3-modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 8px; background: var(--bg); flex: none; }

@keyframes v3modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes v3modalSlide { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Form helpers inside modals */
.v3-modal-card .v3-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.v3-modal-card .v3-field:last-child { margin-bottom: 0; }
.v3-modal-card .v3-field label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.v3-modal-card .v3-field .hint { color: var(--ink-4); font-size: 11.5px; margin: 0; }
.v3-modal-card .v3-field .hint.err { color: #b91c1c; font-weight: 600; }
.v3-modal-card .v3-field input[type="text"],
.v3-modal-card .v3-field input[type="number"],
.v3-modal-card .v3-field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; color: var(--ink); background: var(--surface); outline: none; font-family: inherit; }
.v3-modal-card .v3-field input:focus, .v3-modal-card .v3-field textarea:focus { border-color: var(--teal-800); box-shadow: 0 0 0 3px var(--teal-50); }

.v3-modal-card .v3-kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.v3-modal-card .v3-kv { display: flex; flex-direction: column; gap: 2px; }
.v3-modal-card .v3-kv .k { color: var(--ink-4); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.v3-modal-card .v3-kv .v { color: var(--ink-2); font-size: 13px; word-break: break-word; }

/* Lock button */
.v3-cfg-root .field .lock { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; color: var(--ink-4); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background 120ms, color 120ms, border-color 120ms; }
.v3-cfg-root .field .lock:hover:not(:disabled) { background: var(--surf-2); color: var(--ink-2); }
.v3-cfg-root .field .lock.on { background: var(--green-50); border-color: var(--green-2, #3f8f5c); color: var(--green-2, #3f8f5c); }
.v3-cfg-root .field .lock:disabled { opacity: 0.45; cursor: not-allowed; }

/* Placeholder pages: a centred card with an icon, title, description and
   "Coming soon" tag. Used by every V3 route that's still stubbed. */
.v3-placeholder { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.v3-placeholder-card { max-width: 480px; width: 100%; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 40px 32px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.v3-placeholder-ic { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 14px; background: rgba(20, 170, 170, 0.08); color: var(--teal-800); display: inline-flex; align-items: center; justify-content: center; }
.v3-placeholder-ic .icon { width: 26px; height: 26px; }
.v3-placeholder-card h1 { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.v3-placeholder-card p { margin: 0 auto 18px; max-width: 360px; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.v3-placeholder-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--teal-800); background: rgba(20, 170, 170, 0.1); border-radius: 999px; }

/* =========================================================================
   Help & Support landing page (HelpAndSupport.razor)
   Look: hero with gradient + soft illustration, quick-action cards, two-
   column layout with tickets on the left and an SLA / status / contact
   side rail on the right, then a popular-articles grid. Static demo —
   every interactive element is non-wired.
   ========================================================================= */

.hs-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: center;
    padding: 30px 32px;
    border-radius: 18px;
    margin-bottom: 18px;
    overflow: hidden;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--teal-800) 16%, var(--surface)) 0%, var(--teal-50) 55%, var(--surface) 100%);
    border: 1px solid color-mix(in oklab, var(--teal-800) 14%, var(--line));
}
.hs-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
        linear-gradient(color-mix(in oklab, var(--teal-800) 8%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(90deg, color-mix(in oklab, var(--teal-800) 8%, transparent) 1px, transparent 1px) 0 0 / 22px 22px;
    mask-image: radial-gradient(110% 90% at 20% 20%, #000 30%, transparent 75%);
    opacity: 0.35;
}
.hs-hero-ink { position: relative; z-index: 1; min-width: 0; }
.hs-eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.6); color: var(--teal-800); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid color-mix(in oklab, var(--teal-800) 14%, transparent); }
.v3-app[data-theme="dark"] .hs-eyebrow { background: rgba(255,255,255,0.06); }
.hs-hero h1 { margin: 10px 0 6px; font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.hs-hero .hs-lead { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; max-width: 620px; }
.hs-hero .hs-lead b { color: var(--ink); font-weight: 600; }

.hs-search { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; max-width: 640px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -12px rgba(11,42,54,0.12); }
.hs-search .ic { color: var(--ink-3); display: inline-flex; }
.hs-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); padding: 8px 0; }
.hs-search .v3-btn-primary { height: 34px; padding: 0 16px; }

.hs-qtags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.hs-qtags .lbl { color: var(--ink-3); font-size: 12px; margin-right: 4px; }
.hs-qtags .tag { font-size: 12px; color: var(--teal-800); background: rgba(255,255,255,0.6); border: 1px solid color-mix(in oklab, var(--teal-800) 14%, transparent); padding: 4px 9px; border-radius: 999px; cursor: pointer; transition: background 120ms; }
.hs-qtags .tag:hover { background: var(--surface); }
.v3-app[data-theme="dark"] .hs-qtags .tag { background: rgba(255,255,255,0.04); }

.hs-hero-art { position: relative; z-index: 1; color: var(--teal-800); opacity: 0.9; }
.hs-hero-art svg { width: 100%; height: auto; max-height: 200px; }
@media (max-width: 900px) {
    .hs-hero { grid-template-columns: 1fr; }
    .hs-hero-art { display: none; }
}

/* ---------- Quick action grid ---------- */
.hs-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.hs-quick.hs-quick-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1080px) { .hs-quick, .hs-quick.hs-quick-3 { grid-template-columns: repeat(2, 1fr); } }
.hs-quick-card {
    display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
    cursor: pointer; transition: transform 120ms, box-shadow 120ms, border-color 120ms;
    text-decoration: none; color: inherit;
}
.hs-quick-card:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -12px rgba(11,42,54,0.25); border-color: color-mix(in oklab, var(--teal-800) 22%, var(--line)); }
.hs-quick-card .ic { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; }
.hs-quick-card .ic .icon { width: 20px; height: 20px; }
.hs-quick-card .t { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.hs-quick-card .s { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.hs-quick-card .arr { color: var(--ink-4); }
.hs-quick-card:hover .arr { color: var(--teal-800); transform: translateX(2px); transition: all 160ms; }
.hs-quick-card.accent-teal .ic { background: rgba(17, 61, 79, 0.10); color: var(--teal-800); }
.hs-quick-card.accent-amber .ic { background: var(--amber-50); color: var(--amber); }
.hs-quick-card.accent-purple .ic { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }
.hs-quick-card.accent-green .ic { background: rgba(22, 163, 74, 0.10); color: #16a34a; }

.live-dot, .ok-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.live-dot { background: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18); }
.ok-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }

/* Inline "Coming soon" tag used in quick-action card titles + side-rail
   card headers. Two sizes: default fits next to a 14-px title, -lg for a
   standalone header pill. The .is-soon modifier also softens the parent
   card so it reads as non-interactive. */
.soon-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: color-mix(in oklab, var(--teal-800) 10%, var(--surface)); color: var(--teal-800); font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: middle; border: 1px solid color-mix(in oklab, var(--teal-800) 14%, transparent); }
.soon-tag-lg { margin: 0; padding: 3px 10px; font-size: 10.5px; }
.hs-quick-card.is-soon { opacity: 0.82; cursor: default; }
.hs-quick-card.is-soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.hs-quick-card.is-soon .arr { display: none; }
.hs-card.is-soon { background: color-mix(in oklab, var(--teal-50) 35%, var(--surface)); border-style: dashed; }
.hs-status-list.preview li { opacity: 0.55; }
.hs-status-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ---------- Main two-column ---------- */
.hs-main { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .hs-main { grid-template-columns: 1fr; } }

.hs-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.hs-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.hs-card-head.tight { margin-bottom: 10px; }
.hs-card-head > div:first-child { flex: 1; min-width: 0; }
.hs-card-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.hs-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.hs-card-head .sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Tabs ---------- */
.hs-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.hs-tabs > button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-3); border-radius: 8px; cursor: pointer; }
.hs-tabs > button:hover { background: var(--teal-50); color: var(--teal-800); }
.hs-tabs > button.on { background: var(--teal-100); color: var(--teal-800); font-weight: 600; }
.hs-tabs > button .num { font-size: 11px; background: rgba(0,0,0,0.06); padding: 1px 6px; border-radius: 999px; color: var(--ink-2); }
.v3-app[data-theme="dark"] .hs-tabs > button .num { background: rgba(255,255,255,0.08); }
.hs-tabs > button.on .num { background: rgba(255,255,255,0.6); color: var(--teal-800); }
.hs-tabs .spacer { flex: 1; }
.hs-tabs .v3-search.sm { width: 220px; }
.hs-tabs .v3-search.sm input { padding: 4px 0; }

/* ---------- Scope segmented control (admin: My tenant / All tenants) ---------- */
.hs-scope {
    display: inline-flex; gap: 2px;
    padding: 3px;
    background: var(--teal-50);
    border: 1px solid var(--teal-100);
    border-radius: 10px;
    margin: 4px 0 10px 0;
}
.hs-scope button {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 0; border-radius: 7px;
    font-size: 12.5px; font-weight: 500;
    color: var(--ink-2); cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}
.hs-scope button svg { width: 14px; height: 14px; }
.hs-scope button:hover { color: var(--ink); }
.hs-scope button.on {
    background: var(--surface);
    color: var(--teal-800);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.hs-scope .scope-badge {
    font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
    padding: 1px 5px; border-radius: 4px;
    background: color-mix(in oklab, var(--amber) 18%, transparent);
    color: var(--amber);
    font-weight: 700;
}

/* ---------- Ticket table ---------- */
.hs-ticket-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hs-ticket-table .row { display: grid; grid-template-columns: 90px 1fr 160px 110px 130px 140px 80px; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
/* Cross-tenant view inserts a Tenant column between Subject and Requester. */
.hs-ticket-table.with-tenant .row { grid-template-columns: 82px 1fr 140px 150px 100px 120px 130px 76px; }
.hs-ticket-table .col.tenant { font-size: 12px; min-width: 0; }
.hs-ticket-table .col.tenant .tenant-pill {
    display: inline-block; max-width: 100%;
    padding: 2px 8px; border-radius: 6px;
    background: var(--teal-50); color: var(--teal-800);
    border: 1px solid var(--teal-100);
    font-size: 11.5px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hs-ticket-table .row:first-child { border-top: 0; }
.hs-ticket-table .row.head { background: var(--teal-50); padding: 8px 14px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hs-ticket-table .row:not(.head):hover { background: color-mix(in oklab, var(--teal-50) 60%, var(--surface)); }
.hs-ticket-table .col.id { color: var(--ink-3); font-size: 12px; }
.hs-ticket-table .col.sub .t { font-size: 13.5px; font-weight: 500; color: var(--ink); margin-bottom: 2px; }
.hs-ticket-table .col.sub .m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.hs-ticket-table .col.sub .tag { background: var(--teal-50); color: var(--teal-800); padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 500; }
.hs-ticket-table .col.sub .dot { color: var(--ink-4); }
.hs-ticket-table .col.sub .msgs, .hs-ticket-table .col.sub .att { display: inline-flex; align-items: center; gap: 3px; }
.hs-ticket-table .col.who { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.hs-ticket-table .col.who .av { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--teal-100); color: var(--teal-800); display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; }
.hs-ticket-table .col.who .n { color: var(--ink); font-weight: 500; line-height: 1.1; }
.hs-ticket-table .col.who .e { color: var(--ink-4); font-size: 11px; line-height: 1.2; }
.hs-ticket-table .col.upd { font-size: 12px; color: var(--ink-2); }
.hs-ticket-table .col.upd .sub { font-size: 11px; color: var(--ink-4); }

.prio-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; }
.prio-pill.p-urgent { background: rgba(220, 38, 38, 0.10); color: #b91c1c; border-color: rgba(220, 38, 38, 0.2); }
.prio-pill.p-high   { background: rgba(234, 88, 12, 0.10);  color: #c2410c; border-color: rgba(234, 88, 12, 0.2); }
.prio-pill.p-med    { background: var(--amber-50); color: var(--amber); border-color: color-mix(in oklab, var(--amber) 30%, transparent); }
.prio-pill.p-low    { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-100); }

.st-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.st-pill.s-open     { background: rgba(59, 130, 246, 0.10); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.22); }
.st-pill.s-progress { background: rgba(124, 58, 237, 0.10); color: #6d28d9; border-color: rgba(124, 58, 237, 0.22); }
.st-pill.s-pending  { background: var(--amber-50); color: var(--amber); border-color: color-mix(in oklab, var(--amber) 30%, transparent); }
.st-pill.s-resolved { background: rgba(22, 163, 74, 0.10); color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.st-pill.s-closed   { background: rgba(0,0,0,0.05); color: var(--ink-2); border-color: var(--line); }
.v3-app[data-theme="dark"] .st-pill.s-closed { background: rgba(255,255,255,0.06); }

.hs-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.hs-card-foot .spacer { flex: 1; }

/* ---------- KB grid ---------- */
.hs-kb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .hs-kb-grid { grid-template-columns: 1fr; } }
.hs-kb { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; transition: border-color 120ms, background 120ms; text-decoration: none; color: inherit; }
.hs-kb:hover { border-color: color-mix(in oklab, var(--teal-800) 22%, var(--line)); background: var(--teal-50); }
.hs-kb .kb-ic { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.hs-kb .kb-ic.teal { background: rgba(17, 61, 79, 0.10); color: var(--teal-800); }
.hs-kb .kb-ic.amber { background: var(--amber-50); color: var(--amber); }
.hs-kb .kb-ic.purple { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }
.hs-kb .kb-body .t { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.hs-kb .kb-body .s { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; line-height: 1.45; }
.hs-kb .kb-body .meta { display: flex; gap: 12px; font-size: 11px; color: var(--ink-4); }
.hs-kb .kb-body .meta span { display: inline-flex; align-items: center; gap: 4px; }
.hs-kb .kb-body .meta .star-filled { color: var(--amber); }

/* ---------- Side rail cards ---------- */
.hs-col-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 82px; }
@media (max-width: 1080px) { .hs-col-side { position: static; } }

.hs-sla .hs-sla-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hs-sla .hs-sla-head .t { font-size: 13px; color: var(--ink-3); }
.hs-sla .plan-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: linear-gradient(135deg, var(--teal-800), var(--teal-700)); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.hs-sla-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hs-sla-grid .kv { padding: 10px; background: var(--teal-50); border-radius: 10px; }
.hs-sla-grid .k { font-size: 11px; color: var(--ink-3); letter-spacing: 0.03em; text-transform: uppercase; font-weight: 600; margin-bottom: 4px; }
.hs-sla-grid .v { display: flex; align-items: baseline; gap: 6px; }
.hs-sla-grid .v b { font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.hs-sla-grid .mini { font-size: 10.5px; color: var(--ink-4); }
.hs-sla-grid .mini.up { color: #15803d; font-weight: 600; }

.hs-status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hs-status-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 4px 0; }
.hs-status-list li em { font-style: normal; color: var(--ink-3); margin-right: auto; }
.hs-status-list li .ms { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.hs-status-list .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.hs-status-list .dot.ok { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16); }
.hs-status-list .dot.warn { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in oklab, var(--amber) 25%, transparent); }
.hs-status-list .dot.down { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16); }
.hs-status-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--teal-800); margin-top: 10px; cursor: pointer; font-weight: 500; }
.hs-status-link:hover { text-decoration: underline; }

.hs-contact h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink); }
.hs-contact .contact-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; text-decoration: none; color: inherit; }
.hs-contact .contact-row:hover { background: var(--teal-50); }
.hs-contact .contact-row .ic { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.hs-contact .contact-row .ic.teal { background: rgba(17, 61, 79, 0.10); color: var(--teal-800); }
.hs-contact .contact-row .ic.amber { background: var(--amber-50); color: var(--amber); }
.hs-contact .contact-row .ic.purple { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }
.hs-contact .contact-row .t { font-size: 13px; font-weight: 600; color: var(--ink); }
.hs-contact .contact-row .s { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.hs-contact .contact-row .arr { color: var(--ink-4); }
.hs-contact .contact-row:hover .arr { color: var(--teal-800); }

/* =============================================================
   V3 Support Dialogs — V3CreateTicket + V3TicketDetail
   ============================================================= */

/* ---------- Create ticket ----------
   The .v3-ct element IS the modal card — no V3Modal wrapper. Parent
   renders us inside a `.v3-modal-backdrop`; we provide the card chrome
   (width, border, shadow, max-height, scrollable body). This keeps the
   markup flat and lets us own the header/body/footer layout cleanly. */
.v3-ct {
    display: flex; flex-direction: column;
    background: var(--surface);
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    animation: v3modalSlide 160ms ease-out;
}
.v3-ct-head { padding: 22px 26px 14px; border-bottom: 1px solid var(--line); flex: none; }
.v3-ct-head .eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--teal-800); font-weight: 700; margin-bottom: 6px;
}
.v3-ct-head h2 { font-size: 20px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.v3-ct-head .sub { font-size: 13px; color: var(--ink-3); margin: 0; }

.v3-ct-body { padding: 20px 26px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.v3-ct-grid { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
@media (max-width: 720px) { .v3-ct-grid { grid-template-columns: 1fr; } }

.v3-ct .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.v3-ct .field label {
    font-size: 12px; font-weight: 600; color: var(--ink-2);
    letter-spacing: 0.02em;
}
.v3-ct .field label .req { color: #b91c1c; margin-left: 2px; }
.v3-ct .hint {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--ink-4); margin-top: 2px;
}
.v3-ct .hint .spacer { flex: 1; }
.v3-ct .hint .count { font-variant-numeric: tabular-nums; }
.v3-ct .hint .err { color: #b91c1c; font-weight: 500; }

/* Input primitives used by both dialogs */
.v3-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 13.5px; color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    font-family: inherit;
}
.v3-input:focus {
    border-color: var(--teal-700);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-700) 18%, transparent);
}
.v3-input.sm { padding: 5px 8px; font-size: 12.5px; }
textarea.v3-input { line-height: 1.5; resize: vertical; min-height: 72px; }

.v3-select-wrap { position: relative; }
.v3-select-wrap select.v3-input { appearance: none; padding-right: 30px; }
.v3-select-wrap .chev {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    color: var(--ink-3); pointer-events: none;
}

/* Native <select> option popup in dark mode.
   Chromium renders the option list light unless color-scheme:dark is set on
   the <select> itself; an author-set/transparent background alone is ignored.
   Applies to ALL V3 selects — the .v3-input form selects AND the configurator
   field selects (.field-input select), which carry no .v3-input class. The
   opt-orange/opt-red state options keep their own (higher-specificity) colours. */
.v3-app[data-theme="dark"] select { color-scheme: dark; }
.v3-app[data-theme="dark"] select option,
.v3-app[data-theme="dark"] select optgroup {
    background-color: var(--surface);
    color: var(--ink);
}
.v3-app[data-theme="dark"] select option:disabled {
    color: var(--ink-4);
}

/* Priority segmented picker */
.v3-ct-prio { display: flex; gap: 6px; flex-wrap: wrap; }
.v3-ct-prio .prio-opt {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12.5px; font-weight: 500; color: var(--ink-2);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.v3-ct-prio .prio-opt .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: currentColor; opacity: 0.55;
}
.v3-ct-prio .prio-opt.p-urgent { color: #b91c1c; }
.v3-ct-prio .prio-opt.p-high   { color: #c2410c; }
.v3-ct-prio .prio-opt.p-med    { color: var(--amber); }
.v3-ct-prio .prio-opt.p-low    { color: var(--teal-800); }
.v3-ct-prio .prio-opt:hover { border-color: color-mix(in oklab, currentColor 40%, var(--line)); }
.v3-ct-prio .prio-opt.on {
    background: color-mix(in oklab, currentColor 10%, var(--surface));
    border-color: currentColor;
}
.v3-ct-prio .prio-opt.on .dot { opacity: 1; }

/* Attachment drop zone */
.v3-ct-drop {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--teal-50);
    border: 1px dashed color-mix(in oklab, var(--teal-700) 35%, var(--line));
    border-radius: 10px;
    cursor: pointer;
    transition: background 120ms ease;
}
.v3-ct-drop:hover { background: color-mix(in oklab, var(--teal-50) 60%, var(--surface)); }
.v3-ct-drop .ic {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--surface); color: var(--teal-800);
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--teal-100);
}
.v3-ct-drop .t { font-size: 13px; font-weight: 600; color: var(--ink); }
.v3-ct-drop .s { font-size: 11.5px; color: var(--ink-3); }
.v3-ct-file-input { display: none; }

.v3-ct-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.v3-ct-thumbs .thumb {
    position: relative; width: 84px; height: 84px;
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--line);
}
.v3-ct-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v3-ct-thumbs .thumb .rm {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    border: 0; background: rgba(15, 23, 42, 0.72); color: #fff;
    font-size: 14px; line-height: 1;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}

/* Use justify-content instead of a flex-1 spacer — simpler, and avoids
   accidental collisions with any other `.spacer` rule that might have
   `min-width` or `display: none` under a breakpoint. */
.v3-ct-foot {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 26px;
    border-top: 1px solid var(--line);
    background: var(--teal-50);
}
.v3-ct-submit { margin-left: auto; }

/* ---------- Ticket detail ---------- */
.v3-td-loading, .v3-td-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 60px 24px; color: var(--ink-3);
}
.v3-spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--teal-100);
    border-top-color: var(--teal-700);
    border-radius: 50%; animation: v3-spin 0.8s linear infinite;
}
@keyframes v3-spin { to { transform: rotate(360deg); } }

/* .v3-td IS the modal card (same as .v3-ct above). .v3-td-shell is a
   small variant we use for loading/empty states — it's a short card
   that doesn't need the 1080px width. */
.v3-td {
    display: flex; flex-direction: column;
    background: var(--surface);
    width: min(1080px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    animation: v3modalSlide 160ms ease-out;
}
.v3-td.v3-td-shell { width: min(480px, calc(100vw - 32px)); }

.v3-td-head {
    display: grid; grid-template-columns: 1fr auto; gap: 16px;
    padding: 20px 26px 14px; border-bottom: 1px solid var(--line);
}
.v3-td-title .idline {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--ink-3);
}
.v3-td-title .idline .mono { font-family: ui-monospace, 'SF Mono', Consolas, monospace; color: var(--ink-2); }
.v3-td-title .idline .dot { color: var(--ink-4); }
.v3-td-title .idline .cat {
    background: var(--teal-50); color: var(--teal-800);
    padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
}
.v3-td-title .idline .tenant {
    background: var(--amber-50); color: var(--amber);
    padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
    font-weight: 600;
}
.v3-td-title h2 { font-size: 19px; font-weight: 600; color: var(--ink); margin: 6px 0 4px; }
.v3-td-title .meta { font-size: 12px; color: var(--ink-3); }

.v3-td-pills { display: flex; align-items: center; gap: 8px; }
/* Scoped to the dialog-close × specifically — a bare .v3-btn-ghost already
   exists globally (line ~218) for link-style ghost buttons, so we don't
   redefine it here or we'd squash those into 30×30 squares. */
.v3-td-pills .v3-btn-close {
    background: transparent; border: 0; color: var(--ink-3);
    width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px;
}
.v3-td-pills .v3-btn-close:hover { background: var(--teal-50); color: var(--ink); }

/* Keep button labels on one line inside our dialogs — a narrow flex cell
   would otherwise wrap "Close ticket" onto two lines. */
.v3-ct .v3-btn,
.v3-td .v3-btn { white-space: nowrap; }

.v3-td-main {
    display: grid; grid-template-columns: 1fr 320px;
    min-height: 0; flex: 1;
}
@media (max-width: 860px) { .v3-td-main { grid-template-columns: 1fr; } }

/* Thread (left) */
.v3-td-thread {
    display: flex; flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--line);
    /* Anchor for the floating "Jump to latest" pill. */
    position: relative;
}

/* Floating "Jump to latest" pill — reuses .v3-btn.v3-btn-primary for
   colour/typography so it stays on-theme (incl. dark-mode inversion).
   This rule only handles placement, pill shape, shadow, and the
   fade-in. Everything else comes from the base button styles. */
.v3-td-jump.v3-btn.v3-btn-primary,
.v3-td-jump.v3-btn.v3-btn-primary:hover {
    position: absolute;
    left: 50%;
    bottom: 92px;              /* clears the composer height + a little air */
    transform: translateX(-50%);
    width: auto;               /* beat the flex-item stretch from .v3-td-thread */
    border-radius: 999px;
    padding: 6px 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    z-index: 5;
    animation: v3-td-jump-in 160ms ease-out;
}
.v3-td-jump.v3-btn:active { transform: translate(-50%, 1px); }
.v3-td-jump .icon { width: 12px; height: 12px; }

@keyframes v3-td-jump-in {
    from { opacity: 0; transform: translate(-50%, 6px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.v3-td-thread .thread-scroll {
    flex: 1; overflow-y: auto;
    padding: 18px 22px;
    display: flex; flex-direction: column; gap: 14px;
}

/* Chat layout: avatar + bubble in a 2-col grid. For "mine" messages we
   flip the columns (bubble left, avatar right) so the conversation reads
   like a typical right-aligned chat. We assign grid-column EXPLICITLY
   instead of using `order` — `order` interacts poorly with Grid auto-
   placement when template-columns are asymmetric (1fr vs 32px), which
   caused mine-bubbles to collapse to ~32px and stack text character-by-
   character. */
.v3-td-thread .msg {
    display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px;
    align-items: flex-start;
}
.v3-td-thread .msg > .av     { grid-column: 1; }
.v3-td-thread .msg > .bubble { grid-column: 2; }

.v3-td-thread .msg.mine        { grid-template-columns: minmax(0, 1fr) 32px; }
.v3-td-thread .msg.mine > .av     { grid-column: 2; }
.v3-td-thread .msg.mine > .bubble { grid-column: 1; text-align: left; }

.v3-td-thread .msg .av {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--teal-100); color: var(--teal-800);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px; font-weight: 700;
}
.v3-td-thread .msg.mine .av { background: color-mix(in oklab, var(--teal-700) 14%, var(--teal-100)); }

.v3-td-thread .msg .bubble {
    background: var(--teal-50);
    border: 1px solid var(--teal-100);
    border-radius: 12px;
    padding: 10px 14px;
    min-width: 0;
    /* Cap bubble width so long replies don't stretch edge-to-edge — reads
       more like a conversation, less like a form. justify-self below
       anchors bubbles to the correct side of their grid cell. */
    max-width: 75%;
    justify-self: start;
}
.v3-td-thread .msg.mine > .bubble { justify-self: end; }
/* The opening post is a full-width callout, not a chat message. */
.v3-td-thread .msg.original > .bubble { max-width: 100%; justify-self: stretch; }
.v3-td-thread .msg.mine .bubble {
    background: color-mix(in oklab, var(--teal-700) 6%, var(--surface));
    border-color: color-mix(in oklab, var(--teal-700) 22%, var(--line));
}
.v3-td-thread .msg.original .bubble {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.v3-td-thread .msg .bubble header {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 11.5px; color: var(--ink-3);
    margin-bottom: 4px;
}
.v3-td-thread .msg .bubble .who { font-weight: 600; color: var(--ink-2); }
.v3-td-thread .msg .bubble .tag {
    background: var(--teal-100); color: var(--teal-800);
    padding: 1px 7px; border-radius: 999px; font-size: 10px;
    font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
}
.v3-td-thread .msg .bubble .body {
    font-size: 13.5px; color: var(--ink); line-height: 1.5;
    word-wrap: break-word;
}
.v3-td-thread .msg .bubble .body p { margin: 0 0 8px; }
.v3-td-thread .msg .bubble .body p:last-child { margin-bottom: 0; }
.v3-td-thread .msg .bubble .body img { max-width: 100%; border-radius: 6px; }

/* Composer */
.v3-td-composer { padding: 12px 22px 16px; border-top: 1px solid var(--line); background: var(--teal-50); }
.v3-td-composer .v3-input { background: var(--surface); }
.v3-td-composer .composer-bar {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.v3-td-composer .composer-bar .hint { font-size: 11px; color: var(--ink-4); }
.v3-td-composer .composer-bar .spacer { flex: 1; }

.v3-td-closed {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: color-mix(in oklab, #22c55e 8%, var(--teal-50));
    color: var(--ink-2); font-size: 13px;
}

/* Right rail */
.v3-td-side {
    display: flex; flex-direction: column; min-height: 0;
    overflow-y: auto;
    background: color-mix(in oklab, var(--teal-50) 50%, var(--surface));
}
.v3-td-meta { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.v3-td-meta .kv {
    display: grid; grid-template-columns: 92px 1fr; gap: 10px;
    align-items: center;
    padding: 7px 0; border-bottom: 1px dashed var(--line-soft);
}
.v3-td-meta .kv:last-child { border-bottom: 0; }
.v3-td-meta .kv .k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.v3-td-meta .kv .v { font-size: 13px; color: var(--ink); }
.v3-td-meta .kv .v .muted { color: var(--ink-4); font-style: italic; }

.v3-td-timeline { padding: 14px 20px 18px; }
.v3-td-timeline h3 {
    font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-3); font-weight: 700; margin: 0 0 10px;
}
.v3-td-timeline .tl { list-style: none; padding: 0 0 0 14px; margin: 0; position: relative; }
.v3-td-timeline .tl::before {
    content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px;
    width: 2px; background: var(--teal-100);
}
.v3-td-timeline .tl li { position: relative; padding: 0 0 10px 0; }
.v3-td-timeline .tl li .tl-dot {
    position: absolute; left: -14px; top: 6px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--teal-700);
}
.v3-td-timeline .tl li .tl-text { font-size: 12.5px; color: var(--ink); }
.v3-td-timeline .tl li .tl-meta { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.v3-td-timeline .muted { color: var(--ink-4); font-size: 12px; font-style: italic; }

/* ========================================================================
   V3 Full Details — saved configuration workspace
   Layout: header strip -> hero row (preview | info | metrics) -> tabs
   ======================================================================== */

.v3-app .v3-fd { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---- Head strip ---- */
.v3-app .v3-fd-head { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.v3-app .v3-fd-head .title-col { flex: 1 1 320px; min-width: 0; }
.v3-app .v3-fd-head .eyebrow {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    color: var(--ink-3); font-size: 12.5px; margin-bottom: 4px;
}
.v3-app .v3-fd-head .eyebrow .sep { color: var(--ink-4); }
.v3-app .v3-fd-head .eyebrow .link {
    background: none; border: 0; padding: 0; color: var(--teal-800);
    font-weight: 500; cursor: pointer; font-size: 12.5px;
}
.v3-app .v3-fd-head .eyebrow .link:hover { text-decoration: underline; }
.v3-app .v3-fd-head h1 {
    margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
    color: var(--ink); line-height: 1.15;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.v3-app .v3-fd-head .note {
    margin: 6px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.v3-app .v3-fd-head .actions-col { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: 0 0 auto; }
.v3-app .v3-fd-head .actions-col .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Job pill (both in header and modal) */
.v3-app .v3-fd-job-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
    border: 1px solid transparent;
}
.v3-app .v3-fd-job-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.v3-app .v3-fd-job-pill.pill-ok     { background: var(--green-50); color: var(--green);  border-color: color-mix(in oklab, var(--green) 25%, transparent); }
.v3-app .v3-fd-job-pill.pill-err    { background: var(--red-50);   color: var(--red);    border-color: color-mix(in oklab, var(--red) 25%, transparent); }
.v3-app .v3-fd-job-pill.pill-run    { background: var(--teal-50);  color: var(--teal-800); border-color: var(--teal-100); }
.v3-app .v3-fd-job-pill.pill-run .dot { animation: v3FdPulse 1.1s ease-in-out infinite; }
.v3-app .v3-fd-job-pill.pill-queued { background: var(--amber-50); color: var(--amber);  border-color: color-mix(in oklab, var(--amber) 25%, transparent); }
.v3-app .v3-fd-job-pill.pill-none   { background: var(--bg);       color: var(--ink-3);  border-color: var(--line); }

@keyframes v3FdPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.4); }
}

/* ---- Hero row ---- */
.v3-app .v3-fd-hero {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 1.3fr) minmax(200px, 0.8fr);
    gap: 16px;
    align-items: stretch;
}

.v3-app .v3-fd-hero .preview {
    position: relative; overflow: hidden;
    background:
        radial-gradient(120% 100% at 30% 0%, color-mix(in oklab, var(--teal-800) 10%, var(--surface)) 0%, var(--teal-50) 60%, var(--surface) 100%);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    min-height: 260px;
    display: grid; place-items: center;
    box-shadow: var(--shadow);
}
.v3-app .v3-fd-hero .preview img { width: 100%; height: 100%; object-fit: contain; padding: 12px; display: block; }
.v3-app .v3-fd-hero .preview .preview-fallback {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--ink-3); font-size: 12.5px;
}
.v3-app .v3-fd-hero .preview .preview-fallback .icon { width: 40px; height: 40px; color: var(--ink-4); }
.v3-app .v3-fd-hero .preview .view-3d {
    position: absolute; right: 12px; bottom: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: var(--r-sm);
    background: var(--teal-800); color: #fff; border: 1px solid var(--teal-800);
    font-size: 12.5px; font-weight: 500; cursor: pointer;
    box-shadow: 0 4px 14px rgba(17,61,79,0.25);
    transition: background 120ms, transform 80ms;
}
.v3-app .v3-fd-hero .preview .view-3d:hover { background: var(--teal-900); }
.v3-app .v3-fd-hero .preview .view-3d:active { transform: translateY(1px); }
.v3-app .v3-fd-hero .preview .view-3d.disabled,
.v3-app .v3-fd-hero .preview .view-3d:disabled {
    background: var(--line); border-color: var(--line); color: var(--ink-4);
    box-shadow: none; cursor: not-allowed;
}
.v3-app[data-theme="dark"] .v3-fd-hero .preview .view-3d { background: var(--teal-100); color: var(--teal-900); border-color: var(--teal-100); }

/* Info card */
.v3-app .v3-fd-hero .info-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
    padding: 16px 18px; min-width: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.v3-app .v3-fd-hero .info-card .info-h {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; margin-bottom: 4px;
}
.v3-app .v3-fd-hero .info-card .info-h h3 {
    margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
}
.v3-app .v3-fd-hero .info-card .kv-list {
    display: grid; grid-template-columns: 1fr; gap: 10px 18px; margin: 0;
}
.v3-app .v3-fd-hero .info-card .kv-list > div {
    display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: baseline;
    padding: 3px 0;
}
.v3-app .v3-fd-hero .info-card .kv-list dt {
    color: var(--ink-4); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 600;
}
.v3-app .v3-fd-hero .info-card .kv-list dd {
    margin: 0; color: var(--ink); font-size: 13px; line-height: 1.4; word-break: break-word; min-width: 0;
}
.v3-app .v3-fd-hero .info-card .kv-list dd .link {
    background: none; border: 0; padding: 0; color: var(--teal-800);
    font-weight: 500; cursor: pointer; font-size: 13px;
}
.v3-app .v3-fd-hero .info-card .kv-list dd .link:hover { text-decoration: underline; }

/* Metrics column */
.v3-app .v3-fd-hero .metrics-col {
    display: grid; grid-template-rows: repeat(4, 1fr); gap: 10px;
    min-width: 0;
}
.v3-app .v3-fd-hero .metric {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: 10px 12px;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    box-shadow: var(--shadow);
}
.v3-app .v3-fd-hero .metric .m-label {
    font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-4); font-weight: 600;
}
.v3-app .v3-fd-hero .metric .m-value {
    font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
    line-height: 1.1;
}
.v3-app .v3-fd-hero .metric .m-value.pill-ok     { color: var(--green); }
.v3-app .v3-fd-hero .metric .m-value.pill-err    { color: var(--red); }
.v3-app .v3-fd-hero .metric .m-value.pill-run    { color: var(--teal-800); }
.v3-app .v3-fd-hero .metric .m-value.pill-queued { color: var(--amber); }
.v3-app .v3-fd-hero .metric .m-value.pill-none   { color: var(--ink-3); }
.v3-app .v3-fd-hero .metric .m-sub { font-size: 11px; color: var(--ink-3); }

/* ---- Tab body ---- */
.v3-app .v3-fd-tabbody { min-width: 0; }

/* File grid */
.v3-app .v3-fd-filegrid {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden;
}
.v3-app .v3-fd-filegrid .row {
    display: grid;
    grid-template-columns: 36px 88px 1fr 100px 48px;
    align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}
.v3-app .v3-fd-filegrid .row:last-child { border-bottom: 0; }
.v3-app .v3-fd-filegrid .row.head {
    background: var(--teal-50); color: var(--ink-3); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
    padding: 8px 14px;
}
.v3-app .v3-fd-filegrid .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-fd-filegrid .col { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.v3-app .v3-fd-filegrid .c-act { display: flex; justify-content: flex-end; }
.v3-app .v3-fd-filegrid .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.v3-app .v3-fd-filegrid .ext-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 54px; padding: 2px 8px; border-radius: 4px;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.04em; border: 1px solid transparent;
}
.v3-app .v3-fd-filegrid .ext-pill.ext-three { background: #DFE6FA; color: #223A8E; border-color: color-mix(in oklab, #4E6CC9 30%, transparent); }
.v3-app .v3-fd-filegrid .ext-pill.ext-pdf   { background: var(--red-50);   color: var(--red);   border-color: color-mix(in oklab, var(--red) 25%, transparent); }
.v3-app .v3-fd-filegrid .ext-pill.ext-img   { background: var(--teal-50);  color: var(--teal-800); border-color: var(--teal-100); }
.v3-app .v3-fd-filegrid .ext-pill.ext-xls   { background: var(--green-50); color: var(--green); border-color: color-mix(in oklab, var(--green) 25%, transparent); }
.v3-app .v3-fd-filegrid .ext-pill.ext-doc   { background: #DDF0F3; color: #0E4E5E; border-color: color-mix(in oklab, #2F8A9E 30%, transparent); }
.v3-app .v3-fd-filegrid .ext-pill.ext-arc   { background: var(--amber-50); color: var(--amber); border-color: color-mix(in oklab, var(--amber) 25%, transparent); }
.v3-app .v3-fd-filegrid .ext-pill.ext-any   { background: var(--bg); color: var(--ink-3); border-color: var(--line); }
.v3-app .v3-fd-filegrid input[type="checkbox"] { accent-color: var(--teal-800); width: 15px; height: 15px; cursor: pointer; }

/* Drawings grid */
.v3-app .v3-fd-draw-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.v3-app .v3-fd-draw-grid .draw-tile {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); overflow: hidden;
    box-shadow: var(--shadow); transition: box-shadow 120ms, transform 80ms;
    display: flex; flex-direction: column;
}
.v3-app .v3-fd-draw-grid .draw-tile:hover { box-shadow: var(--shadow-hover); }
.v3-app .v3-fd-draw-grid .draw-tile .thumb {
    aspect-ratio: 4/3; background: var(--bg);
    display: grid; place-items: center;
    cursor: zoom-in; overflow: hidden;
    border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-fd-draw-grid .draw-tile .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.v3-app .v3-fd-draw-grid .draw-tile .thumb-skeleton { color: var(--ink-4); }
.v3-app .v3-fd-draw-grid .draw-tile .meta {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
}
.v3-app .v3-fd-draw-grid .draw-tile .meta .fname {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 12.5px; color: var(--ink-2);
}

/* Drawing modal preview */
.v3-app .v3-fd-img-preview {
    width: 100%; max-height: 70vh; display: grid; place-items: center;
    background: var(--bg); border-radius: var(--r-md); padding: 10px;
}
.v3-app .v3-fd-img-preview img { max-width: 100%; max-height: 70vh; display: block; }

/* Timeline */
.v3-app .v3-fd-timeline {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--shadow);
    padding: 6px 16px 6px;
}
.v3-app .v3-fd-timeline .t-row {
    display: grid; grid-template-columns: 28px 1fr; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--line-soft);
    min-width: 0;
}
.v3-app .v3-fd-timeline .t-row:last-child { border-bottom: 0; }
.v3-app .v3-fd-timeline .t-axis { position: relative; }
.v3-app .v3-fd-timeline .t-axis .t-dot {
    position: absolute; left: 8px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--ink-4);
}
.v3-app .v3-fd-timeline .t-axis .t-line {
    position: absolute; left: 13px; top: 18px; bottom: -14px;
    width: 2px; background: var(--line-soft);
}
.v3-app .v3-fd-timeline .t-row:last-child .t-axis .t-line { display: none; }
.v3-app .v3-fd-timeline .t-row.latest .t-axis .t-dot { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 20%, transparent); }
.v3-app .v3-fd-timeline .t-row.current .t-axis .t-dot { background: var(--teal-800); border-color: var(--teal-800); }

.v3-app .v3-fd-timeline .t-body { min-width: 0; }
.v3-app .v3-fd-timeline .t-body .t-head {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.v3-app .v3-fd-timeline .t-body .t-head .link {
    background: none; border: 0; padding: 0; color: var(--teal-800);
    font-weight: 500; cursor: pointer; font-size: 14px; text-align: left;
}
.v3-app .v3-fd-timeline .t-body .t-head .link:hover { text-decoration: underline; }
.v3-app .v3-fd-timeline .t-body .sub { font-size: 11px; color: var(--ink-4); }
.v3-app .v3-fd-timeline .t-body .t-meta {
    color: var(--ink-3); font-size: 12px; margin-top: 2px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.v3-app .v3-fd-timeline .t-body .t-meta .sep { color: var(--ink-4); }
.v3-app .v3-fd-timeline .t-body .t-note {
    margin: 6px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.45;
}

/* Job details modal */
.v3-app .v3-fd-joblist { margin: 0; display: grid; gap: 10px; }
.v3-app .v3-fd-joblist > div {
    display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: baseline;
    padding: 4px 0; border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-fd-joblist > div:last-child { border-bottom: 0; }
.v3-app .v3-fd-joblist dt {
    color: var(--ink-4); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 600;
}
.v3-app .v3-fd-joblist dd { margin: 0; font-size: 13px; color: var(--ink); word-break: break-word; }
.v3-app .v3-fd-joblist .err dd { color: var(--red); }

/* ---- Filter bar — shared by BOM and Parameters modals ---- */
.v3-fd-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.v3-fd-filter-bar .v3-search {
    flex: 1;
    max-width: none;
}
.v3-fd-filter-count {
    flex: none;
    font-size: 12px;
    color: var(--ink-4);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- Document Template Generation list ---- */
.v3-doctpl-list { display: flex; flex-direction: column; gap: 6px; }
.v3-doctpl-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color 120ms, background 120ms; }
.v3-doctpl-row:hover { border-color: var(--teal-700); background: var(--teal-50); }
.v3-doctpl-row.selected { border-color: var(--teal-700); background: var(--teal-50); }
.v3-doctpl-radio { flex: none; }
.v3-doctpl-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); transition: border-color 120ms, background 120ms; }
.v3-doctpl-dot.on { border-color: var(--teal-700); background: var(--teal-700); box-shadow: inset 0 0 0 3px var(--surface); }
.v3-doctpl-info { flex: 1; min-width: 0; }
.v3-doctpl-name { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.v3-doctpl-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.v3-doctpl-cad { background: color-mix(in oklab, var(--amber) 15%, transparent); color: var(--amber); border: 1px solid color-mix(in oklab, var(--amber) 30%, transparent); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 500; }
.v3-doctpl-file { flex: none; font-size: 11.5px; color: var(--ink-4); font-family: var(--mono); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-app[data-theme="dark"] .v3-doctpl-row:hover,
.v3-app[data-theme="dark"] .v3-doctpl-row.selected { background: #1a2a2e; }

/* ---- BOM table (V3Modal) ---- */
.v3-app .v3-fd-bom-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}
.v3-app .v3-fd-bom-table .row {
    display: grid;
    grid-template-columns: minmax(160px,1fr) 52px 120px 160px 90px 72px 72px 60px 100px;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    line-height: 1.45;
    min-width: 0;
}
.v3-app .v3-fd-bom-table .row:last-child { border-bottom: 0; }
.v3-app .v3-fd-bom-table .row.head {
    background: var(--teal-50);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 38px;
}
.v3-app .v3-fd-bom-table .row:not(.head) { min-height: 46px; }
.v3-app .v3-fd-bom-table .row:not(.head):hover { background: var(--teal-50); }
/* All cells: generous side padding, comfortable vertical rhythm */
.v3-app .v3-fd-bom-table .col {
    padding: 11px 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* First column gets slightly more left padding so text clears the card edge */
.v3-app .v3-fd-bom-table .col:first-child { padding-left: 18px; }
/* Last column gets matching right padding */
.v3-app .v3-fd-bom-table .col:last-child { padding-right: 18px; }
.v3-app .v3-fd-bom-table .c-name { font-weight: 500; color: var(--ink); }
.v3-app .v3-fd-bom-table .c-lv { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); text-align: center; }
.v3-app .v3-fd-bom-table .c-qty { font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.v3-app .v3-fd-bom-table .c-dim,
.v3-app .v3-fd-bom-table .c-mass { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* ---- Parameters accordion (V3Modal) ---- */
.v3-app .v3-fd-params-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}
.v3-app .v3-fd-params-step { border-bottom: 1px solid var(--line-soft); }
.v3-app .v3-fd-params-step:last-child { border-bottom: 0; }
/* Step header — tall enough to breathe, left-indent to align with cell content below */
.v3-app .v3-fd-params-step .step-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    cursor: pointer;
    user-select: none;
    min-height: 50px;
    transition: background 120ms;
}
.v3-app .v3-fd-params-step .step-hd:hover { background: var(--teal-50); }
.v3-app .v3-fd-params-step .step-hd .sname { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.v3-app .v3-fd-params-step .step-hd .scnt {
    font-size: 11.5px;
    color: var(--ink-4);
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 2px 10px;
}
.v3-app .v3-fd-params-step .step-hd .chev { color: var(--ink-4); transition: transform 150ms; flex-shrink: 0; }
.v3-app .v3-fd-params-step .step-hd.open .chev { transform: rotate(90deg); }
.v3-app .v3-fd-params-rows { border-top: 1px solid var(--line-soft); }
.v3-app .v3-fd-params-rows .row {
    display: grid;
    grid-template-columns: 150px minmax(160px,1fr) 190px 100px 56px;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    line-height: 1.45;
    min-width: 0;
}
.v3-app .v3-fd-params-rows .row:last-child { border-bottom: 0; }
.v3-app .v3-fd-params-rows .row.head {
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-height: 36px;
}
.v3-app .v3-fd-params-rows .row:not(.head) { min-height: 44px; }
.v3-app .v3-fd-params-rows .row:not(.head):hover { background: var(--teal-50); }
/* All cells: match BOM padding rhythm */
.v3-app .v3-fd-params-rows .col {
    padding: 11px 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-app .v3-fd-params-rows .col:first-child { padding-left: 18px; }
.v3-app .v3-fd-params-rows .col:last-child { padding-right: 18px; }
.v3-app .v3-fd-params-rows .c-grp { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.v3-app .v3-fd-params-rows .c-val { color: var(--ink-2); }
.v3-app .v3-fd-params-rows .c-com { display: flex; align-items: center; justify-content: center; padding: 0; }
.v3-app .v3-fd-params-rows .committed-yes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: color-mix(in oklab, var(--green) 12%, transparent);
    border-radius: 50%;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
}
.v3-app .v3-fd-params-rows .committed-no { color: var(--ink-4); font-size: 16px; line-height: 1; }
/* Option button column — tight, centred */
.v3-app .v3-fd-params-rows .c-opt { display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.v3-app .v3-fd-params-rows .c-opt .v3-btn-icon { width: 30px; height: 30px; padding: 0; border-radius: var(--r-sm); }

/* ---- Parameter options detail table (sm modal, stacks above params modal) ---- */
.v3-app .v3-fd-options-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}
.v3-app .v3-fd-options-table .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    line-height: 1.45;
    min-height: 46px;
}
.v3-app .v3-fd-options-table .row:last-child { border-bottom: 0; }
.v3-app .v3-fd-options-table .row.head {
    background: var(--teal-50);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-height: 38px;
}
.v3-app .v3-fd-options-table .col { padding: 11px 14px; min-width: 0; }
.v3-app .v3-fd-options-table .col:first-child { padding-left: 18px; }
.v3-app .v3-fd-options-table .col:last-child { padding-right: 18px; }
.v3-app .v3-fd-options-table .c-val,
.v3-app .v3-fd-options-table .c-com { display: flex; align-items: center; justify-content: center; }
/* Coloured option badges */
.v3-app .v3-fd-options-table .opt-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 26px; padding: 0 12px;
    border-radius: 13px; font-weight: 700; font-size: 12.5px; color: #fff;
}
.v3-app .v3-fd-options-table .opt-green,
.v3-app .v3-fd-options-table .opt-min,
.v3-app .v3-fd-options-table .opt-max { background: var(--green); }
.v3-app .v3-fd-options-table .opt-red   { background: var(--red); }
.v3-app .v3-fd-options-table .opt-orange { background: var(--amber); color: var(--ink); }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .v3-app .v3-fd-hero { grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); }
    .v3-app .v3-fd-hero .metrics-col {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, 1fr); grid-template-rows: auto;
    }
}

@media (max-width: 900px) {
    .v3-app .v3-fd-head { flex-direction: column; }
    .v3-app .v3-fd-head .actions-col { align-items: flex-start; width: 100%; }
    .v3-app .v3-fd-head .actions-col .btns { justify-content: flex-start; }

    .v3-app .v3-fd-hero { grid-template-columns: 1fr; }
    .v3-app .v3-fd-hero .metrics-col { grid-template-columns: repeat(2, 1fr); }

    .v3-app .v3-fd-filegrid .row { grid-template-columns: 28px 70px 1fr 80px 36px; gap: 8px; padding: 10px; font-size: 12.5px; }
}

@media (max-width: 600px) {
    .v3-app .v3-fd-head h1 { font-size: 18px; }
    .v3-app .v3-fd-hero .preview { min-height: 200px; }
    .v3-app .v3-fd-hero .metrics-col { grid-template-columns: 1fr 1fr; }
    .v3-app .v3-fd-hero .info-card .kv-list > div { grid-template-columns: 1fr; gap: 2px; }

    .v3-app .v3-fd-filegrid .row { grid-template-columns: 22px 60px 1fr 36px; }
    .v3-app .v3-fd-filegrid .row .c-size { display: none; }
    .v3-app .v3-fd-filegrid .row.head .c-size { display: none; }

    .v3-app .v3-fd-draw-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

    .v3-app .v3-fd-timeline { padding: 4px 10px; }
    .v3-app .v3-fd-joblist > div { grid-template-columns: 1fr; gap: 2px; }
}

/* =============================================================
   V3 Products page (.v3-pm-*) — Products list + revisions + artifacts
   ============================================================= */
.v3-app .v3-pm { display: flex; flex-direction: column; gap: 16px; }

.v3-app .v3-pm-split {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    align-items: start;
}

/* ---------- Left: products list ---------- */
.v3-app .v3-pm-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 14px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.v3-app .v3-pm-list-head {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.v3-app .v3-pm-list-head .v3-search { flex: none; min-width: 0; max-width: none; width: 100%; }
.v3-app .v3-pm-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.v3-app .v3-pm-chip {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-3);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 9px;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.v3-app .v3-pm-chip:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-app .v3-pm-chip.on {
    background: var(--teal-700);
    border-color: var(--teal-700);
    color: #fff;
}
.v3-app .v3-pm-chip-fav { display: inline-flex; align-items: center; gap: 4px; }
.v3-app .v3-pm-chip-fav svg { width: 12px; height: 12px; }
.v3-app .v3-pm-chip-fav.on { background: var(--amber, #f59e0b); border-color: var(--amber, #f59e0b); color: #fff; }

.v3-app .v3-pm-card-wrap { position: relative; display: block; }
.v3-app .v3-pm-fav {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ink-4);
    opacity: 0.6;
    transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.v3-app .v3-pm-card-wrap:hover .v3-pm-fav { opacity: 1; }
.v3-app .v3-pm-fav:hover { background: rgba(0,0,0,0.05); color: var(--amber, #f59e0b); }
.v3-app .v3-pm-fav.on { opacity: 1; color: var(--amber, #f59e0b); }
.v3-app .v3-pm-fav svg { width: 14px; height: 14px; }
.v3-app .v3-pm-list-count {
    font-size: 11px;
    color: var(--ink-4);
    text-align: right;
}

.v3-app .v3-pm-list-body {
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v3-app .v3-pm-card {
    width: 100%;
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 36px 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.v3-app .v3-pm-card:hover { background: var(--teal-50); }
.v3-app .v3-pm-card.on {
    background: var(--teal-50);
    border-color: var(--teal-200);
}
.v3-app .v3-pm-card .thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--teal-50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-800);
    font-weight: 700;
    font-size: 13px;
    flex: 0 0 44px;
}
.v3-app .v3-pm-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.v3-app .v3-pm-card .body { min-width: 0; }
.v3-app .v3-pm-card .name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v3-app .v3-pm-card .sub {
    font-size: 11px;
    color: var(--ink-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.v3-app .v3-pm-card .pills { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.v3-app .v3-pm-card .pills .v3-badge { font-size: 10px; padding: 1px 6px; }

.v3-app .v3-pm-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 6px;
    font-size: 11.5px;
    color: var(--ink-3);
    border-top: 1px solid var(--line-soft);
    margin-top: 4px;
}

/* ---------- Right: detail pane ---------- */
.v3-app .v3-pm-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.v3-app .v3-pm-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 18px;
    align-items: center;
}
.v3-app .v3-pm-hero .hero-img {
    width: 96px; height: 96px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--teal-50);
    display: flex; align-items: center; justify-content: center;
}
.v3-app .v3-pm-hero .hero-img img { width: 100%; height: 100%; object-fit: cover; }
.v3-app .v3-pm-hero .hero-ph {
    font-size: 30px; font-weight: 700; color: var(--teal-800);
}
.v3-app .v3-pm-hero .hero-body { min-width: 0; }
.v3-app .v3-pm-hero h2 {
    margin: 4px 0 0; font-size: 20px; font-weight: 700; color: var(--ink);
    line-height: 1.2;
}
.v3-app .v3-pm-hero .desc {
    margin: 6px 0 0;
    color: var(--ink-3);
    font-size: 13px;
    line-height: 1.45;
}
.v3-app .v3-pm-hero .hero-stats {
    display: flex; flex-wrap: wrap; gap: 18px;
    margin-top: 10px;
}
.v3-app .v3-pm-hero .stat { display: flex; flex-direction: column; gap: 1px; min-width: 84px; }
.v3-app .v3-pm-hero .stat .k {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink-4);
}
.v3-app .v3-pm-hero .stat .v {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.v3-app .v3-pm-hero .hero-actions {
    display: flex; flex-direction: column; gap: 6px; align-self: flex-start;
}
.v3-app .v3-pm-hero .hero-actions .v3-pm-hero-btn {
    width: 100%;
    justify-content: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
}
.v3-app .v3-pm-hero .hero-actions .v3-pm-hero-btn svg {
    width: 15px; height: 15px; flex-shrink: 0; vertical-align: middle;
}

/* ---------- Sections ---------- */
.v3-app .v3-pm-sec {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px 16px;
}
.v3-app .v3-pm-sec-h {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}
.v3-app .v3-pm-sec-h h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    display: flex; align-items: center; gap: 8px;
}
.v3-app .v3-pm-sec-h .count {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-4);
    background: var(--teal-50);
    padding: 2px 8px;
    border-radius: 999px;
}

/* ---------- Revisions rail ---------- */
.v3-app .v3-pm-revrail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.v3-app .v3-pm-revrail .rev-wrap { position: relative; display: flex; }
.v3-app .v3-pm-revrail .rev-wrap > .rev { flex: 1; width: 100%; padding-right: 36px; }
.v3-app .v3-pm-revrail .rev-edit {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 6px;
    min-width: 26px;
    background: transparent;
    border-color: transparent;
    color: var(--ink-3);
}
.v3-app .v3-pm-revrail .rev-edit svg { width: 14px; height: 14px; }
.v3-app .v3-pm-revrail .rev-wrap:hover .rev-edit { color: var(--ink); background: var(--surface); border-color: var(--line); }
.v3-app .v3-pm-revrail .rev {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.v3-app .v3-pm-revrail .rev:hover { border-color: var(--teal-300); }
.v3-app .v3-pm-revrail .rev.on {
    border-color: var(--teal-600);
    box-shadow: 0 0 0 2px var(--teal-100) inset;
}
.v3-app .v3-pm-revrail .rev-top {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.v3-app .v3-pm-revrail .rev-top .ver {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-weight: 700;
    font-size: 14px;
    color: var(--teal-800);
}
.v3-app .v3-pm-revrail .rev-top .tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.v3-app .v3-pm-revrail .rev-top .tag.rel {
    background: rgba(46, 204, 113, 0.14);
    color: #1f8b4e;
}
.v3-app .v3-pm-revrail .rev-top .tag.act {
    background: rgba(52, 152, 219, 0.14);
    color: #1f6ea8;
}
.v3-app .v3-pm-revrail .rev .status .v3-badge {
    font-size: 10.5px;
}
.v3-app .v3-pm-revrail .rev .meta {
    font-size: 11px;
    color: var(--ink-3);
    display: flex; flex-direction: column;
}
.v3-app .v3-pm-revrail .rev .meta .sub {
    color: var(--ink-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Artifacts grid ---------- */
.v3-app .v3-pm-artgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.v3-app .v3-pm-artgrid .art {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 110px;
}
.v3-app .v3-pm-artgrid .art-top {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px;
    color: var(--ink-4);
}
.v3-app .v3-pm-artgrid .art-top .type {
    background: var(--teal-50);
    color: var(--teal-800);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.v3-app .v3-pm-artgrid .art-top .id { font-size: 11px; }
.v3-app .v3-pm-artgrid .art-body { flex: 1; }
.v3-app .v3-pm-artgrid .art .name {
    font-size: 13px; font-weight: 600; color: var(--ink);
    line-height: 1.3;
    word-break: break-word;
}
.v3-app .v3-pm-artgrid .art .sub {
    font-size: 11px;
    color: var(--ink-4);
    margin-top: 3px;
    word-break: break-all;
}
.v3-app .v3-pm-artgrid .art-foot {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--line-soft);
    padding-top: 6px;
    font-size: 11px;
    color: var(--ink-3);
}
.v3-app .v3-pm-artgrid .art-foot .actions { display: flex; gap: 6px; }
.v3-app .v3-pm-artgrid .art-foot .actions .v3-btn {
    width: 32px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
}
.v3-app .v3-pm-artgrid .art-foot .actions .v3-btn svg { width: 16px; height: 16px; }
.v3-app .v3-pm-artgrid .art-foot .actions .art-btn-edit {
    color: var(--teal-700); border-color: var(--teal-700); background: var(--teal-50);
}
.v3-app .v3-pm-artgrid .art-foot .actions .art-btn-edit:hover {
    background: var(--teal-100); border-color: var(--teal-800); color: var(--teal-800);
}
.v3-app .v3-pm-artgrid .art-foot .actions .art-btn-dl {
    background: transparent; border-color: transparent; color: var(--ink-3);
}
.v3-app .v3-pm-artgrid .art-foot .actions .art-btn-dl:hover {
    background: var(--surface); border-color: var(--line); color: var(--ink);
}
.v3-app .v3-pm-artgrid .art-foot .actions .art-btn-dl:disabled {
    opacity: 0.35; pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .v3-app .v3-pm-split { grid-template-columns: 280px 1fr; }
}

@media (max-width: 900px) {
    .v3-app .v3-pm-split { grid-template-columns: 1fr; }
    .v3-app .v3-pm-list {
        position: static;
        max-height: 420px;
    }
    .v3-app .v3-pm-hero {
        grid-template-columns: 72px 1fr;
    }
    .v3-app .v3-pm-hero .hero-img { width: 72px; height: 72px; }
    .v3-app .v3-pm-hero .hero-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    .v3-app .v3-pm-hero .hero-stats { gap: 12px; }
    .v3-app .v3-pm-hero .stat { min-width: 70px; }
    .v3-app .v3-pm-revrail { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .v3-app .v3-pm-artgrid { grid-template-columns: 1fr; }
}

/* ---------- Module deep-link tiles on Products hero ---------- */
.v3-app .v3-pm-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.v3-app .v3-pm-tile {
    display: grid;
    grid-template-columns: 36px 1fr 14px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.v3-app .v3-pm-tile:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
}
.v3-app .v3-pm-tile:active { transform: translateY(1px); }
.v3-app .v3-pm-tile .ic {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--teal-50);
    color: var(--teal-800);
}
.v3-app .v3-pm-tile .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v3-app .v3-pm-tile .title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.v3-app .v3-pm-tile .sub {
    font-size: 11.5px;
    color: var(--ink-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v3-app .v3-pm-tile .cta { color: var(--ink-4); display: flex; align-items: center; }

/* =============================================================
   V3 product picker (.v3-pick-*) — used by Test Suites &
   Document Templates landing pages when no product is selected.
   ============================================================= */
.v3-app .v3-pick {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px 16px;
}
.v3-app .v3-pick-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.v3-app .v3-pick-count {
    font-size: 11.5px;
    color: var(--ink-4);
}
.v3-app .v3-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.v3-app .v3-pick-card {
    display: grid;
    grid-template-columns: 44px 1fr 14px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.v3-app .v3-pick-card:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
}
.v3-app .v3-pick-card .thumb {
    width: 44px; height: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--teal-50);
    display: flex; align-items: center; justify-content: center;
    color: var(--teal-800);
    font-weight: 700;
    font-size: 13px;
}
.v3-app .v3-pick-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.v3-app .v3-pick-card .body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v3-app .v3-pick-card .name {
    font-size: 13.5px; font-weight: 600; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v3-app .v3-pick-card .sub {
    font-size: 11px; color: var(--ink-4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v3-app .v3-pick-card .cta { color: var(--ink-4); display: flex; align-items: center; }

@media (max-width: 600px) {
    .v3-app .v3-pm-modules { grid-template-columns: 1fr; }
    .v3-app .v3-pick-grid { grid-template-columns: 1fr; }
}

/* =============================================================
   V3 Test Suite (.v3-ts-*) — bundle list, detail, execution, review
   ============================================================= */

.v3-app .v3-ts-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; gap: 12px;
}
.v3-app .v3-ts-count {
    font-size: 11.5px;
    color: var(--ink-4);
}

/* ---------- Bundles list (cards) ---------- */
.v3-app .v3-ts-bundlegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}
.v3-app .v3-ts-bundle {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 12px;
    transition: border-color 120ms ease, transform 120ms ease;
}
.v3-app .v3-ts-bundle:hover { border-color: var(--teal-300); }
.v3-app .v3-ts-bundle:active { transform: translateY(1px); }
.v3-app .v3-ts-bundle .bundle-top {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.v3-app .v3-ts-bundle .title h3 {
    margin: 0; font-size: 15px; font-weight: 600; color: var(--ink);
}
.v3-app .v3-ts-bundle .title p {
    margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.v3-app .v3-ts-bundle .cta { color: var(--ink-4); }
.v3-app .v3-ts-bundle .bundle-stats {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
    border-top: 1px solid var(--line-soft); padding-top: 10px;
}
.v3-app .v3-ts-bundle .bundle-stats .stat {
    display: flex; flex-direction: column; gap: 1px;
}
.v3-app .v3-ts-bundle .bundle-stats .k {
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--ink-4);
}
.v3-app .v3-ts-bundle .bundle-stats .v {
    font-size: 13px; font-weight: 600; color: var(--ink);
}

/* ---------- Bundle detail page ---------- */
.v3-app .v3-ts-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.v3-app .v3-ts-stats .stat { display: flex; flex-direction: column; gap: 2px; }
.v3-app .v3-ts-stats .k {
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--ink-4);
}
.v3-app .v3-ts-stats .v {
    font-size: 13.5px; font-weight: 600; color: var(--ink);
}

.v3-app .v3-ts-name-edit {
    display: flex; align-items: center; gap: 8px;
}
.v3-app .v3-ts-name-edit input {
    font-size: 22px; font-weight: 700; color: var(--ink);
    padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px;
    min-width: 280px;
}

.v3-app .v3-ts-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 14px;
    align-items: start;
}
@media (max-width: 1100px) {
    .v3-app .v3-ts-grid { grid-template-columns: 1fr; }
}

.v3-app .v3-ts-sec {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
}
.v3-app .v3-ts-sec-h {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 12px;
}
.v3-app .v3-ts-sec-h h3 {
    margin: 0; font-size: 14px; font-weight: 600; color: var(--ink);
    display: flex; align-items: center; gap: 8px;
}
.v3-app .v3-ts-sec-h .count {
    font-size: 11px; font-weight: 500; color: var(--ink-4);
    background: var(--teal-50);
    padding: 2px 8px; border-radius: 999px;
}

/* configurations list inside bundle */
.v3-app .v3-ts-cfglist { display: flex; flex-direction: column; gap: 6px; }
.v3-app .v3-ts-cfg {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}
.v3-app .v3-ts-cfg-name {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.v3-app .v3-ts-cfg-name span:first-child {
    font-size: 13px; font-weight: 500; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v3-app .v3-ts-cfg-name .sub { font-size: 11px; color: var(--ink-4); }
.v3-app .v3-ts-cfg-meta {
    display: flex; gap: 8px; font-size: 11.5px; color: var(--ink-3);
    align-items: center; flex-wrap: wrap; justify-content: flex-end;
}

/* runs list */
.v3-app .v3-ts-runlist { display: flex; flex-direction: column; gap: 8px; }
.v3-app .v3-ts-run {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: grid;
    grid-template-columns: 110px 1fr auto 18px;
    gap: 12px;
    align-items: center;
    transition: border-color 120ms ease;
}
.v3-app .v3-ts-run:hover { border-color: var(--teal-300); }
.v3-app .v3-ts-run .run-rev {
    display: flex; align-items: center; gap: 6px;
}
.v3-app .v3-ts-run .run-rev .ver { font-size: 13.5px; font-weight: 700; color: var(--teal-800); }
.v3-app .v3-ts-run .run-meta {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.v3-app .v3-ts-run .run-meta .when { font-size: 12.5px; color: var(--ink); font-weight: 500; }
.v3-app .v3-ts-run .run-meta .who { font-size: 11.5px; color: var(--ink-4); }
.v3-app .v3-ts-run .run-status {
    display: flex; align-items: center; gap: 8px;
}
.v3-app .v3-ts-run .run-review {
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--ink-4);
}
.v3-app .v3-ts-run .run-review .ok { color: #1f8b4e; display: inline-flex; align-items: center; gap: 3px; }
.v3-app .v3-ts-run .run-review .err { color: #b23a2c; display: inline-flex; align-items: center; gap: 3px; }
.v3-app .v3-ts-run .run-cta { color: var(--ink-4); }

/* configurations multi-pick modal */
.v3-app .v3-ts-configpick { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.v3-app .v3-ts-configpick-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1.4fr) auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.v3-app .v3-ts-configpick-row:hover { background: var(--teal-50); }
.v3-app .v3-ts-configpick-row.on {
    background: var(--teal-50); border-color: var(--teal-300);
}
.v3-app .v3-ts-configpick-row .name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-app .v3-ts-configpick-row .sub { font-size: 11px; color: var(--ink-4); }
.v3-app .v3-ts-configpick-row .rev { display: flex; align-items: center; gap: 6px; }
.v3-app .v3-ts-configpick-row .when { font-size: 11px; color: var(--ink-4); }

/* ---------- Execution page ---------- */
.v3-app .v3-ts-execstats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
    margin-bottom: 14px;
}
.v3-app .v3-ts-execstats .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 6px;
}
.v3-app .v3-ts-execstats .card-h {
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--ink-4);
}
.v3-app .v3-ts-execstats .card-num {
    font-size: 26px; font-weight: 700; color: var(--ink);
}
.v3-app .v3-ts-execstats .card-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--ink-2);
}
.v3-app .v3-ts-execstats .card-row.sub { color: var(--ink-4); font-size: 11.5px; }
.v3-app .v3-ts-execstats .dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--line);
}
.v3-app .v3-ts-execstats .dot.ok { background: #2ecc71; }
.v3-app .v3-ts-execstats .dot.run { background: #3498db; }
.v3-app .v3-ts-execstats .dot.err { background: #e74c3c; }

.v3-app .v3-ts-resultgrid {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.v3-app .v3-ts-resultgrid .row {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) 110px repeat(5, 70px) 18px;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
    align-items: center;
    font-size: 12.5px;
}
.v3-app .v3-ts-resultgrid .row:last-child { border-bottom: 0; }
.v3-app .v3-ts-resultgrid .row.head {
    background: var(--teal-50);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-ts-resultgrid .row.clickable { cursor: pointer; }
.v3-app .v3-ts-resultgrid .row.clickable:hover { background: var(--teal-50); }
.v3-app .v3-ts-resultgrid .row.disabled { opacity: 0.55; cursor: not-allowed; }
.v3-app .v3-ts-resultgrid .col.cfg .name { font-weight: 600; color: var(--ink); }
.v3-app .v3-ts-resultgrid .col.cfg .sub { font-size: 11px; color: var(--ink-4); }
.v3-app .v3-ts-resultgrid .col.cfg .msg {
    font-size: 11.5px; color: var(--ink-3); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v3-app .v3-ts-resultgrid .col.cat { text-align: center; }
.v3-app .v3-ts-resultgrid .col.act { color: var(--ink-4); display: flex; justify-content: flex-end; }

.v3-app .v3-ts-prog {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--line-soft);
    color: var(--ink-3);
    min-width: 38px;
    text-align: center;
}
.v3-app .v3-ts-prog.none { background: var(--line-soft); color: var(--ink-4); }
.v3-app .v3-ts-prog.some { background: rgba(52, 152, 219, 0.16); color: #1f6ea8; }
.v3-app .v3-ts-prog.all { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }

@media (max-width: 1100px) {
    .v3-app .v3-ts-resultgrid .row {
        grid-template-columns: 1fr 100px;
        gap: 8px;
        padding: 12px;
    }
    .v3-app .v3-ts-resultgrid .row .col.cat:nth-child(n+3) { display: none; }
    .v3-app .v3-ts-resultgrid .row.head .col.cat { display: none; }
    .v3-app .v3-ts-resultgrid .row .col.act { display: none; }
}

/* =============================================================
   V3 Test Suite Review (.v3-tsr-*)
   ============================================================= */
.v3-app .v3-tsr-head { margin-bottom: 12px; }

.v3-app .v3-tsr-comparebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.v3-app .v3-tsr-comparebar label {
    font-size: 11.5px; font-weight: 600;
    color: var(--ink-3);
    margin: 0;
}
.v3-app .v3-tsr-comparebar select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13px;
    color: var(--ink);
    min-width: 260px;
}
.v3-app .v3-tsr-comparebar .toggle-wrap { display: flex; align-items: center; gap: 8px; }
.v3-app .v3-tsr-comparebar .toggle-wrap.disabled { opacity: 0.5; }
.v3-app .v3-tsr-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 12px; font-weight: 600; color: var(--ink-3);
    cursor: pointer;
}
.v3-app .v3-tsr-toggle .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--line);
}
.v3-app .v3-tsr-toggle.on {
    background: rgba(46, 204, 113, 0.14);
    border-color: rgba(46, 204, 113, 0.55);
    color: #1f8b4e;
}
.v3-app .v3-tsr-toggle.on .dot { background: #2ecc71; }
.v3-app .v3-tsr-comparebar .v3-tsr-progress {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
}
.v3-app .v3-tsr-progress .lbl {
    font-size: 11.5px; font-weight: 600; color: var(--ink-4);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.v3-app .v3-tsr-progress .val {
    font-size: 14px; font-weight: 700; color: var(--teal-800);
}

.v3-app .v3-tsr-split {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
    align-items: start;
    min-height: 60vh;
}
@media (max-width: 1100px) {
    .v3-app .v3-tsr-split { grid-template-columns: 240px 1fr; }
}
@media (max-width: 800px) {
    .v3-app .v3-tsr-split { grid-template-columns: 1fr; }
}

/* Tree */
.v3-app .v3-tsr-tree {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    position: sticky; top: 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.v3-app .v3-tsr-tree .sec {
    display: flex; flex-direction: column;
}
.v3-app .v3-tsr-tree .sec-h {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 8px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-tsr-tree .sec-h .ic { color: var(--ink-4); display: flex; }
.v3-app .v3-tsr-tree .sec-h .name { flex: 1; }
.v3-app .v3-tsr-tree .sec-h .prog {
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--line-soft);
    color: var(--ink-4);
    text-transform: none;
    letter-spacing: 0;
}
.v3-app .v3-tsr-tree .sec-h .prog.some { background: rgba(52, 152, 219, 0.16); color: #1f6ea8; }
.v3-app .v3-tsr-tree .sec-h .prog.all { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }
.v3-app .v3-tsr-tree .sec-body { padding: 4px 0 6px; display: flex; flex-direction: column; gap: 2px; }
.v3-app .v3-tsr-tree .empty {
    padding: 8px 12px;
    font-size: 11.5px;
    color: var(--ink-4);
    font-style: italic;
}
.v3-app .v3-tsr-tree .leaf {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--ink-2);
    font-size: 12.5px;
    transition: background 120ms ease;
}
.v3-app .v3-tsr-tree .leaf:hover { background: var(--teal-50); }
.v3-app .v3-tsr-tree .leaf.on {
    background: var(--teal-50);
    border-color: var(--teal-200);
    color: var(--ink);
    font-weight: 500;
}
.v3-app .v3-tsr-tree .leaf .ic { color: var(--ink-4); display: flex; }
.v3-app .v3-tsr-tree .leaf .lbl {
    flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v3-app .v3-tsr-tree .leaf.approved { color: #1f8b4e; }
.v3-app .v3-tsr-tree .leaf.declined { color: #b23a2c; }
.v3-app .v3-tsr-tree .leaf .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--line);
}
.v3-app .v3-tsr-tree .leaf .dot.ok { background: #2ecc71; }
.v3-app .v3-tsr-tree .leaf .dot.err { background: #e74c3c; }

/* Pane */
.v3-app .v3-tsr-pane {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.v3-app .v3-tsr-decision {
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
    background: linear-gradient(180deg, var(--teal-50), transparent);
}
.v3-app .v3-tsr-decision .title {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 10px;
}
.v3-app .v3-tsr-decision .title span:first-child {
    font-size: 16px; font-weight: 600; color: var(--ink);
}
.v3-app .v3-tsr-decision .comment label {
    font-size: 11.5px; font-weight: 600; color: var(--ink-4);
    text-transform: uppercase; letter-spacing: 0.4px;
    display: block; margin-bottom: 6px;
}
.v3-app .v3-tsr-decision .comment .hint {
    font-weight: 400; text-transform: none; letter-spacing: 0;
    color: var(--ink-4);
    font-size: 11px; margin-left: 4px;
}
.v3-app .v3-tsr-decision .comment textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; font-family: inherit;
    background: var(--surface);
    resize: vertical; min-height: 60px;
}
.v3-app .v3-tsr-decision .err {
    color: #b23a2c; font-size: 12px; margin-top: 6px;
}
.v3-app .v3-tsr-decision .actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px;
}

.v3-app .v3-tsr-content { padding: 16px 18px; }

/* File detail view */
.v3-app .v3-tsr-fileview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.v3-app .v3-tsr-fileview.compare { grid-template-columns: 1fr 1fr; }
.v3-app .v3-tsr-fileview .col h4 {
    margin: 0 0 8px; font-size: 12px; font-weight: 600;
    color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.4px;
}
.v3-app .v3-tsr-fileview .col.baseline h4 { color: var(--teal-800); }
.v3-app .v3-tsr-fileview .empty {
    padding: 24px; border: 1px dashed var(--line);
    border-radius: 10px; text-align: center;
    font-size: 13px; color: var(--ink-4);
}
.v3-app .v3-tsr-fileview .file {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.v3-app .v3-tsr-fileview .file .row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 10px;
    padding: 4px 0;
    font-size: 12.5px;
    border-bottom: 1px dashed var(--line-soft);
}
.v3-app .v3-tsr-fileview .file .row:last-child { border-bottom: 0; }
.v3-app .v3-tsr-fileview .file .k {
    font-weight: 600; color: var(--ink-4);
    text-transform: uppercase; letter-spacing: 0.3px; font-size: 10.5px;
    align-self: center;
}
.v3-app .v3-tsr-fileview .file .v.small { font-size: 11.5px; }
.v3-app .v3-tsr-fileview .file .v.mono.small { word-break: break-all; }

/* Tabular (BOM / Params) */
.v3-app .v3-tsr-tabular {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.v3-app .v3-tsr-tabular.compare { grid-template-columns: 1fr 1fr; }
.v3-app .v3-tsr-tabular .col h4 {
    margin: 0 0 8px; font-size: 12px; font-weight: 600;
    color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.4px;
}
.v3-app .v3-tsr-tabular .col.baseline h4 { color: var(--teal-800); }
.v3-app .v3-tsr-tabular .empty {
    padding: 24px; border: 1px dashed var(--line);
    border-radius: 10px; text-align: center;
    font-size: 13px; color: var(--ink-4);
}
.v3-app .v3-tsr-table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    font-size: 12.5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.v3-app .v3-tsr-table th, .v3-app .v3-tsr-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-tsr-table th {
    background: var(--teal-50);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-tsr-table tr:last-child td { border-bottom: 0; }
.v3-app .v3-tsr-table td.mono.small { font-size: 11.5px; }

@media (max-width: 800px) {
    .v3-app .v3-tsr-fileview.compare,
    .v3-app .v3-tsr-tabular.compare {
        grid-template-columns: 1fr;
    }
    .v3-app .v3-tsr-tree {
        position: static;
        max-height: 320px;
    }
}

/* =============================================================
   V3 Test Suite Review — file preview (PDF / image / GLB)
   ============================================================= */
.v3-app .v3-tsr-preview {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    flex-direction: column;
}
.v3-app .v3-tsr-preview .meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--teal-50);
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-3);
    flex-wrap: wrap;
}
.v3-app .v3-tsr-preview .meta .name {
    font-weight: 600;
    color: var(--ink);
    word-break: break-all;
    flex: 1;
    min-width: 120px;
}
.v3-app .v3-tsr-preview .meta .size { color: var(--ink-4); white-space: nowrap; }
.v3-app .v3-tsr-preview .meta .hash {
    font-size: 11px;
    color: var(--ink-4);
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--line-soft);
    cursor: help;
}
.v3-app .v3-tsr-preview .meta .dl {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--teal-800);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
}
.v3-app .v3-tsr-preview .meta .dl:hover {
    background: var(--teal-100);
    border-color: var(--teal-300);
}
.v3-app .v3-tsr-preview .body {
    background: var(--surface);
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 8px;
}
/* Image preview */
.v3-app .v3-tsr-preview .body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 6px;
}
/* PDF preview */
.v3-app .v3-tsr-preview .body embed {
    width: 100%;
    height: 70vh;
    border: 0;
}
/* model-viewer (GLB) */
.v3-app .v3-tsr-preview .body model-viewer {
    width: 100%;
    height: 60vh;
    background: linear-gradient(180deg, #f0f4f6, #e3ecef);
    border-radius: 8px;
    --poster-color: transparent;
}
.v3-app .v3-tsr-preview .body .empty,
.v3-app .v3-tsr-preview .body .error {
    padding: 36px 20px;
    text-align: center;
    color: var(--ink-4);
    font-size: 13px;
}
.v3-app .v3-tsr-preview .body .error { color: #b23a2c; }

/* Compare mode: tighten preview heights so two side-by-side fit nicely */
.v3-app .v3-tsr-fileview.compare .v3-tsr-preview .body img,
.v3-app .v3-tsr-fileview.compare .v3-tsr-preview .body embed {
    max-height: 60vh;
    height: 60vh;
}
.v3-app .v3-tsr-fileview.compare .v3-tsr-preview .body model-viewer {
    height: 50vh;
}

/* =============================================================
   V3 Test Suite Review — BOM table (wide, scrollable)
   ============================================================= */
.v3-app .v3-tsr-tablewrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.v3-app .v3-tsr-tablewrap .v3-tsr-table {
    border: 0;
    border-radius: 0;
    min-width: 880px;
    width: 100%;
}
.v3-app .v3-tsr-bomtable th.num,
.v3-app .v3-tsr-bomtable td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-tsr-bomtable td {
    vertical-align: top;
}

/* =============================================================
   V3 Test Suite Review — File compare toolbar + 5 modes
   ============================================================= */
.v3-app .v3-tsr-cmp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    flex-wrap: wrap;
}
.v3-app .v3-tsr-cmp-toolbar .lbl {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-tsr-cmp-toolbar .modes {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--teal-50);
    padding: 3px;
    border-radius: 8px;
}
.v3-app .v3-tsr-cmp-toolbar .mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
}
.v3-app .v3-tsr-cmp-toolbar .mode:hover:not(:disabled) {
    background: var(--surface);
    color: var(--ink);
}
.v3-app .v3-tsr-cmp-toolbar .mode.on {
    background: var(--surface);
    color: var(--teal-800);
    box-shadow: 0 1px 2px rgba(17, 61, 79, 0.1);
    font-weight: 600;
}
.v3-app .v3-tsr-cmp-toolbar .mode:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Stage wrapper — used by swipe/overlay/flicker/diff */
.v3-app .v3-tsr-stage-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}
.v3-app .v3-tsr-stage-meta {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-bottom: 10px;
}

/* Slider used by swipe + overlay */
.v3-app .v3-tsr-slider {
    width: 100%;
    margin-top: 12px;
    accent-color: var(--teal-800);
}
.v3-app .v3-tsr-swipe-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--ink-4);
    font-weight: 500;
}

/* Swipe mode */
.v3-app .v3-tsr-swipe-stage {
    position: relative;
    width: 100%;
    height: 60vh;
    background: linear-gradient(180deg, #f4f7f8, #e3ecef);
    border-radius: 10px;
    overflow: hidden;
    user-select: none;
}
.v3-app .v3-tsr-swipe-stage img,
.v3-app .v3-tsr-swipe-stage model-viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.v3-app .v3-tsr-swipe-base {
    z-index: 1;
}
.v3-app .v3-tsr-swipe-top {
    z-index: 2;
}
.v3-app .v3-tsr-swipe-handle {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--teal-800);
    z-index: 3;
    pointer-events: none;
    transform: translateX(-1px);
}
.v3-app .v3-tsr-swipe-handle::before,
.v3-app .v3-tsr-swipe-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    background: var(--teal-800);
    border-radius: 50%;
    top: 50%;
    margin-top: -14px;
    box-shadow: 0 2px 8px rgba(17, 61, 79, 0.35);
}
.v3-app .v3-tsr-swipe-handle::after {
    background: transparent;
    border: 2px solid #fff;
    width: 24px;
    height: 24px;
    margin-top: -12px;
}

/* Overlay mode */
.v3-app .v3-tsr-overlay-stage {
    position: relative;
    width: 100%;
    height: 60vh;
    background: linear-gradient(180deg, #f4f7f8, #e3ecef);
    border-radius: 10px;
    overflow: hidden;
}
.v3-app .v3-tsr-overlay-stage img,
.v3-app .v3-tsr-overlay-stage model-viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.v3-app .v3-tsr-overlay-base { z-index: 1; }
.v3-app .v3-tsr-overlay-top { z-index: 2; }

/* Flicker mode */
.v3-app .v3-tsr-flicker-stage {
    position: relative;
    width: 100%;
    height: 60vh;
    background: linear-gradient(180deg, #f4f7f8, #e3ecef);
    border-radius: 10px;
    overflow: hidden;
}
.v3-app .v3-tsr-flicker-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.v3-app .v3-tsr-flicker-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--teal-800);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    z-index: 5;
}

/* Diff mode (CSS-only image diff via blend mode)
   - `isolation: isolate` forces a fresh stacking context so the blend mode
     can only see the sibling base image, not anything painted behind. */
.v3-app .v3-tsr-diff-stage {
    position: relative;
    width: 100%;
    height: 60vh;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    isolation: isolate;
}
.v3-app .v3-tsr-diff-stage img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.v3-app .v3-tsr-diff-base { z-index: 1; }
.v3-app .v3-tsr-diff-top {
    z-index: 2;
    mix-blend-mode: difference !important;
}

/* =============================================================
   V3 Test Suite Review — pdf.js viewer
   ============================================================= */
.v3-app .v3-tsr-pdfjs {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 70vh;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}
.v3-app .v3-tsr-pdfjs-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--teal-50);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.v3-app .v3-tsr-pdfjs-toolbar .btn {
    padding: 4px 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 6px;
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    font-weight: 500;
}
.v3-app .v3-tsr-pdfjs-toolbar .btn:hover {
    border-color: var(--teal-300);
    color: var(--ink);
}
.v3-app .v3-tsr-pdfjs-toolbar .btn.on {
    background: var(--teal-100);
    border-color: var(--teal-300);
    color: var(--teal-800);
    font-weight: 600;
}
.v3-app .v3-tsr-pdfjs-toolbar .zoom {
    font-size: 12px;
    color: var(--ink-3);
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-tsr-pdfjs-toolbar .pages {
    margin-left: auto;
    font-size: 11px;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.v3-app .v3-tsr-pdfjs-scroll {
    flex: 1;
    overflow: auto;
    padding: 10px;
    background: #5c6770;
    text-align: center;
}
.v3-app .v3-tsr-pdfjs-scroll .vf-pdfjs-page {
    display: block;
    margin: 0 auto 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* =============================================================
   V3 Test Suite Review — Diff toolbar + diff table cells
   ============================================================= */
.v3-app .v3-tsr-diff-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.v3-app .v3-tsr-diff-toolbar .modes {
    display: flex;
    gap: 4px;
    background: var(--teal-50);
    padding: 3px;
    border-radius: 8px;
}
.v3-app .v3-tsr-diff-toolbar .mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
}
.v3-app .v3-tsr-diff-toolbar .mode:hover { background: var(--surface); color: var(--ink); }
.v3-app .v3-tsr-diff-toolbar .mode.on {
    background: var(--surface);
    color: var(--teal-800);
    box-shadow: 0 1px 2px rgba(17, 61, 79, 0.1);
    font-weight: 600;
}
.v3-app .v3-tsr-diff-toolbar .summary {
    display: flex;
    gap: 6px;
}
.v3-app .v3-tsr-diff-toolbar .chip {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 500;
}
.v3-app .v3-tsr-diff-toolbar .chip b { font-weight: 700; margin-right: 2px; }
.v3-app .v3-tsr-diff-toolbar .chip.add { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }
.v3-app .v3-tsr-diff-toolbar .chip.rem { background: rgba(231, 76, 60, 0.16); color: #b23a2c; }
.v3-app .v3-tsr-diff-toolbar .chip.chg { background: rgba(241, 196, 15, 0.18); color: #b48700; }
.v3-app .v3-tsr-diff-toolbar .chip.eq { background: var(--line-soft); color: var(--ink-4); }
.v3-app .v3-tsr-diff-toolbar .check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
}
.v3-app .v3-tsr-diff-toolbar .search {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12.5px;
    min-width: 200px;
    background: var(--surface);
    margin-left: auto;
}

.v3-app .v3-tsr-diff-empty {
    padding: 28px 24px;
    text-align: center;
    color: var(--ink-4);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 12px;
    font-size: 13px;
}
.v3-app .v3-tsr-diff-empty.ok {
    color: #1f8b4e;
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.06);
}

.v3-app .v3-tsr-group-title {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-4);
    padding: 10px 4px 6px;
}
.v3-app .v3-tsr-group-title span { color: var(--ink-4); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Diff status badge */
.v3-app .v3-tsr-statusbadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}
.v3-app .v3-tsr-statusbadge.add { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }
.v3-app .v3-tsr-statusbadge.rem { background: rgba(231, 76, 60, 0.16); color: #b23a2c; }
.v3-app .v3-tsr-statusbadge.chg { background: rgba(241, 196, 15, 0.20); color: #b48700; }
.v3-app .v3-tsr-statusbadge.eq { background: var(--line-soft); color: var(--ink-4); }

/* Diff table rows */
.v3-app .v3-tsr-difftable .diff-row.diff-added { background: rgba(46, 204, 113, 0.05); }
.v3-app .v3-tsr-difftable .diff-row.diff-removed { background: rgba(231, 76, 60, 0.05); }
.v3-app .v3-tsr-difftable .diff-row.diff-changed { background: rgba(241, 196, 15, 0.06); }
.v3-app .v3-tsr-difftable .cell-current {
    color: #1f8b4e;
    background: rgba(46, 204, 113, 0.10);
    padding: 1px 4px;
    border-radius: 3px;
}
.v3-app .v3-tsr-difftable .cell-baseline {
    color: #b23a2c;
    background: rgba(231, 76, 60, 0.10);
    padding: 1px 4px;
    border-radius: 3px;
    text-decoration: line-through;
}
.v3-app .v3-tsr-difftable .cell-diff {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.v3-app .v3-tsr-difftable .cell-diff .arrow {
    color: var(--ink-4);
    font-size: 12px;
}
.v3-app .v3-tsr-difftable .name { font-weight: 500; }
.v3-app .v3-tsr-difftable .group-sub {
    font-size: 11px;
    color: var(--ink-4);
    margin-top: 2px;
    font-weight: 400;
}
.v3-app .v3-tsr-difftable .desc {
    font-size: 11px;
    color: var(--ink-4);
    margin-top: 2px;
}
.v3-app .v3-tsr-difftable .muted {
    color: var(--ink-4);
    font-style: italic;
}

/* Side-by-side fileview labels */
.v3-app .v3-tsr-preview .meta .lbl {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--teal-800);
    background: var(--teal-100);
    padding: 2px 8px;
    border-radius: 999px;
}

@media (max-width: 800px) {
    .v3-app .v3-tsr-cmp-toolbar .modes { width: 100%; }
    .v3-app .v3-tsr-diff-toolbar .modes { width: 100%; }
    .v3-app .v3-tsr-diff-toolbar .search { width: 100%; margin-left: 0; }
    .v3-app .v3-tsr-swipe-stage,
    .v3-app .v3-tsr-overlay-stage,
    .v3-app .v3-tsr-flicker-stage,
    .v3-app .v3-tsr-diff-stage { height: 45vh; }
    .v3-app .v3-tsr-pdfjs { height: 60vh; }
}

/* =============================================================
   V3 Test Suite — enhanced run row (TestSuiteDetail page)
   Replaces the older 4-column flat row with a stacked card.
   ============================================================= */
.v3-app .v3-ts-runlist .v3-ts-run {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
}
.v3-app .v3-ts-run .run-head {
    display: grid;
    grid-template-columns: 1fr auto 18px;
    gap: 10px;
    align-items: center;
}
.v3-app .v3-ts-run .run-when .when {
    font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.v3-app .v3-ts-run .run-when .who {
    font-size: 11.5px; color: var(--ink-4); margin-top: 1px;
}
.v3-app .v3-ts-run .run-badges {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.v3-app .v3-ts-run .run-cta { color: var(--ink-4); }

.v3-app .v3-ts-run .run-progress {
    display: flex; align-items: center; gap: 10px;
}
.v3-app .v3-ts-run .run-progress .bar {
    flex: 1;
    height: 8px;
    background: var(--line-soft);
    border-radius: 999px;
    overflow: hidden;
}
.v3-app .v3-ts-run .run-progress .fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #1f8b4e);
    border-radius: 999px;
}
.v3-app .v3-ts-run .run-progress .bar-meta {
    display: flex; flex-direction: column; align-items: flex-end;
    font-size: 11px; color: var(--ink-4); white-space: nowrap;
    line-height: 1.2;
}
.v3-app .v3-ts-run .run-progress .pct {
    font-weight: 700; color: var(--teal-800); font-size: 13px;
}

.v3-app .v3-ts-run .run-counts {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    border-top: 1px solid var(--line-soft);
    padding-top: 10px;
}
.v3-app .v3-ts-run .run-counts .count {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 11px;
}
.v3-app .v3-ts-run .run-counts .count .k {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-4);
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px;
}
.v3-app .v3-ts-run .run-counts .count .v {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-ts-run .run-counts .count-ok .k { color: #1f8b4e; }
.v3-app .v3-ts-run .run-counts .count-ok .v { color: #1f8b4e; }
.v3-app .v3-ts-run .run-counts .count-err .k { color: #b23a2c; }
.v3-app .v3-ts-run .run-counts .count-err .v { color: #b23a2c; }
.v3-app .v3-ts-run .run-counts .count-pending .k { color: #b48700; }

@media (max-width: 700px) {
    .v3-app .v3-ts-run .run-counts { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================================
   V3 Test Suite Execution — hero card (left meta + right progress)
   ============================================================= */
.v3-app .v3-ts-exechero {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 14px;
    margin-bottom: 14px;
}
@media (max-width: 1100px) {
    .v3-app .v3-ts-exechero { grid-template-columns: 1fr; }
}

.v3-app .v3-ts-exechero .meta-card,
.v3-app .v3-ts-exechero .progress-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
}

.v3-app .v3-ts-exechero .meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 18px;
}
.v3-app .v3-ts-exechero .meta-grid .cell {
    display: flex; flex-direction: column; gap: 4px;
}
.v3-app .v3-ts-exechero .meta-grid .k {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-ts-exechero .meta-grid .v {
    font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.v3-app .v3-ts-exechero .meta-grid .v.cad {
    display: flex; flex-wrap: wrap; gap: 4px;
    font-weight: 500;
}
.v3-app .v3-ts-exechero .cad-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
}
.v3-app .v3-ts-exechero .cad-chip.ok { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }
.v3-app .v3-ts-exechero .cad-chip.run { background: rgba(52, 152, 219, 0.16); color: #1f6ea8; }
.v3-app .v3-ts-exechero .cad-chip.err { background: rgba(231, 76, 60, 0.16); color: #b23a2c; }

/* Progress hero (right card) */
.v3-app .v3-ts-exechero .progress-card .hero {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 22px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

/* Conic-gradient ring chart (driven by --p as a % 0..100) */
.v3-app .v3-ring,
.v3-app .v3-ts-exechero .ring,
.v3-app .v3-tsr-headerstrip .ring {
    --size: 116px;
    --p: 0;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background:
        conic-gradient(var(--teal-800) calc(var(--p) * 1%), var(--line-soft) 0);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    flex-shrink: 0;
}
.v3-app .v3-ts-exechero .ring::after,
.v3-app .v3-tsr-headerstrip .ring::after {
    content: '';
    position: absolute;
    inset: 9px;
    background: var(--surface);
    border-radius: 50%;
}
.v3-app .v3-ts-exechero .ring-inner,
.v3-app .v3-tsr-headerstrip .ring-inner {
    position: relative;
    z-index: 1;
    display: flex; flex-direction: column; align-items: center;
}
.v3-app .v3-ts-exechero .ring-inner .num,
.v3-app .v3-tsr-headerstrip .ring-inner .num {
    font-size: 28px;
    font-weight: 800;
    color: var(--teal-800);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-ts-exechero .ring-inner .pct,
.v3-app .v3-tsr-headerstrip .ring-inner .pct {
    font-size: 16px; margin-left: 1px; font-weight: 700;
}
.v3-app .v3-ts-exechero .ring-inner .lbl,
.v3-app .v3-tsr-headerstrip .ring-inner .lbl {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-4);
    margin-top: 4px;
}

.v3-app .v3-ts-exechero .stats {
    display: grid;
    grid-template-columns: repeat(3, auto) 1fr;
    gap: 14px;
    align-items: center;
}
.v3-app .v3-ts-exechero .stat {
    display: flex; flex-direction: column; gap: 2px;
}
.v3-app .v3-ts-exechero .stat .num {
    font-size: 22px; font-weight: 800; color: var(--ink);
    font-variant-numeric: tabular-nums; line-height: 1;
}
.v3-app .v3-ts-exechero .stat .lbl {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-ts-exechero .stat.ok .num { color: #1f8b4e; }
.v3-app .v3-ts-exechero .stat.err .num { color: #b23a2c; }
.v3-app .v3-ts-exechero .stat.pending .num { color: var(--ink-3); }

.v3-app .v3-ts-exechero .verdict {
    margin-left: auto; align-self: center;
}
.v3-app .v3-ts-exechero .verdict .pill {
    padding: 5px 12px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.v3-app .v3-ts-exechero .pill-idle { background: var(--line-soft); color: var(--ink-4); }
.v3-app .v3-ts-exechero .pill-progress { background: rgba(52, 152, 219, 0.16); color: #1f6ea8; }
.v3-app .v3-ts-exechero .pill-rejected { background: rgba(231, 76, 60, 0.16); color: #b23a2c; }
.v3-app .v3-ts-exechero .pill-approved { background: rgba(46, 204, 113, 0.16); color: #1f8b4e; }

.v3-app .v3-ts-exechero .cat-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding-top: 12px;
}
.v3-app .v3-ts-exechero .cat {
    display: flex; flex-direction: column; gap: 4px;
}
.v3-app .v3-ts-exechero .cat-lbl {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-ts-exechero .cat-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
    display: flex;
}
.v3-app .v3-ts-exechero .cat-seg.empty { width: 100%; background: var(--line-soft); }
.v3-app .v3-ts-exechero .cat-seg.done { background: linear-gradient(90deg, #2ecc71, #1f8b4e); }
.v3-app .v3-ts-exechero .cat-meta {
    font-size: 11px; color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
    .v3-app .v3-ts-exechero .progress-card .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .v3-app .v3-ts-exechero .stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .v3-app .v3-ts-exechero .verdict {
        grid-column: 1 / -1;
        margin: 6px auto 0;
    }
    .v3-app .v3-ts-exechero .cat-strip { grid-template-columns: 1fr 1fr; }
    .v3-app .v3-ts-exechero .meta-grid { grid-template-columns: 1fr; }
}

/* Result grid: per-row progress bar column + status row tinting */
.v3-app .v3-ts-resultgrid .row {
    grid-template-columns: minmax(160px, 1.4fr) 130px 110px repeat(5, 60px) 18px;
}
.v3-app .v3-ts-resultgrid .col.prog .row-bar {
    width: 100%;
    height: 6px;
    background: var(--line-soft);
    border-radius: 999px;
    overflow: hidden;
}
.v3-app .v3-ts-resultgrid .col.prog .row-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #1f8b4e);
    border-radius: 999px;
}
.v3-app .v3-ts-resultgrid .col.prog .row-bar-meta {
    margin-top: 3px;
    font-size: 10.5px;
    color: var(--ink-4);
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-ts-resultgrid .col.cfg .name {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.v3-app .v3-ts-resultgrid .row.status-approved { background: rgba(46, 204, 113, 0.04); }
.v3-app .v3-ts-resultgrid .row.status-failed { background: rgba(231, 76, 60, 0.04); }

@media (max-width: 1100px) {
    .v3-app .v3-ts-resultgrid .row {
        grid-template-columns: 1fr 100px 100px;
    }
    .v3-app .v3-ts-resultgrid .col.cat { display: none; }
    .v3-app .v3-ts-resultgrid .col.prog { display: block; }
    .v3-app .v3-ts-resultgrid .row.head .col.cat { display: none; }
    .v3-app .v3-ts-resultgrid .col.act { display: none; }
}

/* =============================================================
   V3 Test Suite Review — header strip with progress ring overview
   ============================================================= */
.v3-app .v3-tsr-headerstrip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 18px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.v3-app .v3-tsr-headerstrip .left h1.v3-h1 {
    margin: 4px 0 0;
}
.v3-app .v3-tsr-headerstrip .left h1 .from {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-4);
    margin-left: 8px;
    font-family: var(--font-mono, ui-monospace, monospace);
}
.v3-app .v3-tsr-headerstrip .left .v3-lead { margin-top: 2px; }
.v3-app .v3-tsr-headerstrip .overview {
    display: flex; align-items: center; gap: 16px;
    border-left: 1px solid var(--line-soft);
    padding-left: 18px;
}
.v3-app .v3-tsr-headerstrip .ring { --size: 92px; }
.v3-app .v3-tsr-headerstrip .ring-inner .num { font-size: 22px; }
.v3-app .v3-tsr-headerstrip .ring-inner .pct { font-size: 13px; }
.v3-app .v3-tsr-headerstrip .stats {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 16px;
}
.v3-app .v3-tsr-headerstrip .stat {
    display: flex; flex-direction: column; gap: 2px; min-width: 64px;
}
.v3-app .v3-tsr-headerstrip .stat .num {
    font-size: 20px; font-weight: 800;
    color: var(--ink); line-height: 1;
    font-variant-numeric: tabular-nums;
}
.v3-app .v3-tsr-headerstrip .stat .lbl {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--ink-4);
}
.v3-app .v3-tsr-headerstrip .stat.ok .num { color: #1f8b4e; }
.v3-app .v3-tsr-headerstrip .stat.err .num { color: #b23a2c; }
.v3-app .v3-tsr-headerstrip .stat.pending .num { color: var(--ink-3); }
.v3-app .v3-tsr-headerstrip .actions {
    display: flex; flex-direction: column; gap: 6px;
    border-left: 1px solid var(--line-soft);
    padding-left: 18px;
}

@media (max-width: 1000px) {
    .v3-app .v3-tsr-headerstrip {
        grid-template-columns: 1fr;
    }
    .v3-app .v3-tsr-headerstrip .overview,
    .v3-app .v3-tsr-headerstrip .actions {
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid var(--line-soft);
        padding-top: 12px;
    }
    .v3-app .v3-tsr-headerstrip .actions {
        flex-direction: row;
    }
}

/* ========================================================================
   Roles & permissions matrix (Pages/V3Pages/UserManagement/Roles.razor)
   ======================================================================== */

/* Extra role pills used by the roles matrix. Existing v3-role-viewer and
   v3-role-admin are reused as-is. */
.v3-role-adv-viewer       { background: #E9EEF1; color: #2C4A55; border-color: #D2DBE0; }
.v3-role-adv-viewer       .v3-role-dot { background: #4F7A89; }
.v3-role-configurator     { background: #E0F1EE; color: #1F5A52; border-color: #C6E1DB; }
.v3-role-configurator     .v3-role-dot { background: #2A8C7E; }
.v3-role-adv-configurator { background: #DCEDF6; color: #1F5775; border-color: #BFDDED; }
.v3-role-adv-configurator .v3-role-dot { background: #2F7CA1; }
.v3-role-builder          { background: #E7E5F2; color: #3A3477; border-color: #CFCBE2; }
.v3-role-builder          .v3-role-dot { background: #5A4FB3; }
.v3-role-config-builder   { background: #DFF1E6; color: #1C5A33; border-color: #C0DECA; }
.v3-role-config-builder   .v3-role-dot { background: #3C8F5B; }
.v3-app[data-theme="dark"] .v3-role-adv-viewer       { background: #1F2A30; color: #B6C9D2; border-color: #2C3A41; }
.v3-app[data-theme="dark"] .v3-role-configurator     { background: #163029; color: #8FD3C5; border-color: #234038; }
.v3-app[data-theme="dark"] .v3-role-adv-configurator { background: #18303D; color: #9FCDE3; border-color: #244254; }
.v3-app[data-theme="dark"] .v3-role-builder          { background: #211F36; color: #BCB6E2; border-color: #322E4E; }

/* Role legend cards above the matrix */
.v3-roles-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.v3-roles-legend-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.v3-roles-legend-card .head { display: flex; align-items: center; }
.v3-roles-legend-card .desc { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }

/* Matrix table */
.v3-roles-matrix { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); }
.v3-rm-row { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(6, minmax(110px, 1fr)); align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.v3-rm-row:last-child { border-bottom: 0; }
.v3-rm-row:nth-child(even):not(.v3-rm-head) { background: color-mix(in oklab, var(--teal-800) 1.5%, var(--surface)); }
.v3-app[data-theme="dark"] .v3-rm-row:nth-child(even):not(.v3-rm-head) { background: color-mix(in oklab, var(--teal-100) 5%, var(--surface)); }
.v3-rm-head { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.v3-app[data-theme="dark"] .v3-rm-head { background: color-mix(in oklab, var(--teal-100) 10%, var(--surface)); }
.v3-rm-cell { min-width: 0; }
.v3-rm-page { display: flex; flex-direction: column; gap: 2px; }
.v3-rm-head .v3-rm-page { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.v3-rm-page-title { font-weight: 600; color: var(--ink); font-size: 13.5px; font-family: var(--mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace); }
.v3-rm-page-sub   { color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.v3-rm-role { display: flex; align-items: center; justify-content: center; text-align: center; }
.v3-rm-yes { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #E2F1E7; color: #1C5A33; border: 1px solid color-mix(in oklab, var(--green) 30%, transparent); }
.v3-rm-no  { color: var(--ink-4); font-size: 16px; line-height: 1; }
.v3-rm-text { font-size: 12px; color: var(--ink-2); padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); white-space: normal; line-height: 1.35; text-align: center; }
.v3-app[data-theme="dark"] .v3-rm-yes { background: #15331F; color: #9BD5AC; }
.v3-rm-empty { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }

@media (max-width: 1100px) {
    .v3-rm-row { grid-template-columns: minmax(180px, 1.6fr) repeat(6, minmax(90px, 1fr)); padding: 10px 12px; }
    .v3-rm-page-title { font-size: 13px; }
}

@media (max-width: 800px) {
    /* Stack each row: page header above, then a 2-col grid of role cells. */
    .v3-rm-row { grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px; }
    .v3-rm-head { display: none; }
    .v3-rm-page { grid-column: 1 / -1; padding-bottom: 4px; border-bottom: 1px dashed var(--line-soft); margin-bottom: 4px; }
    .v3-rm-role { justify-content: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
    .v3-rm-role::before { content: attr(data-role); }
}

/* ─── Application management (Companies / All Users) ──────────────────── */
.v3-am-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.v3-am-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.v3-am-stat .v3-eyebrow { margin-bottom: 4px; }
.v3-am-stat-num {
    font-size: 28px;
    font-weight: 600;
    color: var(--teal-800);
    letter-spacing: -0.02em;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.v3-am-stat-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--ink-3);
}

/* Company table — 5 cols (no Configs/Auth like Users) */
.v3-am-ctable .v3-am-crow {
    grid-template-columns: 2.2fr 1.6fr 1.4fr 1fr 100px;
}

/* All-users table — 4 cols (User / Company / Status / Actions) */
.v3-am-utable .v3-am-urow {
    grid-template-columns: 2.4fr 1.6fr 1fr 100px;
}

.v3-am-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    background: var(--line-soft);
}

.v3-am-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--ink-2);
    background: var(--bg);
    border: 1px solid var(--line-soft);
    padding: 1px 6px;
    border-radius: 4px;
}

.v3-am-muted { color: var(--ink-4); }

.v3-am-empty {
    padding: 40px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}
.v3-am-loading {
    padding: 32px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}

.v3-status-off { color: var(--ink-3); }
.v3-status-off .v3-dot { background: var(--ink-4); }

/* Invite modal form */
.v3-am-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.v3-am-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    color: var(--ink-2);
}
.v3-am-field > span {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-3);
}
.v3-am-field input,
.v3-am-field select {
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    outline: none;
}
.v3-am-field input:focus,
.v3-am-field select:focus {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-800) 15%, transparent);
}
.v3-am-error {
    font-size: 12.5px;
    color: var(--red);
    background: #F5DED6;
    border: 1px solid color-mix(in oklab, var(--red) 30%, transparent);
    border-radius: var(--r-sm);
    padding: 8px 10px;
}

@media (max-width: 900px) {
    .v3-am-stats { grid-template-columns: 1fr; }
    .v3-am-ctable .v3-am-crow,
    .v3-am-utable .v3-am-urow { grid-template-columns: 1fr; }
}

/* ======================== CAD Servers (Sysadmin) ======================== */

.v3-cad-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 18px;
}
.v3-cad-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.v3-cad-stat .k { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); }
.v3-cad-stat .v { font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1.1; }
.v3-cad-stat .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.v3-cad-stat.ok    { border-left: 3px solid var(--green); }
.v3-cad-stat.busy  { border-left: 3px solid var(--teal-800); }
.v3-cad-stat.warn  { border-left: 3px solid var(--amber); }
.v3-cad-stat.err   { border-left: 3px solid var(--red); }

.v3-cad-sec {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px 18px;
    margin-bottom: 18px;
}
.v3-cad-sec-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.v3-cad-sec-h h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.v3-cad-sec-h .count {
    margin-left: 6px;
    font-size: 12px;
    color: var(--ink-4);
    font-weight: 500;
}

/* Servers grid */
.v3-cad-servers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.v3-cad-server {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.v3-cad-server .head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.v3-cad-server .ident .name { font-size: 14px; font-weight: 600; color: var(--ink); }
.v3-cad-server .ident .ip   { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.v3-cad-server .meta { display: flex; flex-direction: column; gap: 4px; }
.v3-cad-server .meta-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.v3-cad-server .meta-row .k { color: var(--ink-4); }
.v3-cad-server .meta-row .v { color: var(--ink); }
.v3-cad-server .meta-row .muted { color: var(--ink-4); }
.v3-cad-server .actions { display: flex; gap: 8px; margin-top: 2px; }

/* Status badges */
.v3-badge.v3-cad-badge-idle  { background: var(--green-50);  color: #1C5A33;          border-color: color-mix(in oklab, var(--green) 30%, transparent); }
.v3-badge.v3-cad-badge-busy  { background: var(--teal-50);   color: var(--teal-800);  border-color: color-mix(in oklab, var(--teal-800) 25%, transparent); }
.v3-badge.v3-cad-badge-maint { background: var(--amber-50);  color: #7A5A1A;          border-color: color-mix(in oklab, var(--amber) 30%, transparent); }
.v3-badge.v3-cad-badge-shut  { background: var(--line-soft); color: var(--ink-3);     border-color: var(--line); }
.v3-badge.v3-cad-badge-done  { background: var(--green-50);  color: #1C5A33;          border-color: color-mix(in oklab, var(--green) 30%, transparent); }
.v3-badge.v3-cad-badge-queued{ background: var(--teal-50);   color: var(--teal-800);  border-color: color-mix(in oklab, var(--teal-800) 20%, transparent); }
.v3-badge.v3-cad-badge-fail  { background: var(--red-50);    color: var(--red);       border-color: color-mix(in oklab, var(--red) 30%, transparent); }
/* Dark mode overrides — light bg colours invert on dark surfaces */
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-idle,
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-done  { background: var(--green-50); color: #9BD5AC; border-color: color-mix(in oklab, var(--green) 40%, transparent); }
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-busy,
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-queued{ background: var(--teal-100); color: var(--teal-700); border-color: color-mix(in oklab, var(--teal-700) 35%, transparent); }
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-maint { background: var(--amber-50); color: #E9C88A; border-color: color-mix(in oklab, var(--amber) 35%, transparent); }
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-shut  { background: var(--surface);  color: var(--ink-3); border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-badge.v3-cad-badge-fail  { background: var(--red-50);   color: #E59A82; border-color: color-mix(in oklab, var(--red) 35%, transparent); }

/* Jobs toolbar */
.v3-cad-jobs-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.v3-cad-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-2, var(--ink));
    cursor: pointer;
    user-select: none;
}
.v3-cad-toggle input { accent-color: var(--teal-800); }
.v3-cad-select {
    height: 32px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 12.5px;
    padding: 0 8px;
}
.v3-cad-select:focus { outline: none; border-color: var(--teal-800); box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-800) 18%, transparent); }

/* Jobs table */
.v3-cad-jobtable {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    overflow-x: auto;
}
.v3-cad-jobhead,
.v3-cad-jobrow {
    display: grid;
    grid-template-columns: 80px 130px 110px minmax(160px, 1.4fr) 80px 110px 110px 150px 90px 90px 90px;
    gap: 0;
    align-items: center;
    min-width: 1180px;
}
.v3-cad-jobhead {
    background: var(--teal-50);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-3);
    font-weight: 500;
    padding: 0;
}
.v3-cad-jobhead > div { padding: 9px 10px; }
.v3-cad-jobrow {
    border-top: 1px solid var(--line-soft);
    background: var(--surface);
    font-size: 12.5px;
    color: var(--ink);
}
.v3-cad-jobrow:hover { background: var(--teal-50); }
.v3-cad-jobrow.is-failed { background: color-mix(in oklab, var(--red-50) 60%, var(--surface)); }
.v3-cad-jobrow.is-failed:hover { background: var(--red-50); }
.v3-cad-jobrow .cell { padding: 10px; min-width: 0; }
.v3-cad-jobrow .cell.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-cad-jobrow .cell.when .sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.v3-cad-jobrow .cell.mono,
.v3-cad-jobtable .mono { font-family: var(--mono); }

.v3-cad-errorbox {
    background: var(--red-50);
    border: 1px solid color-mix(in oklab, var(--red) 25%, transparent);
    border-radius: var(--r-sm);
    padding: 12px;
}
.v3-cad-errorbox pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink);
    max-height: 360px;
    overflow: auto;
}

@media (max-width: 1100px) {
    .v3-cad-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .v3-cad-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =============================================================
   V3 Projects — list table, detail, form
   ============================================================= */

/* ── Projects list table ─────────────────────────────────────── */
.v3-app .v3-proj-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-bottom: 12px;
}

.v3-app .v3-proj-table .row {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr 1.6fr 110px 100px 100px 120px;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background 100ms ease;
}
.v3-app .v3-proj-table .row:last-child { border-bottom: 0; }

.v3-app .v3-proj-table .row.head {
    background: var(--teal-50);
    padding-top: 8px;
    padding-bottom: 8px;
    cursor: default;
}
.v3-app .v3-proj-table .row.selected { background: var(--teal-100); }
.v3-app .v3-proj-table .row.head .col {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
}

.v3-app .v3-proj-table .row:not(.head):hover { background: var(--teal-50); }

.v3-app .v3-proj-table .col {
    padding: 11px 6px;
    font-size: 13px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-app .v3-proj-table .col.customer { color: var(--ink); }
.v3-app .v3-proj-table .col.name b { color: var(--ink); font-weight: 600; }
.v3-app .v3-proj-table .col.pid { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.v3-app .v3-proj-table .col.date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* Configurations table (project detail) */
.v3-app .v3-proj-cfg-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-bottom: 12px;
}
.v3-app .v3-proj-cfg-table .row {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 80px 90px 130px 1fr 100px 80px;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-proj-cfg-table .row:last-child { border-bottom: 0; }
.v3-app .v3-proj-cfg-table .row.head {
    background: var(--teal-50);
    padding-top: 8px;
    padding-bottom: 8px;
}
.v3-app .v3-proj-cfg-table .row.head .col {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
}
.v3-app .v3-proj-cfg-table .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-proj-cfg-table .col {
    padding: 11px 6px;
    font-size: 13px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-app .v3-proj-cfg-table .col.cfg b { color: var(--ink); font-weight: 600; }
.v3-app .v3-proj-cfg-table .col.cno,
.v3-app .v3-proj-cfg-table .col.rev { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.v3-app .v3-proj-cfg-table .col.when { font-size: 12px; color: var(--ink-3); }
.v3-app .v3-proj-cfg-table .col.acts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
}

/* ── Status pills ────────────────────────────────────────────── */
.v3-app .v3-proj-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--teal-50);
    color: var(--teal-800);
    border: 1px solid var(--teal-100);
}

.v3-app .v3-proj-rev-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--line-soft);
    color: var(--ink-3);
}
.v3-app .v3-proj-rev-pill.pill-release    { background: #E8F5E9; color: #4CAF50; }
.v3-app .v3-proj-rev-pill.pill-active     { background: #E8F5E9; color: #4CAF50; }
.v3-app .v3-proj-rev-pill.pill-draft      { background: #FEF0E6; color: #F58A3C; }
.v3-app .v3-proj-rev-pill.pill-design     { background: #CEE8FF; color: #1565C0; }
.v3-app .v3-proj-rev-pill.pill-definition { background: #F2F2F2; color: #616161; }
.v3-app .v3-proj-rev-pill.pill-inactive   { background: #FDECEA; color: #D8433E; }
.v3-app .v3-proj-rev-pill.pill-archived   { background: #F5F5F5; color: #9E9E9E; }

/* ── Footer pagination ───────────────────────────────────────── */
.v3-app .v3-proj-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
    font-size: 12.5px;
    color: var(--ink-3);
    margin-bottom: 20px;
}
.v3-app .v3-proj-foot .spacer { flex: 1; }

/* ── Project detail ──────────────────────────────────────────── */
.v3-app .v3-proj-infostrip {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: 24px;
    overflow: hidden;
}
.v3-app .v3-proj-infostrip .kv {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 20px;
    border-right: 1px solid var(--line-soft);
    min-width: 140px;
}
.v3-app .v3-proj-infostrip .kv:last-child { border-right: 0; }
.v3-app .v3-proj-infostrip .kv.wide { flex: 1 1 300px; }
.v3-app .v3-proj-infostrip .k {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-4);
}
.v3-app .v3-proj-infostrip .v {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
}

/* ── Configurations section ──────────────────────────────────── */
.v3-app .v3-proj-sec { margin-top: 8px; }
.v3-app .v3-proj-sec-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 14px;
}
.v3-app .v3-proj-sec-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.v3-app .v3-proj-sec-head .v3-lead { margin: 2px 0 0; }
.v3-app .v3-proj-sec-head .v3-page-h-actions { align-self: center; }

/* ── Add / Edit form (inside V3Modal) ────────────────────────── */
.v3-app .v3-proj-form { display: flex; flex-direction: column; gap: 0; }
.v3-app .v3-proj-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.v3-app .v3-proj-form .req { color: var(--red); margin-left: 2px; }

/* ── Dark-mode adaptations ───────────────────────────────────── */
.v3-app[data-theme="dark"] .v3-proj-table,
.v3-app[data-theme="dark"] .v3-proj-cfg-table,
.v3-app[data-theme="dark"] .v3-proj-infostrip {
    border-color: var(--line);
}
.v3-app[data-theme="dark"] .v3-proj-table .row.head,
.v3-app[data-theme="dark"] .v3-proj-cfg-table .row.head,
.v3-app[data-theme="dark"] .v3-proj-table .row:not(.head):hover,
.v3-app[data-theme="dark"] .v3-proj-cfg-table .row:not(.head):hover { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-proj-table .row.selected { background: #1e3340; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .v3-app .v3-proj-table .row {
        grid-template-columns: 1fr 1fr 1.4fr 90px 110px 100px 120px;
    }
    .v3-app .v3-proj-table .col.date:last-of-type { display: none; }
    .v3-app .v3-proj-cfg-table .row {
        grid-template-columns: 1.2fr 1.4fr 80px 110px 1fr 80px;
    }
    .v3-app .v3-proj-cfg-table .col.who { display: none; }
}
@media (max-width: 780px) {
    .v3-app .v3-proj-table .row {
        grid-template-columns: 1fr 1.4fr 100px 120px;
    }
    .v3-app .v3-proj-table .col.site,
    .v3-app .v3-proj-table .col.pid { display: none; }
    .v3-app .v3-proj-infostrip .kv { min-width: 120px; }
    .v3-app .v3-proj-form-row { grid-template-columns: 1fr; }
}

/* =============================================================
   V3 Customers page (.v3-cust-*)
   ============================================================= */

/* ── Customers table ─────────────────────────────────────────── */
.v3-app .v3-cust-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    font-size: 13.5px;
}
.v3-app .v3-cust-table .row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.6fr;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    gap: 0;
    cursor: pointer;
    transition: background 100ms ease;
}
.v3-app .v3-cust-table .row:last-child { border-bottom: none; }
.v3-app .v3-cust-table .row.head {
    background: var(--teal-50);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink-4);
    cursor: default;
}
.v3-app .v3-cust-table .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-cust-table .row.selected { background: var(--teal-100); }
.v3-app .v3-cust-table .col {
    padding: 9px 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* ── Sites table ─────────────────────────────────────────────── */
.v3-app .v3-cust-sites-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    font-size: 13.5px;
}
.v3-app .v3-cust-sites-table .row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1.6fr;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    gap: 0;
    cursor: pointer;
    transition: background 100ms ease;
}
.v3-app .v3-cust-sites-table .row:last-child { border-bottom: none; }
.v3-app .v3-cust-sites-table .row.head {
    background: var(--teal-50);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink-4);
    cursor: default;
}
.v3-app .v3-cust-sites-table .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-cust-sites-table .row.selected { background: var(--teal-100); }
.v3-app .v3-cust-sites-table .col {
    padding: 9px 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ── Section container (sites panel) ─────────────────────────── */
.v3-app .v3-cust-sec {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px 16px;
    margin-top: 20px;
}
.v3-app .v3-cust-sec-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 12px;
}

/* ── Pagination footer ───────────────────────────────────────── */
.v3-app .v3-cust-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px 0;
    font-size: 12.5px;
    color: var(--ink-4);
}

/* ── Add / Edit form ─────────────────────────────────────────── */
.v3-app .v3-cust-form { display: flex; flex-direction: column; gap: 0; }
.v3-app .v3-cust-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.v3-app .v3-cust-form .req { color: var(--red); margin-left: 2px; }
.v3-app .v3-cust-form-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: 8px 0 4px;
    border-top: 1px solid var(--line-soft);
    margin-top: 4px;
}

/* ── Dark-mode adaptations ───────────────────────────────────── */
.v3-app[data-theme="dark"] .v3-cust-table,
.v3-app[data-theme="dark"] .v3-cust-sites-table,
.v3-app[data-theme="dark"] .v3-cust-sec {
    border-color: var(--line);
}
.v3-app[data-theme="dark"] .v3-cust-table .row.head,
.v3-app[data-theme="dark"] .v3-cust-sites-table .row.head { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-cust-table .row:not(.head):hover,
.v3-app[data-theme="dark"] .v3-cust-sites-table .row:not(.head):hover { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-cust-table .row.selected { background: #1e3340; }

/* ── Dark-mode: sites selected row ──────────────────────────── */
.v3-app[data-theme="dark"] .v3-cust-sites-table .row.selected { background: #1e3340; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .v3-app .v3-cust-table .row {
        grid-template-columns: 1.4fr 1fr 1.6fr;
    }
    .v3-app .v3-cust-table .col.website { display: none; }
}
@media (max-width: 780px) {
    .v3-app .v3-cust-table .row {
        grid-template-columns: 1.4fr 1.6fr;
    }
    .v3-app .v3-cust-table .col.country { display: none; }
    .v3-app .v3-cust-sites-table .row {
        grid-template-columns: 1.4fr 1.6fr;
    }
    .v3-app .v3-cust-sites-table .col.country { display: none; }
    .v3-app .v3-cust-form-row { grid-template-columns: 1fr; }
}

/* ===== Profile page ===== */
.v3-prof { max-width: 1100px; margin: 0 auto; }

.v3-prof-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background: linear-gradient(135deg, var(--teal-50) 0%, var(--surface) 70%);
    margin-bottom: 24px;
}
.v3-prof-avatar-wrap { flex: none; }
.v3-prof-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08), 0 0 0 4px var(--surface);
    overflow: hidden;
    object-fit: cover;
}
.v3-prof-avatar.initials {
    background: var(--teal-700);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 1px;
    font-family: var(--sans);
}
.v3-prof-hero-body { flex: 1; min-width: 0; }
.v3-prof-hero-body .v3-h1 { margin: 0 0 6px 0; font-size: 26px; line-height: 1.15; }
.v3-prof-sub { color: var(--ink-3); font-size: 13px; margin: 0 0 12px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.v3-prof-sub .dot { color: var(--ink-4); }
.v3-prof-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.v3-prof-role-badge { background: var(--teal-100); color: var(--teal-800); border: 1px solid var(--teal-100); }
.v3-prof-hero-actions { flex: none; align-self: flex-start; }

.v3-prof-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}
.v3-prof-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.v3-prof-card-h {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg);
}
.v3-prof-card-h h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: 0.2px; }

.v3-prof-kv { margin: 0; padding: 8px 18px 14px; }
.v3-prof-kv > div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.v3-prof-kv > div:last-child { border-bottom: 0; }
.v3-prof-kv dt { color: var(--ink-3); font-size: 12px; font-weight: 500; margin: 0; }
.v3-prof-kv dd { margin: 0; color: var(--ink); font-size: 13px; word-break: break-word; }
.v3-prof-kv dd.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.v3-prof-rolelist { list-style: none; margin: 0; padding: 8px 18px 14px; }
.v3-prof-rolelist li {
    display: grid;
    grid-template-columns: 10px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line-soft);
    align-items: start;
}
.v3-prof-rolelist li:last-child { border-bottom: 0; }
.v3-prof-rolelist li .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal-700);
    margin-top: 6px;
    grid-row: 1 / span 2;
}
.v3-prof-rolelist li .name { font-weight: 600; color: var(--ink); font-size: 13px; }
.v3-prof-rolelist li .desc { color: var(--ink-3); font-size: 12px; line-height: 1.5; }

.v3-prof-pref { padding: 6px 18px 14px; }
.v3-prof-pref .row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.v3-prof-pref .row:last-child { border-bottom: 0; }
.v3-prof-pref .row > div:first-child { flex: 1; min-width: 0; }
.v3-prof-pref .title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.v3-prof-pref .sub { color: var(--ink-3); font-size: 12px; }

@media (max-width: 800px) {
    .v3-prof-hero { flex-direction: column; align-items: flex-start; padding: 20px; gap: 16px; }
    .v3-prof-avatar { width: 80px; height: 80px; font-size: 26px; }
    .v3-prof-grid { grid-template-columns: 1fr; }
    .v3-prof-kv > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ===== Notification bell + panel ===== */
.v3-notif-wrap { position: relative; }
.v3-notif-btn { position: relative; }
.v3-notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}
.v3-notif-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
}
.v3-notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    width: 380px;
    max-height: min(560px, 75vh);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: v3-notif-pop .12s ease-out;
}
@keyframes v3-notif-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.v3-notif-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg);
}
.v3-notif-h .title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.v3-notif-h .title .t { font-size: 14px; font-weight: 600; color: var(--ink); }
.v3-notif-h .actions { display: flex; gap: 4px; }
.v3-notif-count { background: var(--teal-100); color: var(--teal-800); font-size: 11px; padding: 2px 6px; }

.v3-notif-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 0 6px;
    background: var(--bg);
}
.v3-notif-tab {
    appearance: none;
    background: none;
    border: 0;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--ink-3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 500;
}
.v3-notif-tab:hover { color: var(--ink-2); }
.v3-notif-tab.on { color: var(--teal-800); border-bottom-color: var(--teal-700); }
.v3-notif-tab .v3-tab-count {
    background: var(--teal-100);
    color: var(--teal-800);
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 8px;
    font-weight: 700;
}

.v3-notif-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.v3-notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-3);
}
.v3-notif-empty p { margin: 8px 0 0 0; font-size: 13px; }
.v3-notif-empty svg { width: 28px; height: 28px; opacity: 0.4; }

.v3-notif-item {
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background-color .1s ease;
    position: relative;
}
.v3-notif-item:hover { background: var(--bg); }
.v3-notif-item.unread { background: linear-gradient(to right, color-mix(in srgb, var(--teal-50) 60%, var(--surface)) 0%, var(--surface) 100%); }
.v3-notif-item.unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 2px 2px 0;
    background: var(--teal-700);
}
.v3-notif-item .ico {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--teal-100);
    color: var(--teal-800);
    display: grid;
    place-items: center;
    flex: none;
}
.v3-notif-item.sev-success .ico { background: color-mix(in srgb, var(--green) 18%, var(--surface)); color: var(--green); }
.v3-notif-item.sev-warning .ico { background: color-mix(in srgb, var(--amber) 18%, var(--surface)); color: var(--amber); }
.v3-notif-item.sev-error   .ico { background: color-mix(in srgb, var(--red)   18%, var(--surface)); color: var(--red); }
.v3-notif-item .body { min-width: 0; }
.v3-notif-item .body .title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.v3-notif-item .body .text {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.45;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.v3-notif-item .body .meta { font-size: 11px; color: var(--ink-4); display: flex; gap: 6px; align-items: center; }
.v3-notif-item .body .meta .new { color: var(--teal-700); font-weight: 600; }
.v3-notif-item .rm {
    width: 24px;
    height: 24px;
    align-self: start;
    color: var(--ink-4);
    font-size: 18px;
    line-height: 1;
}
.v3-notif-item .rm:hover { color: var(--red); }

@media (max-width: 600px) {
    .v3-notif-panel { right: -60px; width: calc(100vw - 24px); max-width: 380px; }
}

/* ===== Home filter drawer ===== */
.v3-fdrawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.32);
    z-index: 200;
    animation: v3-fdrawer-fade .15s ease-out;
}
@keyframes v3-fdrawer-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.v3-fdrawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 92vw;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(0,0,0,0.12);
    z-index: 201;
    display: flex;
    flex-direction: column;
    animation: v3-fdrawer-slide .18s ease-out;
}
@keyframes v3-fdrawer-slide {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.v3-fdrawer-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg);
}
.v3-fdrawer-h h3 {
    margin: 0;
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.v3-fdrawer-h h3 svg { color: var(--teal-700); }

.v3-fdrawer-tools {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
}
.v3-fdrawer-tools .v3-search { width: 100%; max-width: none; flex: none; }
.v3-fdrawer-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: border-color .12s ease, background-color .12s ease;
}
.v3-fdrawer-toggle:hover { border-color: var(--ink-4); background: var(--bg); }
.v3-fdrawer-toggle .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.v3-fdrawer-toggle .t { font-size: 13px; font-weight: 600; color: var(--ink); }
.v3-fdrawer-toggle .s { font-size: 11px; color: var(--ink-3); line-height: 1.35; }
.v3-fdrawer-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.v3-fdrawer-toggle .track {
    position: relative;
    flex: none;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--line);
    transition: background-color .15s ease;
}
.v3-fdrawer-toggle .thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform .15s ease;
}
.v3-fdrawer-toggle input:checked ~ .track { background: var(--teal-700); }
.v3-fdrawer-toggle input:checked ~ .track .thumb { transform: translateX(16px); }
.v3-fdrawer-toggle input:focus-visible ~ .track { box-shadow: 0 0 0 3px color-mix(in oklab, var(--teal-700) 25%, transparent); }

.v3-fdrawer-tree {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 8px 16px;
}

.v3-fdrawer-node { font-size: 13px; }
.v3-fdrawer-node .row {
    display: grid;
    grid-template-columns: 22px 18px 1fr auto;
    gap: 6px;
    align-items: center;
    padding: 6px 8px 6px calc(8px + var(--lvl, 0) * 14px);
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--ink);
    transition: background-color .1s ease;
}
.v3-fdrawer-node.is-product .row:hover { background: var(--teal-50); }
.v3-fdrawer-node.is-group .row:hover   { background: var(--bg); }
.v3-fdrawer-node .row .chev {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    color: var(--ink-3);
    cursor: pointer;
    border-radius: var(--r-sm);
    padding: 0;
}
.v3-fdrawer-node .row .chev:hover { background: var(--surface); color: var(--ink); }
.v3-fdrawer-node .row .chev.empty { cursor: default; }
.v3-fdrawer-node .row .chev.empty:hover { background: none; }
.v3-fdrawer-node .row .ico {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: var(--ink-3);
}
.v3-fdrawer-node.is-product .row .ico { color: var(--green); }
.v3-fdrawer-node.is-product .row .ico:has(svg path[d^="M6 6l12 12"]) { color: var(--ink-4); }
.v3-fdrawer-node .row .lbl {
    font-size: 13px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-fdrawer-node .row .lbl.muted { color: var(--ink-4); font-style: italic; }
.v3-fdrawer-node.is-group .row .lbl { font-weight: 500; }
.v3-fdrawer-node .row .hint {
    font-size: 10px;
    color: var(--teal-700);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    opacity: 0;
    transition: opacity .1s ease;
}
.v3-fdrawer-node.is-product .row:hover .hint { opacity: 1; }

.v3-fdrawer-node .kids { /* indentation handled by --lvl on row */ }

@media (max-width: 600px) {
    .v3-fdrawer { width: 100vw; max-width: 100vw; }
}

/* =============================================================
   V3 Document Templates page (.v3-dt-*)
   ============================================================= */
.v3-app .v3-dt-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    font-size: 13.5px;
}
.v3-app .v3-dt-table .row {
    display: grid;
    grid-template-columns: 1.6fr 1.8fr 1fr 0.9fr 0.8fr;
    align-items: center;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background 100ms ease;
}
.v3-app .v3-dt-table .row:last-child { border-bottom: none; }
.v3-app .v3-dt-table .row.head {
    background: var(--teal-50);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ink-4);
    cursor: default;
}
.v3-app .v3-dt-table .row:not(.head):hover { background: var(--teal-50); }
.v3-app .v3-dt-table .row.selected { background: var(--teal-100); }
.v3-app .v3-dt-table .col {
    padding: 9px 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.v3-app[data-theme="dark"] .v3-dt-table { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-dt-table .row.head { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-dt-table .row:not(.head):hover { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-dt-table .row.selected { background: #1e3340; }

/* Add/Edit modal — file drop and CAD dependency checkbox */
.v3-app .v3-dt-drop {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--teal-50);
    border: 1px dashed color-mix(in oklab, var(--teal-700) 35%, var(--line));
    border-radius: 10px;
    cursor: pointer;
    transition: background 120ms ease;
}
.v3-app .v3-dt-drop:hover { background: color-mix(in oklab, var(--teal-50) 60%, var(--surface)); }
.v3-app .v3-dt-drop.invalid { border-color: #b91c1c; background: rgba(185,28,28,0.05); }
.v3-app .v3-dt-drop.invalid .t { color: #b91c1c; }
.v3-app .v3-dt-drop .ic {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--surface); color: var(--teal-800);
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--teal-100);
}
.v3-app .v3-dt-drop .t { font-size: 13px; font-weight: 600; color: var(--ink); }
.v3-app .v3-dt-drop .s { font-size: 11.5px; color: var(--ink-3); }
.v3-app .v3-dt-file-input { display: none; }

/* ---- Product icon picker (Create product modal) ---- */
.v3-app .v3-prod-icon-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1.5px dashed var(--line);
    border-radius: var(--r-md);
    background: var(--bg);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    min-height: 60px;
}
.v3-app .v3-prod-icon-picker:hover { border-color: var(--teal-700); background: var(--teal-50); }
.v3-app .v3-prod-icon-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--r-sm);
    object-fit: cover;
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.v3-app .v3-prod-icon-name {
    font-size: 12.5px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-app .v3-prod-icon-placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-3);
    font-size: 13px;
}
.v3-app .v3-prod-icon-placeholder svg { width: 16px; height: 16px; }

.v3-app .v3-dt-check {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 13px !important;
    color: var(--ink) !important;
    font-weight: 500 !important;
    cursor: pointer;
}
.v3-app .v3-dt-check input[type="checkbox"] {
    position: static !important;
    left: auto !important;
    top: auto !important;
    opacity: 1 !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    accent-color: var(--teal-700);
    cursor: pointer;
    flex: none;
}

/* Danger button used in the delete confirm */
.v3-app .v3-btn.v3-btn-danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}
.v3-app .v3-btn.v3-btn-danger:hover:not(:disabled) {
    background: color-mix(in oklab, var(--red) 88%, #000);
    border-color: color-mix(in oklab, var(--red) 88%, #000);
}

@media (max-width: 800px) {
    .v3-app .v3-dt-table .row {
        grid-template-columns: 1.4fr 1fr 0.8fr;
    }
    .v3-app .v3-dt-table .col.file,
    .v3-app .v3-dt-table .col.cad { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   QUERY BUILDER — HOME  (.v3-qb-*)
   ═══════════════════════════════════════════════════════════════ */

/* Backdrop to close the more-action menus */
.v3-app .v3-qb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 400;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.v3-app .v3-qb-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 20px;
}
.v3-app .v3-qb-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    font: 600 13px/1 var(--sans);
    color: var(--ink-3);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s;
}
.v3-app .v3-qb-tab:hover { color: var(--ink); }
.v3-app .v3-qb-tab.active {
    color: var(--teal-800);
    border-bottom-color: var(--teal-800);
}
.v3-app .v3-qb-tab svg { width: 15px; height: 15px; }

/* ── Body: list always full-width; detail panel is a fixed drawer ── */
.v3-app .v3-qb-body {
    display: block;
    position: relative;
}
.v3-app .v3-qb-list-col { width: 100%; }

/* Detail panel — slides in from the right as a fixed drawer */
.v3-app .v3-qb-detail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -6px 0 24px rgba(0,0,0,.12);
    overflow-y: auto;
}

/* Search in page header */
.v3-app .v3-qb-header-search { width: 260px; }

/* Slim refresh bar above the list */
.v3-app .v3-qb-list-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

/* ── Query table ───────────────────────────────────────────── */
.v3-app .v3-qb-table {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: visible;   /* must NOT be hidden — dropdown menus escape the table */
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
/* Round the header row when the table stands alone (no section-head above it) */
.v3-app .v3-qb-table .row.head { border-radius: var(--r-md) var(--r-md) 0 0; }
/* Table inside a section: header has no top radius (flush with section-head) */
.v3-app .v3-qb-section .v3-qb-table .row.head { border-radius: 0; }
.v3-app .v3-qb-table .row {
    display: grid;
    grid-template-columns: minmax(0,3fr) minmax(0,1.3fr) minmax(0,1.1fr) minmax(0,1.1fr) 120px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .12s;
    align-items: center;
}
.v3-app .v3-qb-table .row:last-child { border-bottom: none; }

/* Header */
.v3-app .v3-qb-table .row.head {
    background: color-mix(in oklab, var(--teal-800) 4%, var(--bg));
    font: 700 11px/1 var(--sans);
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ink-4);
    border-bottom: 1px solid var(--line);
    min-height: 38px;
}

/* Data rows */
.v3-app .v3-qb-table .row:not(.head) {
    cursor: pointer;
    min-height: 50px;
    background: var(--surface);
}
.v3-app .v3-qb-table .row:not(.head):hover {
    background: color-mix(in oklab, var(--teal-800) 4%, var(--surface));
}
/* Selected row — teal left accent */
.v3-app .v3-qb-table .row.selected {
    background: color-mix(in oklab, var(--teal-800) 8%, var(--surface));
    box-shadow: inset 3px 0 0 var(--teal-800);
}

/* Cells */
.v3-app .v3-qb-table .col {
    padding: 12px 16px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* Actions cell */
.v3-app .v3-qb-table .col.acts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 6px 10px 6px 4px;
}

/* Ghost icon buttons inside action column */
.v3-app .v3-qb-table .col.acts .v3-btn-icon {
    border-color: transparent;
    background: transparent;
    color: var(--ink-2);
    padding: 6px;
    border-radius: var(--r-sm);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
}
.v3-app .v3-qb-table .col.acts .v3-btn-icon:hover {
    background: var(--teal-50);
    color: var(--teal-800);
    border-color: transparent;
}
.v3-app .v3-qb-table .col.acts .v3-btn-icon svg { width: 14px; height: 14px; }

/* Name cell — icon + link inline */
.v3-app .v3-qb-table .col.name {
    display: flex;
    align-items: center;
    gap: 10px;
}
.v3-app .v3-qb-table .col.name svg {
    flex-shrink: 0;
    color: var(--ink-4);
    width: 15px;
    height: 15px;
}

/* Query name link */
.v3-app .v3-qb-name-link {
    color: var(--teal-800);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-app .v3-qb-name-link:hover { text-decoration: underline; color: var(--teal-900); }

/* Star — amber when active */
.v3-app .v3-qb-table .col.acts .v3-qb-star-on,
.v3-app .v3-qb-table .col.acts .v3-qb-star-on:hover {
    color: var(--amber);
    border-color: transparent;
    background: transparent;
}
.v3-app .v3-qb-table .col.acts .v3-qb-star-on svg { color: var(--amber); }

/* Share — teal when active */
.v3-app .v3-qb-table .col.acts .v3-qb-shared-on {
    color: var(--teal-800);
    border-color: transparent;
    background: var(--teal-50);
}

/* More menu icon alignment */
.v3-app .v3-qb-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
}
.v3-app .v3-qb-menu-item svg { flex-shrink: 0; opacity: .75; }

/* Menu divider */
.v3-app .v3-qb-menu-divider {
    height: 1px;
    background: var(--line-soft);
    margin: 3px 0;
}

/* Section count label */
.v3-app .v3-qb-count {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    font: 500 11px/1 var(--sans);
    color: var(--ink-4);
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: 99px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── More-action menu ─────────────────────────────────────── */
/* Menu is rendered at the component root with position:fixed via MouseEventArgs coords.
   This completely avoids overflow/stacking-context clipping from any ancestor. */
.v3-app .v3-qb-menu {
    min-width: 196px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: 0 6px 20px rgba(0,0,0,.14);
    overflow: hidden;
}
/* The floating instance rendered at root */
.v3-qb-menu-fixed {
    position: fixed;
    z-index: 9000;
}
.v3-app .v3-qb-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font: 400 13px/1 var(--sans);
    color: var(--ink);
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background .1s;
}
.v3-app .v3-qb-menu-item:hover { background: var(--teal-50); }
.v3-app .v3-qb-menu-item-danger { color: var(--red); }
.v3-app .v3-qb-menu-item-danger:hover { background: #fff1f0; }

/* ── Section accordion ─────────────────────────────────────── */
/* Section is the single unified border container — avoids double-border junction issues */
.v3-app .v3-qb-section {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    /* NO overflow:hidden here — that would trap the dropdown menu */
}
/* Section head: no own border, just a bottom divider; background rounded at top via border-radius */
.v3-app .v3-qb-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    font: 600 12.5px/1 var(--sans);
    color: var(--ink-2);
    background: color-mix(in oklab, var(--teal-800) 3%, var(--bg));
    border: none;
    border-bottom: 1px solid var(--line-soft);
    border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0; /* inner radius = outer - 1px border */
    cursor: pointer;
    user-select: none;
    transition: background .12s;
    margin-bottom: 0;
}
.v3-app .v3-qb-section-head:hover {
    background: color-mix(in oklab, var(--teal-800) 7%, var(--bg));
}
/* Table inside section: no own border (section provides it), no top-radius */
.v3-app .v3-qb-section .v3-qb-table {
    border: none;
    box-shadow: none;
    border-radius: 0 0 var(--r-md) var(--r-md);
}
.v3-app .v3-qb-section-head svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ink-4); }
.v3-app .v3-qb-section-head .v3-badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 7px;
}

/* ── Unified-table section divider rows (My Queries / Shared Queries labels) ── */
/* These rows live inside .v3-qb-table and override display:grid with flex */
.v3-app .v3-qb-table .row.v3-qb-section-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: color-mix(in oklab, var(--teal-800) 4%, var(--bg));
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    user-select: none;
    font: 600 12.5px/1 var(--sans);
    color: var(--ink-2);
    min-height: unset;
    transition: background .12s;
}
.v3-app .v3-qb-table .row.v3-qb-section-row:hover {
    background: color-mix(in oklab, var(--teal-800) 8%, var(--bg));
}
.v3-app .v3-qb-table .row.v3-qb-section-row svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ink-4); }
/* Message rows (loading / empty) inside the unified table */
.v3-app .v3-qb-table .row.v3-qb-msg-row {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid var(--line-soft);
    min-height: unset;
    background: var(--bg);
}
/* Dark mode overrides for the new row types */
.v3-app[data-theme="dark"] .v3-qb-table .row.v3-qb-section-row {
    background: #162228;
}
.v3-app[data-theme="dark"] .v3-qb-table .row.v3-qb-section-row:hover {
    background: #1e3340;
}
.v3-app[data-theme="dark"] .v3-qb-table .row.v3-qb-msg-row {
    background: #1a2a2e;
}

/* ── Details panel (content styles — positioning is the fixed drawer above) ── */
.v3-app .v3-qb-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
    font: 600 13px/1 var(--sans);
    color: var(--ink);
    background: var(--bg);
}
.v3-app .v3-qb-detail-body { padding: 16px 18px; }
.v3-app .v3-qb-detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 14px;
}
.v3-app .v3-qb-detail-item .label {
    font: 700 10px/1 var(--sans);
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-4);
}
.v3-app .v3-qb-detail-item .value { font-size: 13px; color: var(--ink); word-break: break-word; }

/* Favorite / Shared flag rows in detail panel */
.v3-app .v3-qb-detail-flag { display: flex; align-items: center; }
.v3-app .v3-qb-detail-flag-yes {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal-800);
}
.v3-app .v3-qb-detail-flag-yes svg { width: 14px; height: 14px; }
.v3-app .v3-qb-detail-flag-no { font-size: 13px; color: var(--ink-4); }

/* Action buttons — icon + text inline */
.v3-app .v3-qb-detail-actions {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
}
.v3-app .v3-qb-detail-actions .v3-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.v3-app .v3-qb-detail-actions .v3-btn svg { width: 14px; height: 14px; }

/* ── Schedules table ───────────────────────────────────────── */
.v3-app .v3-qb-sched-table {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
/* Single grid definition shared by header + every data row.
   minmax(0, Xfr) prevents the Name col from overflowing its track.
   The delete column is fixed at 52px — exactly one 30px icon button
   centred with 11px padding each side. */
.v3-app .v3-qb-sched-table .row {
    display: grid;
    grid-template-columns:
        minmax(0,2.2fr)   /* Name      */
        minmax(0,.85fr)   /* Format    */
        minmax(0,1fr)     /* Frequency */
        minmax(0,1.3fr)   /* Next Run  */
        minmax(0,1.3fr)   /* Last Run  */
        minmax(0,.9fr)    /* Status    */
        minmax(0,.85fr)   /* Active    */
        52px;             /* Delete    */
    border-bottom: 1px solid var(--line-soft);
    align-items: center;  /* vertically centre every cell in the row */
}
.v3-app .v3-qb-sched-table .row:last-child { border-bottom: none; }

/* Header row */
.v3-app .v3-qb-sched-table .row.head {
    font: 700 11px/1 var(--sans);
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-4);
    background: color-mix(in oklab, var(--teal-800) 4%, var(--bg));
    border-bottom: 1px solid var(--line);
    min-height: 38px;
}
/* Data rows */
.v3-app .v3-qb-sched-table .row:not(.head) {
    background: var(--surface);
    min-height: 50px;
    transition: background .12s;
}
.v3-app .v3-qb-sched-table .row:not(.head):hover {
    background: color-mix(in oklab, var(--teal-800) 4%, var(--surface));
}

/* Base cell — uniform padding & text-overflow on every column */
.v3-app .v3-qb-sched-table .col {
    padding: 11px 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.4;
}
/* Name — semi-bold so it stands out */
.v3-app .v3-qb-sched-table .col.nm { font-weight: 600; }
/* Status + Active columns need flex so badge/toggle is centred, not top-aligned */
.v3-app .v3-qb-sched-table .col.sm {
    display: flex;
    align-items: center;
    overflow: visible;   /* badges / toggles must not be clipped */
    white-space: normal;
}
/* Delete column: centred icon, no extra padding competing with neighbours */
.v3-app .v3-qb-sched-table .col.acts {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.v3-app .v3-qb-sched-table .col.acts .v3-btn-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: background .12s, color .12s;
}
.v3-app .v3-qb-sched-table .col.acts .v3-btn-icon:hover {
    background: #fff1f0;
    color: var(--red);
}
.v3-app .v3-qb-sched-table .col.acts .v3-btn-icon svg { width: 14px; height: 14px; }

/* ── Saved files table ─────────────────────────────────────── */
.v3-app .v3-qb-file-table {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
/* Single grid definition — minmax(0,…) stops File Name overflowing its track.
   Actions column is fixed at 80px: 2×30px buttons + 6px gap + 14px right padding. */
.v3-app .v3-qb-file-table .row {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,.18fr) minmax(0,.15fr) 80px;
    border-bottom: 1px solid var(--line-soft);
    align-items: center;
}
.v3-app .v3-qb-file-table .row:last-child { border-bottom: none; }

/* Header row */
.v3-app .v3-qb-file-table .row.head {
    font: 700 11px/1 var(--sans);
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-4);
    background: color-mix(in oklab, var(--teal-800) 4%, var(--bg));
    border-bottom: 1px solid var(--line);
    min-height: 38px;
}
/* Data rows */
.v3-app .v3-qb-file-table .row:not(.head) {
    background: var(--surface);
    min-height: 50px;
    transition: background .12s;
}
.v3-app .v3-qb-file-table .row:not(.head):hover {
    background: color-mix(in oklab, var(--teal-800) 4%, var(--surface));
}
/* Base cell — uniform padding and text-overflow on every column */
.v3-app .v3-qb-file-table .col {
    padding: 11px 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.4;
}
/* Type column: flex so the badge sits centred, not top-aligned */
.v3-app .v3-qb-file-table .col.sm {
    display: flex;
    align-items: center;
    overflow: visible;
}
/* Actions column: two ghost icon buttons right-aligned, no extra padding fighting neighbours */
.v3-app .v3-qb-file-table .col.acts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 0 10px 0 0;
}
/* Ghost icon button reset — strips the inherited .v3-btn border that was causing the boxes */
.v3-app .v3-qb-file-table .col.acts .v3-btn-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: background .12s, color .12s;
}
/* Download — teal hover */
.v3-app .v3-qb-file-table .col.acts .v3-btn-icon:first-child:hover {
    background: var(--teal-50);
    color: var(--teal-800);
}
/* Delete — red hover */
.v3-app .v3-qb-file-table .col.acts .v3-btn-icon:last-child:hover {
    background: #fff1f0;
    color: var(--red);
}
.v3-app .v3-qb-file-table .col.acts .v3-btn-icon svg { width: 14px; height: 14px; }

/* ── Status badges ─────────────────────────────────────────── */
.v3-app .v3-badge-green {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font: 700 11px/1 var(--sans);
    letter-spacing: .3px;
    background: var(--green);
    color: #fff;
}
.v3-app .v3-badge-red {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font: 700 11px/1 var(--sans);
    letter-spacing: .3px;
    background: var(--red);
    color: #fff;
}

/* ── Active/inactive toggle ────────────────────────────────── */
.v3-app .v3-qb-toggle {
    padding: 3px 10px;
    border-radius: 99px;
    font: 700 11px/1.4 var(--sans);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.v3-app .v3-qb-toggle.on  { background: var(--green); color: #fff; border-color: var(--green); }
.v3-app .v3-qb-toggle.off { background: var(--bg); color: var(--ink-3); border-color: var(--line); }

/* ── Dark-mode ─────────────────────────────────────────────── */
.v3-app[data-theme="dark"] .v3-qb-table,
.v3-app[data-theme="dark"] .v3-qb-sched-table,
.v3-app[data-theme="dark"] .v3-qb-file-table { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qb-table .row.head,
.v3-app[data-theme="dark"] .v3-qb-sched-table .row.head,
.v3-app[data-theme="dark"] .v3-qb-file-table .row.head { background: #162228; }
.v3-app[data-theme="dark"] .v3-qb-sched-table .row:not(.head) { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-qb-sched-table .row:not(.head):hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qb-sched-table .col.acts .v3-btn-icon:hover { background: rgba(220,38,38,.18); color: #fca5a5; }
.v3-app[data-theme="dark"] .v3-qb-file-table .row:not(.head) { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-qb-file-table .row:not(.head):hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qb-file-table .col.acts .v3-btn-icon:first-child:hover { background: #1e3340; color: var(--teal-100); }
.v3-app[data-theme="dark"] .v3-qb-file-table .col.acts .v3-btn-icon:last-child:hover { background: rgba(220,38,38,.18); color: #fca5a5; }
.v3-app[data-theme="dark"] .v3-qb-table .row:not(.head) { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-qb-table .row:not(.head):hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qb-table .row.selected { background: #1e3848; box-shadow: inset 3px 0 0 var(--teal-100); }
.v3-app[data-theme="dark"] .v3-qb-table .col.acts .v3-btn-icon:hover { background: #1e3340; color: var(--teal-100); }
.v3-app[data-theme="dark"] .v3-qb-menu { background: #1c2e35; border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qb-menu-item:hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qb-detail { border-color: var(--line); background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-qb-detail-head { background: #162228; }
.v3-app[data-theme="dark"] .v3-qb-section { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qb-section-head { background: #162228; border-bottom-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qb-section-head:hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qb-toggle.off { background: #1c2e35; border-color: var(--line); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    /* Hide Created By + Created On (cols 2 & 3), keep Name + Last Modified + actions */
    .v3-app .v3-qb-table .row { grid-template-columns: minmax(0,2.6fr) minmax(0,1.3fr) 120px; }
    .v3-app .v3-qb-table .row > div:nth-child(2),
    .v3-app .v3-qb-table .row > div:nth-child(3) { display: none; }
    /* Detail drawer narrows on medium screens */
    .v3-app .v3-qb-detail { width: 300px; }
}
@media (max-width: 680px) {
    /* Very narrow — hide Last Modified too, keep only Name + actions */
    .v3-app .v3-qb-table .row { grid-template-columns: 1fr 120px; }
    .v3-app .v3-qb-table .row > div:nth-child(4) { display: none; }
    .v3-app .v3-qb-detail { width: 100%; right: 0; left: 0; }
}
/* Schedules table: at ≤1024px hide Next/Last Run + Status; at ≤640px hide Frequency too */
@media (max-width: 1024px) {
    .v3-app .v3-qb-sched-table .row {
        grid-template-columns: minmax(0,2.5fr) minmax(0,1fr) minmax(0,1fr) minmax(0,.9fr) 52px;
    }
    /* Hide Next Run (col 4), Last Run (col 5), Status (col 6) */
    .v3-app .v3-qb-sched-table .row > div:nth-child(4),
    .v3-app .v3-qb-sched-table .row > div:nth-child(5),
    .v3-app .v3-qb-sched-table .row > div:nth-child(6) { display: none; }
}
@media (max-width: 640px) {
    .v3-app .v3-qb-sched-table .row {
        grid-template-columns: minmax(0,2fr) minmax(0,1fr) 52px;
    }
    /* Also hide Frequency (col 3) */
    .v3-app .v3-qb-sched-table .row > div:nth-child(3) { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   QUERY BUILDER — EDITOR  (.v3-qe-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── Header ────────────────────────────────────────────────── */
.v3-app .v3-qe-back-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── View tabs ─────────────────────────────────────────────── */
.v3-app .v3-qe-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 20px;
}
.v3-app .v3-qe-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font: 600 13px/1 var(--sans);
    color: var(--ink-3);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s;
}
.v3-app .v3-qe-tab:hover { color: var(--ink); }
.v3-app .v3-qe-tab.active { color: var(--teal-800); border-bottom-color: var(--teal-800); }
.v3-app .v3-qe-results-badge { margin-left: 2px; }

/* ── Editor panel ──────────────────────────────────────────── */
.v3-app .v3-qe-editor { display: flex; flex-direction: column; gap: 16px; }

.v3-app .v3-qe-rules-wrap {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

/* ── Rules table ───────────────────────────────────────────── */
.v3-app .v3-qe-rules { font-size: 13px; }

.v3-app .v3-qe-rule-head,
.v3-app .v3-qe-rule {
    display: grid;
    grid-template-columns: 70px 90px 200px 150px 1fr;
    border-bottom: 1px solid var(--line-soft);
    align-items: center;
    min-height: 42px;
}
.v3-app .v3-qe-rule:last-of-type { border-bottom: none; }

.v3-app .v3-qe-rule-head {
    font: 700 11px/1 var(--sans);
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--ink-4);
    background: var(--bg);
    min-height: 34px;
}

.v3-app .v3-qe-rule { background: var(--surface); }
.v3-app .v3-qe-rule:hover { background: var(--teal-50); }

/* Column cells */
.v3-app .v3-qe-rule > div,
.v3-app .v3-qe-rule-head > div {
    padding: 6px 10px;
    min-width: 0;
}
.v3-app .qe-c-act {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px !important;
}
/* Strip the inherited .v3-btn border from icon buttons inside the actions cell */
.v3-app .qe-c-act .v3-btn-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.v3-app .qe-c-act .v3-btn-icon svg { width: 13px; height: 13px; }
/* Add clause button — teal on hover */
.v3-app .qe-c-act .v3-btn-icon:first-child {
    color: var(--ink-3);
}
.v3-app .qe-c-act .v3-btn-icon:first-child:hover {
    background: var(--teal-50);
    color: var(--teal-800);
}
/* Delete button — red on hover */
.v3-app .qe-c-act .v3-btn-icon:last-child {
    color: var(--ink-3);
}
.v3-app .qe-c-act .v3-btn-icon:last-child:hover {
    background: #fff1f0;
    color: var(--red);
}
/* Dark mode */
.v3-app[data-theme="dark"] .qe-c-act .v3-btn-icon:first-child:hover {
    background: #1e3340;
    color: var(--teal-100);
}
.v3-app[data-theme="dark"] .qe-c-act .v3-btn-icon:last-child:hover {
    background: rgba(220,38,38,.18);
    color: #fca5a5;
}

/* Hierarchy indentation */
.v3-app .v3-qe-indent-1 { background: color-mix(in srgb, var(--teal-50) 40%, var(--surface)); }
.v3-app .v3-qe-indent-1 .qe-c-field  { padding-left: 26px !important; }
.v3-app .v3-qe-indent-2 { background: color-mix(in srgb, var(--teal-100) 40%, var(--surface)); }
.v3-app .v3-qe-indent-2 .qe-c-field  { padding-left: 44px !important; }

/* Range input pair */
.v3-app .v3-qe-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.v3-app .v3-qe-range .v3-input { flex: 1; min-width: 0; }
.v3-app .v3-qe-range-sep { font-size: 13px; color: var(--ink-4); flex-shrink: 0; }

/* ── Rules footer ──────────────────────────────────────────── */
.v3-app .v3-qe-rules-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--line-soft);
    background: var(--bg);
}

/* ── Post-run hint ─────────────────────────────────────────── */
.v3-app .v3-qe-run-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: 13px;
    color: var(--ink-2);
    background: var(--surface);
}

/* ── Results panel ─────────────────────────────────────────── */
.v3-app .v3-qe-results { display: flex; flex-direction: column; gap: 12px; }

.v3-app .v3-qe-res-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.v3-app .v3-qe-res-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    white-space: nowrap;
}
.v3-app .v3-qe-res-table th {
    padding: 8px 12px;
    font: 700 11px/1 var(--sans);
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--ink-4);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    text-align: left;
    white-space: nowrap;
}
.v3-app .v3-qe-res-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v3-app .v3-qe-res-table tr:last-child td { border-bottom: none; }
.v3-app .v3-qe-res-table tr:hover td { background: var(--teal-50); }
.v3-app .v3-qe-th-id,
.v3-app .v3-qe-td-id  { width: 80px; }
.v3-app .v3-qe-th-dn,
.v3-app .v3-qe-td-dn  { min-width: 220px; }
.v3-app .v3-qe-th-act { width: 56px; text-align: center; }
/* Display Name hyperlink — teal, semi-bold, underline on hover */
.v3-app .v3-qe-dn-link {
    color: var(--teal-800);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.v3-app .v3-qe-dn-link:hover {
    text-decoration: underline;
    color: var(--teal-900);
}
.v3-app .v3-qe-res-table .mono { font-family: var(--mono); font-size: 12px; }

/* ── Results footer / paging ───────────────────────────────── */
.v3-app .v3-qe-res-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-3);
}

/* ── Dark-mode ─────────────────────────────────────────────── */
.v3-app[data-theme="dark"] .v3-qe-rules-wrap { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qe-rule-head  { background: #1a2a2e; }
.v3-app[data-theme="dark"] .v3-qe-rule       { background: #162228; }
.v3-app[data-theme="dark"] .v3-qe-rule:hover { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qe-indent-1   { background: #1a2e36; }
.v3-app[data-theme="dark"] .v3-qe-indent-2   { background: #1c3240; }
.v3-app[data-theme="dark"] .v3-qe-rules-foot { background: #1a2a2e; border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qe-res-wrap   { border-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qe-res-table th { background: #1a2a2e; border-bottom-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qe-res-table td { border-bottom-color: var(--line); }
.v3-app[data-theme="dark"] .v3-qe-res-table tr:hover td { background: #1e3340; }
.v3-app[data-theme="dark"] .v3-qe-run-hint { background: #162228; border-color: var(--line); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .v3-app .v3-qe-rule-head,
    .v3-app .v3-qe-rule {
        grid-template-columns: 60px 80px 160px 120px 1fr;
    }
}
@media (max-width: 640px) {
    .v3-app .v3-qe-rule-head,
    .v3-app .v3-qe-rule {
        grid-template-columns: 56px 1fr 1fr 1fr;
    }
    .v3-app .v3-qe-rule-head > .qe-c-lo,
    .v3-app .v3-qe-rule > .qe-c-lo { display: none; }
}


/* ══════════════════════════════════════════════════════════════
   AI SYSTEM BUILDER  (.v3-sb-*)
   ══════════════════════════════════════════════════════════════ */

/* Root */
.v3-app .v3-sb-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    outline: none;
}

/* Header */
.v3-app .v3-sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
    gap: 12px;
}
.v3-app .v3-sb-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 600 15px/1 var(--sans);
    color: var(--ink);
}
.v3-app .v3-sb-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Body */
.v3-app .v3-sb-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Left panel */
.v3-app .v3-sb-left {
    width: 240px;
    min-width: 200px;
    max-width: 300px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.v3-app .v3-sb-section { border-bottom: 1px solid var(--line-soft); }
.v3-app .v3-sb-section-hdr {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font: 600 11px/1 var(--sans);
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: .04em;
    user-select: none;
    background: var(--bg);
}
.v3-app .v3-sb-section-hdr:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-app .v3-sb-section-hdr .icon { width: 13px; height: 13px; flex-shrink: 0; }
.v3-app .v3-sb-chevron { display: flex; align-items: center; transition: transform .15s; }
.v3-app .v3-sb-chevron.open { transform: rotate(90deg); }
.v3-app .v3-sb-count {
    margin-left: auto;
    font: 500 11px/1 var(--sans);
    color: var(--ink-4);
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: 99px;
    padding: 1px 6px;
}
.v3-app .v3-sb-section-body { padding: 8px; }

.v3-app .v3-sb-template-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    background: var(--bg);
}
.v3-app .v3-sb-template-card:hover { border-color: var(--teal-700); background: var(--teal-50); }
.v3-app .v3-sb-template-info { flex: 1; min-width: 0; }
.v3-app .v3-sb-template-name { display: block; font: 600 12px/1.3 var(--sans); color: var(--ink); }
.v3-app .v3-sb-template-cat  { display: block; font: 400 11px/1.3 var(--sans); color: var(--ink-4); margin-top: 2px; }

.v3-app .v3-sb-template-error {
    padding: 16px;
    text-align: center;
    color: var(--red);
    font: 12px/1.4 var(--sans);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.v3-app .v3-sb-type-list { display: flex; flex-direction: column; gap: 4px; }
.v3-app .v3-sb-type-btn {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    background: var(--bg);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.v3-app .v3-sb-type-btn:hover { background: var(--teal-50); border-color: var(--teal-700); }
.v3-app .v3-sb-type-btn.valid { border-color: var(--green); background: #f0fff4; }
.v3-app .v3-sb-type-btn.invalid { opacity: .5; }
.v3-app .v3-sb-type-btn.disabled { opacity: .45; pointer-events: none; }
.v3-app .v3-sb-type-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 2px; }
.v3-app .v3-sb-type-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v3-app .v3-sb-type-name  { font: 600 12px/1.2 var(--sans); color: var(--ink); }
.v3-app .v3-sb-type-desc  { font: 400 11px/1.3 var(--sans); color: var(--ink-4); }
.v3-app .v3-sb-type-level { font: 400 10px/1 var(--sans); color: var(--ink-4); }
.v3-app .v3-sb-type-hint.valid   { color: var(--green); font-size: 10px; }
.v3-app .v3-sb-type-hint.invalid { color: var(--red); font-size: 10px; }

.v3-app .v3-sb-elem-list { display: flex; flex-direction: column; gap: 3px; }
.v3-app .v3-sb-elem-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 7px;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    cursor: pointer;
    background: var(--bg);
    transition: background .12s;
}
.v3-app .v3-sb-elem-item:hover { background: var(--teal-50); border-color: var(--teal-100); }
.v3-app .v3-sb-elem-item.selected { background: var(--teal-50); border-color: var(--teal-700); }
.v3-app .v3-sb-elem-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.v3-app .v3-sb-elem-info { flex: 1; min-width: 0; }
.v3-app .v3-sb-elem-name { display: block; font: 600 12px/1.2 var(--sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-app .v3-sb-elem-type { display: block; font: 400 10px/1.2 var(--sans); color: var(--ink-4); }
.v3-app .v3-sb-elem-del {
    border: none; background: transparent; color: var(--ink-4);
    width: 22px; height: 22px; flex-shrink: 0;
    border-radius: var(--r-sm); padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .12s;
}
.v3-app .v3-sb-elem-item:hover .v3-sb-elem-del { opacity: 1; }
.v3-app .v3-sb-elem-del:hover { background: #fff1f0; color: var(--red); }

/* Center panel */
.v3-app .v3-sb-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.v3-app .v3-sb-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.v3-app .v3-sb-toolbar-group { display: flex; align-items: center; gap: 2px; }
.v3-app .v3-sb-toolbar-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.v3-app .v3-sb-toolbar .v3-btn-icon {
    width: 28px; height: 28px;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--ink-3);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
    padding: 0;
}
.v3-app .v3-sb-toolbar .v3-btn-icon:hover { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-700); }
.v3-app .v3-sb-toolbar .v3-btn-icon.active { background: var(--teal-100); color: var(--teal-800); border-color: var(--teal-700); }
.v3-app .v3-sb-toolbar .v3-btn-icon:disabled { opacity: .4; pointer-events: none; }
.v3-app .v3-sb-layout-select { width: 120px; }
.v3-app .v3-sb-layout-select .v3-input { padding: 3px 24px 3px 8px; font-size: 12px; height: 28px; }
.v3-app .v3-sb-canvas { flex: 1; overflow: hidden; position: relative; }

/* Right panel */
.v3-app .v3-sb-right {
    width: 280px;
    min-width: 240px;
    max-width: 340px;
    border-left: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
.v3-app .v3-sb-tabs { display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.v3-app .v3-sb-tab {
    flex: 1;
    padding: 9px 8px;
    font: 500 12px/1 var(--sans);
    color: var(--ink-3);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: color .12s, border-color .12s;
}
.v3-app .v3-sb-tab:hover { color: var(--teal-800); }
.v3-app .v3-sb-tab.active { color: var(--teal-800); border-bottom-color: var(--teal-700); font-weight: 600; }
.v3-app .v3-sb-tab .icon { width: 13px; height: 13px; }
.v3-app .v3-sb-tab-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }

/* Properties */
.v3-app .v3-sb-props-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    font: 600 12px/1 var(--sans);
    color: var(--ink-2);
    flex-shrink: 0;
}
.v3-app .v3-sb-props-header .v3-btn-icon {
    border: none; background: transparent; padding: 4px; cursor: pointer; color: var(--teal-800);
    border-radius: var(--r-sm); display: inline-flex; align-items: center;
}
.v3-app .v3-sb-props-container { flex: 1; overflow-y: auto; }
.v3-app .v3-sb-unsaved {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    font: 11px/1.3 var(--sans);
    color: var(--amber);
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
}
.v3-app .v3-sb-unsaved .icon { width: 12px; height: 12px; }
.v3-app .v3-sb-props-table { width: 100%; border-collapse: collapse; font: 12px/1.4 var(--sans); }
.v3-app .v3-sb-props-table th {
    text-align: left;
    padding: 6px 10px;
    font: 600 10px/1 var(--sans);
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--bg);
    border-bottom: 1px solid var(--line-soft);
}
.v3-app .v3-sb-props-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
.v3-app .v3-sb-prop-key { color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.v3-app .v3-sb-builtin  { color: var(--ink-4); font-size: 10px; margin-left: 4px; }
.v3-app .v3-sb-prop-val { color: var(--ink); }
.v3-app .v3-sb-prop-display {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 4px;
    cursor: pointer; padding: 2px 4px; border-radius: var(--r-sm);
    min-height: 22px; word-break: break-word;
}
.v3-app .v3-sb-prop-display:hover { background: var(--teal-50); }
.v3-app .v3-sb-prop-display.empty { color: var(--ink-4); font-style: italic; }
.v3-app .v3-sb-prop-del {
    border: none; background: transparent; color: var(--ink-4);
    width: 18px; height: 18px; flex-shrink: 0;
    border-radius: var(--r-sm); padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .12s;
}
.v3-app .v3-sb-prop-display:hover .v3-sb-prop-del { opacity: 1; }
.v3-app .v3-sb-prop-del:hover { background: #fff1f0; color: var(--red); }
.v3-app .v3-sb-prop-readonly { color: var(--ink-4); display: flex; align-items: center; gap: 6px; padding: 2px 4px; }
.v3-app .v3-sb-prop-input,
.v3-app .v3-sb-prop-textarea {
    width: 100%; padding: 3px 6px;
    font: 12px/1.4 var(--sans);
    border: 1px solid var(--teal-700);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--ink);
    outline: none;
    resize: vertical;
}
.v3-app .v3-sb-prop-input:focus,
.v3-app .v3-sb-prop-textarea:focus { border-color: var(--teal-800); box-shadow: 0 0 0 2px var(--teal-50); }
.v3-app .v3-sb-newprop-row td { background: var(--teal-50); }

/* Chat panel */
.v3-app .v3-sb-chat-tab { overflow: hidden; }
.v3-app .v3-sb-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    flex-shrink: 0;
}
.v3-app .v3-sb-chat-title {
    display: flex; align-items: center; gap: 6px;
    font: 600 12px/1 var(--sans); color: var(--ink-2);
}
.v3-app .v3-sb-chat-title .icon { width: 13px; height: 13px; color: var(--teal-800); }
.v3-app .v3-sb-bp-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font: 500 10px/1 var(--sans); color: var(--teal-800);
    background: var(--teal-50); border: 1px solid var(--teal-100);
    border-radius: 99px; padding: 2px 7px;
}
.v3-app .v3-sb-chat-actions { display: flex; align-items: center; gap: 4px; }
.v3-app .v3-sb-chat-actions .v3-btn-icon {
    border: none; background: transparent; cursor: pointer;
    width: 26px; height: 26px;
    border-radius: var(--r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-3);
    transition: background .12s, color .12s;
}
.v3-app .v3-sb-chat-actions .v3-btn-icon:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-app .v3-sb-chat-actions .v3-btn-icon:disabled { opacity: .4; pointer-events: none; }
.v3-app .v3-sb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.v3-app .v3-sb-chat-welcome { text-align: center; padding: 20px 12px; color: var(--ink-3); }
.v3-app .v3-sb-welcome-icon {
    width: 36px; height: 36px;
    background: var(--teal-50); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px; color: var(--teal-800);
}
.v3-app .v3-sb-chat-welcome h4 { font: 600 13px/1.3 var(--sans); color: var(--ink-2); margin: 0 0 6px; }
.v3-app .v3-sb-chat-welcome p  { font: 12px/1.5 var(--sans); margin: 0 0 8px; }
.v3-app .v3-sb-chat-welcome ul { text-align: left; padding-left: 18px; font: 12px/1.6 var(--sans); margin: 0; }
.v3-app .v3-sb-msg { display: flex; gap: 8px; align-items: flex-start; }
.v3-app .v3-sb-msg.user { flex-direction: row-reverse; }
.v3-app .v3-sb-msg-avatar {
    width: 26px; height: 26px; flex-shrink: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--teal-50); color: var(--teal-800);
}
.v3-app .v3-sb-msg.user .v3-sb-msg-avatar { background: #e8f0fe; color: #1a73e8; }
.v3-app .v3-sb-msg-avatar .icon { width: 12px; height: 12px; }
.v3-app .v3-sb-msg-body { flex: 1; min-width: 0; }
.v3-app .v3-sb-msg-text {
    padding: 7px 10px;
    border-radius: var(--r-md);
    font: 12px/1.5 var(--sans);
    background: var(--bg);
    border: 1px solid var(--line-soft);
    color: var(--ink);
    word-break: break-word;
    position: relative;
}
.v3-app .v3-sb-msg.user .v3-sb-msg-text { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.v3-app .v3-sb-msg-time {
    font: 10px/1 var(--sans); color: var(--ink-4);
    margin-top: 3px; display: flex; align-items: center; gap: 4px;
}
.v3-app .v3-sb-msg.user .v3-sb-msg-time { justify-content: flex-end; }
.v3-app .v3-sb-msg-duration { color: var(--ink-4); font-size: 10px; }
.v3-app .v3-sb-msg-copy { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity .12s; }
.v3-app .v3-sb-msg-text:hover .v3-sb-msg-copy { opacity: 1; }
.v3-app .v3-sb-msg-copy .v3-btn-icon {
    border: none; background: var(--bg); color: var(--ink-3);
    width: 20px; height: 20px; border-radius: var(--r-sm);
    cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.v3-app .v3-sb-msg-file { margin-bottom: 6px; }
.v3-app .v3-sb-msg-img img { max-width: 100%; border-radius: var(--r-sm); }
.v3-app .v3-sb-msg-doc {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; background: var(--bg);
    border: 1px solid var(--line-soft); border-radius: var(--r-sm);
    font: 11px/1 var(--sans); color: var(--ink-3);
}
.v3-app .v3-sb-typing {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--bg); border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
}
.v3-app .v3-sb-typing-dots { display: flex; gap: 3px; }
.v3-app .v3-sb-typing-dots span {
    width: 6px; height: 6px;
    background: var(--ink-4); border-radius: 50%;
    animation: v3SbTypingBounce 1s infinite;
}
.v3-app .v3-sb-typing-dots span:nth-child(2) { animation-delay: .15s; }
.v3-app .v3-sb-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes v3SbTypingBounce {
    0%,80%,100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}
.v3-app .v3-sb-typing-timer { font: 11px/1 var(--sans); color: var(--ink-4); }
.v3-app .v3-sb-chat-input-area {
    border-top: 1px solid var(--line-soft);
    padding: 8px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface);
}
.v3-app .v3-sb-file-preview {
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    padding: 6px 8px;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg);
}
.v3-app .v3-sb-file-img img { max-height: 80px; border-radius: var(--r-sm); }
.v3-app .v3-sb-file-doc { font: 12px/1.3 var(--sans); color: var(--ink-3); }
.v3-app .v3-sb-file-name { display: block; font-weight: 600; color: var(--ink); font-size: 12px; }
.v3-app .v3-sb-file-size { display: block; color: var(--ink-4); font-size: 11px; }
.v3-app .v3-sb-file-rm {
    border: none; background: transparent; color: var(--ink-4); cursor: pointer;
    width: 20px; height: 20px; border-radius: var(--r-sm); padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto;
}
.v3-app .v3-sb-file-rm:hover { background: #fff1f0; color: var(--red); }
.v3-app .v3-sb-sel-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.v3-app .v3-sb-badge-rm {
    border: none; background: transparent; cursor: pointer;
    width: 14px; height: 14px; border-radius: 2px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; color: inherit; vertical-align: middle; margin-left: 2px;
}
.v3-app .v3-sb-chat-input-wrap { display: flex; align-items: flex-end; gap: 6px; }
.v3-app .v3-sb-chat-textarea {
    flex: 1;
    min-height: 36px;
    max-height: 120px;
    padding: 7px 10px;
    font: 12px/1.5 var(--sans);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg);
    color: var(--ink);
    resize: none;
    outline: none;
    overflow-y: auto;
}
.v3-app .v3-sb-chat-textarea:focus { border-color: var(--teal-700); box-shadow: 0 0 0 2px var(--teal-50); }
.v3-app .v3-sb-chat-textarea:disabled { opacity: .5; }
.v3-app .v3-sb-chat-btns { display: flex; align-items: flex-end; gap: 4px; }
.v3-app .v3-sb-chat-btns .v3-btn-icon {
    border: 1px solid var(--line); background: var(--bg); color: var(--ink-3);
    width: 32px; height: 32px; border-radius: var(--r-md);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; transition: background .12s, color .12s;
}
.v3-app .v3-sb-chat-btns .v3-btn-icon:hover { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-700); }
.v3-app .v3-sb-chat-btns .v3-btn-icon:disabled { opacity: .4; pointer-events: none; }
.v3-app .v3-sb-chat-error {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px;
    background: #fff1f0; border: 1px solid #fecaca;
    border-radius: var(--r-sm);
    font: 11px/1.3 var(--sans); color: var(--red);
}

/* Template grid in modal */
.v3-app .v3-sb-tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 4px;
}
.v3-app .v3-sb-tpl-card {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px;
    cursor: pointer;
    background: var(--bg);
    transition: border-color .15s, background .15s;
}
.v3-app .v3-sb-tpl-card:hover { border-color: var(--teal-700); background: var(--teal-50); }
.v3-app .v3-sb-tpl-card.active { border-color: var(--teal-800); background: var(--teal-50); }
.v3-app .v3-sb-tpl-card-hdr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.v3-app .v3-sb-tpl-card-name { font: 600 13px/1.3 var(--sans); color: var(--ink); }
.v3-app .v3-sb-tpl-card-desc { font: 12px/1.4 var(--sans); color: var(--ink-3); margin: 0 0 8px; }
.v3-app .v3-sb-tpl-card-meta { display: flex; align-items: center; gap: 8px; }
.v3-app .v3-sb-tpl-card-types { font: 11px/1 var(--sans); color: var(--ink-4); }

/* Best practices info in modal */
.v3-app .v3-sb-bp-info {
    display: flex; gap: 10px;
    padding: 12px; border-radius: var(--r-md);
    background: #f0fff4; border: 1px solid #bbf7d0;
    color: var(--ink-2); font: 12px/1.5 var(--sans);
}
.v3-app .v3-sb-bp-info.inactive { background: var(--bg); border-color: var(--line-soft); }
.v3-app .v3-sb-bp-info strong { display: block; margin-bottom: 4px; font-weight: 600; }
.v3-app .v3-sb-bp-info p { margin: 0; }
.v3-app .v3-sb-bp-info .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--green); }
.v3-app .v3-sb-bp-info.inactive .icon { color: var(--ink-4); }

/* Full-height override — applied only when the AI System Builder is on screen.
   :has() is supported in all modern browsers (Chrome 105+, Firefox 121+, Safari 15.4+).
   This removes the standard page padding and makes .v3-content a flex child that
   stretches to fill the remaining viewport height below the topbar. */
.v3-app .v3-main:has(.v3-sb-root) {
    overflow: hidden;
}
.v3-app .v3-content:has(.v3-sb-root) {
    flex: 1;
    min-height: 0;
    padding: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* ========================================================================
   V3 Configurator AI Copilot (V3ConfigChat) — lives inside the right rail's
   AI tab. All rules prefixed .v3-chat- to avoid collision with other V3
   features. Uses the design tokens declared at the top of this file.
   ======================================================================== */
.v3-chat-root {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

.v3-chat-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--teal-50);
}
.v3-chat-h-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--teal-800);
    font-weight: 600;
    font-size: 13px;
}
.v3-chat-h-spacer { flex: 1; }
.v3-chat-model {
    height: 28px;
    padding: 0 8px;
    font-size: 12.5px;
    width: auto;
    min-width: 90px;
}

.v3-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg);
}

.v3-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--ink-3);
    padding: 24px 16px;
    gap: 8px;
}
.v3-chat-empty h4 {
    margin: 0;
    color: var(--teal-800);
    font-size: 14px;
}
.v3-chat-empty p {
    margin: 0;
    font-size: 12.5px;
    max-width: 320px;
}

.v3-chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.v3-chat-msg.user { flex-direction: row-reverse; }

.v3-chat-avatar {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--teal-100);
    color: var(--teal-800);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}
.v3-chat-msg.user .v3-chat-avatar {
    background: var(--teal-800);
    color: #fff;
}
.v3-chat-avatar-u { line-height: 1; }

.v3-chat-bubble {
    max-width: 82%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 8px 10px;
    font-size: 13px;
    color: var(--ink);
    word-break: break-word;
}
.v3-chat-msg.user .v3-chat-bubble {
    background: var(--teal-800);
    color: #fff;
    border-color: var(--teal-800);
}
.v3-chat-msg.user .v3-chat-bubble .v3-chat-meta { color: rgba(255,255,255,0.7); }

.v3-chat-text { white-space: pre-wrap; }
.v3-chat-text.md p { margin: 0 0 6px; }
.v3-chat-text.md p:last-child { margin-bottom: 0; }
.v3-chat-text.md ul,
.v3-chat-text.md ol { margin: 4px 0 4px 20px; padding: 0; }
.v3-chat-text.md code {
    background: var(--line-soft);
    color: var(--teal-800);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12px;
}
.v3-chat-text.md pre {
    background: var(--teal-50);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 12px;
    margin: 6px 0;
}

.v3-chat-meta {
    margin-top: 4px;
    color: var(--ink-4);
    font-size: 11px;
    display: flex;
    gap: 6px;
    align-items: center;
}
.v3-chat-meta-dot { opacity: 0.6; }

.v3-chat-imgPreview {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border-radius: var(--r-sm);
    margin-bottom: 6px;
    border: 1px solid var(--line);
}

.v3-chat-fileChip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--teal-50);
    color: var(--teal-800);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    margin-bottom: 6px;
    max-width: 100%;
}
.v3-chat-fileChip .n {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.v3-chat-fileChip .t {
    background: var(--teal-800);
    color: #fff;
    border-radius: 4px;
    font-size: 10px;
    padding: 0 5px;
    font-weight: 600;
}

.v3-chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ink-3);
    font-size: 12px;
}
.v3-chat-typing > span:not(.elapsed) {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-4);
    animation: v3ChatBlink 1.2s infinite ease-in-out;
}
.v3-chat-typing > span:nth-child(2) { animation-delay: 0.15s; }
.v3-chat-typing > span:nth-child(3) { animation-delay: 0.3s; }
.v3-chat-typing .elapsed { margin-left: 6px; font-size: 11px; color: var(--ink-4); }
@keyframes v3ChatBlink {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.v3-chat-proposal {
    align-self: stretch;
    border: 1px solid var(--amber);
    background: var(--amber-50);
    border-radius: var(--r-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.v3-chat-proposal-h {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--teal-800);
    font-size: 12.5px;
}
.v3-chat-proposal-h .count {
    margin-left: auto;
    background: var(--teal-800);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
}
.v3-chat-proposal-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 6px 8px;
    max-height: 180px;
    overflow-y: auto;
}
.v3-chat-proposal-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
}
.v3-chat-proposal-row .grp { color: var(--ink-3); }
.v3-chat-proposal-row .sep { color: var(--ink-4); }
.v3-chat-proposal-row .fld { color: var(--ink); font-weight: 500; }
.v3-chat-proposal-row .arrow { color: var(--ink-4); }
.v3-chat-proposal-row .val { color: var(--teal-800); font-weight: 600; }
.v3-chat-proposal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.v3-chat-staged {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-top: 1px solid var(--line);
    background: var(--teal-50);
}
.v3-chat-staged-img {
    max-height: 56px;
    max-width: 120px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
}
.v3-chat-staged > .v3-btn { margin-left: auto; }

.v3-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.v3-chat-input {
    flex: 1;
    min-height: 36px;
    max-height: 140px;
    resize: none;
    overflow-y: auto;
    padding: 8px 10px;
    line-height: 1.4;
}
.v3-chat-input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.v3-chat-input-actions label.v3-btn {
    cursor: pointer;
    margin: 0;
}

/* ============================================================
   V3 Knowledge Base
   Used by:
     /v3/{co}/knowledge-base           (KnowledgeBase.razor)
     /v3/{co}/knowledge-base/{slug}    (KbArticle.razor)
   The hero strip on the landing page reuses .hs-hero from the
   Help & Support styles above; the rules below cover the
   category rail, article cards, prose typography, and TOC.
   ============================================================ */

.v3-kb-layout { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: flex-start; margin-top: 8px; }
@media (max-width: 900px) { .v3-kb-layout { grid-template-columns: 1fr; } }

/* ----- Category rail ----- */
.v3-kb-rail { position: sticky; top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
@media (max-width: 900px) { .v3-kb-rail { position: static; } }
.v3-kb-rail-head { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 4px 8px 8px; }
.v3-kb-rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.v3-kb-rail-list button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
    background: transparent; border: 0; border-radius: var(--r-sm);
    color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.v3-kb-rail-list button:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-kb-rail-list button.on { background: var(--teal-100); color: var(--teal-800); font-weight: 600; }
.v3-kb-rail-list button .num { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--bg); border-radius: 999px; padding: 1px 8px; }
.v3-kb-rail-list button.on .num { background: color-mix(in oklab, var(--teal-800) 16%, var(--surface)); color: var(--teal-800); }

/* ----- Results pane ----- */
.v3-kb-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.v3-kb-results-head h2 { font-size: 18px; font-weight: 600; color: var(--ink); margin: 0; }
.v3-kb-results-head .sub { font-size: 12px; color: var(--ink-3); margin: 2px 0 0; }
.v3-kb-results-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ----- Create-article modal ----- */
.v3-kb-create { display: flex; flex-direction: column; gap: 16px; }
.v3-kb-create-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); align-self: flex-start; }
.v3-kb-create-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: transparent; border: 0; border-radius: calc(var(--r-md) - 3px); cursor: pointer; }
.v3-kb-create-tabs button.on { background: var(--surface); color: var(--teal-800); box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
.v3-kb-create-tabs button .icon { width: 16px; height: 16px; }
.v3-kb-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.v3-kb-create-full { grid-column: 1 / -1; }
.v3-kb-create-body { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; min-height: 220px; }
.v3-kb-create-publish { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.v3-kb-create-hint { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }
.v3-kb-create-filepicker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.v3-kb-create-filepicker > label { cursor: pointer; position: relative; }
.v3-kb-create-filepicker > label .icon { width: 14px; height: 14px; }
.v3-kb-create-fileinput { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; opacity: 0; }
.v3-kb-create-filehint { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); max-width: 100%; }
.v3-kb-create-filehint .icon { width: 14px; height: 14px; color: var(--amber); flex: none; }
.v3-kb-create-filehint .name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.v3-kb-create-filehint .size { color: var(--ink-3); flex: none; }
.v3-kb-create-fileclear { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; margin-left: 2px; background: transparent; color: var(--ink-3); border: 0; border-radius: 999px; cursor: pointer; }
.v3-kb-create-fileclear:hover { background: rgba(17,61,79,0.08); color: var(--ink); }
.v3-kb-create-fileclear .icon { width: 12px; height: 12px; }
.v3-kb-create .req { color: var(--red); margin-left: 2px; }
@media (max-width: 720px) {
    .v3-kb-create-grid { grid-template-columns: 1fr; }
}

/* ----- Article grid ----- */
.v3-kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.v3-kb-card {
    display: grid; grid-template-rows: 120px 1fr; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
    text-decoration: none; color: inherit; cursor: pointer;
    transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.v3-kb-card:hover { border-color: color-mix(in oklab, var(--teal-800) 35%, var(--line)); transform: translateY(-2px); box-shadow: 0 6px 16px -10px color-mix(in oklab, var(--teal-800) 40%, transparent); }
.v3-kb-card-thumb { position: relative; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-800); }
.v3-kb-card-thumb.accent-teal   { background: var(--teal-50);  color: var(--teal-800); }
.v3-kb-card-thumb.accent-amber  { background: var(--amber-50); color: var(--amber); }
.v3-kb-card-thumb.accent-green  { background: var(--green-50); color: var(--green); }
.v3-kb-card-thumb.accent-purple { background: color-mix(in oklab, var(--teal-800) 12%, var(--surface)); color: var(--teal-800); }
.v3-kb-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v3-kb-card-thumb .icon { width: 36px; height: 36px; }
.v3-kb-card-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.v3-kb-card-body h3 { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.35; }
.v3-kb-card-body p { font-size: 12.5px; color: var(--ink-3); margin: 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v3-kb-card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.v3-kb-card-meta .cat { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-weight: 500; }
.v3-kb-card-meta .read { display: inline-flex; align-items: center; gap: 4px; }
.v3-kb-card-meta .dot { color: var(--ink-4); }
.v3-kb-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.v3-kb-card-tags .tag { font-size: 10.5px; color: var(--ink-3); background: var(--line-soft); border-radius: 999px; padding: 1px 8px; }

/* ----- Pager ----- */
.v3-kb-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px 0 8px; }
.v3-kb-pager-info { font-size: 12px; color: var(--ink-3); }

/* =========================
   Article detail page
   ========================= */
.v3-kb-article { max-width: 1100px; margin: 0 auto; }
.v3-kb-back { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 0; padding: 4px 8px 4px 0; color: var(--ink-3); cursor: pointer; font-size: 12px; }
.v3-kb-back:hover { color: var(--teal-800); }
.v3-kb-article-head { padding: 8px 0 18px; border-bottom: 1px solid var(--line-soft); margin-bottom: 22px; }
.v3-kb-article-headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v3-kb-article-head h1 { font-size: 30px; font-weight: 700; color: var(--ink); margin: 8px 0 4px; line-height: 1.2; letter-spacing: -0.01em; }
.v3-kb-article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.v3-kb-article-meta .cat { background: var(--teal-50); color: var(--teal-800); border-radius: 999px; padding: 2px 10px; font-weight: 600; font-size: 11px; }
.v3-kb-article-meta .dot { color: var(--ink-4); }
.v3-kb-article-meta .icon { width: 12px; height: 12px; vertical-align: middle; margin-right: 2px; }
.v3-kb-article-lead { font-size: 16px; color: var(--ink-2); margin: 14px 0 0; line-height: 1.55; max-width: 720px; }
.v3-kb-article-cover { width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--r-md); margin-top: 18px; }

.v3-kb-article-layout { display: grid; grid-template-columns: 1fr 240px; gap: 36px; align-items: flex-start; }
@media (max-width: 980px) { .v3-kb-article-layout { grid-template-columns: 1fr; } .v3-kb-article-side { order: -1; } }

/* ----- Markdown prose ----- */
.v3-kb-prose { font-size: 15px; color: var(--ink); line-height: 1.65; }
.v3-kb-prose > * { max-width: 720px; }
.v3-kb-prose h2 { font-size: 22px; font-weight: 600; color: var(--ink); margin: 32px 0 10px; letter-spacing: -0.005em; scroll-margin-top: 80px; }
.v3-kb-prose h3 { font-size: 17px; font-weight: 600; color: var(--ink); margin: 24px 0 8px; scroll-margin-top: 80px; }
.v3-kb-prose h4 { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 20px 0 6px; }
.v3-kb-prose p { margin: 0 0 14px; color: var(--ink-2); }
.v3-kb-prose a { color: var(--teal-800); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--teal-800) 35%, transparent); text-underline-offset: 2px; }
.v3-kb-prose a:hover { text-decoration-color: var(--teal-800); }
.v3-kb-prose ul, .v3-kb-prose ol { margin: 0 0 14px; padding-left: 22px; color: var(--ink-2); }
.v3-kb-prose li { margin: 4px 0; }
.v3-kb-prose code { font-family: var(--mono); font-size: 0.88em; background: var(--line-soft); border-radius: 4px; padding: 1px 5px; color: var(--ink); }
.v3-kb-prose pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; overflow: auto; margin: 0 0 16px; max-width: 720px; }
.v3-kb-prose pre code { background: transparent; padding: 0; font-size: 13px; line-height: 1.5; }
.v3-kb-prose blockquote { margin: 0 0 14px; padding: 8px 16px; border-left: 3px solid var(--teal-100); color: var(--ink-3); background: var(--teal-50); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.v3-kb-prose blockquote p:last-child { margin-bottom: 0; }
.v3-kb-prose img { max-width: 100%; height: auto; border-radius: var(--r-sm); margin: 12px 0; border: 1px solid var(--line-soft); }
.v3-kb-prose table { border-collapse: collapse; margin: 0 0 18px; max-width: 720px; width: 100%; font-size: 13.5px; }
.v3-kb-prose th, .v3-kb-prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.v3-kb-prose th { background: var(--bg); font-weight: 600; color: var(--ink); }
.v3-kb-prose hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ----- PDF-only fallback (legacy article) ----- */
.v3-kb-pdf-only { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 24px; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--r-md); text-align: center; }
.v3-kb-pdf-only .ic { width: 40px; height: 40px; display: grid; place-items: center; background: var(--amber-50); color: var(--amber); border-radius: 999px; }
.v3-kb-pdf-only .ic .icon { width: 22px; height: 22px; }
.v3-kb-pdf-only h3 { font-size: 16px; font-weight: 600; margin: 0; color: var(--ink); }
.v3-kb-pdf-only p { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; max-width: 360px; }

/* ----- Inline PDF viewer (legacy PDF-only article) ----- */
.v3-kb-pdf-embed { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.v3-kb-pdf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.v3-kb-pdf-toolbar .meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v3-kb-pdf-toolbar .ic { width: 32px; height: 32px; display: grid; place-items: center; background: var(--amber-50); color: var(--amber); border-radius: var(--r-sm); flex: none; }
.v3-kb-pdf-toolbar .ic .icon { width: 18px; height: 18px; }
.v3-kb-pdf-toolbar .t { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-kb-pdf-toolbar .s { font-size: 11.5px; color: var(--ink-3); }
.v3-kb-pdf-frame { width: 100%; height: calc(100vh - 280px); min-height: 520px; border: 0; display: block; background: var(--bg); }
@media (max-width: 768px) {
    .v3-kb-pdf-frame { height: 70vh; min-height: 360px; }
}

/* ----- Inline attachment supplement (when Body + PDF both exist) ----- */
.v3-kb-article-attach { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 24px 0 8px; max-width: 720px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); }
.v3-kb-article-attach .ic { width: 32px; height: 32px; display: grid; place-items: center; background: var(--amber-50); color: var(--amber); border-radius: var(--r-sm); flex: none; }
.v3-kb-article-attach .body { flex: 1; min-width: 0; }
.v3-kb-article-attach .body .t { font-size: 13px; font-weight: 600; color: var(--ink); }
.v3-kb-article-attach .body .s { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----- Helpful vote stub ----- */
.v3-kb-helpful { display: flex; align-items: center; gap: 8px; margin: 32px 0 8px; padding: 14px 0; border-top: 1px solid var(--line-soft); max-width: 720px; }
.v3-kb-helpful .t { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-right: 6px; }

/* ----- Right rail: TOC & related ----- */
.v3-kb-article-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 18px; }
@media (max-width: 980px) { .v3-kb-article-side { position: static; } }
.v3-kb-toc, .v3-kb-related { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.v3-kb-toc .head, .v3-kb-related .head { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.v3-kb-toc ul, .v3-kb-related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.v3-kb-toc li a { display: block; font-size: 12.5px; color: var(--ink-2); text-decoration: none; line-height: 1.4; padding: 2px 0; }
.v3-kb-toc li.lvl3 { padding-left: 12px; }
.v3-kb-toc li.lvl3 a { font-size: 12px; color: var(--ink-3); }
.v3-kb-toc li a:hover { color: var(--teal-800); }
.v3-kb-related li a { display: block; cursor: pointer; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.v3-kb-related li:first-child a { border-top: 0; padding-top: 0; }
.v3-kb-related li a .t { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.v3-kb-related li a:hover .t { color: var(--teal-800); }
.v3-kb-related li a .s { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; }

/* ============================================================
   Dashboards (Personal / Tenant Business / Tenant Operational)
   ============================================================ */

.v3-dash-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.v3-dash-h .v3-h1 { margin: 0; }
.v3-dash-h .v3-lead { margin-top: 4px; }
.v3-dash-h-actions { display: flex; gap: 8px; align-items: center; }

.v3-dash-section { margin-top: 20px; }
.v3-dash-section-title { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px 2px; font-weight: 600; }

/* Stat tile — label + big number + delta */
.v3-dash-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-height: 110px; }
.v3-dash-stat .v3-dash-stat-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.v3-dash-stat .v3-dash-stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); font-feature-settings: "tnum","ss01"; line-height: 1.1; }
.v3-dash-stat .v3-dash-stat-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.v3-dash-stat .v3-dash-stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 1px 7px; border-radius: 999px; width: fit-content; margin-top: 4px; }
.v3-dash-stat .v3-dash-stat-delta.up   { background: var(--green-50); color: var(--green); }
.v3-dash-stat .v3-dash-stat-delta.down { background: var(--red-50);   color: var(--red); }
.v3-dash-stat .v3-dash-stat-delta.flat { background: var(--line-soft); color: var(--ink-3); }

/* Widget card — titled .v3-card wrapper */
.v3-dash-widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.v3-dash-widget .v3-dash-widget-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.v3-dash-widget .v3-dash-widget-h h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.v3-dash-widget .v3-dash-widget-h .sub { font-size: 12px; color: var(--ink-3); }
.v3-dash-widget .v3-dash-widget-body { padding: 14px 16px; flex: 1; }
.v3-dash-widget .v3-dash-widget-empty { padding: 24px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* Activity timeline */
.v3-dash-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.v3-dash-timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.v3-dash-timeline li:first-child { border-top: 0; padding-top: 0; }
.v3-dash-timeline .ti-icon { width: 26px; height: 26px; border-radius: 999px; background: var(--teal-50); color: var(--teal-800); display: grid; place-items: center; font-size: 12px; }
.v3-dash-timeline .ti-icon.amber { background: var(--amber-50); color: var(--amber); }
.v3-dash-timeline .ti-icon.green { background: var(--green-50); color: var(--green); }
.v3-dash-timeline .ti-body .ti-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.v3-dash-timeline .ti-body .ti-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.v3-dash-timeline .ti-when { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }

/* Task list (waiting on me) */
.v3-dash-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.v3-dash-tasks li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.v3-dash-tasks li:first-child { border-top: 0; padding-top: 0; }
.v3-dash-tasks .tk-pill { width: 6px; height: 36px; border-radius: 3px; background: var(--amber); flex: none; }
.v3-dash-tasks .tk-body { flex: 1; min-width: 0; }
.v3-dash-tasks .tk-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-dash-tasks .tk-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* Mini product list / chip row */
.v3-dash-prod-row { display: flex; flex-wrap: wrap; gap: 8px; }
.v3-dash-prod-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.v3-dash-prod-chip:hover { border-color: var(--teal-700); }
.v3-dash-prod-chip .ico { width: 22px; height: 22px; border-radius: 50%; background: var(--teal-50); color: var(--teal-800); display: grid; place-items: center; font-size: 10px; font-weight: 600; }
.v3-dash-prod-chip .name { font-size: 12.5px; color: var(--ink); }
.v3-dash-prod-chip .pid { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }

/* Top products list (bar list) */
.v3-dash-toplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.v3-dash-toplist li { display: grid; grid-template-columns: 1fr 56px; gap: 10px; align-items: center; }
.v3-dash-toplist .tp-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v3-dash-toplist .tp-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v3-dash-toplist .tp-name { font-size: 13px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-dash-toplist .tp-count { font-size: 12px; color: var(--ink-3); font-feature-settings: "tnum"; }
.v3-dash-toplist .tp-bar { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.v3-dash-toplist .tp-bar-fill { height: 100%; background: var(--teal-700); border-radius: 999px; }
.v3-dash-toplist .tp-share { font-size: 11px; color: var(--ink-4); text-align: right; font-feature-settings: "tnum"; }

/* Sparkline / bar chart (CSS-only) */
.v3-dash-spark { display: flex; align-items: flex-end; gap: 2px; height: 80px; padding-top: 4px; }
.v3-dash-spark .bar { flex: 1; background: var(--teal-100); border-radius: 2px 2px 0 0; min-height: 2px; }
.v3-dash-spark .bar.hi { background: var(--teal-700); }

/* Seat utilization donut */
.v3-dash-seat { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: center; }
.v3-dash-seat-ring { width: 140px; height: 140px; border-radius: 50%; background: conic-gradient(var(--ring-color, var(--teal-700)) calc(var(--ring, 0) * 1%), var(--line-soft) 0); display: grid; place-items: center; position: relative; }
.v3-dash-seat-ring::after { content: ""; position: absolute; inset: 14px; background: var(--surface); border-radius: 50%; }
.v3-dash-seat-ring .v3-dash-seat-num { position: relative; z-index: 1; text-align: center; }
.v3-dash-seat-ring .v3-dash-seat-num .big { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); font-feature-settings: "tnum"; line-height: 1; }
.v3-dash-seat-ring .v3-dash-seat-num .small { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.v3-dash-seat-meta { display: flex; flex-direction: column; gap: 10px; }
.v3-dash-seat-meta .row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.v3-dash-seat-meta .row .k { color: var(--ink-3); }
.v3-dash-seat-meta .row .v { color: var(--ink); font-weight: 500; }
.v3-dash-seat.ok    { --ring-color: var(--green); }
.v3-dash-seat.warn  { --ring-color: var(--amber); }
.v3-dash-seat.crit  { --ring-color: var(--red); }

/* Status pill */
.v3-dash-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.v3-dash-pill.green { background: var(--green-50); color: var(--green); }
.v3-dash-pill.amber { background: var(--amber-50); color: var(--amber); }
.v3-dash-pill.red   { background: var(--red-50);   color: var(--red); }
.v3-dash-pill .dot  { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Contributor / audit rows */
.v3-dash-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.v3-dash-rows li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.v3-dash-rows li:first-child { border-top: 0; padding-top: 0; }
.v3-dash-rows .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--teal-100); color: var(--teal-800); display: grid; place-items: center; font-size: 10.5px; font-weight: 600; flex: none; }
.v3-dash-rows .main { flex: 1; min-width: 0; }
.v3-dash-rows .main .t { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-dash-rows .main .s { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.v3-dash-rows .right { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.v3-dash-rows .num { font-feature-settings: "tnum"; color: var(--ink); font-weight: 500; }

/* Quick-action button row */
.v3-dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Responsive */
@media (max-width: 900px) {
    .v3-dash-seat { grid-template-columns: 1fr; justify-items: center; }
    .v3-dash-h { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   Dashboards V2 — engineering-blueprint aesthetic (Tenant Dashboard design)
   Class prefix: .v3-td-* (tenant dashboard) + .v3-kpi-* (KPI strip)
   ============================================================ */

.v3-ops { color: var(--ink); }

/* ---- Masthead ---- */
.v3-td-masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.v3-td-mast-left { min-width: 0; flex: 1; }
.v3-td-slug { font-size: 11px; letter-spacing: 0.12em; color: var(--ink-3); display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v3-td-slug b { color: var(--ink); font-weight: 600; }
.v3-td-live { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border: 1px solid color-mix(in oklab, var(--green) 40%, transparent); color: #1C5A33; border-radius: 999px; font-size: 10px; letter-spacing: 0.1em; margin-left: 6px; }
.v3-app[data-theme="dark"] .v3-td-live { color: #9BD5AC; }
.v3-td-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: v3-td-pulse 1.6s ease-in-out infinite; }
@keyframes v3-td-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.v3-td-h1 { margin: 10px 0 0; font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; color: var(--ink); }
.v3-td-h1-sep { color: var(--ink-4); margin: 0 6px; font-weight: 300; }
.v3-td-h1-sub { font-weight: 500; font-size: 22px; color: var(--ink-3); font-family: var(--mono); font-feature-settings: "ss01","cv11"; letter-spacing: -0.01em; }

.v3-td-mast-meta { font-size: 11px; letter-spacing: 0.1em; color: var(--ink-3); margin-top: 14px; display: flex; align-items: center; flex-wrap: wrap; font-family: var(--mono); }
.v3-td-mast-meta b { color: var(--ink); font-weight: 600; margin-left: 6px; }
.v3-td-pipe { color: var(--ink-4); margin: 0 14px; }

.v3-td-mast-right { display: flex; gap: 8px; align-items: center; flex: none; flex-wrap: wrap; }

/* Segmented control */
.v3-td-seg { display: inline-flex; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.v3-td-seg button { padding: 4px 10px; border: 0; background: transparent; color: var(--ink-3); border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; }
.v3-td-seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* V3TimeFilter — segmented control + Custom date-range popover */
.v3-td-seg-wrap { position: relative; }
.v3-td-seg-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    display: flex;
    align-items: end;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    white-space: nowrap;
}
.v3-td-seg-popover label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-3);
}
.v3-td-seg-popover input[type="date"] {
    min-width: 140px;
    padding: 4px 8px;
    font-size: 12px;
}

/* ---- KPI strip (6 tiles in one bordered grid) ---- */
.v3-kpi-strip { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-bottom: 22px; overflow: hidden; }
.v3-kpi { padding: 14px 16px 12px; border-right: 1px solid var(--line); position: relative; }
.v3-kpi:last-child { border-right: 0; }
.v3-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--fam, var(--teal-800)); }
.v3-kpi-k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-4); font-family: var(--mono); }
.v3-kpi-v { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--fam-deep, var(--teal-800)); line-height: 1; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-kpi-d { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; letter-spacing: 0.04em; font-family: var(--mono); }

.v3-kpi.t-teal   { --fam: var(--teal-800);  --fam-deep: var(--teal-800); }
.v3-kpi.t-amber  { --fam: #C8892A;          --fam-deep: #7A4E10; }
.v3-kpi.t-green  { --fam: var(--green);     --fam-deep: #1C5A33; }
.v3-kpi.t-purple { --fam: #7A4A8F;          --fam-deep: #3E2252; }
.v3-kpi.t-red    { --fam: var(--red);       --fam-deep: #6A2614; }
.v3-app[data-theme="dark"] .v3-kpi.t-amber  { --fam-deep: #E9C88A; }
.v3-app[data-theme="dark"] .v3-kpi.t-green  { --fam-deep: #9BD5AC; }
.v3-app[data-theme="dark"] .v3-kpi.t-purple { --fam-deep: #C9ADD9; }
.v3-app[data-theme="dark"] .v3-kpi.t-red    { --fam-deep: #E59A82; }
.v3-app[data-theme="dark"] .v3-kpi.t-teal   { --fam-deep: var(--teal-100); }

/* ---- Grids ---- */
.v3-td-grid { display: grid; gap: 16px; margin-bottom: 18px; }
.v3-td-grid-12-12 { grid-template-columns: 1fr 1fr; }
.v3-td-grid-8-16  { grid-template-columns: 1fr 1.6fr; }

/* ---- Card ---- */
.v3-td-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.v3-td-card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.v3-td-card-h h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); }
.v3-td-card-id { font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-4); padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; font-family: var(--mono); }
.v3-td-card-sub { font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); margin-left: 4px; font-family: var(--mono); }
.v3-td-card-h .spacer { flex: 1; }
.v3-td-card-foot { display: flex; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 10.5px; letter-spacing: 0.06em; color: var(--ink-3); margin-top: auto; font-family: var(--mono); }
.v3-td-card-foot .spacer { flex: 1; }
.v3-td-link { color: var(--teal-800); font-size: 10.5px; letter-spacing: 0.08em; cursor: pointer; font-family: var(--mono); }
.v3-app[data-theme="dark"] .v3-td-link { color: var(--teal-100); }
.v3-td-link:hover { text-decoration: underline; }

/* ---- Tick rule ---- */
.v3-td-tick { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; }
.v3-td-tick-rule { height: 1px; background: var(--line); width: 24px; }
.v3-td-tick-rule-grow { flex: 1; }
.v3-td-tick-glyph { color: var(--ink-4); font-size: 11px; }
.v3-td-tick-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-2); font-weight: 600; }
.v3-td-tick-count { font-size: 10.5px; color: var(--ink-4); font-family: var(--mono); }

/* ---- Helpers ---- */
.v3-td-good { color: #1C5A33; }
.v3-app[data-theme="dark"] .v3-td-good { color: #9BD5AC; }
.v3-td-warn { color: #7A4E10; }
.v3-app[data-theme="dark"] .v3-td-warn { color: #E9C88A; }
.v3-td-dim  { color: var(--ink-4); }
.v3-td-mono { font-family: var(--mono); font-feature-settings: "ss01","cv11"; letter-spacing: -0.01em; }
.v3-td-num  { font-variant-numeric: tabular-nums; }

/* ---- License card ---- */
.v3-td-lic-hero { padding: 18px 18px 14px; border-bottom: 1px solid var(--line-soft); }
.v3-td-lic-num { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.v3-td-lic-k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-4); font-family: var(--mono); }
.v3-td-lic-big { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--teal-800); display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.v3-app[data-theme="dark"] .v3-td-lic-big { color: var(--teal-100); }
.v3-td-lic-slash { color: var(--ink-4); font-weight: 300; font-size: 38px; }
.v3-td-lic-max { color: var(--ink-3); font-weight: 500; font-size: 32px; }
.v3-td-lic-d { font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 6px; font-family: var(--mono); }
.v3-td-lic-bar { position: relative; height: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.v3-td-lic-bar-fill { height: 100%; background: var(--teal-800); transition: width 240ms ease; }
.v3-app[data-theme="dark"] .v3-td-lic-bar-fill { background: var(--teal-100); }
.v3-td-lic-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--surface); opacity: 0.5; }
.v3-td-lic-rows { padding: 8px 0; }
.v3-td-lic-row { display: grid; grid-template-columns: 78px 1.4fr 1fr 70px 50px; align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.v3-td-lic-row:last-child { border-bottom: 0; }
.v3-td-lic-row.warn { background: color-mix(in oklab, var(--amber) 5%, transparent); }
.v3-td-lic-sku { font-size: 10.5px; color: var(--ink-3); padding: 2px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; text-align: center; letter-spacing: 0.04em; font-family: var(--mono); }
.v3-td-lic-label .v3-td-lic-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.v3-td-lic-label .v3-td-lic-role { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; margin-top: 1px; font-family: var(--mono); }
.v3-td-lic-mini-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.v3-td-lic-mini-fill { height: 100%; transition: width 240ms ease; background: var(--teal-800); }
.v3-td-lic-mini-fill.warn { background: var(--amber); }
.v3-td-lic-count { text-align: right; font-size: 12.5px; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-td-lic-count b { font-weight: 700; }
.v3-td-lic-pct { font-size: 11px; color: var(--ink-3); text-align: right; font-family: var(--mono); }
.v3-td-lic-pct.warn { color: #7A4E10; font-weight: 600; }
.v3-app[data-theme="dark"] .v3-td-lic-pct.warn { color: #E9C88A; }

/* ---- CAD chart numbers + servers ---- */
.v3-td-chart-numbers { display: grid; grid-template-columns: repeat(4, 1fr); padding: 16px; gap: 0; border-bottom: 1px solid var(--line-soft); }
.v3-td-chart-num { padding-right: 16px; border-right: 1px solid var(--line-soft); }
.v3-td-chart-num:nth-child(2), .v3-td-chart-num:nth-child(3) { padding-left: 16px; }
.v3-td-chart-num:last-child { border-right: 0; padding-left: 16px; }
.v3-td-chart-k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-4); font-family: var(--mono); }
.v3-td-chart-v { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; margin-top: 4px; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-td-chart-u { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.v3-td-chart-d { font-size: 10.5px; letter-spacing: 0.06em; margin-top: 6px; color: var(--ink-3); font-family: var(--mono); }
.v3-td-chart-wrap { padding: 12px 6px; }
.v3-td-legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; font-family: var(--mono); }
.v3-td-legend i { display: inline-block; width: 10px; height: 8px; vertical-align: middle; margin-right: 5px; border-radius: 1px; }
.v3-td-servers { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border-top: 1px solid var(--line-soft); }
.v3-td-server { display: grid; grid-template-columns: 14px 1fr 50px 1fr 40px; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); font-size: 12px; }
.v3-td-server-host { color: var(--ink-2); font-size: 11.5px; font-family: var(--mono); }
.v3-td-server-q { color: var(--ink-3); font-size: 11px; padding: 2px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; text-align: center; font-family: var(--mono); }
.v3-td-server-bar { display: block; height: 5px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.v3-td-server-bar > span { display: block; height: 100%; background: var(--teal-800); }
.v3-td-server-load { color: var(--ink-2); font-size: 11px; text-align: right; font-family: var(--mono); }
.v3-td-server.offline { opacity: 0.5; }
.v3-td-server.offline .v3-td-server-bar > span { background: var(--ink-4); }
.v3-td-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.v3-td-dot-green { background: var(--green); box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 20%, transparent); }
.v3-td-dot-amber { background: var(--amber); }
.v3-td-dot-red   { background: var(--red); }
.v3-td-dot-ink   { background: var(--ink-4); }

/* ---- 24h CAD wait chart (bar + p95 + queue) ---- */
.v3-td-wait { width: 100%; height: 160px; display: block; }

/* ---- Products table ---- */
.v3-td-prod-tbl { padding: 4px 0; }
.v3-td-prod-th, .v3-td-prod-row { display: grid; grid-template-columns: 24px minmax(0, 2.4fr) 56px minmax(60px, 0.7fr) 56px 56px 90px; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.v3-td-prod-th { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 8px; padding-bottom: 8px; font-family: var(--mono); }
.v3-app[data-theme="dark"] .v3-td-prod-th { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); }
.v3-td-prod-row:last-child { border-bottom: 0; }
.v3-td-prod-row:hover { background: var(--teal-50); cursor: pointer; }
.v3-td-prod-rank { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.v3-td-prod-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.v3-td-prod-id { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; font-family: var(--mono); }
.v3-td-prod-label { font-size: 13px; font-weight: 500; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-td-fam-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--fam, var(--teal-800)); }
.v3-td-prod-num { font-size: 12.5px; color: var(--ink); text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-td-prod-num b { font-weight: 700; }
.v3-td-prod-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.v3-td-prod-bar-fill { height: 100%; background: var(--fam, var(--teal-800)); transition: width 240ms ease; }
.v3-td-prod-spark { display: flex; justify-content: flex-end; align-items: center; }

/* ---- Users / actors table ---- */
.v3-td-user-tbl { padding: 4px 0; }
.v3-td-user-th, .v3-td-user-row { display: grid; grid-template-columns: 24px minmax(0, 1.8fr) 56px minmax(70px, 1fr) 52px 52px 56px; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.v3-td-user-th { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 8px; padding-bottom: 8px; font-family: var(--mono); }
.v3-app[data-theme="dark"] .v3-td-user-th { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); }
.v3-td-user-row:last-child { border-bottom: 0; }
.v3-td-user-row:hover { background: var(--teal-50); cursor: pointer; }
.v3-td-user-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.v3-td-user-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; text-transform: uppercase; flex: none; background: var(--teal-800); }
.v3-td-user-av.sm { width: 22px; height: 22px; font-size: 9.5px; }
.v3-td-user-name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-td-user-dept { font-size: 10px; color: var(--ink-3); letter-spacing: 0.06em; margin-top: 1px; font-family: var(--mono); }
.v3-td-role-pill { font-size: 10.5px; padding: 2px 8px; border: 1px solid; border-radius: 999px; font-weight: 600; text-align: center; letter-spacing: 0.04em; font-family: var(--mono); display: inline-block; }
.v3-td-role-pill.t-teal   { background: var(--teal-50);  color: var(--teal-800); border-color: var(--teal-100); }
.v3-td-role-pill.t-amber  { background: var(--amber-50); color: #7A4E10;        border-color: color-mix(in oklab, var(--amber) 40%, transparent); }
.v3-td-role-pill.t-green  { background: var(--green-50); color: #1C5A33;        border-color: color-mix(in oklab, var(--green) 40%, transparent); }
.v3-td-role-pill.t-red    { background: var(--red-50);   color: #6A2614;        border-color: color-mix(in oklab, var(--red) 40%, transparent); }
.v3-td-user-config { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.v3-td-user-bar { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.v3-td-user-bar > div { height: 100%; background: var(--teal-800); transition: width 240ms ease; }
.v3-app[data-theme="dark"] .v3-td-user-bar > div { background: var(--teal-100); }

/* ---- Configurations card (stacked + history) ---- */
.v3-td-cfg-hero { padding: 18px 16px; border-bottom: 1px solid var(--line-soft); }
.v3-td-cfg-total { font-size: 56px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; color: var(--teal-800); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-app[data-theme="dark"] .v3-td-cfg-total { color: var(--teal-100); }
.v3-td-cfg-total-k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-4); margin-top: 4px; font-family: var(--mono); }
.v3-td-cfg-stacked { display: flex; height: 18px; border-radius: 3px; overflow: hidden; margin: 16px 0 14px; gap: 2px; background: var(--bg); }
.v3-td-cfg-seg { transition: flex 240ms ease; }
.v3-td-cfg-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.v3-td-cfg-leg { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 8px; font-size: 12.5px; }
.v3-td-cfg-sw { width: 10px; height: 10px; border-radius: 2px; }
.v3-td-cfg-leg-l { color: var(--ink-2); }
.v3-td-cfg-leg-v { font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.v3-td-cfg-leg-p { color: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.v3-td-output-hist { padding: 16px 16px 14px; }
.v3-td-output-hist-h { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); margin-bottom: 10px; font-family: var(--mono); }
.v3-td-output-v { color: var(--ink); font-weight: 600; }
.v3-td-output-bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.v3-td-output-bar { flex: 1; min-height: 2px; transition: height 240ms; border-radius: 1px 1px 0 0; background: var(--teal-800); }
.v3-td-output-bar.today { background: var(--amber); }
.v3-td-output-axis { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.08em; color: var(--ink-4); margin-top: 8px; font-family: var(--mono); }

/* ---- Recent CAD jobs ---- */
.v3-td-jobs-tbl { padding: 4px 0; }
.v3-td-jobs-th, .v3-td-jobs-row { display: grid; grid-template-columns: 110px 1.6fr 1fr 1fr 60px 60px 50px; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.v3-td-jobs-th { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 8px; padding-bottom: 8px; font-family: var(--mono); }
.v3-app[data-theme="dark"] .v3-td-jobs-th { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); }
.v3-td-jobs-row:last-child { border-bottom: 0; }
.v3-td-jobs-row:hover { background: var(--teal-50); }
.v3-td-jobs-id { font-size: 11px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.v3-td-jobs-status { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.v3-td-jobs-status.completed { background: var(--green); box-shadow: 0 0 0 2px color-mix(in oklab, var(--green) 18%, transparent); }
.v3-td-jobs-status.queued    { background: var(--amber); box-shadow: 0 0 0 2px color-mix(in oklab, var(--amber) 18%, transparent); }
.v3-td-jobs-status.failed    { background: var(--red); }
.v3-td-jobs-prod { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v3-td-jobs-pname { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.v3-td-jobs-cust { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; letter-spacing: 0.04em; font-family: var(--mono); }
.v3-td-jobs-user { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.v3-td-jobs-out { font-size: 11px; color: var(--ink-3); padding: 2px 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; letter-spacing: 0.04em; display: inline-block; width: fit-content; font-family: var(--mono); }
.v3-td-jobs-num { font-size: 12px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- Footer line ---- */
.v3-td-foot { display: flex; align-items: center; gap: 14px; padding: 14px 0 0; margin-top: 28px; border-top: 1px solid var(--line); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-4); font-family: var(--mono); }
.v3-td-foot-rule { flex: 1; height: 1px; background: var(--line); }

/* ---- Activity timeline (Personal dashboard) ---- */
.v3-td-act-list { display: flex; flex-direction: column; }
.v3-td-act { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.v3-td-act:last-child { border-bottom: 0; }
.v3-td-act-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--teal-800); }
.v3-td-act-dot.amber { background: var(--amber); }
.v3-td-act-dot.green { background: var(--green); }
.v3-td-act-dot.red   { background: var(--red); }
.v3-td-act-what { font-size: 13px; color: var(--ink); font-weight: 500; }
.v3-td-act-where { font-size: 11px; color: var(--ink-3); margin-top: 2px; font-family: var(--mono); letter-spacing: 0.03em; }
.v3-td-act-when { font-size: 10.5px; color: var(--ink-4); font-family: var(--mono); white-space: nowrap; }

/* ---- Mini-product chip-row (for Personal "favorites" / "recently used") ---- */
.v3-td-mini-list { display: flex; flex-direction: column; }
.v3-td-mini-row { display: grid; grid-template-columns: 10px 80px 1fr 56px 50px; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.v3-td-mini-row:last-child { border-bottom: 0; }
.v3-td-mini-row:hover { background: var(--teal-50); }
.v3-td-mini-pid { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; font-family: var(--mono); }
.v3-td-mini-name { font-size: 13px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-td-mini-num { font-size: 11.5px; text-align: right; color: var(--ink-2); font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- Tenant health row (Platform Ops) ---- */
.v3-td-tenant-th, .v3-td-tenant-row { display: grid; grid-template-columns: 24px minmax(0, 1.8fr) 70px 90px 80px 80px 90px; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.v3-td-tenant-th { background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 8px; padding-bottom: 8px; font-family: var(--mono); }
.v3-app[data-theme="dark"] .v3-td-tenant-th { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); }
.v3-td-tenant-row:last-child { border-bottom: 0; }
.v3-td-tenant-row:hover { background: var(--teal-50); cursor: pointer; }

/* ---- Wait chart (CSS-only fallback bars) ---- */
.v3-td-wait-bars { display: flex; align-items: stretch; gap: 2px; height: 140px; padding: 12px 16px; }
.v3-td-wait-col { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 1px; position: relative; min-width: 0; }
.v3-td-wait-bar-avg { background: var(--teal-800); border-radius: 1px; min-height: 2px; }
.v3-td-wait-p95 { position: absolute; left: -2px; right: -2px; height: 2px; background: var(--amber); }
.v3-td-wait-q { position: absolute; bottom: -10px; left: 1px; right: 1px; height: 4px; background: var(--red); opacity: 0.85; border-radius: 1px; }
.v3-td-wait-axis { display: flex; justify-content: space-between; padding: 14px 16px 12px; font-size: 9.5px; color: var(--ink-4); font-family: var(--mono); letter-spacing: 0.08em; }

/* ---- KPI strip responsive ---- */
@media (max-width: 1200px) {
    .v3-td-grid-12-12, .v3-td-grid-8-16 { grid-template-columns: 1fr; }
    .v3-kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .v3-kpi:nth-child(3) { border-right: 0; }
    .v3-kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 700px) {
    .v3-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .v3-kpi:nth-child(2n) { border-right: 0; }
    .v3-kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
    .v3-td-h1 { font-size: 26px; }
    .v3-td-h1-sub { font-size: 18px; }
    .v3-td-prod-th, .v3-td-prod-row,
    .v3-td-user-th, .v3-td-user-row,
    .v3-td-jobs-th, .v3-td-jobs-row,
    .v3-td-tenant-th, .v3-td-tenant-row { font-size: 11px; padding: 8px 10px; gap: 6px; }
}


/* ============================================================
   Configuration Builder — landing page (v3-cb-*)
   ============================================================ */
.v3-cb-toolbar-spacer { flex: 1; }
.v3-cb-status-filter { min-width: 160px; }

.v3-cb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.v3-cb-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms, box-shadow 120ms;
}
.v3-cb-card:hover {
    border-color: var(--teal-700);
    box-shadow: 0 1px 0 rgba(17,61,79,0.04), 0 4px 12px rgba(17,61,79,0.08);
}
.v3-cb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v3-cb-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.v3-cb-status {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--mono);
    flex-shrink: 0;
}
.v3-cb-status-draft     { background: var(--teal-50);  color: var(--teal-800); }
.v3-cb-status-published { background: var(--green-50); color: var(--green); }
.v3-cb-status-archived  { background: var(--bg);       color: var(--ink-3); }

.v3-cb-card-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.v3-cb-product { font-weight: 500; color: var(--ink-2); }
.v3-cb-sep { color: var(--ink-4); }
.v3-cb-rev { font-family: var(--mono); font-size: 11.5px; }
.v3-cb-desc { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.v3-cb-card-foot {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--ink-4);
}
.v3-cb-counts { font-family: var(--mono); }

.v3-cb-error {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: rgba(180, 72, 47, 0.08);
    color: var(--red);
    font-size: 12.5px;
}

/* ============================================================
   Configuration Builder — editor (v3-cbe-*)
   ============================================================ */
.v3-cbe-app {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    margin: -16px -16px -16px -16px;
}

.v3-cbe-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.v3-cbe-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ink-2); padding: 5px 9px; border-radius: 6px;
    font-size: 12.5px; font-weight: 500;
    text-decoration: none;
}
.v3-cbe-back:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-cbe-divider { width: 1px; height: 22px; background: var(--line); }
.v3-cbe-title { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.v3-cbe-title-input {
    background: transparent; border: 0; outline: 0;
    font-size: 15px; font-weight: 600; color: var(--ink);
    padding: 4px 6px; border-radius: 4px;
    min-width: 200px;
}
.v3-cbe-title-input:focus { background: var(--bg); box-shadow: 0 0 0 2px var(--teal-100); }
.v3-cbe-status { flex-shrink: 0; }

.v3-cbe-tabs {
    display: flex; gap: 2px;
    background: var(--bg); border: 1px solid var(--line);
    border-radius: 8px; padding: 3px;
    margin-left: 16px;
}
.v3-cbe-tabs button {
    padding: 5px 12px; border: 0; background: transparent; cursor: pointer;
    border-radius: 6px; font-size: 12.5px;
    color: var(--ink-3); font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
}
.v3-cbe-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 rgba(17,61,79,0.04); }
.v3-cbe-tab-ct {
    font-family: var(--mono); font-size: 10.5px;
    padding: 1px 5px; background: var(--teal-50); color: var(--teal-800);
    border-radius: 4px;
}
.v3-cbe-spacer { flex: 1; }
.v3-cbe-status-text { font-size: 11.5px; color: var(--ink-3); }
.v3-cbe-status-ok { color: var(--green); }

.v3-cbe-body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 340px;
    flex: 1;
    min-height: 0;
}

.v3-cbe-palette {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 14px 12px;
    overflow-y: auto;
}
.v3-cbe-palette-h h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.v3-cbe-palette-search { margin-bottom: 12px; }
.v3-cbe-palette-cat { margin-bottom: 14px; }
.v3-cbe-palette-cat-h {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--ink-4); font-weight: 600; font-family: var(--mono);
    margin-bottom: 6px; padding: 0 2px;
}
.v3-cbe-palette-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.v3-cbe-palette-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 8px 9px; border-radius: 7px;
    border: 1px solid var(--line); background: var(--surface);
    cursor: pointer; text-align: left;
    transition: border-color 120ms, background 120ms;
}
.v3-cbe-palette-item:hover { border-color: var(--teal-800); background: var(--teal-50); }
.v3-cbe-palette-ic {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--teal-50); color: var(--teal-800);
    border-radius: 5px;
    font-weight: 600; font-size: 12px; font-family: var(--mono);
}
.v3-cbe-palette-lab { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.v3-cbe-palette-foot {
    margin-top: 14px; padding: 10px;
    background: var(--teal-50); border-radius: 8px;
    font-size: 11px; color: var(--teal-800); line-height: 1.4;
}

.v3-cbe-canvas {
    display: flex; flex-direction: column;
    min-width: 0;
    background: var(--bg);
}
.v3-cbe-canvas-h {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
}
.v3-cbe-canvas-h h2 { margin: 0; font-size: 15px; font-weight: 600; }
.v3-cbe-canvas-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 80px; }

.v3-cbe-section {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
}
.v3-cbe-section.selected { border-color: var(--teal-100); background: var(--surface); }

.v3-cbe-section-h {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 4px 8px 4px;
}
.v3-cbe-section-title {
    flex: 1;
    background: transparent; border: 0; outline: 0;
    font-size: 16px; font-weight: 600;
    color: var(--ink);
    padding: 2px 4px; border-radius: 4px;
}
.v3-cbe-section-title:focus { background: var(--bg); box-shadow: 0 0 0 2px var(--teal-100); }

.v3-cbe-fields {
    display: flex; flex-direction: column; gap: 8px;
    padding: 4px;
    min-height: 30px;
}
.v3-cbe-field-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 10px; padding: 10px 12px;
    cursor: pointer;
    transition: border-color 120ms, box-shadow 120ms;
}
.v3-cbe-field-card:hover { border-color: var(--ink-4); }
.v3-cbe-field-card.active {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 3px var(--teal-50);
}
.v3-cbe-field-head { display: flex; align-items: center; gap: 10px; }
.v3-cbe-field-kind {
    width: 26px; height: 26px;
    display: grid; place-items: center;
    background: var(--teal-50); color: var(--teal-800);
    border-radius: 6px;
    font-weight: 600; font-size: 13px; font-family: var(--mono);
    flex-shrink: 0;
}
.v3-cbe-field-info { flex: 1; min-width: 0; }
.v3-cbe-field-label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.v3-cbe-req { color: var(--red); margin-left: 2px; font-weight: 600; }
.v3-cbe-field-meta { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.v3-cbe-key { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.v3-cbe-drop-hint {
    padding: 14px; border: 1.5px dashed var(--line);
    border-radius: 10px; text-align: center;
    font-size: 12px; color: var(--ink-3);
}
.v3-cbe-add-section {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px;
    border: 1.5px dashed var(--line); border-radius: 10px;
    background: transparent; cursor: pointer;
    color: var(--ink-3); font-size: 12.5px; font-weight: 500;
}
.v3-cbe-add-section:hover { color: var(--teal-800); border-color: var(--teal-800); background: var(--teal-50); }

.v3-cbe-empty {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 10px; padding: 40px 20px;
    text-align: center;
}
.v3-cbe-empty p { color: var(--ink-3); margin-bottom: 12px; }

.v3-cbe-section-del { color: var(--ink-4); }
.v3-cbe-section-del:hover { color: var(--red); }

.v3-cbe-props {
    background: var(--surface);
    border-left: 1px solid var(--line);
    overflow-y: auto;
}
.v3-cbe-props-h {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.v3-cbe-props-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
}
.v3-cbe-props-section h5 {
    margin: 0 0 10px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-4);
    font-weight: 600;
    font-family: var(--mono);
}
.v3-cbe-prop-row { display: flex; gap: 8px; align-items: flex-end; }
.v3-cbe-prop-row .v3-field { flex: 1; }

.v3-cbe-checkbox {
    display: inline-flex !important; align-items: center; gap: 6px;
    font-size: 12.5px;
}
.v3-cbe-checkbox input { margin: 0; }

.v3-cbe-props-empty {
    padding: 40px 24px;
    text-align: center; color: var(--ink-3);
}
.v3-cbe-props-empty h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.v3-cbe-props-empty p { margin: 0; font-size: 12px; line-height: 1.5; }

.v3-cbe-opt-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    margin-bottom: 5px;
    align-items: center;
}
.v3-cbe-opt-val, .v3-cbe-opt-lab { padding: 4px 7px !important; font-size: 11.5px !important; }

.v3-cbe-del-btn { color: var(--red); }
.v3-cbe-del-btn:hover { background: var(--red-50); }

.v3-cbe-stub {
    padding: 40px 60px;
    max-width: 600px;
    margin: 0 auto;
}
.v3-cbe-stub h3 { font-size: 18px; margin: 0 0 8px; }
.v3-cbe-stub p { color: var(--ink-3); line-height: 1.5; }

/* ============================================================
   Configuration Builder — drag & drop affordances + previews
   ============================================================ */

/* Palette item draggable */
.v3-cbe-palette-item { cursor: grab; user-select: none; }
.v3-cbe-palette-item:active { cursor: grabbing; }

/* Section grip + drag-over feedback */
.v3-cbe-grip {
    cursor: grab;
    color: var(--ink-4);
    font-size: 14px;
    letter-spacing: -2px;
    padding: 2px 4px;
    user-select: none;
}
.v3-cbe-grip:hover { color: var(--ink-2); }
.v3-cbe-grip:active { cursor: grabbing; }

.v3-cbe-grip-small {
    cursor: grab;
    color: var(--ink-4);
    font-size: 12px;
    letter-spacing: -2px;
    user-select: none;
}
.v3-cbe-grip-small:hover { color: var(--ink-2); }

/* Drag-and-drop styles driven by js/configBuilderDrag.js + SortableJS. */

/* The "ghost" element SortableJS leaves in the destination position while the
   item is being dragged. We fade it so the user reads the real card position
   (where it will land) clearly. The card itself doesn't need an extra overlay
   — SortableJS animates the surrounding cards making room, which is the cue. */
.v3-cbe-field-card.cb-sortable-ghost,
.v3-cbe-section.cb-sortable-ghost {
    opacity: 0.35;
    background: var(--teal-50);
    border-color: var(--teal-700);
}
/* SortableJS adds chosen-class on mousedown, before drag starts. Light cue. */
.v3-cbe-field-card.cb-sortable-chosen,
.v3-cbe-section.cb-sortable-chosen { cursor: grabbing; }

/* Page-tab drop highlight (handled by the native HTML5 listeners). */
.v3-cbe-pagetab.cb-drop-target {
    background: var(--teal-50);
    box-shadow: inset 0 -2px 0 var(--teal-700);
}

.v3-cbe-field-card[draggable="true"] { cursor: grab; }
.v3-cbe-field-card[draggable="true"]:active { cursor: grabbing; }

/* ============================================================
   Field-card preview primitives (v3-cbp-*)
   Modelled on the design's .bp-* primitives.
   ============================================================ */
.v3-cbe-field-preview {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.v3-cbp-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}
.v3-cbp-input-tall { min-height: 56px; align-items: flex-start; padding-top: 8px; }
.v3-cbp-input-stub { color: var(--ink-4); font-style: italic; }
.v3-cbp-mono { font-family: var(--mono); }
.v3-cbp-unit { margin-left: auto; color: var(--ink-4); font-size: 11px; font-family: var(--mono); }
.v3-cbp-select { justify-content: space-between; cursor: pointer; }
.v3-cbp-chev { color: var(--ink-3); font-size: 11px; }

.v3-cbp-toggle { display: inline-flex; align-items: center; gap: 8px; }
.v3-cbp-toggle-pill {
    width: 32px; height: 18px; border-radius: 9px; background: var(--line);
    padding: 2px; display: inline-block; transition: background 120ms;
}
.v3-cbp-toggle-pill span { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform 120ms; }
.v3-cbp-toggle-pill.on { background: var(--teal-800); }
.v3-cbp-toggle-pill.on span { transform: translateX(14px); }
.v3-cbp-toggle-lab { font-size: 11.5px; color: var(--ink-3); }

.v3-cbp-stepper {
    display: inline-flex; align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
}
.v3-cbp-stepper button {
    padding: 5px 11px;
    color: var(--ink-2);
    font-size: 13px;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.v3-cbp-stepper span {
    padding: 5px 14px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    font-size: 12.5px;
    font-family: var(--mono);
    min-width: 60px;
    text-align: center;
}

.v3-cbp-slider { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.v3-cbp-slider-track { flex: 1; height: 4px; background: var(--line); border-radius: 2px; position: relative; }
.v3-cbp-slider-fill { height: 100%; background: var(--teal-800); border-radius: 2px; position: relative; }
.v3-cbp-slider-fill::after {
    content: ""; position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--teal-800);
}
.v3-cbp-slider-val { font-size: 12px; color: var(--ink-2); min-width: 70px; text-align: right; font-family: var(--mono); }

.v3-cbp-dim {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 3px 6px; background: var(--bg);
}
.v3-cbp-dim span {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 6px; border-right: 1px solid var(--line);
}
.v3-cbp-dim span:last-child { border-right: 0; }
.v3-cbp-dim i {
    font-style: normal; color: var(--ink-4);
    font-size: 10.5px; font-family: var(--mono);
}
.v3-cbp-dim b { font-weight: 500; font-size: 12px; font-family: var(--mono); }

.v3-cbp-rating { display: flex; gap: 2px; font-size: 16px; color: var(--ink-4); }
.v3-cbp-rating .on { color: var(--amber); }

.v3-cbp-radio { display: flex; flex-direction: column; gap: 4px; }
.v3-cbp-radio-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 9px;
    border: 1px solid var(--line); border-radius: 6px;
    font-size: 12.5px; color: var(--ink-2);
    background: var(--bg);
}
.v3-cbp-radio-row.on { border-color: var(--teal-800); background: var(--teal-50); color: var(--teal-800); }
.v3-cbp-radio-row .dot {
    width: 12px; height: 12px; border-radius: 50%;
    border: 1.5px solid var(--ink-4); flex-shrink: 0;
}
.v3-cbp-radio-row.on .dot {
    border-color: var(--teal-800);
    background: radial-gradient(circle, var(--teal-800) 40%, var(--surface) 45%);
}

.v3-cbp-seg {
    display: inline-flex; background: var(--bg);
    border: 1px solid var(--line); border-radius: 6px;
    padding: 2px; gap: 2px;
}
.v3-cbp-seg span {
    padding: 4px 11px; font-size: 12px; color: var(--ink-3);
    border-radius: 4px;
}
.v3-cbp-seg span.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 rgba(17,61,79,0.04); }

.v3-cbp-img-radio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.v3-cbp-img-card {
    border: 1px solid var(--line); border-radius: 8px;
    overflow: hidden; padding: 0; background: var(--bg);
}
.v3-cbp-img-card.on { border-color: var(--teal-800); box-shadow: 0 0 0 1px var(--teal-800); }
.v3-cbp-img-thumb {
    height: 50px;
    background: linear-gradient(135deg, var(--teal-50), var(--teal-100));
}
.v3-cbp-img-thumb-sm { height: 36px; width: 50px; border-radius: 5px; flex-shrink: 0; }
.v3-cbp-img-name { padding: 5px 8px 1px; font-size: 12px; font-weight: 500; }
.v3-cbp-img-sub { padding: 0 8px 6px; font-size: 10.5px; color: var(--ink-3); }

.v3-cbp-img-list { display: flex; flex-direction: column; gap: 6px; }
.v3-cbp-img-list-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
}

.v3-cbp-swatches { display: flex; gap: 6px; }
.v3-cbp-swatch {
    width: 22px; height: 22px;
    border-radius: 5px; border: 1px solid var(--line);
}

.v3-cbp-checks { display: flex; flex-direction: column; gap: 4px; }
.v3-cbp-check-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 9px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
    font-size: 12.5px; color: var(--ink-2);
}
.v3-cbp-check-row.on { border-color: var(--teal-800); background: var(--teal-50); color: var(--teal-800); }
.v3-cbp-check-row .box {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--ink-4);
    display: grid; place-items: center;
    font-size: 9px; color: var(--surface); flex-shrink: 0;
}
.v3-cbp-check-row.on .box { background: var(--teal-800); border-color: var(--teal-800); }
.v3-cbp-check-row .price { margin-left: auto; color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }

.v3-cbp-chips {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 5px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
}
.v3-cbp-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px; border-radius: 4px;
    background: var(--teal-50); color: var(--teal-800);
    font-size: 11px; font-family: var(--mono);
}
.v3-cbp-chip i { font-style: normal; opacity: 0.7; cursor: pointer; }
.v3-cbp-chip-input { color: var(--ink-4); font-size: 11.5px; font-style: italic; padding: 2px 4px; }

.v3-cbp-matrix {
    padding: 9px 11px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
    font-size: 11.5px; color: var(--ink-3); font-family: var(--mono);
    display: inline-block;
}

.v3-cbp-file {
    display: flex; align-items: center; gap: 8px;
    padding: 12px;
    border: 1.5px dashed var(--line); border-radius: 6px;
    font-size: 12px; color: var(--ink-3);
    justify-content: center;
    background: var(--bg);
}

/* Slightly tighter spacing on the field card body now that previews are present */
.v3-cbe-field-card { padding: 12px 14px; }
.v3-cbe-field-head .v3-cbe-grip-small { margin-right: 2px; }

/* ============================================================
   Configuration Builder — right pane v2 (compact, design-aligned)
   ============================================================ */

/* Props header */
.v3-cbe-props-h {
    padding: 16px 18px;
    gap: 12px;
}
.v3-cbe-props-h .v3-cbe-field-kind.lg {
    width: 32px; height: 32px; font-size: 15px;
}
.v3-cbe-props-h-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}
.v3-cbe-props-h-key {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 2px;
}

.v3-cbe-props-empty-ic {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--ink-4);
}

/* Compact prop rows — mirrors .bp-prop in the design */
.v3-cbe-prop {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.v3-cbe-prop > span {
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 500;
}
.v3-cbe-prop input,
.v3-cbe-prop select {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    outline: none;
    width: 100%;
}
.v3-cbe-prop input:focus,
.v3-cbe-prop select:focus {
    border-color: var(--teal-800);
    background: var(--surface);
}

.v3-cbe-prop-row { display: flex; gap: 8px; align-items: flex-end; }
.v3-cbe-prop-row .v3-cbe-prop { flex: 1; margin-bottom: 0; }

/* Inline toggle (Required) */
.v3-cbe-toggle-prop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    cursor: pointer;
    background: var(--bg);
    color: var(--ink-2);
    margin-top: 4px;
}
.v3-cbe-toggle-prop input {
    margin: 0;
    accent-color: var(--teal-800);
}
.v3-cbe-toggle-prop:hover { border-color: var(--teal-800); color: var(--teal-800); }

/* Pill-style on/off toggle used in the field properties panel (Required, etc.). */
.v3-cbe-toggle-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 4px; }
.v3-cbe-toggle-row input { display: none; }
.v3-cbe-toggle-pill {
    width: 32px; height: 18px; border-radius: 9px;
    background: var(--line); padding: 2px; display: inline-block;
    transition: background 120ms;
}
.v3-cbe-toggle-pill > span {
    display: block; width: 14px; height: 14px; border-radius: 50%;
    background: #fff; transition: transform 120ms;
}
.v3-cbe-toggle-row input:checked + .v3-cbe-toggle-pill { background: var(--teal-800); }
.v3-cbe-toggle-row input:checked + .v3-cbe-toggle-pill > span { transform: translateX(14px); }
.v3-cbe-toggle-label { font-size: 12px; color: var(--ink-2); }

/* Image-option extras — shown only for ImageRadio / ImageList renderers. */
.v3-cbe-option-image {
    display: flex; align-items: center; gap: 8px;
    margin-top: 4px; padding-left: 0;
}
.v3-cbe-option-image-preview {
    width: 40px; height: 40px; border-radius: 4px;
    border: 1px dashed var(--line);
    background: var(--bg) center/cover no-repeat;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-4); font-size: 18px; flex: 0 0 auto;
}
.v3-cbe-option-image input[type="text"],
.v3-cbe-option-image input[type="number"] {
    flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px;
    border: 1px solid var(--line); border-radius: 4px;
}
.v3-cbe-option-image input[type="number"] { flex: 0 0 70px; }
.v3-cbe-option-image .v3-cbe-upload {
    flex: 0 0 auto; padding: 4px 8px; font-size: 11px;
    border: 1px solid var(--line); border-radius: 4px;
    cursor: pointer; background: var(--bg); color: var(--ink-2);
}
.v3-cbe-option-image .v3-cbe-upload:hover { border-color: var(--teal-800); color: var(--teal-800); }
.v3-cbe-option-image .v3-cbe-upload input { display: none; }

/* AI assistant slide-over panel — pinned to the right of the editor body.
   Doesn't push the canvas because it absolute-positions over the right edge. */
.v3-cbe-ai-toggle { gap: 4px; }
.v3-cbe-ai-toggle.on { background: var(--teal-50); border-color: var(--teal-800); color: var(--teal-800); }

.v3-cbe-ai-panel {
    position: fixed;
    top: 64px; right: 0; bottom: 0;
    width: 360px;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -4px 0 18px rgba(17, 61, 79, 0.08);
    display: flex; flex-direction: column;
    z-index: 100;
}
.v3-cbe-ai-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
}
.v3-cbe-ai-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.v3-cbe-ai-close {
    border: none; background: transparent; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--ink-3); padding: 0 6px;
}
.v3-cbe-ai-close:hover { color: var(--ink); }

.v3-cbe-ai-msgs {
    flex: 1; overflow-y: auto;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.v3-cbe-ai-hint {
    background: var(--bg); border: 1px dashed var(--line);
    border-radius: 6px; padding: 12px; font-size: 12px; color: var(--ink-3);
    line-height: 1.6;
}
.v3-cbe-ai-hint span { color: var(--teal-800); font-style: italic; }

.v3-cbe-ai-msg { display: flex; }
.v3-cbe-ai-msg.user { justify-content: flex-end; }
.v3-cbe-ai-msg.ai   { justify-content: flex-start; }
.v3-cbe-ai-msg-body {
    max-width: 85%; padding: 8px 12px; border-radius: 10px;
    font-size: 12.5px; line-height: 1.5; white-space: pre-wrap;
}
.v3-cbe-ai-msg.user .v3-cbe-ai-msg-body { background: var(--teal-800); color: #fff; }
.v3-cbe-ai-msg.ai   .v3-cbe-ai-msg-body { background: var(--teal-50);  color: var(--ink-2); }
.v3-cbe-ai-msg.pending .v3-cbe-ai-msg-body { color: var(--ink-4); font-style: italic; }

.v3-cbe-ai-foot {
    padding: 10px 12px; border-top: 1px solid var(--line-soft);
    display: flex; gap: 8px; align-items: flex-end;
}
.v3-cbe-ai-input {
    flex: 1; padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    font-family: inherit; font-size: 12.5px;
    resize: none; min-height: 44px; max-height: 140px;
}
.v3-cbe-ai-input:focus { outline: none; border-color: var(--teal-800); }
.v3-cbe-ai-send { flex: 0 0 auto; }

/* Structured build-plan card surfaced when the assistant returns json. */
.v3-cbe-ai-plan {
    margin-top: 8px;
    border: 1px solid var(--teal-100);
    background: var(--surface);
    border-radius: 8px;
    padding: 10px 12px;
}
.v3-cbe-ai-plan-h {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 6px;
}
.v3-cbe-ai-plan-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.v3-cbe-ai-plan-meta  { font-size: 11px;   color: var(--ink-4); font-family: var(--mono); }
.v3-cbe-ai-plan-list {
    list-style: none; margin: 0 0 10px; padding: 0;
    font-size: 12px; color: var(--ink-2);
    display: flex; flex-direction: column; gap: 4px;
}
.v3-cbe-ai-plan-list strong { color: var(--ink); }
.v3-cbe-ai-plan-fields { color: var(--ink-3); }

/* Display-image variant — both the runtime widget and the editor canvas card. */
.v3-sdcr-display-img { width: 100%; }
.v3-sdcr-display-img img { display: block; max-width: 100%; max-height: 280px; border-radius: 4px; object-fit: contain; }
.v3-sdcr-display-img.empty {
    padding: 24px; border: 1px dashed var(--line); border-radius: 6px;
    text-align: center; color: var(--ink-4); font-size: 12px;
}
.v3-cbp-display-img { width: 100%; min-height: 60px; padding: 6px; }
.v3-cbp-display-img img { display: block; max-width: 100%; max-height: 160px; border-radius: 4px; object-fit: contain; }

/* Description widget — soft info box styled like a Radzen "notification" tile. */
.v3-sdcr-description {
    border: 1px solid var(--teal-100);
    background: var(--teal-50);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12.5px; color: var(--ink-2);
    line-height: 1.45;
    white-space: pre-wrap; /* preserve author line breaks */
}
.v3-sdcr-description.empty {
    border-style: dashed;
    background: transparent;
    color: var(--ink-4); font-style: italic;
}
/* Editor canvas card preview of a Description — slightly toned down. */
.v3-cbp-description {
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: var(--bg);
    font-size: 12px; color: var(--ink-3);
    white-space: pre-wrap;
    min-height: 30px;
}
/* Properties-panel textarea for editing Description body. */
.v3-cbe-description-edit {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--line); border-radius: 5px;
    font-family: inherit; font-size: 12.5px; color: var(--ink-2);
    background: var(--surface); resize: vertical;
}
.v3-cbe-description-edit:focus { outline: none; border-color: var(--teal-800); }

/* Options list — compact rows */
.v3-cbe-options-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.v3-cbe-option-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 5px;
    align-items: center;
}
.v3-cbe-option-row input {
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 11.5px;
    flex: 1; min-width: 0;
    outline: none;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
}
.v3-cbe-option-row input.v3-cbp-mono { font-family: var(--mono); }
.v3-cbe-option-row input:focus { border-color: var(--teal-800); background: var(--surface); }

.v3-cbe-add-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border: 1px dashed var(--line);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    color: var(--ink-3);
    font-size: 11.5px;
    font-weight: 500;
}
.v3-cbe-add-option:hover { color: var(--teal-800); border-color: var(--teal-800); }

.v3-cbe-empty-mini {
    font-size: 11.5px;
    color: var(--ink-4);
    font-style: italic;
    padding: 4px 0;
}

/* Table-constraint authoring widget: a compact NxK grid where each row is a
   tuple of allowed/forbidden field values. Fields list above the grid lets
   the author choose which fields participate. */
.v3-cbe-tbl-fields {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 4px 0;
}
.v3-cbe-tbl-fields select {
    min-width: 140px;
}
.v3-cbe-tbl-rows {
    flex-direction: column !important;
    align-items: stretch !important;
}
.v3-cbe-tbl {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 12.5px;
}
.v3-cbe-tbl th {
    text-align: left;
    color: var(--ink-3);
    font-weight: 500;
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
}
.v3-cbe-tbl td {
    padding: 3px 4px;
    border-bottom: 1px dashed var(--line-soft);
}
.v3-cbe-tbl td select {
    width: 100%;
    min-width: 0;
}
.v3-cbe-tbl tr:hover td {
    background: rgba(17, 61, 79, 0.03);
}
/* Tuple-expansion badge: shows how many concrete tuples a row produces after
   wildcards are expanded. 1 (fully specified) gets a muted dot; >1 gets an
   amber chip so authors immediately see expansion cost. */
.v3-cbe-tbl-expand-h { text-align: center; width: 28px; color: var(--ink-4); }
.v3-cbe-tbl-expand   { text-align: center; width: 28px; }
.v3-cbe-tbl-expand-chip {
    display: inline-block;
    min-width: 18px; height: 18px; line-height: 18px;
    padding: 0 5px; border-radius: 9px;
    font-size: 11px; font-family: var(--mono); font-feature-settings: "tnum" 1;
    background: var(--bg); color: var(--ink-4); border: 1px solid var(--line-soft);
}
.v3-cbe-tbl-expand-chip.wide {
    background: #FFF4D1; color: #8a5a00; border-color: rgba(138, 90, 0, 0.22);
}

/* Constraint-set summary footer — pinned below the rule list. Plain-English
   counts of rules per kind + total tuple footprint across all table
   constraints. Lets authors gauge complexity at a glance. */
.v3-cbe-c-summary-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    margin-top: 10px;
    font-size: 12.5px;
}
.v3-cbe-c-summary-total {
    font-weight: 600; color: var(--ink); margin-right: 4px;
}
.v3-cbe-c-summary-pill {
    padding: 2px 8px; border-radius: 999px; font-size: 11.5px;
}
.v3-cbe-c-summary-tables {
    margin-left: auto; color: var(--ink-3); font-style: italic;
}

/* Default-value preview block */
.v3-cbe-default-preview {
    padding: 8px 0 4px;
}

/* Danger / icon-only buttons */
.v3-cbe-icon-btn {
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: background 120ms, color 120ms;
}
.v3-cbe-icon-btn:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-cbe-icon-btn-danger:hover { background: var(--red-50); color: var(--red); }

/* Section delete reveals on section hover/selection — keep visible always but quiet */
.v3-cbe-section .v3-cbe-icon-btn-danger { opacity: 0.55; transition: opacity 120ms; }
.v3-cbe-section:hover .v3-cbe-icon-btn-danger,
.v3-cbe-section.selected .v3-cbe-icon-btn-danger { opacity: 1; }

.v3-cbe-field-card .v3-cbe-icon-btn { opacity: 0; transition: opacity 120ms; }
.v3-cbe-field-card:hover .v3-cbe-icon-btn,
.v3-cbe-field-card.active .v3-cbe-icon-btn { opacity: 1; }

/* Big danger button (Delete field) */
.v3-cbe-danger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--red);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}
.v3-cbe-danger-btn:hover {
    background: var(--red-50);
    border-color: var(--red);
}

/* Section header is now the drag handle — show grab cursor */
.v3-cbe-section-h {
    cursor: grab;
}
.v3-cbe-section-h:active { cursor: grabbing; }
/* but inputs inside should still be a text cursor */
.v3-cbe-section-h input,
.v3-cbe-section-h button { cursor: auto; }
.v3-cbe-section-h .v3-cbe-icon-btn { cursor: pointer; }

/* While being dragged, fade the section out a bit */
.v3-cbe-section.dragging { opacity: 0.55; }

/* Tighter section h5 label */
.v3-cbe-props-section h5 {
    margin-bottom: 8px;
}

/* Make sure the v3-field selectors we used to use don't leak — none in here now */

/* ============================================================
   Constraints tab + kind-specific editors
   ============================================================ */

/* Constraints tab layout */
.v3-cbe-constraints {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 480px;
    flex: 1;
    min-height: 0;
}

.v3-cbe-c-list-pane {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.v3-cbe-c-toolbar {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.v3-cbe-c-toolbar h3 { margin: 0; font-size: 15px; font-weight: 600; }

.v3-cbe-c-kinds {
    display: flex; gap: 6px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    overflow-x: auto;
}
.v3-cbe-c-kind {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--surface);
    font-size: 12px; color: var(--ink-2);
    white-space: nowrap;
    cursor: pointer;
}
.v3-cbe-c-kind:hover { border-color: var(--ink-4); }
.v3-cbe-c-kind.on {
    border-color: var(--c-color, var(--teal-800));
    background: var(--c-soft, var(--teal-50));
    color: var(--c-color, var(--teal-800));
}
.v3-cbe-c-kind .ic {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    background: var(--bg); color: var(--ink-3);
    border-radius: 4px; font-weight: 600; font-size: 11px;
}
.v3-cbe-c-kind .ct { font-size: 10.5px; color: var(--ink-4); font-family: var(--mono); }

.v3-cbe-c-list {
    flex: 1; overflow-y: auto;
    padding: 16px 24px 80px;
    display: flex; flex-direction: column; gap: 8px;
}
.v3-cbe-c-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 10px; cursor: pointer;
    transition: border-color 120ms;
}
.v3-cbe-c-row:hover { border-color: var(--ink-4); }
.v3-cbe-c-row.active {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 3px var(--teal-50);
}
.v3-cbe-c-row.disabled { opacity: 0.55; }

.v3-cbe-c-icon {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    border-radius: 4px;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}
.v3-cbe-c-icon.lg { width: 28px; height: 28px; font-size: 13px; }

.v3-cbe-c-body { flex: 1; min-width: 0; }
.v3-cbe-c-name-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px;
}
.v3-cbe-c-kind-tag {
    font-size: 10px;
    padding: 1px 6px; border-radius: 3px;
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--mono);
}
.v3-cbe-c-row .v3-cbe-c-name {
    font-size: 13px; font-weight: 500; color: var(--ink);
}
.v3-cbe-c-summary {
    font-size: 11.5px; color: var(--ink-3);
}

.v3-cbe-c-switch {
    position: relative; display: inline-block;
    width: 30px; height: 17px;
    flex-shrink: 0; margin-top: 2px;
    cursor: pointer;
}
.v3-cbe-c-switch input { opacity: 0; width: 0; height: 0; }
.v3-cbe-c-switch span {
    position: absolute; inset: 0;
    background: var(--line); border-radius: 9px;
    transition: background 120ms;
}
.v3-cbe-c-switch span::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 13px; height: 13px; border-radius: 50%;
    background: var(--surface);
    transition: transform 120ms;
}
.v3-cbe-c-switch input:checked + span { background: var(--green); }
.v3-cbe-c-switch input:checked + span::after { transform: translateX(13px); }

/* Detail pane (editor) */
.v3-cbe-c-detail-pane {
    background: var(--surface);
    border-left: 1px solid var(--line);
    display: flex; flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.v3-cbe-c-editor-h {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.v3-cbe-c-name-input {
    flex: 1;
    background: transparent; border: 0; outline: 0;
    font-size: 15px; font-weight: 600;
    color: inherit;
    padding: 2px 0;
}
.v3-cbe-c-editor-body {
    flex: 1; overflow-y: auto;
    padding: 0;
}
.v3-cbe-c-editor-body .v3-cbe-props-section {
    padding: 14px 18px;
}

.v3-cbe-c-leaf {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 1.3fr auto;
    gap: 5px;
    margin-bottom: 5px;
    align-items: center;
}
.v3-cbe-c-leaf select, .v3-cbe-c-leaf input {
    padding: 4px 7px;
    border: 1px solid var(--line); border-radius: 4px;
    background: var(--bg); color: var(--ink);
    font-size: 11.5px; outline: none;
    width: 100%;
}
.v3-cbe-c-leaf select:focus, .v3-cbe-c-leaf input:focus {
    border-color: var(--teal-800); background: var(--surface);
}

.v3-cbe-c-preview {
    margin: 14px 18px 24px;
    padding: 12px 14px;
    background: var(--green-50);
    border: 1px solid color-mix(in oklab, var(--green) 30%, var(--green-50));
    border-radius: 10px;
}
.v3-cbe-c-preview-h {
    font-size: 10.5px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--green);
    font-weight: 600; font-family: var(--mono);
    margin-bottom: 8px;
}
.v3-cbe-c-preview-step {
    font-size: 12px; color: var(--ink-2);
    font-family: var(--mono);
}

/* Kind-specific editors */
.v3-cbe-swatch-edit { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.v3-cbe-swatch-row {
    display: grid;
    grid-template-columns: 22px 1fr 1fr auto;
    gap: 5px;
    align-items: center;
}
.v3-cbe-swatch-edit-chip {
    width: 22px; height: 22px; border-radius: 5px;
    border: 1px solid var(--line);
    display: block;
}
.v3-cbe-swatch-row input {
    padding: 4px 7px;
    border: 1px solid var(--line); border-radius: 4px;
    background: var(--bg); font-size: 11.5px; outline: none;
}
.v3-cbe-swatch-row input:focus { border-color: var(--teal-800); background: var(--surface); }

/* ============================================================
   Shared runtime renderer (.v3-sdcr-*) — used by Preview today,
   designed to lift into the runtime configurator unchanged.
   ============================================================ */
.v3-sdcr-form { display: flex; flex-direction: column; gap: 18px; }
.v3-sdcr-section { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.v3-sdcr-section-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.v3-sdcr-fields { display: flex; flex-direction: column; gap: 14px; }
.v3-sdcr-field { display: flex; flex-direction: column; gap: 6px; }
.v3-sdcr-label { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.v3-sdcr-req { color: var(--red); margin-left: 2px; font-weight: 600; }
.v3-sdcr-help { font-size: 11.5px; color: var(--ink-3); margin-top: -2px; }
.v3-sdcr-msg { font-size: 11.5px; padding: 4px 8px; border-radius: 4px; }
.v3-sdcr-msg-info    { background: var(--teal-50);  color: var(--teal-800); }
.v3-sdcr-msg-warning { background: var(--amber-50); color: var(--amber); }
.v3-sdcr-msg-error   { background: var(--red-50);   color: var(--red); }

.v3-sdcr-input {
    width: 100%; padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg); color: var(--ink);
    font-size: 13px; outline: none;
}
.v3-sdcr-input:focus { border-color: var(--teal-800); background: var(--surface); }
.v3-sdcr-textarea { min-height: 60px; resize: vertical; }
.v3-sdcr-mono { font-family: var(--mono); }
.v3-sdcr-unit { color: var(--ink-4); font-size: 11.5px; font-family: var(--mono); }

.v3-sdcr-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.v3-sdcr-toggle input { display: none; }
.v3-sdcr-toggle-pill {
    width: 32px; height: 18px; border-radius: 9px;
    background: var(--line); padding: 2px; display: inline-block;
    transition: background 120ms;
}
.v3-sdcr-toggle-pill span {
    display: block; width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); transition: transform 120ms;
}
.v3-sdcr-toggle-pill.on { background: var(--teal-800); }
.v3-sdcr-toggle-pill.on span { transform: translateX(14px); }
.v3-sdcr-toggle-lab { font-size: 12px; color: var(--ink-3); }

/* Single-checkbox variant (Boolean kind, Checkbox renderer). */
.v3-sdcr-single-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.v3-sdcr-single-check input { display: none; }
.v3-sdcr-check-box {
    width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line);
    background: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--teal-800); transition: background .15s, border-color .15s;
}
.v3-sdcr-check-box.on { background: var(--teal-800); border-color: var(--teal-800); color: #fff; }
.v3-sdcr-check-lab { font-size: 12px; color: var(--ink-3); }

.v3-sdcr-stepper {
    display: inline-flex; align-items: center;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
}
.v3-sdcr-stepper button {
    padding: 6px 12px; background: transparent; border: 0; cursor: pointer;
    color: var(--ink-2); font-size: 14px;
}
.v3-sdcr-stepper button:hover { background: var(--teal-50); color: var(--teal-800); }
.v3-sdcr-stepper span {
    padding: 6px 16px; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
    font-size: 12.5px; font-family: var(--mono); min-width: 70px; text-align: center;
}

.v3-sdcr-slider { display: flex; align-items: center; gap: 12px; }
.v3-sdcr-slider input[type=range] { flex: 1; accent-color: var(--teal-800); }
.v3-sdcr-slider-val { min-width: 80px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.v3-sdcr-dim {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 3px 6px; background: var(--bg);
}
.v3-sdcr-dim span {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 6px; border-right: 1px solid var(--line);
}
.v3-sdcr-dim span:last-child { border-right: 0; }
.v3-sdcr-dim i { font-style: normal; color: var(--ink-4); font-size: 10.5px; font-family: var(--mono); }
.v3-sdcr-dim input {
    width: 50px; padding: 2px 4px;
    border: 0; background: transparent;
    text-align: right; font-family: var(--mono); font-size: 12px;
    outline: none;
}

.v3-sdcr-rating { display: flex; gap: 4px; font-size: 20px; color: var(--ink-4); cursor: pointer; user-select: none; }
.v3-sdcr-rating span.on { color: var(--amber); }
.v3-sdcr-rating span:hover { color: var(--amber); }

/* Rows fit horizontally when the column is wide enough — auto-fit will wrap
   to the next line only when there isn't room. flex:1 makes the grid fill
   the parent .field-input (which is display:flex). */
.v3-sdcr-radio { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 5px; flex: 1; min-width: 0; }
.v3-sdcr-radio-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    font-size: 12.5px; color: var(--ink-2); background: var(--bg);
    cursor: pointer;
}
.v3-sdcr-radio-row:hover { border-color: var(--ink-4); }
.v3-sdcr-radio-row.on { border-color: var(--teal-800); background: var(--teal-50); color: var(--teal-800); }
.v3-sdcr-radio-row .dot {
    width: 12px; height: 12px; border-radius: 50%;
    border: 1.5px solid var(--ink-4); flex-shrink: 0;
}
.v3-sdcr-radio-row.on .dot {
    border-color: var(--teal-800);
    background: radial-gradient(circle, var(--teal-800) 40%, var(--surface) 45%);
}
.v3-sdcr-radio-row .price { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* Tacton-style per-option state. Applied to Radio rows, Segmented chips,
   Swatch buttons, Image cards/rows and Checkbox rows so the user sees at
   a glance which options are selectable freely (green = no marker — it's
   just the default), which would cascade (orange = amber border + corner
   pip) and which are impossible (red = strikethrough + dimmed). */
.opt-orange { position: relative; border-color: var(--amber) !important; }
.opt-orange::after {
    content: ""; position: absolute; top: 4px; right: 4px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
}
.opt-red {
    position: relative;
    opacity: 0.45; cursor: not-allowed !important;
    text-decoration: line-through;
    border-color: var(--red) !important;
}
.opt-red::after {
    content: "✕"; position: absolute; top: 2px; right: 6px;
    color: var(--red); font-size: 11px; line-height: 1; font-weight: 700;
}
/* Swatches get a coloured ring instead of the corner pip — the swatch's
   background colour fills the inside, so we can't show a dot in there. */
.v3-sdcr-swatch.opt-orange { box-shadow: 0 0 0 2px var(--amber); }
.v3-sdcr-swatch.opt-red    { box-shadow: 0 0 0 2px var(--red); opacity: 0.6; }
.v3-sdcr-swatch.opt-red::after { content: ""; }

/* Native <option> elements can only be styled with background-color + color in
   most browsers. Orange = amber tint with brown text; red = pale red with
   strikethrough + dim red text. These rules need higher specificity than the
   TCX `.opt-invalid` class on the same element — that one is also applied by
   the runtime when a domain value is marked invalid, and would otherwise win
   the cascade and paint orange options red too. Scope under the same chain
   the legacy rules use. */
.v3-cfg-root .field-input select option.opt-orange,
select option.opt-orange {
    background-color: #FFF4D1;
    color: #8a5a00;
    text-decoration: none;
}
.v3-cfg-root .field-input select option.opt-red,
select option.opt-red {
    background-color: #FBE3E0;
    color: #b23a2c;
    text-decoration: line-through;
}

/* Tacton-style cascade confirm popover. Fires when the user clicks an
   orange option; lists every cascading change so they decide whether to
   accept the trade-off. Fixed-position centre overlay with backdrop. */
.v3-sdcr-cascade-backdrop {
    position: fixed; inset: 0;
    background: rgba(17, 61, 79, 0.30);
    z-index: 998;
}
.v3-sdcr-cascade-pop {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px 18px;
    min-width: 320px; max-width: 480px;
    box-shadow: 0 14px 40px rgba(17, 61, 79, 0.20);
    z-index: 999;
}
.v3-sdcr-cascade-head {
    font-size: 14px; color: var(--ink); margin-bottom: 10px;
}
.v3-sdcr-cascade-head b { color: var(--teal-800); }
.v3-sdcr-cascade-list {
    list-style: none; padding: 0; margin: 0 0 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.v3-sdcr-cascade-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 193, 7, 0.08);
    border-left: 3px solid var(--amber);
    border-radius: 4px;
    font-size: 13px;
}
.v3-sdcr-cascade-list .cas-fld {
    font-family: var(--mono); color: var(--ink); font-size: 12px;
}
.v3-sdcr-cascade-list .cas-from {
    color: var(--ink-3); text-decoration: line-through; margin-left: auto;
}
.v3-sdcr-cascade-list .cas-arrow { color: var(--ink-4); }
.v3-sdcr-cascade-list .cas-to {
    color: var(--teal-800); font-weight: 600;
}
.v3-sdcr-cascade-actions {
    display: flex; justify-content: flex-end; gap: 8px;
}

.v3-sdcr-seg {
    display: inline-flex; background: var(--bg);
    border: 1px solid var(--line); border-radius: 6px;
    padding: 2px; gap: 2px;
}
.v3-sdcr-seg span {
    padding: 5px 14px; font-size: 12.5px; color: var(--ink-3);
    border-radius: 4px; cursor: pointer;
}
.v3-sdcr-seg span.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 rgba(17,61,79,0.04); }

.v3-sdcr-img-radio { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; flex: 1; min-width: 0; }
.v3-sdcr-img-card {
    position: relative;
    border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; background: var(--surface); cursor: pointer;
    display: flex; flex-direction: column;
    transition: border-color 120ms, box-shadow 120ms, transform 120ms;
    /* Cards on the same grid row already stretch to equal heights, but pin a
       min ratio so a single card on a row keeps its proportions. */
    min-height: 0;
}
.v3-sdcr-img-card:hover {
    border-color: var(--ink-4);
    box-shadow: 0 2px 8px rgba(17, 61, 79, 0.06);
    transform: translateY(-1px);
}
.v3-sdcr-img-card.on {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 1px var(--teal-800), 0 4px 12px rgba(17, 61, 79, 0.10);
}
/* Subtle teal check badge in the upper-right when selected. */
.v3-sdcr-img-card.on::after {
    content: "✓";
    position: absolute; top: 6px; right: 6px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--teal-800); color: #fff;
    font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
    box-shadow: 0 1px 3px rgba(17, 61, 79, 0.30);
}
/* Padding-bottom ratio trick — strictly locks the thumb to 4:3 regardless of
   the contained image's intrinsic dimensions. aspect-ratio is advisory and
   can be overridden by an oversized child. */
.v3-sdcr-img-thumb {
    position: relative;
    width: 100%; height: 0;
    padding-bottom: 75%; /* 4:3 = height is 75% of width */
    background:
        repeating-linear-gradient(45deg,
            var(--bg) 0 8px,
            var(--line-soft) 8px 9px);
    color: var(--ink-4); font-size: 18px;
    border-bottom: 1px solid var(--line-soft);
    overflow: hidden;
}
/* When the thumb has no image, show a subtle icon hint, centered in the box. */
.v3-sdcr-img-thumb:empty::before {
    content: "▦"; opacity: 0.4; font-size: 24px;
    position: absolute; inset: 0;
    display: grid; place-items: center;
}
.v3-sdcr-img-thumb img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.v3-sdcr-img-thumb-sm {
    aspect-ratio: auto; height: 40px; width: 60px;
    border-radius: 5px; flex-shrink: 0; border: 1px solid var(--line-soft);
}
/* Fixed-size footer so cards with sub-label and cards without are visually
   identical. Sub renders as &nbsp; when empty — keeps the row reserved. */
.v3-sdcr-img-foot {
    padding: 8px 10px 10px;
    display: flex; flex-direction: column;
    flex: 1; justify-content: flex-start;
}
.v3-sdcr-img-name {
    font-size: 12.5px; font-weight: 500; color: var(--ink);
    line-height: 1.25;
}
.v3-sdcr-img-sub  {
    font-size: 11px; color: var(--ink-3);
    line-height: 1.3;
    min-height: 14px; /* always reserve a line, even when SubLabel is empty */
}
.v3-sdcr-img-card.on .v3-sdcr-img-name { color: var(--teal-800); }

.v3-sdcr-img-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; flex: 1; min-width: 0; }
.v3-sdcr-img-list-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
    cursor: pointer;
}
.v3-sdcr-img-list-row.on { border-color: var(--teal-800); background: var(--teal-50); }
.v3-sdcr-img-list-row .price { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.v3-sdcr-swatches { display: flex; gap: 8px; }
.v3-sdcr-swatch {
    width: 28px; height: 28px;
    border-radius: 6px; border: 1px solid var(--line);
    cursor: pointer; padding: 0;
}
.v3-sdcr-swatch.on { box-shadow: 0 0 0 2px var(--teal-800); }

.v3-sdcr-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 5px; flex: 1; min-width: 0; }
.v3-sdcr-check-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    font-size: 12.5px; color: var(--ink-2); background: var(--bg);
    cursor: pointer;
}
.v3-sdcr-check-row.on { border-color: var(--teal-800); background: var(--teal-50); color: var(--teal-800); }
.v3-sdcr-check-row .box {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--ink-4);
    display: grid; place-items: center;
    font-size: 9px; color: var(--surface); flex-shrink: 0;
}
.v3-sdcr-check-row.on .box { background: var(--teal-800); border-color: var(--teal-800); }
.v3-sdcr-check-row .price { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.v3-sdcr-chips {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 5px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
}
.v3-sdcr-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 4px;
    background: var(--teal-50); color: var(--teal-800);
    font-size: 11.5px; font-family: var(--mono);
}
.v3-sdcr-chip i { font-style: normal; cursor: pointer; opacity: 0.7; }
.v3-sdcr-chip i:hover { opacity: 1; }
.v3-sdcr-chip-input {
    background: transparent; border: 0; outline: 0;
    padding: 3px 4px; font-size: 12px; flex: 1; min-width: 100px;
}

.v3-sdcr-matrix {
    padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
    font-size: 12px; color: var(--ink-3); font-family: var(--mono);
}
.v3-sdcr-file {
    padding: 16px; border: 1.5px dashed var(--line); border-radius: 6px;
    text-align: center; font-size: 12.5px; color: var(--ink-3);
    background: var(--bg);
}

.v3-sdcr-empty { padding: 60px 20px; text-align: center; color: var(--ink-3); }

/* ============================================================
   Preview tab layout (.v3-cbe-preview*)
   ============================================================ */
.v3-cbe-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    flex: 1;
    min-height: 0;
    padding: 24px;
    gap: 16px;
    background: var(--bg);
    overflow-y: auto;
}
.v3-cbe-preview-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    align-self: start;
}
.v3-cbe-preview-h {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--green-50);
}
.v3-cbe-preview-h h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--green); }
.v3-cbe-preview-h-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green);
}
.v3-cbe-preview-body { padding: 18px; max-height: calc(100vh - 240px); overflow-y: auto; }

.v3-cbe-preview-side { display: flex; flex-direction: column; gap: 12px; }
.v3-cbe-preview-side-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.v3-cbe-preview-side-h {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 11.5px; font-weight: 600; color: var(--ink-2);
    background: var(--bg);
}
.v3-cbe-preview-side-rules { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.v3-cbe-rule {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 6px 8px; border-radius: 6px;
    font-size: 11.5px;
}
.v3-cbe-rule-warning { background: var(--amber-50); }
.v3-cbe-rule-error   { background: var(--red-50); }
.v3-cbe-rule-info    { background: transparent; }
.v3-cbe-rule-body { flex: 1; min-width: 0; }
.v3-cbe-rule-name { font-weight: 500; color: var(--ink); }
.v3-cbe-rule-summary { color: var(--ink-3); font-size: 11px; font-family: var(--mono); }

/* ============================================================
   WYSIWYG layout — column picker / span picker / render-as picker
   + canvas + runtime grid layout
   ============================================================ */

/* Canvas fields container becomes a CSS grid when section.LayoutColumns > 1 */
.v3-cbe-fields[data-cols="1"] { display: flex; flex-direction: column; gap: 8px; }
.v3-cbe-fields[data-cols="2"],
.v3-cbe-fields[data-cols="3"],
.v3-cbe-fields[data-cols="4"] {
    display: grid;
    gap: 8px;
    padding: 4px;
    min-height: 30px;
}
.v3-cbe-fields[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.v3-cbe-fields[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-cbe-fields[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

/* The "drop hint" empty state should span the whole row in a grid */
.v3-cbe-fields[data-cols="2"] .v3-cbe-drop-hint,
.v3-cbe-fields[data-cols="3"] .v3-cbe-drop-hint,
.v3-cbe-fields[data-cols="4"] .v3-cbe-drop-hint { grid-column: 1 / -1; }

/* Column picker in the section header */
.v3-cbe-cols-picker {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 6px;
    margin-left: 6px;
}
.v3-cbe-cols-label {
    font-size: 10px; color: var(--ink-4);
    padding: 0 5px;
    font-family: var(--mono);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.v3-cbe-cols-picker button {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 7px; border-radius: 4px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-3);
}
.v3-cbe-cols-picker button:hover { background: var(--bg); }
.v3-cbe-cols-picker button.on { background: var(--teal-800); color: #fff; }
.v3-cbe-cols-glyph {
    display: inline-flex; gap: 1.5px; align-items: stretch;
    height: 11px;
}
.v3-cbe-cols-glyph i {
    display: inline-block; background: currentColor; border-radius: 1px;
}
.v3-cbe-cols-glyph[data-cols="1"] i { width: 13px; }
.v3-cbe-cols-glyph[data-cols="2"] i { width: 5.5px; }
.v3-cbe-cols-glyph[data-cols="3"] i { width: 3.5px; }
.v3-cbe-cols-glyph[data-cols="4"] i { width: 2.5px; }

/* Span picker in the field card head */
.v3-cbe-span-picker {
    display: inline-flex; gap: 1px;
    padding: 2px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 5px;
}
.v3-cbe-span-picker button {
    padding: 2px 6px; border-radius: 3px;
    border: 0; background: transparent; cursor: pointer;
    font-size: 11px; color: var(--ink-3);
    font-family: var(--mono); min-width: 16px;
}
.v3-cbe-span-picker button:hover { background: var(--surface); }
.v3-cbe-span-picker button.on { background: var(--teal-800); color: #fff; }

/* Render-as picker in properties pane */
.v3-cbe-render-picker {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
}
.v3-cbe-render-choice {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--bg);
    cursor: pointer; text-align: left;
    transition: border-color 120ms, background 120ms;
}
.v3-cbe-render-choice:hover { border-color: var(--teal-800); }
.v3-cbe-render-choice.on { background: var(--teal-50); border-color: var(--teal-800); }
.v3-cbe-render-icon {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--surface); color: var(--teal-800);
    border-radius: 5px;
    font-weight: 600; font-size: 13px;
    font-family: var(--mono);
    flex-shrink: 0;
    border: 1px solid var(--line);
}
.v3-cbe-render-choice.on .v3-cbe-render-icon {
    background: var(--teal-800); color: #fff; border-color: var(--teal-800);
}
.v3-cbe-render-name { font-size: 12px; font-weight: 500; color: var(--ink); }

/* Runtime renderer grid */
.v3-sdcr-fields[data-cols="1"] { display: flex; flex-direction: column; gap: 14px; }
.v3-sdcr-fields[data-cols="2"],
.v3-sdcr-fields[data-cols="3"],
.v3-sdcr-fields[data-cols="4"] {
    display: grid;
    gap: 14px;
}
.v3-sdcr-fields[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.v3-sdcr-fields[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-sdcr-fields[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   Pages — editor tab strip + runtime left menu
   ============================================================ */

/* Editor: page tabs strip between top bar and canvas */
.v3-cbe-pagetabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 8px 24px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.v3-cbe-pagetab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: var(--bg);
    font-size: 12.5px;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    bottom: -1px;
}
.v3-cbe-pagetab:hover { color: var(--teal-800); }
.v3-cbe-pagetab.on {
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    border-color: var(--line);
    border-bottom-color: var(--surface);
}
.v3-cbe-pagetab-title {
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    color: inherit;
    padding: 2px 4px;
    width: 110px;
    min-width: 60px;
}
.v3-cbe-pagetab-title:focus {
    background: var(--bg);
    box-shadow: 0 0 0 2px var(--teal-100);
    border-radius: 3px;
}
.v3-cbe-pagetab-del {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    border: 0; background: transparent;
    color: var(--ink-4);
    font-size: 14px; line-height: 1;
    cursor: pointer;
    border-radius: 3px;
}
.v3-cbe-pagetab-del:hover { background: var(--red-50); color: var(--red); }
.v3-cbe-pagetab-add {
    display: inline-flex; align-items: center;
    padding: 6px 9px;
    border: 1px dashed var(--line);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    bottom: -1px;
}
.v3-cbe-pagetab-add:hover { color: var(--teal-800); border-color: var(--teal-800); }

/* Runtime: left page nav (TCX-style) */
.v3-sdcr-shell {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}
.v3-sdcr-pagenav {
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding: 14px 8px;
    min-width: 0;
}
.v3-sdcr-pagenav-h {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-4);
    font-weight: 600;
    font-family: var(--mono);
    padding: 0 8px 8px;
}
.v3-sdcr-pagenav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 2px;
}
.v3-sdcr-pagenav-item:hover { background: var(--surface); }
.v3-sdcr-pagenav-item.active {
    background: var(--teal-50);
    color: var(--teal-800);
    font-weight: 500;
}
.v3-sdcr-pagenav-no {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-4);
    min-width: 14px;
}
.v3-sdcr-pagenav-item.active .v3-sdcr-pagenav-no { color: var(--teal-700); }
.v3-sdcr-pagenav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-sdcr-pagebody { padding: 16px 20px; }

/* ============================================================
   Preview polish — matrix grid, committed-rows card, stronger
   section headers in the runtime renderer.
   ============================================================ */

/* Stronger section headers in the runtime form */
.v3-sdcr-sec {
    padding: 16px 18px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.v3-sdcr-sec-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.005em;
    border-bottom: 1px solid var(--line-soft);
}

/* Matrix grid (runtime) */
.v3-sdcr-matrix-grid {
    border-collapse: collapse;
    width: 100%;
    max-width: 480px;
    font-size: 12px;
}
.v3-sdcr-matrix-grid th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 500;
    color: var(--ink-2);
    background: var(--bg);
    border: 1px solid var(--line);
}
.v3-sdcr-matrix-grid thead th { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }
.v3-sdcr-matrix-grid td {
    padding: 6px;
    border: 1px solid var(--line);
    text-align: center;
    background: var(--surface);
    cursor: pointer;
}
.v3-sdcr-matrix-grid td:hover { background: var(--teal-50); }
.v3-sdcr-matrix-cell {
    display: inline-block;
    width: 12px; height: 12px; border-radius: 50%;
    border: 1.5px solid var(--ink-4);
    background: transparent;
}
.v3-sdcr-matrix-cell.on {
    border-color: var(--teal-800);
    background: radial-gradient(circle, var(--teal-800) 45%, var(--surface) 50%);
}

/* "Configuration so far" rows in preview side panel */
.v3-cbe-committed {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 6px 9px;
    border-radius: 5px;
    font-size: 11.5px;
    align-items: baseline;
}
.v3-cbe-committed.empty { color: var(--ink-4); }
.v3-cbe-committed.set { color: var(--ink); background: var(--teal-50); }
.v3-cbe-committed-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink-3);
}
.v3-cbe-committed.set .v3-cbe-committed-label { color: var(--teal-800); }
.v3-cbe-committed-value {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-2);
    text-align: right;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Image lightbox / full-screen preview ===== */
.v3-img-preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: v3-fdrawer-fade .15s ease-out;
    cursor: zoom-out;
}
.v3-img-preview-img {
    max-width: 92vw;
    max-height: 90vh;
    border-radius: var(--r-md);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    cursor: default;
    object-fit: contain;
}
.v3-img-preview-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 120ms;
}
.v3-img-preview-close:hover { background: rgba(255,255,255,0.28); }
.v3-cbe-committed.set .v3-cbe-committed-value { color: var(--teal-800); font-weight: 500; }
/* ===== User Overview Dashboard (.v3-uod-*) ===== */

/* Thin colored accent stripe at the top of the profile card */
.v3-uod-band {
    height: 4px;
    flex-shrink: 0;
    width: 100%;
}

/* Profile card wrapper */
.v3-uod-profile-card { overflow: visible !important; }

/* Profile row: avatar | info | stats — single horizontal strip */
.v3-uod-profile-body {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    flex-wrap: wrap;
}

/* Avatar — shared base */
.v3-uod-av {
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.02em;
}
.v3-uod-av-lg {
    width: 72px;
    height: 72px;
    font-size: 22px;
    border: 2.5px solid transparent;
    box-shadow: 0 0 0 1px var(--line);
}
.v3-uod-av-sm {
    width: 44px;
    height: 44px;
    font-size: 14px;
}

/* User info block */
.v3-uod-info {
    flex: 1;
    min-width: 180px;
}
.v3-uod-info-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.v3-uod-info-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--ink-3);
    margin-top: 3px;
}
.v3-uod-info-row svg { flex-shrink: 0; width: 13px; height: 13px; }
.v3-uod-info-row b { color: var(--ink); font-weight: 600; }

/* Active / Inactive status pills */
.v3-uod-pill-active,
.v3-uod-pill-inactive {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.v3-uod-pill-active  { background: var(--green-50); color: var(--green); }
.v3-uod-pill-inactive { background: var(--red-50);   color: var(--red);   }

/* Stat boxes row — pushed to the right */
.v3-uod-stats {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    align-items: stretch;
}
.v3-uod-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 18px 12px;
    border-radius: var(--r-md);
    border: 1.5px solid transparent;
    min-width: 88px;
    text-align: center;
}
.v3-uod-stat-num {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}
.v3-uod-stat-label {
    font-size: 11px;
    color: var(--ink-3);
    white-space: nowrap;
    font-weight: 500;
    line-height: 1.3;
}

/* Chart card header row */
.v3-uod-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 6px;
    gap: 12px;
    flex-wrap: wrap;
}
.v3-uod-chart-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.v3-uod-chart-icon svg { width: 16px; height: 16px; }
.v3-uod-chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.v3-uod-chart-sub {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 1px;
}

/* Chart body: chart left + ranked list right */
.v3-uod-chart-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 0;
    padding: 16px 0 0;
}
@media (max-width: 860px) {
    .v3-uod-chart-body { grid-template-columns: 1fr; }
    .v3-uod-ranked { border-left: none; border-top: 1px solid var(--line-soft); }
}
.v3-uod-chart-wrap {
    padding: 0 20px 20px;
    min-height: 220px;
}
.v3-uod-ranked {
    border-left: 1px solid var(--line-soft);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}
.v3-uod-ranked-item {
    border-radius: var(--r-sm);
    border-left: 3px solid transparent;
    padding: 8px 10px 6px;
}
.v3-uod-ranked-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.v3-uod-ranked-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--mono);
}
.v3-uod-ranked-label {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    color: var(--ink-2);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v3-uod-ranked-val {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.v3-uod-ranked-pct {
    font-size: 10.5px;
    color: var(--ink-4);
    font-family: var(--mono);
    text-align: right;
}
.v3-uod-mini-bar {
    height: 4px;
    background: var(--line-soft);
    border-radius: 2px;
    overflow: hidden;
}
.v3-uod-mini-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 400ms ease;
}

/* Config table section header */
.v3-uod-tbl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.v3-uod-search { width: 220px; }

/* User selection strip (chip list) */
.v3-uod-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.v3-uod-strip-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}
.v3-uod-strip-search { width: 220px; }
.v3-uod-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.v3-uod-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    border: 1.5px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 120ms, box-shadow 120ms, background 120ms;
    min-width: 80px;
    text-align: center;
}
.v3-uod-chip:hover { border-color: var(--ink-4); background: var(--bg); }
.v3-uod-chip-on { font-weight: 600; }
.v3-uod-chip-fn { font-size: 12px; font-weight: 600; color: var(--ink); }
.v3-uod-chip-ln { font-size: 11px; color: var(--ink-3); }
.v3-uod-chip-badge {
    font-size: 10px;
    font-family: var(--mono);
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.opt-red {
    position: relative;
    opacity: 0.45; cursor: not-allowed !important;
    text-decoration: line-through;
    border-color: var(--red) !important;
}
.opt-red::after {
    content: "✕"; position: absolute; top: 2px; right: 6px;
    color: var(--red); font-size: 11px; line-height: 1; font-weight: 700;
}
/* Swatches get a coloured ring instead of the corner pip — the swatch's
   background colour fills the inside, so we can't show a dot in there. */
.v3-sdcr-swatch.opt-orange { box-shadow: 0 0 0 2px var(--amber); }
.v3-sdcr-swatch.opt-red    { box-shadow: 0 0 0 2px var(--red); opacity: 0.6; }
.v3-sdcr-swatch.opt-red::after { content: ""; }

/* Native <option> elements can only be styled with background-color + color in
   most browsers. Orange = amber tint with brown text; red = pale red with
   strikethrough + dim red text. These rules need higher specificity than the
   TCX `.opt-invalid` class on the same element — that one is also applied by
   the runtime when a domain value is marked invalid, and would otherwise win
   the cascade and paint orange options red too. Scope under the same chain
   the legacy rules use. */
.v3-cfg-root .field-input select option.opt-orange,
select option.opt-orange {
    background-color: #FFF4D1;
    color: #8a5a00;
    text-decoration: none;
}
.v3-cfg-root .field-input select option.opt-red,
select option.opt-red {
    background-color: #FBE3E0;
    color: #b23a2c;
    text-decoration: line-through;
}

/* Tacton-style cascade confirm popover. Fires when the user clicks an
   orange option; lists every cascading change so they decide whether to
   accept the trade-off. Fixed-position centre overlay with backdrop. */
.v3-sdcr-cascade-backdrop {
    position: fixed; inset: 0;
    background: rgba(17, 61, 79, 0.30);
    z-index: 998;
}
.v3-sdcr-cascade-pop {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px 18px;
    min-width: 320px; max-width: 480px;
    box-shadow: 0 14px 40px rgba(17, 61, 79, 0.20);
    z-index: 999;
}
.v3-sdcr-cascade-head {
    font-size: 14px; color: var(--ink); margin-bottom: 10px;
}
.v3-sdcr-cascade-head b { color: var(--teal-800); }
.v3-sdcr-cascade-list {
    list-style: none; padding: 0; margin: 0 0 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.v3-sdcr-cascade-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 193, 7, 0.08);
    border-left: 3px solid var(--amber);
    border-radius: 4px;
    font-size: 13px;
}
.v3-sdcr-cascade-list .cas-fld {
    font-family: var(--mono); color: var(--ink); font-size: 12px;
}
.v3-sdcr-cascade-list .cas-from {
    color: var(--ink-3); text-decoration: line-through; margin-left: auto;
}
.v3-sdcr-cascade-list .cas-arrow { color: var(--ink-4); }
.v3-sdcr-cascade-list .cas-to {
    color: var(--teal-800); font-weight: 600;
}
.v3-sdcr-cascade-actions {
    display: flex; justify-content: flex-end; gap: 8px;
}

.v3-sdcr-seg {
    display: inline-flex; background: var(--bg);
    border: 1px solid var(--line); border-radius: 6px;
    padding: 2px; gap: 2px;
}
.v3-sdcr-seg span {
    padding: 5px 14px; font-size: 12.5px; color: var(--ink-3);
    border-radius: 4px; cursor: pointer;
}
.v3-sdcr-seg span.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 rgba(17,61,79,0.04); }

.v3-sdcr-img-radio { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; flex: 1; min-width: 0; }
.v3-sdcr-img-card {
    position: relative;
    border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; background: var(--surface); cursor: pointer;
    display: flex; flex-direction: column;
    transition: border-color 120ms, box-shadow 120ms, transform 120ms;
    /* Cards on the same grid row already stretch to equal heights, but pin a
       min ratio so a single card on a row keeps its proportions. */
    min-height: 0;
}
.v3-sdcr-img-card:hover {
    border-color: var(--ink-4);
    box-shadow: 0 2px 8px rgba(17, 61, 79, 0.06);
    transform: translateY(-1px);
}
.v3-sdcr-img-card.on {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 1px var(--teal-800), 0 4px 12px rgba(17, 61, 79, 0.10);
}
/* Subtle teal check badge in the upper-right when selected. */
.v3-sdcr-img-card.on::after {
    content: "✓";
    position: absolute; top: 6px; right: 6px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--teal-800); color: #fff;
    font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
    box-shadow: 0 1px 3px rgba(17, 61, 79, 0.30);
}
/* Padding-bottom ratio trick — strictly locks the thumb to 4:3 regardless of
   the contained image's intrinsic dimensions. aspect-ratio is advisory and
   can be overridden by an oversized child. */
.v3-sdcr-img-thumb {
    position: relative;
    width: 100%; height: 0;
    padding-bottom: 75%; /* 4:3 = height is 75% of width */
    background:
        repeating-linear-gradient(45deg,
            var(--bg) 0 8px,
            var(--line-soft) 8px 9px);
    color: var(--ink-4); font-size: 18px;
    border-bottom: 1px solid var(--line-soft);
    overflow: hidden;
}
/* When the thumb has no image, show a subtle icon hint, centered in the box. */
.v3-sdcr-img-thumb:empty::before {
    content: "▦"; opacity: 0.4; font-size: 24px;
    position: absolute; inset: 0;
    display: grid; place-items: center;
}
.v3-sdcr-img-thumb img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.v3-sdcr-img-thumb-sm {
    aspect-ratio: auto; height: 40px; width: 60px;
    border-radius: 5px; flex-shrink: 0; border: 1px solid var(--line-soft);
}
/* Fixed-size footer so cards with sub-label and cards without are visually
   identical. Sub renders as &nbsp; when empty — keeps the row reserved. */
.v3-sdcr-img-foot {
    padding: 8px 10px 10px;
    display: flex; flex-direction: column;
    flex: 1; justify-content: flex-start;
}
.v3-sdcr-img-name {
    font-size: 12.5px; font-weight: 500; color: var(--ink);
    line-height: 1.25;
}
.v3-sdcr-img-sub  {
    font-size: 11px; color: var(--ink-3);
    line-height: 1.3;
    min-height: 14px; /* always reserve a line, even when SubLabel is empty */
}
.v3-sdcr-img-card.on .v3-sdcr-img-name { color: var(--teal-800); }

.v3-sdcr-img-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; flex: 1; min-width: 0; }
.v3-sdcr-img-list-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
    cursor: pointer;
}
.v3-sdcr-img-list-row.on { border-color: var(--teal-800); background: var(--teal-50); }
.v3-sdcr-img-list-row .price { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.v3-sdcr-swatches { display: flex; gap: 8px; }
.v3-sdcr-swatch {
    width: 28px; height: 28px;
    border-radius: 6px; border: 1px solid var(--line);
    cursor: pointer; padding: 0;
}
.v3-sdcr-swatch.on { box-shadow: 0 0 0 2px var(--teal-800); }

.v3-sdcr-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 5px; flex: 1; min-width: 0; }
.v3-sdcr-check-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    font-size: 12.5px; color: var(--ink-2); background: var(--bg);
    cursor: pointer;
}
.v3-sdcr-check-row.on { border-color: var(--teal-800); background: var(--teal-50); color: var(--teal-800); }
.v3-sdcr-check-row .box {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--ink-4);
    display: grid; place-items: center;
    font-size: 9px; color: var(--surface); flex-shrink: 0;
}
.v3-sdcr-check-row.on .box { background: var(--teal-800); border-color: var(--teal-800); }
.v3-sdcr-check-row .price { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.v3-sdcr-chips {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 5px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg);
}
.v3-sdcr-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 4px;
    background: var(--teal-50); color: var(--teal-800);
    font-size: 11.5px; font-family: var(--mono);
}
.v3-sdcr-chip i { font-style: normal; cursor: pointer; opacity: 0.7; }
.v3-sdcr-chip i:hover { opacity: 1; }
.v3-sdcr-chip-input {
    background: transparent; border: 0; outline: 0;
    padding: 3px 4px; font-size: 12px; flex: 1; min-width: 100px;
}

.v3-sdcr-matrix {
    padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
    font-size: 12px; color: var(--ink-3); font-family: var(--mono);
}
.v3-sdcr-file {
    padding: 16px; border: 1.5px dashed var(--line); border-radius: 6px;
    text-align: center; font-size: 12.5px; color: var(--ink-3);
    background: var(--bg);
}

.v3-sdcr-empty { padding: 60px 20px; text-align: center; color: var(--ink-3); }

/* ============================================================
   Preview tab layout (.v3-cbe-preview*)
   ============================================================ */
.v3-cbe-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    flex: 1;
    min-height: 0;
    padding: 24px;
    gap: 16px;
    background: var(--bg);
    overflow-y: auto;
}
.v3-cbe-preview-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    align-self: start;
}
.v3-cbe-preview-h {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--green-50);
}
.v3-cbe-preview-h h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--green); }
.v3-cbe-preview-h-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green);
}
.v3-cbe-preview-body { padding: 18px; max-height: calc(100vh - 240px); overflow-y: auto; }

.v3-cbe-preview-side { display: flex; flex-direction: column; gap: 12px; }
.v3-cbe-preview-side-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.v3-cbe-preview-side-h {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 11.5px; font-weight: 600; color: var(--ink-2);
    background: var(--bg);
}
.v3-cbe-preview-side-rules { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.v3-cbe-rule {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 6px 8px; border-radius: 6px;
    font-size: 11.5px;
}
.v3-cbe-rule-warning { background: var(--amber-50); }
.v3-cbe-rule-error   { background: var(--red-50); }
.v3-cbe-rule-info    { background: transparent; }
.v3-cbe-rule-body { flex: 1; min-width: 0; }
.v3-cbe-rule-name { font-weight: 500; color: var(--ink); }
.v3-cbe-rule-summary { color: var(--ink-3); font-size: 11px; font-family: var(--mono); }

/* ============================================================
   WYSIWYG layout — column picker / span picker / render-as picker
   + canvas + runtime grid layout
   ============================================================ */

/* Canvas fields container becomes a CSS grid when section.LayoutColumns > 1 */
.v3-cbe-fields[data-cols="1"] { display: flex; flex-direction: column; gap: 8px; }
.v3-cbe-fields[data-cols="2"],
.v3-cbe-fields[data-cols="3"],
.v3-cbe-fields[data-cols="4"] {
    display: grid;
    gap: 8px;
    padding: 4px;
    min-height: 30px;
}
.v3-cbe-fields[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.v3-cbe-fields[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-cbe-fields[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

/* The "drop hint" empty state should span the whole row in a grid */
.v3-cbe-fields[data-cols="2"] .v3-cbe-drop-hint,
.v3-cbe-fields[data-cols="3"] .v3-cbe-drop-hint,
.v3-cbe-fields[data-cols="4"] .v3-cbe-drop-hint { grid-column: 1 / -1; }

/* Column picker in the section header */
.v3-cbe-cols-picker {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 6px;
    margin-left: 6px;
}
.v3-cbe-cols-label {
    font-size: 10px; color: var(--ink-4);
    padding: 0 5px;
    font-family: var(--mono);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.v3-cbe-cols-picker button {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 7px; border-radius: 4px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-3);
}
.v3-cbe-cols-picker button:hover { background: var(--bg); }
.v3-cbe-cols-picker button.on { background: var(--teal-800); color: #fff; }
.v3-cbe-cols-glyph {
    display: inline-flex; gap: 1.5px; align-items: stretch;
    height: 11px;
}
.v3-cbe-cols-glyph i {
    display: inline-block; background: currentColor; border-radius: 1px;
}
.v3-cbe-cols-glyph[data-cols="1"] i { width: 13px; }
.v3-cbe-cols-glyph[data-cols="2"] i { width: 5.5px; }
.v3-cbe-cols-glyph[data-cols="3"] i { width: 3.5px; }
.v3-cbe-cols-glyph[data-cols="4"] i { width: 2.5px; }

/* Span picker in the field card head */
.v3-cbe-span-picker {
    display: inline-flex; gap: 1px;
    padding: 2px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 5px;
}
.v3-cbe-span-picker button {
    padding: 2px 6px; border-radius: 3px;
    border: 0; background: transparent; cursor: pointer;
    font-size: 11px; color: var(--ink-3);
    font-family: var(--mono); min-width: 16px;
}
.v3-cbe-span-picker button:hover { background: var(--surface); }
.v3-cbe-span-picker button.on { background: var(--teal-800); color: #fff; }

/* Render-as picker in properties pane */
.v3-cbe-render-picker {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
}
.v3-cbe-render-choice {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--bg);
    cursor: pointer; text-align: left;
    transition: border-color 120ms, background 120ms;
}
.v3-cbe-render-choice:hover { border-color: var(--teal-800); }
.v3-cbe-render-choice.on { background: var(--teal-50); border-color: var(--teal-800); }
.v3-cbe-render-icon {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--surface); color: var(--teal-800);
    border-radius: 5px;
    font-weight: 600; font-size: 13px;
    font-family: var(--mono);
    flex-shrink: 0;
    border: 1px solid var(--line);
}
.v3-cbe-render-choice.on .v3-cbe-render-icon {
    background: var(--teal-800); color: #fff; border-color: var(--teal-800);
}
.v3-cbe-render-name { font-size: 12px; font-weight: 500; color: var(--ink); }

/* Runtime renderer grid */
.v3-sdcr-fields[data-cols="1"] { display: flex; flex-direction: column; gap: 14px; }
.v3-sdcr-fields[data-cols="2"],
.v3-sdcr-fields[data-cols="3"],
.v3-sdcr-fields[data-cols="4"] {
    display: grid;
    gap: 14px;
}
.v3-sdcr-fields[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.v3-sdcr-fields[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.v3-sdcr-fields[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   Pages — editor tab strip + runtime left menu
   ============================================================ */

/* Editor: page tabs strip between top bar and canvas */
.v3-cbe-pagetabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 8px 24px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.v3-cbe-pagetab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: var(--bg);
    font-size: 12.5px;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    bottom: -1px;
}
.v3-cbe-pagetab:hover { color: var(--teal-800); }
.v3-cbe-pagetab.on {
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    border-color: var(--line);
    border-bottom-color: var(--surface);
}
.v3-cbe-pagetab-title {
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    color: inherit;
    padding: 2px 4px;
    width: 110px;
    min-width: 60px;
}
.v3-cbe-pagetab-title:focus {
    background: var(--bg);
    box-shadow: 0 0 0 2px var(--teal-100);
    border-radius: 3px;
}
.v3-cbe-pagetab-del {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    border: 0; background: transparent;
    color: var(--ink-4);
    font-size: 14px; line-height: 1;
    cursor: pointer;
    border-radius: 3px;
}
.v3-cbe-pagetab-del:hover { background: var(--red-50); color: var(--red); }
.v3-cbe-pagetab-add {
    display: inline-flex; align-items: center;
    padding: 6px 9px;
    border: 1px dashed var(--line);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    bottom: -1px;
}
.v3-cbe-pagetab-add:hover { color: var(--teal-800); border-color: var(--teal-800); }

/* Runtime: left page nav (TCX-style) */
.v3-sdcr-shell {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}
.v3-sdcr-pagenav {
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding: 14px 8px;
    min-width: 0;
}
.v3-sdcr-pagenav-h {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-4);
    font-weight: 600;
    font-family: var(--mono);
    padding: 0 8px 8px;
}
.v3-sdcr-pagenav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 2px;
}
.v3-sdcr-pagenav-item:hover { background: var(--surface); }
.v3-sdcr-pagenav-item.active {
    background: var(--teal-50);
    color: var(--teal-800);
    font-weight: 500;
}
.v3-sdcr-pagenav-no {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-4);
    min-width: 14px;
}
.v3-sdcr-pagenav-item.active .v3-sdcr-pagenav-no { color: var(--teal-700); }
.v3-sdcr-pagenav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-sdcr-pagebody { padding: 16px 20px; }

/* ============================================================
   Preview polish — matrix grid, committed-rows card, stronger
   section headers in the runtime renderer.
   ============================================================ */

/* Stronger section headers in the runtime form */
.v3-sdcr-sec {
    padding: 16px 18px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.v3-sdcr-sec-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.005em;
    border-bottom: 1px solid var(--line-soft);
}

/* Matrix grid (runtime) */
.v3-sdcr-matrix-grid {
    border-collapse: collapse;
    width: 100%;
    max-width: 480px;
    font-size: 12px;
}
.v3-sdcr-matrix-grid th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 500;
    color: var(--ink-2);
    background: var(--bg);
    border: 1px solid var(--line);
}
.v3-sdcr-matrix-grid thead th { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }
.v3-sdcr-matrix-grid td {
    padding: 6px;
    border: 1px solid var(--line);
    text-align: center;
    background: var(--surface);
    cursor: pointer;
}
.v3-sdcr-matrix-grid td:hover { background: var(--teal-50); }
.v3-sdcr-matrix-cell {
    display: inline-block;
    width: 12px; height: 12px; border-radius: 50%;
    border: 1.5px solid var(--ink-4);
    background: transparent;
}
.v3-sdcr-matrix-cell.on {
    border-color: var(--teal-800);
    background: radial-gradient(circle, var(--teal-800) 45%, var(--surface) 50%);
}

/* "Configuration so far" rows in preview side panel */
.v3-cbe-committed {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 6px 9px;
    border-radius: 5px;
    font-size: 11.5px;
    align-items: baseline;
}
.v3-cbe-committed.empty { color: var(--ink-4); }
.v3-cbe-committed.set { color: var(--ink); background: var(--teal-50); }
.v3-cbe-committed-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink-3);
}
.v3-cbe-committed.set .v3-cbe-committed-label { color: var(--teal-800); }
.v3-cbe-committed-value {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-2);
    text-align: right;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Image lightbox / full-screen preview ===== */
.v3-img-preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: v3-fdrawer-fade .15s ease-out;
    cursor: zoom-out;
}
.v3-img-preview-img {
    max-width: 92vw;
    max-height: 90vh;
    border-radius: var(--r-md);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    cursor: default;
    object-fit: contain;
}
.v3-img-preview-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 120ms;
}
.v3-img-preview-close:hover { background: rgba(255,255,255,0.28); }
.v3-cbe-committed.set .v3-cbe-committed-value { color: var(--teal-800); font-weight: 500; }

/* ===== V3 Drawer (slide-over panel) ===== */
.v3-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 900;
    display: flex;
    justify-content: flex-end;
    animation: v3-fade-in 150ms ease;
}
.v3-drawer-panel {
    position: relative;
    background: var(--surface);
    width: 100%;
    max-width: 960px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.18);
    animation: v3-slide-in-right 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}
@keyframes v3-slide-in-right {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@keyframes v3-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.v3-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
}
.v3-drawer-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.v3-drawer-icon { display: flex; align-items: center; color: var(--ink-3); }
.v3-drawer-icon svg { width: 18px; height: 18px; }
.v3-drawer-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.v3-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-3);
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 120ms, color 120ms;
    padding: 0;
    font-family: var(--sans);
}
.v3-drawer-close:hover { background: var(--red-50); color: var(--red); border-color: var(--red); }
.v3-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
}
.v3-drawer-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ===== Login Activity Panel (.v3-la-*) ===== */

/* Outer wrapper */
.v3-la-panel { display: flex; flex-direction: column; gap: 0; }

/* KPI tile row */
.v3-la-kpi-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.v3-la-pop-host { position: relative; flex: 1; min-width: 120px; }

.v3-la-kpi {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    cursor: default;
    transition: border-color 120ms, box-shadow 120ms;
    user-select: none;
}
.v3-la-pop-host:hover .v3-la-kpi {
    border-color: var(--teal-700);
    box-shadow: 0 2px 12px rgba(17,61,79,0.1);
}
.v3-la-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.v3-la-kpi-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.v3-la-kpi-today  .v3-la-kpi-value { color: var(--teal-700); }
.v3-la-kpi-week   .v3-la-kpi-value { color: var(--amber); }
.v3-la-kpi-month  .v3-la-kpi-value { color: var(--green); }
.v3-la-kpi-online .v3-la-kpi-value { color: var(--teal-800); }

/* Live dot */
.v3-la-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-4);
    flex-shrink: 0;
}
.v3-la-dot-live {
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-50);
    animation: v3-la-pulse 2s infinite;
}
.v3-la-dot-off { background: var(--ink-4); }
.v3-la-dot-sm  { width: 6px; height: 6px; }
@keyframes v3-la-pulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--green-50); }
    50%       { box-shadow: 0 0 0 5px var(--green-50); }
}

/* KPI popover */
.v3-la-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    max-width: 320px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    z-index: 200;
    padding: 10px 0;
    animation: v3-fade-in 120ms ease;
}
.v3-la-pop-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    padding: 2px 14px 8px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.v3-la-pop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 14px;
}
.v3-la-pop-row:hover { background: var(--teal-50); }
.v3-la-pop-name  { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.v3-la-pop-email { font-size: 11px; color: var(--ink-4); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.v3-la-pop-empty { font-size: 12px; color: var(--ink-4); padding: 8px 14px; }
.v3-la-connecting { font-size: 11px; color: var(--amber); margin-left: 6px; }

/* Filter label */
.v3-la-filter-label {
    font-size: 12.5px;
    color: var(--ink-3);
    font-weight: 500;
    white-space: nowrap;
}

/* Custom range badge */
.v3-la-range-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--teal-50);
    border: 1px solid var(--teal-100);
    border-radius: var(--r-sm);
    padding: 4px 12px;
    font-size: 13px;
    color: var(--teal-800);
    font-weight: 500;
}

/* Chart container */
.v3-la-chart-wrap {
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    padding: 12px 16px 8px;
    margin-bottom: 16px;
}
.v3-la-chart-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

/* Data table */
.v3-la-table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-top: 4px;
}
.v3-la-table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--line-soft);
}
.v3-la-table-search { width: 240px; }
.v3-la-table-count {
    font-size: 12px;
    color: var(--ink-4);
    margin-left: auto;
}
.v3-la-table-scroller { overflow-x: auto; }

.v3-la-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.v3-la-table thead th {
    background: var(--bg);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 120ms;
}
.v3-la-table thead th:hover { color: var(--ink); }

/* Sort indicators */
.v3-la-th-sort::after  { content: " ↕"; opacity: 0.4; font-size: 10px; }
.v3-la-th-asc::after   { content: " ↑"; color: var(--teal-700); font-size: 10px; }
.v3-la-th-desc::after  { content: " ↓"; color: var(--teal-700); font-size: 10px; }

.v3-la-tr { border-bottom: 1px solid var(--line-soft); transition: background 100ms; }
.v3-la-tr:last-child { border-bottom: none; }
.v3-la-tr:hover { background: var(--teal-50); }
.v3-la-tr-online { background: color-mix(in oklab, var(--green-50) 60%, var(--surface)); }
.v3-la-tr-online:hover { background: var(--green-50); }

.v3-la-td { padding: 9px 12px; color: var(--ink-2); vertical-align: middle; }
.v3-la-td-name  { font-weight: 500; color: var(--ink); white-space: nowrap; }
.v3-la-td-email { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.v3-la-td-date  { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.v3-la-td-empty { text-align: center; padding: 32px; color: var(--ink-4); font-size: 13px; }

/* Last config cell */
.v3-la-lastcfg { display: flex; flex-direction: column; gap: 1px; }
.v3-la-lastcfg-date    { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.v3-la-lastcfg-product {
    font-size: 11px;
    color: var(--teal-700);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ============================================================
   User Management V3 — invite / confirm modals & table polish
   ============================================================ */

/* 6-column user table (drops the redundant standalone Email column) */
.v3-utr.v3-utr-6 {
    grid-template-columns: 2.4fr 1.5fr 1.2fr 1fr 1.2fr 120px;
}
@media (max-width: 900px) {
    .v3-utr.v3-utr-6 { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
}

/* ── Invite modal: seat availability note ── */
.v3-um-seat-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.v3-um-seat-note .icon { flex: none; width: 14px; height: 14px; }
.v3-um-seat-note.ok {
    background: var(--green-50, #E5F1EA);
    color: #1C5A33;
    border-color: color-mix(in oklab, var(--green) 25%, transparent);
}
.v3-app[data-theme="dark"] .v3-um-seat-note.ok {
    background: #15331F;
    color: #9BD5AC;
}
.v3-um-seat-note.warn {
    background: var(--red-50, #F7E8E3);
    color: var(--red);
    border-color: color-mix(in oklab, var(--red) 25%, transparent);
}
.v3-app[data-theme="dark"] .v3-um-seat-note.warn {
    background: #3A1B12;
    color: #E59A82;
}

/* ── Invite modal: role description preview ── */
.v3-um-role-desc {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 6px;
}
.v3-um-role-desc .desc {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.45;
}

/* ── Invite modal: email input (extend modal field selector) ── */
.v3-modal-card .v3-field input[type="email"] {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--ink);
    background: var(--surface);
    outline: none;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.v3-modal-card .v3-field input[type="email"]:focus {
    border-color: var(--teal-800);
    box-shadow: 0 0 0 3px var(--teal-50);
}

/* ── Invite modal: inline error message ── */
.v3-um-err {
    font-size: 12.5px;
    font-weight: 600;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--r-sm);
    padding: 8px 12px;
    margin-top: 4px;
}
.v3-app[data-theme="dark"] .v3-um-err {
    background: #3A1B12;
    color: #E59A82;
    border-color: #7f2d1a;
}

/* ── Confirm modal: user identity card ── */
.v3-um-confirm-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    margin-bottom: 4px;
}
.v3-um-confirm-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 14px !important;
    flex: none;
}
.v3-um-confirm-name {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink);
}
.v3-um-confirm-email {
    font-size: 12px;
    color: var(--ink-3);
}
.v3-um-confirm-msg {
    margin: 12px 0 0;
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.5;
}

/* ── Edit modal: user profile header ── */
.v3-um-edit-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: color-mix(in oklab, var(--teal-800) 4%, var(--surface));
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    margin-bottom: 18px;
}
.v3-app[data-theme="dark"] .v3-um-edit-head {
    background: color-mix(in oklab, var(--teal-100) 8%, var(--surface));
}
.v3-um-edit-avatar {
    width: 44px !important;
    height: 44px !important;
    font-size: 15px !important;
    flex: none;
}
.v3-um-edit-info { min-width: 0; }
.v3-um-edit-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v3-um-edit-email {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Edit modal: "View role permissions" link ── */
.v3-um-roles-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--teal-700);
    text-decoration: none;
    font-weight: 500;
}
.v3-um-roles-link:hover { text-decoration: underline; }
.v3-app[data-theme="dark"] .v3-um-roles-link { color: var(--teal-100); }

/* ── v3-input sizing fix inside modal v3-field ── */
.v3-modal-card .v3-field .v3-input,
.v3-modal-card .v3-field input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}
.v3-modal-card .v3-field .v3-select-wrap {
    width: 100%;
}
.v3-modal-card .v3-field .v3-select-wrap select.v3-input {
    width: 100%;
}

/* ── Subscriptions page ──────────────────────────────────────────── */
.v3-sub-seats { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.v3-sub-seat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px; min-width: 180px; flex: 1 1 180px; box-shadow: var(--shadow); }
.v3-sub-seat-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.v3-sub-seat-numbers { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.v3-sub-seat-big { font-size: 28px; font-weight: 700; color: var(--teal-800); font-variant-numeric: tabular-nums; line-height: 1; }
.v3-app[data-theme="dark"] .v3-sub-seat-big { color: var(--teal-100); }
.v3-sub-seat-sep { font-size: 20px; color: var(--ink-4); }
.v3-sub-seat-total { font-size: 18px; color: var(--ink-2); font-weight: 500; }
.v3-sub-seat-unit { font-size: 12px; color: var(--ink-3); margin-left: 2px; }
.v3-sub-seat-bar-wrap { margin-bottom: 6px; }
.v3-sub-seat-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.v3-sub-seat-bar-fill { height: 100%; border-radius: 3px; transition: width 300ms ease; }
.v3-sub-seat-foot { font-size: 12px; color: var(--ink-3); }
.v3-urow.v3-urow-sel { background: var(--teal-50) !important; box-shadow: inset 3px 0 0 var(--teal-800); }
.v3-app[data-theme="dark"] .v3-urow.v3-urow-sel { background: #1e3340 !important; box-shadow: inset 3px 0 0 var(--teal-100); }
.v3-sub-actions { display: grid; grid-template-columns: 1fr 30px 30px; gap: 4px; align-items: center; justify-items: end; padding-right: 4px; min-height: 32px; }
.v3-btn-sm-icon .icon, .v3-btn-sm-icon svg { width: 12px !important; height: 12px !important; }
.v3-btn.v3-btn-sm-icon { padding: 4px 8px; font-size: 11.5px; gap: 4px; }
.v3-sub-renew { font-size: 12.5px; color: var(--ink-4); font-weight: 500; }
.v3-sub-renew.on { color: var(--green); }

/* ── Add Seats — inline V3Modal content ──────────────────────────── */

/* 4-stat horizontal bar (Product / Current Max / Used / Remaining) */
.v3-addseats-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); margin-bottom: 0; }
.v3-app[data-theme="dark"] .v3-addseats-summary { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); }
.v3-addseats-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-right: 1px solid var(--line); }
.v3-addseats-stat:last-child { border-right: none; }
.v3-addseats-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.v3-addseats-val { font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.v3-addseats-ok  { color: #15803d; }
.v3-addseats-low { color: var(--red); }
.v3-app[data-theme="dark"] .v3-addseats-ok { color: #4ade80; }

/* New Total preview callout below the seats input */
.v3-addseats-preview { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--teal-800); font-weight: 500; background: var(--teal-50); border: 1px solid color-mix(in oklab, var(--teal-800) 20%, transparent); border-radius: var(--r-sm); padding: 5px 10px; margin-bottom: 14px; }
.v3-addseats-preview .icon { width: 12px; height: 12px; flex-shrink: 0; }
.v3-app[data-theme="dark"] .v3-addseats-preview { color: var(--teal-100); background: #0e2a30; border-color: color-mix(in oklab, var(--teal-100) 20%, transparent); }

/* ── Add / Edit License — inline V3Modal content ──────────────────── */
.v3-lic-form { display: flex; flex-direction: column; gap: 0; }

/* 2-column date row */
.v3-lic-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* required asterisk */
.v3-lic-form .req { color: var(--red); font-weight: 700; margin-left: 2px; }

/* read-only product display (edit mode) */
.v3-lic-readonly-val { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.v3-lic-readonly-val .hint { margin: 0; }

/* Auto-renew toggle row */
.v3-lic-toggle { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.v3-lic-toggle input[type="checkbox"] { accent-color: var(--teal-800); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.v3-app[data-theme="dark"] .v3-lic-toggle input[type="checkbox"] { accent-color: var(--teal-100); }
.v3-lic-toggle-lbl { font-size: 13px; color: var(--ink-2); }

/* User Management — role breakdown bar (below seat cards) */
.v3-um-role-bar { margin-bottom: 20px; }
.v3-um-role-bar .v3-seat-bar { display:flex; height:8px; border-radius:4px; overflow:hidden; background:var(--line-soft); margin-bottom:8px; }
.v3-um-role-bar .v3-seat-bar .seg { min-width:2px; }
.v3-um-role-bar .v3-seat-legend { display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12px; color:var(--ink-2); }
.v3-um-role-bar .v3-seat-legend .lg { display:inline-flex; align-items:center; gap:5px; }
.v3-um-role-bar .v3-seat-legend .sw { display:inline-block; width:10px; height:10px; border-radius:2px; flex-shrink:0; }
.v3-um-role-bar .v3-seat-legend .num { font-weight:600; color:var(--ink); }

/* ── Roles & Permissions page — plan tier cards ─────────────────────── */
.v3-rp-plan-section { margin-bottom: 16px; }
.v3-rp-plan-overline { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal-800); margin-bottom: 4px; }
.v3-app[data-theme="dark"] .v3-rp-plan-overline { color: var(--teal-100); }
.v3-rp-plan-heading { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.v3-rp-plan-sub { font-size: 13px; color: var(--ink-3); margin: 0; }

.v3-rp-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }

.v3-rp-plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 18px 18px; overflow: hidden; box-shadow: var(--shadow); }
.v3-rp-plan-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.v3-rp-plan-lite   .v3-rp-plan-accent { background: #2563eb; }
.v3-rp-plan-standard .v3-rp-plan-accent { background: #d97706; }
.v3-rp-plan-premium  .v3-rp-plan-accent { background: #7c3aed; }

.v3-rp-popular { position: absolute; top: 16px; right: -1px; background: #0f172a; color: #fff; font-size: 10px; font-weight: 600; padding: 3px 12px 3px 10px; border-radius: 4px 0 0 4px; letter-spacing: 0.4px; white-space: nowrap; }
.v3-app[data-theme="dark"] .v3-rp-popular { background: #d97706; color: #fff; }

.v3-rp-plan-name { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.v3-rp-plan-lite   .v3-rp-plan-name { color: #2563eb; }
.v3-rp-plan-standard .v3-rp-plan-name { color: #d97706; }
.v3-rp-plan-premium  .v3-rp-plan-name { color: #7c3aed; }
.v3-app[data-theme="dark"] .v3-rp-plan-lite     .v3-rp-plan-name { color: #93c5fd; }
.v3-app[data-theme="dark"] .v3-rp-plan-standard .v3-rp-plan-name { color: #fcd34d; }
.v3-app[data-theme="dark"] .v3-rp-plan-premium  .v3-rp-plan-name { color: #c4b5fd; }
.v3-rp-plan-desc { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; line-height: 1.45; }

.v3-rp-role-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-4); margin-bottom: 6px; }
.v3-rp-divider { border: none; border-top: 1px solid var(--line-soft); margin: 10px 0; }
.v3-rp-roles { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }

.v3-rp-role-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.v3-rp-role-chip::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; }
.v3-rp-role-inherited { background: var(--bg); color: var(--ink-4); }
.v3-rp-role-inherited::before { background: var(--ink-4); }
.v3-rp-role-lite::before     { background: #2563eb; }
.v3-rp-role-standard::before { background: #d97706; }
.v3-rp-role-premium::before  { background: #7c3aed; }

/* ── Matrix — package group header row ─────────────────────────────── */
.v3-rp-matrix-overline { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal-800); margin-bottom: 10px; }
.v3-app[data-theme="dark"] .v3-rp-matrix-overline { color: var(--teal-100); }

.v3-rm-row.v3-rm-pkg-row { padding: 6px 16px 0; border-bottom: none; background: color-mix(in oklab, var(--teal-800) 3%, var(--surface)); }
.v3-app[data-theme="dark"] .v3-rm-row.v3-rm-pkg-row { background: color-mix(in oklab, var(--teal-100) 10%, var(--surface)); }
.v3-rm-pkg-cell { grid-column: span 2; text-align: center; padding: 4px 4px 6px; border-top: 2px solid transparent; }
.v3-rm-pkg-cell.v3-rm-pkg-lite     { border-top-color: #2563eb; }
.v3-rm-pkg-cell.v3-rm-pkg-standard { border-top-color: #d97706; }
.v3-rm-pkg-cell.v3-rm-pkg-premium  { border-top-color: #7c3aed; }

.v3-rm-pkg-pill { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 1px 10px; border-radius: 999px; }
.v3-rm-pkg-lite .v3-rm-pkg-pill     { color: #2563eb; background: #eff6ff; border: 1px solid #bfdbfe; }
.v3-rm-pkg-standard .v3-rm-pkg-pill { color: #d97706; background: #fffbeb; border: 1px solid #fde68a; }
.v3-rm-pkg-premium .v3-rm-pkg-pill  { color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; }
.v3-app[data-theme="dark"] .v3-rm-pkg-lite .v3-rm-pkg-pill     { color: #93c5fd; background: #172554; border-color: #1e3a8a; }
.v3-app[data-theme="dark"] .v3-rm-pkg-standard .v3-rm-pkg-pill { color: #fcd34d; background: #3b2000; border-color: #78350f; }
.v3-app[data-theme="dark"] .v3-rm-pkg-premium .v3-rm-pkg-pill  { color: #c4b5fd; background: #2e1065; border-color: #4c1d95; }

/* ── Seat pool info banner ───────────────────────────────────────────── */
.v3-rp-info-banner { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px 16px; background: color-mix(in oklab, var(--teal-800) 4%, var(--surface)); border: 1px solid color-mix(in oklab, var(--teal-800) 20%, transparent); border-radius: var(--r-md); font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.v3-rp-info-banner .icon { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; color: var(--teal-800); }
.v3-app[data-theme="dark"] .v3-rp-info-banner { background: color-mix(in oklab, var(--teal-100) 8%, var(--surface)); border-color: color-mix(in oklab, var(--teal-100) 20%, transparent); }
.v3-app[data-theme="dark"] .v3-rp-info-banner .icon { color: var(--teal-100); }

/* Responsive: stack plan cards on narrow screens */
@media (max-width: 800px) {
    .v3-rp-plans { grid-template-columns: 1fr; }
}

/* ── Subscription Logs drawer ───────────────────────────────────────── */
.v3-sublog-desc { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.v3-sublog-by { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.v3-sublog-system { font-size: 12px; color: var(--ink-4); font-style: italic; }
.v3-sublog-date { font-size: 12px; color: var(--ink-3); font-family: var(--mono); white-space: nowrap; }
