/* Payment Follow-Up — CRM project design system */
:root {
    --primary-gradient: linear-gradient(135deg, #7c6df0 0%, #9b7cf7 100%);
    --primary-color: #7c6df0;
    --primary-light: #9b7cf7;
    --primary-dark: #5b4fd4;
    --crm-success: #3dd68c;
    --crm-warning: #e8b84a;
    --crm-danger: #f06666;
    /* Theme tokens */
    --app-bg: #ffffff;
    --app-foreground: #0f172a;
    --app-card: #ffffff;
    --app-muted: #f1f5f9;
    --app-muted-foreground: #64748b;
    --app-border: #e5e7eb;
    --app-nav-bg: #ffffff;
    --app-nav-foreground: #0f172a;
    --app-nav-border: #e5e7eb;
    --app-footer-bg: #f1f5f9;
    --app-footer-foreground: #64748b;
    --app-footer-border: #e2e8f0;
    --app-content-bg: #f8fafc;
    --app-input-bg: #ffffff;
    --app-input-border: #e5e7eb;
    --app-dropdown-bg: #ffffff;
    --app-dropdown-foreground: #0f172a;
    --crm-bg: #f8fafc;
    --crm-foreground: #0f172a;
    --crm-card: #ffffff;
    --crm-muted: #f1f5f9;
    --crm-muted-foreground: #64748b;
    --crm-border: #e5e7eb;
    --crm-radius: 12px;
}

.dark {
    --app-bg: #14141c;
    --app-foreground: #d4d4dc;
    --app-card: #1f1f28;
    --app-muted: #2a2a36;
    --app-muted-foreground: #8b8b9a;
    --app-border: #3a3a48;
    --app-nav-bg: #1a1a22;
    --app-nav-foreground: #d4d4dc;
    --app-nav-border: #3a3a48;
    --app-footer-bg: #1a1a22;
    --app-footer-foreground: #8b8b9a;
    --app-footer-border: #3a3a48;
    --app-content-bg: #14141c;
    --app-input-bg: #23232d;
    --app-input-border: #3a3a48;
    --app-dropdown-bg: #23232d;
    --app-dropdown-foreground: #d4d4dc;
    --crm-bg: #14141c;
    --crm-foreground: #d4d4dc;
    --crm-card: #1f1f28;
    --crm-muted: #2a2a36;
    --crm-muted-foreground: #8b8b9a;
    --crm-border: #3a3a48;
    --crm-surface-2: #2e2e3a;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    padding-bottom: 70px;
    padding-top: 0;
    background: var(--app-bg);
    color: var(--app-foreground);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Header - consistent top alignment, no negative margin */
.app-navbar {
    top: 0;
    min-height: 60px;
    height: 60px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    background: var(--app-nav-bg) !important;
    color: var(--app-nav-foreground);
    border-bottom: 1px solid var(--app-nav-border);
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.dark .app-navbar { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }

.app-nav-logo { height: 45px; width: auto; }
.app-nav-title { font-weight: 600; color: var(--app-nav-foreground); text-decoration: none; }
.app-nav-user { color: var(--app-nav-foreground); }
.app-nav-link { color: var(--app-nav-foreground) !important; }
.app-navbar-toggler { border-color: var(--app-border) !important; }
.app-navbar-toggler .navbar-toggler-icon { filter: invert(0); }
.dark .app-navbar-toggler .navbar-toggler-icon { filter: invert(1); }

.app-theme-toggle {
    color: var(--app-nav-foreground) !important;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.35rem !important;
}
.app-theme-toggle:hover { opacity: 0.8; }

.content-wrapper {
    padding-top: 1.5rem;
    max-width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.footer {
    background: var(--app-footer-bg);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    color: var(--app-footer-foreground);
    font-size: 14px;
    border-top: 1px solid var(--app-footer-border);
    z-index: 999;
    min-height: 56px;
}
.app-footer-text { color: var(--app-footer-foreground); }

/* Nav dropdown */
.app-dropdown {
    background: var(--app-dropdown-bg) !important;
    border-color: var(--app-border) !important;
}
.app-dropdown .dropdown-item {
    color: var(--app-dropdown-foreground) !important;
}
.app-dropdown .dropdown-item:hover { background: var(--app-muted) !important; }
.app-dropdown .dropdown-divider { border-color: var(--app-border) !important; }

/* Main content area */
.tab-content {
    background: var(--app-content-bg) !important;
    border-color: var(--app-border) !important;
    color: var(--app-foreground);
}
.dark .tab-content { border-color: var(--app-border); }

/* Navigation tabs (Dashboard, Invoices, etc.) */
.navigation-tabs-container { margin-bottom: 1rem; }
.modern-tabs { border-bottom: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modern-tabs .nav-link {
    background: var(--primary-gradient);
    border: none;
    margin: 0;
    border-radius: 10px;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    font-weight: 500;
}
.modern-tabs .nav-link:hover {
    background: linear-gradient(135deg, #d32f5e 0%, #a61746 100%);
    color: white;
    transform: translateY(-1px);
}
.modern-tabs .nav-link.active {
    background: #dc3545;
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.35);
    font-weight: 600;
}

/* Forms */
.form-control, .form-select {
    background: var(--app-input-bg) !important;
    border-color: var(--app-input-border) !important;
    color: var(--app-foreground) !important;
}
.input-group-text {
    background: var(--app-muted) !important;
    border-color: var(--app-input-border) !important;
    color: var(--app-muted-foreground);
}
.form-control::placeholder { color: var(--app-muted-foreground); }
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(190, 29, 79, 0.25);
}

.modal-header {
    background: var(--primary-gradient) !important;
    color: #fff !important;
}
.modal-header .btn-close { filter: brightness(0) invert(1); }
.modal-content {
    background: var(--app-card) !important;
    border-color: var(--app-border) !important;
}
.modal-body { color: var(--app-foreground); }
.modal-footer { border-color: var(--app-border) !important; background: var(--app-muted) !important; }

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, #d32f5e 0%, #a61746 100%); color: #fff; }

.text-primary { color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

.text-muted { color: var(--app-muted-foreground) !important; }

/* Cards */
.card {
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--app-border);
    background: var(--app-card) !important;
    color: var(--app-foreground);
}
.dark .card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.card::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--primary-gradient);
    margin: -1px -1px 0 -1px;
    border-radius: 12px 12px 0 0;
}
.card-body { color: var(--app-foreground); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-bordered { border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 12px; text-align: left; border-color: var(--app-border); font-size: 14px; color: var(--app-foreground); }
.table th { background: var(--app-muted) !important; font-weight: 600; color: var(--app-muted-foreground) !important; }
.table-striped tbody tr:nth-of-type(odd) { background: rgba(0, 0, 0, 0.03); }
.dark .table-striped tbody tr:nth-of-type(odd) { background: rgba(255, 255, 255, 0.03); }
.table-hover tbody tr:hover { background: var(--app-muted) !important; }
.table-responsive { overflow-x: auto; border-radius: 8px; }

/* DCRM-like invoice tabs + table */
.crm-tabs-list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: var(--crm-muted);
    color: var(--crm-muted-foreground);
    border: 1px solid var(--crm-border);
    overflow-x: auto;
    max-width: 100%;
}
.crm-tab-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-muted-foreground);
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.crm-tab-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--crm-foreground);
}
.dark .crm-tab-trigger:hover { background: rgba(255, 255, 255, 0.08); }
.crm-tab-trigger.active {
    background: var(--crm-card);
    color: var(--crm-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.crm-tab-trigger:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(190, 29, 79, 0.25); }

.crm-card-elevated {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}
.dark .crm-card-elevated { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.crm-card-header {
    padding: 10px 0;
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-muted);
}
.crm-card-title { font-size: 14px; font-weight: 700; color: var(--crm-foreground); }

.crm-table-wrap { overflow: auto; }
.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--crm-border);
}
.crm-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: 48px;
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
    background: var(--crm-card);
    color: var(--crm-muted-foreground);
    font-weight: 700;
    border: 1px solid var(--crm-border);
}
.crm-table tbody td {
    padding: 10px 8px;
    vertical-align: middle;
    border: 1px solid var(--crm-border);
    color: var(--crm-foreground);
}
.crm-table thead th:first-child,
.crm-table tbody td:first-child {
    padding-left: 4px;
}
.crm-table thead th:last-child,
.crm-table tbody td:last-child {
    padding-right: 4px;
}
.crm-table tbody tr:hover { background: var(--crm-muted); }
.crm-table tbody tr:last-child td { border-bottom: 1px solid var(--crm-border); }

