/* ================================================================
   SalesCoachAI - Global Stylesheet (Premium Edition)
   ================================================================ */

/* ------------------------------------------------------------------
   1. CSS Variables (Design Tokens)
   ------------------------------------------------------------------ */
:root {
    /* Colours */
    --primary: #0071e3;
    --primary-hover: #0062c7;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0d6efd;

    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --border: #e9ecef;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 25px 60px rgba(0, 0, 0, 0.12);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.25s ease;

    /* Jewel-tone accent family -- deep, saturated "gemstone" hues used
       to colour-code nav items and KPI cards by feature area, instead
       of the flat monochrome grey the UI used everywhere before. */
    --blue-1: #1d4ed8;    --blue-2: #3b82f6;   /* sapphire */
    --violet-1: #7e22ce;  --violet-2: #a855f7; /* amethyst */
    --amber-1: #b45309;   --amber-2: #be123c;  /* amber -> ruby (warning) */
    --emerald-1: #047857; --emerald-2: #10b981; /* emerald */
    --teal-1: #0f766e;    --teal-2: #14b8a6;   /* deep teal */
    --ruby-1: #9f1239;    --ruby-2: #e11d48;   /* ruby */

    /* Theme-aware accent for callout text (e.g. the AI-generated
       customer scenario on the Voice Coach page) -- dark enough on a
       light card, bright enough on a dark one, unlike a single fixed
       hex which only reads well in one theme. */
    --scenario-text: #0f766e;
}

/* ------------------------------------------------------------------
   2. Base & Reset
   ------------------------------------------------------------------ */
* {
    box-sizing: border-box;
}

::selection {
    background: var(--primary);
    color: white;
}

body {
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-hover);
}

/* ------------------------------------------------------------------
   3. Container
   ------------------------------------------------------------------ */
.container {
    max-width: 1400px;
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    margin-right: auto;
    margin-left: auto;
}

/* ------------------------------------------------------------------
   4. Glass Morphism Card
   ------------------------------------------------------------------ */
.glass-card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ------------------------------------------------------------------
   5. Cards
   ------------------------------------------------------------------ */
.card {
    background: var(--card-bg);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}
.card-body {
    padding: 1.5rem;
}
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

/* ------------------------------------------------------------------
   6. Buttons (with ripple effect and scale on hover)
   ------------------------------------------------------------------ */
.btn {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity var(--transition);
}
.btn:hover::after {
    opacity: 1;
}
.btn:hover {
    transform: translateY(-2px) scale(1.02);
}
.btn-primary {
    background: var(--primary);
    border: none;
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-success {
    background: var(--success);
    border: none;
}
.btn-warning {
    background: var(--warning);
    border: none;
    color: #212529;
}
.btn-danger {
    background: var(--danger);
    border: none;
}
.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

/* Focus states for accessibility */
button:focus,
.btn:focus,
input:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.2);
}

/* ------------------------------------------------------------------
   7. Navbar
   ------------------------------------------------------------------ */
.navbar {
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: 0.8rem 1rem;
}

/* ------------------------------------------------------------------
   8. Tables
   ------------------------------------------------------------------ */
