/* ===== Fusion Management - Dark Theme Stylesheet ===== */

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #111640;
    --bg-panel: #161b4a;
    --bg-input: #1a2050;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-gold: #eab308;
    --accent-red: #ef4444;
    --accent-purple: #a78bfa;
    --border-color: #2a3060;
    --border-focus: #3b82f6;
    --border-success: #22c55e;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 20px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.poke-dark {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ===== Login Page ===== */
.poke-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 40%, rgba(59,130,246,0.12) 0%, transparent 60%);
}

.poke-login-container {
    text-align: center;
    padding: 60px 40px;
    width: 100%;
}

.poke-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}

.poke-logo-text {
    font-family: Inter;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 6px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #FFF 0%, #93C5FD 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.poke-login-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.poke-login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.btn-dlrsecured {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-dlrsecured:hover { background: var(--accent-blue-hover); }
.btn-dlrsecured i { font-size: 18px; }

.poke-login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Header ===== */
.poke-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.poke-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.poke-header-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 6px;
    color: var(--text-primary);
}

.poke-header-center { flex: 1; text-align: center; }

.poke-env-badge {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 6px;
}

.poke-env-badge.env-staging { color: var(--accent-gold); }
.poke-env-badge.env-prod    { color: var(--accent-red); }

.poke-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mgmt-user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-blue-hover); }
.btn-primary:disabled { background: var(--mgmt-border, #333); color: var(--mgmt-text-muted, #888); cursor: not-allowed; }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s;
}

.btn-outline:hover { border-color: var(--text-secondary); }
.btn-outline.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--bg-panel);
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover   { background: var(--bg-input); border-color: var(--accent-blue); }
.btn-secondary:visited { color: var(--accent-blue); }

.inline-form { display: inline; }
.btn-logout  { gap: 6px; }

/* ===== Main Content ===== */
.poke-main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}

.poke-main.mgmt-wide {
    max-width: 1500px;
}

/* ===== Page Title ===== */
.mgmt-page-title {
    margin-bottom: 24px;
}

.mgmt-page-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mgmt-page-title h2 i { color: var(--accent-blue); }

/* ===== Search Form ===== */
.mgmt-search-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.mgmt-search-forms {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.mgmt-search-forms .mgmt-search-form {
    margin-bottom: 0;
}

.mgmt-filters-row {
    display: grid;
    grid-template-columns: 1fr 200px auto;
    gap: 16px;
    align-items: end;
}

.mgmt-search-btn-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ===== Form Fields ===== */
.poke-field { display: flex; flex-direction: column; gap: 6px; }

.poke-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.poke-select, .poke-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

.poke-select:focus, .poke-input:focus { border-color: var(--border-focus); }

.poke-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== Alerts ===== */
.mgmt-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.mgmt-alert-error {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--accent-red);
}

/* ===== Results ===== */
.mgmt-results-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.mgmt-results-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Table ===== */
.poke-log-container { overflow-x: auto; }

.poke-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.poke-log-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.poke-log-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(42,48,96,0.5);
    color: var(--text-primary);
    vertical-align: middle;
}

.poke-log-table tr:hover td { background: rgba(255,255,255,0.02); }
.poke-log-empty { text-align: center; color: var(--text-muted); padding: 40px 16px !important; }

.mgmt-table-link       { color: var(--accent-blue); text-decoration: none; }
.mgmt-table-link:hover { text-decoration: underline; }

