/* ══════════════════════════════════════════════
   PBIP Documenter — Mondrian / De Stijl Theme
   Clean geometric blocks, bold lines, primary colors
   ══════════════════════════════════════════════ */

:root {
    --primary: #1a3a5c;
    --primary-light: #2c5f8a;
    --accent: #c89632;
    --accent-light: #f5deb3;
    --red: #cc3333;
    --blue: #1565c0;
    --yellow: #f9a825;
    --bg: #f5f3ee;
    --bg-light: #faf9f6;
    --card-bg: #ffffff;
    --border: #d0ccc4;
    --border-light: #e0dcd4;
    --border-dark: #1a3a5c;
    --surface: #f8f6f1;
    --text: #2c2c2c;
    --text-secondary: #666666;
    --text-light: #696969;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 2px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    /* Mondrian grid background */
    background-image:
        linear-gradient(90deg, rgba(26, 58, 92, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(26, 58, 92, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── HEADER ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--primary);
    border-bottom: 4px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.header-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: 'Playfair Display', 'Source Serif 4', Georgia, serif;
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-left: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-sponsor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.btn-sponsor-github {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-sponsor-github:hover {
    background: rgba(255, 255, 255, 0.25);
}

.btn-sponsor-coffee {
    background: var(--accent);
    color: var(--primary);
}

.btn-sponsor-coffee:hover {
    background: #daa640;
}

/* ── MAIN LAYOUT ── */
.app-body {
    display: flex;
    gap: 0;
    margin-top: 20px;
    min-height: calc(100vh - 180px);
}

/* ── SIDEBAR ── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    position: sticky;
    top: 80px;
}

.sidebar-section {
    border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.sidebar-header:hover {
    background: var(--bg);
}

.sidebar-header .material-symbols-outlined {
    font-size: 18px;
}

.sidebar-item {
    display: block;
    padding: 8px 16px 8px 32px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: var(--bg);
    border-left-color: var(--accent);
}

.sidebar-item.active {
    background: #e8eaf6;
    border-left-color: var(--primary);
    font-weight: 600;
}

.btn-sidebar-load-more {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
}

.btn-sidebar-load-more:hover {
    background: var(--bg);
}

.sidebar-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    background: var(--bg);
    color: var(--text-secondary);
}

.sidebar-children {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-section.collapsed .sidebar-children {
    max-height: 0;
}

.sidebar-chevron {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 0;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.sidebar-section.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

/* ── MAIN CONTENT ── */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: 20px;
}

.content-panel {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.content-panel h2 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--accent);
    font-family: 'Playfair Display', 'Source Serif 4', Georgia, serif;
}

.content-panel h3 {
    font-size: 16px;
    color: var(--primary);
    margin: 20px 0 10px;
}

/* ── FOLDER SELECTION ── */
.folder-section {
    text-align: center;
    padding: 60px 24px;
}

.folder-section h2 {
    border-bottom: none;
    font-size: 24px;
    margin-bottom: 12px;
}

.folder-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
}

.btn-open-folder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 3px 3px 0 var(--accent);
}

.btn-open-folder:hover {
    background: var(--primary-light);
    box-shadow: 4px 4px 0 var(--accent);
    transform: translate(-1px, -1px);
}

.btn-open-folder:active {
    box-shadow: 1px 1px 0 var(--accent);
    transform: translate(1px, 1px);
}

.btn-export-sample {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-export-sample:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-sample-data {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-sample-data:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sample-data:disabled {
    opacity: 0.5;
    cursor: default;
}

.folder-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.folder-info .material-symbols-outlined {
    color: #2e7d32;
}

/* ── DISCOVERY PANEL ── */
.discovery-panel {
    max-width: 700px;
    margin: 0 auto 20px;
}

.discovery-panel h2 {
    border-bottom: none;
    text-align: center;
}

.discovery-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.discovery-group {
    margin-bottom: 20px;
}

.discovery-group h3 {
    margin-bottom: 10px;
}

.discovery-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.discovery-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.discovery-item:hover {
    border-color: var(--primary);
    background: #e8eaf6;
}

.discovery-item.selected {
    border-color: var(--primary);
    background: #e8eaf6;
}

.discovery-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.discovery-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}

.discovery-item-type {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}

.discovery-report-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.discovery-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
}