.table {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.table th {
    border-top: none;
    font-weight: 600;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------
   9. Progress Bars
   ------------------------------------------------------------------ */
.progress {
    border-radius: 20px;
    height: 10px;
    background: var(--border);
}
.progress-bar {
    transition: width 1.2s ease-in-out;
    border-radius: 20px;
}

/* ------------------------------------------------------------------
   10. Badges
   ------------------------------------------------------------------ */
.badge {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 50px;
    font-weight: 500;
}

/* ------------------------------------------------------------------
   11. Scrollbar
   ------------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: #c8c8c8;
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ------------------------------------------------------------------
   12. Animations
   ------------------------------------------------------------------ */
.fade-up {
    animation: fadeUp 0.6s ease forwards;
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #eee, #f5f5f5, #eee);
    background-size: 200%;
    animation: skeleton 1.2s infinite;
}
@keyframes skeleton {
    0% {
        background-position: 200%;
    }
    100% {
        background-position: -200%;
    }
}

/* Spinner (used in loading overlay) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------
   13. Hero Card (premium gradient + glass effect)
   ------------------------------------------------------------------ */
.hero-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 40%, #eef6ff 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
}
/* Glass variant for hero */
.hero-card.glass {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ------------------------------------------------------------------
   14. Score Ring (with grow animation)
   ------------------------------------------------------------------ */
.score-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: conic-gradient(var(--success) 0% var(--score-percent, 87%), var(--border) var(--score-percent, 87%) 100%);
    position: relative;
    margin: 0 auto;
    animation: growScore 1.3s ease;
}
@keyframes growScore {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
.score-ring-inner {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--success);
}
.score-ring-inner small {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------
   15. Snapshot Cards (with glass effect)
   ------------------------------------------------------------------ */
.snapshot-card {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    border: 1px solid #e0e7ff;
    margin-bottom: 1.5rem;
}
.snapshot-card.glass {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.2rem;
}
.snapshot-item {
    text-align: center;
}
.snapshot-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.snapshot-item .value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ------------------------------------------------------------------
   16. Executive Summary Bullets
   ------------------------------------------------------------------ */
.executive-bullets {
    background: #f8fafc;
    border-radius: 20px;
    padding: 1.5rem 2rem;
    border-left: 6px solid var(--primary);
    margin-bottom: 1.5rem;
}
.executive-bullets .bullet {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.executive-bullets .bullet:last-child {
    margin-bottom: 0;
}
.executive-bullets .bullet-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

/* ------------------------------------------------------------------
   17. Skill Rows
   ------------------------------------------------------------------ */
.skill-row {
    margin-bottom: 1.5rem;
}
.skill-row .progress {
    height: 10px;
    border-radius: 8px;
    background: var(--border);
}
.skill-row .progress-bar {
    border-radius: 8px;
}

/* Status badges – modern flat colours */
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    white-space: nowrap;
    color: white;
}
.status-excellent {
    background: #16a34a;
}
.status-good {
    background: #3b82f6;
}
.status-average {
    background: #f59e0b;
}
.status-needs {
    background: #ef4444;
}

/* ------------------------------------------------------------------
   18. Strength & Opportunity Cards
   ------------------------------------------------------------------ */
.strength-card {
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    border-left: 4px solid var(--success);
}
.strength-card.green {
    background: #f0fdf4;
    border-left-color: #22c55e;
}
.strength-card.blue {
    background: #eff6ff;
    border-left-color: #2563eb;
}
.strength-card.purple {
    background: #faf5ff;
    border-left-color: #a855f7;
}

.opportunity-card {
    background: #fffbeb;
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #f59e0b;
}
.opportunity-card .impact {
    color: #92400e;
    font-weight: 600;
}
.opportunity-card .rec {
    color: var(--text);
}
.opportunity-card .result {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------
   19. Coach Verdict
   ------------------------------------------------------------------ */
.coach-verdict {
    background: #eff6ff;
    border-left: 6px solid #2563eb;
    border-radius: 20px;
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
}
.coach-verdict .verdict-text {
    font-size: 1.25rem;
    line-height: 1.6;
    font-weight: 400;
    color: #1e293b;
}
.coach-verdict .divider {
    border: 0;
    border-top: 1px solid #dbeafe;
    margin: 1.2rem 0;
}

/* ------------------------------------------------------------------
   20. Vertical Timeline
   ------------------------------------------------------------------ */
.timeline-vertical {
    list-style: none;
    padding: 0;
    position: relative;
}
.timeline-vertical::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: var(--border);
}
.timeline-vertical li {
    padding-left: 48px;
    position: relative;
    padding-bottom: 1.8rem;
}
.timeline-vertical li:last-child {
    padding-bottom: 0;
}
.timeline-vertical li .timeline-icon {
    position: absolute;
    left: 8px;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--border);
}
.timeline-vertical li.completed .timeline-icon {
    background: var(--success);
}
.timeline-vertical li.in-progress .timeline-icon {
    background: var(--warning);
}
.timeline-vertical li.pending .timeline-icon {
    background: var(--danger);
}

/* ------------------------------------------------------------------
   21. Script Block
   ------------------------------------------------------------------ */
.script-block {
    background: #1e1e2f;
    color: #cdd6f4;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    white-space: pre-wrap;
    border-left: 4px solid #89b4fa;
    position: relative;
}
.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}
.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------------------
   22. Transcript Bubbles (with hover effect)
   ------------------------------------------------------------------ */
