/* ========================================================================
   AI Operations Platform — Dashboard Theme
   Dark admin theme with sidebar + main content layout
   ======================================================================== */

/* ----- CSS Custom Properties ----- */
:root {
    --bg-body: #0f0f1a;
    --bg-sidebar: #1a1a2e;
    --bg-card: #16162b;
    --bg-card-hover: #1e1e36;
    --bg-input: #1e1e32;
    --bg-input-focus: #252540;
    --bg-modal-overlay: rgba(0, 0, 0, 0.7);

    --accent: #6366f1;
    --accent-hover: #5558e6;
    --accent-light: rgba(99, 102, 241, 0.15);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.15);

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52525b;

    --border: #27272a;
    --border-light: #2a2a3e;

    --sidebar-width: 250px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 0.9375rem;
}

ul { list-style: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }

/* ========================================================================
   SIDEBAR
   ======================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-close {
    width: 32px;
    height: 32px;
    display: none; /* visible on mobile */
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    transition: background var(--transition);
}
.sidebar-close:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.nav-link.active .nav-icon {
    color: var(--accent);
}

.nav-icon {
    flex-shrink: 0;
    color: var(--text-dim);
    transition: color var(--transition);
}

.nav-link:hover .nav-icon {
    color: var(--text-secondary);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================================================
   MAIN WRAPPER
   ======================================================================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================================================
   TOP HEADER
   ======================================================================== */
.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    transition: background var(--transition);
}
.hamburger:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-logout {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    transition: all var(--transition);
}
.btn-logout:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ========================================================================
   MAIN CONTENT
   ======================================================================== */
.main-content {
    flex: 1;
    padding: 28px 32px 40px;
}

/* ========================================================================
   CARDS
   ======================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

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

.card-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
}

.card-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--accent);
    white-space: nowrap;
}

.card-body {
    padding: 20px 24px 24px;
}

.card-body.p-0 {
    padding: 0;
}

/* ========================================================================
   STAT CARDS
   ======================================================================== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
    transition: all var(--transition);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(1) { border-left-color: var(--accent); }
.stat-card:nth-child(2) { border-left-color: var(--warning); }
.stat-card:nth-child(3) { border-left-color: var(--success); }
.stat-card:nth-child(4) { border-left-color: var(--danger); }

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-calls { background: var(--accent-light); color: var(--accent); }
.stat-icon-tasks { background: var(--warning-light); color: var(--warning); }
.stat-icon-transcripts { background: var(--success-light); color: var(--success); }
.stat-icon-priority { background: var(--danger-light); color: var(--danger); }

.stat-card-body {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -1px;
}

.stat-card-trend {
    font-size: 0.8125rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.trend-up, .trend-down {
    font-weight: 600;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ========================================================================
   DASHBOARD GRID
   ======================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot-success { background: var(--success); }
.activity-dot-warning { background: var(--warning); }
.activity-dot-info { background: var(--info); }
.activity-dot-danger { background: var(--danger); }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
    display: block;
}

/* Schedule Widget */
.schedule-list {
    display: flex;
    flex-direction: column;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.schedule-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.schedule-time {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 52px;
    flex-shrink: 0;
}

.schedule-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

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

.schedule-meta {
    font-size: 0.8125rem;
    color: var(--text-dim);
}

.schedule-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-completed { background: var(--success-light); color: var(--success); }
.status-in-progress { background: var(--accent-light); color: var(--accent); }
.status-scheduled { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* Quick Actions */
.quick-actions-card {
    margin-top: 0;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.quick-action-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.quick-action-btn svg {
    color: var(--text-muted);
    transition: color var(--transition);
}

.quick-action-btn:hover svg {
    color: var(--accent);
}

/* ========================================================================
   FILTERS
   ======================================================================== */
.filters-card .card-body {
    padding-bottom: 16px;
}

.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition);
    outline: none;
}
.search-input::placeholder {
    color: var(--text-dim);
}
.search-input:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.filter-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.filter-group-action {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
    min-width: auto;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input, .filter-select {
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition);
    min-height: 38px;
}
.filter-input:focus, .filter-select:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.filter-select {
    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='%2371717a' 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 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--transition);
}
.filter-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}
.filter-tab.active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.filter-tabs-actions {
    margin-left: auto;
}

