/* ===== Base ===== */
:root {
    --sidebar-width-collapsed: 56px;
    --sidebar-width-expanded: 220px;
    --header-height: 52px;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;
    --bg-header: #1a1a2e;
    --bg-main: #f4f5f7;
    --bg-chat: #ffffff;
    --text-sidebar: #a8a8b8;
    --text-sidebar-active: #ffffff;
    --accent: #4f6ef7;
    --accent-hover: #3b5bdb;
    --border-color: #e0e0e0;
    --chat-user-bg: #4f6ef7;
    --chat-agent-bg: #f0f2f5;
    --chat-user-text: #ffffff;
    --chat-agent-text: #1a1a2e;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Allow natural page scrolling in the main content area */

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width-collapsed);
    min-width: var(--sidebar-width-collapsed);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, min-width 0.2s ease;
    overflow: hidden;
    z-index: 100;
}

.sidebar.expanded {
    width: var(--sidebar-width-expanded);
    min-width: var(--sidebar-width-expanded);
}

.sidebar-top {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 12px;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-sidebar-active);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.sidebar-brand i {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    color: var(--text-sidebar-active);
    background: var(--bg-sidebar-hover);
}

.sidebar-label {
    display: none;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.expanded .sidebar-label {
    display: inline;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sidebar-link i {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-link.active {
    color: var(--text-sidebar-active);
    background: rgba(79, 110, 247, 0.15);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.sidebar-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0;
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-main);
}

/* ===== Top Header ===== */
.top-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--bg-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Client Switcher */
.client-switcher {
    margin-left: 16px;
}

.client-switcher-select {
    background: rgba(255,255,255,0.1);
    color: #d0d0e0;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 4px 28px 4px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23d0d0e0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    max-width: 220px;
    text-overflow: ellipsis;
    transition: border-color 0.2s, background 0.2s;
}

.client-switcher-select:hover {
    background-color: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
}

.client-switcher-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79,110,247,0.25);
}

.client-switcher-select option {
    background: #1a1a2e;
    color: #d0d0e0;
}

/* Hide switcher when only one client */
.client-switcher.single-client {
    display: none;
}

/* User Dropdown */
.user-dropdown-toggle {
    color: #d0d0e0 !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.user-dropdown-toggle:hover {
    color: #ffffff !important;
    background: var(--bg-sidebar-hover);
}

.user-dropdown-toggle .bi-person-circle {
    font-size: 1.3rem;
}

.user-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

/* ===== Chat Interface ===== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    color: #6b7280;
    padding: 40px 20px;
}

.chat-welcome-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.chat-welcome h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 0.95rem;
    max-width: 480px;
    line-height: 1.5;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.chat-suggestion {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #fff;
    color: #374151;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.chat-suggestion:hover {
    border-color: var(--accent);
    background: rgba(79, 110, 247, 0.05);
    color: var(--accent);
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.agent {
    align-self: flex-start;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.chat-message.user .chat-avatar {
    background: var(--chat-user-bg);
    color: #fff;
}

.chat-message.agent .chat-avatar {
    background: #e5e7eb;
    color: #4b5563;
}

.chat-bubble {
    padding: 10px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.92rem;
    word-wrap: break-word;
}

.chat-message.user .chat-bubble {
    background: var(--chat-user-bg);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
}

.chat-message.agent .chat-bubble {
    background: var(--chat-agent-bg);
    color: var(--chat-agent-text);
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    gap: 12px;
    max-width: 80%;
}

.typing-indicator.visible {
    display: flex;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-agent-bg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
    padding: 16px 0 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.92rem;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    padding: 4px 0;
    font-family: inherit;
    background: transparent;
}

.chat-input::placeholder {
    color: #9ca3af;
}

.chat-send-btn {
    background: var(--accent);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

.chat-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.chat-send-btn i {
    font-size: 1.1rem;
}

/* ===== Scrollbar ===== */
.chat-messages::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* ===== Focus styles ===== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ===== Settings Pages ===== */
.settings-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
    overflow-y: auto;
    height: 100%;
}

