:root {
    --bg: #0a0c10;
    --bg-gradient: linear-gradient(135deg, #0a0c10 0%, #0f1219 100%);
    --surface: #13161e;
    --surface2: #1b1f2a;
    --surface3: #232838;
    --border: #2a2f3e;
    --border-hover: #3b4258;
    --text: #e8e9ed;
    --text-secondary: #b0b4c0;
    --text-muted: #6b7189;
    --accent: #4f8ff7;
    --accent-dim: rgba(79,143,247,0.12);
    --accent-mid: rgba(79,143,247,0.25);
    --green: #34d399;
    --green-dim: rgba(52,211,153,0.12);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251,191,36,0.12);
    --orange: #fb923c;
    --orange-dim: rgba(251,146,60,0.12);
    --purple: #a78bfa;
    --purple-dim: rgba(167,139,250,0.12);
    --red: #f87171;
    --red-dim: rgba(248,113,113,0.12);
    --cyan: #22d3ee;
    --cyan-dim: rgba(34,211,238,0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --transition-fast: 0.15s ease;
    --transition-med: 0.25s ease;
    --transition-slow: 0.35s cubic-bezier(0.4,0,0.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* ── Header ── */
header {
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-left { display: flex; flex-direction: column; gap: 2px; }
.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}
.source-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Stats ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat:nth-child(1)::before { background: linear-gradient(90deg, var(--accent), #818cf8); }
.stat:nth-child(2)::before { background: linear-gradient(90deg, var(--green), #6ee7b7); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, var(--purple), #c4b5fd); }
.stat:nth-child(4)::before { background: linear-gradient(90deg, var(--orange), #fdba74); }
.stat:nth-child(5)::before { background: linear-gradient(90deg, var(--cyan), #67e8f9); }
.stat:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 2px;
}
.stat:nth-child(1) .stat-value { color: var(--accent); }
.stat:nth-child(2) .stat-value { color: var(--green); }
.stat:nth-child(3) .stat-value { color: var(--purple); }
.stat:nth-child(4) .stat-value { color: var(--orange); }
.stat:nth-child(5) .stat-value { color: var(--cyan); }
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

/* ── Search ── */
.search-container { margin-bottom: 24px; position: relative; }
.search-icon {
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    font-size: 18px;
    pointer-events: none;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.search-input {
    width: 100%;
    padding: 14px 20px 14px 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-input::placeholder { color: var(--text-muted); }
.search-prompt {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.search-prompt:hover { border-color: var(--accent); color: var(--accent); }
/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.search-container { position: relative; }
.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.search-result:hover { background: var(--surface2); }
.search-result-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.search-result-text { flex: 1; min-width: 0; }
.search-result-label { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sublabel { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-ask { border-top: 1px solid var(--border); }

.search-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.search-hint code {
    background: var(--surface2);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ── Main Tabs (top level: EAM / System-Wide) ── */
.main-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 4px;
    border: 1px solid var(--border);
    border-bottom: none;
}
.main-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}
.main-tab:hover { color: var(--text-secondary); background: var(--surface2); }
.main-tab.active {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Sub Tabs ── */
.sub-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--surface);
    padding: 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab .count {
    background: var(--surface2);
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.tab.tab-highlight {
    background: linear-gradient(135deg, rgba(79,143,247,0.08), rgba(167,139,250,0.08));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab.tab-highlight .count {
    background: var(--purple-dim);
    color: var(--purple);
    border-color: rgba(167,139,250,0.3);
}
.tab.active .count {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-mid);
}

/* ── Panels ── */
.panel { display: none; }
.panel.active { display: block; }

/* ── Loading state ── */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ── */
.card-grid {
    display: grid;
    gap: 10px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-med), transform var(--transition-fast);
}
.card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(79,143,247,0.08);
    transform: translateY(-1px);
}
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.card-badge {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-mid);
}
.card-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    margin-bottom: 8px;
}
.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Tags ── */
.tag {
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.tag-service { background: var(--accent-dim); color: var(--accent); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-yellow { background: var(--yellow-dim); color: var(--yellow); }
.tag-orange { background: var(--orange-dim); color: var(--orange); }
.tag-purple { background: var(--purple-dim); color: var(--purple); }
.tag-red { background: var(--red-dim); color: var(--red); }
.tag-cyan { background: var(--cyan-dim); color: var(--cyan); }
.tag-muted { background: var(--surface3); color: var(--text-muted); }

/* ── Card Stats Row ── */
.card-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.card-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-stat-val {
    font-weight: 700;
    color: var(--text-secondary);
}

/* ── Detail Overlay ── */
.detail-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-slow);
}
.detail-backdrop.open {
    display: block;
    opacity: 1;
}
.detail-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 55%;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 100;
    overflow-y: auto;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
}
.detail-overlay.open {
    transform: translateX(0);
}
.detail-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.detail-close:hover {
    background: var(--surface3);
    border-color: var(--border-hover);
}
.detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    padding-right: 48px;
    line-height: 1.3;
}
.detail-subtitle {
    color: var(--accent);
    font-size: 14px;
    margin-bottom: 16px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.detail-section {
    margin-bottom: 24px;
}
.detail-section h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* ── Info Grid ── */
.info-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}
.info-label {
    color: var(--text-muted);
    font-weight: 500;
}
.info-value {
    color: var(--text);
    word-break: break-word;
}
.info-value code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: var(--surface2);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}

/* ── Entity / Sub Cards ── */
.entity-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.entity-card:hover {
    border-color: var(--accent);
    background: var(--surface3);
}
.entity-card.no-hover {
    cursor: default;
}
.entity-card.no-hover:hover {
    border-color: var(--border);
    background: var(--surface2);
}
.entity-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text);
}
.entity-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ── Field List ── */
.field-list { display: flex; flex-wrap: wrap; gap: 4px; }
.field {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-muted);
    border: 1px solid transparent;
}
.field.key-field {
    color: var(--accent);
    border-color: var(--accent-mid);
    background: var(--accent-dim);
}

/* ── CRUD Badge ── */
.crud-badges { display: flex; gap: 3px; margin-top: 6px; }
.crud-badge {
    display: inline-block;
    width: 22px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.crud-on { background: var(--green-dim); color: var(--green); }
.crud-off { background: var(--surface3); color: var(--text-muted); opacity: 0.4; }

/* ── Screen Flow ── */
.flow-node {
    padding: 10px 14px;
    margin-bottom: 4px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    font-size: 13px;
}
.flow-node-title { font-weight: 600; color: var(--text); }
.flow-node-comp { color: var(--text-muted); font-size: 12px; }
.flow-node-entity {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent);
    margin-top: 3px;
}
.flow-nav {
    font-size: 11px;
    color: var(--orange);
    margin-top: 3px;
}

/* ── Device Icons ── */
.device-icons { display: flex; gap: 8px; align-items: center; }
.device-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
}
.device-on { background: var(--green-dim); color: var(--green); }
.device-off { background: var(--surface3); color: var(--text-muted); opacity: 0.4; }

/* ── Empty ── */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Pager ── */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 18px;
    color: var(--text-muted);
    font-size: 13px;
}
.pager button {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.pager button:hover {
    border-color: var(--accent);
    background: var(--surface3);
}

/* ── Custom Objects Specific ── */
.node-section {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
}
.node-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.node-header:hover { background: var(--surface3); }
.node-header-title { font-weight: 600; font-size: 14px; }
.node-header-meta { font-size: 12px; color: var(--text-muted); }
.node-body { padding: 0 16px 14px 16px; }
.node-info-row {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .detail-overlay { width: 70%; }
    .container { padding: 20px 24px; }
    .assess-grid { grid-template-columns: repeat(3, 1fr); }
    .module-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .container { padding: 16px; }
    header { flex-direction: column; align-items: flex-start; }
    header h1 { font-size: 22px; }
    .source-info { text-align: left; font-size: 10px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat { padding: 12px 16px; }
    .stat-value { font-size: 24px; }
    .search-input { font-size: 14px; padding: 12px 16px 12px 38px; }
    .search-icon { font-size: 16px; left: 12px; }
    .search-hint { display: none; }
    .search-dropdown { max-height: 300px; }
    .search-result { padding: 8px 12px; gap: 10px; }
    .search-result-icon { width: 24px; height: 24px; font-size: 10px; }
    .main-tabs { padding: 3px; }
    .main-tab { padding: 10px 14px; font-size: 13px; }
    .sub-tabs { padding: 0 2px; }
    .tab { padding: 8px 12px; font-size: 12px; }
    .tab .count { display: none; }
    .card { padding: 14px 16px; }
    .card-header { flex-direction: column; gap: 6px; }
    .card-badge { align-self: flex-start; }
    .info-grid { grid-template-columns: 1fr; gap: 4px; }
    .info-label { font-weight: 700; }
    .detail-overlay {
        width: 100%;
        padding: 20px 16px;
    }
    .detail-backdrop { display: none !important; }
    .detail-title { font-size: 18px; }
    .pager { flex-wrap: wrap; }
    .assess-grid { grid-template-columns: repeat(2, 1fr); }
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .score-display { padding: 24px 16px 20px; }
    .score-display .score-value { font-size: 40px; }
    .connectivity-header { flex-wrap: wrap; }
    .connectivity-svc { font-size: 11px; }
    .ref-table { font-size: 11px; display: block; overflow-x: auto; }
    .ref-table th, .ref-table td { padding: 6px 8px; }
    .flow-pipeline { gap: 4px; }
    .flow-stage { font-size: 10px; padding: 2px 8px; }
    .flow-card { padding: 12px; }
    .flow-card-services { font-size: 10px; }
    .migration-filter { gap: 6px; }
    .migration-filter-btn { padding: 5px 10px; font-size: 11px; }
    .assess-extras { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .container { padding: 12px; }
    header h1 { font-size: 20px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat { min-width: 0; padding: 10px 12px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 10px; }
    .main-tab { padding: 8px 10px; font-size: 12px; }
    .tab { padding: 6px 8px; font-size: 11px; }
    .assess-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .module-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .assess-card { padding: 12px; }
    .assess-card-value { font-size: 22px; }
    .score-display .score-value { font-size: 32px; }
    .score-bar-legend { flex-direction: column; align-items: flex-start; }
    .card-grid { gap: 8px; }
    .pager { flex-direction: column; gap: 8px; }
    .pager button { width: 100%; }
    .assess-extras { grid-template-columns: 1fr; }
    .flow-card-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .connectivity-card { padding: 10px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Clean Core Assessment ── */
.score-display {
    text-align: center;
    padding: 32px 20px 24px;
    margin-bottom: 24px;
}
.score-display .score-value {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 4px;
}
.score-display .score-value.score-green {
    background: linear-gradient(135deg, var(--green), #6ee7b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.score-display .score-value.score-yellow {
    background: linear-gradient(135deg, var(--yellow), #fde68a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.score-display .score-value.score-red {
    background: linear-gradient(135deg, var(--red), #fca5a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.score-display .score-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}
.score-display .score-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}
.score-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 16px;
    background: var(--surface3);
}
.score-bar-segment {
    height: 100%;
    transition: width var(--transition-med);
}
.score-bar-segment.seg-standard { background: var(--green); }
.score-bar-segment.seg-z-copy { background: #2dd4bf; }
.score-bar-segment.seg-custom-dev { background: var(--orange); }
.score-bar-segment.seg-demo-test { background: var(--yellow); }
.score-bar-segment.seg-custom-bo { background: var(--purple); }
.score-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    justify-content: center;
}
.score-bar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.score-bar-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.category-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.category-badge.cat-standard { background: var(--green-dim); color: var(--green); }
.category-badge.cat-z_copy { background: rgba(45,212,191,0.12); color: #2dd4bf; }
.category-badge.cat-custom_dev { background: var(--orange-dim); color: var(--orange); }
.category-badge.cat-demo_test { background: var(--yellow-dim); color: var(--yellow); }
.category-badge.cat-custom_bo { background: var(--purple-dim); color: var(--purple); }
.assess-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.assess-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.assess-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.assess-card-accent {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.assess-card-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 2px;
}
.assess-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}
.assess-card-pct {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.assess-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.assess-extras {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 28px;
}
.browse-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-mid);
    color: var(--accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    margin-top: 20px;
    margin-bottom: 8px;
}
.browse-btn:hover {
    background: var(--accent-mid);
    border-color: var(--accent);
}

/* ── Entity Graph ── */
.graph-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 14px;
    transition: var(--transition-fast);
}
.graph-toggle:hover { border-color: var(--accent); color: var(--accent); }
.graph-toggle.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.graph-section { margin-bottom: 24px; }
.graph-section h4 { font-size: 14px; margin-bottom: 10px; color: var(--text-secondary); }
.ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ref-table th { text-align: left; padding: 8px 12px; background: var(--surface2); color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); }
.ref-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.ref-table tr:hover td { background: var(--surface2); }
.ref-arrow { color: var(--accent); font-weight: bold; }

/* ── Data Flow ── */
.flow-pipeline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.flow-stage { font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.flow-arrow { color: var(--text-muted); font-size: 14px; }
.stage-create { background: var(--green-dim); color: var(--green); }
.stage-read { background: var(--accent-dim); color: var(--accent); }
.stage-update { background: var(--yellow-dim); color: var(--yellow); }
.stage-release { background: var(--cyan-dim); color: var(--cyan); }
.stage-complete { background: var(--purple-dim); color: var(--purple); }
.stage-cancel { background: var(--red-dim); color: var(--red); }
.stage-other { background: rgba(107,113,137,0.15); color: var(--text-muted); }

/* ── Migration Badges ── */
.migration-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.migration-simple { background: var(--green-dim); color: var(--green); }
.migration-medium { background: var(--yellow-dim); color: var(--yellow); }
.migration-complex { background: var(--red-dim); color: var(--red); }

/* ── Migration filter buttons ── */
.migration-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.migration-filter-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition-fast);
}
.migration-filter-btn:hover { border-color: var(--accent); }
.migration-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.migration-filter-btn.migration-complex.active { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.migration-filter-btn.migration-medium.active { background: var(--yellow-dim); border-color: var(--yellow); color: var(--yellow); }
.migration-filter-btn.migration-simple.active { background: var(--green-dim); border-color: var(--green); color: var(--green); }

/* ── Service connectivity ── */
.connectivity-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
}
.connectivity-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}
.connectivity-svc {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.connectivity-arrow {
    color: var(--text-muted);
    font-size: 16px;
}
.connectivity-bar {
    height: 6px;
    background: var(--surface3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.connectivity-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--cyan));
    border-radius: 3px;
    transition: width 0.3s ease;
}
.connectivity-entities {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Migration card border ── */
.card-migration-simple { border-left: 3px solid var(--green); }
.card-migration-medium { border-left: 3px solid var(--yellow); }
.card-migration-complex { border-left: 3px solid var(--red); }

/* ── Collapsible section ── */
.collapsible-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition-fast);
    width: 100%;
    text-align: left;
}
.collapsible-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Graph tab stats ── */
.graph-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.graph-entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

/* ── Module Cards ── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    overflow: hidden;
}
.module-card-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.module-card-value { font-size: 24px; font-weight: 700; }
.module-card-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ── Flow lifecycle card ── */
.flow-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    transition: var(--transition-fast);
}
.flow-card:hover { border-color: var(--border-hover); }
.flow-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.flow-card-title { font-size: 15px; font-weight: 600; }
.flow-card-count { font-size: 12px; color: var(--text-muted); }
.flow-card-services { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.flow-card-actions { margin-top: 8px; }
.flow-detail-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: var(--transition-fast);
}
.flow-detail-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Stage bar (horizontal proportional) ── */
.stage-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface3);
    margin-bottom: 12px;
}
.stage-bar-seg { height: 100%; min-width: 2px; }
.stage-bar-seg.sb-create { background: var(--green); }
.stage-bar-seg.sb-read { background: var(--accent); }
.stage-bar-seg.sb-update { background: var(--yellow); }
.stage-bar-seg.sb-release { background: var(--cyan); }
.stage-bar-seg.sb-complete { background: var(--purple); }
.stage-bar-seg.sb-cancel { background: var(--red); }
.stage-bar-seg.sb-other { background: var(--text-muted); }

/* ── Tab link button ── */
.tab-link-btn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-fast);
}
.tab-link-btn:hover { background: var(--accent-mid); }

/* Migration Planner */
.cluster-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    transition: var(--transition-fast);
}
.cluster-card:hover { border-color: var(--border-hover); }
.cluster-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.cluster-card-title {
    font-size: 16px;
    font-weight: 600;
}
.cluster-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}
.cluster-shared {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.cluster-shared code {
    color: var(--accent);
    font-size: 11px;
}
.cluster-services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.cluster-svc-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.cluster-svc-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.cluster-svc-meta {
    font-size: 11px;
    color: var(--text-muted);
}
.cluster-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.cluster-action-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition-fast);
}
.cluster-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.cluster-action-btn.primary {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.independent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
.independent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: var(--transition-fast);
}
.independent-card:hover { border-color: var(--border-hover); }
.quick-wins {
    background: var(--green-dim);
    border: 1px solid rgba(52,211,153,0.3);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.quick-wins-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
    margin-bottom: 4px;
}
.quick-wins-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Ask / NL Query */
.ask-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79,143,247,0.4);
    z-index: 1000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ask-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(79,143,247,0.5); }
