/* Microware — Dark Theme Debug Panel */

:root {
    --bg: #1a1a2e;
    --surface: #222244;
    --surface-hover: #2a2a55;
    --border: #333366;
    --text: #e0e0e0;
    --text-secondary: #8888aa;
    --text-muted: #555577;

    /* Phase colors */
    --phase-manifest: #9b59b6;
    --phase-network: #3498db;
    --phase-decoder: #e67e22;
    --phase-buffering: #e74c3c;
    --phase-ready: #2ecc71;

    /* Severity */
    --sev-fast: #2ecc71;
    --sev-normal: #f1c40f;
    --sev-slow: #e67e22;
    --sev-very-slow: #e74c3c;

    /* Comparison */
    --delta-improved: #2ecc71;
    --delta-regression: #e74c3c;
    --delta-unchanged: #95a5a6;

    /* Scenario */
    --pass: #2ecc71;
    --fail: #e74c3c;
    --hit: #3498db;
    --miss: #555577;

    /* Module accents */
    --module-debug-panel: #3498db;
    --module-devices: #9b59b6;
    --module-player: #2ecc71;
    --module-log-exporter: #e67e22;
    --module-device-mgmt: #9b59b6;
    --module-remote-config: #f1c40f;
    --module-current-user: #e74c3c;
    --module-mobile-testing: #1abc9c;
    --module-analytics: #e67e22;

    /* Status */
    --success: #2ecc71;
    --error: #e74c3c;
    --warning: #f1c40f;
    --info: #3498db;
    --muted: #555577;

    /* Shell layout */
    --topbar-height: 48px;
    --sidebar-width: 48px;
    --sidebar-width-expanded: 200px;
    --sidebar-bg: #16162e;

    --font-data: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 6px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    min-width: 800px;
}

/* ── Top Bar (GitHub-style) ── */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 300;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.brand-icon {
    background: var(--phase-network);
    color: #fff;
    border-radius: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

.topbar-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
}

.topbar-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: var(--border);
}

.topbar-stats {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.topbar-notification {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--phase-network);
    border-radius: 50%;
    border: 2px solid var(--sidebar-bg);
}

/* Sidebar always visible — hamburger toggles expand/collapse */

/* ── Notification Panel ── */

.notification-panel {
    display: none;
    position: fixed;
    top: var(--topbar-height);
    right: 16px;
    width: 360px;
    max-height: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 400;
    flex-direction: column;
    overflow: hidden;
}

.notification-panel.visible {
    display: flex;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}

.notification-list {
    overflow-y: auto;
    flex: 1;
}

.notification-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.notification-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: background 0.15s;
}

.notification-item:hover { background: var(--surface-hover); }

.notification-item.unread { border-left: 3px solid var(--phase-network); }

.notification-item .notif-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.notification-item .notif-body {
    flex: 1;
    min-width: 0;
}

.notification-item .notif-title {
    color: var(--text);
    font-weight: 500;
    margin-bottom: 2px;
}

.notification-item .notif-meta {
    color: var(--text-muted);
    font-size: 11px;
}

/* ── Shell Layout ── */

.shell {
    display: flex;
    min-height: 100vh;
    padding-top: var(--topbar-height);
}

/* ── Sidebar (GitHub-style) ── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: width 0.2s ease;
    overflow: hidden;
}

.sidebar.expanded { width: var(--sidebar-width-expanded); }

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    margin: 0 8px;
    transition: all 0.15s;
    white-space: nowrap;
    font-size: 12px;
    position: relative;
}

.sidebar-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.sidebar-item.active {
    color: var(--text);
    background: var(--surface);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--module-accent, var(--phase-network));
}

.sidebar-item .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-item .item-label { display: none; }
.sidebar.expanded .sidebar-item .item-label { display: block; }

/* Sidebar always shown */

/* ── Shell Content ── */

.shell-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.2s ease;
    display: flex;
    flex-direction: column;
}

.shell:has(.sidebar.expanded) .shell-content {
    margin-left: var(--sidebar-width-expanded);
}