/* List groups (reminders) */
.list-group-item {
    background: var(--app-card) !important;
    border-color: var(--app-border) !important;
    color: var(--app-foreground);
}
.card-header { border-color: var(--app-border) !important; color: #fff !important; }

/* Report section headers */
h6.bg-primary { background: var(--primary-gradient) !important; color: #fff !important; }

/* Edit follow-up modal — CRM-style (clear sections, teal accent on active sub-tab) */
.followup-edit-modal .modal-content {
    border-radius: 14px;
    overflow: hidden;
}
.followup-edit-modal__header {
    background: linear-gradient(180deg, #1a1d21 0%, #15181c 100%) !important;
    color: #f8fafc !important;
    border-bottom: 1px solid #2a2f36 !important;
}
.followup-edit-modal__header .modal-title { font-weight: 700; letter-spacing: 0.02em; }
.followup-edit-modal__header .text-muted,
.followup-edit-modal__header small { color: #94a3b8 !important; }
.followup-edit-modal__header .btn-close { filter: brightness(0) invert(1); opacity: 0.75; }

.followup-edit-tabs {
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--crm-border);
    padding-bottom: 10px !important;
    margin-bottom: 0 !important;
}
.followup-edit-tabs .nav-link {
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-muted-foreground);
    padding: 0.4rem 0.85rem;
    border: 1px solid transparent;
}
.followup-edit-tabs .nav-link:hover {
    color: var(--crm-foreground);
    background: var(--crm-muted);
}
.followup-edit-tabs .nav-link.active {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #22c55e !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
}

.followup-period-strip {
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--crm-muted);
    border: 1px solid var(--crm-border);
    color: var(--crm-foreground);
}
.followup-period-strip strong { color: var(--crm-foreground); }

.followup-invoice-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--app-muted);
    border: 1px solid var(--app-border);
    color: var(--app-muted-foreground);
}