/* ========================================================================
   BUTTONS
   ======================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--accent-light);
}

/* ========================================================================
   DATA TABLE
   ======================================================================== */
.table-container {
    overflow-x: auto;
}

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

.data-table thead {
    background: rgba(255,255,255,0.02);
}

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

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

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

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.012);
}
.data-table tbody tr:nth-child(even):hover {
    background: rgba(255,255,255,0.035);
}

.table-row td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-preview {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dim) !important;
}

/* ========================================================================
   BADGES
   ======================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ========================================================================
   PAGINATION
   ======================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.page-btn {
    padding: 8px 16px;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all var(--transition);
    background: transparent;
}
.page-btn:hover:not(:disabled) {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.page-num:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.page-num.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
}

/* ========================================================================
   EMPTY & LOADING STATES
   ======================================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 12px;
}

.empty-state h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-dim);
    max-width: 360px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 16px;
    text-align: center;
}

.loading-state p {
    font-size: 0.875rem;
    color: var(--text-dim);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================================================
   MODAL
   ======================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.25s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 0;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    transition: all var(--transition);
}
.modal-close:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px 24px;
}

/* ========================================================================
   FORMS
   ======================================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    transition: all var(--transition);
}
.form-input::placeholder {
    color: var(--text-dim);
}
.form-input:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-select {
    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='%2371717a' 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 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ========================================================================
   TASKS
   ======================================================================== */
.task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.task-item:last-child {
    border-bottom: none;
}
.task-item:hover {
    background: rgba(255,255,255,0.02);
}
.task-item.task-completed {
    opacity: 0.6;
}

.task-checkbox-label {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}

.task-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-dim);
    border-radius: 6px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-checkbox:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.task-checkbox:checked + .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.task-body {
    flex: 1;
    min-width: 0;
}

.task-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.task-title-done {
    text-decoration: line-through;
    color: var(--text-dim);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: var(--text-dim);
}

.task-assignee, .task-due {
    display: flex;
    align-items: center;
    gap: 5px;
}

.task-delete {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-dim);
    transition: all var(--transition);
    opacity: 0;
}
.task-item:hover .task-delete {
    opacity: 1;
}
.task-delete:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ========================================================================
   TRANSCRIPT MODAL DETAIL
   ======================================================================== */
.transcript-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
}

.meta-row {
    display: flex;
    gap: 8px;
    font-size: 0.875rem;
}

.meta-label {
    color: var(--text-dim);
    font-weight: 500;
    min-width: 70px;
}

.meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

.transcript-full {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transcript-line {
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    line-height: 1.6;
    transition: background var(--transition);
}

.transcript-line:hover {
    background: rgba(255,255,255,0.03);
}

.transcript-line.speaker-agent {
    background: var(--accent-light);
}

.transcript-line.speaker-caller {
    background: rgba(255,255,255,0.02);
}

.transcript-time {
    color: var(--text-dim);
    font-weight: 500;
    margin-right: 6px;
}

.transcript-speaker {
    color: var(--accent);
    font-weight: 600;
    margin-right: 4px;
}

.transcript-text {
    color: var(--text-secondary);
}

/* ========================================================================
   SUMMARY GRID
   ======================================================================== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.summary-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.summary-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.summary-date {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
}

.summary-category {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.summary-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.summary-card-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.summary-card-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.summary-section {
    margin-bottom: 14px;
}

.summary-section h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.summary-section ul {
    list-style: disc;
    padding-left: 20px;
}

.summary-section li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 4px;
}

.action-list li {
    list-style: none;
    padding-left: 0;
    position: relative;
}
.action-list li::before {
    content: '→';
    color: var(--accent);
    margin-right: 8px;
}

.summary-expand-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.8125rem;
}

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

/* ========================================================================
   CHAT INTERFACE
   ======================================================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 56px - 28px - 28px);
    max-height: 800px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-ai {
    align-self: flex-start;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.message-user .message-avatar {
    background: var(--success-light);
    color: var(--success);
}

.message-bubble {
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 14px 18px;
    border: 1px solid var(--border);
}

.message-user .message-bubble {
    background: var(--accent-light);
    border-color: rgba(99,102,241,0.25);
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

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

.message-content p {
    margin-bottom: 8px;
}
.message-content p:last-child {
    margin-bottom: 0;
}

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

.message-content ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 8px;
}
.message-content ul:last-child {
    margin-bottom: 0;
}
.message-content li {
    margin-bottom: 3px;
}

.message-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
}
.message-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

.message-content code {
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--warning);
}

.message-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.8125rem;
}

.message-content th, .message-content td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}

.message-content th {
    background: rgba(255,255,255,0.03);
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 0.6875rem;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    padding: 0 24px 16px;
    align-items: center;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 12px 18px;
    border: 1px solid var(--border);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); background: var(--text-dim); }
    30% { transform: translateY(-8px); background: var(--accent); }
}

/* Suggested Questions */
.suggested-questions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
}