/* ── Breadcrumb ── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.breadcrumb-segment {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
}

.breadcrumb-segment:hover { color: var(--text); }

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 10px;
    margin: 0 2px;
}

.breadcrumb-segment.current {
    color: var(--text);
    font-weight: 600;
    cursor: default;
}

/* ── Main ── */

.main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ── Buttons ── */

.btn {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-ui);
    transition: background 0.15s;
}

.btn:hover { background: var(--surface-hover); }
.btn.active { background: var(--phase-network); border-color: var(--phase-network); }
.btn.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-danger { border-color: var(--sev-very-slow); color: var(--sev-very-slow); }
.btn-danger:hover { background: rgba(231,76,60,0.15); }

/* ── Filters bar ── */

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

.filters input, .filters select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font-ui);
}

.filters input::placeholder { color: var(--text-muted); }

/* ── Table ── */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th {
    background: var(--surface);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover { color: var(--text); }
th.sorted { color: var(--phase-network); }

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

tr:hover td { background: var(--surface-hover); }
tr.clickable { cursor: pointer; }

/* ── Badges ── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-session { background: rgba(52,152,219,0.2); color: var(--phase-network); }
.badge-scenario { background: rgba(155,89,182,0.2); color: var(--phase-manifest); }
.badge-pass { background: rgba(46,204,113,0.2); color: var(--pass); }
.badge-fail { background: rgba(231,76,60,0.2); color: var(--fail); }

.severity-fast { color: var(--sev-fast); }
.severity-normal { color: var(--sev-normal); }
.severity-slow { color: var(--sev-slow); }
.severity-very-slow { color: var(--sev-very-slow); }

/* ── Pagination ── */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.pagination-btns {
    display: flex;
    gap: 4px;
}

/* ── Report Detail ── */

.detail-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.detail-header-info h2 {
    font-size: 15px;
    margin-bottom: 4px;
}

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

.detail-meta span { white-space: nowrap; }
.detail-meta .label { color: var(--text-muted); margin-right: 4px; }

/* ── KPI Cards ── */

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

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.kpi-card .kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-card .kpi-value {
    font-family: var(--font-data);
    font-size: 22px;
    font-weight: 700;
}

.kpi-card .kpi-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Waterfall ── */

.waterfall-bar {
    display: flex;
    height: 16px;
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}

.waterfall-bar .phase {
    height: 100%;
    min-width: 2px;
    position: relative;
}

.waterfall-bar .phase:hover { opacity: 0.8; }

.phase-manifest { background: var(--phase-manifest); }
.phase-network { background: var(--phase-network); }
.phase-decoder { background: var(--phase-decoder); }
.phase-buffering { background: var(--phase-buffering); }
.phase-ready { background: var(--phase-ready); }

.waterfall-legend {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.waterfall-legend span::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-manifest::before { background: var(--phase-manifest); }
.legend-network::before { background: var(--phase-network); }
.legend-decoder::before { background: var(--phase-decoder); }
.legend-buffering::before { background: var(--phase-buffering); }
.legend-ready::before { background: var(--phase-ready); }

/* ── Expandable row ── */

.expand-row td {
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.expand-content {
    padding: 12px 20px;
    background: rgba(34,34,68,0.5);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.expand-section h4 {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.expand-section dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    font-size: 12px;
}

.expand-section dt { color: var(--text-secondary); }
.expand-section dd { font-family: var(--font-data); }

/* ── DotStrip (scenario) ── */

.dot-strip {
    display: flex;
    gap: 3px;
    margin: 8px 0;
}

.dot-strip .dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    position: relative;
    cursor: default;
}

.dot.hit { background: var(--hit); }
.dot.miss { background: var(--miss); }

.dot .tooltip {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 10;
}

.dot:hover .tooltip { display: block; }

/* ── Comparison ── */

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.compare-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.compare-header h3 { font-size: 13px; margin-bottom: 4px; }

.delta-improved { color: var(--delta-improved); }
.delta-regression { color: var(--delta-regression); }
.delta-unchanged { color: var(--delta-unchanged); }

/* ── Tabs ── */

.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--phase-network); border-bottom-color: var(--phase-network); }

/* ── Back link ── */

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    cursor: pointer;
}

