/* =====================================================================
   LYRA — neutral, high-contrast interface
   Palette: Vercel Geist gray scale (white / #fafafa backgrounds, #171717 ink),
   steps used by role as in Radix Colors (app bg, component bg, hover, selected,
   borders, secondary and primary text). Colour is reserved for meaning
   (status of a workflow, warnings, errors). Type: Geist + Geist Mono.
   ===================================================================== */

:root {
    color-scheme: light;
    --bg: #ffffff;
    --bg-subtle: #fafafa;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-3: #f2f2f2;
    --surface-4: #e8e8e8;
    --border: #ebebeb;
    --border-strong: #d4d4d4;
    --text: #171717;
    --text-2: #525252;
    --text-3: #737373;
    --accent: #171717;
    --accent-hover: #383838;
    --accent-fg: #ffffff;
    --data: #525252;
    --data-soft: #a3a3a3;
    --user-bubble: #f2f2f2;
    --code-bg: #f5f5f5;
    --tooltip-bg: #171717;
    --tooltip-text: #ededed;
    --tooltip-muted: #a1a1a1;

    --st-done: #16a34a;
    --st-progress: #d97706;
    --st-error: #dc2626;
    --st-todo: #8f8f8f;
    --st-todo-fill: #d9d9d9;
    --st-locked: #7c3aed;
    --st-glyph: #ffffff;

    --warn-bg: #fffbeb;
    --warn-border: #fcd34d;
    --warn-text: #92400e;
    --err-bg: #fef2f2;
    --err-border: #fecaca;
    --err-text: #b91c1c;
    --ok-text: #15803d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .04);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, .14);
    --ring: 0 0 0 3px rgba(23, 23, 23, .10);

    --font: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* legacy names still used by inline styles in app.js */
    --text-primary: var(--text);
    --text-secondary: var(--text-2);
    --text-muted: var(--text-3);
    --error: var(--st-error);
    --warning: var(--st-progress);
    --success: var(--st-done);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0a0a0a;
        --bg-subtle: #0a0a0a;
        --surface: #111111;
        --surface-2: #161616;
        --surface-3: #1f1f1f;
        --surface-4: #2a2a2a;
        --border: #242424;
        --border-strong: #3a3a3a;
        --text: #ededed;
        --text-2: #a1a1a1;
        --text-3: #8f8f8f;
        --accent: #ededed;
        --accent-hover: #cfcfcf;
        --accent-fg: #0a0a0a;
        --data: #a1a1a1;
        --data-soft: #525252;
        --user-bubble: #1f1f1f;
        --code-bg: #1a1a1a;
        --tooltip-bg: #ededed;
        --tooltip-text: #171717;
        --tooltip-muted: #525252;
        --st-done: #22c55e;
        --st-progress: #f59e0b;
        --st-error: #ef4444;
        --st-todo: #737373;
        --st-todo-fill: #333333;
        --st-locked: #a78bfa;
        --st-glyph: #0a0a0a;
        --warn-bg: rgba(245, 158, 11, .08);
        --warn-border: rgba(245, 158, 11, .35);
        --warn-text: #fbbf24;
        --err-bg: rgba(239, 68, 68, .08);
        --err-border: rgba(239, 68, 68, .35);
        --err-text: #f87171;
        --ok-text: #4ade80;
        --shadow-sm: none;
        --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
        --ring: 0 0 0 3px rgba(237, 237, 237, .14);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0a0a;
    --bg-subtle: #0a0a0a;
    --surface: #111111;
    --surface-2: #161616;
    --surface-3: #1f1f1f;
    --surface-4: #2a2a2a;
    --border: #242424;
    --border-strong: #3a3a3a;
    --text: #ededed;
    --text-2: #a1a1a1;
    --text-3: #8f8f8f;
    --accent: #ededed;
    --accent-hover: #cfcfcf;
    --accent-fg: #0a0a0a;
    --data: #a1a1a1;
    --data-soft: #525252;
    --user-bubble: #1f1f1f;
    --code-bg: #1a1a1a;
    --tooltip-bg: #ededed;
    --tooltip-text: #171717;
    --tooltip-muted: #525252;
    --st-done: #22c55e;
    --st-progress: #f59e0b;
    --st-error: #ef4444;
    --st-todo: #737373;
    --st-todo-fill: #333333;
    --st-locked: #a78bfa;
    --st-glyph: #0a0a0a;
    --warn-bg: rgba(245, 158, 11, .08);
    --warn-border: rgba(245, 158, 11, .35);
    --warn-text: #fbbf24;
    --err-bg: rgba(239, 68, 68, .08);
    --err-border: rgba(239, 68, 68, .35);
    --err-text: #f87171;
    --ok-text: #4ade80;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(237, 237, 237, .14);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    width: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
::selection { background: var(--surface-4); color: var(--text); }

/* === LAYOUT === */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
}

/* === HEADER === */
.chat-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.chat-header-inner {
    max-width: 1240px;
    margin: 0 auto;
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-container { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.chat-header h1 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.brand-sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 11px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--st-done);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-done) 18%, transparent);
}

.lang-switch {
    display: inline-flex;
    height: 32px;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-3);
}
.lang-option {
    min-width: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.lang-option:hover { color: var(--text); }
.lang-option[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border); }

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
    :root:not([data-theme="light"]) .theme-icon-light { display: none; }
}

/* === CHAT BOX === */
.chat-box {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-box-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.chat-box::-webkit-scrollbar { width: 10px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 10px; border: 3px solid var(--bg); }
.chat-box::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* === MESSAGES === */
.message {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    min-width: 0;
    animation: fadeInUp .25s ease-out both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.message.user { align-self: flex-end; align-items: flex-end; max-width: min(72%, 720px); }
.message.bot { align-self: stretch; align-items: flex-start; }
/* Answers fade in a little slower than questions; several messages of one answer are staggered (animation-delay set in JS) */
.message.bot.appear { animation: fadeInUp .42s cubic-bezier(.2, .7, .2, 1) both; }
.chat-box { scroll-padding-top: 16px; }
@media (prefers-reduced-motion: reduce) { .message, .message.bot.appear { animation: none; } }

.message-content {
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    min-width: 0;
}

.message.user .message-content {
    background: var(--user-bubble);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 6px;
    white-space: pre-wrap;
}

.message.bot .message-content {
    color: var(--text);
    max-width: 780px;
    padding: 2px 0;
}

.message-time {
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 6px;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}
.message.bot .message-time { padding: 0; }

/* === MARKDOWN === */
.text-content p { margin-bottom: 10px; }
.text-content p:last-child { margin-bottom: 0; }
.text-content strong { color: var(--text); font-weight: 600; }
.text-content em { color: var(--text-2); }
.text-content a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.text-content a:hover { text-decoration-color: var(--text); }
.text-content ul, .text-content ol { margin: 6px 0 10px 22px; }
.text-content li { margin: 3px 0; }
.text-content li::marker { color: var(--text-3); }
.text-content h1, .text-content h2, .text-content h3, .text-content h4 { font-weight: 600; letter-spacing: -.01em; margin: 14px 0 8px; line-height: 1.3; }
.text-content h1 { font-size: 20px; }
.text-content h2 { font-size: 18px; }
.text-content h3 { font-size: 16px; }
.text-content h4 { font-size: 15px; }
.text-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.text-content blockquote { border-left: 2px solid var(--border-strong); padding-left: 12px; color: var(--text-2); margin: 8px 0; }
.text-content code {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--text);
}
.text-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 10px 0;
}
.text-content pre code { background: none; border: none; padding: 0; font-size: 13px; }

.text-content table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.text-content th {
    background: var(--surface-2);
    color: var(--text-2);
    font-weight: 500;
    font-size: 12.5px;
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.text-content td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.text-content tr:last-child td { border-bottom: none; }
.text-content tbody tr:hover td { background: var(--surface-2); }

/* === WELCOME === */
.welcome { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 4px; }
.welcome-title { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.welcome-text { color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 640px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.suggestion {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background .15s, border-color .15s;
}
.suggestion:hover { background: var(--surface-3); border-color: var(--border-strong); }
.suggestion-icon { color: var(--text-3); display: inline-flex; }
.suggestion-icon svg { width: 15px; height: 15px; }

/* === ADAPTIVE CARDS (generic) === */
.adaptive-card-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    color: var(--text);
    box-shadow: var(--shadow);
    min-width: 280px;
    max-width: 680px;
    font-size: 14px;
}
.adaptive-card-wrapper .ac-textBlock { color: var(--text) !important; font-family: var(--font) !important; }
.adaptive-card-wrapper .ac-container,
.adaptive-card-wrapper .ac-adaptiveCard { background: transparent !important; }
.adaptive-card-wrapper .ac-image { border-radius: var(--radius-sm); }
.adaptive-card-wrapper .ac-actionSet { gap: 8px; }
.adaptive-card-wrapper .ac-pushButton {
    height: 34px;
    padding: 0 14px !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-strong) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font: 500 13.5px var(--font) !important;
    cursor: pointer;
    transition: background .15s;
}
.adaptive-card-wrapper .ac-pushButton:hover { background: var(--surface-3) !important; }
.adaptive-card-wrapper .ac-pushButton.style-positive,
.adaptive-card-wrapper .ac-pushButton.primary { background: var(--accent) !important; color: var(--accent-fg) !important; border-color: var(--accent) !important; }
.adaptive-card-wrapper .ac-input,
.adaptive-card-wrapper input,
.adaptive-card-wrapper select,
.adaptive-card-wrapper textarea {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-xs) !important;
}
.adaptive-card-wrapper .ac-factset td { padding: 3px 12px 3px 0; }

/* Wide cards (dashboards) */
.message.bot:has(.lineage-card),
.message.bot:has(.rule-process-card),
.message.bot:has(.ly-card) { align-self: stretch; }
.adaptive-card-wrapper:has(.lineage-card),
.adaptive-card-wrapper:has(.rule-process-card) { width: 100%; max-width: none; padding: 24px; }
.adaptive-card-wrapper:has(.ly-card) { max-width: 680px; padding: 20px 22px; }
.adaptive-card-wrapper:has(.ly-help) { max-width: 860px; }
.adaptive-card-wrapper:has(.ly-techlog) { width: 100%; max-width: 1000px; }