.mgmt-company-name { font-weight: 500; }
.mgmt-cif          { font-family: monospace; font-size: 12px; color: var(--text-secondary); }
.mgmt-timestamp    { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ===== Badges ===== */
.mgmt-type-badge, .mgmt-state-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Type badges */
.mgmt-type-enterprise { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3);  }
.mgmt-type-rooftop    { background: rgba(167,139,250,0.15); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.3); }
.mgmt-type-group      { background: rgba(34,197,94,0.15);   color: #4ade80; border: 1px solid rgba(34,197,94,0.3);   }

/* State badges */
.mgmt-state-setup  { background: rgba(234,179,8,0.15);   color: #fbbf24; border: 1px solid rgba(234,179,8,0.3);   }
.mgmt-state-pilot  { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3);  }
.mgmt-state-on     { background: rgba(34,197,94,0.15);   color: #4ade80; border: 1px solid rgba(34,197,94,0.3);   }

/* ===== Hamburger Nav Menu ===== */
.mgmt-nav-menu {
    position: relative;
}

.mgmt-hamburger {
    padding: 6px 10px;
}

.mgmt-nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    overflow: hidden;
}

.mgmt-nav-dropdown.open {
    display: block;
}

.mgmt-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.mgmt-nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.mgmt-nav-item.mgmt-nav-active {
    color: var(--accent-blue);
    background: rgba(59,130,246,0.08);
}

.mgmt-nav-item i { font-size: 15px; }

/* ===== Search filter grid variants ===== */
.mgmt-filters-row-users           { grid-template-columns: repeat(6, 1fr) auto; }
.mgmt-filters-row-roles           { grid-template-columns: repeat(3, 1fr) auto; }
.mgmt-filters-row-companies       { grid-template-columns: repeat(5, 1fr) auto; }
.mgmt-filters-row-companies-admin { grid-template-columns: repeat(6, 1fr) auto; }
.mgmt-filters-row-analytics       { grid-template-columns: 1fr 2fr 1fr 1fr 0.50fr; }

.twoCols { grid-column: span 2; }

/* ===== User / Role table cells ===== */
.mgmt-user-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgmt-role-name { font-weight: 500; }
.mgmt-email     { font-size: 12px; color: var(--text-secondary); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgmt-count     { font-size: 12px; color: var(--text-secondary); text-align: center; }
.mgmt-flags-cell { display: flex; gap: 4px; flex-wrap: nowrap; }

/* ===== Flag badges ===== */
.mgmt-flag-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.mgmt-flag-active     { background: rgba(34,197,94,0.15);   color: #4ade80; border: 1px solid rgba(34,197,94,0.3);   }
.mgmt-flag-inactive   { background: rgba(90,99,128,0.15);   color: #8892b0; border: 1px solid rgba(90,99,128,0.3);  }
.mgmt-flag-admin      { background: rgba(234,179,8,0.15);   color: #fbbf24; border: 1px solid rgba(234,179,8,0.3);  }
.mgmt-flag-frontrunner{ background: rgba(167,139,250,0.15); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.3);}
.mgmt-flag-default    { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.mgmt-flag-allow      { background: rgba(34,197,94,0.15);   color: #4ade80; border: 1px solid rgba(34,197,94,0.3);  }
.mgmt-flag-deny       { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.3);  }

.mgmt-flag-inherit    { color: var(--text-muted); font-size: 12px; }

/* ===== Required field marker ===== */
.mgmt-required { color: var(--accent-red); }

/* ===== Error Page ===== */
.poke-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
    text-align: center;
}

.poke-error-container code {
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

/* ===== Edit Screens ===== */
.mgmt-edit-section-title { padding-top: 10px; }

.mgmt-edit-actions {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ===== Debug / Diagnostic ===== */
.mgmt-debug-pre {
    background: var(--surface-2, #1e1e1e);
    color: var(--text-primary, #d4d4d4);
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    max-height: 500px;
    overflow-y: auto;
}

/* ===== Lightbox / Modal ===== */
.mgmt-lightbox-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.mgmt-lightbox-link:hover { text-decoration: underline; }

.mgmt-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.mgmt-modal-overlay.open {
    display: flex;
}

.mgmt-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.mgmt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.mgmt-modal-header i { color: var(--accent-blue); margin-right: 6px; }

.mgmt-modal .poke-log-table { font-size: 13px; }

/* ===== Effective Rights Preview Table ===== */
.mgmt-rights-allow { color: var(--accent-green); }
.mgmt-rights-deny  { color: var(--accent-red); }

/* ===== Deny-flag toggle (X-box checkbox) ===== */
.mgmt-deny-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}
.mgmt-deny-toggle input[type="checkbox"] { display: none; }
.mgmt-deny-box {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    font-size: 15px;
    color: transparent;
}
.mgmt-deny-toggle input:checked + .mgmt-deny-box {
    background: rgba(239, 68, 68, 0.18);
    border-color: var(--accent-red);
    color: var(--accent-red);
}
.mgmt-deny-toggle:hover .mgmt-deny-box {
    border-color: var(--accent-red);
}
.mgmt-deny-cell {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    min-width: 130px;
}

/* ===== Toast notifications ===== */
#mgmt-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.mgmt-toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: auto;
    max-width: 320px;
}
.mgmt-toast.mgmt-toast-error {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.mgmt-toast.mgmt-toast-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}
.mgmt-toast.mgmt-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Analytics Dashboard ===== */

/* Tile grid layouts */
.analytics-tiles-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.analytics-charts-row   { grid-template-columns: 1fr 1fr; }
.analytics-kpi-row      { grid-template-columns: 1fr 1fr; }
/* Single-column so each tile gets the full page width. analytics-tools-row holds Tool
   Success Rate and Top Failing Tools, whose tables carry six columns (Tool, MCP Server,
   Platform, Succeeded, Calls, Success Rate) and cannot show every header at half width;
   Error Counts by Type and MCP Endpoint Coverage stack full-width below them.
   analytics-pair-row holds only Distinct Rey Chats per Store and stays single-column
   to match. */
.analytics-tools-row    { grid-template-columns: 1fr; }
.analytics-tools-row > .analytics-tile { min-width: 0; }
/* Every tile in this row, not just the first: Tool Success Rate and Top Failing Tools both
   carry resizable six-column tables that can be dragged wider than the tile, and they are
   the first and second children respectively. Without this the second one clips instead of
   scrolling. */
.analytics-tools-row > .analytics-tile .analytics-table-scroll { overflow-x: auto; }
.analytics-pair-row     { grid-template-columns: 1fr; }
.analytics-pair-row > .analytics-tile { min-width: 0; }
.analytics-pair-row > .analytics-tile:first-child .analytics-table-scroll { overflow-x: auto; }
.analytics-feedback-row { grid-template-columns: 1fr 1fr; }
.analytics-suggestion-row { grid-template-columns: 1fr; }
.analytics-help-row     { grid-template-columns: 1fr 1fr; }
.analytics-help-row > .analytics-tile { min-width: 0; }
.analytics-frustration-row { grid-template-columns: 1fr 1fr; }
.analytics-escalation-row { grid-template-columns: 1fr; }
.analytics-qa-row { grid-template-columns: 1fr; }
.analytics-toolbar-item-reach-row { grid-template-columns: 1fr; }
.analytics-tac-chats-row { grid-template-columns: 1fr; }
.analytics-deferred-row { grid-template-columns: 1fr 1fr; }
.analytics-full-tile    { margin-bottom: 16px; }

/* Tile-scoped filter bar — sits inside a section above the tiles it filters.
   Mirrors the global mgmt-search-form sizing but tighter (single field row) so
   it visually reads as "scoped to the section below", not a new page-level filter. */
.analytics-section-filter {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}
.analytics-section-filter .poke-field { flex: 0 0 280px; }
.analytics-section-filter .analytics-section-filter-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 6px;
}

/* Right-aligned controls cluster inside a tile header (filter + computed_at badge),
   so the slim filter dropdown sits next to the timestamp rather than floating in the
   middle of the flex row. */
.analytics-tile-header-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Slim tile-scoped filter form. Lives inside the tile header (not a separate bar above
   the tiles like .analytics-section-filter), so the visual weight has to stay light:
   no border on the form itself, just a compact label + native select. */
.analytics-tile-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.analytics-tile-filter-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.analytics-tile-filter select {
    padding: 4px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.15s;
}
.analytics-tile-filter select:focus { border-color: var(--border-focus); }
.analytics-tile-filter select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Individual tile */
.analytics-tile {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.analytics-tile-chart { padding-bottom: 20px; }

.analytics-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.analytics-tile-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.analytics-tile-label i { color: var(--accent-blue); font-size: 14px; }

/* Info-tip icon — small muted (i) glyph next to a tile title that exposes a plain-English
   description of the metric on hover via the native HTML title attribute. Overrides the
   .analytics-tile-label i rule above (muted color, smaller size). No custom tooltip
   styling — we lean on the browser/OS native tooltip for the bubble itself. */
.analytics-tile-label i.analytics-info-tip {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 4px;
    transition: color 0.15s;
}
.analytics-tile-label i.analytics-info-tip:hover { color: var(--accent-blue); }

.analytics-tile-period {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.analytics-tile-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 20px 0;
    text-align: center;
}

/* Chart container */
.analytics-chart-container {
    position: relative;
    height: 200px;
}

/* TAC Chats Started — summary strip below the stacked-bar chart. Window totals per origin
   plus an overall total so the user doesn't have to eyeball the bars. */
.analytics-tac-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}
.analytics-tac-summary-item {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.analytics-tac-summary-total {
    border-left: 1px solid var(--border-color);
    padding-left: 12px;
}
.analytics-tac-summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.analytics-tac-summary-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}
.analytics-tac-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* computed_at badge shown on each tile */
.analytics-computed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.analytics-computed-badge i { font-size: 11px; }

/* Warning banner */
.analytics-warning-banner {
    background: rgba(234,179,8,0.10);
    border: 1px solid rgba(234,179,8,0.3);
    color: var(--accent-gold);
}

/* Rate / count values */
.analytics-pct {
    font-size: 13px;
    font-weight: 600;
}

.analytics-rate-good { color: var(--accent-green); }
.analytics-rate-warn { color: var(--accent-gold); }
.analytics-rate-bad  { color: var(--accent-red); }

.analytics-count {
    font-weight: 500;
    text-align: left;
}

.analytics-tool-name {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* QA Flagged Conversations — Detail tile: expandable sub-rows for subsequent frustration
   events within a conversation. The chevron toggle on the parent row flips the parent
   tbody's "is-open" class; sub-rows are display:none by default and revealed when open. */
.qa-subrow { display: none; }
.qa-conv-group.is-open .qa-subrow { display: table-row; }
.qa-subrow td {
    background: rgba(255,255,255,0.02);
    color: var(--text-secondary);
    font-size: 12px;
}
.qa-subrow-cell { padding-left: 28px !important; }   /* indent to align under parent timestamp, past the caret column */

.qa-subrow-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 6px 0 0;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.qa-subrow-toggle:hover { color: var(--text-primary); }
.qa-subrow-caret { transition: transform 0.15s ease; display: inline-block; }
.qa-conv-group.is-open .qa-subrow-caret { transform: rotate(90deg); }
.qa-subrow-count {
    font-size: 11px;
    opacity: 0.75;
}

/* Scrollable table area inside a tile */
.analytics-table-scroll { max-height: 280px; overflow-y: auto; }

/* Resizable table columns (drag the right edge of each header) */
.analytics-resizable-table { table-layout: fixed; }
.analytics-resizable-table th { position: relative; overflow: hidden; text-overflow: ellipsis; }
.analytics-resizable-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.analytics-col-resize {
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 2;
    border-right: 1px solid var(--border-color);
}
.analytics-col-resize:hover { background: var(--accent-blue); opacity: 0.5; }

/* ===== Pipeline Health Dashboard ===== */

/* Summary stat cards — four across, collapsing with the other tile rows on mobile. */
.pipeline-stats-row { grid-template-columns: 1fr 1fr 1fr 1fr; }

.pipeline-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.pipeline-stat-normal      { color: var(--accent-green); }
.pipeline-stat-investigate { color: var(--accent-gold); }
.pipeline-stat-alert       { color: var(--accent-red); }

/* Severity badges — same shape as the flag badges, colored by threshold band. */
.pipeline-sev-normal      { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3);  }
.pipeline-sev-investigate { background: rgba(234,179,8,0.15);  color: #fbbf24; border: 1px solid rgba(234,179,8,0.3);  }
.pipeline-sev-alert       { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3);  }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .mgmt-filters-row { grid-template-columns: 1fr; }
    .poke-header { flex-wrap: wrap; gap: 8px; }
    .poke-header-center { order: 3; flex-basis: 100%; }
    .poke-login-title { font-size: 36px; }
    .poke-logo-text { font-size: 24px; }
    .analytics-charts-row,
    .analytics-kpi-row,
    .analytics-tools-row,
    .analytics-pair-row,
    .analytics-feedback-row,
    .analytics-suggestion-row,
    .analytics-frustration-row,
    .analytics-escalation-row,
    .analytics-qa-row,
    .analytics-toolbar-item-reach-row,
    .analytics-help-row,
    .analytics-deferred-row,
    .pipeline-stats-row { grid-template-columns: 1fr; }
    .mgmt-filters-row-analytics { grid-template-columns: 1fr; }
}