/* ── STATS BAR ── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Playfair Display', Georgia, serif;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-hint {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    min-height: 14px;
}

.stat-card.dimmed {
    opacity: 0.5;
}

/* ── TABLES ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
}

th {
    background: var(--primary);
    color: #ffffff;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

tr:nth-child(even) {
    background: #f8f6f2;
}

tr:hover {
    background: #f0ebe3;
}

/* ── MEASURE CARD ── */
.measure-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px;
    margin: 10px 0;
}

.measure-card h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 6px;
}

.measure-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dax-block {
    background: #f5f2ed;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: var(--radius);
    margin: 8px 0;
}

/* ── BADGE ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
}

.badge-measure { background: #fff8e1; color: #f57f17; }
.badge-column { background: #e3f2fd; color: #1565c0; }
.badge-hidden { background: #fce4ec; color: #c62828; }
.badge-table { background: #e8eaf6; color: #283593; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }
.badge-field-param { background: #e3f2fd; color: #1565c0; }
.badge-calc { background: #e8f5e9; color: #2e7d32; }

/* ── FIELD PARAM & CALC GROUP (in-app) ── */
.fp-items-container {
    margin: 8px 0;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: var(--radius);
    font-size: 13px;
}

.fp-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.fp-item-chip {
    display: inline-block;
    background: #fff;
    border: 1px solid #bbdefb;
    border-radius: 3px;
    padding: 1px 6px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}

.calc-item-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid #2e7d32;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 8px 0;
}

.calc-item-card h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 4px;
}

.calc-item-card details summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.calc-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.visual-special-block {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 12px;
}

.visual-special-block.fp-block {
    background: #e3f2fd;
    border-left: 4px solid #1565c0;
}

.visual-special-block.cg-block {
    background: #e8f5e9;
    border-left: 4px solid #2e7d32;
}

.visual-special-header {
    margin-bottom: 6px;
    font-size: 12px;
}

.visual-special-block .calc-items-list {
    flex-direction: column;
    gap: 6px;
}

.cg-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.cg-expr-detail {
    font-size: 11px;
}

.cg-expr-detail summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 11px;
}

.cg-expr-code {
    margin: 4px 0 0;
    padding: 6px 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ── DOWNLOAD BAR ── */
.download-bar {
    padding: 20px 24px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.download-bar-header {
    margin-bottom: 14px;
}

.download-bar .label {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.download-bar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.download-bar-grid-2col {
    grid-template-columns: 1fr 1fr;
}

.btn-download-group {
    position: relative;
}

.btn-download-group .btn-download-card {
    width: 100%;
}

.btn-download-md-options,
.btn-download-html-options {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.btn-download-md-options.open,
.btn-download-html-options.open {
    display: flex;
}

.btn-download-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--primary);
    font-weight: 500;
    transition: all var(--transition);
}

.btn-download-sub:hover {
    background: #e8eaf6;
    border-color: var(--primary);
}

.btn-download-sub:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-download {
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-download-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border);
    text-align: left;
}

.btn-download-card:hover {
    border-color: var(--primary);
    background: #e8eaf6;
}


.btn-download-icon {
    font-size: 18px;
    color: var(--primary);
}

.btn-download-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.btn-download-desc {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.4;
}

/* ── DIAGRAM CONTAINER ── */
.diagram-container {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: var(--radius);
}

.diagram-container svg {
    display: block;
    margin: 0 auto;
}

/* ── DESCRIPTION QUOTE ── */
.description-quote {
    border-left: 4px solid var(--accent);
    padding: 8px 16px;
    margin: 8px 0;
    background: #fffde7;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

/* ── LOADING ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    background: var(--primary);
    color: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    font-size: 14px;
    max-width: 360px;
}

.toast.error {
    background: var(--red);
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.hidden { display: none !important; }

/* ── SPONSOR TOAST ── */
.sponsor-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-hover);
    z-index: 1001;
    max-width: 380px;
    animation: slideIn 0.3s ease;
}

.sponsor-toast-content {
    position: relative;
}

.sponsor-toast-text {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
    padding-right: 24px;
}

.sponsor-toast-actions {
    display: flex;
    gap: 8px;
}

.sponsor-toast-actions a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.btn-sponsor-toast {
    background: var(--accent);
    color: var(--primary);
}

.btn-sponsor-toast:hover {
    background: #daa640;
}