/* === TYPING INDICATOR === */
.typing-indicator { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 2px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* === INPUT === */
.chat-input-area { flex-shrink: 0; background: var(--bg); }
.chat-input-inner { max-width: 880px; margin: 0 auto; padding: 8px 24px 16px; }

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 10px 10px 10px 18px;
    box-shadow: var(--shadow);
    transition: border-color .15s, box-shadow .15s;
}
.input-wrapper:focus-within { border-color: var(--text-3); box-shadow: var(--shadow), var(--ring); }

textarea#user-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    padding: 6px 0;
    resize: none;
    max-height: 160px;
    overflow-y: auto;
}
textarea#user-input::placeholder { color: var(--text-3); }
textarea#user-input:focus-visible { outline: none; }

#send-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: var(--accent-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
#send-btn:hover:not(:disabled) { background: var(--accent-hover); }
#send-btn:disabled { background: var(--surface-4); color: var(--text-3); cursor: not-allowed; }
#send-btn svg { width: 18px; height: 18px; }

.input-footnote { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 8px; }

@media (max-width: 600px) {
    .chat-header-inner { padding: 0 16px; }
    .brand-sub { display: none; }
    .status { display: none; }
    .chat-box-inner { padding: 20px 16px; gap: 22px; }
    .chat-input-inner { padding: 8px 16px 12px; }
    .message.user { max-width: 88%; }
    .adaptive-card-wrapper { min-width: 0; width: 100%; padding: 16px; }
    .adaptive-card-wrapper:has(.lineage-card) { padding: 16px; }
}

/* =====================================================================
   LYRA CARDS: clarification, confirmation, help, errors, technical log
   ===================================================================== */
.ly-card { display: flex; flex-direction: column; gap: 14px; }
.ly-card-head { display: flex; align-items: flex-start; gap: 12px; }
.ly-card-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    color: var(--text);
}
.ly-card-icon svg { width: 17px; height: 17px; }
.ly-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; letter-spacing: -.005em; }
.ly-card-sub { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.ly-quote { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }

.ly-options { display: flex; flex-direction: column; gap: 6px; }
.ly-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ly-option:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.ly-option-arrow { color: var(--text-3); flex-shrink: 0; }
.ly-option.muted { color: var(--text-2); border-style: dashed; }
.ly-option.chosen { border-color: var(--text); background: var(--surface-3); }
.ly-options.answered .ly-option:not(.chosen) { opacity: .45; }
.ly-option:disabled { cursor: default; }

.ly-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ly-btn {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    transition: background .15s, opacity .15s;
}
.ly-btn:hover:not(:disabled) { background: var(--surface-3); }
.ly-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.ly-btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ly-btn:disabled { opacity: .45; cursor: default; }
.ly-note { font-size: 12.5px; color: var(--text-3); }

.ly-help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.ly-help-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.ly-help-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ly-help-example {
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.ly-help-example:hover { border-color: var(--border-strong); background: var(--surface-3); }

.ly-error .ly-card-icon { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-border); }
.ly-error.warn .ly-card-icon { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.ly-hint { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.ly-hint-label { color: var(--text-3); font-weight: 500; flex-shrink: 0; }
.ly-ref-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.ly-ref { font-family: var(--mono); font-size: 12px; color: var(--text-2); background: var(--surface-3); border-radius: 5px; padding: 2px 7px; }
.ly-link { background: none; border: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); padding: 0; }
.ly-link:hover { color: var(--text); text-decoration-color: var(--text); }

.ly-log { display: flex; flex-direction: column; gap: 10px; }
.ly-log-entry { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ly-log-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.ly-log-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ly-tag { font-size: 11.5px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; background: var(--surface); }
.ly-log-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ly-pre {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    max-height: 280px;
    overflow: auto;
    color: var(--text);
}
.ly-log details summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); padding: 2px 0; }
.ly-log details summary:hover { color: var(--text); }
.ly-log details[open] summary { margin-bottom: 6px; }

/* =====================================================================
   RULE CREATION WIZARD (Process step)
   ===================================================================== */
.rule-process-card { width: 100%; }
.rule-process-card h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; margin-bottom: 6px; color: var(--text); }
.rule-process-subtitle { color: var(--text-2); font-size: 13.5px; line-height: 1.5; margin-bottom: 16px; }
.rule-process-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.rule-process-table-wrap::-webkit-scrollbar { height: 8px; }
.rule-process-table-wrap::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 8px; }
.rule-process-select-table,
.rule-process-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; color: var(--text); }
.rule-process-select-table th,
.rule-process-select-table td,
.rule-process-grid th,
.rule-process-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 12px; vertical-align: middle; white-space: nowrap; }
.rule-process-select-table th,
.rule-process-grid th { background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 500; text-align: left; }
.rule-process-select-table td { text-align: center; min-width: 56px; }
.rule-process-select-table th:first-child,
.rule-process-grid th:first-child { min-width: 90px; position: sticky; left: 0; z-index: 1; background: var(--surface-3); color: var(--text); }
.rule-process-grid { min-width: max-content; }
.rule-process-grid td { min-width: 160px; }
.rule-process-grid input[type="text"] { width: 100%; min-width: 138px; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); padding: 7px 9px; font-size: 13px; }
.rule-process-grid input[type="text"]:focus { outline: none; border-color: var(--text-3); box-shadow: var(--ring); }
.rule-process-select-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.rule-process-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.rule-process-actions button { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 500; }
.rule-process-icon-btn { width: 36px; height: 36px; background: var(--surface); color: var(--text); }
.rule-process-icon-btn:hover { background: var(--surface-3); }
.rule-process-primary { height: 36px; padding: 0 16px; background: var(--accent); border-color: var(--accent) !important; color: var(--accent-fg); }
.rule-process-primary:hover { background: var(--accent-hover); }

/* =====================================================================
   DASHBOARD CARDS — shared by the elimination lineage and the workflow status
   ===================================================================== */
.lineage-card { width: 100%; display: flex; flex-direction: column; gap: 20px; }
.lineage-card [hidden] { display: none !important; }
.lineage-card h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--text); }
.lineage-card h4 { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 10px; letter-spacing: 0; }
.lineage-card button { font-family: var(--font); }

.lin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.lin-subtitle { color: var(--text-2); font-size: 13.5px; margin-top: 5px; line-height: 1.45; }
.lin-hero { text-align: right; }
.lin-hero-label { color: var(--text-2); font-size: 12.5px; }
.lin-hero-value { font-size: 32px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; }

