/* ═══════════════════════════════════════════════════════════
   OKK NS — Система контроля качества звонков
   Дизайн: тёмная тема, glassmorphism, Inter font
   ═══════════════════════════════════════════════════════════ */

/* ─── Переменные ─── */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1a2744;
    --bg-glass: rgba(22, 33, 62, 0.7);
    --bg-input: rgba(255, 255, 255, 0.05);

    --text-primary: #e8e8f0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --sidebar-width: 240px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

    --transition: 0.2s ease;
}

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    line-height: 1.6;
}

/* ─── Sidebar ─── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    padding: 1rem 0.75rem;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.25rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.nav-links a.active {
    color: var(--accent-hover);
    background: var(--accent-glow);
}

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

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

.user-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-btn {
    display: block;
    text-align: center;
    padding: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    transition: all var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ─── Content ─── */
.content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    flex: 1;
    min-height: 100vh;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.content-full {
    flex: 1;
    min-height: 100vh;
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.badge {
    background: var(--accent-glow);
    color: var(--accent-hover);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ─── Flash Messages ─── */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-error,
.flash-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.flash-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.flash-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* ─── Login ─── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #8b5cf6);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-full {
    width: 100%;
}

/* ─── Filters ─── */
.filters-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filters-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 140px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* ─── Call Cards ─── */
.calls-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.call-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}

.call-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.call-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0;
}

.call-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.call-direction {
    font-size: 0.85rem;
    font-weight: 600;
}

.call-direction.outgoing {
    color: var(--info);
}

.call-direction.incoming {
    color: var(--success);
}

