/* CSS Variables for Theme */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-bg: #1e293b;
    --darker-bg: #0f172a;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --sidebar-width: min(25vw, 370px);
    --header-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: clip;                 /* prevent horizontal scroll without creating a scroll context (preserves descendant position:sticky) */
}

a { color: var(--primary-color); }
a:hover { color: var(--primary-dark); }

.sidebar a:hover { color: white; }

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary-light);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;           /* required for overflow-y to engage in a flex child */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    /* Dark, thin scrollbar — matches sidebar theme */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(99, 102, 241, 0.25);
    color: white;
    border-left-color: rgba(99, 102, 241, 0.6);
}

.nav-item.active {
    background-color: rgba(79, 70, 229, 0.2);
    color: white;
    border-left-color: var(--primary-light);
}

.nav-item i {
    font-size: 18px;
    width: 24px;
}

/* === SIDEBAR QUICK CASES === */

.sidebar-cases-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
}

.sidebar-cases-header {
    padding: 8px 20px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
}

.sidebar-cases-header i {
    color: var(--sidebar-accent, #6366f1);
    font-size: 12px;
}

.sidebar-cases-table {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.sidebar-cases-table::-webkit-scrollbar { width: 4px; }
.sidebar-cases-table::-webkit-scrollbar-track { background: transparent; }
.sidebar-cases-table::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.5);
    border-radius: 2px;
}

/* Compact table inside sidebar */
.sc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    background: transparent;
    table-layout: fixed;
}

.sc-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

.sc-table th {
    background: rgba(10,15,30,0.97);
    color: rgba(255,255,255,0.6);
    padding: 5px 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid rgba(99,102,241,0.3);
    white-space: nowrap;
    overflow: hidden;
}

/* Fixed widths — badge cols tight, PC Name gets remaining space */
.sc-table th:nth-child(1) { width: 28px; text-align: center; }  /* Comm */
.sc-table th:nth-child(2) { width: 28px; text-align: center; }  /* Fault */
.sc-table th:nth-child(3) { width: auto; }                       /* PC Name */
.sc-table th:nth-child(4) { width: 26px; text-align: center; }  /* Inher */
.sc-table th:nth-child(5) { width: 24px; text-align: center; }  /* Injury */
.sc-table th:nth-child(6) { width: 30px; text-align: center; }  /* Calls */

.sc-table td:nth-child(1),
.sc-table td:nth-child(2),
.sc-table td:nth-child(4),
.sc-table td:nth-child(5),
.sc-table td:nth-child(6) {
    text-align: center;
    padding: 4px 2px;
}

.sc-table td {
    padding: 5px 4px;
    color: rgba(255,255,255,0.8);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-color: transparent !important;
}

.sc-case-row {
    cursor: pointer;
    transition: background 0.15s;
}

.sc-case-row:hover {
    background: rgba(99,102,241,0.45) !important;
}

.sc-case-row:hover td {
    color: #fff !important;
}

.sc-case-row:hover span {
    opacity: 1;
}

.sc-case-row.multi-victim {
    background: rgba(59,130,246,0.06);
    border-left: 2px solid rgba(59,130,246,0.35);
}

.sc-case-row.multi-victim:hover {
    background: rgba(99,102,241,0.45) !important;
}

.sc-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0; /* required for text-overflow in table cells */
}

.sc-muted { color: rgba(255,255,255,0.4) !important; }

.sc-num {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
}