.back-link:hover { color: var(--text); }

/* ── Empty state ── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 { font-size: 15px; margin-bottom: 8px; color: var(--text-secondary); }

/* ── Compare checkbox ── */

.compare-check {
    width: 14px;
    height: 14px;
    accent-color: var(--phase-network);
}

.compare-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 24px;
    z-index: 100;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.compare-bar.visible { display: flex; }

/* ── Mono data ── */

.mono { font-family: var(--font-data); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Mobile Testing Module ── */

.badge-passed { background: var(--pass); color: #fff; }
.badge-failed, .badge-fail { background: var(--fail); color: #fff; }
.badge-warning { background: var(--sev-normal); color: #1a1a2e; }
.badge-partial { background: var(--sev-slow); color: #fff; }
.badge-info { background: var(--info); color: #fff; }
.badge-unknown { background: var(--muted); color: var(--text); }

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
    align-items: center;
}
.filter-bar select,
.filter-bar input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font-ui);
}
.filter-bar select { min-width: 120px; }
.filter-bar input[type="text"] { width: 140px; }
.filter-bar input[type="date"] { width: 130px; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--surface-hover); }

.clickable { cursor: pointer; color: var(--info); text-decoration: underline; }
.clickable:hover { color: #5dade2; }

/* Step timeline */
.step-timeline .duration-bar {
    height: 6px;
    border-radius: 3px;
    min-width: 4px;
    display: inline-block;
}
.step-extra { margin-top: 4px; }
.step-data-chip {
    display: inline-block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 10px;
    margin: 1px 2px;
    color: var(--text-secondary);
}
.step-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.1s;
}
.step-thumb:hover { transform: scale(1.5); z-index: 10; position: relative; }
.step-error-row td { padding-top: 0 !important; }
.step-error {
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid var(--error);
    padding: 4px 8px;
    font-size: 11px;
    color: var(--sev-very-slow);
}

/* Screenshot gallery */
.screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 12px 0;
}
.screenshot-card {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.15s;
}
.screenshot-card:hover { border-color: var(--info); }
.screenshot-card img {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    display: block;
}
.screenshot-label {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}
.screenshot-trigger {
    padding: 0 8px 4px;
    font-size: 10px;
    color: var(--text-muted);
}

/* Lightbox */
.mt-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.mt-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
}

/* Content cards (shorts, assets) */
.content-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 12px 0;
}
.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: border-color 0.15s;
}
.content-card:hover { border-color: var(--module-mobile-testing); }
.content-card-highlighted { border-color: var(--sev-normal); border-width: 2px; }
.content-card-header { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.content-card-index { font-family: var(--font-data); font-size: 11px; color: var(--text-muted); }
.content-card-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.content-card-meta { font-size: 11px; color: var(--text-secondary); }
.content-card-likes { font-size: 11px; color: var(--sev-very-slow); margin-top: 4px; }

/* Search flow */
.search-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}
.flow-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
    min-width: 100px;
}
.flow-step.flow-success { border-color: var(--success); }
.flow-step.flow-pending { border-color: var(--warning); }
.flow-icon { font-size: 20px; margin-bottom: 4px; }
.flow-label { font-weight: 600; font-size: 12px; }
.flow-detail { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.flow-type { margin-top: 4px; }
.flow-arrow { font-size: 18px; color: var(--text-muted); }

/* Breakdown chips */
.mt-breakdown {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}
.mt-breakdown-chip {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.mt-breakdown-chip:hover { border-color: var(--module-mobile-testing); }
.chip-name { font-weight: 600; }
.chip-stat { color: var(--text-secondary); font-size: 11px; }
.chip-rate { font-family: var(--font-data); font-size: 12px; }

/* Info banner */
.mt-info-banner {
    background: rgba(26, 188, 156, 0.1);
    border: 1px solid var(--module-mobile-testing);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin: 12px 0;
    font-size: 13px;
}

/* Transition stats */
.transition-stats {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin: 8px 0;
}
.stat-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 12px;
}

/* Notes */
.mt-notes { margin: 12px 0; }
.mt-note {
    background: rgba(241, 196, 15, 0.1);
    border-left: 3px solid var(--warning);
    padding: 6px 12px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Video section */
.mt-video-section { margin: 12px 0; }
.mt-video-section video { border-radius: var(--radius); background: #000; }

/* Sortable column headers */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--info); }

/* ── Analytics Module ──────────────────────────────────────── */

.analytics-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.analytics-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    padding: 16px;
    margin-bottom: 12px;
}