.followup-timeline {
    border-left: 2px solid var(--crm-border);
    margin-left: 10px;
    padding-left: 16px;
}
.followup-timeline-item {
    font-size: 14px;
    position: relative;
    padding-bottom: 14px;
}
.followup-timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--crm-muted-foreground);
    border: 2px solid var(--crm-card);
}
.followup-timeline-item.is-followup::before {
    background: #22c55e;
}
.followup-badge-follow {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #16a34a !important;
    font-weight: 600;
    font-size: 11px;
}
.dark .followup-badge-follow {
    color: #4ade80 !important;
}

/* Invoice "More" popup UI */
.invoice-items-swal {
    background: var(--crm-card) !important;
    color: var(--crm-foreground) !important;
    border: 1px solid var(--crm-border) !important;
}
.invoice-items-pop-head {
    border-bottom: 1px solid var(--crm-border);
    padding-bottom: 8px;
}
.invoice-items-table th,
.invoice-items-table td {
    border-color: var(--crm-border) !important;
    color: var(--crm-foreground) !important;
}
.invoice-items-swal .invoice-items-table thead th {
    background: #334a69 !important;
    color: #e5edf8 !important;
}
.invoice-items-swal .invoice-items-table tbody td {
    background: #21324a !important;
    color: #e6edf7 !important;
}
.invoice-items-swal .invoice-items-table tbody tr:nth-child(even) td {
    background: #1d2c42 !important;
}
.invoice-items-summary {
    width: 280px;
    background: var(--crm-muted);
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
}

