:root {
    --sidebar-width: 240px;
    --header-height: 70px;
}

.demo-body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
}

/* ======== SIDEBAR ======== */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* Role Toggle */
.role-toggle-wrap {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.role-toggle {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 3px;
}

.role-btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.role-btn.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.75rem 0;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-avatar.sm {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ======== MAIN CONTENT ======== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header {
    height: var(--header-height);
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.demo-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    width: 400px;
}

.header-search input {
    background: none;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
}

.header-search input:focus { outline: none; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-actions-group {
    display: flex;
    gap: 0.75rem;
}

.notification-bell {
    font-size: 1.25rem;
    position: relative;
    cursor: pointer;
}

.notification-bell .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-rose);
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 800;
}

/* ======== VIEWS ======== */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.view {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
}

.view.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.view-header h1 { font-size: 1.75rem; }
.view-kicker { color: var(--text-dim); font-size: 0.9rem; margin: 0.25rem 0 0; }

.date-picker {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.stat-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-value small {
    font-size: 1rem;
    color: var(--text-muted);
}

.trend {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.trend.up { color: var(--accent-emerald); background: rgba(16, 185, 129, 0.1); }
.trend.down { color: var(--accent-rose); background: rgba(244, 63, 94, 0.1); }

.mini-chart { height: 40px; position: relative; }

/* Channel Tabs */
.channel-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.channel-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.channel-tab:hover { border-color: var(--text-muted); color: var(--text-main); }
.channel-tab.active { background: rgba(99,102,241,0.1); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* Dashboard Bottom */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.recent-calls-card, .insights-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.card-header h2 { font-size: 1.125rem; }

.view-all {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 0.5rem 0.75rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.data-table.compact td { padding: 0.6rem 0.5rem 0.6rem 0; font-size: 0.8rem; }
.data-table.compact th { font-size: 0.7rem; padding-bottom: 0.75rem; }

.clickable-row { cursor: pointer; transition: background 0.2s; }
.clickable-row:hover { background-color: rgba(255, 255, 255, 0.02); }

.fw-500 { font-weight: 500; }

.channel-icon { font-size: 1.1rem; }

.sentiment-badge { font-size: 0.75rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.sentiment-badge.positive { color: var(--accent-emerald); background: rgba(16, 185, 129, 0.1); }
.sentiment-badge.neutral { color: var(--text-muted); background: rgba(255, 255, 255, 0.05); }
.sentiment-badge.negative { color: var(--accent-rose); background: rgba(244, 63, 94, 0.1); }

.status-badge { font-size: 0.75rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.status-badge.complete { color: var(--accent-cyan); background: rgba(6, 182, 212, 0.1); }
.status-badge.flagged { color: var(--accent-amber); background: rgba(245, 158, 11, 0.1); }

/* Action Items List */
.action-items-list { display: flex; flex-direction: column; gap: 1rem; }
.action-item { display: flex; align-items: flex-start; gap: 0.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.action-item:last-child { border-bottom: none; }
.action-item input[type="checkbox"] { margin-top: 0.25rem; cursor: pointer; }
.action-item label { display: flex; flex-direction: column; cursor: pointer; }
.ai-title { font-size: 0.875rem; font-weight: 500; }
.ai-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ======== INTERACTION DETAIL VIEW ======== */
.breadcrumb { margin-bottom: 0.5rem; }
.back-link { font-size: 0.875rem; color: var(--text-muted); }

.call-player-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.transcript-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

.player-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.btn-play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.btn-play:hover { transform: scale(1.05); }

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress {
    height: 100%;
    background: var(--primary);
}

.time { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.waveform {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 60px;
    padding: 0 1rem;
}

.wave {
    flex: 1;
    background: var(--border-light);
    border-radius: 2px;
    height: var(--height);
    transition: background 0.3s;
}

.wave.active { background: var(--primary); }

.transcript-content {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 400px;
}

.transcript-search { padding: 1rem; border-bottom: 1px solid var(--border); }
.transcript-search input { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; color: white; font-size: 0.875rem; font-family: var(--font-sans); }

.transcript-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.transcript-entry {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid transparent;
}

.transcript-entry.active {
    border-left-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.entry-time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); display: inline-block; margin-bottom: 0.25rem; }
.entry-speaker { font-size: 0.875rem; font-weight: 600; margin-left: 0.5rem; }
.entry-speaker.agent { color: var(--accent-cyan); }
.entry-speaker.customer { color: var(--accent-amber); }
.entry-text { font-size: 0.9rem; line-height: 1.5; color: var(--text-main); margin-top: 0.25rem; }

.insights-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.insight-card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.insight-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.sentiment-over-time {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 60px;
    margin-bottom: 1rem;
}

.s-bar { flex: 1; border-radius: 2px; }
.s-bar.pos { background: var(--accent-emerald); opacity: 0.6; }
.s-bar.neu { background: var(--text-muted); opacity: 0.3; }
.s-bar.neg { background: var(--accent-rose); opacity: 0.6; }

.coaching-notes { display: flex; flex-direction: column; gap: 0.75rem; }
.notepoint { font-size: 0.85rem; padding-left: 1.25rem; position: relative; }
.notepoint::before { content: "\2022"; position: absolute; left: 0; font-size: 1.25rem; line-height: 1; }
.notepoint.positive::before { color: var(--accent-emerald); }
.notepoint.neutral::before { color: var(--accent-amber); }

/* Scorecard Score */
.scorecard-score {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
}
.scorecard-score small { font-size: 1rem; color: var(--text-muted); }
.scorecard-score.inline { font-size: 1.25rem; }
.scorecard-score.inline small { font-size: 0.8rem; }

.criterion-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.criterion-row { display: flex; align-items: center; gap: 0.75rem; }
.criterion-label { font-size: 0.78rem; color: var(--text-muted); width: 140px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.criterion-bar { flex: 1; height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.criterion-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s; }
.criterion-fill.green { background: var(--accent-emerald); }
.criterion-fill.yellow { background: var(--accent-amber); }
.criterion-fill.red { background: var(--accent-rose); }
.criterion-val { font-size: 0.78rem; font-weight: 600; width: 28px; text-align: right; }

/* Notable Snippets */
.snippets-list { display: flex; flex-direction: column; gap: 0.75rem; }
.snippet-item { padding: 0.6rem; background: rgba(0,0,0,0.2); border-radius: 8px; }
.snippet-time { font-family: var(--font-mono); font-size: 0.7rem; color: var(--primary); }
.snippet-text { font-size: 0.8rem; color: var(--text-main); margin: 0.25rem 0; font-style: italic; }
.snippet-tag { font-size: 0.65rem; font-weight: 600; color: var(--accent-amber); background: rgba(245,158,11,0.1); padding: 2px 6px; border-radius: 4px; }

/* Comments */
.comments-list { margin-bottom: 0.75rem; }
.comment-item { padding: 0.6rem; background: rgba(0,0,0,0.15); border-radius: 8px; margin-bottom: 0.5rem; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 0.25rem; }
.comment-author { font-size: 0.78rem; font-weight: 600; }
.comment-anchor { font-size: 0.7rem; color: var(--primary); font-family: var(--font-mono); }
.comment-text { font-size: 0.8rem; color: var(--text-muted); }
.comment-input-row { display: flex; gap: 0.5rem; }
.comment-input { flex: 1; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.6rem; color: white; font-size: 0.8rem; font-family: var(--font-sans); }

/* Call Metrics Bar */
.call-metrics-bar {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
}

.metric-item { display: flex; align-items: center; gap: 0.5rem; }
.metric-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.metric-value { font-size: 0.9rem; font-weight: 700; }
.metric-value.sentiment-positive { color: var(--accent-emerald); }

.talk-listen-bar {
    display: flex;
    width: 160px;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    font-size: 0.65rem;
    font-weight: 700;
}

.talk-portion { background: var(--primary); display: flex; align-items: center; justify-content: center; color: white; }
.listen-portion { background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

/* ======== LIVE CALL VIEW ======== */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-rose);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px var(--accent-rose);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.live-call-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.live-left { display: flex; flex-direction: column; }

.live-transcript-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    flex: 1;
}

.live-transcript-panel h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }

.live-transcript-scroll { max-height: 350px; overflow-y: auto; }

.live-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 50px;
    margin-top: 1rem;
    padding: 0 1rem;
}

.live-waveform .wave-bar {
    width: 4px;
    background-color: var(--primary);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

@keyframes wave { 0% { height: 8px; } 100% { height: 40px; } }

.transcript-entry.typing .entry-text { color: var(--text-muted); }
.typing-cursor { animation: blink 0.8s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.live-right { display: flex; flex-direction: column; gap: 1.25rem; }

/* Coaching Hint Cards */
.coaching-hint-cards { display: flex; flex-direction: column; gap: 0.75rem; }
.hint-card {
    padding: 0.75rem;
    border-radius: 8px;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.hint-card.warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); }
.hint-card.info { background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2); }
.hint-card.danger { background: rgba(244,63,94,0.10); border: 1px solid rgba(244,63,94,0.28); }
.hint-card.success { background: rgba(16,185,129,0.10); border: 1px solid rgba(16,185,129,0.28); }

/* Post-call aggregate score cards — sentiment, churn risk, account health. */
.score-card .score-card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.score-card .score-card-header h3 { margin: 0; }
.score-badge {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card-hover);
    color: var(--text-main);
    min-width: 3.25rem;
    text-align: center;
}
.score-badge.good   { background: rgba(16,185,129,0.16); color: var(--accent-emerald); }
.score-badge.warn   { background: rgba(245,158,11,0.16); color: var(--accent-amber); }
.score-badge.bad    { background: rgba(244,63,94,0.16); color: var(--accent-rose); }
.score-confidence { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.score-caveat {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(245,158,11,0.08);
    border-left: 3px solid var(--accent-amber);
    border-radius: var(--radius-sm);
    color: var(--text-main);
}
.score-factors { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.75rem; }
.score-factor {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
}
.score-factor .score-factor-dir {
    font-weight: 600;
    width: 0.9rem;
    flex-shrink: 0;
    text-align: center;
    border-radius: 3px;
}
.score-factor.positive .score-factor-dir { color: var(--accent-emerald); background: rgba(16,185,129,0.12); }
.score-factor.negative .score-factor-dir { color: var(--accent-rose);    background: rgba(244,63,94,0.12); }
.score-factor-label { font-weight: 500; color: var(--text-main); }
.score-factor-why { color: var(--text-muted); }
.score-factor-mag {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-size: 0.7rem;
    color: var(--text-subtle);
}
.score-recs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}
.score-rec {
    font-size: 0.8rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}
.score-rec .score-rec-priority {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.score-rec .score-rec-priority.high   { background: rgba(244,63,94,0.14); color: var(--accent-rose); }
.score-rec .score-rec-priority.medium { background: rgba(245,158,11,0.14); color: var(--accent-amber); }
.score-rec .score-rec-priority.low    { background: rgba(6,182,212,0.14); color: var(--accent-cyan); }

/* Live-emitted alert cards fade in then out when auto-dismissed. */
.hint-card.live-alert { transition: opacity 0.3s ease, transform 0.3s ease; animation: hintSlideIn 0.25s ease-out; }
.hint-card.live-alert.dismissing { opacity: 0; transform: translateY(-4px); }
@keyframes hintSlideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Patience indicator light — tiny dot inline with its numeric reading. */
.metric-value.patience-light::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--text-subtle);
    vertical-align: baseline;
}
.metric-value.patience-light.good::before { background: var(--accent-emerald); }
.metric-value.patience-light.warn::before { background: var(--accent-amber); }
.metric-value.patience-light.bad::before  { background: var(--accent-rose); }

.hint-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.hint-card p { font-size: 0.8rem; line-height: 1.4; color: var(--text-main); }

/* Compliance List */
.compliance-list { display: flex; flex-direction: column; gap: 0.5rem; }
.compliance-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: default;
}
.compliance-item.checked { color: var(--accent-emerald); }

/* Caller Info Grid */
.caller-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.caller-field { display: flex; flex-direction: column; }
.caller-field.full-width { grid-column: 1 / -1; }
.field-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin-bottom: 0.15rem; }
.field-value { font-size: 0.85rem; font-weight: 500; }

.sparkline-svg { width: 100%; height: 30px; }
.inline-sparkline { width: 80px; height: 20px; display: inline-block; vertical-align: middle; }

/* Whisper Tray */
.whisper-tray {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(99,102,241,0.06);
    border: 1px dashed rgba(99,102,241,0.25);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    margin-top: 0.75rem;
}
.whisper-icon { font-size: 1.1rem; }
.whisper-label { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* ======== MANAGER MONITORING VIEW ======== */
.monitoring-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.monitoring-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.monitoring-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.monitoring-agent { display: flex; gap: 0.75rem; align-items: center; }
.monitoring-agent-name { font-weight: 600; font-size: 0.9rem; display: block; }
.monitoring-caller { font-size: 0.78rem; color: var(--text-muted); display: block; }
.monitoring-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.monitoring-duration { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }

.monitoring-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.monitoring-detail-panel h2 { font-size: 1.1rem; margin-bottom: 1.25rem; }

.monitoring-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.monitoring-transcript h3 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.monitoring-right { display: flex; flex-direction: column; gap: 1rem; }

.whisper-input-card {
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 12px;
    padding: 1.25rem;
}
.whisper-input-card h3 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.whisper-input-row { display: flex; gap: 0.5rem; }
.whisper-input { flex: 1; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; color: white; font-size: 0.85rem; font-family: var(--font-sans); }

/* ======== CALL LIBRARY VIEW ======== */
.library-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-select, .filter-tags-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.filter-tags-input { min-width: 180px; }

.library-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.library-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.library-card:hover { border-color: var(--border-light); transform: translateY(-2px); }

.library-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }

.quality-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}
.quality-badge.exemplary { color: var(--accent-emerald); background: rgba(16,185,129,0.1); }
.quality-badge.needs-improvement { color: var(--accent-rose); background: rgba(244,63,94,0.1); }
.quality-badge.flagged { color: var(--accent-amber); background: rgba(245,158,11,0.1); }

.library-play-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
}