.btn-sponsor-toast-secondary {
    background: var(--bg);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-sponsor-toast-secondary:hover {
    background: #e8eaf6;
}

.sponsor-toast-close {
    position: absolute;
    top: -4px;
    right: -4px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.sponsor-toast-close:hover {
    color: var(--text);
}

/* ── INLINE SPONSOR BANNER ── */
.sponsor-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fffbee;
    border: 1px solid #ffe082;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text);
}

.sponsor-banner a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.sponsor-banner a:hover {
    color: var(--primary-light);
}

.sponsor-banner-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}

.sponsor-banner-close:hover {
    color: var(--text);
}

/* ── SPONSOR PULSE ── */
@keyframes sponsor-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 150, 50, 0); }
    50% { box-shadow: 0 0 8px 4px rgba(200, 150, 50, 0.4); }
}

.btn-sponsor-coffee.pulse {
    animation: sponsor-pulse 2s ease-in-out 3;
}

/* ── TIME SAVED ROW ── */
.time-saved-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fffbee;
    border-top: 1px solid #ffe082;
    border-left: 4px solid var(--accent);
    font-size: 13px;
    color: var(--text);
}

.time-saved-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.time-saved-icon {
    font-size: 18px;
    color: var(--accent);
}

.time-saved-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-time-saved-primary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--accent);
    color: var(--primary);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition);
}

.btn-time-saved-primary:hover { background: #daa640; }

.btn-time-saved-secondary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--bg-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-time-saved-secondary:hover { background: var(--primary); color: #fff; }

/* ── SIDEBAR SPONSOR CARD ── */
.sidebar-sponsor-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin-top: auto;
    border-top: 2px solid var(--accent);
    background: var(--bg);
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-sponsor-link {
    margin-left: auto;
    color: var(--primary);
    font-weight: 600;
    font-size: 11px;
    text-decoration: none;
    transition: color var(--transition);
}

.sidebar-sponsor-link:hover { color: var(--accent); }

/* ── GITHUB STARS BADGE ── */
.github-stars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 500;
}

/* ── MILESTONE BANNER ── */
.milestone-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fffbee;
    border: 1px solid #ffe082;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text);
    animation: sponsorSlideUp 0.3s ease forwards;
}

.milestone-banner a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.milestone-banner a:hover { color: var(--primary-light); }

.milestone-banner-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1;
    flex-shrink: 0;
}

.milestone-banner-close:hover { color: var(--text); }

/* ── SPONSOR TOAST SLIDE-UP ── */
.sponsor-toast.slide-up {
    animation: sponsorSlideUp 0.3s ease forwards;
}

@keyframes sponsorSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── FOOTER ── */
.app-footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 3px solid var(--primary);
    background: var(--card-bg);
    margin-top: 20px;
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-divider {
    color: var(--border);
}

/* ── SECTION VIEWS (hidden by default) ── */
.section-view {
    display: none;
}

.section-view.active {
    display: block;
}

/* ── VISUAL USAGE SECTION ── */
.visual-usage-tag {
    display: inline-block;
    background: #f3e5f5;
    color: #6a1b9a;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 12px;
    margin: 2px;
}

/* ── VIEW TOGGLE (segmented control) ── */
.view-toggle {
    display: inline-flex;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.view-toggle-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition);
}

.view-toggle-btn:not(:last-child) {
    border-right: 2px solid var(--primary);
}

.view-toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
}

.view-toggle-btn:hover:not(.active) {
    background: #e8eaf6;
}

/* ── PAGE LAYOUT DIAGRAM ── */
.page-layout-diagram {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    position: relative;
}

.page-layout-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 12px;
}

.page-layout-dims {
    margin-left: auto;
    font-weight: 400;
    color: var(--text-light);
    font-size: 11px;
    text-transform: none;
}

.page-layout-diagram svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.layout-visual-rect {
    cursor: pointer;
}

.layout-visual-rect:hover rect {
    filter: brightness(0.95);
}

.page-layout-tooltip {
    position: absolute;
    background: var(--primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    bottom: 8px;
    left: 16px;
    z-index: 5;
}

/* ── VISUAL CARD ── */
.visual-card {
    background: var(--card-bg);
    border: 1px solid #ce93d8;
    border-left: 4px solid #9c27b0;
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}

.visual-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.visual-card-header h4 {
    font-size: 14px;
    color: var(--primary);
    margin: 0;
}

.badge-visual-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    background: #f3e5f5;
    color: #6a1b9a;
}

.visual-field-roles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.visual-role-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
}