.settings-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.settings-back {
    margin-bottom: 16px;
}

.settings-back a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.settings-back a:hover {
    text-decoration: underline;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.settings-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.settings-card-header {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.settings-card-header > i {
    font-size: 1.5rem;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.settings-card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: #1f2937;
}

.settings-card-header p {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0;
}

.settings-card-body {
    padding: 14px 20px;
    flex: 1;
}

.settings-card-footer {
    padding: 12px 20px;
    border-top: 1px solid #f3f4f6;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.connection-status.connected { color: #059669; }
.connection-status.disconnected { color: #9ca3af; }
.connection-status i { font-size: 1rem; }

.connection-banner {
    display: flex;
    align-items: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 20px;
}

.platform-fields {
    animation: fadeIn 0.2s ease;
}

/* ===== Service Area Badges ===== */
.area-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.area-badge-zipcode { background: #dbeafe; color: #1e40af; }
.area-badge-city { background: #fce7f3; color: #9d174d; }
.area-badge-county { background: #fef3c7; color: #92400e; }
.area-badge-state { background: #d1fae5; color: #065f46; }

.service-area-usage {
    padding: 12px 0;
}

/* ===== Data Pages ===== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px;
}

.page-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

/* Report Toolbar */
.report-toolbar-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.report-toolbar-left {
    font-size: 0.875rem;
    color: #6b7280;
}

.report-toolbar-right {
    display: flex;
    gap: 8px;
}

.report-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 0.825rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary-color, #2563eb);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.report-export-btn:hover {
    background: #1d4ed8;
}

/* ===== DataTables Styling ===== */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .row:first-child {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
}

.dataTables_wrapper .row:last-child {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-color);
    margin: 0;
    background: #f9fafb;
    border-radius: 0 0 8px 8px;
}

.dataTables_wrapper .dataTables_length {
    font-size: 0.85rem;
    color: #6b7280;
}

.dataTables_wrapper .dataTables_length select {
    padding: 5px 28px 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 0.85rem;
    color: #374151;
    margin: 0 6px;
    cursor: pointer;
    appearance: auto;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.dataTables_wrapper .dataTables_filter {
    font-size: 0.85rem;
    color: #6b7280;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #374151;
    margin-left: 6px;
    min-width: 200px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.825rem;
    color: #6b7280;
    padding-top: 4px;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 12px !important;
    margin: 0 2px;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #374151 !important;
    font-size: 0.825rem;
    cursor: pointer;
    transition: all 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
    color: #111827 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color, #2563eb) !important;
    border-color: var(--primary-color, #2563eb) !important;
    color: #fff !important;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: default;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #fff !important;
    border-color: #d1d5db !important;
}

/* Table itself */
.dataTables_wrapper table.dataTable {
    border-collapse: collapse !important;
    margin: 0 !important;
    width: 100% !important;
}

.dataTables_wrapper table.dataTable thead th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 14px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    white-space: nowrap;
}

.dataTables_wrapper table.dataTable thead th:first-child {
    padding-left: 20px !important;
}

.dataTables_wrapper table.dataTable tbody td {
    padding: 10px 14px !important;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.dataTables_wrapper table.dataTable tbody td:first-child {
    padding-left: 20px !important;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
    background-color: #eff6ff !important;
}

.dataTables_wrapper table.dataTable tbody tr.odd {
    background-color: #fff;
}

.dataTables_wrapper table.dataTable tbody tr.even {
    background-color: #fafbfc;
}

/* Sort icons */
.dataTables_wrapper table.dataTable thead .sorting,
.dataTables_wrapper table.dataTable thead .sorting_asc,
.dataTables_wrapper table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-grid-sm {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
}

.kpi-card.mini {
    padding: 14px 16px;
    gap: 0;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background: #dbeafe; color: #2563eb; }
.kpi-icon.green { background: #d1fae5; color: #059669; }
.kpi-icon.purple { background: #ede9fe; color: #7c3aed; }
.kpi-icon.orange { background: #ffedd5; color: #ea580c; }
.kpi-icon.red { background: #fee2e2; color: #dc2626; }
.kpi-icon.teal { background: #ccfbf1; color: #0d9488; }

.kpi-body {
    flex: 1;
    min-width: 0;
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.kpi-card.mini .kpi-value {
    font-size: 1.2rem;
}

.kpi-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.kpi-badge {
    font-size: 0.72rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 6px;
    display: inline-block;
}

.kpi-badge.warn {
    background: #fef3c7;
    color: #92400e;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table thead th {
    background: #f9fafb;
    padding: 10px 14px;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.table-responsive {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Section Title Bar */
.section-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.section-title-bar .section-title {
    margin: 0;
}

.view-all-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Modern Table (DataTables-enhanced) */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.modern-table thead th {
    background: #f9fafb;
    padding: 12px 16px;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.modern-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.modern-table tbody tr:hover {
    background: #f0f4ff;
}

.modern-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.modern-table tbody tr:nth-child(even):hover {
    background: #f0f4ff;
}

/* DataTables custom styling */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    padding: 16px 20px 12px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataTables_wrapper .dataTables_length select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fff;
    color: #374151;
    min-width: 65px;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fff;
    color: #374151;
    outline: none;
    transition: border-color 0.15s;
    min-width: 220px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dataTables_wrapper .dataTables_info {
    padding: 12px 20px;
    font-size: 0.82rem;
    color: #9ca3af;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 12px 20px;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-block;
    padding: 5px 12px;
    margin: 0 2px;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    transition: all 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color, #2563eb);
    color: #fff;
    border-color: var(--primary-color, #2563eb);
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: default;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #fff;
    color: #6b7280;
    border-color: #e5e7eb;
}

/* Sort arrow styling */
.modern-table thead th.sorting,
.modern-table thead th.sorting_asc,
.modern-table thead th.sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 24px;
}

.modern-table thead th.sorting::after,
.modern-table thead th.sorting_asc::after,
.modern-table thead th.sorting_desc::after {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #9ca3af;
}

.modern-table thead th.sorting::after { content: "⇅"; }
.modern-table thead th.sorting_asc::after { content: "↑"; color: var(--primary-color, #2563eb); }
.modern-table thead th.sorting_desc::after { content: "↓"; color: var(--primary-color, #2563eb); }

/* Report toolbar */
.report-toolbar-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.report-export-btn {
    padding: 7px 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-export-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.active, .status-badge.completed, .status-badge.enabled, .status-badge.ok { background: #d1fae5; color: #065f46; }
.status-badge.inactive, .status-badge.expired, .status-badge.paused { background: #f3f4f6; color: #6b7280; }
.status-badge.cancelled, .status-badge.removed, .status-badge.failed { background: #fee2e2; color: #991b1b; }
.status-badge.pendingrenewal, .status-badge.pending, .status-badge.scheduled, .status-badge.running { background: #dbeafe; color: #1e40af; }
.status-badge.warn { background: #fef3c7; color: #92400e; }
.status-badge.urgent { background: #fee2e2; color: #991b1b; }
.status-badge.open, .status-badge.inprogress { background: #ede9fe; color: #5b21b6; }

.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    white-space: nowrap;
}

/* LTV Badges */
.ltv-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
}

.ltv-badge.platinum { background: linear-gradient(135deg, #e5e7eb, #d1d5db); color: #1f2937; }
.ltv-badge.gold { background: #fef3c7; color: #92400e; }
.ltv-badge.silver { background: #f3f4f6; color: #4b5563; }
.ltv-badge.bronze { background: #ffedd5; color: #9a3412; }

/* Recommendation Badges */
.rec-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 600;
}

.rec-badge.target { background: #d1fae5; color: #065f46; }
.rec-badge.suppress { background: #fee2e2; color: #991b1b; }
.rec-badge.defer { background: #fef3c7; color: #92400e; }
.rec-badge.test { background: #dbeafe; color: #1e40af; }

.warn-text { color: #d97706; }

/* Filter Bar */
.filter-bar {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* Section Title */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.section-title i {
    color: var(--accent);
}

/* Pagination */
.page-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 16px;
    padding: 8px 0;
}

.page-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #374151;
    border: 1px solid var(--border-color);
    background: #fff;
}

.page-pagination .page-link:hover { background: #f3f4f6; }
.page-pagination .page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Dashboard Tables */
.dashboard-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 16px;
}

.dash-table-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.dash-table-card h5 {
    padding: 14px 18px;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
}

.dash-table-card h5 i { color: var(--accent); }

/* Report Grid */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.report-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.report-card h5 {
    padding: 14px 18px;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
}

.report-card h5 i { color: var(--accent); }

/* Utility */
.fw-medium { font-weight: 500; }

/* ===== Reports Catalog ===== */
.report-category-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.report-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.report-catalog-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer;
}

.report-catalog-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(79, 110, 247, 0.10);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.report-catalog-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    background: #eef1ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent);
}

.report-catalog-info {
    flex: 1;
    min-width: 0;
}

.report-catalog-info h6 {
    margin: 0 0 2px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
}

.report-catalog-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.35;
}

.report-catalog-arrow {
    color: #c0c4cc;
    font-size: 0.9rem;
    transition: color 0.15s, transform 0.15s;
}

.report-catalog-card:hover .report-catalog-arrow {
    color: var(--accent);
    transform: translateX(2px);
}

/* ===== Report Viewer ===== */
.report-view-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 24px);
    padding-bottom: 0 !important;
}

.report-view-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-back-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.15s;
}

.report-back-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: #eef1ff;
}

.report-toolbar {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-report-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: #374151;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-report-action:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f8f9ff;
}

.report-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.report-status-bar #filterStatus {
    color: var(--accent);
    font-weight: 500;
}

.report-grid-container {
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* AG Grid theme overrides */
.ag-theme-alpine {
    --ag-header-background-color: #f8f9fb;
    --ag-header-foreground-color: #374151;
    --ag-row-hover-color: #f0f4ff;
    --ag-selected-row-background-color: #e8edff;
    --ag-font-size: 13px;
    --ag-header-font-size: 12px;
    --ag-header-font-weight: 600;
    --ag-border-color: #e5e7eb;
    --ag-row-border-color: #f3f4f6;
    --ag-cell-horizontal-padding: 12px;
}

.ag-theme-alpine .ag-header-cell-text {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ag-theme-alpine .ag-floating-filter-input {
    font-size: 12px;
}

.ag-theme-alpine .ag-paging-panel {
    font-size: 12px;
}

/* ===== Create Report Button ===== */
.btn-create-report {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-create-report:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }

/* ===== Report Builder Layout ===== */
.builder-layout {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* ── Field Picker Sidebar ── */
.builder-sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.builder-sidebar-header {
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border-color);
}
.builder-sidebar-header h6 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
}

.builder-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
}
.builder-search:focus { border-color: var(--accent); }

.builder-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

/* Field categories */
.field-category-header {
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
}
.field-category-header i { font-size: 0.65rem; margin-right: 4px; }
.field-category-body.collapsed { display: none; }

/* Field tables */
.field-table-header {
    padding: 5px 14px 5px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.field-table-header i { color: var(--accent); font-size: 0.8rem; }
.field-table-header.disabled { opacity: 0.35; pointer-events: none; }
.field-table-fields.collapsed { display: none; }

/* Field pills */
.field-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 4px 32px;
    font-size: 0.78rem;
    color: #4b5563;
    cursor: grab;
    user-select: none;
    transition: background 0.1s;
}
.field-pill:hover { background: #f3f4f6; }
.field-pill.disabled { opacity: 0.3; cursor: not-allowed; }
.field-pill.dragging { opacity: 0.4; }
.field-pill i { font-size: 0.7rem; color: #9ca3af; }

/* ── Builder Main ── */
.builder-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

.builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}
.builder-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.builder-toolbar-left h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.builder-toolbar-right {
    display: flex;
    gap: 8px;
}

.btn-builder {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-builder:hover { border-color: var(--accent); color: var(--accent); }
.btn-builder-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-builder-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

/* ── Builder Sections ── */
.builder-section {
    margin: 12px 20px 0;
}
.builder-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.builder-hint {
    font-weight: 400;
    color: #9ca3af;
    margin-left: 4px;
}

.builder-drop-zone {
    min-height: 60px;
    background: #fff;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    align-content: flex-start;
    transition: border-color 0.15s, background 0.15s;
}
.builder-drop-zone.drag-over {
    border-color: var(--accent);
    background: #f0f4ff;
}
.builder-drop-zone-sm { min-height: 44px; }

.builder-drop-placeholder {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    color: #9ca3af;
    font-size: 0.8rem;
}
.builder-drop-placeholder i { font-size: 1rem; }

/* ── Builder Chips (columns) ── */
.builder-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    background: #f0f4ff;
    border: 1px solid #d6deff;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.1s;
}
.builder-chip:hover { box-shadow: 0 1px 4px rgba(79,110,247,0.15); }
.builder-chip.dragging { opacity: 0.4; }
.builder-chip.drag-target { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,110,247,0.2); }

.chip-table {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    background: #e5e7eb;
    padding: 1px 6px;
    border-radius: 3px;
}
.chip-field { font-weight: 500; color: #374151; }
.chip-agg {
    padding: 1px 4px;
    border: 1px solid #d6deff;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #fff;
    color: #374151;
    outline: none;
}
.chip-remove {
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.chip-remove:hover { color: #dc3545; }

/* ── Filter rows ── */
.builder-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
}
.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 160px;
    font-weight: 500;
    color: #374151;
}
.filter-op, .filter-val, .filter-val2 {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.78rem;
    outline: none;
}
.filter-op { min-width: 100px; }
.filter-val, .filter-val2 { width: 140px; }
.filter-op:focus, .filter-val:focus, .filter-val2:focus { border-color: var(--accent); }

/* ── Messages ── */
.builder-messages { padding: 0 20px; }
.builder-msg {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: 8px;
}
.msg-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg-warning { background: #fffbeb; color: #92400e; border: 1px solid #fed7aa; }
.msg-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.msg-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Results ── */
.builder-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 12px 20px 12px;
    min-height: 0;
}
.builder-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #6b7280;
}
.builder-result-grid {
    flex: 1;
    min-height: 300px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

/* ── Modals ── */
.builder-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.builder-modal {
    background: #fff;
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.builder-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}
.builder-modal-header h6 { margin: 0; font-weight: 600; }
.builder-modal-close {
    border: none;
    background: none;
    font-size: 1.3rem;
    color: #9ca3af;
    cursor: pointer;
}
.builder-modal-body {
    padding: 16px 18px;
    max-height: 50vh;
    overflow-y: auto;
}
.builder-modal-body label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    margin: 10px 0 4px;
}
.builder-modal-body label:first-child { margin-top: 0; }
.builder-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}
.builder-input:focus { border-color: var(--accent); }
.builder-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
}

/* Load modal items */
.load-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.load-item:last-child { border-bottom: none; }
.load-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.load-item-info strong { font-size: 0.85rem; }
.load-item-info span { font-size: 0.75rem; }
.load-item-info small { font-size: 0.7rem; }
.load-item-actions {
    display: flex;
    gap: 4px;
}
.btn-delete-report { color: #dc3545 !important; border-color: #fecaca !important; }
.btn-delete-report:hover { background: #fef2f2 !important; }

/* ===== My Clients Page ===== */
.clients-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 800px;
}

.client-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    transition: box-shadow 0.15s;
}

.client-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.client-card-active {
    border-color: var(--accent);
    background: #f8f9ff;
}

.client-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #eef1fb;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.client-card-active .client-card-icon {
    background: var(--accent);
    color: #fff;
}

.client-card-details {
    flex: 1;
    min-width: 0;
}

.client-card-name {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-active-client {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.client-card-meta {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: #6c757d;
    flex-wrap: wrap;
}

.client-card-actions {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .client-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .client-card-meta {
        flex-direction: column;
        gap: 4px;
    }
    .client-card-actions {
        align-self: flex-end;
    }
}

/* ===== Help Panel ===== */
.help-toggle-btn {
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
}
.help-toggle-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.help-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.help-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 90vw;
    background: #fff;
    z-index: 1050;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.help-panel.open {
    transform: translateX(0);
}

.help-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
    flex-shrink: 0;
}
.help-panel-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}
.help-panel-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}
.help-panel-close:hover {
    color: #333;
    background: #e9ecef;
}

.help-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.help-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.help-page-title i {
    font-size: 1.2rem;
}

.help-section {
    margin-bottom: 20px;
}
.help-section-heading {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}
.help-section-body {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
    margin-bottom: 0;
}
.help-section-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.help-section-list li {
    font-size: 0.875rem;
    color: #444;
    line-height: 1.55;
    padding: 5px 0 5px 20px;
    position: relative;
    border-bottom: 1px solid #f5f5f5;
}
.help-section-list li:last-child {
    border-bottom: none;
}
.help-section-list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.help-section-list li code {
    background: #f0f2f5;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82rem;
    color: #d63384;
}
.help-section-list li strong {
    color: #1a1a2e;
}

.help-empty {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}
.help-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}
.help-empty p {
    font-size: 0.9rem;
}

/* ===== Weather Widget & Dropdown ===== */
.weather-widget-wrapper {
    position: relative;
}
.weather-widget-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}
.weather-widget-btn:hover {
    color: var(--accent);
}
.weather-temp {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
}
.weather-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1100;
    overflow: hidden;
}
.weather-dropdown.show {
    display: block;
}
.weather-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}
.weather-dropdown-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}
.weather-dropdown-body {
    padding: 12px 8px;
}
.weather-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}
.weather-view-all-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
}
.weather-view-all-link:hover {
    text-decoration: underline;
}
.weather-forecast-row {
    display: flex;
    justify-content: space-between;
    gap: 2px;
}
.weather-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 2px;
    border-radius: 8px;
    transition: background 0.15s;
}
.weather-day:hover {
    background: #f5f5f5;
}
.weather-day.has-alert {
    background: rgba(255, 193, 7, 0.1);
}
.weather-day-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.weather-day-icon {
    font-size: 1.4rem;
    color: #1a73e8;
    margin-bottom: 4px;
    line-height: 1;
}
.weather-day-temps {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.weather-high {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
}
.weather-low {
    font-size: 0.7rem;
    color: #888;
}
.weather-day-alert {
    margin-top: 2px;
    color: #ffc107;
    font-size: 0.7rem;
}
.weather-empty {
    text-align: center;
    color: #888;
    padding: 20px 12px;
    font-size: 0.85rem;
}
.weather-loading {
    text-align: center;
    color: #888;
    padding: 20px 12px;
    font-size: 0.85rem;
}

/* ===== Notification Bell & Dropdown ===== */
.notification-bell-wrapper {
    position: relative;
}
.notification-bell-btn {
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    position: relative;
}
.notification-bell-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.notification-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 99px;
    padding: 0 4px;
}
.notification-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 370px;
    max-height: 480px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 1060;
    overflow: hidden;
    flex-direction: column;
}
.notification-dropdown.open {
    display: flex;
}
.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
}
.notification-dropdown-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
}
.notification-mark-all-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
}
.notification-mark-all-btn:hover {
    background: rgba(79,110,247,0.08);
}
.notification-dropdown-list {
    overflow-y: auto;
    max-height: 340px;
    flex: 1;
}
.notification-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: inherit;
}
.notification-item:hover {
    background: #f8f9fa;
}
.notification-item-icon {
    font-size: 1.2rem;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}
.notification-item-content {
    flex: 1;
    min-width: 0;
}
.notification-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notification-item-message {
    font-size: 0.8rem;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notification-item-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
}
.notification-item-dismiss {
    background: none;
    border: none;
    color: #bbb;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    align-self: flex-start;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
}
.notification-item-dismiss:hover {
    color: var(--accent);
    background: rgba(79,110,247,0.08);
}
.notification-empty {
    padding: 28px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}
.notification-dropdown-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: #f8f9fa;
}
.notification-view-all-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}
.notification-view-all-link:hover {
    text-decoration: underline;
}

/* ===== Notifications Page ===== */
.notification-page-list {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.notification-page-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    align-items: flex-start;
}
.notification-page-item:last-child {
    border-bottom: none;
}
.notification-page-item.unread {
    background: rgba(79,110,247,0.04);
    border-left: 3px solid var(--accent);
}
.notification-page-item.read {
    opacity: 0.65;
}
.notification-page-icon {
    font-size: 1.3rem;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}
.notification-page-content {
    flex: 1;
    min-width: 0;
}
.notification-page-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
    text-decoration: none;
}
a.notification-page-title:hover {
    color: var(--accent);
}
.notification-page-message {
    font-size: 0.85rem;
    color: #555;
    margin-top: 3px;
    line-height: 1.5;
}
.notification-page-meta {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.75rem;
}
.notification-page-mark-read {
    color: var(--accent) !important;
    text-decoration: none !important;
}

/* ===== Manage Profile ===== */
.manage-profile-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}
.manage-profile-nav {
    flex-shrink: 0;
    width: 220px;
    position: sticky;
    top: calc(var(--header-height) + 20px);
}
.manage-nav-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 12px;
    padding: 0 12px;
}
.manage-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.manage-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.manage-nav-link:hover {
    background: #f0f2f5;
    color: #1a1a2e;
}
.manage-nav-link.active {
    background: rgba(79,110,247,0.08);
    color: var(--accent);
    font-weight: 600;
}
.manage-nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}
.manage-profile-content {
    flex: 1;
    min-width: 0;
    max-width: 640px;
}
.manage-page-header {
    margin-bottom: 20px;
}
.manage-page-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.manage-page-header p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.manage-profile-content .form-control:disabled {
    font-size: 0.95rem;
    background: #f8f9fa;
    color: #333;
}

/* ===== Mobile Menu Button (hidden on desktop) ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 1.3rem;
    padding: 4px 8px;
    margin-right: 8px;
    cursor: pointer;
    border-radius: 6px;
}
.mobile-menu-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ===== Responsive: Tablet (<=992px) ===== */
@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    .report-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    .dashboard-tables {
        grid-template-columns: 1fr;
    }
}

/* ===== Responsive: Mobile (<=768px) ===== */
@media (max-width: 768px) {
    /* Sidebar: hidden by default, overlay when open */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-width-expanded) !important;
        min-width: var(--sidebar-width-expanded) !important;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
    }
    .sidebar .sidebar-label {
        display: inline;
    }
    .sidebar .sidebar-toggle {
        display: none;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-overlay.visible {
        display: block;
    }

    /* Show hamburger menu */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
    }

    /* Header */
    .top-header {
        padding: 0 12px;
    }
    .header-title {
        font-size: 0.9rem;
    }
    .client-switcher {
        margin-left: 8px;
    }
    .client-switcher-select {
        max-width: 130px;
        font-size: 0.78rem;
        padding: 3px 24px 3px 6px;
    }
    .header-right {
        gap: 2px;
    }
    .user-name {
        display: none;
    }
    .user-dropdown-toggle .bi-chevron-down {
        display: none;
    }

    /* Main content */
    .main-content {
        padding: 12px 12px;
    }
    .page-container {
        padding: 16px 12px;
    }
    .page-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .page-header h2 {
        font-size: 1.2rem;
    }

    /* Settings */
    .settings-container {
        padding: 16px 12px;
    }
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* KPI grids */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .kpi-card {
        padding: 12px;
    }
    .kpi-value {
        font-size: 1.2rem;
    }

    /* Dashboard tables */
    .dashboard-tables {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Data tables: horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    .data-table thead th {
        padding: 8px 8px;
        font-size: 0.75rem;
    }
    .data-table tbody td {
        padding: 6px 8px;
    }

    /* Bootstrap tables in cards */
    .card .table-hover {
        font-size: 0.8rem;
    }
    .card-body.p-0 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .card-body.p-0 .table {
        min-width: 500px;
    }

    /* Filter bar */
    .filter-bar {
        padding: 10px 12px;
    }
    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 100% !important;
        min-width: 0 !important;
    }
    .filter-bar form {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    /* Report catalog */
    .report-catalog-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .report-catalog-card {
        padding: 12px;
    }
    .report-catalog-info h6 {
        font-size: 0.88rem;
    }
    .report-catalog-info p {
        font-size: 0.78rem;
    }

    /* Report viewer */
    .report-viewer-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Chat */
    .chat-welcome h2 {
        font-size: 1.2rem;
    }
    .chat-suggestions {
        flex-direction: column;
    }
    .chat-suggestion {
        font-size: 0.8rem;
    }
    .chat-bubble {
        max-width: 90%;
    }
    .chat-input-area {
        padding: 8px 12px;
    }

    /* Notifications dropdown */
    .notification-dropdown {
        width: calc(100vw - 24px);
        right: -40px;
    }

    /* Help panel */
    .help-panel {
        width: 100%;
        max-width: 100%;
    }

    /* Manage profile */
    .manage-profile-layout {
        flex-direction: column;
    }
    .manage-profile-nav {
        width: 100%;
        position: static;
    }
    .manage-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
    .manage-nav-link {
        padding: 6px 10px;
        font-size: 0.82rem;
    }
    .manage-profile-content {
        max-width: 100%;
    }

    /* Google Ads tab content */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    /* Service areas / services offered forms */
    .settings-back {
        margin-bottom: 12px;
    }
}

/* ===== Responsive: Small phones (<=480px) ===== */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .page-container {
        padding: 12px 8px;
    }
    .settings-container {
        padding: 12px 8px;
    }
    .card-body {
        padding: 12px;
    }
    .notification-dropdown {
        right: -60px;
    }
    .chat-input-area {
        padding: 6px 8px;
    }

    /* Manage profile nav on tiny screens */
    .manage-nav-link {
        padding: 5px 8px;
        font-size: 0.78rem;
        gap: 5px;
    }
    .manage-nav-link i {
        font-size: 0.85rem;
    }
}

/* ===== Desktop-only pages: block mobile access ===== */
.mobile-not-supported {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #666;
}
.mobile-not-supported i {
    font-size: 3rem;
    color: var(--accent);
    display: block;
    margin-bottom: 16px;
}
.mobile-not-supported h5 {
    margin-bottom: 8px;
}
.mobile-not-supported p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .desktop-only-content {
        display: none !important;
    }
    .mobile-not-supported {
        display: block;
    }
}
