/* LeadAdd pages on top of the Metronic theme. Phones first; "lg" (992px) is the desktop layout. */

.la-main { padding: 16px 0 24px; min-width: 0; }
.la-page { max-width: 1320px; margin: 0 auto; width: 100%; }
.la-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.la-touch { min-width: 44px; min-height: 44px; }
.la-account { min-width: 0; }
.la-account-select { width: min(300px, 55vw); }
.la-break { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

/* ---- Bottom navigation (phones) ---- */
.la-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 106; display: flex;
    background: #fff; border-top: 1px solid #e4e6ef; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.la-bottom-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 58px; border: 0; background: none; color: #5e6278; font-size: .75rem; font-weight: 600;
}
.la-bottom-item i { font-size: 1.35rem; color: inherit; }
.la-bottom-item.active { color: #1b64be; }
.la-bottom-icon { position: relative; display: inline-flex; }
.la-bottom-icon .la-issue-badge { position: absolute; top: -6px; left: 14px; font-size: .65rem; }
.la-sheet-backdrop { position: fixed; inset: 0; z-index: 107; background: rgba(0, 0, 0, .4); }
.la-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 108; background: #fff; border-radius: 16px 16px 0 0;
    max-height: 80vh; overflow-y: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.la-sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 8px; font-weight: 700; }