.ask-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 480px;
    max-width: calc(100vw - 48px);
    max-height: 70vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.ask-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ask-header-title { font-size: 14px; font-weight: 700; }
.ask-header-sub { font-size: 11px; color: var(--text-muted); }
.ask-input-area {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
}
.ask-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: none;
}
.ask-input:focus { border-color: var(--accent); }
.ask-submit {
    background: var(--accent);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}
.ask-submit:hover { background: #3d7de0; }
.ask-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
    max-height: calc(70vh - 140px);
}
.ask-msg {
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 90%;
    word-wrap: break-word;
}
.ask-msg-user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}
.ask-msg-assistant {
    align-self: flex-start;
    background: var(--surface2);
    color: var(--text-secondary);
    border-bottom-left-radius: 4px;
}
.ask-typing { color: var(--text-muted); font-style: italic; }
.ask-cursor { color: var(--accent); animation: blink 0.8s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.ask-examples {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ask-example {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}
.ask-example:hover { border-color: var(--accent); color: var(--accent); }

/* Advisor Agent overlay */
.advisor-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.advisor-container {
    width: 700px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 768px) {
    .ask-panel {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1100;
    }
    .ask-messages { max-height: calc(100vh - 140px); }
    .ask-toggle { bottom: 16px; right: 16px; width: 46px; height: 46px; font-size: 20px; }
    .ask-examples { flex-wrap: wrap; }
    .ask-example { font-size: 10px; padding: 4px 10px; }
    .advisor-container { width: 100vw; max-height: 100vh; border-radius: 0; }
    .advisor-overlay { align-items: flex-end; }
}