.visual-role-label {
    font-weight: 600;
    min-width: 70px;
    flex-shrink: 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 11px;
    padding-top: 3px;
}

.visual-role-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.field-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: none;
    font-family: inherit;
}

.field-chip:hover {
    filter: brightness(0.9);
    text-decoration: underline;
}

.field-chip[data-role="Values"]   { background: #fff8e1; color: #f57f17; }
.field-chip[data-role="Category"] { background: #e3f2fd; color: #1565c0; }
.field-chip[data-role="Series"]   { background: #e8f5e9; color: #2e7d32; }
.field-chip[data-role="Filters"]  { background: #fce4ec; color: #c62828; }
.field-chip[data-role="Tooltips"] { background: #f5f5f5; color: var(--text-secondary); }
.field-chip[data-role="Other"]    { background: var(--bg); color: var(--text-secondary); }

/* ── PAGE GROUP (By Visual view) ── */
.page-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    margin: 20px 0 8px;
    cursor: pointer;
    user-select: none;
}

.page-group-header:first-child {
    margin-top: 0;
}

.page-group-header .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.25s ease;
}

.page-group-header.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.page-group-content {
    overflow: hidden;
    max-height: 5000px;
    transition: max-height 0.3s ease-out, opacity 0.2s ease;
    opacity: 1;
}

.page-group-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.visual-card-empty {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 4px 0;
}

/* ── INTERACTIVE DIAGRAM ── */
.diagram-interactive {
    position: relative;
    overflow: hidden;
    cursor: grab;
    min-height: 400px;
}

.diagram-interactive.panning {
    cursor: grabbing;
}

.diagram-interactive svg {
    cursor: inherit;
}

.diagram-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.diagram-ctrl-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--primary);
    padding: 0;
}

.diagram-ctrl-btn:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.diagram-ctrl-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.diagram-ctrl-btn .material-symbols-outlined {
    font-size: 20px;
}

/* SVG node interactivity */
.table-node {
    cursor: pointer;
}

.table-node.dimmed {
    opacity: 0.15;
    transition: opacity 0.2s ease;
}

.table-node.highlighted > rect:nth-of-type(2) {
    stroke: var(--accent);
    stroke-width: 3;
}

.rel-line {
    transition: opacity 0.2s ease;
}

.rel-line.highlighted path {
    stroke: var(--accent) !important;
    stroke-width: 3 !important;
}

.rel-line.dimmed {
    opacity: 0.1;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .app-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: none;
        position: static;
    }

    .main-content {
        margin-left: 0;
    }

    .header-subtitle {
        display: none;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .btn-open-folder {
        width: 100%;
        justify-content: center;
    }

    .download-bar-grid,
    .download-bar-grid-2col {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── BROWSER SUPPORT WARNING ── */
.browser-warning {
    background: #fff3e0;
    border: 2px solid #ff9800;
    border-radius: var(--radius);
    padding: 16px 24px;
    margin: 20px 0;
    text-align: center;
    font-size: 14px;
    color: #e65100;
}

.browser-warning a {
    color: #e65100;
    font-weight: 600;
}

/* ── NO DATA PLACEHOLDER ── */
.placeholder {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.placeholder .material-symbols-outlined {
    font-size: 48px;
    color: var(--border);
    display: block;
    margin-bottom: 12px;
}

/* ── RELATIONSHIP CARD ── */
.rel-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 4px 0;
    font-size: 13px;
    flex-wrap: wrap;
}

.rel-arrow {
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
}

/* ── SIDEBAR SEARCH ── */
.sidebar-search {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}

.sidebar-search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 8px;
}

.sidebar-search-icon {
    font-size: 18px;
    color: var(--text-light);
    flex-shrink: 0;
}

.sidebar-search-input-wrap input {
    flex: 1;
    border: none;
    background: none;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    min-width: 0;
}

.sidebar-search-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.25);
}

.sidebar-search-input-wrap input::placeholder {
    color: var(--text-light);
}

.sidebar-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-light);
    padding: 0 2px;
    line-height: 1;
}

.sidebar-search-clear:hover {
    color: var(--text);
}

.sidebar-search-count {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    text-align: center;
}

.sidebar-item.search-hidden {
    display: none;
}

/* ── DAX TRUNCATION ── */
.dax-block.truncated {
    max-height: 7.5em;
    overflow: hidden;
    position: relative;
}