.transcript-bubble {
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    margin-bottom: 0.6rem;
    max-width: 85%;
    word-wrap: break-word;
    transition: transform var(--transition);
}
.transcript-bubble:hover {
    transform: translateX(4px);
}
.bubble-customer {
    background: var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text);
}
.bubble-sales {
    background: #dbeafe;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    color: #004de6;
}
.transcript-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Search highlight */
.search-highlight {
    background: #ffeb3b;
    padding: 0 2px;
    border-radius: 2px;
}
.transcript-bubble.highlight {
    border-left: 3px solid var(--primary);
}

/* ------------------------------------------------------------------
   23. Analytics Grid
   ------------------------------------------------------------------ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.analytics-item {
    background: #fff;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.analytics-item .number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}
.analytics-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------
   24. Action Cards (Manager Action Required)
   ------------------------------------------------------------------ */
.action-card {
    border-radius: 20px;
    padding: 1.2rem 2rem;
    border-left: 6px solid;
    margin-bottom: 1.5rem;
}
.action-urgent {
    background: #fef2f2;
    border-color: var(--danger);
}
.action-soon {
    background: #fffbeb;
    border-color: var(--warning);
}
.action-none {
    background: #f0fdf4;
    border-color: var(--success);
}

/* ------------------------------------------------------------------
   25. Summary Card (with glass effect)
   ------------------------------------------------------------------ */
