:root {
    --bg: #0b1220;
    --bg-hero-start: #1a2a6c;
    --bg-hero-end: #141b2d;
    --card-bg: #0f1628;
    --text: #e6e8ef;
    --muted: #cfd8e3b4;
    --accent: #7bd88f;
    --primary: #7bd88f;
    --primary-text: #0b1220;
    --input-bg: #0b1220;
    --input-border: #26324a;
    --card-shadow: 0 10px 40px rgba(0, 0, 0, .35);
    --toast-success: #28a745;
    --toast-error: #dc3545;
    --toast-info: #0d6efd;
    --toast-warn: #ffc107;
    --radius-lg: 20px;
    --radius-md: 12px;
    --ui-transition: 220ms ease;
    --form-select-bg-img: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>");
    --dt-sort-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3e%3cpath fill='%2326324a' d='M27.66 224h264.7c24.6 0 36.89-29.78 19.54-47.12L177.2 25.12c-9.375-9.375-24.57-9.375-33.94 0L7.125 176.9C-10.22 194.2 2.063 224 27.66 224zM292.3 288H27.66c-24.6 0-36.89 29.78-19.54 47.12l130.5 151.8c9.375 9.375 24.57 9.375 33.94 0l130.5-151.8C329.2 317.8 316.9 288 292.3 288z'/%3e%3c/svg%3e") !important;
    --dt-sort-icon-active: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3e%3cpath fill='%237bd88f' d='M27.66 224h264.7c24.6 0 36.89-29.78 19.54-47.12L177.2 25.12c-9.375-9.375-24.57-9.375-33.94 0L7.125 176.9C-10.22 194.2 2.063 224 27.66 224zM292.3 288H27.66c-24.6 0-36.89 29.78-19.54 47.12l130.5 151.8c9.375 9.375 24.57 9.375 33.94 0l130.5-151.8C329.2 317.8 316.9 288 292.3 288z'/%3e%3c/svg%3e") !important;
}

/* Base */
body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.45;
}

.hero {
    background: radial-gradient(80% 80% at 50% 10%, var(--bg-hero-start), transparent), linear-gradient(120deg, var(--bg), var(--bg-hero-end));
}

.h-savings {
    font-size: 2.2rem;
    font-weight: 800
}

/* Hero tweaks for small screens */
@media (max-width: 767px) {
    .hero {
        padding: 1.6rem 0;
    }

    .h-savings {
        font-size: 1.25rem;
    }
}

/* Layout containers */
.container,
.container-fluid {
    max-width: 1200px;
}

.card {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    background: linear-gradient(180deg, rgba(123, 216, 143, 0.02), rgba(255, 255, 255, 0.01)), linear-gradient(180deg, rgba(255, 255, 255, 0.01), var(--card-bg));
    color: var(--text);
}

.brand {
    font-weight: 800;
    letter-spacing: .3px
}

/* Navbar wrapping/responsive tweaks */
#mainNavbar {
    background: var(--bg);
}

.navbar {
    flex-wrap: wrap;
}

.navbar .navbar-brand {
    white-space: normal;
    word-break: break-word;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Navbar toggler visual refinement */
.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
}

.nav-link.nav-action {
    transition: color var(--ui-transition);
}

.nav-link.nav-action:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-link.active {
    color: var(--accent, #7bd88f);
    font-weight: 600;
}

.pill {
    font-size: .78rem
}

.accent {
    color: var(--accent)
}

a,
a:hover {
    color: var(--accent)
}

a:focus-visible,
button:focus-visible,
.form-control:focus-visible {
    outline: 3px solid rgba(123, 216, 143, 0.12);
    outline-offset: 2px;
}

/* Buttons: subtle shadow and active press behaviour */
.btn {
    transition: transform var(--ui-transition), box-shadow var(--ui-transition), filter var(--ui-transition);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary,
.btn-success {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
    font-weight: 700
}

.btn-primary:focus-visible,
.btn-success:focus-visible,
.btn:focus-visible {
    outline: 3px solid rgba(123, 216, 143, 0.18);
    outline-offset: 3px;
}

.btn-primary:hover {
    filter: brightness(.95)
}

/* Inputs */
.input-dark {
    background: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text)
}

/* Inputs */
.form-control,
.form-select,
input[type="date"] {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.00));
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--text);
}

.form-control:focus,
.form-select:focus,
input[type="date"]:focus {
    background: var(--input-bg);
    border-color: var(--accent);
    box-shadow: 0 8px 28px rgba(123, 216, 143, 0.08);
    color: var(--text);
}

.form-control::placeholder,
.form-select::placeholder {
    color: var(--muted);
}

::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.form-control[disabled],
.form-select[disabled],
input[type="date"][disabled] {
    opacity: 0.7;
}

.form-select,
.form-select:focus {
    background-image: var(--form-select-bg-img);
    background-repeat: no-repeat, no-repeat;
    background-position: right .75rem center, 0 0;
    background-size: 1rem auto, 100% 100%;
    padding-right: 2.5rem;
}