.dax-block.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2em;
    background: linear-gradient(transparent, #f5f2ed);
    pointer-events: none;
}

.btn-dax-toggle {
    display: inline-block;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px 10px;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
}

.btn-dax-toggle:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.btn-load-more-measures {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 16px 0;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.btn-load-more-measures:hover {
    background: var(--surface);
    border-color: var(--primary);
}

/* ── WARNING BANNER ── */
.warning-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 4px solid #f9a825;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    color: #6d4c00;
}

.warning-banner-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    font-family: inherit;
    margin-left: auto;
    white-space: nowrap;
}

.warning-banner-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #6d4c00;
    line-height: 1;
    padding: 0 2px;
}

.warning-banner-close:hover {
    color: var(--text);
}

/* ── BREADCRUMB ── */
.breadcrumb {
    margin-bottom: 12px;
    font-size: 13px;
}
.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    opacity: 0.7;
}
.breadcrumb-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ── ERROR MODAL ── */
.error-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.error-modal-content {
    position: relative;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.error-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border);
}

.error-modal-header h3 {
    font-size: 16px;
    color: var(--red);
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.error-modal-close:hover {
    color: var(--text);
}

.error-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
}

.error-modal-item {
    padding: 10px 12px;
    background: #fef3f3;
    border: 1px solid #f8d7da;
    border-left: 3px solid var(--red);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.error-modal-item .error-file {
    font-weight: 600;
    color: var(--primary);
    font-size: 12px;
}

.error-modal-item .error-line {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.error-modal-item .error-message {
    margin-top: 4px;
    color: var(--text);
}

.error-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-error-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--primary);
    transition: all var(--transition);
}

.btn-error-copy:hover {
    background: #e8eaf6;
    border-color: var(--primary);
}

/* ── LINEAGE ── */
.lineage-diagram-container {
    position: relative;
    overflow: hidden;
    cursor: grab;
    min-height: 350px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 0;
    background: var(--bg-light);
}

.lineage-diagram-container.panning {
    cursor: grabbing;
}

.lineage-diagram-container svg {
    cursor: inherit;
    display: block;
}

.lineage-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.lineage-select-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.lineage-select {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--card-bg);
}

.lineage-select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn-trace-lineage {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    background: #9c27b0;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-trace-lineage:hover {
    background: #7b1fa2;
    transform: translateY(-1px);
}

.btn-trace-lineage.btn-trace-sm {
    padding: 3px 8px;
    font-size: 11px;
}

.lineage-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.lineage-mini .lineage-arrow {
    color: var(--text-light);
}

.lineage-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
}

.lineage-badge.source {
    background: #e8f5e9;
    color: #2e7d32;
}

.lineage-badge.table {
    background: #e3f2fd;
    color: #1565c0;
}

.lineage-badge.measure {
    background: #fff8e1;
    color: #f57f17;
}

.lineage-badge.visual {
    background: #f3e5f5;
    color: #6a1b9a;
}

.lineage-badge.column {
    background: #e3f2fd;
    color: #1565c0;
}

/* Lineage SVG node styling */
.lineage-node {
    transition: opacity 0.2s ease;
}

.lineage-edge {
    transition: all 0.2s ease;
}

.lineage-edge.relationship {
    stroke-dasharray: 6 3;
}