/* Follow-up records: two-side activity/chat layout */
.followup-records-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.followup-record-chat-item {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 12px;
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    padding: 10px 12px;
}
.followup-record-chat-left {
    border-right: 1px dashed var(--crm-border);
    padding-right: 10px;
}
.followup-record-date { font-size: 15px; color: var(--crm-foreground); }
.followup-record-meta { margin-top: 4px; }
.followup-record-chat-right { min-width: 0; }
.followup-record-bubble {
    background: var(--crm-muted);
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 8px 10px;
    line-height: 1.45;
    color: var(--crm-foreground);
    white-space: pre-wrap;
}
.followup-transcript-pre {
    background: rgba(2, 6, 23, 0.75);
    border: 1px solid var(--crm-border);
    color: var(--crm-foreground);
    max-height: 220px;
    overflow: auto;
}
html:not(.dark) .followup-transcript-pre {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

/* Conversation transcript (Calls tab + follow-up records) */
.crm-transcript-panel {
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--crm-card) 88%, var(--crm-muted) 12%);
    overflow: hidden;
}
.crm-transcript-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 0;
    background: transparent;
    color: var(--crm-foreground);
    text-align: left;
    font-size: 14px;
}
.crm-transcript-toggle:hover {
    background: rgba(148, 163, 184, 0.08);
}
.crm-transcript-toggle-title {
    flex: 1;
    font-weight: 600;
}
.crm-transcript-toggle-meta {
    font-size: 12px;
    font-family: ui-monospace, monospace;
    color: var(--crm-muted-foreground, #94a3b8);
}
.crm-transcript-chevron {
    color: var(--crm-muted-foreground, #94a3b8);
    transition: transform 0.2s ease;
}
.crm-transcript-toggle[aria-expanded="true"] .crm-transcript-chevron {
    transform: rotate(180deg);
}
.crm-transcript-preview {
    border-top: 1px solid var(--crm-border);
    line-height: 1.4;
}
.crm-transcript-panel .collapse.show ~ .crm-transcript-preview,
.crm-transcript-panel:has(.collapse.show) .crm-transcript-preview {
    display: none;
}
.crm-transcript-body {
    border-top: 1px solid var(--crm-border);
    padding: 0;
    max-height: min(360px, 48vh);
    overflow-y: auto;
    background: color-mix(in srgb, var(--crm-card) 92%, var(--crm-muted) 8%);
}
.crm-transcript-rows {
    display: flex;
    flex-direction: column;
}
.crm-transcript-row {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-transcript-row:last-child {
    border-bottom: 0;
}
.crm-transcript-row-accent {
    width: 4px;
    flex-shrink: 0;
    border-radius: 999px;
    align-self: stretch;
    min-height: 1.5rem;
}
.crm-transcript-row--agent .crm-transcript-row-accent { background: #3b82f6; }
.crm-transcript-row--customer .crm-transcript-row-accent { background: #34d399; }
.crm-transcript-row--other .crm-transcript-row-accent { background: var(--crm-muted-foreground); }
.crm-transcript-row-content {
    min-width: 0;
    flex: 1;
}
.crm-transcript-row-speaker {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}
.crm-transcript-row--agent .crm-transcript-row-speaker { color: #60a5fa; }
.crm-transcript-row--customer .crm-transcript-row-speaker { color: #34d399; }
.crm-transcript-row-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
    color: var(--crm-foreground);
    white-space: pre-wrap;
    word-break: break-word;
}
.crm-transcript-plain {
    padding: 14px 16px;
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--crm-foreground);
}
@media (max-width: 900px) {
    .followup-record-chat-item {
        grid-template-columns: 1fr;
    }
    .followup-record-chat-left {
        border-right: 0;
        border-bottom: 1px dashed var(--crm-border);
        padding-right: 0;
        padding-bottom: 8px;
    }
}

/* ---------- 2026 UI refresh overrides ---------- */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    line-height: 1.45;
}
.content-wrapper {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 !important;
}

.app-navbar {
    min-height: 64px;
    height: auto;
    border-bottom: 1px solid var(--app-border);
    backdrop-filter: blur(8px);
}
.app-nav-logo { height: 34px; }
.app-nav-title { font-size: 1rem; font-weight: 700; letter-spacing: 0.01em; }

.app-main-links {
    gap: 0.15rem;
}
.app-main-link {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--app-nav-foreground) !important;
    border-radius: 8px;
    padding: 0.4rem 0.6rem !important;
    transition: background-color .18s ease, color .18s ease;
}
.app-main-link:hover {
    background: var(--app-muted);
    color: var(--primary-color) !important;
}

.footer {
    position: static;
    margin-top: auto;
    min-height: 52px;
    padding: 0.75rem 1rem;
    font-size: 13px;
}

.tab-content.bg-light {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}

.crm-card-elevated,
.card,
.modal-content,
.table-responsive {
    border-radius: 12px !important;
}
.card,
.crm-card-elevated {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.dark .card,
.dark .crm-card-elevated {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
}
.btn-sm {
    border-radius: 8px;
}
.form-control,
.form-select {
    min-height: 38px;
    border-radius: 10px !important;
}
textarea.form-control { min-height: 92px; }

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

@media (max-width: 992px) {
    .content-wrapper {
        padding: 0 !important;
    }
    .app-main-links {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .app-main-link {
        padding: 0.5rem 0.65rem !important;
    }
    .footer {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.35rem;
    }
}

/* Sidebar shell inspired by latest CRM patterns */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--app-bg);
    gap: 0 !important;
}
.app-sidebar {
    width: 190px;
    border-right: 0 !important;
    margin-right: 0 !important;
    background: var(--app-card);
    padding: 0.85rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.app-sidebar-brand {
    padding: 0.35rem 0.45rem;
}
.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.35rem;
}
.app-side-link {
    color: var(--app-foreground);
    text-decoration: none;
    border-radius: 9px;
    padding: 0.58rem 0.7rem;
    font-weight: 600;
    font-size: 0.92rem;
}
.app-side-link:hover {
    background: var(--app-muted);
    color: var(--primary-color);
}
.app-side-link.active {
    background: linear-gradient(135deg, rgba(229, 57, 99, 0.18), rgba(190, 29, 79, 0.22));
    color: var(--primary-color);
    border: 1px solid rgba(190, 29, 79, 0.25);
}
.app-sidebar-toggle {
    border-radius: 8px;
    padding: 0.15rem 0.45rem;
}
.app-sidebar-user {
    border-top: 1px solid var(--app-border);
    padding: 0.75rem 0.45rem 0.2rem;
}
.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: 0;
    padding-left: 0 !important;
}
.app-main .tab-content,
.app-main .crm-card-elevated {
    margin-left: 0 !important;
}
.app-main > .content-wrapper {
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 8px !important;
}
.app-topbar {
    height: 58px;
    border-bottom: 1px solid var(--app-border);
    padding: 0;
    background: var(--app-card);
    position: sticky;
    top: 0;
    z-index: 40;
}
.app-shell.sidebar-collapsed .app-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-right: 0 !important;
    overflow: hidden !important;
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    pointer-events: none;
}
.app-shell.sidebar-collapsed .app-nav-title,
.app-shell.sidebar-collapsed .app-side-link span,
.app-shell.sidebar-collapsed .app-sidebar-user > div,
.app-shell.sidebar-collapsed .app-sidebar-user .btn {
    display: none !important;
}
.app-shell.sidebar-collapsed .app-side-link {
    text-align: center;
    padding: 0 !important;
    margin: 0 !important;
    height: 0 !important;
    overflow: hidden;
}
.app-shell.sidebar-collapsed .app-side-link i {
    margin-right: 0 !important;
}
.app-shell.sidebar-collapsed .app-sidebar-brand,
.app-shell.sidebar-collapsed .app-sidebar-nav,
.app-shell.sidebar-collapsed .app-sidebar-user {
    display: none !important;
}
.app-shell.sidebar-collapsed .app-main {
    margin-left: 0 !important;
}

/* Old page-level duplicated top navs are hidden in the new shell */
.navigation-tabs-container {
    display: none !important;
}

@media (max-width: 992px) {
    .app-shell {
        display: block;
    }
    .app-sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--app-border);
    }
    .app-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .app-side-link {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

.app-page-head h4 {
    font-weight: 700;
    color: var(--app-foreground);
}
.app-page-head p {
    font-size: 0.92rem;
}

.app-subtabs {
    border: 0;
    gap: 0.45rem;
}
.app-subtabs .nav-link {
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-muted-foreground);
    background: var(--app-card);
    padding: 0.38rem 0.78rem;
    font-weight: 600;
    font-size: 0.88rem;
}
.app-subtabs .nav-link:hover {
    color: var(--primary-color);
    border-color: rgba(190, 29, 79, 0.35);
}
.app-subtabs .nav-link.active {
    background: linear-gradient(135deg, rgba(229, 57, 99, 0.16), rgba(190, 29, 79, 0.24));
    color: var(--primary-color);
    border-color: rgba(190, 29, 79, 0.34);
}