.summary-card {
    background: linear-gradient(135deg, #ffffff, #fafafa);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}
.summary-card.glass {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.2rem;
}

/* ------------------------------------------------------------------
   26. Conversation Badge
   ------------------------------------------------------------------ */
.conversation-badge {
    font-size: 0.75rem;
    background: var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.conversation-badge i {
    font-size: 0.8rem;
}

/* ------------------------------------------------------------------
   27. Manager Meta
   ------------------------------------------------------------------ */
.manager-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ------------------------------------------------------------------
   28. Insight Cards (Quick Stats)
   ------------------------------------------------------------------ */
.insight-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.insight-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

/* ------------------------------------------------------------------
   29. Sticky Action Bar (for report actions)
   ------------------------------------------------------------------ */
.report-actions {
    position: sticky;
    top: 15px;
    z-index: 20;
}

/* ------------------------------------------------------------------
   30. Toast Notifications
   ------------------------------------------------------------------ */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    background: var(--primary);
    color: white;
}
.toast-notification.show {
    opacity: 1;
}
.toast-notification.toast-success {
    background: var(--success);
    color: white;
}
.toast-notification.toast-warning {
    background: var(--warning);
    color: #212529;
}
.toast-notification.toast-danger {
    background: var(--danger);
    color: white;
}
.toast-notification.toast-info {
    background: var(--primary);
    color: white;
}

/* ------------------------------------------------------------------
   31. Loading Overlay
   ------------------------------------------------------------------ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.loading-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-message {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ------------------------------------------------------------------
   32. Responsive
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .hero-card {
        padding: 1.5rem;
    }
    .score-ring {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }
    .score-ring-inner {
        width: 75px;
        height: 75px;
    }
    .coach-verdict {
        padding: 1.5rem;
    }
    .coach-verdict .verdict-text {
        font-size: 1rem;
    }
    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .snapshot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ------------------------------------------------------------------
   33. Print Mode
   ------------------------------------------------------------------ */
@media print {
    .navbar,
    .btn,
    .sidebar,
    .report-actions,
    .copy-btn {
        display: none !important;
    }
    body {
        background: white;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    .hero-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    .glass-card {
        backdrop-filter: none !important;
        background: white !important;
        border: 1px solid #ddd !important;
    }
    .script-block {
        background: #f5f5f5 !important;
        color: #333 !important;
        border-left-color: #666 !important;
    }
}

/* ------------------------------------------------------------------
   34. Dark Mode -- automatic, follows the OS/browser preference,
   site-wide (previously a manual-only toggle scoped to one page).
   The old toggle button on report_detail.html still runs its JS
   harmlessly but no longer does anything -- dark mode is automatic
   there too now.
   ------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111;
        --card-bg: #1f1f1f;
        --text: #f5f5f7;
        --text-muted: #a0a0a5;
        --border: #2c2c2e;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
        --shadow-hover: 0 25px 60px rgba(0, 0, 0, 0.6);

        /* Bootstrap 5.3 ships its own colour variables that only switch
           via a `data-bs-theme="dark"` attribute we never set. Without
           overriding them here, every Bootstrap utility class that isn't
           re-styled above (.text-muted, .text-secondary, .border, table
           stripes, etc.) stays pinned to its light-mode colour and turns
           unreadable against our dark backgrounds. */
        color-scheme: dark;
        --bs-body-color: #f5f5f7;
        --bs-body-color-rgb: 245, 245, 247;
        --bs-body-bg: #111;
        --bs-emphasis-color: #fff;
        --bs-heading-color: inherit;
        --bs-secondary-color: rgba(245, 245, 247, 0.75);
        --bs-secondary-color-rgb: 245, 245, 247;
        --bs-secondary-bg: #2c2c2e;
        --bs-tertiary-color: rgba(245, 245, 247, 0.5);
        --bs-tertiary-color-rgb: 245, 245, 247;
        --bs-tertiary-bg: #1f1f1f;
        --bs-border-color: #3a3a3c;
        --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
        --bs-link-color: #4a9eff;
        --bs-link-hover-color: #7ab8ff;
        --bs-link-color-rgb: 74, 158, 255;
        --bs-link-hover-color-rgb: 122, 184, 255;

        --scenario-text: #5eead4;
    }

html {
    body {
        background: var(--bg);
        color: var(--text);
    }

    .card {
        background: var(--card-bg);
    }

    .hero-card {
        background: linear-gradient(135deg, #1f1f1f 0%, #2a2a3a 40%, #1a1a3a 100%);
    }

    .glass-card,
    .hero-card.glass,
    .snapshot-card.glass,
    .summary-card.glass {
        background: rgba(30, 30, 40, 0.8);
        border-color: rgba(255, 255, 255, 0.08);
    }

    .snapshot-card {
        background: linear-gradient(135deg, #1a1a2e, #1f1f3a);
        border-color: #2a2a4a;
    }

    .executive-bullets {
        background: #1a1a2e;
        border-left-color: #4a7aff;
    }

    .coach-verdict {
        background: #1a1a2e;
        border-left-color: #4a7aff;
    }
    .coach-verdict .verdict-text {
        color: #e0e0e6;
    }
    .coach-verdict .divider {
        border-color: #2a2a4a;
    }

    .strength-card.green {
        background: #0f1f0f;
        border-left-color: #22c55e;
    }
    .strength-card.blue {
        background: #0f1a2f;
        border-left-color: #4a8aff;
    }
    .strength-card.purple {
        background: #1a0f2f;
        border-left-color: #a855f7;
    }

    .opportunity-card {
        background: #1f1a0f;
        border-left-color: #f59e0b;
    }

    .analytics-item {
        background: #1f1f1f;
        border-color: #2a2a2a;
    }

    .transcript-bubble.bubble-customer {
        background: #2a2a2a;
        color: #e0e0e6;
    }
    .transcript-bubble.bubble-sales {
        background: #1a2a4a;
        color: #8ab4ff;
    }

    .script-block {
        background: #0d0d1a;
        border-left-color: #4a8aff;
    }

    .btn-outline-secondary {
        border-color: #4a4a4a;
        color: #c0c0c0;
    }
    .btn-outline-secondary:hover {
        background: #4a4a4a;
        color: #fff;
    }

    .conversation-badge {
        background: #2a2a2a;
        color: #a0a0a5;
    }

    .insight-card {
        background: #1f1f1f;
        border-color: #2a2a2a;
    }

    .action-urgent {
        background: #1f0f0f;
        border-color: var(--danger);
    }
    .action-soon {
        background: #1f1a0f;
        border-color: var(--warning);
    }
    .action-none {
        background: #0f1f0f;
        border-color: var(--success);
    }

    .summary-card {
        background: #1a1a1a;
        border-color: #2a2a2a;
    }

    ::-webkit-scrollbar-track {
        background: #1a1a1a;
    }
    ::-webkit-scrollbar-thumb {
        background: #4a4a4a;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: #5a5a5a;
    }

    .skeleton {
        background: linear-gradient(90deg, #1a1a1a, #2a2a2a, #1a1a1a);
        background-size: 200%;
    }

    .toast-notification {
        background: #2a2a2a;
        color: #f5f5f7;
    }
    .toast-notification.toast-success {
        background: #1a5a2a;
        color: white;
    }
    .toast-notification.toast-warning {
        background: #5a4a1a;
        color: #f5f5f7;
    }
    .toast-notification.toast-danger {
        background: #5a1a1a;
        color: white;
    }
    .toast-notification.toast-info {
        background: #1a2a5a;
        color: white;
    }

    .loading-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

    /* Bootstrap's .bg-white / .bg-light utilities are !important and
       fixed-light regardless of theme. Left alone, any card-header,
       badge or content panel using them (across templates written
       before dark mode existed) ends up with light-in-dark-mode text
       stranded on a background that never goes dark -- invisible.
       Neutralize them here UNLESS paired with .text-dark, which means
       the light background is a deliberate, self-contained pill/box
       (e.g. `badge bg-light text-dark`) and is left as-is. */
    .bg-white:not(.text-dark),
    .bg-light:not(.text-dark) {
        background-color: var(--card-bg) !important;
    }

    /* The inverse case: .text-dark used on plain text/icons with no
       background utility of its own (relying on a parent container
       for backing) rather than paired with one on the SAME element.
       Once that parent correctly goes dark, this text is invisible
       dark-on-dark. Neutralize it UNLESS the element also carries a
       bg-* utility itself (bg-warning, bg-info-subtle, bg-light, ...),
       which means it's a self-contained badge/chip that already
       supplies its own permanently-light backing. */
    .text-dark:not([class*="bg-"]) {
        color: var(--text) !important;
    }
}

/* =========================================
   KPI CARDS
========================================= */

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Gradient icon chip + coloured bottom accent, applied to a stat card
   via an `accent-*` modifier class so each KPI reads as its own
   feature area at a glance instead of a flat grey/white tile. */
.kpi-icon-chip {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex: none;
    background: var(--grad);
    box-shadow: 0 6px 16px -4px var(--glow);
}

.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--grad);
}

.stat-card.accent-blue    { --grad: linear-gradient(135deg, var(--blue-1), var(--blue-2));       --glow: rgba(59, 130, 246, 0.4); }
.stat-card.accent-violet  { --grad: linear-gradient(135deg, var(--violet-1), var(--violet-2));   --glow: rgba(168, 85, 247, 0.4); }
.stat-card.accent-amber   { --grad: linear-gradient(135deg, var(--amber-1), var(--amber-2));     --glow: rgba(190, 18, 60, 0.4); }
.stat-card.accent-emerald { --grad: linear-gradient(135deg, var(--emerald-1), var(--emerald-2)); --glow: rgba(16, 185, 129, 0.4); }
.stat-card.accent-teal    { --grad: linear-gradient(135deg, var(--teal-1), var(--teal-2));       --glow: rgba(20, 184, 166, 0.4); }

.stat-card.accent-blue .text-primary    { color: var(--blue-1) !important; }
.stat-card.accent-amber .text-danger    { color: var(--amber-2) !important; }
.stat-card.accent-emerald .text-success { color: var(--emerald-1) !important; }
.stat-card.accent-teal .text-primary    { color: var(--teal-2) !important; }

.card.bg-primary-subtle,
.card.bg-success-subtle,
.card.bg-warning-subtle,
.card.bg-info-subtle {
    border: 1px solid rgba(255,255,255,0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card.bg-primary-subtle:hover,
.card.bg-success-subtle:hover,
.card.bg-warning-subtle:hover,
.card.bg-info-subtle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12) !important;
}

/* AI-generated callout text (e.g. the customer scenario on the Voice
   Coach page) -- a distinct accent instead of default body colour, so
   it reads as the one thing the advisor needs to act on. */
.scenario-text {
    color: var(--scenario-text);
    font-weight: 500;
}
.scenario-text strong { color: var(--text); }

/* =========================================
   LAYOUT SPACING
========================================= */

/* Reduce large gap below the dual navigation */
.main-content {
    padding-top: 1.5rem !important;
}

/* Make AI + CRM navigation blocks tighter */
.app-nav-section {
    margin-bottom: 0.75rem;
}

/* Reduce top gap below sticky header */
.page-content {
    padding-top: 1.25rem !important;
}


/* =========================================
   DASHBOARD PAGE (admin)
========================================= */

.dashboard-page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
}

.dashboard-page h1,
.dashboard-page h2 {
    margin-top: 0;
    letter-spacing: -0.02em;
}

.dashboard-page .card {
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-page .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

/* Cards opt into a dark header explicitly (bg-dark text-white),
   never forced globally -- keeps plain white-header cards clean. */

.dashboard-page canvas {
    max-width: 100%;
}

/* =========================================
   STAT / KPI CARDS
========================================= */

.stat-card {
    border-radius: 18px;
    transition: transform 0.25s ease,
                box-shadow 0.25s ease,
                border-color 0.25s ease;
    border: 1px solid rgba(15, 23, 42, 0.05);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12) !important;
    border-color: rgba(0, 113, 227, 0.15);
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card h6 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.stat-card h2 {
    font-size: 2rem;
    line-height: 1;
}

.stat-card i {
    font-size: 2rem;
    opacity: 0.9;
}

/* A red/ruby stat-card accent was never defined alongside blue/violet/
   amber/emerald/teal, even though --ruby-1/--ruby-2 tokens exist --
   needed for "Absent" style counts across the app. */
.stat-card.accent-ruby { --grad: linear-gradient(135deg, var(--ruby-1), var(--ruby-2)); --glow: rgba(225, 29, 72, 0.4); }
.stat-card.accent-ruby .text-danger { color: var(--ruby-1) !important; }

/* =========================================
   ATTENDANCE -- shared icon-forward sub-nav pills
   (templates/attendance/_tabs.html, and any page with its own local
   nav row, e.g. team.html's manager-scoped links)
========================================= */
/* Every tab stays visible at once (wraps to as many rows as it
   needs) rather than hiding most of them behind a horizontal swipe --
   so the container is a plain rounded card, not a capsule. A capsule
   radius (border-radius: 100px) only ever looks right wrapped around
   a single row; at that radius, wrapping onto a second row (a
   mid-size window, a phone turned landscape) stretched the same
   curve around two rows into a lopsided blob instead. A modest,
   ordinary card radius looks right regardless of how many rows the
   tabs wrap onto. */
/* Grid, not flex-wrap -- flex-wrap packs each row greedily by
   whatever pixel width happens to fit, so rows end up an uneven mix
   of one/two items with no shared left edge from row to row. A grid
   with a fixed column width instead gives every column a consistent
   start position regardless of any one label's length, so the whole
   block reads as aligned columns rather than a ragged list. */
.atd-tabs {
    padding: 5px; background: rgba(15, 23, 42, 0.04); border-radius: 16px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, max-content));
    justify-items: start; gap: 4px;
}
.atd-tab {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
    text-decoration: none; padding: 8px 16px; border-radius: 100px;
    white-space: nowrap; transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.atd-tab i { font-size: 0.78rem; opacity: 0.85; }
.atd-tab:hover { color: var(--text); background: rgba(15, 23, 42, 0.05); }
.atd-tab.active {
    color: #fff; background: linear-gradient(135deg, var(--blue-1), var(--blue-2));
    box-shadow: 0 6px 16px -4px rgba(59, 130, 246, 0.5);
}
.atd-tab-warning.active { background: linear-gradient(135deg, #b45309, #d97706); box-shadow: 0 6px 16px -4px rgba(217, 119, 6, 0.5); }
.atd-tab-danger.active { background: linear-gradient(135deg, var(--ruby-1), var(--ruby-2)); box-shadow: 0 6px 16px -4px rgba(225, 29, 72, 0.5); }
.atd-tab-success.active { background: linear-gradient(135deg, var(--emerald-1), var(--emerald-2)); box-shadow: 0 6px 16px -4px rgba(16, 185, 129, 0.5); }
@media (max-width: 991.98px) {
    /* Pills would otherwise shrink to fit the narrower viewport
       instead of keeping their natural width and just scrolling. */
    .atd-tab { flex: none; }
}

/* Page-header icon chip -- every attendance page's <h1> gets one of
   these, colour set per-page via an inline background (each page is
   its own "feature area" in the jewel-tone system). */
.atd-hero-icon {
    width: 52px; height: 52px; border-radius: 16px;
    background: linear-gradient(135deg, var(--blue-1), var(--blue-2));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; box-shadow: 0 8px 20px -6px rgba(59,130,246,0.5); flex: none;
}

/* Clickable KPI/filter tiles -- Team Attendance, Attendance Today (and
   any other "who's in what state" summary row): a gradient icon chip,
   a coloured bottom accent, and a ring when that filter is active. */
.atd-team-kpi { position: relative; overflow: hidden; text-decoration: none; display: block; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.atd-team-kpi:hover { transform: translateY(-4px); box-shadow: 0 14px 30px -10px rgba(15,23,42,0.25) !important; }
.atd-team-kpi.is-active { border-color: transparent !important; box-shadow: 0 0 0 2px var(--kpi-c, var(--blue-2)) inset, 0 10px 24px -8px rgba(0,0,0,0.15) !important; }
.atd-team-kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--kpi-c, transparent); }
.atd-team-kpi .atd-kpi-icon {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #fff;
    background: var(--kpi-c, #64748b); box-shadow: 0 6px 14px -4px var(--kpi-c, transparent);
}
.atd-team-kpi .num { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.atd-team-kpi .lbl { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-top: 2px; }

/* Colour-accented review/list sections (Approvals' six categories,
   and any other page listing "items with a reason attached") -- a
   coloured left rail + icon chip make each category scannable, and
   the empty state reads as a reassurance ("nothing pending") rather
   than a blank "no results" default. */
.atd-approval-card { position: relative; overflow: hidden; border: 1px solid rgba(15,23,42,0.05); }
.atd-approval-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ac); }
.atd-approval-icon {
    width: 34px; height: 34px; border-radius: 10px; background: var(--ac); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex: none;
    box-shadow: 0 4px 10px -3px var(--ac);
}
.atd-count-badge { background: rgba(15,23,42,0.06); color: var(--text-muted); font-weight: 700; }
.atd-empty-state {
    display: flex; align-items: center; gap: 0.6rem; color: var(--emerald-1);
    background: rgba(16,185,129,0.07); padding: 0.85rem 1rem; border-radius: 12px;
    font-weight: 600; font-size: 0.88rem;
}
.atd-review-row { border: 1px solid rgba(15,23,42,0.06); border-radius: 14px; padding: 0.9rem; transition: background .15s ease; }
.atd-review-row:hover { background: rgba(15,23,42,0.02); }