.analytics-chart-card h3 {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
}

.analytics-section {
    margin: 20px 0;
}

.analytics-section h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px;
}

/* Horizontal bar chart */
.hbar-chart { margin: 8px 0; }
.hbar-track {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg);
}
.hbar-seg {
    height: 100%;
    transition: width 0.3s;
    cursor: default;
}

/* Chart legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    font-size: 11px;
}
.chart-legend-vertical {
    flex-direction: column;
    gap: 4px;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}
.chart-empty {
    color: var(--text-muted);
    font-size: 12px;
    padding: 12px;
    text-align: center;
}

/* Donut chart */
.donut-chart-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Event timeline */
.analytics-timeline-table td,
.analytics-timeline-table th {
    font-size: 11px;
    padding: 6px 8px;
}
.cat-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.imp-pill {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 10px;
}
.flow-tag {
    display: inline-block;
    background: var(--surface-hover);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin: 1px;
    color: var(--text-secondary);
}
.param-chip {
    display: inline-block;
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin: 1px;
    font-family: var(--font-data);
    color: var(--text-secondary);
}
.params-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.analytics-dup-row {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.02) 4px,
        rgba(255, 255, 255, 0.02) 8px
    );
    opacity: 0.7;
}
.badge-dup {
    background: var(--warning);
    color: var(--bg);
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
}
.badge-analytics {
    background: var(--module-analytics);
    color: #fff;
}
.analytics-cat-btn.active {
    background: currentColor;
    color: #fff !important;
}
.analytics-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.analytics-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Funnel cards */
.funnel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin: 8px 0;
}
.funnel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    padding: 14px;
}
.funnel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.funnel-name {
    font-weight: 600;
    font-size: 13px;
}
.funnel-status {
    font-weight: 700;
    font-size: 13px;
}
.funnel-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.funnel-progress-track {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.funnel-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.funnel-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-data);
}
.funnel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.funnel-action {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-data);
}
.funnel-action.seen {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

/* Compare */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    margin: 16px 0;
}
.compare-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    padding: 16px;
}
.compare-delta {
    display: flex;
    align-items: center;
    min-width: 120px;
}

/* Cross-module link */
.cross-link {
    margin: 8px 0;
}
.cross-link .btn {
    font-size: 12px;
}

@media (max-width: 768px) {
    .analytics-charts-row {
        grid-template-columns: 1fr;
    }
    .compare-grid {
        grid-template-columns: 1fr;
    }
    .donut-chart-wrap {
        flex-direction: column;
    }
}