.library-card-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
.library-time-range { font-family: var(--font-mono); font-size: 0.75rem; color: var(--primary); margin-bottom: 0.25rem; }
.library-source { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.library-excerpt { font-size: 0.8rem; color: var(--text-muted); font-style: italic; line-height: 1.4; margin-bottom: 0.75rem; }

.library-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    color: var(--text-muted);
}

/* ======== SEARCH VIEW ======== */
.search-big-input {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.search-icon-lg { font-size: 1.5rem; }

.search-big-input input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1.1rem;
}

.search-big-input input:focus { outline: none; }

.search-results { display: flex; flex-direction: column; gap: 1rem; }
.search-result-count { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.search-result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.search-result-item:hover { border-color: var(--border-light); }

.search-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.search-result-title { font-weight: 600; font-size: 0.95rem; }
.search-result-date { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }

.search-result-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.search-result-excerpt mark {
    background: rgba(245,158,11,0.3);
    color: var(--text-main);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ======== CONTACTS VIEW ======== */
.contact-detail-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
}

.contact-info-panel { display: flex; flex-direction: column; gap: 1.25rem; }

.churn-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}
.churn-badge.low { color: var(--accent-emerald); background: rgba(16,185,129,0.1); }
.churn-badge.medium { color: var(--accent-amber); background: rgba(245,158,11,0.1); }
.churn-badge.high { color: var(--accent-rose); background: rgba(244,63,94,0.1); }

.contact-history-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.contact-history-panel h3 { font-size: 1rem; margin-bottom: 1.25rem; }

.history-timeline { display: flex; flex-direction: column; gap: 1rem; }

.history-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child { border-bottom: none; }

.history-content { display: flex; flex-direction: column; gap: 0.25rem; }
.history-title { font-size: 0.9rem; font-weight: 500; }
.history-date { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }

/* ======== ANALYTICS VIEW ======== */
.analytics-top-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.health-score-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.health-score-card h3 { font-size: 0.95rem; margin-bottom: 1rem; }

.health-gauge {
    position: relative;
    width: 120px;
    height: 120px;
}

