:root {
    --ml-green: #08916a;
    --ml-green-2: #16a34a;
    --ml-green-dark: #08795a;
    --ml-ink: #0f172a;
    --ml-muted: #5f6c80;
    --ml-border: #dee6f0;
    --ml-soft: #f7f9fc;
    --surface: #ffffff;
    --surface-2: #f7fbff;
    --text-main: #0f172a;
    --text-muted: #5f6c80;
    --shadow-soft: 0 12px 28px rgba(14, 30, 52, 0.08);
    --shadow-card: 0 16px 36px rgba(15, 30, 49, 0.1);
    --shadow-nav: 0 8px 24px rgba(15, 30, 49, 0.06);
}

body {
    min-height: 100vh;
    color: var(--ml-ink);
    background: linear-gradient(180deg, #ffffff 0%, var(--ml-soft) 100%);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.main-nav {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-bottom: 1px solid var(--ml-border);
    box-shadow: var(--shadow-nav);
    backdrop-filter: saturate(1.25) blur(6px);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.brand {
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--ml-ink);
    display: inline-flex;
    align-items: center;
}

.brand-icon {
    color: var(--ml-green);
    margin-right: 0.35rem;
    font-size: 1.7rem;
}

img.brand-icon {
    width: 1.7rem;
    height: 1.7rem;
    object-fit: contain;
}

@media (max-width: 767.98px) {
    .brand {
        font-size: 1.52rem;
    }

    .brand-icon {
        font-size: 1.35rem;
    }
}

.nav-link-lite {
    color: color-mix(in srgb, var(--text-main) 88%, #7b8ba3 12%);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-link-lite:hover {
    color: var(--ml-green);
}

.btn-main,
.btn-main:visited {
    background: var(--ml-green);
    border-color: var(--ml-green);
    color: #fff;
    font-weight: 700;
    padding: 0.78rem 1.35rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-main:hover,
.btn-main:focus {
    background: var(--ml-green-dark);
    border-color: var(--ml-green-dark);
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary-lite {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--ml-border) 85%, #aec0d8 15%);
    color: color-mix(in srgb, var(--text-main) 88%, #6f839f 12%);
    border-radius: 0.75rem;
    padding: 0.78rem 1.35rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-secondary-lite:hover,
.btn-secondary-lite:focus {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--ml-green) 40%, var(--ml-border) 60%);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.88rem;
}

.mobile-quick-nav {
    display: none;
}

.user-pill {
    color: #314157;
    background: #f3f7fb;
    border: 1px solid #d9e4ef;
    border-radius: 999px;
    font-size: 0.82rem;
    padding: 0.3rem 0.7rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-section-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--ml-border);
    background: var(--surface-2);
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 700;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.panel-header-copy {
    max-width: 760px;
}

.panel-header-copy p {
    margin: 0.45rem 0 0;
    color: var(--ml-muted);
}

.panel-actions,
.action-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-card {
    border: 1px solid var(--ml-border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    padding: 1.25rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.section-head p {
    margin: 0.35rem 0 0;
    color: var(--ml-muted);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid #d7e8e2;
    border-radius: 1.25rem;
    background:
        radial-gradient(circle at top left, rgba(8, 145, 106, 0.18), transparent 36%),
        linear-gradient(130deg, #f0faf6 0%, #f7fbff 100%);
    box-shadow: var(--shadow-card);
    padding: 1.4rem;
}

.hero-panel::after {
    content: '';
    position: absolute;
    inset: auto -8% -35% auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(19, 118, 232, 0.08);
    pointer-events: none;
}

.hero-panel.warning {
    border-color: #f0dca0;
    background:
        radial-gradient(circle at top left, rgba(234, 179, 8, 0.12), transparent 34%),
        linear-gradient(130deg, #fff9e8 0%, #fffdf4 100%);
}

.hero-panel.danger {
    border-color: #eab7b7;
    background:
        radial-gradient(circle at top left, rgba(220, 38, 38, 0.1), transparent 34%),
        linear-gradient(130deg, #fff4f4 0%, #fffaf8 100%);
}

.hero-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.hero-kpi {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.72);
    padding: 0.85rem 0.95rem;
}

.hero-kpi-label {
    display: block;
    color: var(--ml-muted);
    font-size: 0.8rem;
    margin-bottom: 0.28rem;
}

.hero-kpi-value {
    display: block;
    color: var(--ml-ink);
    font-weight: 800;
    font-size: 1.02rem;
}

.business-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.category-pill,
.soft-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4f91;
    font-size: 0.77rem;
    font-weight: 700;
    border: 1px solid #d8e6fb;
}

.soft-pill {
    background: #f3fbf7;
    color: #0f6d52;
    border-color: #d9e8df;
}

.business-url {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--ml-muted);
    font-size: 0.82rem;
    text-decoration: none;
}

.business-url:hover {
    color: var(--ml-green);
}

.template-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.template-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.template-desc {
    color: var(--ml-muted);
    font-size: 0.8rem;
    line-height: 1.25;
}

.template-badge--service {
    background: #ecf7f2;
    border-color: #cdeadd;
    color: #0f6d52;
}

.template-badge--booking {
    background: #eef6ff;
    border-color: #d5e6fb;
    color: #185792;
}

.template-badge--catalog {
    background: #fff4e8;
    border-color: #f2ddc7;
    color: #8a4a10;
}

.template-badge--sales {
    background: #ffecec;
    border-color: #f4cbcb;
    color: #9d2b2b;
}

.template-badge--mixed {
    background: #f1f3ff;
    border-color: #dadcf8;
    color: #3f4d9a;
}

.template-badge--institutional,
.template-badge--lead {
    background: #eff4f8;
    border-color: #d8e3ec;
    color: #314a61;
}

.template-badge--default {
    background: #f4f5f7;
    border-color: #e0e4ea;
    color: #5e6b7d;
}

.inline-form-stack {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.kpi-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--ml-border);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
}

.muted-note {
    color: var(--ml-muted);
    font-size: 0.9rem;
}

.desktop-only {
    display: inline-flex;
}

.mobile-only {
    display: none;
}

@media (min-width: 768px) {
    .user-pill {
        max-width: 280px;
    }
}

.theme-toggle {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ml-border) 82%, #a9bdd8 18%);
    background: var(--surface);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover,
.theme-toggle:focus {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--ml-green) 45%, var(--ml-border) 55%);
    transform: translateY(-1px);
}

.btn-main {
    background: var(--ml-green);
    border-color: var(--ml-green);
    color: #fff;
    font-weight: 700;
    border-radius: 0.7rem;
    transition: all 0.2s ease;
}

.btn-main:hover,
.btn-main:focus {
    background: var(--ml-green-dark);
    border-color: var(--ml-green-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 145, 106, 0.2);
}

.btn-secondary-lite {
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--ml-border) 85%, #aec0d8 15%);
    color: color-mix(in srgb, var(--ml-ink) 88%, #6f839f 12%);
    border-radius: 0.75rem;
    padding: 0.78rem 1.35rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-secondary-lite:hover,
.btn-secondary-lite:focus {
    background: var(--ml-soft);
    border-color: color-mix(in srgb, var(--ml-green) 40%, var(--ml-border) 60%);
    color: var(--ml-ink);
}

.stat-card {
    border: 1px solid var(--ml-border);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 4px 15px rgba(15, 30, 49, 0.04);
    padding: 1.25rem;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(15, 30, 49, 0.08);
}

.billing-hero {
    border: 1px solid #d7e8e2;
    border-radius: 1rem;
    background: linear-gradient(130deg, #f0faf6 0%, #f7fbff 100%);
    box-shadow: 0 4px 15px rgba(15, 30, 49, 0.04);
    padding: 1.5rem;
}

.billing-hero-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: #e0f4ec;
    color: #0f7d5d;
    flex-shrink: 0;
}

.billing-hero.is-warning {
    border-color: #f2e2a1;
    background: linear-gradient(130deg, #fff9e8 0%, #fffdf4 100%);
}

.billing-hero.is-warning .billing-hero-icon {
    background: #fff1c2;
    color: #8a6100;
}

.kpi-note {
    font-size: 0.84rem;
    color: var(--ml-muted);
    margin-top: 0.3rem;
}

.credits-low {
    color: #c0392b;
    font-weight: 700;
}

.stat-label {
    color: var(--ml-muted);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
}

/* Stats carousel */
.stats-carousel-wrap {
    display: flex;
    gap: 0.75rem;
    overflow: visible;
}

.stats-carousel-item {
    flex: 1;
    min-width: 0;
}

@media (max-width: 767px) {
    .stats-carousel-wrap {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.75rem;
        scrollbar-width: none;
        /* hint: right edge of last card peeks */
    }

    .stats-carousel-wrap::-webkit-scrollbar {
        display: none;
    }

    .stats-carousel-item {
        flex: 0 0 72vw;
        scroll-snap-align: start;
    }
}

/* Preview button in business card */
.btn-preview-action {
    background: var(--ml-green);
    color: #fff;
    border: none;
    font-weight: 600;
}

.btn-preview-action:hover,
.btn-preview-action:focus {
    background: #0a7056;
    color: #fff;
}

.table-card {
    border: 1px solid var(--ml-border);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 4px 15px rgba(15, 30, 49, 0.04);
    overflow: hidden;
}

/* Actions column — desktop 2-col grid */
/* Business table — fixed layout, no horizontal scroll */
.business-table {
    table-layout: fixed;
    width: 100%;
}

.business-table .col-ciudad {
    width: 90px;
}

.business-table .col-estado {
    width: 86px;
}

.business-table .col-num {
    width: 48px;
}

.business-table .col-acciones {
    width: 200px;
}

/* Actions column — desktop 2-col grid */
.actions-cell {
    vertical-align: top;
    padding: 0.6rem 0.5rem !important;
}

.action-btns-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    align-items: start;
}

.action-btns-wrap>.btn-preview-action {
    grid-column: 1 / -1;
}

.action-btns-wrap>.btn {
    font-size: 0.78rem;
    padding: 0.28rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-btns-wrap>form {
    display: contents;
    /* transparent to grid — button becomes grid item */
}

.action-btns-wrap>form .btn {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.28rem 0.4rem;
}

.action-full-width {
    grid-column: 1 / -1;
}

.domain-hint-note {
    font-size: 0.73rem;
    color: var(--ml-muted);
    margin: 0.4rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ai-source-card {
    margin-top: 0.65rem;
    border: 1px solid #d8e5f4;
    border-radius: 14px;
    background: linear-gradient(165deg, #f9fcff 0%, #f4f9ff 100%);
    box-shadow: 0 10px 26px rgba(15, 30, 49, 0.07);
    padding: 0.85rem 0.95rem;
}

.ai-source-card--inline {
    margin-top: 0.7rem;
    max-width: 640px;
}

.ai-source-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ai-source-title {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    font-size: 0.96rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0f3b2d;
}

.ai-source-title i {
    color: #0ea46a;
    font-size: 1rem;
}

.ai-source-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.2rem 0.58rem;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.ai-source-status-pill.is-ready {
    color: #116b41;
    background: #e8f8ef;
    border-color: #bdebd0;
}

.ai-source-status-pill.is-pending {
    color: #7a5b00;
    background: #fff8db;
    border-color: #f6e3a2;
}

.ai-source-status-pill.is-incomplete {
    color: #8a5a00;
    background: #fff1dd;
    border-color: #ffd8a8;
}

.ai-source-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-top: 0.56rem;
}

.ai-source-copy {
    margin-top: 0.52rem;
    color: #4f637d;
    font-size: 0.81rem;
    line-height: 1.42;
}

.ai-source-url-field {
    margin-top: 0.56rem;
}

.ai-source-url-field .form-control {
    border-radius: 10px;
    border: 1px solid #cfdef0;
    background: #ffffff;
    min-height: 40px;
    color: #1f354d;
    font-size: 0.81rem;
    font-weight: 600;
    padding: 0.45rem 0.72rem;
    box-shadow: inset 0 1px 1px rgba(15, 30, 49, 0.03);
}

.ai-source-url-field .form-control:focus {
    border-color: #7ab6f2;
    box-shadow: 0 0 0 0.2rem rgba(67, 145, 219, 0.16);
}

.ai-source-actions .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    border-width: 1px;
}

.ai-btn-primary {
    background: linear-gradient(145deg, #118a5b 0%, #0e7b51 100%);
    border-color: #0f774f;
    color: #fff;
    box-shadow: 0 8px 18px rgba(11, 125, 81, 0.2);
}

.ai-btn-primary:hover,
.ai-btn-primary:focus {
    background: linear-gradient(145deg, #0f7f54 0%, #0d6e49 100%);
    border-color: #0d6e49;
    color: #fff;
}

.ai-btn-primary:disabled,
.ai-btn-primary[aria-disabled="true"] {
    background: #c9d5e4;
    border-color: #c9d5e4;
    color: #5f7288;
    box-shadow: none;
}

.ai-btn-secondary {
    background: #fff;
    color: #1f5f9e;
    border-color: #b8d2eb;
}

.ai-btn-secondary:hover,
.ai-btn-secondary:focus {
    background: #f4f9ff;
    color: #154f86;
    border-color: #9cc2e6;
}

.ai-source-help-link {
    margin-top: 0.44rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #2f6fae;
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-source-help-link:hover,
.ai-source-help-link:focus {
    color: #1a5692;
}

.ai-source-help-modal {
    border: 1px solid #d6e3f3;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(11, 29, 48, 0.18);
}

.ai-source-help-modal .modal-title {
    font-weight: 700;
    color: #133f66;
}

.ai-source-help-modal .modal-title i {
    color: #0f8d61;
}

.ai-help-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.48rem;
}

.ai-help-examples span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.62rem;
    border-radius: 999px;
    border: 1px solid #d3e2f2;
    background: #f8fbff;
    font-size: 0.76rem;
    font-weight: 600;
    color: #32567a;
}

html[data-theme="dark"] .ai-source-card {
    border-color: #2f3f56;
    background: linear-gradient(165deg, #1b2737 0%, #1d2a3c 100%);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .ai-source-title {
    color: #e5edf7;
}

html[data-theme="dark"] .ai-source-title i {
    color: #53d39c;
}

html[data-theme="dark"] .ai-source-copy {
    color: #b4c2d4;
}

html[data-theme="dark"] .ai-source-url-field .form-control {
    background: #132031;
    border-color: #30475f;
    color: #deecfb;
}

html[data-theme="dark"] .ai-source-url-field .form-control:focus {
    border-color: #4f89c2;
    box-shadow: 0 0 0 0.2rem rgba(79, 137, 194, 0.22);
}

html[data-theme="dark"] .ai-source-status-pill.is-ready {
    color: #95e9bd;
    background: rgba(41, 122, 79, 0.28);
    border-color: rgba(84, 180, 127, 0.45);
}

html[data-theme="dark"] .ai-source-status-pill.is-pending {
    color: #f5dc8f;
    background: rgba(121, 89, 24, 0.35);
    border-color: rgba(192, 151, 64, 0.42);
}

html[data-theme="dark"] .ai-source-status-pill.is-incomplete {
    color: #ffd4a1;
    background: rgba(125, 78, 17, 0.34);
    border-color: rgba(197, 129, 37, 0.46);
}

html[data-theme="dark"] .ai-btn-secondary {
    background: #152535;
    color: #8fc1f0;
    border-color: #385574;
}

html[data-theme="dark"] .ai-btn-secondary:hover,
html[data-theme="dark"] .ai-btn-secondary:focus {
    background: #193047;
    color: #b3d8ff;
    border-color: #49709a;
}

html[data-theme="dark"] .ai-source-help-link {
    color: #8cc5ff;
}

html[data-theme="dark"] .ai-source-help-link:hover,
html[data-theme="dark"] .ai-source-help-link:focus {
    color: #b7dbff;
}

html[data-theme="dark"] .ai-source-help-modal {
    border-color: #2f425b;
    background: #182636;
}

html[data-theme="dark"] .ai-source-help-modal .modal-header,
html[data-theme="dark"] .ai-source-help-modal .modal-body {
    color: #d3e1ef;
}

html[data-theme="dark"] .ai-source-help-modal .modal-title {
    color: #e2eefb;
}

html[data-theme="dark"] .ai-help-examples span {
    border-color: #36506a;
    background: #203246;
    color: #b9d2ea;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    color: #334155;
    border-bottom: 1px solid var(--ml-border);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 1rem;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem;
    border-bottom: 1px solid var(--ml-border);
}

.empty-state-card {
    border: 2px dashed var(--ml-border);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 4rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.empty-state-card:hover {
    background: #fff;
    border-color: var(--ml-green);
    box-shadow: 0 10px 30px rgba(8, 145, 106, 0.08);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--ml-green);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.panel-footer {
    margin-top: 2rem;
    border: 1px solid #d6ede6;
    border-radius: 1rem;
    background: linear-gradient(130deg, #f0faf6 0%, #f7fbff 100%);
    box-shadow: 0 4px 15px rgba(15, 30, 49, 0.04);
}

.panel-footer h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f3b2d;
    letter-spacing: -0.01em;
}

.panel-footer p {
    margin: 0;
    color: #4f637d;
    font-size: 0.95rem;
    line-height: 1.5;
}

.panel-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.panel-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #0c5f47;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.panel-footer-links a:hover {
    color: var(--ml-green-dark);
    text-decoration: underline;
}

.footer-kpi-tip {
    border: 1px dashed #b8ddd2;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.75);
    padding: 0.85rem 1rem;
    color: #35506d;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-bottom {
    border-top: 1px solid #d8e6f2;
    color: #64758b;
    font-size: 0.85rem;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .table-responsive {
        border: 0;
    }

    .mobile-card-view tbody,
    .mobile-card-view tr,
    .mobile-card-view td {
        display: block;
        width: 100%;
    }

    .mobile-card-view thead {
        display: none;
        /* Hide table headers on mobile */
    }

    .mobile-card-view tr {
        background: #fff;
        border: 1px solid var(--ml-border);
        border-radius: 1rem;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .mobile-card-view td {
        border-bottom: 1px solid #f1f5f9;
        padding: 0.75rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .mobile-card-view td:last-child {
        border-bottom: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding-top: 1rem;
    }

    .mobile-card-view td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ml-muted);
        text-align: left;
        padding-right: 1rem;
        font-size: 0.85rem;
    }

    .mobile-card-view .business-name-td {
        flex-direction: row;
        justify-content: flex-start;
        font-size: 1.1rem;
        font-weight: 700;
        border-bottom: 2px solid var(--ml-soft);
        padding-bottom: 1rem;
    }

    .mobile-card-view .business-name-td::before {
        display: none;
    }

    /* Actions cell — mobile: single column */
    .actions-cell {
        padding: 0.75rem 0 !important;
        display: block !important;
    }

    .action-btns-wrap {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .action-btns-wrap>.btn,
    .action-btns-wrap>form,
    .action-btns-wrap>form .btn {
        width: 100%;
        display: block;
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    .action-btns-wrap>form {
        display: block;
        /* override display:contents on mobile */
    }

    .action-full-width {
        grid-column: unset;
    }

    .domain-hint-note {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.75rem;
        margin-top: 0.5rem;
        max-width: 100%;
    }

    .ai-source-card--inline {
        max-width: none;
        margin-top: 0.6rem;
    }

    .ai-source-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.38rem;
    }

    .ai-source-title {
        font-size: 0.91rem;
    }

    .ai-source-copy {
        font-size: 0.79rem;
        margin-top: 0.45rem;
    }

    .ai-source-actions {
        grid-template-columns: 1fr;
        margin-top: 0.52rem;
    }

    .ai-source-actions .btn {
        min-height: 40px;
        font-size: 0.84rem;
    }

    .ai-source-help-link {
        margin-top: 0.48rem;
        font-size: 0.76rem;
    }

    .btn-action-mobile {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .panel-actions,
    .action-cluster,
    .inline-form-stack {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-actions>*,
    .action-cluster>*,
    .inline-form-stack>* {
        width: 100%;
    }

    .section-card,
    .hero-panel {
        padding: 1rem;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: inline-flex;
    }

    /* Navigation Responsive */
    .main-nav>.container {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
        gap: 0.55rem !important;
    }

    .brand {
        font-size: 1.52rem;
    }

    .brand-icon {
        font-size: 1.35rem;
    }

    img.brand-icon {
        width: 1.35rem;
        height: 1.35rem;
    }

    .main-nav>.container>.d-flex .nav-link-lite {
        display: none;
    }

    .theme-toggle {
        width: 2.2rem;
        height: 2.2rem;
    }

    .main-nav .btn-main {
        padding: 0.68rem 0.9rem;
        font-size: 0.88rem;
        white-space: nowrap;
    }

    @media (max-width: 992px) {
        .brand {
            font-size: 1.6rem;
        }
    }

    .mobile-quick-nav {
        display: block;
        position: sticky;
        top: 60px;
        z-index: 1025;
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        border-bottom: 1px solid var(--ml-border);
        backdrop-filter: saturate(1.2) blur(8px);
    }

    .mobile-quick-nav-track {
        display: flex;
        gap: 0.55rem;
        overflow-x: auto;
        padding: 0.55rem 0.9rem 0.35rem;
        scrollbar-width: none;
    }

    .mobile-quick-nav-track::-webkit-scrollbar {
        display: none;
    }

    .mobile-quick-link {
        flex: 0 0 auto;
        text-decoration: none;
        border-radius: 999px;
        padding: 0.48rem 0.78rem;
        background: var(--surface-2);
        border: 1px solid var(--ml-border);
        color: var(--text-main);
        font-size: 0.83rem;
        font-weight: 700;
        white-space: nowrap;
    }
}

/* Dark Theme */
html[data-theme="dark"] {
    --ml-ink: #e7edf7;
    --ml-muted: #9eb0c8;
    --ml-soft: #121925;
    --ml-border: #2a3549;
    --surface: #111a28;
    --surface-2: #0f1724;
    --text-main: #e7edf7;
    --text-muted: #9eb0c8;
    --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.42);
    --shadow-nav: 0 10px 26px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body {
    color: var(--ml-ink);
    background: linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .brand *:not(.brand-icon),
html[data-theme="dark"] .h4,
html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .panel-footer h2,
html[data-theme="dark"] .panel-footer h2 *,
html[data-theme="dark"] .panel-footer h2,
html[data-theme="dark"] .panel-footer strong {
    color: #f8fafc !important;
}


html[data-theme="dark"] .panel-footer p {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .panel-footer-links a,
html[data-theme="dark"] .panel-footer-links a * {
    color: #38bdf8 !important;
}

html[data-theme="dark"] .main-nav,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .billing-hero,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .panel-footer,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .footer-kpi-tip,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .empty-state-card {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

html[data-theme="dark"] .empty-state-card {
    background: rgba(30, 41, 59, 0.5);
}

html[data-theme="dark"] .empty-state-card:hover {
    background: #1e293b;
    border-color: var(--ml-green);
}

html[data-theme="dark"] .billing-hero {
    border-color: #0f7d5d;
    background: linear-gradient(130deg, #132b24 0%, #1e293b 100%);
}

html[data-theme="dark"] .billing-hero.is-warning {
    border-color: #8a6100;
    background: linear-gradient(130deg, #332608 0%, #1e293b 100%);
}

html[data-theme="dark"] .billing-hero-icon {
    background: #0f7d5d;
    color: #fff;
}

html[data-theme="dark"] .billing-hero.is-warning .billing-hero-icon {
    background: #8a6100;
    color: #fff;
}

html[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #f8fafc;
}

html[data-theme="dark"] .table thead th {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .mobile-card-view tr {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .mobile-card-view td {
    border-color: #334155;
}

html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-secondary {
    color: #f8fafc;
    border-color: #475569;
}

html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-secondary:hover {
    background: #334155;
    border-color: #64748b;
}

html[data-theme="dark"] .btn-link,
html[data-theme="dark"] .nav-link-lite,
html[data-theme="dark"] .form-label {
    color: #e6edf7 !important;
}

html[data-theme="dark"] .btn-secondary-lite {
    color: #d8e3f2;
    border-color: #3c4d67;
    background: #131e2e;
}

html[data-theme="dark"] .btn-secondary-lite:hover,
html[data-theme="dark"] .btn-secondary-lite:focus {
    background: #1a2a3f;
    border-color: #567197;
    color: #fff;
}

html[data-theme="dark"] .nav-section-pill,
html[data-theme="dark"] .kpi-badge,
html[data-theme="dark"] .hero-kpi,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .category-pill,
html[data-theme="dark"] .soft-pill {
    background: #131e2e;
    border-color: #334155;
    color: #e6edf7;
}

html[data-theme="dark"] .hero-panel {
    border-color: #215a49;
    background:
        radial-gradient(circle at top left, rgba(8, 145, 106, 0.18), transparent 36%),
        linear-gradient(130deg, #102019 0%, #121c2b 100%);
}

html[data-theme="dark"] .hero-panel.warning {
    border-color: #6b5a2d;
    background:
        radial-gradient(circle at top left, rgba(234, 179, 8, 0.12), transparent 34%),
        linear-gradient(130deg, #2f2812 0%, #121c2b 100%);
}

html[data-theme="dark"] .hero-panel.danger {
    border-color: #6b2d37;
    background:
        radial-gradient(circle at top left, rgba(220, 38, 38, 0.12), transparent 34%),
        linear-gradient(130deg, #32181d 0%, #121c2b 100%);
}

html[data-theme="dark"] .hero-kpi {
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] .business-url,
html[data-theme="dark"] .muted-note,
html[data-theme="dark"] .domain-hint-note,
html[data-theme="dark"] .section-head p,
html[data-theme="dark"] .panel-header-copy p,
html[data-theme="dark"] .hero-kpi-label {
    color: #9eb0c8;
}

html[data-theme="dark"] .ai-source-card {
    border-color: #344255 !important;
    background: #182334 !important;
}

html[data-theme="dark"] .ai-source-url,
html[data-theme="dark"] .ai-source-missing {
    color: #9eb0c8 !important;
}

html[data-theme="dark"] .ai-source-preview {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #dbe7f5;
}

html[data-theme="dark"] .btn-main {
    color: #fff !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: #101a29;
    border-color: #33455e;
    color: #dce6f5;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background: #0f1825;
    color: #e6eef8;
    border-color: #3d5f86;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .footer-bottom,
html[data-theme="dark"] .kpi-note {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .panel-footer-links a:hover {
    color: #cbd5e1 !important;
}

/* Ensure brand icon is always green regardless of theme overrides */
html[data-theme="dark"] .brand-icon,
html[data-theme="dark"] .brand .brand-icon,
.brand-icon {
    color: var(--ml-green) !important;
}