.lin-pov { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lin-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--text); white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.lin-chip b { color: var(--text-3); font-weight: 500; margin-right: 1px; }
.lin-link { background: none; border: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; padding: 2px 4px; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.lin-link:hover { color: var(--text); text-decoration-color: var(--text); }

.lin-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lin-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.lin-kpi-value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.lin-kpi-label { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }

.lin-path { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.lin-stage { flex: 1 0 150px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.lin-stage:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.lin-stage:disabled { cursor: default; }
.lin-stage.active { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.lin-stage-title { font-size: 12px; color: var(--text-2); font-weight: 500; }
.lin-stage-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 3px 0 2px; }
.lin-stage-sub { font-size: 11.5px; color: var(--text-3); }
.lin-path-arrow { align-self: center; color: var(--text-3); font-size: 16px; flex: 0 0 auto; }

.lin-bars { display: flex; flex-direction: column; gap: 2px; }
.lin-bar-row { display: grid; grid-template-columns: minmax(160px, 34%) 1fr 140px; align-items: center; gap: 14px; background: none; border: 1px solid transparent; border-radius: var(--radius-xs); padding: 7px 8px; color: var(--text); cursor: pointer; text-align: left; transition: background .12s; }
.lin-bar-row:hover { background: var(--surface-2); }
.lin-bar-row.active { border-color: var(--border-strong); background: var(--surface-3); }
.lin-bar-row.active .lin-bar { background: var(--text); }
.lin-bar-label { display: flex; flex-direction: column; min-width: 0; }
.lin-bar-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lin-bar-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lin-bar-track { position: relative; height: 12px; }
.lin-bar-axis { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--border-strong); }
.lin-bar { position: absolute; top: 0; height: 100%; background: var(--data); border-radius: 0 4px 4px 0; transition: background .12s; }
.lin-bar.neg { border-radius: 4px 0 0 4px; }
.lin-bar-value { text-align: right; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--text); }
.lin-bars-rest { font-size: 12.5px; color: var(--text-3); padding: 6px 8px 0; }

.lin-explorer { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; min-height: 320px; }
.lin-list-pane, .lin-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.lin-list-pane { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.lin-toolbar { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lin-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.lin-crumb { background: none; border: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; padding: 3px 6px; border-radius: 5px; }
.lin-crumb:hover { background: var(--surface-3); color: var(--text); }
.lin-crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.lin-crumb.current:hover { background: none; }
.lin-crumb-sep { color: var(--text-3); font-size: 12px; }
.lin-search { width: 100%; height: 34px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text); font-size: 13.5px; padding: 0 10px; outline: none; transition: border-color .15s, box-shadow .15s; }
.lin-search::placeholder { color: var(--text-3); }
.lin-search:focus { border-color: var(--text-3); box-shadow: var(--ring); }
.lin-search.wide { max-width: 420px; }
.lin-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.lin-filters:empty { display: none; }
.lin-filter { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); border-radius: 999px; font-size: 12.5px; padding: 3px 10px; cursor: pointer; }
.lin-filter:hover { background: var(--surface-4); }

.lin-list { overflow-y: auto; max-height: 460px; }
.lin-node { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.lin-node:last-child { border-bottom: none; }
.lin-node:hover { background: var(--surface-2); }
.lin-node.selected { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--text); }
.lin-toggle { width: 22px; height: 22px; background: none; border: none; color: var(--text-3); cursor: pointer; border-radius: 4px; font-size: 12px; }
.lin-toggle:hover:not(:disabled) { background: var(--surface-4); color: var(--text); }
.lin-toggle:disabled { cursor: default; }
.lin-node-main { min-width: 0; }
.lin-node-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lin-node-rule { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lin-node-src { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.lin-node-right { text-align: right; }
.lin-node-amount { font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lin-node-kids { font-size: 11.5px; color: var(--text-3); }
.lin-badge { flex: 0 0 auto; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); border-radius: 4px; font-size: 11px; font-weight: 600; padding: 0 5px; font-family: var(--mono); }
.lin-warn-dot { color: var(--st-progress); font-size: 12px; }
.lin-more { margin: 10px auto; display: block; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); border-radius: var(--radius-xs); height: 30px; padding: 0 12px; font-size: 12.5px; cursor: pointer; }
.lin-more:hover { color: var(--text); background: var(--surface-3); }
.lin-empty { padding: 20px; color: var(--text-3); font-size: 13.5px; text-align: center; }

.lin-detail { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lin-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lin-detail-rule { font-size: 16px; font-weight: 600; letter-spacing: -.01em; word-break: break-all; }
.lin-tag { font-size: 11.5px; color: var(--text-2); border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.lin-detail-desc { font-size: 13.5px; color: var(--text-2); }
.lin-detail-label { font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 2px; }
.lin-formula { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.lin-term { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px 10px; text-align: center; }
.lin-term.result { border-color: var(--text); }
.lin-term-value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lin-term-label { font-size: 11px; color: var(--text-3); }
.lin-op { align-self: center; color: var(--text-3); font-size: 15px; font-weight: 500; }
.lin-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.lin-facts dt { color: var(--text-3); }
.lin-facts dd { color: var(--text); font-variant-numeric: tabular-nums; min-width: 0; word-break: break-word; }
.lin-layer { font-size: 12.5px; color: var(--text-2); border-left: 2px solid var(--border-strong); padding: 7px 11px; background: var(--surface-2); border-radius: 0 var(--radius-xs) var(--radius-xs) 0; line-height: 1.5; }
.lin-layer b { color: var(--text); font-weight: 600; }
.lin-layer-elimination { border-left-color: var(--text); }
.lin-layer-elimination_missing, .lin-layer-unreadable { border-left-color: var(--st-progress); }
.lin-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.lin-primary, .lin-secondary { height: 34px; border-radius: var(--radius-xs); padding: 0 14px; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .15s; white-space: nowrap; }
.lin-primary { background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); }
.lin-primary:hover { background: var(--accent-hover); }
.lin-primary.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.lin-secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.lin-secondary:hover { background: var(--surface-3); }
.lin-warning { font-size: 12.5px; color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius-xs); padding: 7px 10px; line-height: 1.5; }
.lin-footnote { font-size: 12px; color: var(--text-3); }

.lin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.lin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lin-table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.lin-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lin-table tr:last-child td { border-bottom: none; }
.lin-table tbody tr:hover td { background: var(--surface-2); }
.lin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.lin-table .center { text-align: center; }
.lin-mini { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
.lin-mini-bar { height: 4px; background: var(--data); border-radius: 2px; min-width: 2px; }

.lin-tooltip { position: fixed; z-index: 1000; pointer-events: none; max-width: 360px; background: var(--tooltip-bg); border-radius: var(--radius-xs); padding: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--tooltip-muted); box-shadow: var(--shadow-lg); }
.lin-tooltip-title { color: var(--tooltip-text); font-weight: 600; margin-bottom: 2px; word-break: break-all; }

.lin-understood { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--text); }
.lin-understood-label { font-size: 11.5px; font-weight: 500; color: var(--accent-fg); background: var(--accent); border-radius: 999px; padding: 2px 9px; }
.lin-understood-unknown { color: var(--warn-text); }

/* --- Rule definition panel (Scope / Select / Process) --- */
.lin-rule { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.lin-rule-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lin-rule-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 2px 0; word-break: break-all; }
.lin-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 9px; align-self: flex-start; flex-wrap: wrap; }
.lin-tabs:empty { display: none; }
.lin-tab { display: flex; align-items: baseline; gap: 7px; background: none; border: none; color: var(--text-2); font-size: 13.5px; font-weight: 500; height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; transition: color .15s, background .15s; }
.lin-tab:hover { color: var(--text); }
.lin-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border); }
.lin-tab-count { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.lin-skeleton { color: var(--text-3); font-size: 13.5px; padding: 18px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); animation: lin-pulse 1.2s ease-in-out infinite; }
@keyframes lin-pulse { 50% { opacity: .45; } }
.lin-muted { color: var(--text-3); font-size: 12.5px; }

.lin-process { display: flex; flex-direction: column; gap: 10px; }
.lin-pline { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 14px 16px; }
.lin-pline.fired { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.lin-pline-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lin-pline-num { font-size: 13.5px; font-weight: 600; }
.lin-pill { font-size: 11.5px; font-weight: 500; color: var(--accent-fg); background: var(--accent); border-radius: 999px; padding: 2px 10px; }
.lin-pline-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: start; }
.lin-pline-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lin-pline-label { font-size: 12px; font-weight: 500; color: var(--text-3); }
.lin-pline-arrow { align-self: center; font-size: 18px; color: var(--text-3); }
.lin-prow { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: start; }
.lin-prow-dim { font-size: 12.5px; color: var(--text-2); padding-top: 4px; }
.lin-params { display: flex; flex-wrap: wrap; gap: 6px; }
.lin-param { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 4px 10px; text-align: center; min-width: 70px; }
.lin-param-value { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lin-param-label { font-size: 11px; color: var(--text-3); }

.lin-rchip { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--radius-xs); padding: 3px 9px; font-size: 12.5px; border: 1px solid; word-break: break-all; font-family: var(--mono); font-size: 12px; }
.lin-rchip.include { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.lin-rchip.exclude { background: transparent; border-color: var(--border-strong); border-style: dashed; color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.lin-rchip-sign { font-weight: 700; text-decoration: none; display: inline-block; }
.lin-rchip.include .lin-rchip-sign { color: var(--ok-text); }
.lin-rchip.exclude .lin-rchip-sign { color: var(--err-text); }

.lin-select { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.lin-srow { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); align-items: start; }
.lin-srow:last-child { border-bottom: none; }
.lin-srow-dim { font-size: 13.5px; font-weight: 500; padding-top: 3px; }

.lin-scope { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.lin-scope-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.lin-scope-col.unused { opacity: .55; }
.lin-scope-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 600; }
.lin-scope-chip { font-size: 12px; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--border); color: var(--text-3); }
.lin-scope-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 500; }