.app-kpi-tile .card-body h6 {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.app-kpi-tile .card-body h4 {
    margin-bottom: 0.2rem;
    font-weight: 700;
}
.app-kpi-tile .card-body small {
    color: var(--app-muted-foreground);
}
.app-kpi-pink { border-left: 4px solid #e53963 !important; }
.app-kpi-red { border-left: 4px solid #dc3545 !important; }
.app-kpi-blue { border-left: 4px solid #0d6efd !important; }
.app-kpi-dark { border-left: 4px solid #6c757d !important; }

.app-panel-card .card-header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* Invoices compact table notes/status */
.invoice-notes-cell {
    max-width: 220px;
}
.invoice-notes-truncate {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: 2.7em;
}

/* Follow-up modal modern refresh */
.followup-edit-modal .modal-dialog {
    max-width: 1180px;
}
.followup-edit-modal .modal-content {
    border: 1px solid var(--crm-border);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}
.followup-edit-modal .modal-body {
    padding: 14px 14px 10px;
}
.followup-edit-modal .tab-content {
    background: transparent !important;
}
.followup-edit-modal .tab-pane {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    padding: 12px;
}
.followup-edit-modal .form-label.small {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--crm-muted-foreground);
}
.followup-edit-modal .form-text {
    font-size: 11px;
}
.followup-edit-modal .form-control,
.followup-edit-modal .form-select {
    border-radius: 10px !important;
    min-height: 32px;
    font-size: 12px;
}
.followup-edit-modal textarea.form-control {
    min-height: 72px;
}
.followup-edit-modal .followup-edit-tabs {
    border: 0;
    margin-bottom: 10px !important;
}
.followup-edit-modal .followup-edit-tabs .nav-link {
    border-radius: 999px;
    border: 1px solid var(--crm-border);
    background: var(--crm-card);
    color: var(--crm-muted-foreground);
    font-size: 12px;
    padding: 0.35rem 0.75rem;
}
.followup-edit-modal .followup-edit-tabs .nav-link.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.2)) !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
}
.followup-edit-modal .followup-invoice-chip {
    border-radius: 999px;
}
.followup-edit-modal #followupRecordsList {
    border: 1px dashed var(--crm-border);
    border-radius: 10px;
    padding: 10px;
    background: color-mix(in srgb, var(--crm-card) 88%, var(--crm-muted) 12%);
}
.followup-records-timeline {
    display: grid;
    gap: 8px;
}
.followup-record-item {
    border: 1px solid var(--crm-border);
    background: var(--crm-card);
    border-radius: 10px;
    padding: 8px 10px;
}
.followup-record-item .badge {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
}
.followup-edit-modal .modal-footer {
    background: var(--crm-card) !important;
    border-top: 1px solid var(--crm-border) !important;
    padding: 10px 14px;
}
.followup-edit-modal .modal-footer .btn {
    border-radius: 10px;
    min-width: 96px;
}

/* === Global readability fixes (light + dark) === */
html:not(.dark) .tab-content,
html:not(.dark) .tab-content *:not(.btn):not(.badge):not(i) {
    color: #0f172a !important;
}
html:not(.dark) .tab-content .text-muted {
    color: #475569 !important;
}
html:not(.dark) .tab-content .table thead th {
    color: #334155 !important;
    background: #e2e8f0 !important;
}
html:not(.dark) .tab-content .table tbody td {
    color: #0f172a !important;
    background: #ffffff !important;
}
html:not(.dark) .tab-content .form-control,
html:not(.dark) .tab-content .form-select {
    color: #0f172a !important;
    background: #ffffff !important;
}
html:not(.dark) .tab-content .form-control::placeholder {
    color: #64748b !important;
}