.form-check-label {
    color: var(--text);
}

/* Muted / accessibility */
.text-muted {
    color: var(--muted) !important;
}

.text-muted small {
    color: var(--muted) !important;
}

/* Utility tweaks */
footer.small {
    color: var(--muted)
}

/* Modal styles (dark theme) - use theme variables where possible */
.modal-content {
    background-color: var(--card-bg);
    color: var(--text);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: var(--card-shadow);
}

.modal-header,
.modal-footer {
    border-color: rgba(255, 255, 255, 0.04);
    background: transparent;
}

.modal-title {
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    max-height: 60vh;
    overflow: auto;
}

/* Responsive modal on small viewports */
@media (max-width: 576px) {
    .modal-dialog {
        max-width: calc(100% - 1rem);
        margin: 0.5rem;
    }

    .modal-body {
        max-height: 65vh;
    }
}

/* small helper for an offer preview inside the modal */
.lead-offer-preview {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    border-radius: 8px;
    padding: 0.65rem;
    border: 1px solid var(--input-border);
    margin-bottom: 0.75rem;
    transition: box-shadow var(--ui-transition), transform var(--ui-transition);
}

.lead-offer-preview:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

/* Admin dashboard helpers */
.admin-spark {
    width: 120px;
    height: 64px;
    margin-left: 1rem;
}

.card-anim {
    will-change: transform, opacity;
}

.count-up {
    font-variant-numeric: tabular-nums;
}

.btn-wrapped {
    white-space: normal;
}

/* Notifications / toasts */
.floating-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.floating-toast {
    pointer-events: auto;
    min-width: 220px;
    max-width: 360px;
    padding: .6rem .8rem;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    background: rgba(20, 24, 36, 0.95);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.floating-toast .toast-body {
    flex: 1 1 auto;
    padding-right: .6rem;
}

.floating-toast .toast-close {
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.floating-toast.success {
    border-left: 4px solid var(--toast-success);
}

.floating-toast.error {
    border-left: 4px solid var(--toast-error);
}

.floating-toast.info {
    border-left: 4px solid var(--toast-info);
}

.floating-toast.warn {
    border-left: 4px solid var(--toast-warn);
}

/* Confirm modal tweaks (uses bootstrap modal) */
.confirm-modal .modal-content {
    background: var(--card-bg);
    color: var(--text);
}

.confirm-modal .modal-footer .btn {
    min-width: 100px;
}

/* Table Core Styles */
table.dataTable {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--input-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: rgba(123, 216, 143, 0.05);
    --bs-table-hover-color: var(--text);
}

table.dataTable thead th {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text);
    font-weight: 600;
    border-bottom-width: 2px;
    border-color: var(--input-border);
}

table.dataTable tbody td {
    vertical-align: middle;
}

.table.dataTable tbody td a {
    text-decoration: none;
    font-weight: 500;
}

.dt-search label,
.dt-length label {
    color: var(--muted);
    font-size: 0.9rem;
}

.dt-info {
    color: var(--muted);
    font-size: 0.9rem;
    padding-top: 0.5rem !important;
}

.pagination {
    --bs-pagination-color: var(--text);
    --bs-pagination-bg: var(--card-bg);
    --bs-pagination-border-color: var(--input-border);

    --bs-pagination-disabled-color: var(--muted);
    --bs-pagination-disabled-bg: var(--card-bg);
    --bs-pagination-disabled-border-color: var(--input-border);
    --bs-pagination-disabled-opacity: 0.5;

    --bs-pagination-hover-color: var(--text);
    --bs-pagination-hover-bg: var(--input-border);
    --bs-pagination-hover-border-color: var(--input-border);

    --bs-pagination-focus-color: var(--text);
    --bs-pagination-focus-bg: var(--input-border);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(123, 216, 143, 0.25);

    --bs-pagination-active-color: var(--primary-text);
    --bs-pagination-active-bg: var(--primary);
    --bs-pagination-active-border-color: var(--primary);
}

.dt-paging .pagination {
    border-radius: var(--radius-md);
}

.dt-processing {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
}

/* Password meter styles */
.password-meter {
    margin-top: 6px
}

.password-meter .meter {
    background: rgba(255, 255, 255, 0.04);
    height: 8px;
    border-radius: 6px;
    overflow: hidden
}

.password-meter .meter-bar {
    width: 0;
    height: 100%;
    background: #dc3545;
    transition: width 180ms ease
}

.password-meter .meter-text {
    font-size: 12px;
    color: #cfd8e3b4;
    margin-top: 6px
}

details>summary {
    cursor: pointer;
    color: var(--accent);
    transition: color var(--ui-transition);
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

details>summary:hover {
    color: var(--text);
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary::before {
    content: '+';
    font-weight: bold;
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease-in-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

details[open]>summary::before {
    transform: rotate(45deg);
}

#chart-agent-leads,
#chart-agent-savings {
    height: 300px;
    max-height: 300px;
}