/* Lineage Detail Panel */
.lineage-detail-panel {
    margin: 12px 0;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    position: relative;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lineage-detail-panel.hidden { display: none; }

.lineage-detail-panel.type-table { border-left-color: #1565c0; }
.lineage-detail-panel.type-measure { border-left-color: #f9a825; }
.lineage-detail-panel.type-column { border-left-color: #42a5f5; }
.lineage-detail-panel.type-visual { border-left-color: #9c27b0; }
.lineage-detail-panel.type-dataSource { border-left-color: #4caf50; }
.lineage-detail-panel.type-calcItem { border-left-color: #2e7d32; }
.lineage-detail-panel.type-fpItem { border-left-color: #6a1b9a; }

.lineage-detail-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none; border: none;
    cursor: pointer; font-size: 18px;
    color: var(--text-secondary);
    line-height: 1;
}
.lineage-detail-close:hover { color: var(--text); }

.lineage-detail-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.lineage-detail-heading .lineage-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lineage-detail-heading h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.lineage-detail-section {
    margin-top: 10px;
}

.lineage-detail-section h4 {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lineage-detail-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.lineage-detail-section th,
.lineage-detail-section td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.lineage-detail-section th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
}

.lineage-detail-dax {
    background: #f5f5f0;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

.lineage-detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.lineage-detail-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    background: #f0f0f0;
    color: var(--text);
}

.lineage-detail-chip.measure { background: #fff8e1; color: #f57f17; }
.lineage-detail-chip.column { background: #e3f2fd; color: #1565c0; }
.lineage-detail-chip.visual { background: #f3e5f5; color: #6a1b9a; }
.lineage-detail-chip.table { background: #e3f2fd; color: #1565c0; }
.lineage-detail-chip.source { background: #e8f5e9; color: #2e7d32; }
.lineage-detail-chip.calcItem { background: #e8f5e9; color: #2e7d32; }
.lineage-detail-chip.fpItem { background: #f3e5f5; color: #6a1b9a; }
.lineage-detail-chip.indirect { opacity: 0.7; font-style: italic; }

/* Expandable table nodes */
.lineage-node-expand-indicator {
    font-size: 10px;
    fill: #666;
    cursor: pointer;
}

/* Data Source Cards */
.data-source-card {
    background: var(--card-bg);
    border: 1px solid #a5d6a7;
    border-left: 4px solid #4caf50;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 8px 0;
}

.data-source-card h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 4px;
}

.data-source-card .ds-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.data-source-card .ds-meta code {
    background: #e8f5e9;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 12px;
}

/* Measure chain display */
.measure-chain {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
}

.measure-chain-item {
    display: inline-block;
    padding: 1px 6px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 2px;
    font-size: 11px;
    color: #f57f17;
}

.measure-chain-arrow {
    color: var(--text-light);
    font-size: 11px;
}

/* ── DYNAMIC FEATURES VIEW ── */

.section-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.dynamic-summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.dynamic-sep { color: var(--text-light); }

.dynamic-card {
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--card-bg);
}

.dynamic-card-fp { border-left: 4px solid #1565c0; }
.dynamic-card-cg { border-left: 4px solid #2e7d32; }

.dynamic-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dynamic-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

.dynamic-card-icon { font-size: 20px; color: var(--primary); }
.dynamic-card-fp .dynamic-card-icon { color: #1565c0; }
.dynamic-card-cg .dynamic-card-icon { color: #2e7d32; }

.dynamic-card-insight {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.dynamic-card-section { margin-top: 10px; }
.dynamic-card-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.dynamic-visual-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dynamic-visual-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    font-size: 11.5px;
}

.dynamic-visual-page {
    color: var(--text-light);
    font-size: 10px;
    margin-left: 2px;
}

.dynamic-learn-more {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 12.5px;
}

.dynamic-learn-more a {
    color: var(--primary);
    text-decoration: none;
}

.dynamic-learn-more a:hover { text-decoration: underline; }

.value-moment-prompt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff8e1, #fff3e0);
    border: 1px solid #ffcc80;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 16px;
    animation: fadeSlideIn 0.4s ease;
}

.value-moment-prompt a { color: var(--primary); font-weight: 500; }
.value-moment-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dynamic badge for visual cards */
.badge-dynamic {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

/* ── MODEL INSIGHTS CARDS ── */

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow var(--transition), border-color var(--transition);
    text-decoration: none;
    color: inherit;
}

.insight-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.insight-card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.insight-card-fp .insight-card-icon { color: #1565c0; }
.insight-card-cg .insight-card-icon { color: #2e7d32; }
.insight-card-broken .insight-card-icon { color: #c62828; }

.insight-card-text {
    font-size: 12.5px;
    line-height: 1.4;
}

.insight-card-text strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

/* ── BEFORE/AFTER COMPARISON ── */

.before-after-widget {
    margin-top: 16px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--card-bg);
}

.before-after-widget summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    user-select: none;
}

.before-after-widget summary:hover { background: var(--surface); }

.before-after-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border-light);
}

.before-after-col {
    padding: 14px;
}

.before-after-col h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.before-col {
    border-right: 1px solid var(--border-light);
    background: #fafafa;
}

.before-col h4 { color: #c62828; }
.after-col h4 { color: #2e7d32; }

.before-after-code {
    padding: 10px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}

.before-after-reveal {
    padding: 10px 12px;
    background: #e3f2fd;
    border-left: 3px solid #1565c0;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.5;
}

.before-after-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}