.la-sheet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.la-sheet-link {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid #eff2f5;
    border-radius: 10px; color: #181c32; font-weight: 600;
}
.la-sheet-link i { font-size: 1.25rem; color: #5e6278; }
@media (max-width: 991.98px) {
    /* The theme fixes the body height, which would leave the end of a long page under the bar */
    body.la-has-bottom { height: auto; min-height: 100%; padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
    body.la-has-bottom .scrolltop { bottom: 80px; }
}

/* ---- Date range ---- */
.la-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.la-chips { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: thin; }
.la-chip {
    flex: 0 0 auto; min-height: 40px; min-width: 48px; padding: 6px 14px; border-radius: 20px; border: 1px solid #e4e6ef;
    background: #fff; color: #3f4254; font-weight: 600; white-space: nowrap;
}
.la-chip[aria-pressed="true"] { background: #1b64be; border-color: #1b64be; color: #fff; }
.la-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.la-dates input { width: 160px; }

/* ---- Home ---- */
.la-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 992px) { .la-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.la-tile { background: #fff; border-radius: 12px; padding: 14px 16px; border: 1px solid #eff2f5; display: block; color: inherit; }
.la-tile-label { color: #7e8299; font-size: .8rem; font-weight: 600; }
.la-tile-value { color: #181c32; font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.la-tile-note { color: #5e6278; font-size: .8rem; }
.la-chart { min-height: 300px; }
.la-table-view { max-height: 320px; overflow: auto; }

/* Weekday by hour: one blue, darker for more leads */
.la-heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: .7rem; color: #5e6278; }
.la-heat-cell { border: 0; padding: 0; height: 22px; border-radius: 3px; background: #f1f3f6; }
.la-heat-cell[data-level="1"] { background: #cce3fd; }
.la-heat-cell[data-level="2"] { background: #9dc8f7; }
.la-heat-cell[data-level="3"] { background: #6aabf1; }
.la-heat-cell[data-level="4"] { background: #257de0; }
.la-heat-cell[data-level="5"] { background: #0f4a96; }
.la-heat-cell:focus-visible { outline: 2px solid #181c32; }
.la-heat-day { display: flex; align-items: center; font-weight: 600; }
.la-heat-hour { text-align: left; white-space: nowrap; overflow: visible; }

/* ---- Lists of leads and issues ---- */
.la-rows { display: flex; flex-direction: column; gap: 10px; }
.la-card { background: #fff; border: 1px solid #eff2f5; border-radius: 12px; padding: 14px; }
.la-lead { display: flex; align-items: center; gap: 12px; }
.la-lead-main { flex: 1; min-width: 0; color: inherit; display: block; }
.la-lead-name { color: #181c32; font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-lead-meta { color: #7e8299; font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.la-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.la-details { white-space: pre-wrap; overflow-wrap: anywhere; background: #f9f9f9; border-radius: 8px; padding: 10px; font-size: .8rem; max-height: 260px; overflow: auto; }
.la-fields { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.la-fields dt { color: #7e8299; font-size: .8rem; font-weight: 600; margin-top: 10px; }
.la-fields dd { margin: 0; color: #181c32; overflow-wrap: anywhere; }
@media (min-width: 768px) { .la-fields { grid-template-columns: 220px 1fr; } .la-fields dt { margin-top: 6px; } .la-fields dd { margin-top: 6px; } }
.la-timeline { list-style: none; margin: 0; padding: 0; }
.la-timeline > li { border-top: 1px solid #eff2f5; padding: 12px 0; }
.la-timeline > li:first-child { border-top: 0; }
.la-empty { text-align: center; padding: 40px 16px; color: #5e6278; }

@media (max-width: 575.98px) {
    .la-account-select { width: 52vw; }
}

/* Wide tables on the older pages scroll inside themselves instead of stretching the page */
@media (max-width: 991.98px) {
    .app-content .card-body, .modal-body { overflow-x: auto; }
}

/* Long values in the desktop table are cut off, with the full text on hover */
.la-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tableCard td:first-child { min-width: 160px; max-width: 280px; overflow-wrap: anywhere; }
#tableCard .badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; display: inline-block; white-space: nowrap; }

/* Alert rules, opt-in records, team and API tokens: each table row becomes a card on a phone */
@media (max-width: 767.98px) {
    #kt_notificationactions_table thead, #dataTable_optin thead, #dataTable_team thead, #dataTable_apitokens thead { display: none; }
    #kt_notificationactions_table, #dataTable_optin, #dataTable_team, #dataTable_apitokens,
    #kt_notificationactions_table tbody, #dataTable_optin tbody, #dataTable_team tbody, #dataTable_apitokens tbody,
    #kt_notificationactions_table tr, #dataTable_optin tr, #dataTable_team tr, #dataTable_apitokens tr { display: block; width: 100% !important; }
    #kt_notificationactions_table tbody tr, #dataTable_optin tbody tr, #dataTable_team tbody tr, #dataTable_apitokens tbody tr {
        border: 1px solid #e4e6ef; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
    }
    #kt_notificationactions_table tbody td, #dataTable_optin tbody td, #dataTable_team tbody td, #dataTable_apitokens tbody td {
        display: block; width: 100% !important; border: 0 !important; padding: 4px 0 !important; overflow-wrap: anywhere; text-align: left !important;
    }
    #kt_notificationactions_table .btn, #dataTable_team .btn, #dataTable_apitokens .btn { min-height: 40px; }
}

/* ======================================================================
   One look for every screen: the older pages take the same colours, cards,
   controls, tables and dialogs as Home, Leads and Issues.
   ====================================================================== */
:root, [data-bs-theme="light"] {
    --kt-primary: #1b64be; --kt-primary-active: #154f97; --kt-primary-light: #e8f0fb; --kt-primary-rgb: 27, 100, 190; --kt-primary-inverse: #ffffff;
    --kt-text-primary: #1b64be; --kt-link-color: #1b64be; --kt-link-hover-color: #154f97; --kt-component-hover-color: #1b64be;
    --kt-component-active-bg: #1b64be; --kt-component-checked-bg: #1b64be;
    --bs-primary: #1b64be; --bs-primary-rgb: 27, 100, 190; --bs-link-color: #1b64be; --bs-link-hover-color: #154f97;
}
body, body.app-default, body.auth-bg { font-family: Inter, system-ui, sans-serif; background-color: #f5f7fa !important; background-image: none !important; }

/* Page headings */
.la-pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* Cards */
.card { background: #fff; border: 1px solid #eff2f5; border-radius: 12px; box-shadow: none; }
.card.card-flush { box-shadow: none; }
.card > .card-header { min-height: 60px; padding: 0 20px; }
.card > .card-body { padding: 20px; }
.card .card-header + .card-body { padding-top: 12px; }
.card .card-title h2, .card .card-title h3 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.card-header .card-title, .card-header .card-toolbar { flex-wrap: wrap; gap: 8px; margin-top: 8px; margin-bottom: 8px; }

/* Buttons and form controls */
.btn { border-radius: 8px; }
.btn:not(.btn-icon):not(.btn-sm):not(.btn-link):not(.la-chip) { min-height: 42px; }
.form-control, .form-select { border-radius: 8px; }
.form-control:not(textarea):not(.form-control-sm), .form-select:not(.form-select-sm) { min-height: 44px; }
.form-control.form-control-solid, .form-select.form-select-solid { background-color: #fff; border: 1px solid #e4e6ef; }
.form-control:focus, .form-select:focus, .form-control.form-control-solid:focus { border-color: #1b64be; background-color: #fff; }
.input-group > .form-control, .input-group > .form-select { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.input-group > :last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.badge { border-radius: 6px; }

/* Tables */
.table > thead > tr > th { color: #7e8299; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.table > tbody > tr > td { vertical-align: middle; }

/* Dialogs, drawers, tabs and notices */
.modal-content { border-radius: 16px; border: 0; }
.alert { border-radius: 12px; }
.nav-pills .nav-link { border-radius: 20px; font-weight: 600; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: #1b64be; color: #fff; }
.nav-line-tabs .nav-item .nav-link.active { border-bottom-color: #1b64be; color: #1b64be; }
.swal2-popup { border-radius: 16px; }

@media (max-width: 575.98px) {
    .card > .card-header { padding: 0 14px; }
    .card > .card-body { padding: 14px; }
    .modal-dialog:not(.modal-fullscreen) { margin: 8px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 16px !important; padding-right: 16px !important; }
    .card-toolbar > [data-kt-customer-table-toolbar="base"] { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 991.98px) {
    /* The older pages' own side padding on top of the page padding wastes a phone's width */
    .app-main .app-content { padding-left: 0; padding-right: 0; }
    .nav-line-tabs, .nav-pills { flex-wrap: nowrap; overflow-x: auto; }
    .nav-line-tabs .nav-item, .nav-pills .nav-item { white-space: nowrap; }
}

/* ---- Signed-out pages: sign in, sign up, passwords, verification, terms ---- */
.la-auth-root { min-height: 100vh; }
.la-auth-main { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; }
.la-auth-logo { display: block; margin: 8px auto 20px; }
.la-auth-logo img { height: 36px; max-width: 220px; }
.la-auth-card { width: 100%; max-width: 480px; margin: 0 auto; background: #fff; border: 1px solid #eff2f5; border-radius: 16px; padding: 28px 22px; }
.la-auth-card h1 { font-size: 1.5rem; }
.la-auth-foot { width: 100%; max-width: 480px; margin: 16px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.la-auth .form-control.bg-transparent.border-primary, .la-auth .form-check-input.border-primary { border-color: #e4e6ef !important; background-color: #fff !important; }
.la-auth .form-control.bg-transparent.border-primary:focus { border-color: #1b64be !important; }
.la-auth .form-check-input.border-primary:checked { background-color: #1b64be !important; border-color: #1b64be !important; }
.la-auth .btn[type="submit"], .la-auth button.btn-primary { width: 100%; }
.la-public { padding: 16px; }
.la-public-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto 16px; }
.la-public-top img { height: 30px; }
.la-public-body { max-width: 960px; margin: 0 auto; }

/* The sign-in cards: full-width actions, and a six digit code on one line */
.la-auth-card a.btn.btn-light, .la-auth-card .btn-primary { width: 100%; margin-left: 0 !important; margin-right: 0 !important; }
.la-auth-card a.btn.btn-light { display: flex; align-items: center; justify-content: center; margin-top: 10px; }
.la-auth-card input[name^="code_"] { width: calc((100% - 36px) / 6) !important; min-width: 0; margin: 8px 3px !important; padding: 0; background: #fff !important; }

/* Connected Facebook forms: the buttons move under the name on a phone */
@media (max-width: 575.98px) {
    .la-form-row { flex-wrap: wrap; row-gap: 8px; }
    .la-form-row > .flex-grow-1 { flex-basis: calc(100% - 60px); min-width: 0; }
    .la-form-row > button { margin-left: auto; }
    .la-form-row > button + button { margin-left: 0; }
}

/* Table toolbars on a phone: the main action on its own line, then search and the other buttons across the width */
@media (max-width: 575.98px) {
    .app-main .card > .card-header { flex-direction: column; align-items: stretch; }
    .app-main .card-header > .card-title { margin-left: 0; margin-right: 0; }
    .app-main .card-header > .card-toolbar { margin-top: 0; width: 100%; }
    .app-main .card-header > .card-toolbar > div { width: 100%; justify-content: flex-start !important; }
    .app-main .card-header .card-toolbar .position-relative { flex: 1 1 180px; width: auto !important; margin: 0 !important; }
    .app-main .card-header .card-toolbar .position-relative .form-control { width: 100% !important; }
    .app-main .card-header .card-toolbar .btn.me-3 { margin-right: 0 !important; }
}

/* No language choice is offered; the older sign-in pages showed the picker inconsistently */
.la-auth-foot > .me-10 { display: none !important; }