.gauge-svg { width: 120px; height: 120px; }

.gauge-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.gauge-value { font-size: 2rem; font-weight: 800; }
.gauge-sub { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }

.analytics-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.analytics-chart-card h3 { font-size: 0.95rem; margin-bottom: 1rem; }

.trend-chart { padding: 0 1rem; }

.trend-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    position: relative;
}

.trend-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
}

.trend-bar {
    width: 100%;
    max-width: 40px;
    height: var(--h);
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 4px 4px 0 0;
    opacity: 0.7;
    position: absolute;
    bottom: 0;
}

.trend-line-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-emerald);
    border-radius: 50%;
    position: absolute;
    top: var(--top);
    z-index: 2;
}

.trend-label {
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.trend-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.legend-bar { width: 16px; height: 10px; background: var(--primary); border-radius: 2px; opacity: 0.7; }
.legend-dot { width: 8px; height: 8px; background: var(--accent-emerald); border-radius: 50%; }

.analytics-mid-row, .analytics-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Topics List */
.topics-list { display: flex; flex-direction: column; gap: 0.6rem; }
.topic-row { display: flex; align-items: center; gap: 0.75rem; }
.topic-name { font-size: 0.85rem; width: 150px; flex-shrink: 0; }
.topic-bar { flex: 1; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.topic-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.topic-count { font-size: 0.78rem; color: var(--text-muted); width: 36px; text-align: right; }

/* Feedback Themes */
.feedback-themes { display: flex; flex-direction: column; gap: 0.6rem; }
.feedback-theme { display: flex; align-items: center; gap: 0.75rem; }
.theme-sentiment {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.theme-sentiment.positive { background: rgba(16,185,129,0.15); color: var(--accent-emerald); }
.theme-sentiment.negative { background: rgba(244,63,94,0.15); color: var(--accent-rose); }
.theme-text { font-size: 0.85rem; flex: 1; }
.theme-count { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ======== SCORECARDS VIEW ======== */
.scorecards-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.scorecard-templates-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.scorecard-templates-list h3 { font-size: 0.95rem; margin-bottom: 1rem; }

.template-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.25rem;
}

.template-item:hover { background: rgba(255,255,255,0.03); }
.template-item.active { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.2); }

.template-icon { font-size: 1.1rem; }
.template-name { font-size: 0.9rem; font-weight: 600; display: block; }
.template-meta { font-size: 0.72rem; color: var(--text-muted); display: block; }

.scorecard-editor-preview { display: flex; flex-direction: column; gap: 1.25rem; }

.criteria-editor { display: flex; flex-direction: column; gap: 0.5rem; }
.criteria-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
}
.criteria-name { font-size: 0.85rem; font-weight: 500; }
.criteria-weight { font-size: 0.75rem; color: var(--text-muted); }

.scored-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.9rem; }

/* ======== KNOWLEDGE BASE VIEW ======== */
.kb-document-list { display: flex; flex-direction: column; gap: 0.75rem; }

.kb-document {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s;
}

.kb-document:hover { border-color: var(--border-light); }

.kb-source-icon { font-size: 1.5rem; flex-shrink: 0; }
.kb-doc-info { flex: 1; }
.kb-doc-title { font-size: 0.9rem; font-weight: 600; display: block; }
.kb-doc-meta { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 0.15rem; }

.kb-sync-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}
.kb-sync-status.synced { color: var(--accent-emerald); background: rgba(16,185,129,0.1); }
.kb-sync-status.syncing { color: var(--accent-amber); background: rgba(245,158,11,0.1); }

/* ======== INTEGRATIONS VIEW ======== */
.integrations-section { margin-bottom: 2rem; }
.integrations-section h3 { font-size: 1.1rem; margin-bottom: 1rem; }

.integration-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.integration-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    transition: border-color 0.2s;
}

.integration-card-item:hover { border-color: var(--border-light); }
.integration-card-item.connected { border-color: rgba(16,185,129,0.3); }

.integration-icon-lg { font-size: 2rem; }
.integration-name { font-weight: 600; font-size: 0.9rem; }

.integration-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}
.integration-status.connected { color: var(--accent-emerald); background: rgba(16,185,129,0.1); }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent-emerald); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ======== SETTINGS VIEW ======== */
.settings-sections { display: flex; flex-direction: column; gap: 2rem; max-width: 800px; }

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-section h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.settings-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

.radio-group { display: flex; flex-direction: column; gap: 0.75rem; }

.radio-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.radio-item.active, .radio-item:has(input:checked) { border-color: var(--primary); background: rgba(99,102,241,0.06); }

.radio-desc { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; margin-left: auto; }

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.pii-entities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.settings-select {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
    width: 300px;
    cursor: pointer;
}

.settings-section code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ======== MODALS ======== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    width: 600px;
    max-width: 90%;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,1);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.close-modal { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.3s;
}

.upload-area:hover { border-color: var(--primary); }
.upload-icon { font-size: 3rem; opacity: 0.5; }
.upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 1rem; }

/* ======== RESPONSIVE DEMO ======== */
@media (max-width: 1200px) {
    .library-grid { grid-template-columns: repeat(2, 1fr); }
    .integration-cards-row { grid-template-columns: repeat(3, 1fr); }
    .monitoring-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .dashboard-bottom-grid { grid-template-columns: 1fr; }
    .call-player-grid { grid-template-columns: 1fr; height: auto; }
    .live-call-grid { grid-template-columns: 1fr; }
    .analytics-top-row { grid-template-columns: 1fr; }
    .analytics-mid-row, .analytics-bottom-row { grid-template-columns: 1fr; }
    .contact-detail-grid { grid-template-columns: 1fr; }
    .scorecards-layout { grid-template-columns: 1fr; }
    .monitoring-detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .library-grid { grid-template-columns: 1fr; }
    .integration-cards-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .monitoring-cards-grid { grid-template-columns: 1fr; }
    .integration-cards-row { grid-template-columns: 1fr; }
}

/* ======== COLLAPSIBLE NAV GROUPS ======== */
.nav-group {
    margin-top: 4px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    cursor: pointer;
    user-select: none;
}

.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nav-group-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.nav-group.collapsed .nav-group-chevron {
    transform: rotate(-90deg);
}

.nav-group-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.nav-group.collapsed .nav-group-items {
    max-height: 0;
    opacity: 0;
}

/* Manager-only items hidden by default */
.manager-only {
    display: none;
}

.app-layout.manager-mode .manager-only {
    display: flex;
}

/* ======== REDESIGNED INTERACTIONS TABLE ======== */
.interactions-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.interactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.interactions-table thead th:hover {
    color: var(--text-main);
}