/* --- Scope justification (DA_EntityScope_DSA): value of the entity / partner against the rule's conditions --- */
.lin-scope-wrap { display: flex; flex-direction: column; gap: 12px; }
.lin-verdict { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; line-height: 1.45; border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid var(--border); background: var(--surface); }
.lin-verdict-icon { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--st-glyph); }
.lin-verdict.pass .lin-verdict-icon { background: var(--st-done); }
.lin-verdict.fail { border-color: var(--err-border); background: var(--err-bg); }
.lin-verdict.fail .lin-verdict-icon { background: var(--st-error); }
.lin-scope-col.pass { border-color: var(--border-strong); }
.lin-scope-col.fail { border-color: var(--err-border); }
.lin-scope-title { display: inline-flex; align-items: center; gap: 8px; }
.lin-scope-result { font-size: 12px; font-weight: 500; white-space: nowrap; }
.lin-scope-result.pass { color: var(--ok-text); }
.lin-scope-result.fail { color: var(--err-text); }
.lin-scope-facts { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.lin-scope-sec { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.lin-scope-sec-result { font-size: 12px; font-weight: 600; }
.lin-scope-sec-result.pass { color: var(--ok-text); }
.lin-scope-sec-result.fail { color: var(--err-text); }
.lin-scope-sec-result.skip { color: var(--text-3); font-weight: 500; }
.lin-scope-chip.actual { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--st-done); }
.lin-scope-chip.actual.fail { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--st-error); color: var(--err-text); border-style: solid; border-color: var(--err-border); }
.lin-scope-why { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.lin-generated summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.lin-generated summary:hover { color: var(--text); }
.lin-generated[open] summary { margin-bottom: 6px; }

@media (max-width: 860px) {
    .lin-explorer { grid-template-columns: 1fr; }
    .lin-bar-row { grid-template-columns: minmax(110px, 40%) 1fr 100px; }
    .lin-hero { text-align: left; }
    .lin-pline-flow { grid-template-columns: 1fr; }
    .lin-pline-arrow { transform: rotate(90deg); justify-self: start; }
    .lin-srow { grid-template-columns: 1fr; gap: 6px; }
}

/* =====================================================================
   WORKFLOW STATUS DASHBOARD
   ===================================================================== */
.wf-bg-done { background: var(--st-done); }
.wf-bg-progress { background: var(--st-progress); }
.wf-bg-error { background: var(--st-error); }
.wf-bg-todo { background: var(--st-todo-fill); }
.wf-bg-locked { background: var(--st-locked); }

.wf-badge { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.wf-badge-icon { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; line-height: 1; color: var(--st-glyph); }
.wf-done .wf-badge-icon { background: var(--st-done); }
.wf-progress .wf-badge-icon { background: var(--st-progress); }
.wf-error .wf-badge-icon { background: var(--st-error); }
.wf-todo .wf-badge-icon { background: var(--st-todo); }
.wf-locked .wf-badge-icon { background: var(--st-locked); font-size: 9px; }
.wf-badge-label { font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; }
.wf-muted { color: var(--text-3); font-size: 12px; }
.wf-unknown { margin-top: 8px; font-size: 12.5px; }

.wf-switcher { display: flex; gap: 8px; align-items: flex-end; }
.wf-field { display: flex; flex-direction: column; gap: 4px; }
.wf-field-label { font-size: 11.5px; font-weight: 500; color: var(--text-3); padding-left: 1px; }
.wf-switcher .lin-search { width: 112px; font-family: var(--mono); font-size: 12.5px; }
.wf-switcher .wf-field-root .lin-search { width: 170px; }

.wf-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.wf-kpi { text-align: left; cursor: pointer; color: var(--text); transition: border-color .15s, background .15s; }
.wf-kpi:hover { background: var(--surface-2); border-color: var(--border-strong); }
.wf-kpi-top { display: flex; align-items: center; gap: 10px; }
.wf-kpi-error { border-color: var(--err-border); }
.wf-kpi-error:hover { border-color: var(--st-error); }

.wf-stack-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wf-stack { display: flex; gap: 2px; width: 100%; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.wf-seg { min-width: 3px; cursor: default; }
.wf-seg:first-child { border-radius: 4px 0 0 4px; }
.wf-seg:last-child { border-radius: 0 4px 4px 0; }
.wf-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.wf-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.wf-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.wf-overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.wf-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wf-panel h4 { margin: 0 0 6px 2px; }
.wf-group, .wf-issue { display: flex; flex-direction: column; gap: 7px; text-align: left; background: none; border: 1px solid transparent; border-radius: var(--radius-xs); padding: 9px 10px; color: var(--text); cursor: pointer; transition: background .12s, border-color .12s; }
.wf-group:hover, .wf-issue:hover { background: var(--surface-2); border-color: var(--border); }
.wf-group-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; min-width: 0; }
.wf-group-name > span:not(.wf-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-group-facts { font-size: 12px; color: var(--text-3); }
.wf-issue-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wf-issue-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-issue-time { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wf-issue-msg { font-size: 12.5px; color: var(--text-2); padding-left: 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wf-explorer { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 80px; }
.wf-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wf-search { max-width: 340px; flex: 1 1 220px; }
.wf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wf-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 10px 0 5px; color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: background .12s, border-color .12s; }
.wf-chip:hover { background: var(--surface-2); border-color: var(--border-strong); }
.wf-chip.on { border-color: var(--text); background: var(--surface-3); color: var(--text); }
.wf-tree-pane .lin-crumbs { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.wf-list { max-height: 520px; }
.wf-node { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.wf-node:last-child { border-bottom: none; }
.wf-node:hover { background: var(--surface-2); }
.wf-node.selected { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--text); }
.wf-node.focus .wf-node-name { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.wf-node-main { min-width: 0; }
.wf-node-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wf-node-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-node-sub { font-size: 12px; color: var(--text-3); margin: 2px 0 0 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-node-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 92px; }
.wf-mini { width: 92px; }
.wf-steps { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.wf-stepbar { display: flex; flex-direction: column; gap: 6px; }
.wf-progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wf-progress-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.wf-progress-fill { height: 100%; border-radius: 0 4px 4px 0; }
.wf-message { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-left: 2px solid var(--border-strong); border-radius: 0 var(--radius-xs) var(--radius-xs) 0; padding: 9px 11px; max-height: 220px; overflow: auto; }
.wf-message-error { border-left-color: var(--st-error); }
.wf-message-progress { border-left-color: var(--st-progress); }
.wf-child-list { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-child { display: inline-flex; align-items: center; gap: 6px; height: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 10px 0 5px; color: var(--text); font-size: 12.5px; cursor: pointer; transition: border-color .12s, background .12s; }
.wf-child:hover { border-color: var(--border-strong); background: var(--surface-2); }

.wf-matrix-pane { display: flex; flex-direction: column; gap: 10px; }
.wf-matrix-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-select { width: auto; min-width: 180px; cursor: pointer; }
.wf-matrix-wrap { max-height: 560px; overflow: auto; }
.wf-matrix { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.wf-matrix th, .wf-matrix td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: center; white-space: nowrap; }
.wf-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2); font-weight: 500; font-size: 12px; }
.wf-matrix-corner, .wf-matrix-entity { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left !important; }
.wf-matrix thead .wf-matrix-corner { z-index: 3; background: var(--surface-2); }
.wf-matrix-name { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.wf-matrix tbody tr:hover td, .wf-matrix tbody tr:hover th { background: var(--surface-2); }
.wf-cell { width: 30px; height: 22px; border: none; border-radius: 4px; color: var(--st-glyph); font-size: 11px; font-weight: 700; cursor: pointer; }
.wf-cell:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.wf-cell.dim { opacity: .18; }
.wf-cell-none { color: var(--text-3); }
.wf-cell.wf-bg-todo { color: var(--text-2); }

@media (max-width: 860px) {
    .wf-overview { grid-template-columns: 1fr; }
    .wf-switcher { flex-wrap: wrap; }
}

/* =====================================================================
   VALIDATION CONTROLS
   Red = KO blocking and ERROR, amber = KO warning, green only as a small
   check. Every colour comes with an icon and a label.
   ===================================================================== */
.vc-card { gap: 16px; }
.vc-card button { font-family: var(--font); }
.vc-card :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: var(--radius-xs); }
.vc-card .vc-row-btn:focus-visible, .vc-card .vc-group-btn:focus-visible { outline-offset: -2px; border-radius: 0; outline-width: 1.5px; }
.vc-card .vc-search input:focus-visible { outline: none; }
.vc-card [hidden] { display: none !important; }
.vc-icon { display: inline-flex; width: 16px; height: 16px; flex: 0 0 auto; }
.vc-icon svg { width: 100%; height: 100%; }
.vc-k-blocking .vc-icon, .vc-k-blocking.vc-icon { color: var(--st-error); }
.vc-k-warning .vc-icon { color: var(--st-progress); }
.vc-k-error .vc-icon { color: var(--st-error); }
.vc-k-passed .vc-icon, .vc-ok-ink { color: var(--st-done); }
.vc-muted { color: var(--text-3) !important; }
.vc-note { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }

/* header */
.vc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.vc-head-main { min-width: 0; flex: 1 1 260px; }
.vc-title { display: flex; align-items: flex-start; gap: 10px; font-size: 18px !important; overflow-wrap: anywhere; }
.vc-title-icon { width: 20px; height: 20px; margin-top: 2px; color: var(--text-2); }
.vc-sub { font-variant-numeric: tabular-nums; }
.vc-sub-filter { color: var(--text-3); }
.vc-crumbs { padding: 0 0 8px; }

.vc-verdict { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.vc-verdict.small { height: 24px; padding: 0 9px; font-size: 11px; gap: 5px; }
.vc-verdict.small .vc-icon { width: 13px; height: 13px; }
.vc-v-blocked { background: var(--st-error); color: var(--st-glyph); }
.vc-v-blocked .vc-icon { color: var(--st-glyph); }
.vc-v-blocked .vc-icon svg path { stroke: var(--st-error); }
.vc-v-errors { color: var(--err-text); border-color: var(--st-error); background: transparent; }
.vc-v-errors .vc-icon { color: var(--st-error); }
.vc-v-warnings { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.vc-v-warnings .vc-icon { color: var(--st-progress); }
.vc-v-passed { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.vc-v-passed .vc-icon { color: var(--st-done); }
.vc-v-notrun { color: var(--text-3); border: 1px dashed var(--border-strong); background: transparent; }
.vc-mix { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.vc-mix-item { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.vc-v-blocked-text .vc-icon, .vc-v-errors-text .vc-icon { color: var(--st-error); }
.vc-v-warnings-text .vc-icon { color: var(--st-progress); }
.vc-v-passed-text .vc-icon { color: var(--st-done); }
.vc-v-notrun-text .vc-icon { color: var(--text-3); }

/* KPI strip */
.vc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.vc-kpi { display: flex; flex-direction: column; gap: 6px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 12px; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.vc-kpi:hover { background: var(--surface-2); border-color: var(--border-strong); }
.vc-kpi[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.vc-kpi-top { display: flex; align-items: center; gap: 8px; }
.vc-kpi-value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.vc-kpi-label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-kpi-bar { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.vc-kpi-fill { height: 100%; border-radius: 2px; background: var(--data-soft); min-width: 0; }
.vc-kpi.vc-k-blocking .vc-kpi-fill, .vc-kpi.vc-k-error .vc-kpi-fill { background: var(--st-error); }
.vc-kpi.vc-k-warning .vc-kpi-fill { background: var(--st-progress); }
.vc-kpi.muted { color: var(--text-3); }
.vc-kpi.muted .vc-icon { color: var(--text-3); opacity: .7; }
.vc-kpi.muted .vc-kpi-label { color: var(--text-3); }

/* banners */
.vc-banner { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.vc-banner-error { border-color: var(--err-border); background: var(--err-bg); color: var(--err-text); cursor: pointer; }
.vc-banner-error .vc-icon { color: var(--st-error); }
.vc-banner-warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.vc-banner-warn .vc-icon { color: var(--st-progress); }
.vc-banner-action { margin-left: auto; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.vc-inline-error { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--err-border); background: var(--err-bg); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text); }
.vc-inline-error .vc-icon { color: var(--st-error); margin-top: 1px; }
.vc-inline-error-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vc-inline-error-title { font-weight: 600; color: var(--err-text); overflow-wrap: anywhere; }

/* toolbar */
.vc-toolbar { display: flex; flex-direction: column; gap: 10px; }
.vc-toolbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.vc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vc-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: background .12s, border-color .12s; }
.vc-chip .vc-icon { width: 13px; height: 13px; }
.vc-chip:hover { background: var(--surface-2); border-color: var(--border-strong); }
.vc-chip[aria-checked="true"] { border-color: var(--text); background: var(--surface-3); color: var(--text); }
.vc-chip-count { font-variant-numeric: tabular-nums; color: var(--text-3); }
.vc-chip[aria-checked="true"] .vc-chip-count { color: var(--text-2); }
.vc-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-3); }
.vc-search:focus-within { border-color: var(--text-3); box-shadow: var(--ring); }
/* !important: beats the Adaptive Card input rule (.adaptive-card-wrapper input) the view is rendered inside */
.vc-card .vc-search input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 100%; padding: 0; border: none !important; border-radius: 0 !important; outline: none; box-shadow: none; background: transparent !important; color: var(--text); font: inherit; font-size: 13.5px; }
.vc-card .vc-search input::-webkit-search-cancel-button { cursor: pointer; }
.vc-search input::placeholder { color: var(--text-3); }
.vc-kbd { font-family: var(--mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; line-height: 18px; }
.vc-seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); flex-wrap: wrap; }
.vc-seg-label { font-size: 12px; color: var(--text-3); padding: 0 6px 0 6px; }
.vc-seg-btn { height: 26px; padding: 0 10px; border: none; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.vc-seg-btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.vc-switch { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; padding: 4px 2px; }
.vc-switch-track { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--surface-4); transition: background .15s; flex: 0 0 auto; }
.vc-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.vc-switch[aria-checked="true"] { color: var(--text); }
.vc-switch[aria-checked="true"] .vc-switch-track { background: var(--accent); }
.vc-switch[aria-checked="true"] .vc-switch-track::after { transform: translateX(12px); background: var(--accent-fg); }

/* list */
.vc-list-shell { display: flex; flex-direction: column; gap: 8px; transition: opacity .2s; }
.vc-is-running .vc-list-shell, .vc-is-running .vc-kpis, .vc-is-running .vc-toolbar, .vc-is-running .vc-etable-wrap { opacity: .45; pointer-events: none; }
.vc-list { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.vc-list.vc-virtual { max-height: 640px; overflow: auto; position: relative; }
.vc-vinner { position: relative; width: 100%; }
.vc-vitem { position: absolute; top: 0; left: 0; right: 0; }
.vc-item { border-bottom: 1px solid var(--border); }
.vc-item:last-child { border-bottom: none; }
.vc-list.vc-virtual .vc-item:last-child { border-bottom: 1px solid var(--border); }
.vc-group { background: var(--surface-2); }
.vc-group-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 12px; background: none; border: none; text-align: left; color: var(--text); cursor: pointer; }
.vc-group-btn:hover { background: var(--surface-3); }
.vc-group-name { font-size: 13px; font-weight: 600; }
.vc-group-facts { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: 1; min-width: 0; }
.vc-chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }
[aria-expanded="true"] > .vc-chev { transform: rotate(90deg); }
.vc-chev-end { margin-left: auto; align-self: center; }

.vc-row-btn { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; align-items: start; gap: 4px 14px; width: 100%; padding: 10px 12px; background: none; border: none; text-align: left; color: var(--text); cursor: pointer; transition: background .12s; }
.vc-set .vc-row-btn { grid-template-columns: 128px minmax(0, 1fr) 16px; }
.vc-row-btn:hover { background: var(--surface-2); }
.vc-row-btn[aria-expanded="true"] { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--text); }
.vc-item.d1 .vc-row-btn { padding-left: 24px; }
.vc-item.d2 .vc-row-btn { padding-left: 40px; }
.vc-item.d2 { background: var(--bg-subtle); }
.vc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; padding-top: 1px; }
.vc-status.vc-k-blocking .vc-status-label, .vc-status.vc-k-error .vc-status-label { color: var(--err-text); }
.vc-status.vc-k-warning .vc-status-label { color: var(--warn-text); }
.vc-status.vc-k-passed .vc-status-label { color: var(--text-2); }
.vc-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vc-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; }
.vc-row-title b { font-weight: 600; }
.vc-row-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vc-set-facts { color: var(--text-2); font-variant-numeric: tabular-nums; }
.vc-iter { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; line-height: 19px; }
.vc-row-num { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; min-width: 104px; }
.vc-amount { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vc-expected { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vc-change { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 0 6px; line-height: 18px; border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); }
.vc-change-now_ok { border-color: var(--st-done); color: var(--ok-text); }
.vc-change-new_ko, .vc-change-new, .vc-change-new_error { border-color: var(--st-error); color: var(--err-text); }
.vc-changed > .vc-row-btn { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text-2); }

.vc-list-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 0; }
.vc-list-foot:empty { display: none; }
.vc-show-passed { margin: 0; }
.vc-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-left: auto; }

/* expansion */
.vc-detail { display: flex; flex-direction: column; gap: 14px; padding: 4px 14px 16px 154px; background: var(--surface-2); border-top: 1px dashed var(--border); }
.vc-item.d1 .vc-detail { padding-left: 166px; }
.vc-item.d2 .vc-detail { padding-left: 182px; }
.vc-sec { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 10px; }
.vc-sec .lin-detail-label { margin: 0; }
.vc-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vc-expl { font-size: 13.5px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.vc-terms { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); max-height: 320px; overflow: auto; }
.vc-term { display: grid; grid-template-columns: minmax(22px, max-content) minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.vc-term:last-child { border-bottom: none; }
.vc-term.inactive { opacity: .5; }
.vc-term-total { background: var(--surface-2); align-items: center; position: sticky; bottom: 0; }
.vc-sign { font-family: var(--mono); font-size: 13px; font-weight: 600; text-align: center; white-space: nowrap; color: var(--text-2); }
.vc-sign.neg { color: var(--text); }
.vc-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.vc-total-label { font-size: 12.5px; color: var(--text-2); }
.vc-total-value { font-size: 14px; font-variant-numeric: tabular-nums; }
.vc-pov { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-3); overflow-wrap: anywhere; word-break: break-word; }
.vc-tok { white-space: nowrap; }
.vc-tok-dim { opacity: .75; }
.vc-tok.key { color: var(--text); font-weight: 600; }
.vc-pov-sep { opacity: .5; }
.vc-error-box { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--err-border); border-left: 3px solid var(--st-error); background: var(--surface); border-radius: var(--radius-xs); padding: 10px 12px; }
.vc-error-first { font-size: 13.5px; font-weight: 600; color: var(--err-text); overflow-wrap: anywhere; }
.vc-trace summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.vc-trace[open] summary { margin-bottom: 6px; }
.vc-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 13px; }
.vc-facts dt { color: var(--text-3); }
.vc-facts dd { color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.vc-def { display: flex; flex-direction: column; gap: 10px; }
.vc-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

/* empty / success */
.vc-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.vc-empty-inline { border: none; padding: 26px 16px; }
.vc-empty-icon { width: 28px; height: 28px; color: var(--text-3); }
.vc-empty-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.vc-empty-sub { font-size: 13px; color: var(--text-2); }
.vc-empty .lin-primary { margin-top: 6px; }
.vc-success { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text); }

/* entity table */
.vc-etable-wrap { max-height: 520px; overflow: auto; }
.vc-etable th { padding: 0; }
.vc-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; height: 34px; padding: 0 12px; background: none; border: none; color: inherit; font: inherit; font-weight: 500; cursor: pointer; justify-content: inherit; }
.vc-etable th.num .vc-sort { justify-content: flex-end; }
.vc-sort-dir { color: var(--text-3); }
.vc-erow { cursor: pointer; }
.vc-erow td { font-variant-numeric: tabular-nums; }
.vc-n { color: var(--text-3); }
.vc-n-blocking, .vc-n-error { color: var(--err-text); font-weight: 600; }
.vc-n-warning { color: var(--warn-text); font-weight: 600; }