html.dark .tab-content,
html.dark .tab-content *:not(.btn):not(.badge):not(i) {
    color: #e2e8f0 !important;
}
html.dark .tab-content .text-muted {
    color: #94a3b8 !important;
}
html.dark .tab-content .table thead th {
    color: #cbd5e1 !important;
    background: #334155 !important;
}
html.dark .tab-content .table tbody td {
    color: #e2e8f0 !important;
    background: #1e293b !important;
}
html.dark .tab-content .form-control,
html.dark .tab-content .form-select {
    color: #e2e8f0 !important;
    background: #1e293b !important;
    border-color: #475569 !important;
}
html.dark .tab-content .form-control::placeholder {
    color: #94a3b8 !important;
}

/* Admin tabs page specific */
.tab-status-map .table td,
.tab-status-map .table th,
.tab-status-map label,
.tab-status-map .form-text {
    color: inherit !important;
}

/* ========== CRM project UI (Flatrix Ops) ========== */
.app-sidebar {
    width: 240px;
    background: var(--app-nav-bg);
    border-right: 1px solid var(--app-border);
    padding: 1.1rem 0.75rem;
}
.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.5rem 1rem;
}
.app-brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: grid;
    place-items: center;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    background: var(--primary-gradient);
    flex-shrink: 0;
}
.app-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.app-brand-title { font-size: 0.88rem; font-weight: 600; color: var(--app-foreground); letter-spacing: -0.01em; }
.app-brand-sub {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-muted-foreground);
}
.app-sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; padding: 0 0.15rem; }
.app-side-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--app-muted-foreground);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.app-side-link i { font-size: 1rem; width: 1rem; text-align: center; }
.app-side-link:hover { background: var(--app-muted); color: var(--app-foreground); }
.app-side-link.active {
    background: var(--app-muted);
    color: var(--app-foreground);
    font-weight: 600;
}
.app-side-dot {
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}
.app-sidebar-user { padding: 0.75rem 0.35rem 0.25rem; border-top: 1px solid var(--app-border); }
.app-user-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    background: var(--crm-surface-2, var(--app-muted));
    border: 1px solid var(--app-border);
}
.app-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, rgba(124, 109, 240, 0.85), rgba(124, 109, 240, 0.45));
    flex-shrink: 0;
}
.app-user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-user-name { font-size: 0.78rem; font-weight: 600; color: var(--app-foreground); }
.app-user-role { font-size: 0.68rem; color: var(--app-muted-foreground); }
.app-topbar {
    height: 3.5rem;
    padding: 0 1.25rem;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--app-border);
}
.app-topbar-title { font-size: 0.9rem; font-weight: 600; color: var(--app-foreground); }
.app-topbar-sub { font-size: 0.68rem; color: var(--app-muted-foreground); margin-top: 1px; }
.app-sync-badge {
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    padding: 0 0.65rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    color: var(--app-muted-foreground);
    background: var(--crm-surface-2, var(--app-muted));
    border: 1px solid var(--app-border);
}
.app-sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--crm-success);
    animation: crm-pulse 2s ease-in-out infinite;
}
@keyframes crm-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.app-btn-ghost {
    color: var(--app-muted-foreground) !important;
    border: 1px solid var(--app-border) !important;
    background: var(--crm-surface-2, var(--app-muted)) !important;
    border-radius: 0.4rem !important;
}
.app-btn-ghost:hover { color: var(--app-foreground) !important; background: var(--app-muted) !important; }
.app-btn-ghost-danger {
    color: var(--crm-danger) !important;
    border: 1px solid color-mix(in srgb, var(--crm-danger) 35%, transparent) !important;
    background: color-mix(in srgb, var(--crm-danger) 10%, transparent) !important;
    border-radius: 0.4rem !important;
}
.app-btn-ghost-danger:hover {
    background: color-mix(in srgb, var(--crm-danger) 18%, transparent) !important;
}
.content-wrapper { padding: 1.25rem 1.5rem 1.5rem !important; }
.app-page { max-width: 100%; }

/* Stat cards */
.crm-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 992px) { .crm-stat-grid { grid-template-columns: repeat(4, 1fr); } }
.crm-stat-card {
    position: relative;
    border-radius: 0.75rem;
    border: 1px solid var(--crm-border);
    background: var(--crm-card);
    padding: 1rem 1.1rem;
    overflow: hidden;
}
.crm-stat-card::before {
    content: '';
    position: absolute;
    top: -3rem;
    right: -3rem;
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    background: var(--primary-gradient);
    opacity: 0.07;
    filter: blur(24px);
    pointer-events: none;
}
.crm-stat-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-muted-foreground);
}
.crm-stat-value {
    margin-top: 0.65rem;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--crm-foreground);
    font-variant-numeric: tabular-nums;
}
.crm-stat-hint { margin-top: 0.25rem; font-size: 0.68rem; color: var(--crm-muted-foreground); }
.crm-stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1rem;
    opacity: 0.85;
}
.crm-stat-card--danger .crm-stat-value, .crm-stat-card--danger .crm-stat-icon { color: var(--crm-danger); }
.crm-stat-card--success .crm-stat-value, .crm-stat-card--success .crm-stat-icon { color: var(--crm-success); }
.crm-stat-card--primary .crm-stat-icon { color: var(--primary-color); }