.interactions-table tbody tr.interaction-row {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.interactions-table tbody tr.interaction-row:hover {
    background: var(--bg-card-hover);
}

.interactions-table td {
    padding: 12px;
    vertical-align: middle;
    white-space: nowrap;
}

/* Expand chevron */
.expand-chevron {
    width: 20px;
    transition: transform 0.2s ease;
    color: var(--text-muted);
    cursor: pointer;
}

.interaction-row.expanded .expand-chevron {
    transform: rotate(90deg);
}

/* Channel icons */
.channel-icon-svg {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channel-icon-svg.voice { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.channel-icon-svg.email { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.channel-icon-svg.transcript { background: rgba(139, 92, 246, 0.15); color: var(--secondary); }

/* Topic pills */
.topic-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    margin-right: 4px;
}

/* QA Score bar */
.qa-score-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qa-bar-track {
    width: 48px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
}

.qa-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.qa-bar-fill.high { background: var(--accent-emerald); }
.qa-bar-fill.mid { background: var(--accent-amber); }
.qa-bar-fill.low { background: var(--accent-rose); }

/* Action items completion */
.action-completion {
    font-size: 13px;
    font-weight: 500;
}

.action-completion.complete { color: var(--accent-emerald); }
.action-completion.partial { color: var(--accent-amber); }
.action-completion.none { color: var(--accent-rose); }

/* Risk flag icons */
.risk-flags {
    display: flex;
    gap: 4px;
}

.risk-flag {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.risk-flag.churn { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.risk-flag.escalation { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.risk-flag.compliance { background: rgba(139, 92, 246, 0.15); color: var(--secondary); }

/* Relative date with hover */
.date-relative {
    color: var(--text-muted);
    font-size: 13px;
    cursor: default;
}

/* Expandable row content */
.row-expand {
    display: none;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.row-expand.open {
    display: table-row;
}

.row-expand-content {
    padding: 16px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.row-expand-summary {
    grid-column: 1 / -1;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

.row-expand-metrics {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.row-metric-pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.row-expand-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.row-expand-footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.table-pagination button {
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    font-size: 13px;
}

.table-pagination button:hover {
    background: var(--bg-card-hover);
}

.table-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ======== ACTION ITEMS STANDALONE VIEW ======== */
.action-items-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.action-filter-btn {
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.action-filter-btn.active,
.action-filter-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.priority-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.high { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.priority-badge.medium { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.priority-badge.low { background: rgba(99, 102, 241, 0.15); color: var(--primary); }

.category-pill {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.due-date.overdue {
    color: var(--accent-rose);
    font-weight: 500;
}

.status-badge.dismissed {
    text-decoration: line-through;
    opacity: 0.5;
}

/* ======== TOAST NOTIFICATIONS ======== */
.toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    background: rgba(30, 30, 42, 0.95);
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid var(--accent-emerald); }
.toast-info    { border-left: 3px solid var(--primary); }
.toast-warning { border-left: 3px solid var(--accent-amber); }
.toast-error   { border-left: 3px solid var(--accent-rose); }

/* ======== GENERIC MODAL BODY ELEMENTS ======== */
.generic-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}
.generic-modal-body label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.generic-modal-body input[type="text"],
.generic-modal-body input[type="url"],
.generic-modal-body input[type="email"],
.generic-modal-body textarea,
.generic-modal-body select {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: var(--font-sans);
}
:root[data-theme="light"] .generic-modal-body input[type="text"],
:root[data-theme="light"] .generic-modal-body input[type="url"],
:root[data-theme="light"] .generic-modal-body input[type="email"],
:root[data-theme="light"] .generic-modal-body textarea,
:root[data-theme="light"] .generic-modal-body select {
    background: #fff;
}
.generic-modal-body textarea { min-height: 120px; resize: vertical; }
.generic-modal-actions .btn { padding: 0.5rem 0.9rem; font-size: 0.85rem; }

/* ======== SIMPLE DROPDOWN (bell, date picker) ======== */
.simple-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    z-index: 500;
    display: none;
}
.simple-dropdown.open { display: block; }
.simple-dropdown .dd-item {
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
}
.simple-dropdown .dd-item:hover { background: rgba(255,255,255,0.05); }
.simple-dropdown .dd-item.active { background: rgba(99,102,241,0.12); color: var(--primary); }
.simple-dropdown .dd-heading {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.notification-bell { position: relative; cursor: pointer; }
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
}
.notification-item:hover { background: rgba(255,255,255,0.04); }
.notification-item .notif-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}
.date-picker { position: relative; cursor: pointer; user-select: none; }

/* ======== FILE UPLOAD QUEUE ======== */
.upload-queue {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.upload-queue:empty { display: none; }
.upload-file-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}
.upload-file-row .file-name { flex: 1; color: var(--text-main); }
.upload-file-row .file-size { color: var(--text-muted); font-size: 0.75rem; }
.upload-file-row .remove-file { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }
.upload-area.drag-over { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.upload-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ======== WHISPER MESSAGES ======== */
.whisper-tray.has-messages .whisper-label { color: var(--text-main); }
.whisper-message {
    font-size: 0.8rem;
    padding: 2px 8px;
    background: rgba(99,102,241,0.1);
    border-radius: 4px;
    margin-left: 4px;
}

/* ======== GENERATED KEY DISPLAY ======== */
.generated-key-display {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-emerald);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.generated-key-display button {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-main);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* ============================================================ */
/*  UNIFIED HOVER / ELEVATION — single recipe per surface        */
/* ============================================================ */
.stat-card,
.insight-card,
.monitoring-card,
.search-result-item,
.kb-document,
.integration-card-item,
.settings-section {
    transition: border-color var(--dur-med, 220ms) var(--ease-out, ease),
                transform var(--dur-med, 220ms) var(--ease-out, ease),
                box-shadow var(--dur-med, 220ms) var(--ease-out, ease),
                background-color var(--dur-fast, 120ms);
}
.stat-card:hover,
.library-card:hover,
.monitoring-card:hover,
.search-result-item:hover,
.kb-document:hover,
.integration-card-item:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}
.library-card { transition: all var(--dur-med, 220ms) var(--ease-out, ease); }
.data-table tr,
.interactions-table tbody tr {
    transition: background-color var(--dur-fast, 120ms);
}
.clickable-row:hover,
.data-table tbody tr:hover,
.interactions-table tbody tr.interaction-row:hover {
    background-color: var(--bg-card-hover);
}

/* ============================================================ */
/*  THEME TOGGLE + HEADER SEARCH (button-as-input)               */
/* ============================================================ */
.header-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    padding: 0.55rem 0.75rem 0.55rem 1rem;
    width: 420px;
    max-width: 50vw;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color var(--dur-fast, 120ms), background var(--dur-fast, 120ms);
}
.header-search:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
    color: var(--text-main);
}
.header-search-placeholder { flex: 1; text-align: left; }
.search-icon-svg { color: var(--text-subtle, var(--text-muted)); flex-shrink: 0; }
.kbd-hint,
.cmdk-hint,
.cmdk-footer kbd {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1;
}
:root[data-theme="light"] .kbd-hint,
:root[data-theme="light"] .cmdk-hint,
:root[data-theme="light"] .cmdk-footer kbd { background: rgba(15,23,42,0.04); }
.kbd-mod { font-size: 0.85em; }

.notification-bell {
    background: none;
    border: none;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm, 6px);
    transition: color var(--dur-fast, 120ms), background var(--dur-fast, 120ms);
}
.notification-bell:hover { color: var(--text-main); background: var(--bg-card); }
.notification-bell .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-rose);
    color: white;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 10px;
    font-weight: 800;
    line-height: 1.2;
}

/* ============================================================ */
/*  SIDEBAR COLLAPSE STATE                                       */
/* ============================================================ */
.sidebar-brand { position: relative; }
.sidebar-collapse-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: color var(--dur-fast, 120ms), background var(--dur-fast, 120ms), border-color var(--dur-fast, 120ms);
}
.sidebar-collapse-btn:hover { color: var(--text-main); border-color: var(--border); background: var(--bg-card); }

.app-sidebar.collapsed { width: 72px; transition: width var(--dur-med, 220ms) var(--ease-out, ease); }
.app-sidebar.collapsed .logo-text,
.app-sidebar.collapsed .role-toggle-wrap,
.app-sidebar.collapsed .nav-group-label,
.app-sidebar.collapsed .nav-group-chevron,
.app-sidebar.collapsed .user-info,
.app-sidebar.collapsed .nav-item { /* hide text labels */ }
.app-sidebar.collapsed .nav-group-header { padding: 0.25rem 0; justify-content: center; }
.app-sidebar.collapsed .nav-group-header > .nav-group-label,
.app-sidebar.collapsed .nav-group-header > .nav-group-chevron { display: none; }
.app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.6rem 0;
    gap: 0;
    font-size: 0; /* hide label */
    position: relative;
}
.app-sidebar.collapsed .nav-item .nav-icon { font-size: initial; }
.app-sidebar.collapsed .sidebar-brand { padding: 0 0.75rem; justify-content: center; gap: 0; }
.app-sidebar.collapsed .sidebar-collapse-btn { position: static; transform: none; margin-left: 0.25rem; }
.app-sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.app-sidebar.collapsed .user-profile { justify-content: center; }

/* Tooltip on collapsed nav-item hover (CSS only) */
.app-sidebar.collapsed .nav-item::after {
    content: attr(aria-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    padding: 0.3rem 0.55rem;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.78rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-fast, 120ms);
    z-index: 40;
}
.app-sidebar.collapsed .nav-item:hover::after,
.app-sidebar.collapsed .nav-item:focus-visible::after { opacity: 1; }

/* ============================================================ */
/*  MODAL IMPROVEMENTS                                           */
/* ============================================================ */
.modal-overlay { opacity: 0; pointer-events: none; transition: opacity var(--dur-med, 220ms); }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    transform: translateY(8px) scale(0.98);
    transition: transform var(--dur-med, 220ms) var(--ease-out, ease);
    box-shadow: var(--shadow-xl);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.close-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 6px);
    transition: color var(--dur-fast, 120ms), background var(--dur-fast, 120ms);
}
.close-modal:hover { color: var(--text-main); background: var(--bg-card-hover); }
.upload-or { display: block; color: var(--text-subtle, var(--text-muted)); font-size: 0.8rem; }

/* ============================================================ */
/*  TOOLTIP + INFO HINT                                          */
/* ============================================================ */
.info-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1;
    transition: background var(--dur-fast, 120ms), color var(--dur-fast, 120ms);
}
.info-hint:hover,
.info-hint:focus-visible { background: var(--primary-soft); color: var(--primary); }