.call-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.call-status {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-answer {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-noanswer {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-cancel {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.call-card-body {
    padding: 0.75rem 1.25rem 1rem;
}

.call-parties {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.call-party {
    display: flex;
    flex-direction: column;
}

.party-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.party-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.call-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.call-duration {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.call-analysis-preview {
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.call-analysis-preview p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.call-audio {
    margin-top: 0.5rem;
}

.call-audio audio {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-xs);
    filter: invert(1) hue-rotate(180deg);
    opacity: 0.7;
}

/* ─── Expandable ─── */
.call-card-expand {
    padding: 0 1.25rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.expand-section {
    margin-top: 1rem;
}

.expand-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.transcription-text,
.analysis-text {
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.expand-meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.expand-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.call-card-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.call-card-toggle:hover {
    color: var(--accent-hover);
    background: var(--bg-input);
}

.call-card-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon {
    transition: transform var(--transition);
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
}

.page-info {
    color: var(--text-muted);
    font-weight: 600;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ─── Dashboard ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Managers ─── */
.managers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

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

.manager-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.manager-phones {
    list-style: none;
}

.manager-phones li {
    padding: 0.3rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.manager-phones li::before {
    content: '📱 ';
}

/* ─── Responsive ─── */
/* ─── Burger Button (mobile only) ─── */
.burger-btn {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.4rem;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1;
}

.burger-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

/* ─── Sidebar Overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.25s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .burger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body {
        overflow-x: hidden;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 3.5rem;
        /* Space for burger */
        max-width: 100vw;
        overflow-x: hidden;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 0;
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .filter-group input[type="date"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        display: block;
        width: 100% !important;
        min-width: 0;
        padding: 0.7rem 1rem;
        min-height: 2.6rem;
    }

    .filters-card {
        max-width: 100%;
        box-sizing: border-box;
    }

    .call-parties {
        flex-wrap: wrap;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .period-buttons {
        flex-wrap: wrap;
    }

    .custom-range-form {
        flex-wrap: wrap;
    }

    .page-header {
        flex-wrap: wrap;
    }

    /* Compact data table on mobile */
    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.4rem;
    }

    .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .expand-icon {
        font-size: 0.7rem;
    }

    .room-buttons-row .data-table {
        font-size: 0.75rem;
    }
}

/* ─── Period Filter Buttons ─── */
.period-filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.period-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.period-btn {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.period-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

.period-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Period buttons inside filters card */
.filters-period-row {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.period-btn-reset {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.4rem 0.55rem;
}

.period-btn-reset:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Custom range form */
.custom-range-form {
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.custom-range-form input[type="date"] {
    width: auto;
    min-width: 140px;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.date-sep {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

/* ─── Clickable Stat Cards ─── */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.stat-card-link:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.stat-card-link .stat-value {
    -webkit-text-fill-color: unset;
    background: none;
    color: var(--text-primary);
}

.stat-card-link:hover .stat-value {
    color: var(--accent-hover);
}

/* ─── Section Titles ─── */
.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ─── Chart Container ─── */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.empty-chart {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

/* ─── Manager Stats Table ─── */
.manager-table-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead th {
    text-align: left;
    padding: 0.65rem 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: var(--bg-input);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.manager-name-cell {
    font-weight: 600;
    color: var(--text-primary) !important;
}

/* ─── Rate Badges ─── */
.rate-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.rate-good {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.rate-mid {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.rate-low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ─── Sortable Table ─── */
.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
    white-space: nowrap;
}

.sortable-th:hover {
    color: var(--accent-hover) !important;
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 0.25rem;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.sortable-th:hover .sort-icon {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   Умный анализ
   ═══════════════════════════════════════════════════════════ */

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.smart-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(20px);
}

.smart-form-card {
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.smart-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.smart-textarea {
    flex: 1;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.smart-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.smart-textarea::placeholder {
    color: var(--text-muted);
}

.smart-submit {
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: fit-content;
}

.smart-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Спиннер в кнопке */
.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.spinner-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.spinner-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Примеры */
.smart-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.examples-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-right: 0.25rem;
}

.example-chip {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: var(--accent-light);
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.example-chip:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Loading */
.smart-loading {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}

.smart-loading-content {
    text-align: center;
}

.loading-pulse {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--accent);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 0 20px rgba(124, 58, 237, 0);
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    }
}

.loading-text {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 500;
}

.loading-subtext {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Ошибка */
.smart-error-card {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
}

/* Параметры */
.smart-params-card {
    border-color: rgba(59, 130, 246, 0.25);
}

.params-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

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

.params-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.params-badge {
    margin-left: auto;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-empty {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.param-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.param-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Результат анализа */
.smart-analysis-card {
    border-color: rgba(16, 185, 129, 0.25);
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

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

.analysis-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.analysis-content {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.92rem;
}

.analysis-content h2,
.analysis-content h3,
.analysis-content h4 {
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem;
}

.analysis-content h2 {
    font-size: 1.15rem;
}

.analysis-content h3 {
    font-size: 1.05rem;
}

.analysis-content h4 {
    font-size: 0.95rem;
}

.analysis-content ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.analysis-content li {
    margin-bottom: 0.35rem;
}

.analysis-content strong {
    color: var(--text-primary);
}

.analysis-content p {
    margin: 0.5rem 0;
}

.analysis-content ol {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

/* Inline audio players */
.inline-player {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.15rem 0;
}

.play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.6rem;
    border: none;
    border-radius: 1rem;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.play-btn:hover {
    background: rgba(16, 185, 129, 0.35);
    transform: scale(1.05);
}

.play-btn:active {
    transform: scale(0.97);
}

.player-info {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
}

.call-ref {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    color: var(--text-secondary, #d1d5db);
}

/* Mobile */
@media (max-width: 768px) {
    .smart-textarea {
        font-size: 16px;
        /* iOS Safari зумит при font-size < 16px */
        padding: 0.75rem;
        min-height: 70px;
    }

    .params-grid {
        grid-template-columns: 1fr 1fr;
    }

    .smart-examples {
        gap: 0.375rem;
    }

    .example-chip {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .inline-player {
        flex-wrap: wrap;
    }

    .player-info {
        white-space: normal;
        font-size: 0.7rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   Карточка звонка (call_detail)
   ═══════════════════════════════════════════════════════════ */

.btn-back {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.detail-meta-card {
    border-color: rgba(99, 102, 241, 0.25);
}

.detail-tech-card {
    opacity: 0.7;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-meta-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-meta-value {
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.detail-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    background: var(--bg-input);
    border-radius: 12px;
}

.detail-text-block {
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}


.detail-card audio {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-xs);
    filter: invert(1) hue-rotate(180deg);
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════
   Список звонков в Умном анализе + кнопка карточки
   ═══════════════════════════════════════════════════════════ */

.calls-list-card {
    border-color: rgba(245, 158, 11, 0.25);
}

.calls-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: opacity var(--transition);
}

.calls-list-header:hover {
    opacity: 0.8;
}

.calls-list-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.calls-list-toggle-icon {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}

.calls-list-toggle-icon.expanded {
    transform: rotate(180deg);
}

.calls-list-body {
    margin-top: 1rem;
}

.calls-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.calls-list-table th {
    text-align: left;
    padding: 0.5rem 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.calls-list-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    vertical-align: middle;
}

.calls-list-table tr:hover td {
    background: var(--bg-input);
}

.calls-list-table tr:last-child td {
    border-bottom: none;
}

.calls-list-table tr.audio-row td {
    padding: 0 0.5rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.calls-list-table tr.audio-row:hover td {
    background: transparent;
}

.call-audio-cell {
    min-width: 250px;
}

.compact-player {
    width: 250px;
    height: 32px;
}

.call-actions-cell {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

/* Кнопка перехода в карточку */
.card-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.2rem 0.5rem;
    border: none;
    border-radius: 1rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.card-link-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
    color: var(--accent-hover);
}

/* Правая часть хедера карточки звонка */
.call-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Иконка-ссылка на карточку в хедере */
.call-card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s;
}

.call-card-link:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: scale(1.1);
}

/* Кнопка транскрипции в карточке звонка */
.transcribe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.transcribe-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: scale(1.1);
}

.transcribe-btn.loading {
    pointer-events: none;
    opacity: 0.6;
    animation: spin 1s linear infinite;
}

.transcribe-btn.done {
    background: rgba(16, 185, 129, 0.25);
}

.transcribe-btn.error {
    background: rgba(239, 68, 68, 0.15);
}

/* Кнопка в детальной карточке — с текстом */
.transcribe-btn-detail {
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.3rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .detail-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .calls-list-table {
        font-size: 0.78rem;
    }

    .calls-list-table th,
    .calls-list-table td {
        padding: 0.4rem 0.3rem;
    }

    .call-actions-cell {
        flex-wrap: wrap;
    }
}

/* Bizon report — room dropdown + tags */
.room-dropdown {
    position: relative;
    display: inline-block;
}

.room-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.room-dropdown-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.room-dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.room-dropdown.open .room-dropdown-arrow {
    transform: rotate(180deg);
}

.room-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    padding: 0.35rem 0;
}

.room-dropdown.open .room-dropdown-menu {
    display: block;
}

.room-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.room-dropdown-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.room-dropdown-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.room-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border-radius: 12px;
    white-space: nowrap;
}

.room-tag-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.room-tag-clear:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

/* ─── Truncate Cell (for long URLs in tables) ─── */
.truncate-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Customers (CDP) ─── */
.customers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.customer-result-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
}

.customer-result-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
    transform: translateY(-1px);
}

.customer-result-card.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.customer-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.customer-id {
    font-weight: 700;
    color: var(--accent-hover);
    font-size: 0.9rem;
}

.customer-first-seen {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.customer-result-contacts {
    margin-bottom: 0.5rem;
}

.contact-line {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.15rem 0;
}

.customer-result-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mini-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-muted);
}

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

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

.customer-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

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

.customer-detail-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.customer-contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.contact-section {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.contact-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.contact-item:last-of-type {
    border-bottom: none;
}

.contact-value {
    font-weight: 500;
    font-size: 0.9rem;
    flex: 1;
}

.contact-source {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-delete {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-icon-delete:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.add-contact-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.add-contact-form input[type="text"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.merge-section {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.merge-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.merge-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.merge-form input[type="number"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
}

.merge-form input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

.related-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.related-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.related-table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-input);
}

.data-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.order-status {
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.order-payed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.order-new {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.order-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.flash-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

/* ─── UTM tree table: compact layout with word-wrap ─── */
.utm-tree-table {
    table-layout: fixed;
    width: 100%;
}

.utm-tree-table td:nth-child(2) {
    word-break: break-all;
    overflow-wrap: break-word;
    font-size: 0.8rem;
    line-height: 1.35;
}

.utm-tree-table td:nth-child(1) {
    width: 30px;
}

/* Copy button inline next to UTM names */
.utm-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.3rem;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.65rem;
    opacity: 0;
    vertical-align: middle;
    transition: all 0.15s;
}

tr:hover .utm-copy-btn {
    opacity: 0.6;
}

.utm-copy-btn:hover {
    opacity: 1 !important;
    border-color: var(--border);
    background: var(--bg-input);
    color: var(--accent-light);
}

.utm-copy-btn.copied {
    opacity: 1 !important;
    color: var(--success);
}

/* Clickable site link */
.utm-site-link {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    transition: color 0.15s, border-color 0.15s;
}

.utm-site-link:hover {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
}

/* ─── Anton Report: Period Dropdown ─── */
.period-dropdown-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.period-dropdown {
    padding: 0.5rem 2rem 0.5rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    min-width: 200px;
}

.period-dropdown:hover {
    border-color: var(--accent);
    background-color: rgba(139, 92, 246, 0.08);
}

.period-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.period-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* ─── Anton Report: Section container (рамка + плашка) ─── */
.report-section {
    position: relative;
    border: 1.5px dashed rgba(99, 102, 241, 0.35);
    border-radius: 16px;
    padding: 2rem 1.2rem 1rem;
    margin-bottom: 1.5rem;
}

.report-section-badge {
    position: absolute;
    top: -0.7rem;
    left: 1.2rem;
    background: var(--bg-primary);
    padding: 0.15rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(99, 102, 241, 0.85);
    border: 1.5px dashed rgba(99, 102, 241, 0.35);
    border-radius: 6px;
}

/* ─── Anton Report: Two-column layout ─── */
.report-two-cols {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .report-two-cols {
        grid-template-columns: 1fr;
    }
}

/* ─── Anton Report: Section Stats ─── */
.report-section-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.report-stat-big {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.report-stat-number {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.report-stat-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.report-stat-small {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.report-stat-small strong {
    color: var(--text-primary);
}

/* ─── Anton Report: Mini Tables ─── */
.report-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.report-mini-table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.report-mini-table thead th:last-child {
    text-align: right;
}

.report-mini-table tbody td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.report-domain-row td {
    padding-top: 0.6rem !important;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.report-badge-count {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: #a78bfa;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.3rem;
}

.outside-note {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.outside-ok {
    color: #16a34a !important;
}

.outside-bad {
    color: #ef4444 !important;
}

.outside-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.outside-source-cell,
.outside-customer-cell,
.outside-order-cell {
    min-width: 120px;
    max-width: 260px;
    overflow-wrap: anywhere;
}

.outside-source-table {
    min-width: 1380px;
    font-size: 0.72rem;
}

.outside-source-table thead th:last-child,
.outside-source-table tbody td:last-child {
    text-align: left;
}

.outside-source-row {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 700;
}

.outside-customer-row {
    background: rgba(255, 255, 255, 0.025);
}

.outside-single-order-row {
    background: rgba(255, 255, 255, 0.035);
}

.outside-order-row {
    background: rgba(0, 0, 0, 0.08);
}

.outside-source-name {
    color: #e0e7ff;
}

.outside-customer-cell {
    padding-left: 1.55rem !important;
}

.outside-order-cell {
    padding-left: 2.55rem !important;
}

.outside-toggle,
.outside-toggle-sub {
    margin-right: 0.35rem;
}

.outside-paid {
    color: #16a34a;
    font-weight: 700;
}

.outside-customer-link {
    color: #f8fafc;
    font-weight: 800;
    text-decoration: none;
}

.outside-customer-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.outside-client-main {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    max-width: 100%;
    white-space: nowrap;
}

.outside-dot {
    color: rgba(255, 255, 255, 0.36);
    font-weight: 500;
}

.outside-order-inline {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
}

.outside-order-link {
    color: #dbeafe;
    font-weight: 700;
    text-decoration: none;
}

.outside-order-link:hover {
    color: #dbeafe;
    text-decoration: underline;
}

.outside-muted {
    margin-top: 0.06rem;
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.45);
}

.outside-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-top: 0.2rem;
    padding: 0.12rem 0.42rem;
    border-radius: 4px;
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.16);
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.outside-pill-inline {
    margin-top: 0;
    margin-left: 0.25rem;
    vertical-align: baseline;
}

.outside-debug {
    margin-top: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.outside-debug summary {
    cursor: pointer;
    color: rgba(129, 140, 248, 0.95);
    font-weight: 700;
}

.report-page-cell {
    padding-left: 1.6rem !important;
    word-break: break-all;
}

.report-page-link {
    color: #818cf8;
    text-decoration: none;
    word-break: break-all;
    transition: color 0.2s;
}

.report-page-link:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.report-count-cell {
    text-align: right !important;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

/* ─── Tilda Table: Horizontal Scroll + Sticky Column ─── */
.tilda-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-card);
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    box-sizing: border-box;
}

.sticky-col-2 {
    position: sticky;
    left: 220px;
    z-index: 2;
    background: var(--bg-card);
    white-space: nowrap;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.25);
}

.report-domain-row .sticky-col {
    background: #1a1f3d;
}

.report-domain-row .sticky-col-2 {
    background: #1a1f3d;
}

thead th.sticky-col,
thead th.sticky-col-2 {
    z-index: 3;
    background: var(--bg-card);
}

/* ─── Sortable Headers ─── */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.sortable-th:hover {
    color: var(--accent-hover);
}

.sortable-th::after {
    content: '';
    display: inline-block;
    width: 0.6em;
    margin-left: 0.2em;
    font-size: 0.6em;
    opacity: 0.3;
}

.sortable-th.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent);
}

.sortable-th.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent);
}

.report-no-data {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    padding: 1rem;
    opacity: 0.7;
}

/* ─── Anton Report: Metrics Grid ─── */
.stats-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 520px) {
    .stats-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stats-grid-5 .stat-card {
    padding: 1rem 1.2rem;
    min-width: 0;
}

.stats-grid-5 .stat-value {
    font-size: 1.35rem;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.stats-grid-5 .stat-label {
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

.stats-grid-5 .stat-icon {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.stat-card-budget {
    background: linear-gradient(135deg, var(--bg-card), rgba(99, 102, 241, 0.08));
    border-color: rgba(99, 102, 241, 0.15);
    position: relative;
    overflow: hidden;
}

.stat-card-budget::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card-budget:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.1);
}

.stat-card-neutral {
    background: var(--bg-card);
    border-color: var(--border);
}

.stat-card-neutral:hover {
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

/* ─── Meta bar под плашками ─── */
.stat-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.4rem 0;
}

.stat-meta-item {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

/* ─── Anton Report: Custom Dropdown ─── */
.ar-dropdown {
    position: relative;
    z-index: 50;
}

.ar-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 1rem 0.45rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 180px;
}

.ar-dropdown__trigger:hover {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.08);
}

.ar-dropdown.open .ar-dropdown__trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.ar-dropdown__label {
    flex: 1;
}

.ar-dropdown__chevron {
    transition: transform 0.25s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.ar-dropdown.open .ar-dropdown__chevron {
    transform: rotate(180deg);
}

/* Menu panel */
.ar-dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.ar-dropdown.open .ar-dropdown__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Section labels */
.ar-dropdown__section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 0.45rem 0.75rem 0.2rem;
}

/* Period items */
.ar-dropdown__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.15s;
}

.ar-dropdown__item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.ar-dropdown__item.active {
    background: var(--accent-glow);
    color: var(--accent-hover);
    font-weight: 600;
}

/* Divider */
.ar-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0.5rem;
}

/* Inline forms (N days, custom range, webinar window) */
.ar-dropdown__inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.75rem 0.5rem;
    flex-wrap: wrap;
}

.ar-dropdown__input {
    text-align: center;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.ar-dropdown__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.ar-dropdown__input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ar-dropdown__apply-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: white;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ar-dropdown__apply-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), #8b5cf6);
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Бейдж окна атрибуции вебинара */
.ar-window-badge {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.2);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: default;
    transition: opacity 0.2s;
}

.ar-window-badge:hover {
    opacity: 0.8;
}

/* ─── ROI positive highlight ─── */
.report-roi-positive {
    color: #16a34a !important;
    font-weight: 700;
}

/* ─── Drill-down rows (campaign → adset → ad) ─── */
.drill-toggle,
.drill-toggle-sub {
    display: inline-block;
    cursor: pointer;
    font-size: 0.6rem;
    color: #818cf8;
    margin-right: 0.3rem;
    transition: transform 0.2s ease, color 0.15s;
    user-select: none;
    vertical-align: middle;
}

.drill-toggle:hover,
.drill-toggle-sub:hover {
    color: #a78bfa;
}

.drill-toggle.open,
.drill-toggle-sub.open {
    transform: rotate(90deg);
}

.drill-row td {
    padding: 0.25rem 0.6rem !important;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.drill-campaign td {
    background: #161930;
}

.drill-campaign .sticky-col,
.drill-campaign .sticky-col-2 {
    background: #161930;
}

.drill-adset td {
    background: #141728;
}

.drill-adset .sticky-col,
.drill-adset .sticky-col-2 {
    background: #141728;
}

.drill-ad td {
    background: #121520;
}

.drill-ad .sticky-col,
.drill-ad .sticky-col-2 {
    background: #121520;
}

.drill-row td.drill-cell-source {
    padding-left: 3.2rem !important;
    word-break: break-word;
    min-width: 200px;
    max-width: 400px;
}

.drill-row td.utm-tree-cell {
    padding-left: calc(3.2rem + var(--utm-depth, 0) * 1.15rem) !important;
}

.utm-tree-label {
    display: flex;
    align-items: flex-start;
    gap: .3rem;
}

.utm-tree-label .source-people-toggle {
    flex: 0 0 22px;
    margin-left: auto;
}

.utm-tree-source,
.utm-tree-states {
    min-width: 0;
    overflow-wrap: anywhere;
}

.utm-tree-source,
.utm-tree-value {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.utm-tree-subtitle {
    color: var(--text-secondary, #9ca3af);
    font-size: .69rem;
    line-height: 1.5;
    margin-top: .25rem;
    overflow-wrap: anywhere;
}

.utm-copy {
    cursor: default;
    border-radius: 3px;
    transition: background-color .18s ease;
}

.utm-copy:hover {
    background-color: #94a3b814;
}

.utm-copy:focus-visible {
    outline: 1px solid #a78bfa;
    outline-offset: 2px;
}

.utm-copy.utm-copy--copied {
    background-color: #34d39935;
}

.utm-copy.utm-copy--failed {
    background-color: #f8717135;
}

.utm-value-tooltip {
    position: fixed;
    z-index: 1500;
    max-width: min(600px, calc(100vw - 16px));
    padding: 8px 12px;
    border: 1px solid #4b506c;
    border-radius: 6px;
    background: #272b41;
    color: #f3f4f6;
    font-size: .78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    pointer-events: none;
    box-shadow: 0 4px 16px #0004;
}

.utm-copy-status {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.utm-copy-clipboard {
    position: fixed;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.utm-tree-toggle,
.utm-tree-spacer {
    flex: 0 0 16px;
    margin-right: .3rem;
}

.utm-tree-toggle {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    line-height: 1.5;
}

.drill-utm-node td,
.drill-utm-node .sticky-col,
.drill-utm-node .sticky-col-2 {
    background: var(--report-tr-hover, #161a29);
}

.google-tree-title {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.google-tree-subtitle {
    margin: .2rem 0 0 calc(16px + .6rem);
    font-size: .68rem;
    color: var(--text-secondary);
}

.google-unattributed-reason {
    color: rgba(255,255,255,.55);
    font-size: .72rem;
}

.drill-google-ad .creative-toggle-btn {
    flex: 0 0 22px;
    margin-left: 0;
}

.google-creative-panel { padding: 1rem; }
.google-creative-caption { margin-bottom: .75rem; white-space: pre-line; }
.google-video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 480px)); gap: 1rem; }
.google-video-card iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; margin-bottom: .4rem; }

.drill-row td.drill-cell-campaign {
    padding-left: 4.2rem !important;
    word-break: break-word;
    min-width: 200px;
    max-width: 400px;
}

.drill-row td.drill-cell-adset {
    padding-left: 5.4rem !important;
    word-break: break-word;
    min-width: 200px;
    max-width: 400px;
}

.drill-row td.drill-cell-ad {
    padding-left: 6.6rem !important;
    word-break: break-word;
    min-width: 200px;
    max-width: 400px;
}

/* ─── Creative Preview Card ─── */
.creative-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 0.4rem;
    padding: 0;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    color: #818cf8;
    cursor: pointer;
    font-size: 0.7rem;
    vertical-align: middle;
    transition: all 0.15s;
    line-height: 1;
}

.creative-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a78bfa;
}

.creative-toggle-btn[aria-expanded="true"] {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(129, 140, 248, 0.65);
    color: #c4b5fd;
}

.drill-detail td {
    background: #0f1118;
    padding: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.drill-detail .sticky-col,
.drill-detail .sticky-col-2 {
    background: #0f1118;
}
/* ─── Detail Panel (pinned on horizontal scroll) ─── */
.detail-panel {
    position: sticky;
    left: 0;
    max-width: 100vw;
    overflow-x: visible;
}

/* ─── Detail Panel Tabs ─── */
.detail-panel__tabs {
    display: flex;
    gap: 0;
    padding: 0 1rem 0 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-panel__tab {
    padding: 0.4rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
}

.detail-panel__tab:hover {
    color: rgba(255, 255, 255, 0.7);
}

.detail-panel__tab--active {
    color: #a78bfa;
    border-bottom-color: #818cf8;
}

/* ─── People Panel ─── */
.people-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    padding: 0.35rem 0.75rem 0.3rem 0.75rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.7);
}

.people-panel__loading,
.people-panel__error {
    padding: 0.55rem 0.75rem;
    font-size: 0.68rem;
}

.people-panel__loading {
    color: rgba(255, 255, 255, 0.55);
}

.people-panel__error {
    color: #f87171;
}

.people-panel__retry {
    margin-left: 0.35rem;
    padding: 0.15rem 0.45rem;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 4px;
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.1);
    font: inherit;
    cursor: pointer;
}

.people-panel__retry:hover {
    background: rgba(248, 113, 113, 0.18);
}

.people-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.people-table {
    table-layout: fixed;
    border-collapse: collapse;
    width: 870px;
    min-width: 870px;
    font-size: 0.66rem;
    margin-bottom: 0.5rem;
}

/* Column widths via colgroup */
.people-table col.col-name      { width: 110px; }
.people-table col.col-first-reg { width: 74px; }
.people-table col.col-days      { width: 36px; }
.people-table col.col-reg       { width: 74px; }
.people-table col.col-web       { width: 48px; }
.people-table col.col-min       { width: 48px; }
.people-table col.col-ord       { width: 52px; }
.people-table col.col-stat      { width: 88px; }
.people-table col.col-rev       { width: 68px; }
.people-table col.col-pay       { width: 52px; }
.people-table col.col-paid      { width: 72px; }
.people-table col.col-calls     { width: 120px; }

.people-table th,
.people-table td {
    padding: 0.16rem 0.22rem;
}

.people-table th {
    text-align: left;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.people-table td {
    color: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Numeric columns stay nowrap (2=first-reg, 3=days, 4=reg-otch, 5=web, 6=min, 7=ord, 9=rev, 10=pay, 11=paid) */
.people-table th:nth-child(2),
.people-table td:nth-child(2),
.people-table th:nth-child(3),
.people-table td:nth-child(3),
.people-table th:nth-child(4),
.people-table td:nth-child(4),
.people-table th:nth-child(5),
.people-table td:nth-child(5),
.people-table th:nth-child(6),
.people-table td:nth-child(6),
.people-table th:nth-child(7),
.people-table td:nth-child(7),
.people-table th:nth-child(9),
.people-table td:nth-child(9),
.people-table th:nth-child(10),
.people-table td:nth-child(10),
.people-table th:nth-child(11),
.people-table td:nth-child(11) {
    white-space: nowrap;
}

/* Name and status can wrap */
.people-table th:first-child,
.people-table td:first-child,
.people-table th:nth-child(8),
.people-table td:nth-child(8) {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.people-table .play-btn {
    cursor: pointer;
    border: none;
    background: none;
    color: #818cf8;
    font-size: 0.7rem;
    padding: 0 2px;
    vertical-align: middle;
}

.people-table th:first-child,
.people-table td:first-child {
    padding-left: 0.75rem;
}

.people-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.people-table th.sortable:hover {
    color: rgba(255, 255, 255, 0.7);
}

.people-table th .sort-arrow {
    font-size: 0.55rem;
    color: #818cf8;
}

.people-table a {
    color: #818cf8;
    text-decoration: none;
}

.people-table a:hover {
    text-decoration: underline;
}

.creative-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 1rem 0.75rem 7rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 900px;
}

.creative-card__thumb {
    flex-shrink: 0;
    width: 280px;
    height: auto;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
}

.creative-card__thumb:hover {
    border-color: rgba(99, 102, 241, 0.4);
    opacity: 0.85;
}

.creative-card__thumb-placeholder {
    flex-shrink: 0;
    width: 280px;
    min-height: 280px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.25);
}

.creative-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.creative-card__title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.3;
}

.creative-card__body {
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
    font-size: 0.72rem;
}

.creative-card__body-more {
    color: #818cf8;
    cursor: pointer;
    font-size: 0.68rem;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
}

.creative-card__body-more:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.creative-card__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.creative-card__cta-badge {
    display: inline-block;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.creative-card__link {
    color: #818cf8;
    text-decoration: none;
    font-size: 0.68rem;
    word-break: break-all;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.creative-card__link:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.creative-card__ad-id {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.25);
    font-family: monospace;
}

.creative-card__load-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.3rem;
    white-space: nowrap;
}

.creative-card__load-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a78bfa;
}

.creative-card__load-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.creative-card__spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: creative-spin 0.6s linear infinite;
}

@keyframes creative-spin {
    to { transform: rotate(360deg); }
}

.creative-card__error {
    color: #ef4444;
    font-size: 0.68rem;
    margin-top: 0.2rem;
}

.creative-card__status {
    color: rgba(255,255,255,0.4);
    font-size: 0.65rem;
    margin-top: 0.25rem;
    font-style: italic;
}

.creative-card__video {
    max-width: 300px;
    max-height: 200px;
    border-radius: 6px;
    margin-top: 0.3rem;
}

.creative-card__video-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #818cf8;
    font-size: 0.7rem;
    text-decoration: none;
    margin-top: 0.3rem;
}

.creative-card__video-link:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.drill-utm-source td {
    background: #181c38;
}

.drill-utm-source .sticky-col,
.drill-utm-source .sticky-col-2 {
    background: #181c38;
}

/* ─── Flex layout: Ad Accounts + GC Regs ─── */
.report-flex-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.report-flex-left {
    flex: 0 0 68%;
    min-width: 0;
}

.report-flex-right {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .report-flex-row {
        flex-direction: column;
    }

    .report-flex-left,
    .report-flex-right {
        flex: 1 1 100%;
    }
}

/* FB placements are an alternative breakdown, independent of advertising arrows. */
.fb-placement-toggle {
    display: inline-flex; align-items: center; gap: .3rem;
    margin: .2rem 0 .1rem .4rem; padding: .2rem .4rem;
    color: #a5b4fc; background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .2); border-radius: 4px;
    font: inherit; font-size: .7rem; cursor: pointer; white-space: nowrap;
}
.fb-placement-toggle.open { background: rgba(99, 102, 241, .22); }
.fb-placement-toggle.open span { transform: rotate(180deg); }
.fb-placement-empty { display: block; margin-top: .15rem; color: var(--text-muted); font-size: .65rem; font-weight: normal; }
.drill-row td.fb-placement-cell { padding-left: calc(4.2rem + var(--fb-depth, 0) * 1.15rem) !important; white-space: normal; }
.fb-placement-label { overflow-wrap: anywhere; color: #a5b4fc; font-size: .75rem; }
.drill-fb-placement .sticky-col, .drill-fb-placement .sticky-col-2 { background: #171a2d; }
.drill-row td.fb-people-cell { width: auto; min-width: 0; max-width: none; }
.creative-toggle-btn:disabled { opacity: .35; cursor: default; }

.fb-hierarchy-toggle { border: 0; padding: 0; background: transparent; font: inherit; }