/* Status pills */
.crm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}
.crm-status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}
.crm-status-pill--upcoming {
    background: color-mix(in srgb, var(--crm-success) 12%, transparent);
    color: var(--crm-success);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--crm-success) 22%, transparent);
}
.crm-status-pill--overdue {
    background: color-mix(in srgb, var(--crm-danger) 12%, transparent);
    color: var(--crm-danger);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--crm-danger) 25%, transparent);
}
.crm-status-pill--unrecoverable {
    background: var(--crm-muted);
    color: var(--crm-muted-foreground);
    box-shadow: inset 0 0 0 1px var(--crm-border);
}
.crm-status-pill--test, .crm-status-pill--all {
    background: color-mix(in srgb, var(--crm-warning) 12%, transparent);
    color: var(--crm-warning);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--crm-warning) 25%, transparent);
}

/* Action buttons */
.crm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    border: 1px solid var(--crm-border);
    background: var(--crm-surface-2, var(--crm-muted));
    color: var(--crm-muted-foreground);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.crm-action-btn:hover { color: var(--crm-foreground); background: var(--crm-muted); }
.crm-action-btn--primary {
    border-color: color-mix(in srgb, var(--primary-color) 35%, transparent);
    color: var(--primary-color);
}
.crm-action-btn--primary:hover { background: color-mix(in srgb, var(--primary-color) 12%, transparent); }
.crm-action-btn--success {
    border-color: color-mix(in srgb, var(--crm-success) 35%, transparent);
    color: var(--crm-success);
}
.crm-action-btn--success:hover { background: color-mix(in srgb, var(--crm-success) 12%, transparent); }
.crm-action-count {
    margin-left: 2px;
    padding: 0 0.25rem;
    border-radius: 0.2rem;
    font-size: 0.58rem;
    font-weight: 700;
    background: color-mix(in srgb, currentColor 12%, transparent);
}

/* Invoice board — CRM toolbar */
.invoice-board .invoice-toolbar {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
}
.invoice-board .invoice-segment {
    background: var(--crm-surface-2, var(--crm-muted));
    border: 1px solid var(--crm-border);
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}
.invoice-board .invoice-segment .crm-tab-trigger {
    border: 0;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    color: var(--crm-muted-foreground);
}
.invoice-board .invoice-segment .crm-tab-trigger.active {
    background: var(--crm-card);
    color: var(--crm-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.invoice-board .invoice-tab-count {
    background: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.58rem;
}
.invoice-board .invoice-segment .crm-tab-trigger.active .invoice-tab-count {
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    color: var(--primary-color);
}
.invoice-board .invoice-search-input {
    background: var(--crm-surface-2, var(--app-input-bg)) !important;
    border-color: var(--crm-border) !important;
    color: var(--crm-foreground) !important;
    font-size: 0.75rem;
    min-height: 2.25rem;
    padding-left: 2rem;
}
.invoice-board .invoice-tool-btn {
    font-size: 0.75rem;
    min-height: 2.25rem;
    border-radius: 0.4rem !important;
    background: var(--crm-surface-2, var(--app-muted)) !important;
    border: 1px solid var(--crm-border) !important;
    color: var(--crm-foreground) !important;
}
.invoice-board .invoice-tool-btn.btn-primary {
    background: var(--primary-gradient) !important;
    border: none !important;
    color: #fff !important;
}
.invoice-board .crm-card-elevated {
    margin: 0;
    border-radius: 0.75rem;
    border: 1px solid var(--crm-border);
    background: var(--crm-card);
}
.invoice-board .invoice-grid thead th {
    background: color-mix(in srgb, var(--crm-muted) 60%, var(--crm-card));
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-muted-foreground);
    border-color: var(--crm-border);
    padding: 0.75rem 0.65rem;
}
.invoice-board .invoice-grid tbody td {
    font-size: 0.75rem;
    border-color: var(--crm-border);
    padding: 0.65rem;
    vertical-align: top;
}
.invoice-board .invoice-grid tbody tr:hover { background: color-mix(in srgb, var(--crm-muted) 50%, transparent); }
.invoice-board .invoice-grid .font-mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}
.invoice-board .invoice-grid td.text-overdue { color: var(--crm-danger); }
.invoice-flatrix-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid color-mix(in srgb, var(--crm-success) 30%, transparent);
    background: color-mix(in srgb, var(--crm-success) 12%, transparent);
    color: var(--crm-success);
}
.invoice-flatrix-badge.is-off {
    border-color: var(--crm-border);
    background: var(--crm-surface-2, var(--crm-muted));
    color: var(--crm-muted-foreground);
}
.invoice-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--crm-border);
    background: color-mix(in srgb, var(--crm-muted) 40%, transparent);
    font-size: 0.68rem;
    color: var(--crm-muted-foreground);
}