.tooltip {
    position: fixed;
    z-index: 9000;
    pointer-events: none;
    max-width: 280px;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.8rem;
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity var(--dur-fast, 120ms), transform var(--dur-fast, 120ms);
}
.tooltip.visible { opacity: 1; transform: translateY(0); }

/* ============================================================ */
/*  COMMAND PALETTE                                              */
/* ============================================================ */
.cmdk-overlay { align-items: flex-start; padding-top: 10vh; }
.cmdk-panel {
    width: 620px;
    max-width: 92vw;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    transform: translateY(8px) scale(0.99);
    transition: transform var(--dur-med, 220ms) var(--ease-out, ease);
}
.modal-overlay.active .cmdk-panel { transform: translateY(0) scale(1); }
.cmdk-input-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}
.cmdk-input-row input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
}
.cmdk-input-row input:focus { outline: none; box-shadow: none; }
.cmdk-list { list-style: none; padding: 0.5rem; margin: 0; overflow-y: auto; flex: 1; }
.cmdk-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}
.cmdk-list li[aria-selected="true"],
.cmdk-list li:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.cmdk-list li .cmdk-kind {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cmdk-list .cmdk-empty {
    color: var(--text-muted);
    padding: 1.25rem;
    text-align: center;
    cursor: default;
}
.cmdk-footer {
    display: flex;
    gap: 1.25rem;
    justify-content: flex-end;
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-muted);
}
.cmdk-footer kbd { font-family: var(--font-mono); font-size: 0.68rem; padding: 1px 5px; }

/* ============================================================ */
/*  EMPTY / LOADING / ERROR STATES                               */
/* ============================================================ */
.state-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    gap: 0.5rem;
}
.state-illustration {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-soft, rgba(99,102,241,0.1));
    color: var(--primary);
    margin-bottom: 0.75rem;
}
.state-illustration.error { background: rgba(244,63,94,0.12); color: var(--accent-rose); }
.state-wrap h3 { font-size: 1.05rem; margin: 0; }
.state-wrap p { font-size: 0.9rem; color: var(--text-muted); max-width: 380px; margin-bottom: 0.6rem; }

/* Skeleton rows */
.skeleton-wrap { padding: 1rem 0; gap: 0.75rem; }
.skeleton-row {
    width: 100%;
    height: 48px;
    border-radius: var(--radius-sm, 6px);
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.03) 100%);
    background-size: 200% 100%;
    animation: skeleton-sheen 1.4s ease-in-out infinite;
}
:root[data-theme="light"] .skeleton-row {
    background: linear-gradient(90deg,
        rgba(15,23,42,0.04) 0%,
        rgba(15,23,42,0.10) 50%,
        rgba(15,23,42,0.04) 100%);
    background-size: 200% 100%;
}
@keyframes skeleton-sheen {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton-row { animation: none; }
}

/* ============================================================ */
/*  SIGNALS COLUMN + FROZEN FIRST COLUMN                         */
/* ============================================================ */
[data-sticky-first] { position: relative; }
[data-sticky-first] .col-sticky {
    position: sticky;
    left: 0;
    background: var(--bg-main);
    z-index: 2;
}
[data-sticky-first] tbody td.col-sticky,
[data-sticky-first] tbody tr:hover td.col-sticky { background: inherit; }
[data-sticky-first] tbody tr.interaction-row:hover td.col-sticky { background: var(--bg-card-hover); }

.signals-cell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 220px;
}
.signals-more {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    cursor: help;
}

/* ============================================================ */
/*  IMPROVED CHARTS (SVG-driven)                                 */
/* ============================================================ */
.mini-chart {
    height: 40px;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}