/* footer, confirmation, progress */
.vc-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.vc-footer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vc-footer-actions button:disabled { opacity: .45; cursor: default; }
.vc-generated { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.vc-confirm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lg); }
.vc-confirm-title { font-size: 15px; font-weight: 600; }
.vc-modes { display: flex; flex-direction: column; gap: 6px; }
.vc-mode { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-xs); cursor: pointer; }
.vc-mode:has(input:checked) { border-color: var(--text); background: var(--surface-2); }
.vc-mode input { margin-top: 3px; accent-color: var(--accent); }
.vc-mode-text { display: flex; flex-direction: column; gap: 2px; }
.vc-mode-label { font-size: 13.5px; font-weight: 500; }
.vc-progress { display: flex; align-items: center; gap: 12px; width: 100%; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.vc-progress-bar { position: relative; flex: 0 0 120px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.vc-progress-bar::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 2px; background: var(--text-2); animation: vc-indeterminate 1.4s ease-in-out infinite; }
@keyframes vc-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* skeleton */
.vc-skeleton { display: flex; flex-direction: column; gap: 12px; }
.vc-sk { border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: vc-shimmer 1.3s ease-in-out infinite; }
@keyframes vc-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.vc-sk-head { display: flex; justify-content: space-between; gap: 16px; }
.vc-sk-title { height: 22px; width: 60%; }
.vc-sk-badge { height: 30px; width: 110px; border-radius: 999px; }
.vc-sk-sub { height: 12px; width: 40%; }
.vc-sk-tile { height: 78px; border-radius: var(--radius-sm); }
.vc-sk-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 90px; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.vc-sk-dot { height: 16px; width: 16px; border-radius: 50%; }
.vc-sk-line { height: 14px; }
.vc-sk-num { height: 14px; }

@media (max-width: 720px) {
    .vc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vc-detail, .vc-item.d1 .vc-detail, .vc-item.d2 .vc-detail { padding-left: 14px; }
}
@media (max-width: 520px) {
    .vc-row-btn, .vc-set .vc-row-btn { grid-template-columns: 22px minmax(0, 1fr); }
    .vc-status-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .vc-row-num { grid-column: 2; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 8px; min-width: 0; }
    .vc-set .vc-chev-end { display: none; }
    .vc-item.d1 .vc-row-btn { padding-left: 18px; }
    .vc-item.d2 .vc-row-btn { padding-left: 26px; }
    .vc-verdict { height: 26px; font-size: 11.5px; }
    .vc-title { font-size: 16px !important; }
    .vc-kbd { display: none; }
    .vc-facts { grid-template-columns: 1fr; gap: 0 0; }
    .vc-facts dd { margin-bottom: 6px; }
}

/* =====================================================================
   METADATA PICKERS, CONSOLIDATION LAUNCHER, DATA MODEL VIEW
   Same tokens as the validation controls: grey scale, red = error,
   amber = warning; the accent only on the primary button.
   ===================================================================== */
.mp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mp-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.mp-helper { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.mp-error { font-size: 12.5px; color: var(--err-text); line-height: 1.45; overflow-wrap: anywhere; }
.mp-error-actions { display: flex; flex-wrap: wrap; gap: 8px; align-self: center; }
.mp-combo { position: relative; display: flex; align-items: center; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); }
.mp-combo:focus-within { border-color: var(--text-3); box-shadow: var(--ring); }
.mp-field.invalid .mp-combo, .mp-tree-wrap.invalid .mp-tree { border-color: var(--st-error); }
/* !important: beats the Adaptive Card input rule (.adaptive-card-wrapper input) the cards are rendered inside */
.mp-combo .mp-input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 100%; padding: 0 10px; border: none !important; border-radius: 0 !important; outline: none; box-shadow: none; background: transparent !important; color: var(--text); font: inherit; font-size: 13.5px; }
.mp-combo-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 100%; border: none; background: none; color: var(--text-3); cursor: pointer; }
.mp-combo-chev { width: 14px; height: 14px; transform: rotate(90deg); }
.mp-listbox { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.mp-option { display: flex; align-items: baseline; gap: 8px; padding: 7px 9px; border-radius: var(--radius-xs); font-size: 13.5px; cursor: pointer; }
.mp-option:hover, .mp-option.active { background: var(--surface-3); }
.mp-option.selected .mp-option-name { font-weight: 600; }
.mp-option-hint { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-option-empty { padding: 8px 9px; font-size: 12.5px; color: var(--text-3); }
.mp-select { height: 32px; padding: 0 8px; font: inherit; font-size: 13.5px; }
.mp-seg { flex-wrap: wrap; }
.mp-seg .vc-seg-btn { font-variant-numeric: tabular-nums; }
.mp-time-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mp-time-out { font-family: var(--mono); font-size: 13px; color: var(--text); }
.mp-time-row { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.mp-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); flex: 1 1 380px; }
.mp-months .vc-seg-btn { padding: 0 4px; min-width: 0; }

/* entity tree */
.mp-tree-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; }
.mp-tree { position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-height: 120px; }
.mp-tree:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.mp-tree-inner { position: relative; width: 100%; }
.mp-node { position: absolute; left: 0; right: 0; height: 34px; display: flex; align-items: center; gap: 8px; padding-right: 10px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.mp-node:hover { background: var(--surface-2); }
.mp-node.active { background: var(--surface-3); }
.mp-tree:focus-visible .mp-node.active { box-shadow: inset 0 0 0 1.5px var(--text-3); }
.mp-node.selected { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--text); }
.mp-chev { display: inline-flex; width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-3); }
.mp-chev .vc-icon { width: 14px; height: 14px; margin: 1px; transition: transform .15s; }
.mp-node[aria-expanded="true"] .mp-chev .vc-icon { transform: rotate(90deg); }
.mp-chev.loading { border: 2px solid var(--border-strong); border-top-color: var(--text-2); border-radius: 50%; width: 12px; height: 12px; flex-basis: 12px; margin: 0 2px; animation: mp-spin .8s linear infinite; }
.mp-chev.loading .vc-icon { display: none; }
@keyframes mp-spin { to { transform: rotate(360deg); } }
.mp-node-name { font-weight: 600; color: var(--text); }
.mp-node-desc { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mp-node-err { font-size: 11.5px; color: var(--err-text); }
.mp-tag { font-size: 10.5px; letter-spacing: .03em; color: var(--text-3); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; line-height: 16px; flex: 0 0 auto; }
.mp-tree-empty { padding: 14px; font-size: 13px; color: var(--text-3); }
.mp-results { position: absolute; z-index: 30; top: 42px; left: 0; right: 0; max-height: 300px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.mp-result { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border-radius: var(--radius-xs); cursor: pointer; }
.mp-result:hover, .mp-result.active { background: var(--surface-3); }
.mp-result-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; min-width: 0; }
.mp-result-path { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; }
.mp-selected { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 28px; }
.mp-selected-empty { font-size: 12.5px; color: var(--text-3); }
.mp-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid var(--text); border-radius: 999px; font-size: 12.5px; background: var(--surface); font-variant-numeric: tabular-nums; }
.mp-chip b { font-family: var(--mono); font-weight: 600; }
.mp-chip-sep { color: var(--text-3); }
.mp-selected-path { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); overflow-wrap: anywhere; }