/* ── Account Menu ──────────────────────────────────────────── */
.account-menu { position: relative; }
.account-btn { padding: 0; background: none; border: none; cursor: pointer; }
.account-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
}
.account-dropdown {
    display: none; position: absolute; right: 0; top: 40px;
    background: var(--surface); border: 1px solid var(--border, #2a2a4a);
    border-radius: 8px; padding: 12px; min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 1000;
}
.account-dropdown.visible { display: block; }
.account-info { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.account-name { color: var(--text); font-weight: 600; font-size: 14px; }
.account-role-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    background: var(--accent); color: #fff; width: fit-content;
}
.account-role-badge[data-role="admin"] { background: #e74c3c; }
.account-role-badge[data-role="developer"] { background: #3498db; }
.account-role-badge[data-role="qa"] { background: #2ecc71; }
.account-role-badge[data-role="project_manager"] { background: #9b59b6; }
.account-role-badge[data-role="product_manager"] { background: #e67e22; }
.account-role-badge[data-role="analytics"] { background: #1abc9c; }
.account-role-badge[data-role="ba"] { background: #f39c12; }
.account-divider { height: 1px; background: var(--border, #2a2a4a); margin: 8px 0; }
.account-action {
    display: block; width: 100%; text-align: left; padding: 8px;
    background: none; border: none; color: var(--text); cursor: pointer;
    border-radius: 4px; font-size: 13px;
}
.account-action:hover { background: rgba(255,255,255,.05); }

/* ── Integration Cards ─────────────────────────────────────── */
.integration-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; padding: 16px; }
.integration-card {
    background: var(--surface); border-radius: 8px; padding: 20px;
    border: 1px solid var(--border, #2a2a4a);
}
.integration-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.integration-icon { font-size: 1.4rem; }
.integration-name { font-weight: 600; font-size: 1.1rem; color: var(--text); flex: 1; }
.integration-status { display: flex; align-items: center; gap: 6px; font-size: 13px; text-transform: capitalize; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.integration-card-body { margin-bottom: 12px; font-size: 13px; color: var(--text-secondary, #888); }
.integration-platform-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; background: rgba(46,204,113,.15); color: #2ecc71;
}
.integration-platform-badge.off { background: rgba(99,110,114,.15); color: #636e72; }
.integration-info { margin-top: 6px; font-style: italic; color: var(--text-secondary, #888); }
.integration-card-actions { display: flex; gap: 8px; }
.integration-form { max-width: 500px; padding: 16px; }
.integration-scope-toggle { display: flex; gap: 16px; margin-bottom: 16px; padding: 12px; background: var(--surface); border-radius: 8px; }
.scope-option { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; cursor: pointer; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--text); font-weight: 500; }
.form-input {
    width: 100%; padding: 8px 12px; border-radius: 6px;
    border: 1px solid var(--border, #2a2a4a); background: var(--bg);
    color: var(--text); font-size: 14px; box-sizing: border-box;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.integration-message { margin-top: 12px; font-size: 13px; min-height: 1.4em; }
.integration-message.success { color: #2ecc71; }
.integration-message.error { color: #e74c3c; }
.integration-info-bar {
    padding: 10px 14px; margin-bottom: 16px; border-radius: 6px;
    background: rgba(52,152,219,.1); color: #3498db; font-size: 13px;
}
.detail-title { color: var(--text); margin: 16px; font-size: 1.3rem; }

/* ── Users Module ──────────────────────────────────────────── */
.users-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px; gap: 12px; }
.users-table { width: 100%; }
.users-table tbody tr { cursor: pointer; }
.users-table tbody tr:hover { background: rgba(255,255,255,.03); }
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-avatar.small { width: 28px; height: 28px; font-size: 11px; }
.user-avatar.large { width: 56px; height: 56px; font-size: 20px; }
.user-detail-header { display: flex; align-items: center; gap: 16px; padding: 16px; }
.user-detail-name { color: var(--text); margin: 0; font-size: 1.3rem; }
.user-detail-email { color: var(--text-secondary, #888); font-size: 14px; }
.user-detail-created { color: var(--text-secondary, #888); font-size: 12px; margin-top: 2px; }
.user-detail-section { padding: 0 16px 16px; }
.user-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { background: #e74c3c !important; color: #fff; }
.btn-danger:hover { background: #c0392b !important; }
.section-title { color: var(--text); font-size: 14px; margin: 16px 0 8px; font-weight: 600; }
.section-empty { color: var(--text-secondary, #888); font-size: 13px; padding: 8px 0; }
.activity-list { display: flex; flex-direction: column; gap: 4px; }
.activity-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 6px;
}
.activity-item:hover { background: rgba(255,255,255,.02); }
.activity-name { color: var(--text); font-weight: 500; min-width: 140px; }
.activity-time { color: var(--text-secondary, #888); font-size: 13px; min-width: 90px; }
.activity-meta { color: var(--text-secondary, #888); font-size: 12px; }
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.modal {
    background: var(--surface); border-radius: 12px; padding: 24px;
    min-width: 360px; max-width: 440px; box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.modal h3 { color: var(--text); margin: 0 0 16px; }