.mini-chart svg { width: 100%; height: 100%; display: block; }
.mini-chart .mini-chart-fill { fill: url(#mini-chart-grad); }
.mini-chart .mini-chart-line { fill: none; stroke: var(--primary); stroke-width: 1.5; }

/* ============================================================ */
/*  CHANNEL ICON (shared between table + history + search)       */
/* ============================================================ */
span.channel-icon-svg {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
span.channel-icon-svg svg { width: 14px; height: 14px; }

/* ============================================================ */
/*  LIGHT MODE OVERRIDES (platform-specific)                     */
/* ============================================================ */
:root[data-theme="light"] .demo-body { background-color: var(--bg-main); }
:root[data-theme="light"] .app-sidebar { background: var(--bg-secondary); }
:root[data-theme="light"] .app-header { background: var(--bg-main); }
:root[data-theme="light"] .nav-item.active { background: rgba(79,70,229,0.1); color: var(--primary); }
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .insight-card,
:root[data-theme="light"] .monitoring-card,
:root[data-theme="light"] .library-card,
:root[data-theme="light"] .search-result-item,
:root[data-theme="light"] .kb-document,
:root[data-theme="light"] .integration-card-item,
:root[data-theme="light"] .settings-section,
:root[data-theme="light"] .recent-calls-card,
:root[data-theme="light"] .analytics-chart-card,
:root[data-theme="light"] .health-score-card,
:root[data-theme="light"] .player-container,
:root[data-theme="light"] .transcript-content,
:root[data-theme="light"] .live-transcript-panel,
:root[data-theme="light"] .monitoring-detail-panel,
:root[data-theme="light"] .contact-history-panel,
:root[data-theme="light"] .scorecard-templates-list,
:root[data-theme="light"] .call-metrics-bar,
:root[data-theme="light"] .modal { box-shadow: var(--shadow-sm); }

:root[data-theme="light"] .header-search { background: #fff; }
:root[data-theme="light"] .interactions-table tbody tr.interaction-row:hover { background: rgba(79,70,229,0.04); }
:root[data-theme="light"] .role-btn.active { color: #fff; }
:root[data-theme="light"] .user-avatar { color: #fff; }
:root[data-theme="light"] .theme-toggle:hover { background: var(--bg-card-hover); }
:root[data-theme="light"] .talk-portion { color: #fff; }
:root[data-theme="light"] .hint-card.warning { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.28); }
:root[data-theme="light"] .hint-card.info { background: rgba(6,182,212,0.10); border-color: rgba(6,182,212,0.28); }
:root[data-theme="light"] .whisper-tray { background: rgba(79,70,229,0.06); border-color: rgba(79,70,229,0.25); }
:root[data-theme="light"] .criteria-row,
:root[data-theme="light"] .snippet-item,
:root[data-theme="light"] .comment-item,
:root[data-theme="light"] .radio-item { background: rgba(15,23,42,0.04); }
:root[data-theme="light"] .radio-item.active,
:root[data-theme="light"] .radio-item:has(input:checked) { background: rgba(79,70,229,0.06); border-color: var(--primary); }
:root[data-theme="light"] .transcript-entry.active { background: rgba(79,70,229,0.06); }
:root[data-theme="light"] .preview-header,
:root[data-theme="light"] .progress-bar,
:root[data-theme="light"] .criterion-bar,
:root[data-theme="light"] .qa-bar-track,
:root[data-theme="light"] .topic-bar { background: rgba(15,23,42,0.08); }
:root[data-theme="light"] .transcript-search input,
:root[data-theme="light"] .comment-input,
:root[data-theme="light"] .whisper-input,
:root[data-theme="light"] .settings-select,
:root[data-theme="light"] .filter-select,
:root[data-theme="light"] .filter-tags-input { background: #fff; color: var(--text-main); }
:root[data-theme="light"] code { color: var(--text-main); }
:root[data-theme="light"] [data-sticky-first] .col-sticky { background: var(--bg-main); }

/* ============================================================ */
/*  RESPONSIVE — apply manual collapse at 1024px rather than force */
/* ============================================================ */
@media (max-width: 1024px) {
    .header-search { width: auto; min-width: 220px; }
    .app-sidebar:not(.collapsed) { width: var(--sidebar-width); }
}

/* ============================================================ */
/* CONVERSATIONS VIEW                                            */
/* ============================================================ */
.conv-meta { color: var(--text-muted, #888); font-size: 0.9rem; margin-top: 0.25rem; }

.conv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
    align-items: start;
}

.conv-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.conv-message {
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 12px;
    padding: 1rem 1.25rem;
    background: var(--panel-bg, rgba(255,255,255,0.02));
}
.conv-message.inbound { border-left: 3px solid var(--accent-indigo, #6366F1); }
.conv-message.outbound { border-left: 3px solid var(--accent-emerald, #10B981); }

.conv-message-header {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    flex-wrap: wrap;
}
.conv-who { font-weight: 600; color: var(--text-main); }
.conv-subject { font-weight: 500; margin-top: 0.25rem; }
.conv-body {
    margin: 0.5rem 0 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-main);
    max-height: 400px;
    overflow-y: auto;
}

.conv-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
.conv-panel {
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 12px;
    padding: 1rem 1.25rem;
    background: var(--panel-bg, rgba(255,255,255,0.02));
}
.conv-panel h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }
.conv-panel label { display: block; font-size: 0.8rem; color: var(--text-muted, #888); margin: 0.5rem 0 0.25rem; }
.conv-panel input, .conv-panel textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    background: transparent;
    padding: 0.5rem 0.65rem;
    color: var(--text-main);
    font: inherit;
    resize: vertical;
}
.conv-panel textarea { min-height: 60px; }
.conv-draft-rationale {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin: 0.75rem 0 0;
    font-style: italic;
}
.conv-draft-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.conv-draft-flag { font-size: 0.85rem; color: #F59E0B; }

.conv-insights div { margin-bottom: 0.75rem; }
.conv-insights label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted, #888); }
.conv-insights p { margin: 0.2rem 0 0; }

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    color: var(--accent-indigo, #6366F1);
}
.status-pill.waiting_agent { background: rgba(245,158,11,0.15); color: #F59E0B; }
.status-pill.waiting_customer { background: rgba(16,185,129,0.15); color: var(--accent-emerald, #10B981); }
.status-pill.closed { background: rgba(148,163,184,0.15); color: #94A3B8; }

.empty-row { text-align: center; color: var(--text-muted, #888); padding: 2rem 0; }
.badge.risk { background: rgba(239,68,68,0.15); color: #EF4444; padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.72rem; }
.badge.upsell { background: rgba(16,185,129,0.15); color: var(--accent-emerald, #10B981); padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.72rem; }

@media (max-width: 900px) {
    .conv-layout { grid-template-columns: 1fr; }
    .conv-sidebar { position: static; }
}

/* ── Continuous-improvement feedback widgets ── */

.cs-feedback-thumbs {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.5rem;
}
.cs-feedback-thumb {
    background: transparent;
    border: 1px solid var(--border-soft, rgba(148,163,184,0.25));
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.15s ease;
}
.cs-feedback-thumb:hover { background: rgba(148,163,184,0.12); }
.cs-feedback-thumb.cs-active { background: rgba(16,185,129,0.18); border-color: var(--accent-emerald, #10B981); }
.cs-feedback-thumb.cs-feedback-thumb-down.cs-active { background: rgba(239,68,68,0.18); border-color: #EF4444; }

.cs-feedback-comment {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-soft, rgba(148,163,184,0.25));
    background: var(--surface-2, rgba(15,23,42,0.6));
    color: inherit;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 56px;
}

.cs-feedback-rating {
    display: inline-flex;
    gap: 0.15rem;
    margin-top: 0.5rem;
}
.cs-feedback-star {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(148,163,184,0.5);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.1rem 0.2rem;
}
.cs-feedback-star:hover,
.cs-feedback-star.cs-active { color: #F5C518; }

/* ── AI health card / vocab pending panel ── */

.cs-ai-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.cs-ai-health-stat {
    background: var(--surface-2, rgba(15,23,42,0.6));
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-soft, rgba(148,163,184,0.18));
}
.cs-ai-health-label { font-size: 0.7rem; color: var(--text-muted, #94A3B8); text-transform: uppercase; letter-spacing: 0.05em; }
.cs-ai-health-value { font-size: 1.4rem; font-weight: 600; margin-top: 0.25rem; }
.cs-ai-health-sub   { font-size: 0.7rem; color: var(--text-muted, #94A3B8); margin-top: 0.15rem; }
.cs-ai-health-loading,
.cs-ai-health-error,
.cs-ai-health-empty { padding: 1rem; color: var(--text-muted, #94A3B8); font-size: 0.85rem; }

.cs-vocab-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.cs-vocab-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border-soft, rgba(148,163,184,0.15));
}
.cs-vocab-term { font-weight: 500; }
.cs-vocab-meta { font-size: 0.75rem; color: var(--text-muted, #94A3B8); }
.cs-vocab-actions button {
    margin-left: 0.3rem;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-soft, rgba(148,163,184,0.3));
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.75rem;
}
.cs-vocab-actions button:hover { background: rgba(148,163,184,0.12); }
.cs-vocab-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================ */
/* CONVERSATIONS — HTML body + attachments + reply picker        */
/* ============================================================ */
.conv-html-body {
    width: 100%;
    min-height: 220px;
    max-height: 500px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color-scheme: light;
}

.conv-attachments {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}
.conv-attachments li::before {
    content: "📎 ";
    opacity: 0.7;
}
.conv-attachments a { color: var(--accent-indigo, #6366F1); text-decoration: none; }
.conv-attachments a:hover { text-decoration: underline; }
.muted { color: var(--text-muted, #888); }

.conv-attach-picker {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.25rem 0 0.5rem;
    max-height: 160px;
    overflow-y: auto;
}
.conv-attach-option {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    cursor: pointer;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color, rgba(255,255,255,0.15));
    color: var(--text-main);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent-indigo, #6366F1); }

/* ============================================================ */
/*  LIVE KB ANSWER CARDS — verbatim-from-docs, visually distinct */
/* ============================================================ */
.kb-answers-card { position: relative; }
.kb-answers-card h3 { display: flex; align-items: center; gap: 8px; }
.kb-header-icon { color: var(--color-accent, #7c3aed); display: inline-flex; }

.kb-answer-cards { display: flex; flex-direction: column; gap: 10px; }
.kb-empty { font-size: 13px; color: var(--text-muted, #6b7280); margin: 4px 0; }

.kb-card {
    border: 1px solid var(--border-main, #e5e7eb);
    border-left: 3px solid #7c3aed;
    background: var(--bg-elevated, #fff);
    border-radius: 6px;
    padding: 10px 12px;
    position: relative;
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.kb-card.pinned { border-left-color: #f59e0b; background: #fffaf0; }
.kb-card.fading { opacity: 0.3; }
.kb-card.removing { opacity: 0; transform: translateY(-4px); }

.kb-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 8px; margin-bottom: 4px;
}
.kb-card-title {
    font-size: 12px; font-weight: 600; color: var(--text-main, #111827);
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0;
}
.kb-card-title .kb-doc-icon { flex-shrink: 0; opacity: 0.7; }
.kb-card-title .kb-doc-name {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kb-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.kb-card-actions button {
    border: none; background: transparent; cursor: pointer;
    width: 22px; height: 22px; border-radius: 4px;
    color: var(--text-muted, #6b7280);
    display: inline-flex; align-items: center; justify-content: center;
}
.kb-card-actions button:hover { background: var(--bg-main, #f3f4f6); color: var(--text-main, #111827); }
.kb-card-actions button.pinned { color: #f59e0b; }

.kb-card-snippet {
    font-size: 13px; line-height: 1.45; color: var(--text-main, #111827);
    margin: 0; max-height: 3.2em; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.kb-card.expanded .kb-card-snippet {
    max-height: none; display: block; -webkit-line-clamp: unset;
}

.kb-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 6px; gap: 8px;
}
.kb-confidence-bar {
    flex: 1; height: 4px; background: var(--bg-main, #f3f4f6);
    border-radius: 2px; overflow: hidden;
}
.kb-confidence-fill { height: 100%; background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.kb-card-meta {
    font-size: 11px; color: var(--text-muted, #6b7280);
    white-space: nowrap;
}
.kb-card-meta a { color: inherit; text-decoration: underline; }
.kb-card-meta a:hover { color: var(--color-accent, #7c3aed); }

.kb-history-toggle {
    margin-top: 10px; width: 100%;
    border: 1px dashed var(--border-main, #e5e7eb);
    background: transparent; border-radius: 4px;
    padding: 6px 8px; cursor: pointer;
    font-size: 12px; color: var(--text-muted, #6b7280);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.kb-history-toggle:hover { border-color: #7c3aed; color: #7c3aed; }
.kb-history-toggle .kb-history-chevron { transition: transform 150ms ease; }
.kb-history-toggle[aria-expanded="true"] .kb-history-chevron { transform: rotate(180deg); }
.kb-history-count {
    background: var(--bg-main, #f3f4f6); padding: 1px 6px; border-radius: 10px;
    font-weight: 500;
}
.kb-history-drawer {
    margin-top: 8px; display: flex; flex-direction: column; gap: 8px;
    max-height: 240px; overflow-y: auto;
}
.kb-history-drawer .kb-card { opacity: 0.85; }

/* ============================================================ */
/*  LIVE CUSTOMER BRIEF CARD — replaces the old Caller Info card */
/* ============================================================ */
.customer-brief-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.customer-brief-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.customer-brief-header h3 { margin: 0; }

.customer-status-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-main, #f3f4f6);
    color: var(--text-main, #111827);
    border: 1px solid transparent;
}
.customer-status-badge[data-status="active"]    { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.customer-status-badge[data-status="champion"]  { background: #dcfce7; color: #166534; border-color: #86efac; }
.customer-status-badge[data-status="at_risk"]   { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.customer-status-badge[data-status="churning"]  { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.customer-status-badge[data-status="new"]       { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.customer-status-badge[data-status="dormant"]   { background: #e5e7eb; color: #374151; }

.customer-brief-alerts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cb-alert {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    background: var(--bg-elevated, #fff);
    border-left: 3px solid #7c3aed;
    animation: cbAlertSlideIn 220ms ease-out;
}
.cb-alert[data-kind="churn"]          { border-left-color: #dc2626; background: #fef2f2; }
.cb-alert[data-kind="upsell"]         { border-left-color: #16a34a; background: #f0fdf4; }
.cb-alert[data-kind="escalation"]     { border-left-color: #ea580c; background: #fff7ed; }
.cb-alert[data-kind="advocate"]       { border-left-color: #0ea5e9; background: #f0f9ff; }
.cb-alert[data-kind="sentiment_drop"] { border-left-color: #f59e0b; background: #fffbeb; }
.cb-alert .cb-alert-dismiss {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    padding: 0 0 0 4px;
    font-size: 14px;
    line-height: 1;
}
@keyframes cbAlertSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cb-identity { grid-template-columns: 1fr 1fr; gap: 6px 12px; }

.cb-section {
    border-top: 1px solid var(--border-main, #e5e7eb);
    padding-top: 8px;
}
.cb-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.cb-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.cb-confidence {
    font-size: 10px;
    color: var(--text-muted, #9ca3af);
}
.cb-confidence[data-level="high"]   { color: #15803d; }
.cb-confidence[data-level="medium"] { color: #a16207; }
.cb-confidence[data-level="low"]    { color: #b91c1c; }
.cb-confidence::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 4px;
    vertical-align: 1px;
    opacity: 0.7;
}

.cb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cb-list li {
    font-size: 12px;
    line-height: 1.4;
    padding-left: 10px;
    position: relative;
    color: var(--text-main, #111827);
}
.cb-list li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-muted, #9ca3af);
}
.cb-list .cb-empty {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    font-style: italic;
    padding: 0;
}
.cb-list .cb-empty::before { content: ""; }

.cb-signals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cb-sentiment-mode {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--bg-main, #f3f4f6);
    color: var(--text-muted, #6b7280);
}
.cb-sentiment-mode[data-mode="live"] {
    background: #dcfce7;
    color: #166534;
}
.cb-sentiment-body {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cb-sentiment-score {
    font-size: 20px;
    font-weight: 600;
    min-width: 44px;
    color: var(--text-main, #111827);
}
.cb-sentiment-score[data-tone="positive"] { color: #15803d; }
.cb-sentiment-score[data-tone="negative"] { color: #b91c1c; }
.cb-sentiment-score[data-tone="neutral"]  { color: var(--text-main, #111827); }
.cb-sentiment-body .mini-sparkline { flex: 1; min-width: 0; }

.cb-notes { border-top: 1px solid var(--border-main, #e5e7eb); padding-top: 8px; }
.cb-notes-count {
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-main, #f3f4f6);
    padding: 1px 6px;
    border-radius: 999px;
    color: var(--text-muted, #6b7280);
}
.cb-notes-list {
    list-style: none;
    margin: 0 0 8px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}
.cb-note {
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.4;
}
.cb-note .cb-note-meta {
    display: block;
    font-size: 10px;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 2px;
}
.cb-note[data-reviewed="true"] {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.cb-note-composer { display: flex; flex-direction: column; gap: 4px; }
.cb-note-composer textarea {
    resize: vertical;
    width: 100%;
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.4;
    background: var(--bg-main, #f9fafb);
}
.cb-note-composer textarea:focus {
    outline: none;
    border-color: #7c3aed;
}
.cb-note-actions { display: flex; justify-content: flex-end; }
.cb-note-submit {
    border: none;
    background: #7c3aed;
    color: #fff;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
}
.cb-note-submit:hover       { background: #6d28d9; }
.cb-note-submit:disabled    { background: #c4b5fd; cursor: wait; }

/* ============================================================ */
/*  LINDA INSIGHTS view                                          */
/* ============================================================ */
.linda-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.li-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.li-card-head h3 { margin: 0; }

.li-progress {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
}

.li-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-main, #f3f4f6);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}
.li-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    transition: width 250ms ease-out;
}

.li-check-list {
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.li-check-list li {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main, #111827);
}
.li-check-list li::before {
    content: "○";
    color: var(--text-muted, #9ca3af);
    font-size: 14px;
    line-height: 1;
}
.li-check-list li[data-complete="true"]::before {
    content: "✓";
    color: #16a34a;
}
.li-check-list li[data-complete="true"] {
    color: var(--text-muted, #6b7280);
}

.li-primary-btn, .li-secondary-btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.li-primary-btn {
    background: #7c3aed;
    color: #fff;
}
.li-primary-btn:hover { background: #6d28d9; }
.li-primary-btn:disabled { background: #c4b5fd; cursor: wait; }
.li-secondary-btn {
    background: transparent;
    color: var(--text-main, #111827);
    border-color: var(--border-main, #e5e7eb);
}
.li-secondary-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.li-help {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.li-suggestion-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 520px;
    overflow-y: auto;
}
.li-suggestion {
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    padding: 10px;
    background: var(--bg-elevated, #fff);
}
.li-suggestion-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.li-suggestion-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.li-suggestion-confidence {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
}
.li-suggestion-value {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-main, #111827);
    margin: 4px 0;
    white-space: pre-wrap;
}
.li-suggestion-rationale {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    font-style: italic;
    margin: 0 0 6px 0;
}
.li-suggestion-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.li-suggestion-actions button {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}
.li-suggestion-approve {
    background: #16a34a;
    color: #fff;
}
.li-suggestion-approve:hover { background: #15803d; }
.li-suggestion-reject {
    background: transparent;
    color: var(--text-main, #111827);
    border-color: var(--border-main, #e5e7eb);
}
.li-suggestion-reject:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.li-sample { font-size: 11px; color: var(--text-muted, #6b7280); }
.li-playbook {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.li-playbook-section h4 {
    margin: 0 0 4px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.li-playbook-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.li-playbook-section li {
    font-size: 12px;
    line-height: 1.4;
    padding-left: 10px;
    position: relative;
}
.li-playbook-section li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-muted, #9ca3af);
}
.li-playbook-empty {
    font-size: 12px;
    color: var(--text-muted, #9ca3af);
    font-style: italic;
}

/* ============================================================ */
/*  TENANT SETTINGS panel inside Preferences                     */
/* ============================================================ */
.tenant-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.tenant-settings-status {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
}
.tenant-settings-status[data-state="saved"]  { color: #15803d; }
.tenant-settings-status[data-state="saving"] { color: #7c3aed; }
.tenant-settings-status[data-state="error"]  { color: #b91c1c; }

.feature-flag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 16px 0;
}
.feature-flag-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-main, #e5e7eb);
}
.feature-flag-row:last-child { border-bottom: none; }
.feature-flag-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.feature-flag-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main, #111827);
}
.feature-flag-help {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    line-height: 1.4;
}

.tenant-kv-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.tenant-kv-field { display: flex; flex-direction: column; gap: 4px; }
.tenant-kv-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.tenant-kv-select,
.tenant-kv-input {
    font-size: 13px;
    padding: 6px 8px;
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 4px;
    background: var(--bg-main, #f9fafb);
    font-family: inherit;
}
.tenant-kv-select:focus,
.tenant-kv-input:focus {
    outline: none;
    border-color: #7c3aed;
}

/* ============================================================ */
/*  ONBOARDING INTERVIEW view                                    */
/* ============================================================ */
.onboarding-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    min-height: 500px;
}
.onboarding-sidebar {
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.onboarding-sidebar h3 { margin: 0; font-size: 14px; }

.onboarding-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.onboarding-checklist li {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted, #6b7280);
}
.onboarding-checklist li::before {
    content: "○";
    color: var(--text-muted, #9ca3af);
    font-size: 14px;
    line-height: 1;
}
.onboarding-checklist li[data-state="active"]::before {
    content: "●";
    color: #7c3aed;
}
.onboarding-checklist li[data-state="done"]::before {
    content: "✓";
    color: #16a34a;
}
.onboarding-checklist li[data-state="done"] {
    color: var(--text-main, #111827);
    text-decoration: line-through;
    text-decoration-color: rgba(22, 163, 74, 0.35);
}
.onboarding-checklist li[data-state="active"] {
    color: var(--text-main, #111827);
    font-weight: 500;
}

.onboarding-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.onboarding-help {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    margin: 0;
    line-height: 1.4;
}

.onboarding-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
    min-height: 500px;
}
.onboarding-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}
.ob-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.ob-bubble[data-role="assistant"] {
    align-self: flex-start;
    background: var(--bg-main, #f3f4f6);
    color: var(--text-main, #111827);
    border-bottom-left-radius: 4px;
}
.ob-bubble[data-role="user"] {
    align-self: flex-end;
    background: #7c3aed;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ob-bubble[data-role="assistant"][data-typing="true"] {
    opacity: 0.65;
    font-style: italic;
}
.ob-system {
    align-self: center;
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    font-style: italic;
}
.onboarding-composer {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.onboarding-composer textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
    max-height: 160px;
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    background: var(--bg-main, #f9fafb);
}
.onboarding-composer textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

/* ============================================================ */
/*  LOGIN OVERLAY + role-gated nav                               */
/* ============================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.55);
    z-index: 2000;
    padding: 24px;
}
.login-overlay[hidden] { display: none; }

.login-card {
    background: var(--bg-elevated, #fff);
    border-radius: 10px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-card h2 { margin: 0; font-size: 18px; }
.login-sub {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    line-height: 1.45;
}
.login-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.login-label input {
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-main, #f9fafb);
}
.login-label input:focus {
    outline: none;
    border-color: #7c3aed;
}
.login-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 0;
}
.login-error[hidden] { display: none; }
.login-help {
    margin: 4px 0 0 0;
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    line-height: 1.5;
}
.login-help code {
    font-family: ui-monospace, monospace;
    background: var(--bg-main, #f3f4f6);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Admin-only nav entries hidden for agents. Managers keep workspace nav
   plus their own scorecards; only admins see Integrations + Preferences. */
body[data-user-role="agent"] [data-view="linda-insights"],
body[data-user-role="agent"] [data-view="onboarding"],
body[data-user-role="agent"] [data-view="integrations"],
body[data-user-role="agent"] [data-view="preferences"] {
    display: none;
}
body[data-user-role="manager"] [data-view="onboarding"],
body[data-user-role="manager"] [data-view="integrations"],
body[data-user-role="manager"] [data-view="preferences"] {
    display: none;
}

/* ============================================================ */
/*  ADMIN SURFACES: seat reconciliation, billing, Twilio, email  */
/* ============================================================ */
.seat-reconcile-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.seat-reconcile-banner[hidden] { display: none; }
.seat-banner-copy strong { display: block; font-size: 14px; margin-bottom: 2px; }
.seat-banner-copy p { margin: 0; font-size: 12px; line-height: 1.45; }

.seat-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    padding: 24px;
}
.seat-modal-overlay[hidden] { display: none; }
.seat-modal {
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-elevated, #fff);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.seat-modal-head { display: flex; align-items: center; justify-content: space-between; }
.seat-modal-head h2 { margin: 0; font-size: 18px; }
.seat-modal-close {
    background: transparent; border: none; font-size: 20px;
    cursor: pointer; color: var(--text-muted, #6b7280);
    padding: 0 4px; line-height: 1;
}
.seat-modal-sub { margin: 0; font-size: 13px; color: var(--text-muted, #6b7280); }
.seat-modal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.seat-modal-list li {
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
}
.seat-modal-row-head { display: flex; flex-direction: column; gap: 2px; }
.seat-modal-row-head strong { font-size: 13px; }
.seat-modal-row-head span { font-size: 11px; color: var(--text-muted, #6b7280); }
.seat-modal-actions { display: flex; gap: 6px; align-items: center; }
.seat-modal-actions select {
    font-size: 12px; padding: 4px 6px;
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 4px; background: var(--bg-main, #f9fafb);
}
.seat-modal-foot { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 4px; }

/* Billing panel */
.billing-head { display: flex; align-items: center; justify-content: space-between; }
.billing-tier-pill {
    padding: 2px 10px;
    border-radius: 999px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.billing-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.billing-stripe-field { flex: 1; }
.billing-caps { font-size: 11px; color: var(--text-muted, #6b7280); margin: 6px 0 0 0; }
.billing-status { font-size: 12px; margin-top: 8px; }
.billing-status[data-state="ok"] { color: #15803d; }
.billing-status[data-state="error"] { color: #b91c1c; }

/* Twilio creds form */
.twilio-creds-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
}
.twilio-creds-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.twilio-creds-status { font-size: 12px; color: var(--text-muted, #6b7280); }
.twilio-creds-status[data-state="ok"] { color: #15803d; }
.twilio-creds-status[data-state="error"] { color: #b91c1c; }

/* Follow-up email */
.interaction-actions { display: flex; gap: 8px; margin-left: auto; }
.followup-composer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    padding: 24px;
}
.followup-composer-overlay[hidden] { display: none; }
.followup-composer {
    width: 100%;
    max-width: 600px;
    background: var(--bg-elevated, #fff);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 85vh;
    overflow-y: auto;
}
.followup-head { display: flex; align-items: center; justify-content: space-between; }
.followup-head h2 { margin: 0; font-size: 18px; }
.followup-composer textarea,
.followup-composer input[type=text],
.followup-composer input[type=email] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-main, #e5e7eb);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-main, #f9fafb);
}
.followup-body-field textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.45;
}
.followup-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.followup-status { font-size: 12px; color: var(--text-muted, #6b7280); }
.followup-status[data-state="ok"] { color: #15803d; }
.followup-status[data-state="error"] { color: #b91c1c; }