/* Comm / Fault / Inher / Injury badges — all share same base style */
.sc-comm-badge, .sc-fault-badge, .sc-inher-badge, .sc-inj-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 800;
    padding: 1px 3px;
    border-radius: 2px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.sc-comm-cc { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.sc-comm-cu { background: rgba(245,158,11,0.2); color: #fcd34d; }
.sc-comm-nc { background: rgba(239,68,68,0.2);  color: #fca5a5; }

.sc-fault-nf  { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.sc-fault-pf  { background: rgba(245,158,11,0.2); color: #fcd34d; }
.sc-fault-ud  { background: rgba(156,163,175,0.2); color: #d1d5db; }
.sc-fault-oth { background: rgba(99,102,241,0.2); color: #c7d2fe; }

.sc-inher-k  { background: rgba(16,185,129,0.2);  color: #6ee7b7; }
.sc-inher-l  { background: rgba(99,102,241,0.2);  color: #c7d2fe; }
.sc-inher-p  { background: rgba(245,158,11,0.2);  color: #fcd34d; }
.sc-inher-ud { background: rgba(156,163,175,0.2); color: #d1d5db; }
.sc-inher-o  { background: rgba(239,68,68,0.15);  color: #fca5a5; }

.sc-inj-d { background: rgba(239,68,68,0.25);   color: #fca5a5; }
.sc-inj-c { background: rgba(245,158,11,0.25);  color: #fcd34d; }
.sc-inj-o { background: rgba(156,163,175,0.2);  color: #d1d5db; }

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 auto;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-avatar.small {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content (base — extended in Laravel App Additions section below) */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
    overflow-x: clip;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

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

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.notifications {
    position: relative;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Content Area */
.content-area {
    padding: 32px;
}

.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card-primary { border-left-color: var(--primary-color); }
.stat-card-success { border-left-color: var(--success-color); }
.stat-card-warning { border-left-color: var(--warning-color); }
.stat-card-info { border-left-color: var(--info-color); }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    color: var(--primary-color);
}

.stat-card-success .stat-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: var(--success-color);
}

.stat-card-warning .stat-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    color: var(--warning-color);
}

.stat-card-info .stat-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: var(--info-color);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

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

.data-table thead tr {
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tr:hover {
    background-color: var(--light-bg);
}

/* ===== Buttons — Bootstrap 5 overrides ===== */
/* Force inline-flex for icon gap; Bootstrap uses inline-flex too but we pin it */
.btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
}
.btn:not(:disabled):not(.btn-link):hover { transform: translateY(-1px); }
.btn-sm { padding: 0.28rem 0.65rem; font-size: 0.8rem; }

/* Map our design colors into Bootstrap 5's CSS variable button system */
.btn-primary {
    --bs-btn-bg: var(--primary-color); --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark);
}
.btn-secondary {
    --bs-btn-bg: var(--secondary-color); --bs-btn-border-color: var(--secondary-color);
    --bs-btn-hover-bg: #475569; --bs-btn-hover-border-color: #475569;
    --bs-btn-active-bg: #475569;
}
.btn-success {
    --bs-btn-bg: var(--success-color); --bs-btn-border-color: var(--success-color);
    --bs-btn-hover-bg: #059669; --bs-btn-hover-border-color: #059669;
}
.btn-danger {
    --bs-btn-bg: var(--danger-color); --bs-btn-border-color: var(--danger-color);
    --bs-btn-hover-bg: #dc2626; --bs-btn-hover-border-color: #dc2626;
}
.btn-warning {
    --bs-btn-bg: var(--warning-color); --bs-btn-border-color: var(--warning-color);
    --bs-btn-hover-bg: #d97706; --bs-btn-hover-border-color: #d97706;
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}
.btn-info {
    --bs-btn-bg: var(--info-color); --bs-btn-border-color: var(--info-color);
    --bs-btn-hover-bg: #0284c7; --bs-btn-hover-border-color: #0284c7;
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}

/* Extras Bootstrap doesn't have */
.btn-full { width: 100%; justify-content: center; }
.btn-link {
    background: none !important;
    border-color: transparent !important;
    padding: 0 !important;
    color: var(--primary-color);
    box-shadow: none !important;
    transform: none !important;
}
.btn-link:hover { color: var(--primary-dark); }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

/* Performance List */
.performance-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.performance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--light-bg);
    border-radius: 8px;
}

.performance-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.performance-name {
    font-weight: 600;
    font-size: 14px;
}

.performance-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.performance-stats {
    display: flex;
    gap: 8px;
}

/* Cases Grid */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.cases-table-container {
    width: 100%;
    overflow-x: auto;
}

.case-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    border-top: 4px solid var(--primary-color);
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.case-card-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.case-card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.case-card-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

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

.case-info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.case-info-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.case-info-value {
    font-weight: 600;
    font-size: 14px;
}

.case-card-footer {
    padding: 16px 20px;
    background: var(--light-bg);
    display: flex;
    gap: 12px;
}

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.view-description {
    color: var(--text-secondary);
    margin: 0;
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Form Styles */
.form-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    max-width: 1000px;
    margin: 0 auto;
}

.form-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.form-header h3 {
    margin: 0;
    font-size: 22px;
}

.case-form {
    padding: 32px;
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h4 {
    margin: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.form-control {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.case-notes-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.7;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.case-notes-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

/* (old .modal block removed — Alpine modals use .modal-overlay) */

.detail-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--primary-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Victim/Inheritor Blocks */
.victim-block {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.victim-block h5 {
    margin: 0 0 16px 0;
    color: var(--primary-color);
    font-size: 16px;
}

.inheritor-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--info-color);
}

.inheritor-item:last-child {
    margin-bottom: 0;
}

.inheritor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.inheritor-name {
    font-weight: 600;
    font-size: 15px;
}

.call-history {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.call-result {
    padding: 8px 12px;
    background: var(--light-bg);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.call-result:last-child {
    margin-bottom: 0;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--dark-bg);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

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

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

/* Case Details Page */
.case-details-container {
    max-width: 1200px;
    margin: 0 auto;
}

.case-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.case-details-actions {
    display: flex;
    gap: 12px;
}

.case-info-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.case-info-card h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.inheritor-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.inheritor-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.inheritor-card.greyed-out {
    opacity: 0.5;
    background: var(--light-bg);
}

.inheritor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.inheritor-info h5 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.inheritor-info .relationship {
    font-size: 13px;
    color: var(--text-secondary);
}

.phone-list {
    margin-top: 12px;
}

.phone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
}

.call-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

/* Transfer Modal */
.inheritor-transfer-item {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.inheritor-transfer-item:hover {
    border-color: var(--primary-light);
}

.inheritor-transfer-item.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.transfer-checkbox {
    display: flex;
    align-items: start;
    gap: 12px;
}

.transfer-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.transfer-inheritor-info {
    flex: 1;
}

.transfer-inheritor-info h6 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.phone-selection {
    margin-top: 12px;
    padding-left: 32px;
}

.phone-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
}

.phone-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.phone-radio label {
    cursor: pointer;
    margin: 0;
}

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

/* Review Cases */
.review-case-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--info-color);
}

/* Condensed Cases Table */
.cases-section-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 12px 20px;
    margin-bottom: 0;
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.cases-section-header.collapsible {
    cursor: pointer;
    user-select: none;
    margin-top: 20px;
}

.cases-section-header.collapsible:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.condensed-cases-table {
    background: white;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 0;
}

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

.compact-table thead {
    background: #1e293b;
    border-bottom: 2px solid var(--border-color);
}

.compact-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.compact-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.compact-table .case-row {
    transition: background-color 0.2s;
    cursor: pointer;
}

.compact-table .case-row:hover {
    background: rgba(79, 70, 229, 0.08);
}

.compact-table .case-row.multi-victim {
    background-color: rgba(59, 130, 246, 0.05);
    border-left: 3px solid rgba(59, 130, 246, 0.3);
}

.compact-table .case-row.multi-victim:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.compact-table .case-row-inheritor {
    background: var(--light-bg);
}

.compact-table .case-row-inheritor:hover {
    background: #e8eef5;
}

.compact-table .child-row {
    background-color: rgba(220, 38, 38, 0.05);
    border-left: 3px solid #dc2626;
}

.compact-table .child-row:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

.compact-table .child-row td {
    color: #dc2626;
    font-size: 0.95em;
}

.child-toggle {
    transition: transform 0.2s ease;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    min-width: 30px;
}

.status-badge.status-CC {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--success-color);
}

.status-badge.status-NC {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger-color);
}

.status-badge.status-P {
    background: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-color);
}

.status-badge.status-F {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger-color);
}

.status-badge.status-NF {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--success-color);
}

.review-case-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.review-case-title h3 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.transfer-info {
    background: var(--light-bg);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 3px solid var(--warning-color);
}

.transfer-info h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--warning-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.transfer-notes {
    background: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid var(--border-color);
}

.transferred-inheritors {
    margin-top: 20px;
}

.transferred-inheritors h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-box {
        width: 200px;
    }

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

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

    .filters {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .content-area {
        padding: 20px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

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

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

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

/* Detailed Cases Layout */
.detailed-cases-container {
    background: transparent;
    padding: 0;
}

.victim-case-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    overflow: visible;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
}

.badge-assigned {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.badge-unassigned {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--warning-color);
    font-weight: 600;
}

/* Left bar for multi-victim grouping — color set inline per case */
.victim-case-card.grouped {
    border-left-width: 5px;
    border-left-style: solid;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.card-left-section {
    background: #f8fafc;
    padding: 24px;
    border-right: 2px solid var(--border-color);
}

.card-right-section {
    padding: 24px;
    background: white;
}

.victim-header h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.child-victim-name {
    color: #dc2626;
    font-weight: 700;
    margin-bottom: 4px;
}

.child-info {
    color: #dc2626 !important;
    font-weight: 700 !important;
}

.accident-info h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.action-buttons-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card-right-section h4 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.inheritors-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.inheritor-block {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
}

.inheritor-header {
    background: var(--primary-color);
    color: white;
    padding: 8px 12px;
    margin: -16px -16px 12px -16px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    font-size: 13px;
    font-weight: 600;
}

.inheritor-details {
    margin-bottom: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.call-results-section,
.text-results-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.results-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.result-item {
    background: white;
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 11px;
}

.result-num {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.result-date {
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.result-status {
    color: var(--text-primary);
    font-weight: 600;
}

.result-empty {
    color: var(--text-secondary);
    font-size: 11px;
    font-style: italic;
    text-align: center;
    padding: 12px;
}

.no-inheritors {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .victim-case-card {
        grid-template-columns: 1fr;
    }
    
    .card-left-section {
        border-right: none;
        border-bottom: 2px solid var(--border-color);
    }
    
    .inheritors-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* Old collapsible styles - keeping for backward compatibility */
.detailed-case-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.detailed-case-card.multi-victim-header {
    border-left: 4px solid #f97316;
    background: linear-gradient(to right, rgba(249, 115, 22, 0.05) 0%, white 100%);
}

.case-victim-header {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.case-victim-header:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
}

.victim-name-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.victim-name-section h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.collapse-icon {
    color: white;
    font-size: 14px;
    transition: transform 0.2s;
}

.case-details-expanded {
    padding: 20px;
    background: #fafafa;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    font-size: 13px;
}

.info-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.info-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

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

.inheritor-table {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}


.status-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.call-result-cell {
    text-align: center;
    padding: 4px;
}

.call-result-cell.empty {
    opacity: 0.4;
}

.call-result-cell div:first-child {
    font-weight: 600;
    margin-bottom: 2px;
}

/* Other Victims Section - Read-only Display */
.disabled-victim-card {
    position: relative;
    opacity: 1;
}

.disabled-victim-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

.disabled-table {
    opacity: 1;
}

.disabled-table tbody tr {
    background: white !important;
}

.disabled-table tbody tr:hover {
    background: #f8f9fa !important;
}

.disabled-inheritor-section {
    border-radius: 6px;
    background: white !important;
}

.disabled-inheritor-section h5 {
    font-size: 14px;
}


/* =============================================
   HUBB CRM — Laravel App Additions
   ============================================= */

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: clip;
    max-width: 100vw;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;                      /* allow flex child to shrink below content width */
    overflow-x: clip;                  /* clip without creating a scroll context (keeps descendant position:sticky working) */
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

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

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

/* Content Body */
.content-body {
    padding: 24px;
    flex: 1;
    min-width: 0;                      /* allow flex child to shrink below content width */
    overflow-x: clip;                  /* clip without creating a scroll context */
}

/* Sidebar Nav */
.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(79,70,229,0.3);
    border-left: 3px solid var(--primary-light);
}

.nav-item i {
    width: 18px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-details .user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.user-details .user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    font-size: 16px;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    max-width: 100%;                   /* never exceed parent width */
    overflow: hidden;                  /* clip wide children (e.g. leads table) */
}

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

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

.card-body {
    padding: 20px;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3);
    color: #065f46;
}

.alert-danger {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #991b1b;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
}

.alert ul {
    margin: 0;
    padding-left: 16px;
}

/* Persistent alert variant — used for messages with critical one-time info
   like temp passwords. Stays until the user dismisses or reloads. Slightly
   stronger left-border so the eye notices it's different from the auto-
   fading green flash. */
.alert-persistent {
    border-left-width: 4px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.alert-persistent-body {
    flex: 1 1 auto;
    min-width: 0;
}
.alert-persistent-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.alert-persistent-code {
    background: rgba(16, 185, 129, 0.18);
    color: #064e3b;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 14px;
    user-select: all;
    word-break: break-all;
}

/* Utility */
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin: 0 auto 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

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

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    color: var(--text-primary);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-checkbox {
    accent-color: var(--primary-color);
}


/* ============================================================
   Lead List Feature Styles
   ============================================================ */

.list-type-badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.type-tx  { background: rgba(11, 66, 26, 0.1);   color: #0b421a; }
.type-wi  { background: rgba(14, 58, 82, 0.1);   color: #0e3a52; }
.type-nc  { background: rgba(77, 57, 12, 0.1);   color: #4d390c; }
.type-mo  { background: rgba(107, 33, 168, 0.1); color: #6b21a8; }
.type-com { background: rgba(30, 64, 175, 0.1);  color: #1e40af; }

.lead-row-skip     { opacity: 0.5; }
.lead-row-transfer { background: rgba(16, 185, 129, 0.05); }
.lead-row-optin    { background: rgba(16, 185, 129, 0.1); }
.lead-row-noanswer { background: rgba(245, 158, 11, 0.05); }

/* Lead status badges */
.lead-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.ls-leftvm    { background: rgba(245,158,11,0.15);  color: #92400e; }
.ls-noanswer  { background: rgba(249,115,22,0.15);  color: #9a3412; }
.ls-skip      { background: rgba(100,116,139,0.15); color: #475569; }
.ls-transfer  { background: rgba(16,185,129,0.15);  color: #065f46; }
.ls-optin     { background: rgba(16,185,129,0.25);  color: #065f46; }
.ls-optout    { background: rgba(239,68,68,0.15);   color: #991b1b; }
.ls-nosel     { background: rgba(99,102,241,0.15);  color: #3730a3; }
.ls-recycled  { background: rgba(139,92,246,0.15);  color: #5b21b6; }
.ls-neutral   { background: rgba(100,116,139,0.1);  color: #475569; }

/* Sort header links */
.sort-link { color: inherit; text-decoration: none; display:inline-flex; align-items:center; gap:4px; }
.sort-link:hover { color: var(--primary-color); }
.sort-link .sort-icon { font-size:10px; opacity:0.5; }
.sort-link.active .sort-icon { opacity:1; color:var(--primary-color); }

/* ============================================================
   Leads Table — sticky system columns + native horizontal scroll.
   System columns (status, notes, assigned, etc.) freeze on the
   left via position:sticky.  Data columns scroll via overflow-x:auto
   on .leads-table-wrap.  Column widths are fixed via min-width
   in Blade so sticky left offsets remain predictable.
   Scoped to .leads-table so cases/users tables are unaffected.
   ============================================================ */

.leads-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.leads-table {
    border-collapse: collapse;
    table-layout: auto;
    white-space: nowrap;
    width: max-content; /* allow the table to size to its content, enabling scroll */
}

/* Field columns — compact, no wrapping, data-driven width */
.leads-table thead th.field-col {
    white-space: nowrap;
    padding: 8px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    vertical-align: middle;
}

/* Visual separator: field columns get a right border on the last one.
   Applied in Blade by adding .field-col-last to the final th/td in the loop. */
.leads-table th.field-col-last,
.leads-table td.field-col-last {
    border-right: 2px solid var(--border-color);
}

/* System columns — slightly wider, same horizontal style */
.leads-table thead th.sys-col {
    white-space: nowrap;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    vertical-align: middle;
}

/* ---- Sticky system columns (always visible while scrolling) ---- */

/* Checkbox column (admin view only) — leftmost sticky */
.leads-table th.checkbox-col,
.leads-table td.checkbox-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card-bg, #fff);
    min-width: 40px;
    width: 40px;
}
.leads-table thead th.checkbox-col {
    background: var(--light-bg);
    z-index: 3;
}

/* Generic sticky-col: applied to system columns that should freeze.
   Each gets a data-sticky-offset or cumulative left value set inline. */
.leads-table th.sticky-col,
.leads-table td.sticky-col {
    position: sticky;
    z-index: 2;
    background: var(--card-bg, #fff);
}
.leads-table thead th.sticky-col {
    background: var(--light-bg);
    z-index: 3;
}

/* Row-highlight backgrounds must also apply to sticky cells */
.lead-row-skip td.sticky-col       { background: var(--card-bg, #fff); }
.lead-row-transfer td.sticky-col   { background: rgba(16, 185, 129, 0.05); }
.lead-row-noanswer td.sticky-col   { background: rgba(245, 158, 11, 0.05); }
.lead-row-skip td.checkbox-col     { background: var(--card-bg, #fff); }
.lead-row-transfer td.checkbox-col { background: rgba(16, 185, 129, 0.05); }
.lead-row-noanswer td.checkbox-col { background: rgba(245, 158, 11, 0.05); }

/* Shadow edge on the last sticky column to hint at scrollable content */
.leads-table th.sticky-col-last,
.leads-table td.sticky-col-last {
    border-right: 2px solid var(--border-color);
    box-shadow: 4px 0 8px -2px rgba(0,0,0,0.06);
}

/* Compact data cells */
.leads-table td.field-cell {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 8px;
    color: var(--text-primary);
}

/* Tighter row padding for all leads-table cells */
.leads-table td {
    padding: 8px 10px;
    font-size: 13px;
}

.bulk-action-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.list-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: block;
    user-select: none;
}

.list-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.list-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.list-card-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.list-card-stat-warn {
    color: #92400e;
}

.list-card-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.checkbox-col {
    width: 40px;
}

input[type=checkbox] {
    accent-color: var(--primary-color);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.inline-status-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.status-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
}

/* ============================================================
   User Management, Dashboard & Reports additions
   ============================================================ */

/* Role Badges */
.role-badge { display:inline-flex; padding:3px 10px; border-radius:12px; font-size:11px; font-weight:700; text-transform:uppercase; }
.role-super_admin { background:rgba(139,92,246,0.1); color:#6d28d9; }
.role-admin { background:rgba(239,68,68,0.1); color:#991b1b; }
.role-manager { background:rgba(59,130,246,0.1); color:#1e40af; }
.role-employee { background:rgba(100,116,139,0.1); color:#475569; }

/* Status Badges */
.active-badge { display:inline-flex; padding:3px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.badge-active     { background:rgba(16,185,129,0.1);  color:#065f46; }
.badge-inactive   { background:rgba(239,68,68,0.1);   color:#991b1b; }
.badge-transferred{ background:rgba(59,130,246,0.1);  color:#1e40af; }
.badge-voicemail  { background:rgba(245,158,11,0.1);  color:#92400e; }
.badge-not-interested { background:rgba(239,68,68,0.1);   color:#991b1b; }
.badge-neutral    { background:rgba(100,116,139,0.1); color:#475569; }
.badge-follow-up  { background:rgba(59,130,246,0.1);  color:#1e40af; }
.badge-hung-up    { background:rgba(239,68,68,0.08);  color:#7f1d1d; }
.badge-call-back  { background:rgba(16,185,129,0.1);  color:#065f46; }
.badge-disqualify { background:rgba(245,158,11,0.08); color:#78350f; }
.badge-other      { background:rgba(100,116,139,0.07);color:#374151; }
.badge-info       { background:rgba(59,130,246,0.1);  color:#1e40af; }
.badge-muted      { background:rgba(100,116,139,0.1); color:#475569; }

/* Dashboard */
.dashboard-two-col { display:grid; grid-template-columns:2fr 1fr; gap:20px; margin-top:20px; }

/* ============================================================
   REPORTS
   ============================================================ */

/* --- Date Range Bar --- */
.rpt-date-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.rpt-date-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.rpt-date-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.rpt-date-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rpt-date-field label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}
.rpt-date-sep {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 14px;
}
.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}
.date-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}
.rpt-date-bar-right {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- API Error Banner --- */
.rpt-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}
.rpt-alert i { margin-top: 2px; font-size: 16px; flex-shrink: 0; }
.rpt-alert p { margin: 2px 0 0; font-size: 13px; }
.rpt-alert-danger {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #991b1b;
}
.rpt-alert-danger i { color: var(--danger-color); }

/* --- Section Layout --- */
.rpt-section {
    margin-bottom: 32px;
}
.rpt-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.rpt-section-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.rpt-icon-primary { background: rgba(79, 70, 229, 0.1); color: var(--primary-color); }
.rpt-icon-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.rpt-icon-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.rpt-icon-info    { background: rgba(59, 130, 246, 0.1); color: var(--info-color); }
.rpt-icon-danger  { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }

.rpt-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}
.rpt-section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0 0;
}

/* --- Cards --- */
.rpt-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.rpt-sub-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 12px;
}
.rpt-sub-header {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.rpt-card-sub-header {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.rpt-card-sub-header span {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* --- Tables --- */
.rpt-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.rpt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.rpt-table thead {
    background: var(--light-bg);
}
.rpt-table th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    text-align: left;
}
.rpt-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}
.rpt-table tbody tr:last-child td {
    border-bottom: 1px solid var(--border-color);
}
.rpt-table tbody tr:hover td {
    background: rgba(79, 70, 229, 0.02);
}
.rpt-table tfoot td {
    padding: 12px 16px;
    font-weight: 700;
    background: var(--light-bg);
    border-top: 2px solid var(--border-color);
    border-bottom: none;
}
.rpt-table-compact td {
    padding: 8px 16px;
    font-size: 13px;
}

/* Column alignment */
.rpt-table th.rpt-num,
.rpt-table td.rpt-num       { text-align: center; }
.rpt-table th.rpt-num-right,
.rpt-table td.rpt-num-right { text-align: right; }

/* Live-data column group header highlight */
.rpt-table th.rpt-col-live {
    background: rgba(59, 130, 246, 0.06);
    color: var(--info-color);
    position: relative;
}
.rpt-table th.rpt-col-live::after {
    content: 'LIVE';
    display: block;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--info-color);
    margin-top: 1px;
}

/* Cell styles */
.rpt-cell-name  { font-weight: 600; }
.rpt-cell-bold  { font-weight: 700; }
.rpt-cell-muted { font-size: 13px; color: var(--text-secondary); }
.rpt-cell-date  { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.rpt-cell-mono  { font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace; font-size: 12px; color: var(--text-secondary); }
.rpt-cell-live  { font-size: 13px; font-weight: 600; color: var(--info-color); }
.rpt-cell-notes { font-size: 12px; color: var(--text-secondary); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-na         { font-size: 11px; color: var(--text-light); font-style: italic; }
.rpt-credit     { font-size: 11px; color: var(--danger-color); margin-left: 2px; }

/* Percentage indicators */
.rpt-pct {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.rpt-pct-good { color: var(--success-color); }
.rpt-pct-bad  { color: var(--danger-color); }

/* --- Caller Report Breakdown Row --- */
.rpt-breakdown td {
    padding: 4px 16px 10px;
    border-top: none !important;
    background: var(--light-bg);
    font-size: 12px;
}
.rpt-breakdown + tr > td {
    border-top: 2px solid var(--border-color);
}
.rpt-pill {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 2px 3px;
    line-height: 1.5;
}
.rpt-pill strong {
    color: var(--text-primary);
    margin-left: 2px;
}

/* --- Badges (inline metric chips) --- */
.rpt-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.rpt-badge-success { background: rgba(16, 185, 129, 0.1); color: #065f46; }
.rpt-badge-info    { background: rgba(59, 130, 246, 0.1); color: #1e40af; }
.rpt-badge-warning { background: rgba(245, 158, 11, 0.1); color: #92400e; }
.rpt-badge-danger  { background: rgba(239, 68, 68, 0.1); color: #991b1b; }
.rpt-badge-muted   { background: rgba(100, 116, 139, 0.08); color: #475569; }
.rpt-badge-primary { background: rgba(79, 70, 229, 0.1); color: #3730a3; }

/* --- Credit row highlighting --- */
.rpt-row-credit-real td    { background: rgba(245, 158, 11, 0.08); }
.rpt-row-credit-pending td { background: rgba(239, 68, 68, 0.06); }

/* --- Stat Cards (SMS section) --- */
.rpt-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 20px;
}
.rpt-stat-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rpt-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.rpt-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.rpt-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Empty States --- */
.rpt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-light);
}
.rpt-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.4;
}
.rpt-empty p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}
.rpt-empty small {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

/* --- Reports Responsive --- */
@media (max-width: 768px) {
    .rpt-date-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .rpt-date-bar-left {
        width: 100%;
    }
    .rpt-date-fields {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .rpt-date-sep { display: none; }
    .rpt-date-bar-right {
        width: 100%;
        justify-content: flex-start;
    }
    .rpt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .rpt-section-header {
        gap: 10px;
    }
    .rpt-section-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .rpt-section-title { font-size: 16px; }
}
@media (max-width: 480px) {
    .rpt-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Legacy compat — used by dashboard and other pages */
.stat-row { display:flex; gap:20px; margin-bottom:20px; flex-wrap:wrap; }
.mini-stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:16px; padding:20px; }
.mini-stat { background:var(--light-bg); border:1px solid var(--border-color); border-radius:10px; padding:16px 20px; }
.mini-stat-value { font-size:28px; font-weight:700; color:var(--text-primary); }
.mini-stat-label { font-size:13px; color:var(--text-secondary); margin-top:4px; display:flex; align-items:center; gap:5px; }

/* Responsive */
@media (max-width:768px) {
    .dashboard-two-col { grid-template-columns:1fr; }
    .stat-row { flex-direction:column; }
}

[x-cloak] { display: none !important; }

/* ============================================================
   Case Manager Styles
   ============================================================ */
.status-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:600; }
.status-active { background:#10b981; color:#fff; }
.status-transferred { background:rgba(59,130,246,0.1); color:#1e40af; }
.status-archived { background:rgba(100,116,139,0.1); color:#475569; }
.table-container { background:white; border-radius:12px; border:1px solid var(--border-color); overflow:hidden; box-shadow:var(--shadow-sm); }
table { width:100%; border-collapse:collapse; }
thead { background:var(--light-bg); }
th { padding:12px 16px; text-align:left; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-secondary); border-bottom:1px solid var(--border-color); }
td { padding:12px 16px; font-size:14px; color:var(--text-primary); border-bottom:1px solid var(--border-color); }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--light-bg); }
.form-group { margin-bottom:20px; }
.form-label { display:block; font-size:13px; font-weight:600; color:var(--text-primary); margin-bottom:6px; }
.form-control { width:100%; padding:9px 12px; border:1px solid var(--border-color); border-radius:8px; font-size:14px; outline:none; transition:var(--transition); }
.form-control:focus { border-color:var(--primary-color); box-shadow:0 0 0 3px rgba(79,70,229,0.1); }
.form-section { background:white; border-radius:12px; border:1px solid var(--border-color); padding:20px; margin-bottom:20px; }
.form-section-title { font-size:16px; font-weight:700; color:var(--text-primary); margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--border-color); }
.victim-block { border:2px solid var(--border-color); border-radius:10px; padding:16px; margin-bottom:16px; background:var(--light-bg); }
.inheritor-block { border:1px solid var(--border-color); border-radius:8px; padding:12px; margin-bottom:10px; background:white; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
.grid-4 { display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:16px; }

/* ============================================================
   EDIT CASE FORM — Collapsible Card Pattern
   Prefix: .edit-case-*
   ============================================================ */

.edit-case-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.edit-case-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.edit-case-card-head-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.edit-case-card-head-title i {
    font-size: 16px;
}

.edit-case-collapse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.edit-case-collapse-btn:hover {
    background: white;
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.edit-case-card-body {
    padding: 20px;
}

/* Collapsed state — round all corners when body hidden */
.edit-case-card-head.collapsed {
    border-bottom: none;
    border-radius: var(--border-radius);
}

/* Subheadings inside card body */
.edit-case-subhead {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-color);
}

.edit-case-subhead:first-child {
    margin-top: 0;
}

/* Nested lighter panel (e.g., Estate & Family Situation) */
.edit-case-nested {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

/* Info banner (instructional text at top of card) */
.edit-case-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #0c4a6e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.edit-case-info-banner i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--info-color);
}

/* Victim card header (gradient, collapsible) */
.edit-case-victim-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    cursor: pointer;
    user-select: none;
}

.edit-case-victim-head.collapsed {
    border-radius: var(--border-radius);
}

.edit-case-victim-head-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-case-victim-head-title .victim-name {
    font-size: 16px;
    font-weight: 700;
}

.edit-case-victim-head-title .victim-summary {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

.edit-case-victim-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-case-victim-collapse-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 5px 10px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.edit-case-victim-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.edit-case-victim-remove-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    padding: 5px 10px;
    color: #fecaca;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.edit-case-victim-remove-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    color: white;
}

/* Victim card body (inheritors inside) */
.edit-case-victim-body {
    padding: 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Inheritor compact row in victim card */
.edit-case-inheritor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
}

.edit-case-inheritor-row:last-child {
    margin-bottom: 0;
}

.edit-case-inheritor-row-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.edit-case-inheritor-row-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.edit-case-inheritor-row-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.edit-case-inheritor-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Section header with button (e.g., "Victims & Inheritors" + Add Victim) */
.edit-case-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.edit-case-section-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.edit-case-section-header-title i {
    color: var(--primary-color);
}

/* [DELETED] victim-estate-row, victim-estate-status-chips, victim-estate-chip,
   victim-estate-badge-* classes — no longer used after cases/show switched to
   shared _case_card partial (2026-04-22) */
.call-history { margin-top:12px; }
.call-result-item { padding:10px 12px; background:var(--light-bg); border-radius:8px; margin-bottom:8px; font-size:13px; }
.call-result-meta { color:var(--text-secondary); font-size:12px; margin-top:4px; }
.optin-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.optin-sent { background:rgba(245,158,11,0.1); color:#92400e; }
.optin-optin { background:rgba(16,185,129,0.1); color:#065f46; }
.optin-optout { background:rgba(239,68,68,0.1); color:#991b1b; }
.filter-bar { display:flex; gap:12px; align-items:center; margin-bottom:20px; flex-wrap:wrap; }
.filter-select { padding:8px 12px; border:1px solid var(--border-color); border-radius:8px; font-size:14px; background:white; cursor:pointer; }
.search-input { padding:8px 12px; border:1px solid var(--border-color); border-radius:8px; font-size:14px; min-width:200px; }
.page-actions { display:flex; gap:12px; align-items:center; }
.pagination { display:flex; gap:4px; justify-content:center; margin-top:20px; }
.page-btn { padding:6px 12px; border:1px solid var(--border-color); border-radius:6px; background:white; cursor:pointer; font-size:13px; text-decoration:none; color:var(--text-primary); }
.page-btn.active { background:var(--primary-color); color:white; border-color:var(--primary-color); }

/* ============================================================
   Victim / Inheritor Block — Case Detail Page
   ============================================================ */
a.victim-anchor-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
a.victim-anchor-link:hover {
    text-decoration: underline;
}

/* [DELETED] .victim-section, .victim-section-header, .victim-section-title,
   .victim-section-pills, .victim-pill-*, .victim-section-body —
   no longer used after cases/show switched to shared _case_card partial (2026-04-22) */

/* Tabs */
.inh-tabs { display: flex; border-bottom: 2px solid var(--border-color); background: white; padding: 0 20px; }
.inh-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
    transition: color 0.15s;
}
.inh-tab:hover { color: var(--text-primary); }
.inh-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.inh-tab-count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
    transition: all 0.15s;
}
.inh-tab.active .inh-tab-count { background: var(--primary-color); color: white; }
.inh-tab-body { padding: 20px 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.inh-tab-body > .inh-card { margin-bottom: 0; }
.inh-tab-body:has(> .inh-card:only-child) { grid-template-columns: 1fr; }
@media (max-width: 768px) { .inh-tab-body { grid-template-columns: 1fr; } }

/* Inheritor card */
.inh-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: visible;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.inh-card:hover { box-shadow: var(--shadow-md); }
.inh-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 10px 10px 0 0;
}
.inh-card-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.inh-card-name .badge-main { background: rgba(255,255,255,0.25); font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.inh-card-name .badge-rel  { font-size: 13px; font-weight: 400; opacity: 0.85; }
.inh-card-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; opacity: 0.9; }
.inh-card-body { padding: 18px; display: grid; grid-template-columns: 160px 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .inh-card-body { grid-template-columns: 1fr; } }
.inh-col-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); margin-bottom: 6px; }
.inh-phone-item { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 4px; }
.inh-phone-item i { color: var(--success-color); font-size: 11px; }
.inh-notes { font-size: 13px; color: var(--text-secondary); font-style: italic; line-height: 1.5; }
.inh-call-entry { font-size: 13px; padding: 8px 12px; background: var(--light-bg); border-radius: 6px; border-left: 3px solid var(--primary-color); margin-bottom: 6px; }
.inh-call-result { font-weight: 700; color: var(--text-primary); }
.inh-call-date { color: var(--text-secondary); font-size: 12px; margin-top: 1px; }
.inh-call-notes { color: var(--text-secondary); font-size: 12px; font-style: italic; margin-top: 1px; }
.inh-call-by { color: var(--text-light); font-size: 11px; margin-top: 1px; }
.inh-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
}
.inh-log-form {
    padding: 16px 18px;
    background: #f0f4ff;
    border-top: 1px solid #c7d2fe;
}

/* Optin badges on dark card headers — solid colors, white text */
.optin-pill { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:12px; font-size:12px; font-weight:700; }
.optin-pill-sent    { background: rgba(245,158,11,0.85);  color: #fff; } /* amber  — sent/clicked */
.optin-pill-optin   { background: rgba(16,185,129,0.9);   color: #fff; } /* green  — opted in */
.optin-pill-optout  { background: rgba(239,68,68,0.85);   color: #fff; } /* red    — opted out */
.optin-pill-unknown { background: rgba(255,255,255,0.2);  color: #fff; } /* white ghost — other */

/* Modal overlay — display:flex here so x-show (which sets display:none) can cleanly toggle it */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
}

@media (max-width:768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns:1fr; }
    .filter-bar { flex-direction:column; align-items:flex-start; }
}

/* ============================================================
   Leads Table — scroll container + custom scrollbar
   ============================================================ */
.leads-scroll-container {
    position: relative;
    width: 100%;
    min-width: 0;
}

/* Custom scrollbar for the table wrap */
.leads-table-wrap::-webkit-scrollbar {
    height: 8px;
}
.leads-table-wrap::-webkit-scrollbar-track {
    background: var(--light-bg, #f5f5f5);
    border-radius: 4px;
}
.leads-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border-color, #ccc);
    border-radius: 4px;
}
.leads-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #999);
}
/* Firefox */
.leads-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #ccc) var(--light-bg, #f5f5f5);
}

/* Scroll arrow buttons — deprecated, hidden. */
.leads-scroll-btn {
    display: none;
}

/* On small screens, reduce sticky freeze to just the first column
   to avoid the frozen zone consuming too much width */
@media (max-width: 768px) {
    .leads-table th.sticky-col:not([style*="left:0"]):not([style*="left: 0"]),
    .leads-table td.sticky-col:not([style*="left:0"]):not([style*="left: 0"]) {
        position: static;
        box-shadow: none;
        border-right: none;
    }
    .leads-table th.sticky-col[style*="left:0"],
    .leads-table td.sticky-col[style*="left:0"],
    .leads-table th.sticky-col[style*="left: 0"],
    .leads-table td.sticky-col[style*="left: 0"] {
        /* Keep only the first column sticky on mobile */
    }
    .leads-table th.checkbox-col,
    .leads-table td.checkbox-col {
        position: sticky;
        left: 0;
    }
}

/* === GLOBAL SEARCH === */
.global-search {
    position: relative;
    z-index: 500;
}

.global-search-input-wrap {
    position: relative;
    width: 260px;
}

.global-search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

.global-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--light-bg);
    color: var(--text-primary);
    transition: var(--transition);
}

.global-search-input::placeholder {
    color: var(--text-light);
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
}

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.gs-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.gs-loading i {
    color: var(--primary-color);
}

.gs-group-label {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.gs-group-label i {
    font-size: 12px;
    color: var(--primary-color);
}

.gs-result-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s;
    cursor: pointer;
}

.gs-result-item:hover,
.gs-result-item.gs-focused {
    background: var(--light-bg);
    color: var(--text-primary);
}

.gs-result-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.gs-result-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.gs-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.gs-empty i {
    margin-right: 4px;
}

/* Responsive: collapse search on small screens */
@media (max-width: 768px) {
    .global-search-input-wrap {
        width: 180px;
    }
    .global-search-dropdown {
        width: 300px;
        right: -20px;
    }
}

@media (max-width: 576px) {
    .global-search-input-wrap {
        width: 140px;
    }
    .global-search-dropdown {
        position: fixed;
        left: 16px;
        right: 16px;
        width: auto;
        top: calc(var(--header-height) + 4px);
    }
}

/* === REPORTS — landing grid & calls-by-time additions === */

/* Landing card grid */
.rpt-landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 4px 0;
}

.rpt-landing-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
}

.rpt-landing-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(79,70,229,0.1);
    transform: translateY(-1px);
    color: var(--text-primary);
    text-decoration: none;
}

.rpt-landing-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.rpt-landing-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
}

.rpt-landing-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.rpt-landing-arrow {
    color: var(--text-light);
    font-size: 13px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.rpt-landing-card:hover .rpt-landing-arrow {
    color: var(--primary-color);
}

/* Calls-by-time: sticky employee name column */
.rpt-table-time th:first-child,
.rpt-table-time td:first-child {
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 2;
    border-right: 1px solid var(--border-color);
    min-width: 140px;
}

.rpt-table-time thead th:first-child {
    background: var(--light-bg);
    z-index: 3;
}

/* Zero cells in calls-by-time table */
.rpt-cell-zero {
    color: var(--text-light) !important;
    font-weight: 400 !important;
}

/* Sticky name column for calls-by-time (class alias used in view) */
.rpt-cell-name-fixed {
    white-space: nowrap;
}

/* =============================================
   Desktop sidebar collapse
   ============================================= */
.sidebar-collapsed {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar-collapsed ~ .main-content {
    margin-left: 0;
}

/* Sidebar transition for desktop expand/collapse */
.sidebar {
    transition: transform 0.3s ease;
}

.main-content {
    transition: margin-left 0.3s ease;
}

/* =============================================
   Sidebar backdrop (mobile overlay)
   ============================================= */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-backdrop.active {
    display: block;
}

/* =============================================
   Mobile layout (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {
    /* Sidebar: hidden off-screen by default, overlay when open */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

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

    /* Main content: full-width, no left gap */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        transition: none;
    }

    /* Toggle button: 44x44 touch target */
    .sidebar-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }

    /* Header tightens on mobile */
    .top-header {
        padding: 0 12px;
    }

    .page-title {
        font-size: 16px;
    }

    .content-body {
        padding: 16px 12px;
    }
}

/* =============================================
   ADMIN DASHBOARD
   ============================================= */

/* ---- Stats Bar ---- */
.adb-stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.adb-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    min-width: 130px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.15s ease;
    cursor: pointer;
}

.adb-stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.adb-stat-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.adb-stat-card i {
    font-size: 20px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.adb-stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.adb-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 4px;
}

/* Stat card color variants */
.adb-stat-unknown { background: rgba(245, 158, 11, 0.08); }
.adb-stat-unknown i { color: #b45309; }
.adb-stat-unknown .adb-stat-value { color: #92400e; }
.adb-stat-unknown.active { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2); }

/* Found — phone located, ready for caller pickup. Purple to match the .cq-status-found pill color. */
.adb-stat-found { background: rgba(139, 92, 246, 0.08); }
.adb-stat-found i { color: #7c3aed; }
.adb-stat-found .adb-stat-value { color: #5b21b6; }
.adb-stat-found.active { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22); background: rgba(139, 92, 246, 0.14); }

.adb-stat-never { background: rgba(239, 68, 68, 0.08); }
.adb-stat-never i { color: #dc2626; }
.adb-stat-never .adb-stat-value { color: #b91c1c; }
.adb-stat-never.active { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }

.adb-stat-callback { background: rgba(249, 115, 22, 0.08); }
.adb-stat-callback i { color: #ea580c; }
.adb-stat-callback .adb-stat-value { color: #c2410c; }
.adb-stat-callback.active { border-color: #ea580c; box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2); }

/* Due Today — past-intake inheritors with no call activity in last 24h. Teal
   to sit between callback (orange) and stale (deep purple) on the urgency scale. */
.adb-stat-due-today { background: rgba(13, 148, 136, 0.08); }
.adb-stat-due-today i { color: #0d9488; }
.adb-stat-due-today .adb-stat-value { color: #0f766e; }
.adb-stat-due-today.active { border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.22); background: rgba(13, 148, 136, 0.14); }

.adb-stat-stale { background: rgba(124, 58, 237, 0.08); }
.adb-stat-stale i { color: #7c3aed; }
.adb-stat-stale .adb-stat-value { color: #6d28d9; }
.adb-stat-stale.active { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2); }

/* =============================================
   CALL QUEUE — Quick-Filter Stats Bar
   Sibling of .adb-stats-bar, rebuilt with its
   own .cq- prefix so pages can diverge later.
   ============================================= */
.cq-stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cq-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    min-width: 120px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.15s ease;
    cursor: pointer;
}

.cq-stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.cq-stat-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.cq-stat-card i {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.cq-stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.cq-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 3px;
    white-space: nowrap;
}

/* Color variants — mirror the admin dashboard vocabulary */
.cq-stat-unknown { background: rgba(148, 163, 184, 0.10); }
.cq-stat-unknown i { color: #475569; }
.cq-stat-unknown .cq-stat-value { color: #334155; }
.cq-stat-unknown.active {
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.22);
    background: rgba(148, 163, 184, 0.18);
}

/* Found — phone located, ready for caller pickup. Purple matches .cq-status-found pill. */
.cq-stat-found { background: rgba(139, 92, 246, 0.10); }
.cq-stat-found i { color: #7c3aed; }
.cq-stat-found .cq-stat-value { color: #5b21b6; }
.cq-stat-found.active {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
    background: rgba(139, 92, 246, 0.18);
}

.cq-stat-never { background: rgba(239, 68, 68, 0.08); }
.cq-stat-never i { color: #dc2626; }
.cq-stat-never .cq-stat-value { color: #b91c1c; }
.cq-stat-never.active {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
    background: rgba(239, 68, 68, 0.16);
}

.cq-stat-callback { background: rgba(245, 158, 11, 0.10); }
.cq-stat-callback i { color: #b45309; }
.cq-stat-callback .cq-stat-value { color: #92400e; }
.cq-stat-callback.active {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22);
    background: rgba(245, 158, 11, 0.20);
}

.cq-stat-stale { background: rgba(249, 115, 22, 0.08); }
.cq-stat-stale i { color: #ea580c; }
.cq-stat-stale .cq-stat-value { color: #c2410c; }
.cq-stat-stale.active {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22);
    background: rgba(249, 115, 22, 0.18);
}

@media (max-width: 992px) {
    .cq-stat-card {
        min-width: 96px;
        padding: 10px 12px;
    }
    .cq-stat-value {
        font-size: 20px;
    }
    .cq-stat-label {
        font-size: 10px;
    }
}

/* ---- Filter Chips ---- */
.adb-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.adb-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: var(--primary-color);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.adb-filter-chip:hover {
    background: var(--primary-dark);
    color: #fff;
}

.adb-filter-chip i {
    font-size: 10px;
    opacity: 0.8;
}

/* ---- Bulk Toggle ---- */
.adb-bulk-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

/* ---- Case Block (grouped by case) ---- */
.adb-case-block {
    display: grid;
    grid-template-columns: minmax(320px, 40%) 1fr;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    overflow: visible;
}

/* ---- Two-Column Layout ---- */
.adb-case-left {
    padding: 16px 20px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;

    /* Sticky — left info stays visible while the inheritor table on the
       right scrolls by. align-self:start is required so the grid item
       doesn't stretch to match the right column (which would leave no
       space for the sticky behavior to engage). max-height + overflow
       protects against tall left content (long case notes, etc.). */
    position: sticky;
    top: calc(var(--header-height, 70px) + 16px);
    align-self: start;
    max-height: calc(100vh - var(--header-height, 70px) - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.adb-case-left::-webkit-scrollbar {
    width: 6px;
}

.adb-case-left::-webkit-scrollbar-track {
    background: transparent;
}

.adb-case-left::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.adb-case-left::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28);
}

.adb-case-right {
    padding: 16px 20px;
    overflow-x: auto;
    min-width: 0;
}

/* ---- Case Header (always visible, now inside left column) ---- */
.adb-case-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.adb-case-head-main {
    flex: 1;
    min-width: 0;
}

.adb-case-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.adb-case-name-link {
    color: var(--text-primary);
    text-decoration: none;
}

.adb-case-name-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.adb-case-subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.adb-case-sub-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.adb-case-sub-item i {
    font-size: 11px;
    color: var(--text-light);
}

.adb-case-sub-sep {
    width: 3px;
    height: 3px;
    background: var(--text-light);
    border-radius: 50%;
}

.adb-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.adb-toggle-btn:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ---- Case Metadata (collapsible, inside left column) ---- */
.adb-case-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---- Tier Progress Row ---- */
.adb-tier-progress {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

/* ---- Case Notes ---- */
.adb-case-notes {
    padding: 10px 12px;
    background: rgba(245, 158, 11, 0.06);
    border-left: 3px solid var(--warning-color);
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.adb-case-notes i {
    color: var(--warning-color);
    font-size: 12px;
    margin-top: 2px;
}

/* ---- View Case Link (bottom of left column) ---- */
.adb-view-case-link {
    margin-top: auto;
    padding-top: 12px;
}

/* ---- Per-case bottom stats row (spans full width of .adb-case-block grid) ---- */
.adb-case-foot-stats {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
    align-items: center;
    /* Sit above the sticky left column. Without this the pinned left column
       (with the View Case / Share buttons at its base) overlaps this footer
       row as you scroll to the bottom of a tall case block. The opaque
       background then cleanly covers the column where they meet. */
    position: relative;
    z-index: 1;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.adb-case-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.adb-case-stat i {
    font-size: 11px;
    opacity: 0.8;
}

.adb-case-stat strong {
    font-weight: 700;
    font-size: 13px;
}

.adb-case-stat-total {
    background: rgba(107, 114, 128, 0.10);
    color: #374151;
}

.adb-case-stat-unknown {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.adb-case-stat-never {
    background: rgba(220, 38, 38, 0.10);
    color: #991b1b;
}

.adb-case-stat-callback {
    background: rgba(234, 88, 12, 0.12);
    color: #9a3412;
}

.adb-case-stat-stale {
    background: rgba(124, 58, 237, 0.12);
    color: #5b21b6;
}

/* Zero-value stat chips are muted so the eye skips past them */
.adb-case-stat[data-muted="1"] {
    background: transparent !important;
    color: var(--text-light, #9ca3af) !important;
    border: 1px dashed var(--border-color);
}

/* ---- Inheritor Table ---- */
.adb-inh-table-wrapper {
    overflow-x: auto;
}

.adb-inh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.adb-inh-table thead {
    background: var(--light-bg);
}

.adb-inh-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.adb-inh-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

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

.adb-inh-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

.adb-inh-table tbody tr.adb-row-alert {
    background: rgba(239, 68, 68, 0.04);
}

.adb-inh-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* Inheritor cell content */
.adb-inh-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adb-inh-cell .adb-inh-name {
    font-weight: 600;
    color: var(--text-primary);
    display: inline;
}

.adb-inh-cell .adb-inh-rel {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.adb-inh-cell .adb-inh-phones {
    font-size: 12px;
    color: var(--text-light);
    display: block;
}

.adb-note-icon {
    font-size: 11px;
    color: var(--warning-color);
    margin-left: 4px;
    cursor: help;
}

/* Last called severity */
.adb-last-called-fresh {
    color: #059669;
    font-weight: 600;
}

.adb-last-called-warn {
    color: #d97706;
    font-weight: 600;
}

.adb-last-called-stale {
    color: #dc2626;
    font-weight: 700;
}

/* Result column */
.adb-result-text {
    color: var(--text-primary);
}

.adb-result-user {
    font-size: 11px;
    color: var(--text-light);
    display: block;
    margin-top: 2px;
}

/* Tier chips */
.adb-tier-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.adb-tier-chip-main {
    background: var(--primary-color);
    color: #fff;
}

.adb-tier-chip-sub {
    background: #64748b;
    color: #fff;
}

.adb-tier-chip-relative {
    background: #94a3b8;
    color: #fff;
}

/* Flag chips */
.adb-flag-chip {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 4px;
    margin-bottom: 2px;
}

.adb-flag-callback {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
}

.adb-flag-stale {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.adb-flag-never {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

/* View button in table */
.adb-view-btn {
    padding: 4px 10px;
    font-size: 11px;
}

/* ---- Case Footer (no longer used in two-column layout) ---- */
.adb-case-foot {
    display: none;
}

/* ---- Legacy styles (still used in metadata) ---- */
.adb-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

/* ---- Badge styles (used in case header) ---- */
.adb-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.adb-badge-signed-yes     { background: rgba(16,185,129,0.12); color: #065f46; }
.adb-badge-signed-no      { background: rgba(239,68,68,0.1);   color: #991b1b; }
.adb-badge-signed-partial { background: rgba(245,158,11,0.12); color: #92400e; }
.adb-badge-optin-yes      { background: rgba(59,130,246,0.12); color: #1e40af; }
.adb-badge-optin-no       { background: rgba(100,116,139,0.1); color: #475569; }
.adb-badge-optin-partial  { background: rgba(245,158,11,0.12); color: #92400e; }
.adb-badge-death          { background: rgba(239,68,68,0.1);   color: #7f1d1d; }
.adb-badge-catastrophic   { background: rgba(245,158,11,0.1);  color: #78350f; }

/* ---- Metadata row (family info chips) ---- */
.adb-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.adb-meta-item {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* ---- Legal Info Row (inside collapsible metadata) ---- */
.adb-legal-row {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.adb-legal-item {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    color: var(--text-secondary);
}

.adb-legal-item .adb-legal-label {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 110px;
    flex-shrink: 0;
    font-size: 12px;
}

.adb-legal-item .adb-legal-label i {
    margin-right: 4px;
    color: var(--text-light);
}

.adb-legal-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.adb-legal-item a:hover {
    text-decoration: underline;
}

.adb-negligence-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.adb-clm-active        { color: #065f46; font-weight: 600; }
.adb-clm-grandfathered { color: #92400e; font-weight: 600; }
.adb-clm-limited       { color: #1e40af; font-weight: 600; }
.adb-clm-none          { color: var(--text-secondary); }

/* ---- Progress badges (tier stats) ---- */
.adb-progress-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.adb-progress-complete { background: rgba(16,185,129,0.15);  color: #065f46; }
.adb-progress-partial  { background: rgba(245,158,11,0.15);  color: #78350f; }
.adb-progress-empty    { background: rgba(239,68,68,0.12);   color: #991b1b; }

/* ---- Empty state ---- */
.adb-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.adb-empty-state i {
    font-size: 48px;
    color: var(--border-color);
    display: block;
    margin-bottom: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .adb-stats-bar {
        flex-wrap: wrap;
    }
    .adb-stat-card {
        min-width: 100px;
        padding: 12px 14px;
    }
    .adb-stat-value {
        font-size: 22px;
    }
    .adb-inh-table th:nth-child(5),
    .adb-inh-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 900px) {
    .adb-case-block {
        grid-template-columns: 1fr;
    }
    .adb-case-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        /* Disable sticky when stacked — pinning above the table looks broken */
        position: static;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .adb-case-head {
        flex-direction: column;
        gap: 10px;
    }
    .adb-toggle-btn {
        align-self: flex-start;
    }
    .adb-inh-table th:nth-child(4),
    .adb-inh-table td:nth-child(4),
    .adb-inh-table th:nth-child(6),
    .adb-inh-table td:nth-child(6) {
        display: none;
    }
    .adb-bulk-toggle {
        justify-content: flex-start;
    }
}

/* === INHERITOR STATUS BADGES === */
.inh-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 10px;
    border-radius: 10px;
    line-height: 1.5;
    white-space: nowrap;
    flex-shrink: 0;
}

.inh-status-unknown {
    background: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.inh-status-found {
    background: #8b5cf6;
    color: #ffffff;
    border: 1px solid #7c3aed;
}

.inh-status-interested {
    background: #059669;
    color: #ffffff;
    border: 1px solid #047857;
}

.inh-status-not-interested {
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #b91c1c;
}

.inh-status-callback {
    background: #d97706;
    color: #ffffff;
    border: 1px solid #b45309;
}

.inh-status-transferred {
    background: #0d9488;
    color: #ffffff;
    border: 1px solid #0f766e;
}

.inh-status-dnc {
    background: #1e1e1e;
    color: #fca5a5;
    border: 1px solid #7f1d1d;
}

/* =============================================
   AI DASHBOARD
   Three-pane layout for AI chat interface
   Prefix: .aid-* to avoid ad-blocker issues
   ============================================= */

.aid-root {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    height: calc(100vh - var(--header-height, 70px));
    background: var(--light-bg);
    margin: -24px;
    overflow: hidden;
}

/* Collapsed states */
.aid-root .aid-left.aid-collapsed {
    width: 48px;
    min-width: 48px;
}

.aid-root .aid-right.aid-collapsed {
    width: 48px;
    min-width: 48px;
}

.aid-root:has(.aid-left.aid-collapsed) {
    grid-template-columns: 48px 1fr 320px;
}

.aid-root:has(.aid-right.aid-collapsed) {
    grid-template-columns: 280px 1fr 48px;
}

.aid-root:has(.aid-left.aid-collapsed):has(.aid-right.aid-collapsed) {
    grid-template-columns: 48px 1fr 48px;
}

/* === LEFT RAIL === */
.aid-left {
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.aid-left-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.aid-new-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.aid-new-chat:hover {
    background: var(--primary-dark);
}

.aid-new-chat-icon {
    flex: 0;
    padding: 10px 12px;
}

.aid-collapse-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.aid-collapse-btn:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

/* Collapsed left rail: stack buttons vertically so the expand chevron
   stays inside the 48px rail and remains clickable. */
.aid-left.aid-collapsed .aid-left-header {
    flex-direction: column;
    padding: 10px 6px;
    gap: 8px;
    align-items: stretch;
}

.aid-left.aid-collapsed .aid-new-chat-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0 auto;
    flex: 0 0 auto;
}

.aid-left.aid-collapsed .aid-collapse-btn {
    width: 34px;
    height: 34px;
    margin: 0 auto;
}

/* Collapsed right rail: tighten header padding so the 32px collapse
   button fits cleanly in the 48px rail. */
.aid-right.aid-collapsed .aid-right-header {
    padding: 10px 6px;
    justify-content: center;
}

.aid-right.aid-collapsed .aid-collapse-btn {
    width: 34px;
    height: 34px;
}

.aid-left-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.aid-section {
    padding: 16px;
}

.aid-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.aid-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.aid-section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0 16px;
}

.aid-search-mini {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--light-bg);
    margin-bottom: 12px;
    transition: border-color 0.15s ease;
}

.aid-search-mini:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
}

.aid-category {
    margin-bottom: 16px;
}

.aid-category-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-left: 4px;
}

.aid-prompt-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.aid-prompt-item:hover {
    background: var(--light-bg);
}

.aid-prompt-item i:first-child {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.aid-prompt-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aid-prompt-fav {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-color);
    transition: color 0.15s ease;
}

.aid-prompt-fav:hover,
.aid-prompt-fav.active {
    color: var(--warning-color);
}

.aid-prompts-empty,
.aid-session-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
}

.aid-prompts-empty i,
.aid-session-empty i {
    font-size: 24px;
    opacity: 0.5;
}

.aid-session-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    margin-bottom: 4px;
}

.aid-session-item:hover {
    background: var(--light-bg);
}

.aid-session-item.active {
    background: rgba(79, 70, 229, 0.08);
    border-left: 3px solid var(--primary-color);
    padding-left: 9px;
}

.aid-session-item.pinned {
    background: rgba(245, 158, 11, 0.06);
}

.aid-session-item.pinned.active {
    background: rgba(79, 70, 229, 0.08);
}

.aid-session-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aid-session-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-light);
}

.aid-pin-icon {
    color: var(--warning-color);
}

/* === CENTER PANE === */
.aid-center {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.aid-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    flex-shrink: 0;
}

.aid-session-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.aid-session-actions {
    display: flex;
    gap: 4px;
}

.aid-session-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-session-actions button:hover {
    background: #fff;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.aid-session-actions button.active {
    color: var(--warning-color);
}

/* Messages container */
.aid-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

.aid-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
}

.aid-empty-icon {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.aid-empty-state h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.aid-empty-state p {
    font-size: 14px;
    max-width: 360px;
    margin-bottom: 24px;
}

.aid-empty-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.aid-empty-shortcuts span {
    font-size: 12px;
    color: var(--text-light);
}

.aid-empty-shortcuts kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Individual message */
.aid-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 780px;
}

.aid-message.aid-role-user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.aid-message-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

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

.aid-message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.aid-role-user .aid-message-header {
    flex-direction: row-reverse;
}

.aid-message-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.aid-message-time {
    font-size: 11px;
    color: var(--text-light);
}

.aid-message-content {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.aid-role-assistant .aid-message-content {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.aid-role-user .aid-message-content {
    background: var(--primary-color);
    color: #fff;
}

/* Markdown content styling */
.aid-message-content p {
    margin: 0 0 12px;
}

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

.aid-message-content h1,
.aid-message-content h2,
.aid-message-content h3,
.aid-message-content h4 {
    margin: 16px 0 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.aid-message-content h1 { font-size: 20px; }
.aid-message-content h2 { font-size: 18px; }
.aid-message-content h3 { font-size: 16px; }
.aid-message-content h4 { font-size: 14px; }

.aid-message-content ul,
.aid-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.aid-message-content li {
    margin-bottom: 4px;
}

.aid-message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
}

.aid-role-user .aid-message-content code {
    background: rgba(255, 255, 255, 0.2);
}

.aid-message-content pre {
    margin: 12px 0;
    padding: 14px;
    background: #1e293b;
    border-radius: 8px;
    overflow-x: auto;
}

.aid-message-content pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
}

.aid-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.aid-message-content th,
.aid-message-content td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.aid-message-content th {
    background: var(--light-bg);
    font-weight: 600;
}

.aid-message-content tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

.aid-message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.aid-role-user .aid-message-content a {
    color: #fff;
    text-decoration: underline;
}

.aid-message-content blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    font-style: italic;
}

/* Message status */
.aid-message-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

.aid-message-status i {
    font-size: 14px;
}

.aid-message-error {
    color: var(--danger-color);
    font-style: normal;
}

.aid-message-error button {
    margin-left: 8px;
    padding: 4px 10px;
    background: var(--danger-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.aid-message-error button:hover {
    background: #dc2626;
}

/* Message actions */
.aid-message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.aid-message-actions button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-message-actions button:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* === COMPOSER === */
.aid-composer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #fff;
    flex-shrink: 0;
}

.aid-composer-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.aid-composer-toolbar button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-composer-toolbar button:hover:not(:disabled) {
    background: #fff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.aid-composer-toolbar button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.aid-composer-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aid-workflow-select {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--light-bg);
    color: var(--text-primary);
    cursor: pointer;
}

.aid-workflow-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.aid-composer-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.aid-composer-input {
    flex: 1;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--light-bg);
    resize: none;
    transition: all 0.15s ease;
}

.aid-composer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.aid-composer-input::placeholder {
    color: var(--text-light);
}

.aid-send-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.aid-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.aid-send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.aid-send-btn.aid-sending {
    background: var(--text-secondary);
}

/* === RIGHT RAIL === */
.aid-right {
    background: var(--light-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.aid-right-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.aid-right-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.aid-right-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: var(--text-light);
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

.aid-right-empty i {
    font-size: 20px;
    opacity: 0.5;
}

.aid-meta-block {
    margin-bottom: 16px;
}

.aid-meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 4px;
}

.aid-meta-value {
    font-size: 14px;
    color: var(--text-primary);
}

.aid-meta-mono {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.aid-runlog-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.aid-runlog-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.aid-runlog-status {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-transform: capitalize;
    margin-bottom: 12px;
}

.aid-runlog-pending {
    background: rgba(59, 130, 246, 0.12);
    color: #1e40af;
}

.aid-runlog-complete,
.aid-runlog-success {
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
}

.aid-runlog-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.aid-runlog-idle {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.aid-runlog-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aid-runlog-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
}

.aid-runlog-step i {
    width: 16px;
    text-align: center;
}

.aid-step-success i { color: var(--success-color); }
.aid-step-failed i { color: var(--danger-color); }
.aid-step-pending i { color: var(--info-color); }

.aid-step-duration {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

/* === PARAM MODAL === */
.aid-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.aid-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.aid-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-modal-close:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

.aid-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.aid-modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.aid-param-field {
    margin-bottom: 16px;
}

.aid-param-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.aid-param-field input,
.aid-param-field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--light-bg);
    transition: all 0.15s ease;
}

.aid-param-field input:focus,
.aid-param-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
}

.aid-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
}

/* === LIVE STEP FEED (inline in assistant message during pending) === */
.aid-steps-live {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(79, 70, 229, 0.04);
    border-left: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.aid-step-live {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    font-variant-numeric: tabular-nums;
}

.aid-step-live i {
    width: 14px;
    text-align: center;
    font-size: 11px;
}

.aid-step-live-label {
    flex: 1;
}

.aid-step-live-duration {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 11px;
}

.aid-step-live.aid-step-success i {
    color: #059669;
}

.aid-step-live.aid-step-failed i {
    color: #dc2626;
}

.aid-step-live.aid-step-running i {
    color: var(--primary-color);
}

.aid-step-live.aid-step-running .aid-step-live-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* fade-in animation for each new step */
.aid-step-live {
    animation: aid-step-fadein 180ms ease-out;
}

@keyframes aid-step-fadein {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Running run-log state in right rail */
.aid-runlog-running {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

/* Running step icon color in right rail */
.aid-step-running i {
    color: var(--primary-color);
}

/* === PROMPT EDITOR === */

/* Section action button ("+") in section headers */
.aid-section-action {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-section-action:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* Prompt actions wrapper (fav + menu) */
.aid-prompt-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

/* Menu wrapper */
.aid-prompt-menu-wrap {
    position: relative;
}

/* Menu toggle button (ellipsis) */
.aid-prompt-menu-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    opacity: 0.68;
    transition: all 0.15s ease;
}

.aid-prompt-item:hover .aid-prompt-menu-btn {
    opacity: 1;
}

.aid-prompt-menu-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

@media (hover: none) {
    .aid-prompt-menu-btn {
        opacity: 1;
    }
}

/* Dropdown menu */
.aid-prompt-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    padding: 4px;
    z-index: 100;
}

.aid-prompt-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.aid-prompt-menu button:hover {
    background: var(--light-bg);
}

.aid-prompt-menu button i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.aid-prompt-menu button.aid-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
}

.aid-prompt-menu button.aid-danger:hover i {
    color: var(--danger-color);
}

/* Wide modal variant */
.aid-modal-wide {
    max-width: 720px;
}

/* Form grid (2-column) */
.aid-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.aid-form-full {
    grid-column: 1 / -1;
}

/* Form fields */
.aid-form-field {
    display: flex;
    flex-direction: column;
}

.aid-form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.aid-form-field input,
.aid-form-field select,
.aid-form-field textarea {
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--light-bg);
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.aid-form-field input:focus,
.aid-form-field select:focus,
.aid-form-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.aid-form-field textarea {
    resize: vertical;
    line-height: 1.5;
}

.aid-form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

.aid-form-hint code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
}

.aid-form-hint a {
    color: var(--primary-color);
    text-decoration: none;
}

.aid-form-hint a:hover {
    text-decoration: underline;
}

/* Form error */
.aid-form-error {
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: var(--danger-color);
    font-size: 13px;
}

/* Params builder */
.aid-params-builder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aid-param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    flex-wrap: wrap;
}

.aid-param-row input[type="text"] {
    flex: 1;
    min-width: 100px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
}

.aid-param-row input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.aid-param-row select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.aid-param-row select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.aid-param-required {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.aid-param-required input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.aid-param-options {
    flex: 2;
    min-width: 140px;
}

.aid-param-remove {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.aid-param-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.aid-param-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.aid-param-add:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.04);
}

.aid-param-add i {
    font-size: 12px;
}

/* === TAGS & MESSAGE SEARCH === */

/* Tag chips — shared base */
.aid-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.15s ease;
}
.aid-tag-chip:hover { background: rgba(79, 70, 229, 0.18); }
.aid-tag-chip i { font-size: 9px; }
.aid-tag-chip button {
    background: none; border: none;
    color: inherit; opacity: 0.6;
    cursor: pointer;
    padding: 0 0 0 2px;
    font-size: 10px;
}
.aid-tag-chip button:hover { opacity: 1; }

.aid-tag-chip-small {
    padding: 1px 6px;
    font-size: 10px;
    border-radius: 8px;
}

.aid-tag-chip-active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.aid-tag-chip-active:hover { background: var(--primary-dark); }

/* Left rail session tag list */
.aid-session-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}

/* Tag filter pill bar above session list */
.aid-tag-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 2px 10px;
    font-size: 11px;
    color: var(--text-secondary);
}
.aid-tag-filter-label { opacity: 0.8; }

/* Center header tag row */
.aid-session-header-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 0;
}

.aid-tag-input {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    height: 22px;
    min-width: 120px;
    outline: none;
    transition: border-color 0.15s ease;
}
.aid-tag-input:focus { border-color: var(--primary-color); }

.aid-tag-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.aid-tag-add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-style: solid;
}

/* Message search results */
.aid-search-loading,
.aid-search-empty,
.aid-search-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    color: var(--text-secondary);
    font-size: 13px;
    justify-content: center;
}
.aid-search-hint { opacity: 0.6; font-style: italic; }

.aid-search-result {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}
.aid-search-result:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.aid-search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.aid-search-result-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.aid-search-result-count {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--light-bg);
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.aid-search-result-snippet {
    display: flex;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.aid-search-snip-role {
    flex-shrink: 0;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.aid-search-snip-role.aid-role-user {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}
.aid-search-snip-role.aid-role-assistant {
    background: var(--light-bg);
    color: var(--text-secondary);
}

.aid-search-snip-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.aid-search-snip-text mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* === n8n HEALTH INDICATOR (right-rail pill) === */
.aid-health {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.aid-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.aid-health-up       { color: #10b981; } /* emerald */
.aid-health-stubbed  { color: #f59e0b; } /* amber   */
.aid-health-down     { color: #ef4444; } /* red     */
.aid-health-error    { color: #ef4444; } /* red     */
.aid-health-unknown  { color: #6b7280; } /* grey    */

/* Pulse animation only on "up" state so a healthy connection feels alive. */
.aid-health-up .aid-health-dot {
    animation: aid-health-pulse 2s ease-in-out infinite;
}

@keyframes aid-health-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Collapsed right rail: hide label, keep just the dot. */
.aid-right.aid-collapsed .aid-health-label {
    display: none;
}

.aid-right.aid-collapsed .aid-health {
    padding: 4px;
    background: transparent;
}

.aid-mobile-overlay,
.aid-mobile-topbar {
    display: none;
}

/* === RESPONSIVE (narrower default rails at medium widths) ===
   Note: we no longer force-collapse at <1200px because that locked the
   user out of the expand toggle. Just shrink the default widths. The
   .aid-collapsed class (set by the chevron buttons) still controls the
   actual collapse state. */
@media (max-width: 1200px) {
    .aid-root {
        grid-template-columns: 240px 1fr 280px;
    }

    .aid-root:has(.aid-left.aid-collapsed) {
        grid-template-columns: 48px 1fr 280px;
    }

    .aid-root:has(.aid-right.aid-collapsed) {
        grid-template-columns: 240px 1fr 48px;
    }

    .aid-root:has(.aid-left.aid-collapsed):has(.aid-right.aid-collapsed) {
        grid-template-columns: 48px 1fr 48px;
    }
}

@media (max-width: 900px) {
    .aid-root {
        display: block;
        position: relative;
        height: calc(100dvh - var(--header-height, 70px));
        margin: -16px;
        overflow: hidden;
    }

    .aid-root:has(.aid-left.aid-collapsed),
    .aid-root:has(.aid-right.aid-collapsed),
    .aid-root:has(.aid-left.aid-collapsed):has(.aid-right.aid-collapsed) {
        display: block;
        grid-template-columns: none;
    }

    .aid-mobile-overlay {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 25;
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(2px);
    }

    .aid-left,
    .aid-right {
        position: absolute;
        top: 0;
        bottom: 0;
        width: min(88vw, 340px);
        min-width: min(88vw, 340px);
        z-index: 35;
        box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    }

    .aid-left {
        left: 0;
        transform: translateX(0);
        transition: transform 0.22s ease;
    }

    .aid-left.aid-collapsed {
        transform: translateX(-100%);
    }

    .aid-right {
        right: 0;
        left: auto;
        transform: translateX(0);
        transition: transform 0.22s ease;
    }

    .aid-right.aid-collapsed {
        transform: translateX(100%);
    }

    .aid-left.aid-collapsed .aid-left-header,
    .aid-right.aid-collapsed .aid-right-header {
        padding: 16px;
        justify-content: space-between;
    }

    .aid-left.aid-collapsed .aid-new-chat-icon,
    .aid-left.aid-collapsed .aid-collapse-btn,
    .aid-right.aid-collapsed .aid-collapse-btn {
        width: 32px;
        height: 32px;
        margin: 0;
    }

    .aid-center {
        height: 100%;
        min-width: 0;
    }

    .aid-mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border-color);
        background: #fff;
        flex-shrink: 0;
    }

    .aid-mobile-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
        background: var(--light-bg);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        color: var(--text-primary);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        flex-shrink: 0;
    }

    .aid-mobile-title {
        flex: 1;
        min-width: 0;
        text-align: center;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .aid-center-header {
        padding: 10px 12px;
    }

    .aid-session-header-title {
        font-size: 14px;
    }

    .aid-session-header-tags {
        padding: 8px 12px 0;
    }

    .aid-messages {
        padding: 16px 12px 18px;
    }

    .aid-empty-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .aid-empty-state h2 {
        font-size: 20px;
    }

    .aid-empty-state p {
        max-width: 280px;
        margin-bottom: 18px;
    }

    .aid-empty-shortcuts {
        flex-direction: column;
        gap: 8px;
    }

    .aid-message {
        max-width: none;
        gap: 10px;
        margin-bottom: 16px;
    }

    .aid-message.aid-role-user {
        margin-left: 40px;
    }

    .aid-message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .aid-message-content {
        padding: 12px 14px;
        font-size: 13px;
        line-height: 1.55;
    }

    .aid-message-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .aid-composer {
        padding: 12px;
    }

    .aid-composer-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .aid-workflow-select {
        flex: 1 1 180px;
        min-width: 0;
    }

    .aid-composer-input-row {
        gap: 8px;
    }

    .aid-composer-input {
        min-height: 92px;
        font-size: 16px;
    }

    .aid-send-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
        border-radius: 12px;
    }

    .aid-right-body,
    .aid-left-body {
        -webkit-overflow-scrolling: touch;
    }

    .aid-right-body {
        padding: 14px 12px 18px;
    }

    .aid-runlog-step {
        align-items: flex-start;
    }
}

/* Responsive form grid for prompt editor modal */
@media (max-width: 600px) {
    .aid-form-grid {
        grid-template-columns: 1fr;
    }

    .aid-param-row {
        flex-direction: column;
        align-items: stretch;
    }

    .aid-param-row input[type="text"],
    .aid-param-row select {
        width: 100%;
    }

    .aid-param-required {
        justify-content: flex-start;
    }

    .aid-param-remove {
        align-self: flex-end;
    }
}

/* =============================================
   SYSTEM SETTINGS (Super Admin)
   Prefix: .cfg-* to avoid ad-blocker collisions
   ============================================= */

.cfg-root {
    max-width: 1000px;
    margin: 0 auto;
}

.cfg-intro {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Group Card */
.cfg-group-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.cfg-group-head {
    padding: 18px 24px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.cfg-group-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.cfg-group-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.cfg-group-body {
    padding: 8px 0;
}

/* Setting Row */
.cfg-setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 24px;
    align-items: start;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.cfg-setting-row:last-child {
    border-bottom: none;
}

.cfg-setting-info {
    min-width: 0;
}

.cfg-setting-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.cfg-setting-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.cfg-setting-input {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.cfg-number-input {
    width: 120px;
    text-align: right;
}

.cfg-setting-default {
    font-size: 11px;
    color: var(--text-light);
    text-align: right;
}

.cfg-bounds {
    color: var(--text-light);
}

/* Checkbox styling */
.cfg-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.cfg-checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.cfg-checkbox-label {
    font-weight: 500;
}

/* Footer Bar */
.cfg-footer-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.cfg-footer-note {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cfg-footer-note i {
    color: var(--info-color);
}

.cfg-footer-actions {
    display: flex;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .cfg-setting-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cfg-setting-input {
        align-items: flex-start;
    }

    .cfg-number-input {
        width: 100%;
        text-align: left;
    }

    .cfg-setting-default {
        text-align: left;
    }

    .cfg-footer-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cfg-footer-note {
        justify-content: center;
    }

    .cfg-footer-actions {
        justify-content: center;
    }
}

/* =============================================
   AI QUERY LOG (admin/ai-queries)
   ============================================= */

/* Stat card success variant (green) */
.aql-stat-success { background: rgba(16, 185, 129, 0.08); }
.aql-stat-success i { color: #059669; }
.aql-stat-success .adb-stat-value { color: #065f46; }

/* Status badges */
.aql-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.aql-status-success  { background: rgba(16, 185, 129, 0.15); color: #065f46; }
.aql-status-rejected { background: rgba(245, 158, 11, 0.15); color: #92400e; }
.aql-status-failed   { background: rgba(239, 68, 68, 0.15);  color: #991b1b; }

/* Duration color coding */
.aql-duration-fast   { color: #059669; }
.aql-duration-normal { color: var(--text-primary); }
.aql-duration-slow   { color: #dc2626; font-weight: 600; }

/* Table tweaks */
.aql-table code {
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Payload modal */
.aql-payload-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

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

.aql-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aql-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 20px;
    background: var(--light-bg);
    font-size: 13px;
    color: var(--text-secondary);
}

.aql-payload-block {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.aql-payload-block pre {
    margin: 0;
    padding: 16px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 350px;
    overflow-y: auto;
}

.aql-error-block {
    margin: 0 20px 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    color: #991b1b;
    font-size: 13px;
}

.aql-error-block pre {
    margin: 8px 0 0;
    padding: 0;
    background: none;
    color: inherit;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.aql-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* =============================================
   API REQUEST LOG (admin/api-logs)
   ============================================= */

/* Cross-link banner tweak (a bit tighter than default .alert-info) */
.apl-cross-link {
    padding: 8px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}
.apl-cross-link i { margin-right: 6px; }

.sys-nav-wrap {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 18px 14px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.sys-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sys-nav-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sys-nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sys-nav-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sys-nav-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.sys-nav-tab:hover {
    color: var(--text-primary);
    border-color: #cbd5e1;
    background: #eef2ff;
}

.sys-nav-tab-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.sys-nav-tab-active:hover {
    color: #fff;
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* HTTP method badges */
.apl-method-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
}
.apl-method-get    { background: rgba(59, 130, 246, 0.15);  color: #1d4ed8; }
.apl-method-post   { background: rgba(16, 185, 129, 0.15);  color: #047857; }
.apl-method-put    { background: rgba(234, 88, 12, 0.15);   color: #9a3412; }
.apl-method-patch  { background: rgba(234, 88, 12, 0.15);   color: #9a3412; }
.apl-method-delete { background: rgba(239, 68, 68, 0.15);   color: #991b1b; }

/* HTTP status badges */
.apl-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
}
.apl-status-2xx { background: rgba(16, 185, 129, 0.15); color: #065f46; }
.apl-status-3xx { background: rgba(100, 116, 139, 0.15); color: #334155; }
.apl-status-4xx { background: rgba(245, 158, 11, 0.15); color: #92400e; }
.apl-status-5xx { background: rgba(239, 68, 68, 0.15);  color: #991b1b; }

/* Error cell - condensed two-line error preview */
.apl-error-cell {
    display: inline-block;
    max-width: 320px;
    font-size: 12.5px;
    color: #991b1b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.apl-error-cell strong { color: #7f1d1d; }

/* Table path column ergonomics */
.apl-table code {
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.apl-table td { vertical-align: middle; }

/* Section labels inside the details modal (Query Params / Request Body) */
.apl-block-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* =============================================
   CALL QUEUE — Compact caller-focused case view
   ============================================= */

.cq-filter-bar {
    background: white;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.cq-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cq-case-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.cq-case-card.cq-multi {
    border-left: 4px solid var(--primary-color);
}

.cq-case-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    flex-wrap: wrap;

}

/* Sticky case header — ONLY on cards taller than the viewport. The
   .cq-card-tall class is set/cleared by case-card.js's ResizeObserver. On
   short cards the header stays static so it doesn't pin-and-release
   awkwardly as a card passes through the viewport. */
.cq-card-tall .cq-case-header {
    position: sticky;
    top: calc(var(--header-height, 70px) + 16px);
    z-index: 5;
}

.cq-case-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cq-case-id {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.cq-case-id:hover {
    text-decoration: underline;
}

.cq-victim-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.cq-victim-age {
    color: var(--text-secondary);
    font-size: 14px;
}

.cq-injury-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    font-weight: 600;
}

.cq-case-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    flex-wrap: wrap;
}

.cq-meta-item {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cq-meta-item i {
    font-size: 11px;
    color: var(--text-light);
}

.cq-case-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Clickable assignee button (sits in .cq-case-meta) */
.cq-assignee-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid transparent;
    padding: 3px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
}
.cq-assignee-btn i {
    font-size: 11px;
    color: var(--text-light);
}
.cq-assignee-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
    color: var(--primary-color);
}
.cq-assignee-btn:hover i {
    color: var(--primary-color);
}

/* Unassigned variant — warm amber prompt to get attention */
.cq-assignee-unassigned {
    background: rgba(217, 119, 6, 0.08);
    color: #b45309;
    font-weight: 600;
}
.cq-assignee-unassigned i {
    color: #d97706;
}
.cq-assignee-btn.cq-assignee-unassigned:hover {
    background: rgba(217, 119, 6, 0.18);
    border-color: rgba(217, 119, 6, 0.3);
    color: #92400e;
}
.cq-assignee-btn.cq-assignee-unassigned:hover i {
    color: #92400e;
}

/* Victim status pill select (replaces static Active badge) */
.cq-status-select {
    padding: 4px 28px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='currentColor' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: var(--transition);
}
.cq-status-select-active {
    background-color: rgba(16, 185, 129, 0.15);
    color: #047857;
}
.cq-status-select-transferred {
    background-color: rgba(79, 70, 229, 0.15);
    color: #4338ca;
}
.cq-status-select-archived {
    background-color: rgba(107, 114, 128, 0.18);
    color: #374151;
}
.cq-status-select:hover {
    filter: brightness(0.96);
}
.cq-status-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* Inheritor tabs */
.cq-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.cq-tab {
    background: none;
    border: none;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cq-tab:hover {
    color: var(--primary-color);
}

.cq-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.cq-tab-count {
    background: var(--light-bg);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.cq-tab.active .cq-tab-count {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

/* Inheritor rows */
.cq-inheritors {
    padding: 8px 16px 12px;
}

.cq-no-inheritors {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 12px 0;
}

/* Row wrapper holds relative positioning for the transition overlay.
   margin-bottom here creates a consistent gap between inheritor blocks,
   whether or not a last-call footer is rendered inside the wrap. */
.cq-inh-wrap {
    position: relative;
    margin-bottom: 8px;
}
.cq-inh-wrap:last-child {
    margin-bottom: 0;
}

/* Transition overlay — fade + centered message over the whole inheritor block
   when a call-log or archive moves the row to a different tab.           */
.cq-inh-transition-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    border-radius: 8px;
    z-index: 4;
    pointer-events: none;
}

.cq-inh-transition-message {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
    animation: cq-pulse-move 1.5s ease-out;
}

.cq-inh-transition-message i {
    font-size: 12px;
    opacity: 0.9;
}

@keyframes cq-pulse-move {
    0%   { transform: translateX(-8px) scale(0.95); opacity: 0; }
    15%  { transform: translateX(0) scale(1);        opacity: 1; }
    85%  { transform: translateX(0) scale(1);        opacity: 1; }
    100% { transform: translateX(8px) scale(0.95);  opacity: 0; }
}

/* While transitioning, slightly desaturate the underlying row to sell the handoff */
.cq-inh-wrap.cq-inh-transitioning .cq-inheritor-row,
.cq-inh-wrap.cq-inh-transitioning .cq-last-call {
    filter: saturate(0.6) opacity(0.75);
    transition: filter 0.2s ease;
}

.cq-inheritor-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "identity actions"
        "phones   phones";
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: var(--light-bg);
    border-radius: 8px;
    position: relative;
    /* Inter-row spacing is controlled by .cq-inh-wrap { margin-bottom } so it
       stays consistent whether or not a last-call footer is rendered below. */
}

.cq-inh-identity { grid-area: identity; }
.cq-inh-phones   { grid-area: phones; justify-content: flex-start; }
.cq-inh-actions  { grid-area: actions; justify-self: end; }

.cq-inh-identity {
    min-width: 0;
}

.cq-inh-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cq-inh-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.cq-inh-rel {
    color: var(--text-secondary);
    font-size: 13px;
}

.cq-badge-main {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    text-transform: uppercase;
}

.cq-badge-archived {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(100, 116, 139, 0.15);
    color: #475569;
    text-transform: uppercase;
}

.cq-inh-call-status {
    margin-top: 3px;
}

.cq-never-called {
    font-size: 12px;
    color: var(--danger-color);
    font-weight: 600;
}

.cq-never-called i {
    margin-right: 4px;
}

.cq-last-called {
    font-size: 12px;
    color: var(--text-secondary);
}

.cq-last-called i {
    margin-right: 4px;
    color: var(--text-light);
}

.cq-call-count {
    color: var(--text-light);
    margin-left: 4px;
}

/* Phone pills */
.cq-inh-phones {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cq-phone-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cq-phone-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.08);
    color: #065f46;
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.cq-phone-pill:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.3);
}

.cq-phone-pill i {
    font-size: 10px;
}

/* Called state — this number has a logged call result */
.cq-phone-pill-called {
    background: rgba(79, 70, 229, 0.08);
    color: #4338ca;
}
.cq-phone-pill-called:hover {
    background: rgba(79, 70, 229, 0.18);
    color: #3730a3;
    border-color: rgba(79, 70, 229, 0.3);
}

/* Opt-in state — inheritor opted in via this number */
.cq-phone-pill-optin {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

/* Opt-out state */
.cq-phone-pill-optout {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* SMS sent (but not yet opted in/out) */
.cq-phone-pill-sms-sent {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

/* Active pill — the one whose log form is currently open */
.cq-phone-pill-active {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* Pill meta: compact "2h ago" indicator to the right */
.cq-phone-pill-meta {
    font-size: 10px;
    margin-left: 4px;
    padding-left: 6px;
    border-left: 1px solid currentColor;
    opacity: 0.65;
}

/* Pill icon (optin/optout/sms-sent) */
.cq-phone-pill-icon {
    font-size: 10px;
    margin-left: 4px;
}

.cq-no-phone {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

/* Status badges */
.cq-inh-status {
    flex-shrink: 0;
}

.cq-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cq-status-unknown {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.cq-status-found {
    /* purple — visually distinct from the other statuses; signals "newly ready to call" */
    background: rgba(139, 92, 246, 0.15);
    color: #5b21b6;
}

.cq-status-interested {
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.cq-status-not-interested {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

.cq-status-callback {
    background: rgba(59, 130, 246, 0.12);
    color: #1e40af;
}

.cq-status-dnc {
    background: rgba(239, 68, 68, 0.15);
    color: #7f1d1d;
}

/* Inline status pill that doubles as a <select> — reuses the status color classes */
.cq-status-pill-select {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 20px 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='currentColor' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 8px;
    transition: var(--transition);
}
.cq-status-pill-select:hover {
    filter: brightness(0.95);
}
.cq-status-pill-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}
.cq-status-pill-select:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* OPT-IN SMS status badges */
.cq-inh-optin {
    flex-shrink: 0;
}

.cq-optin-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.cq-optin-badge i {
    font-size: 10px;
}

.cq-optin-date {
    font-weight: 400;
    opacity: 0.85;
    font-size: 9px;
}

.cq-optin-none {
    background: rgba(100, 116, 139, 0.08);
    color: #94a3b8;
}

.cq-optin-sent {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.cq-optin-in {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.cq-optin-out {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* Actions */
.cq-inh-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cq-actions-dropdown {
    position: relative;
}

.cq-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 100;
    padding: 6px 0;
}

.cq-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.cq-dropdown-item:hover {
    background: var(--light-bg);
}

.cq-dropdown-item i {
    width: 16px;
    color: var(--text-secondary);
}

/* Phone picker inline */
.cq-phone-picker {
    position: absolute;
    top: 100%;
    right: 60px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    min-width: 180px;
    margin-top: 4px;
}

.cq-phone-picker-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cq-phone-picker-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition);
}

.cq-phone-picker-btn:last-child {
    margin-bottom: 0;
}

.cq-phone-picker-btn:hover {
    background: var(--light-bg);
}

.cq-phone-picker-btn i {
    color: var(--success-color);
    margin-right: 6px;
}

/* Inline log call form */
.cq-log-form {
    grid-column: 1 / -1;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.cq-log-form-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cq-log-form-inner select {
    min-width: 140px;
}

.cq-log-form-inner input {
    flex: 1;
    min-width: 150px;
}

/* Active phone header inside the log form */
.cq-log-form-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.cq-log-form-phone-action {
    padding: 2px 10px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cq-log-form-phone-action i {
    font-size: 11px;
}

/* Call history entries (modal) */
.cq-history-entry {
    padding: 10px 12px;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.cq-history-entry:last-child {
    margin-bottom: 0;
}

.cq-history-result {
    font-weight: 700;
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.cq-history-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.cq-history-phone {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 2px;
    margin-bottom: 2px;
}

.cq-history-phone i {
    font-size: 10px;
}

.cq-history-by {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

/* =============================================
   Last-call footer + inline expanded history
   — sits below the inheritor row, full card width
   ============================================= */
.cq-last-call {
    margin-top: -2px;           /* nestle under the row */
    padding: 10px 14px;
    background: #fafbff;
    border-top: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0 0 8px 8px;
    font-size: 12px;
}

.cq-last-call-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cq-last-call-icon {
    color: var(--primary-color);
    font-size: 13px;
    margin-top: 2px;
    flex-shrink: 0;
}

.cq-last-call-body {
    flex: 1;
    min-width: 0;
}

.cq-last-call-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cq-last-call-result {
    font-weight: 700;
    color: var(--text-primary);
}

.cq-last-call-phone {
    color: var(--primary-color);
    font-weight: 600;
}

.cq-last-call-phone i {
    font-size: 10px;
    margin-right: 2px;
}

.cq-last-call-meta {
    color: var(--text-secondary);
}

.cq-last-call-notes {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
    font-style: italic;
}

.cq-last-call-toggle {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.cq-last-call-toggle:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
}

.cq-last-call-toggle i {
    font-size: 10px;
}

/* Full-width inline expanded history */
.cq-history-expanded {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color, #e5e7eb);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cq-history-expanded-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.cq-history-entry-inline {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
}

.cq-history-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.cq-history-meta-row .cq-history-result {
    margin-bottom: 0;
}

.cq-history-meta-row .cq-history-phone {
    margin: 0;
}

.cq-history-meta-row .cq-history-date {
    color: var(--text-secondary);
}

.cq-history-meta-row .cq-history-by {
    margin: 0;
    color: var(--text-light);
    font-size: 11px;
    margin-left: auto;
}

.cq-history-notes-inline {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-primary);
    line-height: 1.45;
    font-style: italic;
    padding-left: 12px;
    border-left: 2px solid var(--border-color, #e5e7eb);
}

.cq-history-notes {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
    font-style: italic;
}

/* Empty state */
.cq-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.cq-empty i {
    font-size: 48px;
    color: var(--border-color);
    display: block;
    margin-bottom: 16px;
}

.cq-empty p {
    font-size: 16px;
    margin-bottom: 16px;
}

/* Body: Left/Right column layout */
.cq-body {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 20px;
    padding: 16px;
}

.cq-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    --cq-case-header-h: 64px; /* approx height of .cq-case-header */
}

/* Sticky left info — also gated on .cq-card-tall (set by case-card.js).
   Offset is page-header + case-header so this column stacks BELOW the
   sticky .cq-case-header. align-self:start prevents the grid item from
   stretching to match the right column's height. Disabled at <=900px
   below where the body stacks vertically. */
.cq-card-tall .cq-left-col {
    position: sticky;
    top: calc(var(--header-height, 70px) + 16px + var(--cq-case-header-h));
    align-self: start;
    max-height: calc(100vh - var(--header-height, 70px) - var(--cq-case-header-h) - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.cq-left-col::-webkit-scrollbar             { width: 6px; }
.cq-left-col::-webkit-scrollbar-track       { background: transparent; }
.cq-left-col::-webkit-scrollbar-thumb       { background: rgba(0, 0, 0, 0.15); border-radius: 3px; }
.cq-left-col::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }

.cq-right-col {
    min-width: 0;
}

.cq-right-col .cq-tabs {
    padding: 0 0 0 0;
    margin-bottom: 8px;
}

.cq-right-col .cq-inheritors {
    padding: 0;
}

/* =============================================
   Shared Estate / Family Situation block
   Used by call-queue and cases/show via partials/_estate_block.blade.php
   ============================================= */
.estate-block {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 12px;
}

.estate-block-compact {
    padding: 8px 10px;
}

.estate-block-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.estate-block-label i {
    font-size: 12px;
    color: var(--primary-color);
}

.estate-block-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.estate-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 3px 0;
}

.estate-icon {
    color: var(--text-light);
    font-size: 11px;
    width: 14px;
    flex-shrink: 0;
    text-align: center;
}

.estate-label {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}

.estate-value {
    font-weight: 600;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(107, 114, 128, 0.12);
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.estate-value.estate-yes {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.estate-value.estate-no {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

/* OPT-IN summary chip */
.cq-optin-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 6px;
    margin-top: -8px;
}

.cq-optin-summary i {
    color: var(--info-color);
    font-size: 11px;
}

.cq-optin-summary strong {
    color: var(--success-color);
}

/* Info blocks */
.cq-info-block {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 12px;
}

.cq-info-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cq-info-label i {
    font-size: 12px;
    color: var(--primary-color);
}

/* Legal block toggle — buttonized cq-info-label. Strip every UA / framework
   chrome (border, focus ring, box-shadow) so it reads as a plain row. */
.cq-legal-toggle,
.cq-legal-toggle:focus,
.cq-legal-toggle:focus-visible,
.cq-legal-toggle:active,
.cq-legal-toggle:hover {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Inline edit icon button — transparent, minimal, gets emphasis on hover */
.cq-edit-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    padding: 4px 6px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
    transition: var(--transition);
}
.cq-edit-inline:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--primary-color);
}
.cq-edit-inline:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.cq-info-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.cq-info-line {
    margin-bottom: 2px;
}

.cq-info-date {
    color: var(--text-secondary);
    font-size: 12px;
}

.cq-info-empty {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Notes */
.cq-notes-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.cq-read-more {
    background: none;
    border: none;
    padding: 0;
    margin-top: 4px;
    font-size: 12px;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
}

.cq-read-more:hover {
    text-decoration: underline;
}

/* Activity entries */
.cq-activity-entry {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.cq-activity-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cq-activity-entry:first-child {
    padding-top: 0;
}

.cq-activity-main {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cq-activity-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.cq-activity-result {
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.cq-activity-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.cq-activity-user {
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 900px) {
    .cq-body {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .cq-left-col {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;

        /* Disable sticky when the body stacks vertically — pinning the info
           panel above the inheritor list looks broken. */
        position: static;
        max-height: none;
        overflow: visible;
    }

    .cq-info-block {
        flex: 1 1 200px;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .cq-case-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .cq-case-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .cq-inheritor-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "phones"
            "actions";
        gap: 8px;
    }

    .cq-inh-phones {
        justify-content: flex-start;
    }

    .cq-inh-actions {
        justify-self: end;
    }

    .cq-phone-picker {
        right: 0;
        left: auto;
    }
}

/* =============================================
   SELECT DROPDOWN CHEVRON (app-wide fix)

   Bootstrap 5.3's `.form-control` sets `appearance: none`, which strips the
   native browser chevron from <select> elements. Several of our own classes
   use `background: white` / `background: var(--light-bg)` shorthand, which
   also blows away any replacement `background-image`. Result: selects look
   like text inputs with no dropdown indicator.

   This block paints an SVG chevron back onto every single-value <select>,
   regardless of which class it carries. It must live at the BOTTOM of the
   stylesheet so later `background: <color>` shorthand doesn't reset the
   background-image.

   Excludes `<select multiple>` and `<select size="N">` where a visible
   listbox is rendered (no chevron desired).
   ============================================= */

select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 14px;
    padding-right: 32px;
}

/* Re-apply chevron on common container classes that use the `background`
   shorthand with a solid color — shorthand wipes `background-image`. The
   !important prevents those rules from winning on specificity. */
select.form-control:not([multiple]):not([size]),
select.filter-select:not([multiple]):not([size]),
select.form-select:not([multiple]):not([size]),
select.aid-workflow-select:not([multiple]):not([size]),
.aid-form-field select:not([multiple]):not([size]),
.aid-param-field select:not([multiple]):not([size]),
.aid-param-row select:not([multiple]):not([size]) {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 14px 14px !important;
    padding-right: 32px !important;
}

/* Hide the native arrow on IE/legacy Edge (does nothing on modern browsers) */
select::-ms-expand {
    display: none;
}

/* =============================================================================
   App Modal — Global alert/confirm replacement
   ============================================================================= */
.appmodal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10500;
    padding: 20px;
}

.appmodal-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.appmodal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.appmodal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

/* Icon variant backgrounds and colors */
.appmodal-icon.appmodal-variant-info {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary-color);
}
.appmodal-icon.appmodal-variant-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
}
.appmodal-icon.appmodal-variant-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-color);
}
.appmodal-icon.appmodal-variant-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
}

.appmodal-title {
    font-weight: 700;
    font-size: 17px;
    color: var(--text-primary);
}

.appmodal-body {
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-line;
    margin-bottom: 24px;
}

.appmodal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