/* skeletons */
.mp-sk-field { display: flex; flex-direction: column; gap: 6px; }
.mp-sk-label { height: 11px; width: 90px; }
.mp-sk-input { height: 36px; border-radius: var(--radius-xs); }
.mp-sk-node { height: 22px; margin: 6px 0; width: 70%; }
.mp-sk-node:nth-child(odd) { width: 55%; margin-left: 18px; }

/* consolidation launcher */
.cl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.cl-params, .cl-entity { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cl-hint { font-size: 12.5px; padding: 7px 10px; }
.cl-cands { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-entity-notes { display: flex; flex-direction: column; gap: 8px; }
.cl-entity-notes:empty { display: none; }
.cl-footer { align-items: flex-end; }
.cl-summary { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 260px; }
.cl-summary-text { font-family: var(--mono); font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.cl-summary-why { font-size: 12px; color: var(--text-3); }
.cl-footer .lin-primary:disabled { opacity: .45; cursor: default; }
.cl-confirm .lin-primary:disabled { opacity: .45; cursor: default; }
.cl-run-pov { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cl-progress .vc-progress-bar { flex-basis: 160px; }
.cl-ok { border-color: var(--border-strong); }
.cl-warn-text { display: flex; flex-direction: column; gap: 3px; }
.cl-b-running { color: var(--text-2); border: 1px solid var(--border-strong); background: var(--surface-2); }
.cl-b-running .vc-icon { color: var(--text-3); animation: mp-spin 2.4s linear infinite; }
.vc-v-warnings.small, .vc-v-blocked.small, .vc-v-passed.small { text-transform: uppercase; }

/* POV question and member picker cards */
.mp-pov { display: flex; flex-direction: column; gap: 14px; }
.mp-pov-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 14px 18px; align-items: start; }
.mp-pov-actions { display: flex; gap: 8px; }
.mp-pov-editor { gap: 14px; }
.mp-cands { display: flex; flex-direction: column; gap: 6px; }
.mp-cand { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.mp-cand:hover { border-color: var(--border-strong); background: var(--surface-2); }
.mp-cand.chosen { border-color: var(--text); }
.mp-cand:disabled { cursor: default; opacity: .6; }
.mp-picker-search { margin-top: 4px; }
.mp-picker .vc-search input, .mp-pov-editor .vc-search input, .ly-card .mp-tree-search input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 100%; padding: 0; border: none !important; border-radius: 0 !important; outline: none; box-shadow: none; background: transparent !important; color: var(--text); font: inherit; font-size: 13.5px; }
.mp-picker-cancel { align-self: flex-start; }

/* data model view */
.mv-filter { max-width: 420px; }
.mv-table { display: flex; flex-direction: column; gap: 10px; }
.mv-props { display: flex; flex-direction: column; gap: 10px; }
.mv-prop-list { display: flex; flex-direction: column; gap: 16px; max-height: 560px; overflow: auto; }
.mv-member { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mv-member-head { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.mv-member-desc { color: var(--text-3); font-size: 13px; }
.mv-prop-table th.mv-prop-name { width: 38%; background: transparent; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text-2); text-align: left; overflow-wrap: anywhere; vertical-align: baseline; }
.mv-prop-value { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; vertical-align: baseline; }
.mv-ovr-btn { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; padding: 0 8px; height: 22px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 11.5px; cursor: pointer; vertical-align: middle; }
.mv-ovr-btn:hover { border-color: var(--border-strong); color: var(--text); }
.mv-ovr-btn .vc-chev { width: 12px; height: 12px; }
.mv-ovr > td { background: var(--surface-2); padding: 6px 12px 10px; }
.mv-ovr-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mv-ovr-table th { text-align: left; font-weight: 500; color: var(--text-3); padding: 4px 8px 4px 0; border-bottom: 1px solid var(--border); }
.mv-ovr-table td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.mv-ovr-table tr:last-child td { border-bottom: none; }

@media (max-width: 760px) {
    .cl-grid { grid-template-columns: 1fr; }
    .mp-pov-grid { grid-template-columns: 1fr; }
    .mp-months { grid-template-columns: repeat(6, minmax(0, 1fr)); flex-basis: 100%; }
}
@media (max-width: 520px) {
    .mp-node-desc { display: none; }
    .mv-prop-table th.mv-prop-name { width: 42%; }
    .cl-footer .vc-footer-actions { width: 100%; }
}

/* =====================================================================
   DATA MODEL EXPLORER
   Three panes: dimensions | the whole dimension as a tree (only the rows in
   view are drawn) | the selected member. Greys only; the accent marks the
   selection. 32 px rows, 18 px indent with guide lines.
   ===================================================================== */
.me-card { --me-h: 600px; gap: 14px; }
.me-head { padding-bottom: 12px; }
.me-head-tools { display: flex; align-items: center; gap: 8px; }
.me-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.me-iconbtn:hover { background: var(--surface-3); color: var(--text); }
.me-iconbtn .vc-icon { width: 15px; height: 15px; }
.me-iconbtn.small { width: 26px; height: 26px; border-color: var(--border); }
.me-iconbtn.small .vc-icon { width: 13px; height: 13px; }
.me-iconbtn.done { color: var(--ok-text); border-color: var(--st-done); }
.me-body { display: grid; grid-template-columns: 216px minmax(0, 1fr) 312px; height: var(--me-h); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }

/* rail */
.me-rail { display: flex; flex-direction: column; gap: 8px; padding: 10px 8px; border-right: 1px solid var(--border); background: var(--bg-subtle); min-height: 0; }
.me-rail-search { height: 32px; }
.me-rail-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.me-rail-group { display: flex; flex-direction: column; gap: 1px; }
.me-rail-type { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); padding: 4px 8px 3px; }
.me-dim { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 30px; padding: 0 8px; border: none; border-radius: var(--radius-xs); background: none; color: var(--text-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.me-dim:hover { background: var(--surface-3); color: var(--text); }
/* every dimension name in the same font: the selection shows by its background, only the type headers stand out */
.me-dim.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-sm); }
.me-dim-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-dim-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 400; }

/* main: dimension header, toolbar, rows */
.me-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.me-dimhead { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.me-dimname { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; min-width: 0; }
.me-dimname > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-type { font-size: 11px; font-weight: 500; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; line-height: 19px; background: var(--surface-2); }
.me-dimfacts { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.me-toolbar { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.me-toolbar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.me-toolbar-sub { justify-content: space-between; }
.me-search { flex: 1 1 200px; min-width: 0; height: 34px; }
.me-levels { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.me-chip { height: 26px; padding: 0 9px; font-size: 12px; }
.me-viewseg .vc-seg-btn, .me-kindseg .vc-seg-btn { height: 28px; }
.me-card .vc-search input, .me-card .me-rail-search input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 100%; padding: 0; border: none !important; border-radius: 0 !important; outline: none; box-shadow: none; background: transparent !important; color: var(--text); font: inherit; font-size: 13px; }
.me-view { position: relative; flex: 1; overflow: auto; min-height: 0; outline: none; overscroll-behavior: contain; }
.me-card .me-view:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--text-3); }
.me-inner { position: relative; width: 100%; }
.me-row { position: absolute; left: 0; right: 0; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 8px; font-size: 13px; white-space: nowrap; cursor: pointer; color: var(--text); }
.me-row:hover { background: var(--surface-2); }
.me-row.active { background: var(--surface-3); }
.me-view:focus-visible .me-row.active { box-shadow: inset 0 0 0 1.5px var(--text-3); }
.me-row.selected { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--accent); }
.me-row.selected .me-name { font-weight: 600; }
.me-guides { flex: 0 0 auto; align-self: stretch; background-image: repeating-linear-gradient(to right, transparent 0 8px, var(--border-strong) 8px 9px, transparent 9px 18px); opacity: .7; }
.me-twisty { flex: 0 0 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); border-radius: 4px; }
.me-twisty:hover { background: var(--surface-4); color: var(--text); }
.me-twisty .vc-icon { width: 13px; height: 13px; transition: transform .14s ease; }
.me-row[aria-expanded="true"] .me-twisty .vc-icon { transform: rotate(90deg); }
.me-glyph { width: 12px; height: 12px; color: var(--data-soft); }
.me-glyph.parent { color: var(--text-2); }
.me-row.group .me-glyph { color: var(--text-3); }
.me-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12.5px; }
.me-desc { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); font-size: 12.5px; }
.me-meta { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding-left: 8px; }
.me-count { min-width: 22px; text-align: right; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.me-badge { font-size: 10.5px; font-weight: 600; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 6px; line-height: 16px; }
.me-mark { background: var(--warn-bg); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--warn-border); }
.me-row.hit .me-name { font-weight: 600; }
.me-row.group .me-name { font-family: var(--font); font-style: italic; color: var(--text-2); }
.me-lrow { gap: 8px; padding-left: 12px; }
.me-lpath { flex: 0 1 38%; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; color: var(--text-3); font-family: var(--mono); font-size: 11px; margin-left: auto; }
.me-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--text-3); }
.me-status { padding: 6px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; background: var(--bg-subtle); }
.me-trunc { margin: 8px 14px 0; font-size: 12.5px; }