/* Follow-up modal — CRM style */
.followup-edit-modal .modal-content {
    border-radius: 1rem;
    border: 1px solid var(--crm-border);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
}
.followup-edit-modal__header {
    background: var(--crm-card) !important;
    color: var(--crm-foreground) !important;
    border-bottom: 1px solid var(--crm-border) !important;
    padding: 1rem 1.25rem !important;
}
.followup-edit-modal__header .modal-title { font-size: 1rem; font-weight: 600; }
.followup-edit-modal__header .btn-close { filter: none; opacity: 0.55; }
.dark .followup-edit-modal__header .btn-close { filter: invert(1); }
.followup-edit-tabs { border-bottom: 1px solid var(--crm-border) !important; gap: 0.25rem; }
.followup-edit-tabs .nav-link.active {
    background: transparent !important;
    color: var(--primary-color) !important;
    border-color: transparent !important;
    border-bottom: 2px solid var(--primary-color) !important;
    border-radius: 0 !important;
}
.followup-edit-modal .btn-primary {
    box-shadow: 0 10px 40px -12px color-mix(in srgb, var(--primary-color) 45%, transparent);
}

/* Dashboard KPI tiles */
.app-kpi-tile {
    border: 1px solid var(--crm-border) !important;
    background: var(--crm-card) !important;
    border-left-width: 3px !important;
}
.app-kpi-tile .card-body h6 { color: var(--crm-muted-foreground) !important; }
.app-kpi-tile .card-body h4 { color: var(--crm-foreground) !important; }
.app-kpi-pink { border-left-color: var(--primary-color) !important; }
.app-kpi-red { border-left-color: var(--crm-danger) !important; }
.app-kpi-blue { border-left-color: #5b9cf5 !important; }
.app-kpi-dark { border-left-color: var(--crm-muted-foreground) !important; }

/* Login */
body.login-page { background: var(--app-bg) !important; }
.login-box { border-radius: 1rem !important; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.4) !important; }

/* ========== Invoice board — match CRM mockup closely ========== */
.invoice-board .crm-table.invoice-grid {
    border: 0;
}
.invoice-board .crm-table.invoice-grid thead th,
.invoice-board .crm-table.invoice-grid tbody td {
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--crm-border) !important;
    background: transparent !important;
}
.invoice-board .crm-table.invoice-grid tbody tr:last-child td {
    border-bottom: 0 !important;
}
.invoice-board .crm-table.invoice-grid thead th {
    position: static;
    height: auto;
    background: color-mix(in srgb, var(--crm-muted) 55%, var(--crm-card)) !important;
}
html.dark .invoice-board .crm-table.invoice-grid thead th,
html.dark .invoice-board .crm-table.invoice-grid tbody td {
    color: var(--crm-foreground) !important;
    background: transparent !important;
}
html.dark .invoice-board .crm-table.invoice-grid thead th {
    color: var(--crm-muted-foreground) !important;
    background: color-mix(in srgb, var(--crm-muted) 55%, var(--crm-card)) !important;
}
.invoice-board .crm-status-pill {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.invoice-contact-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.3;
    min-width: 120px;
}
.invoice-contact-name {
    font-weight: 500;
    color: var(--crm-foreground);
    font-size: 0.75rem;
}
.invoice-contact-phone {
    font-size: 0.68rem;
    color: var(--crm-muted-foreground);
}
.invoice-company-name {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--crm-foreground);
    max-width: 220px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.invoice-desc-cell {
    max-width: 260px;
}
.invoice-desc-text {
    color: color-mix(in srgb, var(--crm-foreground) 82%, transparent);
    font-size: 0.75rem;
}
.invoice-desc-more {
    border: 0;
    background: none;
    padding: 0;
    margin-left: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
}
.invoice-desc-more:hover { text-decoration: underline; }
.invoice-notes-text {
    font-size: 0.72rem;
    font-style: italic;
    color: var(--crm-muted-foreground);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 180px;
}
.invoice-row-actions {
    min-width: 280px;
}
.invoice-row-actions .crm-action-btn {
    flex-shrink: 0;
}
.crm-stat-card--rate .crm-stat-value,
.crm-stat-card--rate .crm-stat-icon {
    color: var(--primary-color);
}
.invoice-board .invoice-search-form .form-control:focus {
    border-color: color-mix(in srgb, var(--primary-color) 50%, transparent) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 25%, transparent) !important;
}
/* Don't let global tab-content overrides flatten invoice board */
.invoice-board,
.invoice-board *:not(.btn):not(.badge):not(i):not(.bi) {
    color: inherit;
}
.invoice-board .crm-stat-value,
.invoice-board .crm-stat-label,
.invoice-board .invoice-company-name,
.invoice-board .invoice-contact-name {
    color: var(--crm-foreground) !important;
}
.invoice-board .crm-stat-hint,
.invoice-board .invoice-contact-phone,
.invoice-board .text-muted {
    color: var(--crm-muted-foreground) !important;
}