.suggested-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
}

.suggested-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.suggested-chip:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Chat Input */
.chat-input-area {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    background: rgba(0,0,0,0.15);
    border-radius: 0 0 var(--radius) var(--radius);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    transition: all var(--transition);
}
.chat-input::placeholder {
    color: var(--text-dim);
}
.chat-input:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    transition: all var(--transition);
    flex-shrink: 0;
}
.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.chat-input-footer {
    font-size: 0.6875rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 8px;
}

/* ========================================================================
   CHARTS
   ======================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.chart-card .card-body {
    padding: 16px 20px 20px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-container-sm {
    height: 260px;
}

/* ========================================================================
   SCROLLBAR (dark theme)
   ======================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

/* Tablet & below: sidebar collapses */
@media (max-width: 1024px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .top-header {
        padding: 0 16px;
    }

    .main-content {
        padding: 20px 16px 32px;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px 18px;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .filter-row {
        flex-direction: column;
        gap: 12px;
    }

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

    .filter-group-action {
        flex-direction: row;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .transcript-meta {
        grid-template-columns: 1fr;
    }

    .user-name {
        display: none;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .message {
        max-width: 95%;
    }

    .chat-container {
        max-height: 600px;
    }

    .suggested-questions {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 12px 16px;
    }

    .suggested-label {
        display: none;
    }

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

    .chart-container {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
    }

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

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .top-header {
        padding: 0 12px;
    }

    .page-title {
        font-size: 1.0625rem;
    }

    .main-content {
        padding: 16px 12px 24px;
    }

    .modal {
        max-height: 90vh;
        margin: 12px;
    }

    .modal-body {
        padding: 16px 18px 20px;
    }

    .data-table {
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .summary-preview {
        max-width: 120px;
    }

    .task-item {
        padding: 14px 16px;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .chart-container {
        height: 200px;
    }
}

/* ========================================================================
   UTILITY
   ======================================================================== */
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ========================================================================
   Task Description
   ======================================================================== */
.task-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    line-height: 1.4;
    padding-left: 0.1rem;
}

/* ========================================================================
   Trend Neutral Label
   ======================================================================== */
.trend-neutral {
    color: var(--text-muted);
    font-weight: 400;
}

/* ========================================================================
   PIPELINE STATUS
   ======================================================================== */
.pipeline-card {
    margin-bottom: 1.5rem;
}

.pipeline-status-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.pipeline-status-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.pipeline-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.pipeline-online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.pipeline-offline {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.pipeline-status-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pipeline-status-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Progress Bar */
.pipeline-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pipeline-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.pipeline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 4px;
    transition: width 0.6s ease;
}

.pipeline-progress-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Breakdown Grid */
.pipeline-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pipeline-stat {
    text-align: center;
    padding: 0.6rem 0.5rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.pipeline-stat-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.pipeline-stat-lbl {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.pipeline-num-pending { color: var(--warning); }
.pipeline-num-queued { color: #60a5fa; }
.pipeline-num-running { color: var(--accent); }
.pipeline-num-done { color: var(--success); }
.pipeline-num-fail { color: var(--danger); }
.pipeline-num-recent { color: #a78bfa; }

/* Flow Diagram */
.pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 1rem 0.5rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

.pipeline-node {
    text-align: center;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pipeline-node-active {
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.pipeline-node-inactive {
    border-color: var(--danger);
    opacity: 0.65;
}

.pipeline-node-icon {
    font-size: 1.1rem;
}

.pipeline-node-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pipeline-arrow {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .pipeline-flow {
        flex-direction: column;
        gap: 0.3rem;
    }
    .pipeline-arrow {
        transform: rotate(90deg);
    }
}