/* detail */
.me-detail { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-left: 1px solid var(--border); background: var(--bg-subtle); overflow: auto; min-height: 0; }
.me-d-head { display: flex; flex-direction: column; gap: 6px; }
.me-d-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.me-d-desc { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.me-d-tags, .me-kids { display: flex; flex-wrap: wrap; gap: 6px; }
.me-tag { font-size: 11.5px; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.me-tag-alt { border-color: var(--border-strong); color: var(--text); }
.me-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.me-summary .me-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.me-stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); min-width: 0; }
.me-stat dt { font-size: 11px; line-height: 1.25; color: var(--text-3); overflow-wrap: anywhere; }
.me-stat dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.me-d-sec { display: flex; flex-direction: column; gap: 6px; }
.me-d-label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.me-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 6px; border-radius: var(--radius-xs); border: 1px solid transparent; }
.me-crumbs.current { border-color: var(--border); background: var(--surface); }
.me-crumb { border: none; background: none; padding: 1px 4px; border-radius: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); cursor: pointer; }
.me-crumb:hover { background: var(--surface-3); color: var(--text); }
.me-crumbs .me-crumb:last-child { color: var(--text); font-weight: 600; }
.me-crumb-sep { color: var(--text-3); font-size: 11px; }
.me-kid { height: 24px; padding: 0 8px; font-family: var(--mono); font-size: 11.5px; }
.me-plist { display: flex; flex-direction: column; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); }
.me-prow { display: grid; grid-template-columns: minmax(96px, 42%) minmax(0, 1fr); gap: 8px; padding: 6px 9px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.me-prow:last-child { border-bottom: none; }
.me-prow dt { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); overflow-wrap: anywhere; }
.me-prow dd { margin: 0; overflow-wrap: anywhere; }
.me-pvar summary { cursor: pointer; font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.me-pvar ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.me-pvar li { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.me-pvar-k { color: var(--text-3); }
.me-msg { font-size: 12px; padding: 6px 9px; }
.me-d-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
.me-hint { font-size: 11.5px; }

/* skeletons */
.me-sk-dim { height: 26px; margin: 2px 6px; }
.me-sk-row { height: 32px; display: flex; align-items: center; }
.me-sk-line { height: 12px; width: 40%; }
.me-sk-row:nth-child(3n) .me-sk-line { width: 28%; }
.me-sk-detail { height: 54px; }
.me-props-sk { display: flex; flex-direction: column; gap: 6px; }
.me-sk-prop { height: 18px; }

/* full screen */
.me-card.me-full { position: fixed; inset: 16px; z-index: 1000; margin: 0; width: auto; height: auto; max-width: none; box-sizing: border-box; padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), var(--shadow-lg); display: flex; flex-direction: column; }
.me-card.me-full .me-body { flex: 1; height: auto; min-height: 0; }
body.me-noscroll { overflow: hidden; }

@media (max-width: 1100px) {
    .me-body { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
    .me-detail { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--border); overflow: visible; }
    .me-card { --me-h: auto; }
    .me-body { height: auto; }
    .me-main { height: 560px; }
    .me-rail { max-height: 560px; }
}
@media (max-width: 720px) {
    .me-body { grid-template-columns: minmax(0, 1fr); }
    .me-toolbar-sub { justify-content: flex-start; }
    .me-rail { max-height: none; border-right: none; border-bottom: 1px solid var(--border); padding: 8px; }
    .me-rail-search { display: none; }
    .me-rail-list { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
    .me-rail-group { flex-direction: row; gap: 4px; }
    .me-rail-type { display: none; }
    .me-dim { flex: 0 0 auto; width: auto; border: 1px solid var(--border); background: var(--surface); }
    .me-main { height: 480px; }
    .me-desc { display: none; }
    .me-lpath { display: none; }
    .me-search .vc-kbd { display: none; }
    .me-card.me-full { inset: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .me-twisty .vc-icon { transition: none; }
}

/* ================================================================================================================
   DATA VIEW (lyraCardType "dataView"): layout zones (filters / rows / columns, drag & drop), pickers, pivot grid with
   sticky headers and resizable row labels, cell panel
   ================================================================================================================ */
.dv-card { gap: 14px; }
.dv-head { padding-bottom: 12px; }
.dv-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dv-back { display: inline-flex; align-items: center; gap: 4px; }
.dv-back .vc-icon { width: 14px; height: 14px; }
.dv-layout-select { min-width: 240px; max-width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); cursor: pointer; }

/* layout zones */
.dv-zones { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.dv-zone { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 10px; padding: 8px 12px; transition: background .12s, box-shadow .12s; }
.dv-zone + .dv-zone { border-top: 1px solid var(--border); }
.dv-zone-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding-top: 8px; }
.dv-zone-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 32px; }
.dv-zone-hint { font-size: 12px; color: var(--text-3); padding: 0 6px; border: 1px dashed transparent; border-radius: 999px; height: 30px; display: inline-flex; align-items: center; }
.dv-zone-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.dv-dragging .dv-zone-rows .dv-zone-hint, .dv-dragging .dv-zone-columns .dv-zone-hint { border-color: var(--border-strong); color: var(--text-2); }
.dv-zone.over { background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--text-3); }
.dv-zone:first-child.over { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.dv-zone:last-child.over { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.dv-chip-wrap { position: relative; max-width: 100%; min-width: 0; }
.dv-dim { display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: 100%; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12.5px; cursor: pointer; transition: background .12s, border-color .12s, opacity .12s; }
.dv-dim:hover { border-color: var(--border-strong); background: var(--surface); }
.dv-dim[aria-expanded="true"] { border-color: var(--text); }
.dv-dim.axis { border-radius: var(--radius-xs); padding-left: 4px; box-shadow: var(--shadow-sm); cursor: grab; }
.dv-dim.axis:active { cursor: grabbing; }
.dv-dim.small { height: 26px; font-size: 12px; padding: 0 6px 0 8px; }
.dv-dim.dragging { opacity: .35; }
.dv-grip { width: 14px; height: 14px; color: var(--text-3); }
.dv-chip-k { color: var(--text-3); white-space: nowrap; }
.dv-chip-v { font-weight: 600; font-variant-numeric: tabular-nums; max-width: 260px; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-dim.small .dv-chip-v { max-width: 150px; font-weight: 500; }
.dv-chip-tag { font-size: 10.5px; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; line-height: 15px; }
.dv-chip-chev { width: 12px; height: 12px; color: var(--text-3); transform: rotate(90deg); flex: 0 0 auto; }

/* popovers */
.dv-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 280px; max-width: min(420px, calc(100vw - 32px)); padding: 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 10px; cursor: default; }
.dv-pop.wide { width: 400px; max-height: min(620px, calc(100vh - 120px)); overflow: auto; }
.dv-pop .mp-selected { display: none; }   /* the picker states its own choice */
.dv-pop.period { width: 316px; }
.dv-pop.menu { left: auto; right: 0; width: 300px; }
.dv-pop-title { font-size: 13px; font-weight: 600; color: var(--text); }
.dv-pop-moves { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 8px; border-top: 1px solid var(--border); }
.dv-link { border: none; background: none; padding: 2px 0; color: var(--text-2); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); cursor: pointer; }
.dv-link:hover { color: var(--text); text-decoration-color: var(--text); }
.dv-pop-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dv-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dv-pop-member { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dv-pop-member-v { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.dv-filter-preview { display: block; padding: 6px 8px; border-radius: var(--radius-xs); background: var(--code-bg); font-family: var(--mono); font-size: 11.5px; color: var(--text-2); overflow-wrap: anywhere; }
.dv-adv summary { font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.dv-adv[open] { display: flex; flex-direction: column; gap: 6px; }
.dv-choices { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.dv-choices.row { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.dv-choice { text-align: left; height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--text); font-size: 13px; cursor: pointer; }
.dv-choices.row .dv-choice { border-color: var(--border); border-radius: 999px; height: 28px; }
.dv-choice:hover { background: var(--surface-3); }
.dv-choice[aria-selected="true"] { background: var(--surface-3); font-weight: 600; }
.dv-choices.row .dv-choice[aria-selected="true"] { border-color: var(--text); }
.dv-checks { display: flex; flex-direction: column; gap: 6px; }
.dv-check-list { display: flex; flex-direction: column; max-height: 240px; overflow: auto; }
.dv-check { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 6px; border-radius: var(--radius-xs); font-size: 13px; cursor: pointer; }
.dv-check:hover { background: var(--surface-3); }
.dv-check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.dv-year { border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); }
.dv-sk-pop { height: 140px; }
.dv-tree-box .mp-tree-wrap { gap: 8px; }
.dv-exp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.dv-exp .vc-seg-btn { width: 100%; padding: 0 6px; white-space: nowrap; }

/* period picker */
.dv-period { display: flex; flex-direction: column; gap: 10px; }
.dv-period-head { display: flex; align-items: center; justify-content: space-between; }
.dv-period-year { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dv-next .vc-icon { transform: rotate(180deg); }
.dv-period-body { display: flex; flex-direction: column; gap: 8px; }
.dv-period-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 8px; }
.dv-period-k { font-size: 11.5px; color: var(--text-3); }
.dv-period-grid { display: grid; gap: 4px; }
.dv-period-grid.one { grid-template-columns: 1fr; }
.dv-period-grid.two { grid-template-columns: repeat(2, 1fr); }
.dv-period-grid.four { grid-template-columns: repeat(4, 1fr); }
.dv-pbtn { height: 30px; padding: 0 4px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font-size: 12.5px; font-variant-numeric: tabular-nums; text-transform: capitalize; cursor: pointer; transition: background .12s, border-color .12s; }
.dv-pbtn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.dv-pbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }

/* custom layout (OneStream filters) */
.dv-custom { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.dv-custom-row { display: grid; grid-template-columns: 150px 150px minmax(0, 1fr); align-items: center; gap: 8px; }
.dv-custom-row .mp-select { border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); }
.dv-custom-filter { height: 32px; padding: 0 10px; border: 1px solid var(--border-strong) !important; border-radius: var(--radius-xs) !important; background: var(--surface) !important; color: var(--text); font-family: var(--mono); font-size: 12.5px; min-width: 0; width: 100%; box-sizing: border-box; }
.dv-custom-filter:focus { outline: none; border-color: var(--text-3) !important; box-shadow: var(--ring); }
.dv-custom-actions { display: flex; gap: 8px; }

/* toolbar, levels, display menu */
.dv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.dv-search { flex: 1 1 220px; min-width: 0; height: 34px; }
.dv-levels { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.dv-levels-k { font-size: 12px; color: var(--text-3); padding: 0 6px; }
.dv-level { min-width: 30px; height: 26px; padding: 0 8px; border: none; border-radius: 6px; background: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.dv-level:hover { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.dv-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.dv-menu-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; }
.dv-menu-btn .vc-icon { width: 15px; height: 15px; }
.dv-menu-btn[aria-expanded="true"] { border-color: var(--text); }
.dv-menu-sec { display: flex; flex-direction: column; gap: 8px; }
.dv-menu-sec + .dv-menu-sec { padding-top: 10px; border-top: 1px solid var(--border); }
.dv-menu-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dv-menu-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dv-menu-k { font-size: 13px; color: var(--text-2); }
.dv-seg .vc-seg-btn { min-width: 34px; }
.dv-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.dv-iconbtn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.dv-iconbtn:disabled { opacity: .35; cursor: default; }
.dv-iconbtn .vc-icon { width: 15px; height: 15px; }
.dv-iconbtn.small { width: 28px; height: 28px; border-color: var(--border); }

/* grid + panel */
.dv-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.dv-body.with-panel { grid-template-columns: minmax(0, 1fr) 320px; }
.dv-grid-wrap { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.dv-scroll { max-height: 560px; overflow: auto; overscroll-behavior: contain; position: relative; }
.vc-card .dv-scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--text-3); }
.dv-table { --dv-label-w: 300px; border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.dv-table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 500; color: var(--text-2); text-align: right; padding: 8px 12px; white-space: nowrap; vertical-align: bottom; }
.dv-table thead tr:nth-child(2) th { top: 33px; }
.dv-table thead th.dv-colgroup { text-align: center; color: var(--text); font-weight: 600; }
.dv-table thead .dv-corner { left: 0; z-index: 5; text-align: left; font-weight: 400; width: var(--dv-label-w); min-width: var(--dv-label-w); max-width: var(--dv-label-w); box-sizing: border-box; border-right: 1px solid var(--border); }
.dv-corner-k { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.dv-corner-u { display: block; font-size: 11.5px; color: var(--text-3); }
.dv-resize { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 6; touch-action: none; }
.dv-resize::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; width: 2px; border-radius: 2px; background: transparent; transition: background .12s; }
.dv-resize:hover::after, .dv-resize:focus-visible::after, .dv-resizing .dv-resize::after { background: var(--text-3); }
.vc-card .dv-resize:focus-visible { outline: none; }
.dv-resizing, .dv-resizing * { cursor: col-resize !important; user-select: none; }
.dv-col-m { display: block; color: var(--text); font-weight: 600; }
.dv-col-d { display: block; max-width: 170px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.dv-table th.dv-calc, .dv-table td.dv-calc { background: var(--surface-2); }
.dv-table thead th.dv-calc { font-style: italic; }
.dv-row { height: 32px; }
.dv-row .dv-rowhead { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 400; padding: 0 12px 0 10px; height: 32px; width: var(--dv-label-w); min-width: var(--dv-label-w); max-width: var(--dv-label-w); box-sizing: border-box; border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-row .dv-cell { padding: 0 12px; text-align: right; white-space: nowrap; color: var(--text); cursor: pointer; min-width: 96px; }
.dv-row:hover .dv-rowhead, .dv-row:hover .dv-cell { background-color: var(--surface-2); }
.dv-row.parent .dv-m, .dv-row.parent .dv-cell { font-weight: 600; }
.dv-row.top .dv-rowhead, .dv-row.top .dv-cell { border-top: 1px solid var(--border); }
.dv-row.base .dv-rowhead { box-shadow: inset 2px 0 0 var(--text); }
.dv-row.group .dv-cell { cursor: default; }
.dv-cell.nodata { color: var(--text-3); }
.neg-red .dv-cell.neg, .dv-panel-value.neg.red { color: var(--err-text); }
.dv-cell.dv-big { color: var(--warn-text); background-color: var(--warn-bg) !important; }
.dv-scroll:focus .dv-cell.active { box-shadow: inset 0 0 0 1.5px var(--text-3); }   /* keyboard position, only while the grid has focus */
.dv-cell.selected { box-shadow: inset 0 0 0 2px var(--text); }
.dv-label { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; max-width: calc(100% - 22px); vertical-align: middle; }
.dv-m { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.dv-d { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.dv-toggle, .dv-toggle-pad { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-right: 4px; vertical-align: middle; flex: 0 0 auto; }
.dv-toggle { border: none; background: none; padding: 0; color: var(--text-3); cursor: pointer; border-radius: 4px; }
.dv-toggle:hover { background: var(--surface-4); color: var(--text); }
.dv-toggle .vc-icon { width: 12px; height: 12px; transition: transform .12s; }
.dv-toggle.open .vc-icon { transform: rotate(90deg); }
.dv-toggle.busy { animation: vc-shimmer 1s linear infinite; opacity: .5; }
.dv-spacer td, .dv-spacer { padding: 0; border: none; }
.dv-norows { padding: 14px 16px; }
.dv-status { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-3); }
.dv-status .dv-warn { color: var(--warn-text); }
.dv-status .dv-note { color: var(--text-2); }

.dv-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); position: sticky; top: 8px; max-height: 620px; overflow: auto; }
.vc-card .dv-panel:focus, .vc-card .dv-panel:focus-visible { outline: none; }
.dv-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dv-panel-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.dv-panel-sub { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.dv-panel-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.dv-panel-label { font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.dv-script { padding: 8px 10px; border-radius: var(--radius-xs); background: var(--code-bg); font-family: var(--mono); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; color: var(--text-2); }
.dv-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-sk-unit { height: 140px; }

/* data unit */
.dv-unit { display: flex; flex-direction: column; gap: 8px; }
.dv-unit-summary { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.dv-unit-scroll { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-xs); }
.dv-unit.standalone .dv-unit-scroll { max-height: 520px; }
.dv-unit-table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.dv-unit-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dv-unit-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dv-unit-table .num { text-align: right; }
.dv-unit-table td.none { color: var(--text-3); }

/* states */
.dv-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.dv-state .dv-unit { width: 100%; text-align: left; margin-top: 8px; }
.dv-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.dv-problem { display: flex; flex-direction: column; gap: 8px; align-items: center; font-size: 13px; }
.dv-skeleton { display: flex; flex-direction: column; gap: 12px; }
.dv-sk-bar { height: 34px; }
.dv-sk-grid { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dv-sk-row { display: grid; grid-template-columns: 260px repeat(5, minmax(0, 1fr)); gap: 14px; align-items: center; height: 26px; }
.dv-sk-label { height: 12px; width: 70%; }
.dv-sk-num { height: 12px; width: 70%; justify-self: end; }
.dv-sk-row.head .vc-sk { height: 10px; opacity: .7; }

@media (max-width: 1100px) {
    .dv-body.with-panel { grid-template-columns: minmax(0, 1fr); }
    .dv-panel { position: static; max-height: none; }
}
@media (max-width: 720px) {
    .dv-zone { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .dv-zone-label { padding-top: 0; }
    .dv-d, .dv-col-d { display: none; }
    .dv-custom-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .dv-custom-row .mp-label { grid-column: 1 / -1; }
    .dv-custom-filter { grid-column: 1 / -1; }
    .dv-actions { margin-left: 0; }
    .dv-layout-select { min-width: 0; width: 100%; }
    .dv-head-tools { width: 100%; }
    .dv-layout { flex: 1; }
    .dv-sk-row { grid-template-columns: 140px repeat(3, minmax(0, 1fr)); }
    .dv-sk-row .dv-sk-num:nth-child(n+5) { display: none; }
    /* phones: popovers span the zone box (a fixed position would follow the message's animated transform) */
    .dv-zones, .dv-toolbar { position: relative; }
    .dv-chip-wrap { position: static; }
    .dv-pop, .dv-pop.wide, .dv-pop.period, .dv-pop.menu { position: absolute; left: 6px; right: 6px; top: auto; margin-top: 6px; width: auto; max-width: none; max-height: none; overflow: visible; }
    .dv-zone-hint { display: none; }   /* touch screens move dimensions from the chip's menu */
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
