* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #111827;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 190px;
    background: #111827;
    color: white;
    padding: 20px;
    flex-shrink: 0;
}

.sidebar h2 {
    margin: 0 0 28px;
    font-size: 20px;
}

.tab-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tab-button {
    background: transparent;
    border: none;
    color: #d1d5db;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.tab-button:hover,
.tab-button.active {
    background: #2563eb;
    color: white;
}

/* Main */

.main {
    flex: 1;
    min-width: 0;
    padding: 22px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 14px;
}

/* Tabs */

.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

/* Upload */

.upload-button {
    background: #2563eb;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: inline-block;
}

.upload-button input {
    display: none;
}

.secondary-upload {
    background: #111827;
}

.upload-button:hover {
    opacity: 0.9;
}

/* Error */

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
}

.hidden {
    display: none;
}

/* Toolbar */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.05);
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.muted {
    color: #6b7280;
    font-size: 13px;
    margin: 0;
}

/* Buttons */

.btn {
    border: none;
    background: #2563eb;
    color: white;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.btn.small {
    padding: 7px 10px;
    font-size: 13px;
}

.btn.secondary {
    background: #4b5563;
}

.btn.danger {
    background: #dc2626;
}

.btn:hover {
    opacity: 0.9;
}

/* Panels */

.panel {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 7px rgba(15, 23, 42, 0.06);
    margin-bottom: 14px;
    min-width: 0;
}

.panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-header select {
    width: 160px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

/* Cards */

.cards {
    display: grid;
    gap: 12px;
}

.compact-cards {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    margin-bottom: 12px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 1px 7px rgba(15, 23, 42, 0.06);
    min-width: 0;
}

.card p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

.card h2 {
    margin: 6px 0 0;
    font-size: 23px;
}

.primary-card:nth-child(1) {
    border-left: 4px solid #2563eb;
}

.primary-card:nth-child(2) {
    border-left: 4px solid #dc2626;
}

.primary-card:nth-child(3) {
    border-left: 4px solid #7c3aed;
}

.primary-card:nth-child(4) {
    border-left: 4px solid #16a34a;
}

/* Mini metrics */

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: white;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    box-shadow: 0 1px 7px rgba(15, 23, 42, 0.06);
}

.mini-metrics div {
    display: flex;
    justify-content: center;
    gap: 8px;
    border-right: 1px solid #e5e7eb;
    font-size: 13px;
}

.mini-metrics div:last-child {
    border-right: none;
}

.mini-metrics span {
    color: #6b7280;
}

.mini-metrics strong {
    color: #111827;
}

/* Grids */

.dashboard-grid {
    display: grid;
    gap: 14px;
    width: 100%;
}

.overview-grid {
    grid-template-columns: 1fr 1fr;
}

/* Charts */

.chart-panel {
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.chart-panel canvas {
    width: 100% !important;
    display: block;
}

.overview-grid .chart-panel {
    height: auto;
}

.overview-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.forecast-panel {
    height: 520px;
}

.forecast-panel canvas {
    height: 420px !important;
}

.campaign-chart-panel {
    height: auto;
}

.campaign-chart-wrapper {
    position: relative;
    width: 100%;
    height: 340px;
}

.campaign-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Filters */

.filters-panel {
    margin-top: 14px;
}

.filter-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.compact-filter-grid {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    align-items: end;
}

.filter-grid label {
    display: block;
    font-size: 12px;
    color: #374151;
    margin-bottom: 5px;
    font-weight: 700;
}

.filter-grid input,
.filter-grid select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

/* Data */

.data-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.code-box {
    background: #111827;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    overflow-x: auto;
    margin-bottom: 10px;
}

/* Tables */

.table-wrapper {
    overflow-x: auto;
    margin-top: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

th {
    background: #f9fafb;
    color: #374151;
}

/* Responsive */

@media (max-width: 1000px) {
    .sidebar {
        display: none;
    }

    .compact-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .compact-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mini-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .mini-metrics div {
        border-right: none;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .main {
        padding: 14px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .compact-cards,
    .compact-filter-grid,
    .mini-metrics {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-header select {
        width: 100%;
    }
}

/* Overview forecast chart */
.overview-forecast-panel {
    grid-column: 1 / -1;
    height: 390px;
}

.overview-forecast-panel canvas {
    height: 300px !important;
}

/* Help tooltip icons */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #374151;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.help-tip::after {
    content: attr(data-help);
    position: absolute;
    left: 50%;
    top: 135%;
    bottom: auto;
    transform: translateX(-50%);
    width: 260px;
    background: #111827;
    color: white;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
    white-space: normal;
}

.help-tip::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 115%;
    bottom: auto;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #111827 transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
}

.help-tip:hover::after,
.help-tip:hover::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.8s;
}

/* Make charts feel less jumpy */
canvas {
    transition: none !important;
}

@media (max-width: 600px) {
    .help-tip::after {
        width: 220px;
        left: auto;
        right: 0;
        transform: none;
    }
}

/* Prevent tooltip from getting cut off on the left side */
.card:first-child .help-tip::after,
.primary-card:first-child .help-tip::after {
    left: 0;
    right: auto;
    transform: none;
}

.card:first-child .help-tip::before,
.primary-card:first-child .help-tip::before {
    left: 12px;
    right: auto;
    transform: none;
}

/* Global filters shown above all tabs */
.global-filters-panel {
    margin-bottom: 14px;
    padding: 12px 14px;
    overflow: visible !important;
    position: relative;
    z-index: 20;
}

.global-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.global-filters-header h3 {
    margin: 0;
    font-size: 15px;
}

.global-filter-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}

.global-filter-grid label {
    display: block;
    font-size: 12px;
    color: #374151;
    margin-bottom: 5px;
    font-weight: 700;
}

.global-filter-grid input,
.global-filter-grid select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

/* Keep filter area compact */
.global-filters-panel .btn.small {
    white-space: nowrap;
}

/* Make sure help hints inside filters appear above charts */
.global-filters-panel .help-tip,
.global-filters-panel .help-tip::after,
.global-filters-panel .help-tip::before {
    z-index: 99999;
}

@media (max-width: 900px) {
    .global-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .global-filter-grid {
        grid-template-columns: 1fr;
    }

    .global-filters-header {
        align-items: flex-start;
    }
}

.help-tip.align-left::after {
    left: 0;
    right: auto;
    transform: none;
}

.help-tip.align-left::before {
    left: 12px;
    right: auto;
    transform: none;
}


/* Raw CSV data preview */
.data-preview-panel {
    margin-top: 14px;
}

.data-preview-wrapper {
    max-height: 460px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.data-preview-table {
    min-width: 1100px;
}

.data-preview-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f9fafb;
}

.data-preview-table td,
.data-preview-table th {
    white-space: nowrap;
}

.data-preview-table tbody tr:nth-child(even) {
    background: #fafafa;
}

/* Channel color customization */
.channel-color-panel {
    overflow: visible !important;
}

.channel-color-list {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.channel-color-row {
    display: grid;
    grid-template-columns: 24px 1fr 90px 80px;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

.channel-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
}

.channel-color-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.channel-color-input {
    width: 60px;
    height: 34px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.custom-channel-color-form {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.custom-channel-color-form label {
    display: block;
    font-size: 12px;
    color: #374151;
    margin-bottom: 5px;
    font-weight: 700;
}

.custom-channel-color-form input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

.custom-channel-color-form input[type="color"] {
    width: 70px;
    height: 36px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.custom-color-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 700px) {
    .channel-color-row {
        grid-template-columns: 24px 1fr;
    }

    .channel-color-row input,
    .channel-color-row button {
        grid-column: 2;
    }

    .custom-channel-color-form {
        grid-template-columns: 1fr;
    }
}

.existing-channel-color-form {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 10px;
}

.existing-channel-color-form label {
    display: block;
    font-size: 12px;
    color: #374151;
    margin-bottom: 5px;
    font-weight: 700;
}

.existing-channel-color-form select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

.existing-channel-color-form input[type="color"] {
    width: 70px;
    height: 36px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

@media (max-width: 700px) {
    .existing-channel-color-form {
        grid-template-columns: 1fr;
    }
}

/* Collapsible dropdown panels */
.dropdown-panel {
    padding: 0;
    overflow: visible !important;
}

.dropdown-panel>summary {
    list-style: none;
    cursor: pointer;
    padding: 16px;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-panel>summary::-webkit-details-marker {
    display: none;
}

.dropdown-panel>summary::after {
    content: "+";
    color: #2563eb;
    font-size: 20px;
    font-weight: 700;
}

.dropdown-panel[open]>summary::after {
    content: "−";
}

.dropdown-panel-content {
    padding: 0 16px 16px;
}

/* Nested dropdown inside Channel Colors */
.nested-dropdown-panel {
    margin-top: 14px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.nested-dropdown-panel>summary {
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    padding: 8px 0;
}

.nested-dropdown-panel>summary::-webkit-details-marker {
    display: none;
}

.nested-dropdown-panel>summary::after {
    content: "+";
    float: right;
    color: #2563eb;
    font-size: 18px;
}

.nested-dropdown-panel[open]>summary::after {
    content: "−";
}

/* Existing channel color form */
.existing-channel-color-form {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 10px;
}

.existing-channel-color-form label,
.custom-channel-color-form label {
    display: block;
    font-size: 12px;
    color: #374151;
    margin-bottom: 5px;
    font-weight: 700;
}

.existing-channel-color-form select,
.custom-channel-color-form input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

.existing-channel-color-form input[type="color"],
.custom-channel-color-form input[type="color"] {
    width: 70px;
    height: 36px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.autosave-note {
    font-size: 12px;
    color: #2563eb;
    font-weight: 700;
    padding-bottom: 9px;
    white-space: nowrap;
}

/* Channel color list */
.channel-color-list {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.channel-color-row {
    display: grid;
    grid-template-columns: 24px 1fr 90px 80px;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

.channel-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
}

.channel-color-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.channel-color-input {
    width: 60px;
    height: 34px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

/* Custom channel form */
.custom-channel-color-form {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 12px;
    align-items: end;
    margin-top: 12px;
}

.custom-color-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reset-single-channel-color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 700px) {

    .existing-channel-color-form,
    .custom-channel-color-form {
        grid-template-columns: 1fr;
    }

    .channel-color-row {
        grid-template-columns: 24px 1fr;
    }

    .channel-color-row input,
    .channel-color-row button {
        grid-column: 2;
    }

    .autosave-note {
        padding-bottom: 0;
    }
}

/* Editable data table */
.data-edit-input {
    width: 120px;
    min-width: 90px;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    color: #111827;
}

.data-edit-input:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.data-edit-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.data-edit-input.small-number {
    width: 95px;
}

.data-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn.tiny {
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.data-preview-table td {
    vertical-align: middle;
}

.editable-note {
    color: #2563eb;
    font-weight: 700;
}

/* Edit row modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    width: min(720px, 100%);
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.modal-close-btn {
    border: none;
    background: #f3f4f6;
    color: #111827;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal-close-btn:hover {
    background: #e5e7eb;
}

.modal-body {
    padding: 20px;
}

.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.edit-form-grid label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}

.edit-form-grid input {
    width: 100%;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.edit-form-grid input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Table action buttons */
.data-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn.tiny {
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 6px;
}

@media (max-width: 600px) {
    .edit-form-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

.data-row-actions .btn.tiny {
    width: 64px;
    text-align: center;
}

/* Data preview sorting controls */
.data-preview-header {
    align-items: flex-start;
}

.data-preview-controls {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-control label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 4px;
}

.sort-control select {
    min-width: 130px;
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

@media (max-width: 700px) {
    .data-preview-header {
        flex-direction: column;
        gap: 12px;
    }

    .data-preview-controls {
        width: 100%;
        align-items: stretch;
    }

    .sort-control,
    .sort-control select,
    #toggleRawRowsBtn {
        width: 100%;
    }
}

.required-marker {
    color: #dc2626;
}

.field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

.modal-validation-message {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 20px 12px;
}

.modal-validation-message.hidden {
    display: none;
}

/* Forecast summary cards */
.forecast-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.forecast-card {
    min-height: 92px;
}

.forecast-card:nth-child(1) {
    border-left: 4px solid #2563eb;
}

.forecast-card:nth-child(2) {
    border-left: 4px solid #dc2626;
}

.forecast-card:nth-child(3) {
    border-left: 4px solid #16a34a;
}

.forecast-card:nth-child(4) {
    border-left: 4px solid #7c3aed;
}

/* Forecast calculator */
.forecast-calculator-panel {
    margin-bottom: 14px;
}

.forecast-calculator-grid {
    display: grid;
    grid-template-columns: 180px 220px 1fr;
    gap: 12px;
    align-items: end;
    margin-top: 14px;
}

.forecast-calculator-grid label {
    display: block;
    font-size: 12px;
    color: #374151;
    font-weight: 700;
    margin-bottom: 5px;
}

.forecast-calculator-grid input {
    width: 100%;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
}

.calculator-note {
    font-size: 13px;
    color: #6b7280;
    padding-bottom: 9px;
}

.forecast-calculator-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.forecast-calculator-results div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.forecast-calculator-results span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 5px;
}

.forecast-calculator-results strong {
    font-size: 18px;
    color: #111827;
}

/* Forecast table */
.forecast-table-wrapper {
    max-height: 420px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.forecast-table-wrapper th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 5;
}

@media (max-width: 1000px) {
    .forecast-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .forecast-calculator-grid,
    .forecast-calculator-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .forecast-summary-grid,
    .forecast-calculator-grid,
    .forecast-calculator-results {
        grid-template-columns: 1fr;
    }

    .calculator-note {
        padding-bottom: 0;
    }
}

.forecast-scenario-table-panel {
    margin-bottom: 14px;
}

.forecast-calculator-results {
    grid-template-columns: repeat(4, 1fr);
}

.trend-positive {
    color: #16a34a !important;
}

.trend-negative {
    color: #dc2626 !important;
}

.trend-neutral {
    color: #111827 !important;
}

@media (max-width: 1000px) {
    .forecast-calculator-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .forecast-calculator-results {
        grid-template-columns: 1fr;
    }
}

/* Calculator mode tabs */
.calculator-mode-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.calculator-mode-btn {
    border: 1px solid #cbd5e1;
    background: #f9fafb;
    color: #111827;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.calculator-mode-btn:hover {
    background: #eef2ff;
}

.calculator-mode-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.calculator-mode-panel {
    display: none;
    margin-top: 10px;
}

.calculator-mode-panel.active {
    display: block;
}

.calculator-mode-panel h4 {
    margin: 0 0 6px;
    font-size: 15px;
}

/* Calculator grid/results */
.forecast-calculator-grid {
    display: grid;
    grid-template-columns: 220px 220px 1fr;
    gap: 12px;
    align-items: end;
    margin-top: 14px;
}

.forecast-calculator-grid label {
    display: block;
    font-size: 12px;
    color: #374151;
    font-weight: 700;
    margin-bottom: 5px;
}

.forecast-calculator-grid input {
    width: 100%;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
}

.calculator-note {
    font-size: 13px;
    color: #6b7280;
    padding-bottom: 9px;
}

.forecast-calculator-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.forecast-calculator-results div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.forecast-calculator-results span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 5px;
}

.forecast-calculator-results strong {
    font-size: 18px;
    color: #111827;
}

.trend-positive {
    color: #16a34a !important;
}

.trend-negative {
    color: #dc2626 !important;
}

.trend-neutral {
    color: #111827 !important;
}

@media (max-width: 1000px) {
    .forecast-calculator-results {
        grid-template-columns: repeat(2, 1fr);
    }

    .forecast-calculator-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .forecast-calculator-results,
    .forecast-calculator-grid {
        grid-template-columns: 1fr;
    }

    .calculator-note {
        padding-bottom: 0;
    }
}

.forecast-calculator-panel,
.calculator-mode-panel {
    overflow: visible !important;
}

.forecast-calculator-panel,
.forecast-calculator-results,
.forecast-calculator-results div,
.calculator-mode-panel {
    overflow: visible !important;
}

.forecast-calculator-results .help-tip {
    z-index: 99999;
}

.forecast-calculator-results .help-tip::after,
.forecast-calculator-results .help-tip::before {
    z-index: 100000;
}

.help-tip {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    padding: 0 !important;
    margin-left: 5px;
    border-radius: 50%;
    line-height: 1 !important;
    font-size: 11px !important;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

/* Fix help icons appearing above other tooltips */
.help-tip {
    z-index: 1 !important;
}

.help-tip:hover {
    z-index: 100000 !important;
}

.help-tip::after,
.help-tip::before {
    z-index: 100001 !important;
}

/* CSV drag/drop overlay */
.csv-drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    pointer-events: none;
}

.csv-drop-overlay.hidden {
    display: none;
}

.csv-drop-box {
    background: white;
    border: 3px dashed #2563eb;
    border-radius: 18px;
    padding: 42px 52px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.csv-drop-box h2 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #111827;
}

.csv-drop-box p {
    margin: 0;
    color: #6b7280;
    font-size: 15px;
}

/* Sidebar logo */

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 28px;
}

.sidebar-logo img {
    width: 150px;
    object-fit: contain;
    display: block;
}

.sidebar-logo span {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

/* Auth/Login screen */

.auth-screen {
    min-height: 100vh;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: min(430px, 100%);
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.auth-logo {
    background: #111827;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
}

.auth-logo img {
    width: 180px;
    max-width: 100%;
    object-fit: contain;
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 26px;
    color: #111827;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.auth-form label {
    display: block;
    font-size: 12px;
    color: #374151;
    font-weight: 700;
    margin-bottom: 5px;
}

.auth-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.auth-note {
    margin: 16px 0 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .topbar-actions {
        width: 100%;
        align-items: flex-start;
    }
}

/* Faded dashboard background logo */
.main {
    position: relative;
    isolation: isolate;
}

.main::before {
    content: "";
    position: fixed;
    top: 0;
    left: 190px;
    right: 0;
    bottom: 0;
    background-image: url("images/Advometric_LOGO_Trim.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: min(820px, 55vw);
    opacity: 0.025;
    pointer-events: none;
    z-index: -1;
}

/* Keep dashboard content above the watermark */
.main>* {
    position: relative;
    z-index: 1;
}

/* Optional: make panels slightly transparent so the logo can subtly show through */
.panel,
.card,
.toolbar,
.mini-metrics {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(2px);
}

/* Mobile/tablet adjustment when sidebar is hidden */
@media (max-width: 1000px) {
    .main::before {
        left: 0;
        background-size: min(500px, 70vw);
    }
}

/* CSV Data Preview: fill available width, but stop shrinking when too narrow */

.data-preview-wrapper {
    width: 100%;
    overflow: auto;
}

/* 
   Table fills the available panel width.
   Once the panel is narrower than 1380px, the table stops shrinking
   and horizontal scrolling appears.
*/
.data-preview-table {
    width: 100%;
    min-width: 1780px;
    table-layout: fixed;
}

/* Prevent columns from forcing the table wider than intended */
.data-preview-table th,
.data-preview-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Data preview table column proportions with Source Platform column */
.data-preview-table th:nth-child(1),
.data-preview-table td:nth-child(1) {
    width: 8%;
}

.data-preview-table th:nth-child(2),
.data-preview-table td:nth-child(2) {
    width: 7%;
}

.data-preview-table th:nth-child(3),
.data-preview-table td:nth-child(3) {
    width: 8%;
}

.data-preview-table th:nth-child(4),
.data-preview-table td:nth-child(4) {
    width: 14%;
}

.data-preview-table th:nth-child(5),
.data-preview-table td:nth-child(5) {
    width: 7%;
}

.data-preview-table th:nth-child(6),
.data-preview-table td:nth-child(6) {
    width: 8%;
}

.data-preview-table th:nth-child(7),
.data-preview-table td:nth-child(7) {
    width: 7%;
}

.data-preview-table th:nth-child(8),
.data-preview-table td:nth-child(8) {
    width: 8%;
}

.data-preview-table th:nth-child(9),
.data-preview-table td:nth-child(9) {
    width: 8%;
}

.data-preview-table th:nth-child(10),
.data-preview-table td:nth-child(10) {
    width: 5%;
}

.data-preview-table th:nth-child(11),
.data-preview-table td:nth-child(11) {
    width: 5%;
}

.data-preview-table th:nth-child(12),
.data-preview-table td:nth-child(12) {
    width: 5%;
}

.data-preview-table th:nth-child(13),
.data-preview-table td:nth-child(13) {
    width: 5%;
}

.data-preview-table th:nth-child(14),
.data-preview-table td:nth-child(14) {
    width: 10%;
}

/* Keep action buttons visible and aligned */
.data-preview-table td:nth-child(14) {
    overflow: visible;
    padding-left: 8px;
    padding-right: 8px;
}

.data-preview-table .data-row-actions {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.data-preview-table .data-row-actions .btn.tiny {
    flex: 1;
    width: auto;
    min-width: 0;
    text-align: center;
}

/* Tooltip stacking fix */
.panel {
    position: relative;
}

.panel:has(.help-tip:hover) {
    z-index: 100000 !important;
    overflow: visible !important;
}

/* Keep forecast calculator above the scenario panel */
.forecast-calculator-panel {
    position: relative;
    z-index: 50;
    overflow: visible !important;
}

.forecast-scenario-table-panel {
    position: relative;
    z-index: 10;
}

/* Make calculator internals allow tooltip overflow */
.forecast-calculator-panel,
.forecast-calculator-panel .calculator-mode-panel,
.forecast-calculator-panel .forecast-calculator-results,
.forecast-calculator-panel .forecast-calculator-results div {
    overflow: visible !important;
}

.help-tip:hover {
    z-index: 1000000 !important;
}

.help-tip::before,
.help-tip::after {
    z-index: 1000001 !important;
}

/* Smaller parenthetical value inside calculator results */
.forecast-calculator-results .metric-subvalue {
    display: inline;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    margin-left: 4px;
}

/* Loading spinner for Show All Rows button */
.btn.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: wait;
    opacity: 0.9;
}

.btn.loading::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dashboardSpin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes dashboardSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading overlay for CSV Data Preview table */
.data-preview-wrapper {
    position: relative;
}

.data-preview-wrapper.loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 25;
    pointer-events: none;
}

.data-preview-wrapper.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-top: -17px;
    margin-left: -17px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashboardSpin 0.75s linear infinite;
    z-index: 26;
    pointer-events: none;
}

/* Fix Overview help tips appearing behind charts */

/* Let tooltip bubbles escape overview panels */
#overview,
#overview .cards,
#overview .mini-metrics,
#overview .dashboard-grid,
#overview .panel,
#overview .card,
#overview .chart-panel {
    overflow: visible !important;
}

/* Make major dashboard blocks stack properly */
.panel,
.card,
.mini-metrics,
.global-filters-panel,
.toolbar {
    position: relative;
}

/* Raise any block that has an actively hovered help tooltip */
.panel:has(.help-tip:hover),
.card:has(.help-tip:hover),
.mini-metrics:has(.help-tip:hover),
.global-filters-panel:has(.help-tip:hover),
.toolbar:has(.help-tip:hover) {
    z-index: 999999 !important;
    overflow: visible !important;
}

/* Keep chart panels lower unless their own tooltip is hovered */
.chart-panel {
    position: relative;
    z-index: 1;
}

.chart-panel:has(.help-tip:hover) {
    z-index: 999999 !important;
}

/* Make the actual tooltip bubble sit above charts/canvases */
.help-tip:hover {
    z-index: 1000000 !important;
}

.help-tip:hover::before,
.help-tip:hover::after {
    z-index: 1000001 !important;
}

/* Mobile burger navigation */

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    cursor: pointer;
    padding: 9px;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.18);
    flex-shrink: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 999px;
    margin: 4px 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-btn:hover {
    opacity: 0.95;
}

.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 99998;
}

.mobile-sidebar-backdrop.hidden {
    display: none;
}

body.mobile-menu-open {
    overflow: hidden;
}

body.mobile-menu-open .mobile-menu-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.mobile-menu-open .mobile-menu-btn span:nth-child(2) {
    opacity: 0;
}

body.mobile-menu-open .mobile-menu-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1000px) {
    .mobile-menu-btn {
        display: inline-block;
    }

    /*
      Override your existing mobile rule:
      .sidebar { display: none; }
    */
    .sidebar {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 240px;
        height: 100vh;
        z-index: 99999;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.28);
        overflow-y: auto;
    }

    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-logo img {
        width: 165px;
    }

    .tab-button {
        font-size: 15px;
        padding: 12px 14px;
    }
}

@media (max-width: 600px) {
    .topbar-left {
        width: 100%;
    }

    .topbar {
        align-items: stretch;
    }

    .topbar .upload-button {
        align-self: flex-start;
    }

    .mobile-menu-btn {
        width: 40px;
        height: 40px;
    }
}

/* Chart header with metric selector */
.chart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.chart-panel-header h3 {
    margin: 0;
}

.chart-metric-select {
    min-width: 145px;
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

@media (max-width: 600px) {
    .chart-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-metric-select {
        width: 100%;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Auth pages */

.auth-body {
    min-height: 100vh;
    margin: 0;
    background: #f4f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: min(440px, 100%);
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}

.auth-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.auth-switch {
    margin-top: 18px;
    font-size: 14px;
    color: #6b7280;
}

.auth-switch a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-top: 14px;
    font-size: 14px;
}

.resend-code-form {
    margin-top: 16px;
}

.resend-code-form .btn {
    width: 100%;
}

/* Account tab */

.account-panel {
    margin-bottom: 14px;
}

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.account-info-grid div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.account-info-grid span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 5px;
}

.account-info-grid strong {
    color: #111827;
    font-size: 15px;
    word-break: break-word;
}

.account-form {
    display: grid;
    gap: 14px;
    max-width: 520px;
    margin-top: 14px;
}

.account-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}

.account-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.account-action-form {
    margin-top: 14px;
}

.danger-zone-panel {
    border-left: 4px solid #dc2626;
}

.subscription-status-active,
.subscription-status-trial {
    color: #16a34a !important;
}

.subscription-status-canceled,
.subscription-status-past_due {
    color: #dc2626 !important;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-top: 14px;
    font-size: 14px;
}

@media (max-width: 700px) {
    .account-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Compact Account tab layout */

.compact-account-info-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

@media (max-width: 1100px) {
    .compact-account-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .compact-account-info-grid {
        grid-template-columns: 1fr;
    }
}

.account-card-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 16px 0;
}

.account-full-width-btn {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.danger-zone-panel .muted {
    margin-bottom: 14px;
}

/* Account management stacked layout */
.account-management-stack {
    display: grid;
    gap: 14px;
}

.account-management-stack .panel {
    margin-bottom: 0;
}

/* Keep account forms from becoming too wide */
.account-management-stack .account-form,
.account-management-stack .account-action-form {
    max-width: 620px;
}

/* But allow buttons to fill the form width */
.account-management-stack .account-full-width-btn {
    max-width: 620px;
}

@media (max-width: 900px) {
    .compact-account-info-grid {
        grid-template-columns: 1fr;
    }

    .account-management-stack .account-form,
    .account-management-stack .account-action-form,
    .account-management-stack .account-full-width-btn {
        max-width: none;
    }
}

.subscription-panel {
    border-left: 4px solid #f59e0b;
}

.delete-account-panel {
    border-left: 4px solid #dc2626;
}

/* Account tab width cleanup */
#account {
    max-width: 1080px;
    margin-right: auto;
}

/* Keep account panels from stretching across the whole dashboard */
#account .panel {
    width: 100%;
}

/* Let account forms/buttons fill the account panel nicely */
#account .account-form,
#account .account-action-form {
    max-width: 620px;
}

#account .account-full-width-btn,
#account .account-form .btn,
#account .account-action-form .btn {
    width: 100%;
    max-width: 620px;
}

/* On smaller screens, use full width */
@media (max-width: 1100px) {
    #account {
        max-width: none;
        margin: 0;
    }

    #account .compact-account-info-grid {
        grid-template-columns: 1fr;
    }

    #account .account-form,
    #account .account-action-form,
    #account .account-full-width-btn,
    #account .account-form .btn,
    #account .account-action-form .btn {
        max-width: none;
    }
}

/* Make Account action cards fit their content width */
#account .account-management-stack {
    width: fit-content;
    max-width: 100%;
}

/* Set a clean fixed content width for the three stacked cards */
#account .account-management-stack .account-panel {
    width: 680px;
    max-width: 100%;
}

/* Let forms/buttons fill those cards */
#account .account-management-stack .account-form,
#account .account-management-stack .account-action-form,
#account .account-management-stack .account-full-width-btn,
#account .account-management-stack input,
#account .account-management-stack .btn {
    width: 100%;
    max-width: none;
}

/* Professional Account Page Layout */

#account {
    max-width: none;
    margin: 0;
}

.account-page {
    width: min(1180px, 100%);
    margin: 0 auto;
}

/* Account overview */
.account-overview-panel {
    margin-bottom: 16px;
}

.account-overview-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.account-overview-header h3 {
    margin: 0 0 5px;
}

.account-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
}

.account-summary-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    min-width: 0;
}

.account-summary-card span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 6px;
}

.account-summary-card strong {
    display: block;
    color: #111827;
    font-size: 15px;
    word-break: break-word;
}

/* Main content grid */
.account-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
    gap: 16px;
    align-items: start;
}

.account-main-column,
.account-side-column {
    display: grid;
    gap: 16px;
}

.account-settings-card {
    margin-bottom: 0;
}

.account-card-header {
    margin-bottom: 16px;
}

.account-card-header h3 {
    margin: 0 0 5px;
}

/* Forms */
.clean-account-form {
    display: grid;
    gap: 14px;
    max-width: none;
}

.account-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.clean-account-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}

.clean-account-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.clean-account-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.account-action-btn {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    text-align: center;
    text-decoration: none;
}

/* Billing card inside subscription */
.billing-mini-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}

.billing-mini-card span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 5px;
}

.billing-mini-card strong {
    color: #111827;
    font-size: 15px;
}

/* Softer danger styling */
.subscription-card {
    border-left: 4px solid #f59e0b;
}

.delete-account-card {
    border-left: 4px solid #dc2626;
}

/* Subscription status colors */
.subscription-status-active,
.subscription-status-trial {
    color: #16a34a !important;
}

.subscription-status-canceled,
.subscription-status-past_due {
    color: #dc2626 !important;
}

/* Responsive */
@media (max-width: 1100px) {
    .account-summary-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .account-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .account-page {
        width: 100%;
    }

    .account-summary-grid {
        grid-template-columns: 1fr;
    }

    .account-form-row {
        grid-template-columns: 1fr;
    }
}

/* Account profile form: use full card width */
#account .account-settings-card .clean-account-form {
    width: 100%;
    max-width: none;
}

/* Put First Name, Last Name, and Save button across the full row */
#account .account-settings-card .clean-account-form .account-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

/* Move the Save Account Info button into the same grid row visually */
#account .account-settings-card .clean-account-form>.btn {
    width: 180px;
    min-height: 38px;
    align-self: end;
}

/* Make inputs fill their grid cells */
#account .account-settings-card .clean-account-form input {
    width: 100%;
}

/* Profile Information inline layout */
#account .profile-inline-form {
    display: grid;
    grid-template-columns: 1fr 1fr 190px;
    gap: 14px;
    align-items: end;
    width: 100%;
    max-width: none;
}

#account .profile-inline-form input {
    width: 100%;
}

#account .profile-inline-form .btn {
    width: 100%;
    min-height: 38px;
    white-space: nowrap;
}

/* Responsive stacking */
@media (max-width: 900px) {
    #account .profile-inline-form {
        grid-template-columns: 1fr;
    }

    #account .profile-inline-form .btn {
        width: 100%;
    }
}

/* Force Delete Account button to match input width */
#account .delete-account-card .clean-account-form {
    width: 100% !important;
    max-width: none !important;
}

#account .delete-account-card .clean-account-form input {
    width: 100% !important;
    max-width: none !important;
}

#account .delete-account-card .delete-account-submit-btn {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    text-align: center;
}

/* Add spacing below Account tab success/error messages */
#account .success-message,
#account .error {
    margin-bottom: 16px;
}

/* Auth page logo */
.auth-clear-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.auth-clear-logo img {
    max-width: 290px;
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Add spacing above auth page error messages only */
.auth-card .error {
    margin-top: 14px;
}

/* CSV import mode modal */

.csv-import-mode-modal {
    width: min(680px, 100%);
}

.import-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.import-choice-card {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #111827;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.import-choice-card strong {
    display: block;
    font-size: 15px;
    margin-bottom: 7px;
}

.import-choice-card span {
    display: block;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
}

.import-choice-card:hover {
    transform: translateY(-1px);
    border-color: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.15);
}

.import-choice-card.danger-choice {
    border-color: #fecaca;
    background: #fef2f2;
}

.import-choice-card.danger-choice:hover {
    border-color: #dc2626;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.14);
}

@media (max-width: 650px) {
    .import-choice-grid {
        grid-template-columns: 1fr;
    }
}

/* Better CSV import mode modal buttons */

.csv-import-mode-modal {
    width: min(720px, 100%);
}

.import-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.import-choice-card {
    appearance: none;
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    color: #111827;
    border-radius: 14px;
    padding: 18px;
    text-align: left;
    cursor: pointer;
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    align-items: flex-start;
    min-height: 132px;
    width: 100%;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.import-choice-card:hover {
    transform: translateY(-2px);
    border-color: #2563eb;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
    background: linear-gradient(135deg, #ffffff 0%, #dbeafe 100%);
}

.import-choice-card:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.18),
        0 10px 24px rgba(37, 99, 235, 0.16);
}

.import-choice-card strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 7px;
}

.import-choice-card span {
    display: block;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.45;
}

.import-choice-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    flex-shrink: 0;
}

/* Update option */
.update-choice .import-choice-icon {
    background: #dbeafe;
    color: #2563eb;
}

/* Replace option */
.replace-choice {
    border-color: #fecaca;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.replace-choice:hover {
    border-color: #dc2626;
    background: linear-gradient(135deg, #ffffff 0%, #fee2e2 100%);
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.15);
}

.replace-choice .import-choice-icon {
    background: #fee2e2;
    color: #dc2626;
}

/* Footer cancel button spacing */
.csv-import-mode-modal .modal-footer {
    justify-content: flex-end;
}

.csv-import-mode-modal #csvImportCancelBtn {
    min-width: 110px;
}

/* Mobile */
@media (max-width: 650px) {
    .import-choice-grid {
        grid-template-columns: 1fr;
    }

    .import-choice-card {
        min-height: auto;
    }
}

/* Global loading overlay */

.global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999999;
    padding: 20px;
}

.global-loading-overlay.hidden {
    display: none;
}

.global-loading-card {
    width: min(420px, 100%);
    background: white;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.32);
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 16px;
    align-items: start;
}

.global-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(37, 99, 235, 0.18);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashboardSpin 0.75s linear infinite;
}

.global-loading-content strong {
    display: block;
    font-size: 16px;
    color: #111827;
    margin-bottom: 5px;
}

.global-loading-content p {
    margin: 0 0 14px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.global-loading-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.global-loading-bar-fill {
    width: 45%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #2563eb, #60a5fa);
    animation: loadingBarMove 1.15s ease-in-out infinite;
}

@keyframes loadingBarMove {
    0% {
        transform: translateX(-120%);
    }

    50% {
        transform: translateX(60%);
    }

    100% {
        transform: translateX(220%);
    }
}

/* Toolbar record limit note */
.toolbar-status {
    display: grid;
    gap: 4px;
}

.record-limit-note {
    font-size: 12px;
}

.record-limit-note.warning {
    color: #d97706;
    font-weight: 700;
}

.record-limit-note.danger {
    color: #dc2626;
    font-weight: 700;
}

/* Back to site link on auth pages */
.back-to-site-link {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 16px;
}

.back-to-site-link:hover {
    color: #2563eb;
}

.info-message {
    background: #eff6ff;
    color: #1e40af;
    padding: 12px;
    border-radius: 8px;
    margin-top: 14px;
    font-size: 14px;
}

.trial-reassurance {
    margin: 18px auto 0;
    width: min(620px, 100%);
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #1e3a8a;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}

.trial-reassurance strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
}

.trial-reassurance p {
    margin: 0;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.5;
}

/* Auth/payment page spacing */
.auth-card .info-message {
    margin-top: 24px;
    margin-bottom: 28px;
}

.auth-full-width-btn {
    width: 100%;
    margin-top: 0;
    text-align: center;
}

.auth-card .auth-switch {
    margin-top: 16px;
}

/* Trial subscription card */
.account-subscription-note {
    margin-bottom: 14px;
}

.subscribe-now-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.18);
}

.subscribe-now-btn:hover {
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.25);
}

.subscription-card .account-action-form {
    margin-top: 10px;
}

.subscription-card .account-action-btn {
    width: 100%;
}

/* Billing/subscription loading overlay */

.billing-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999999;
    padding: 20px;
}

.billing-loading-overlay.hidden {
    display: none;
}

.billing-loading-card {
    width: min(430px, 100%);
    background: white;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.32);
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 16px;
    align-items: start;
}

.billing-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(37, 99, 235, 0.18);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashboardSpin 0.75s linear infinite;
}

.billing-loading-card strong {
    display: block;
    font-size: 16px;
    color: #111827;
    margin-bottom: 5px;
}

.billing-loading-card p {
    margin: 0 0 14px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.billing-loading-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.billing-loading-bar-fill {
    width: 45%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #2563eb, #60a5fa);
    animation: loadingBarMove 1.15s ease-in-out infinite;
}

@keyframes loadingBarMove {
    0% {
        transform: translateX(-120%);
    }

    50% {
        transform: translateX(60%);
    }

    100% {
        transform: translateX(220%);
    }
}

/* If dashboardSpin does not already exist */
@keyframes dashboardSpin {
    to {
        transform: rotate(360deg);
    }
}

.subscription-status-canceling {
    color: #d97706 !important;
}

.auth-checkbox {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #374151;
    line-height: 1.45;
}

.auth-checkbox input {
    width: auto !important;
    margin-top: 2px;
    flex-shrink: 0;
}

.auth-checkbox a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.auth-checkbox a:hover {
    text-decoration: underline;
}

.recaptcha-wrapper {
    margin-top: 2px;
    overflow-x: auto;
}

.g-recaptcha {
    transform-origin: left top;
}

.auth-legal-links {
    margin: 14px 0 0;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.auth-legal-links a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.auth-legal-links a:hover {
    text-decoration: underline;
}

.auth-legal-links span {
    margin: 0 6px;
    color: #9ca3af;
}

@media (max-width: 380px) {
    .g-recaptcha {
        transform: scale(0.92);
    }
}

.auth-checkbox {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #374151;
    line-height: 1.45;
}

.auth-checkbox input {
    width: auto !important;
    margin-top: 2px;
    flex-shrink: 0;
}

.auth-checkbox a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.auth-checkbox a:hover {
    text-decoration: underline;
}

/* Data preview table column proportions with analytics columns */
.data-preview-table th:nth-child(1),
.data-preview-table td:nth-child(1) {
    width: 7%;
}

.data-preview-table th:nth-child(2),
.data-preview-table td:nth-child(2) {
    width: 6%;
}

.data-preview-table th:nth-child(3),
.data-preview-table td:nth-child(3) {
    width: 7%;
}

.data-preview-table th:nth-child(4),
.data-preview-table td:nth-child(4) {
    width: 12%;
}

.data-preview-table th:nth-child(5),
.data-preview-table td:nth-child(5),
.data-preview-table th:nth-child(6),
.data-preview-table td:nth-child(6),
.data-preview-table th:nth-child(7),
.data-preview-table td:nth-child(7),
.data-preview-table th:nth-child(8),
.data-preview-table td:nth-child(8),
.data-preview-table th:nth-child(9),
.data-preview-table td:nth-child(9),
.data-preview-table th:nth-child(10),
.data-preview-table td:nth-child(10),
.data-preview-table th:nth-child(11),
.data-preview-table td:nth-child(11) {
    width: 6%;
}

.data-preview-table th:nth-child(12),
.data-preview-table td:nth-child(12),
.data-preview-table th:nth-child(13),
.data-preview-table td:nth-child(13),
.data-preview-table th:nth-child(14),
.data-preview-table td:nth-child(14),
.data-preview-table th:nth-child(15),
.data-preview-table td:nth-child(15),
.data-preview-table th:nth-child(16),
.data-preview-table td:nth-child(16),
.data-preview-table th:nth-child(17),
.data-preview-table td:nth-child(17) {
    width: 5%;
}

.data-preview-table th:nth-child(18),
.data-preview-table td:nth-child(18) {
    width: 9%;
}

/* Keep action buttons visible and aligned */
.data-preview-table td:nth-child(18) {
    overflow: visible;
    padding-left: 8px;
    padding-right: 8px;
}

.data-preview-table .data-row-actions {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.data-preview-table .data-row-actions .btn.tiny {
    flex: 1;
    width: auto;
    min-width: 0;
    text-align: center;
}

.metric-explorer-panel {
    margin-top: 0;
}

.metric-explorer-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.metric-explorer-chart-wrapper {
    position: relative;
    width: 100%;
    height: 340px;
}

.metric-explorer-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

@media (max-width: 600px) {
    .metric-explorer-controls {
        width: 100%;
    }

    .metric-explorer-controls select {
        width: 100%;
    }
}

.forecast-chart-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.forecast-chart-controls select {
    min-width: 170px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

@media (max-width: 700px) {
    .forecast-chart-controls {
        width: 100%;
    }

    .forecast-chart-controls select {
        width: 100%;
    }
}

.analytics-forecast-summary-grid .forecast-card:nth-child(1) {
    border-left: 4px solid #0891b2;
}

.analytics-forecast-summary-grid .forecast-card:nth-child(2) {
    border-left: 4px solid #0f766e;
}

.analytics-forecast-summary-grid .forecast-card:nth-child(3) {
    border-left: 4px solid #f59e0b;
}

.analytics-forecast-summary-grid .forecast-card:nth-child(4) {
    border-left: 4px solid #6366f1;
}

#trafficCalculatorPanel .forecast-calculator-grid {
    grid-template-columns: repeat(3, minmax(180px, 220px));
    justify-content: start;
}

#trafficCalculatorPanel .forecast-calculator-grid input {
    max-width: 220px;
}

@media (max-width: 800px) {
    #trafficCalculatorPanel .forecast-calculator-grid {
        grid-template-columns: 1fr;
    }

    #trafficCalculatorPanel .forecast-calculator-grid input {
        max-width: none;
    }
}

.forecast-disclaimer-panel {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 7px rgba(15, 23, 42, 0.05);
}

.forecast-disclaimer-panel strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.forecast-disclaimer-panel p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.calculator-disclaimer {
    margin-top: 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    border-radius: 10px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
}

.forecast-small-disclaimer {
    margin-top: 6px;
    color: #9ca3af;
    font-size: 12px;
    line-height: 1.4;
}

.overview-data-summary-panel {
    margin-bottom: 14px;
}

.overview-data-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
}

.overview-data-summary-grid div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.overview-data-summary-grid span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 5px;
}

.overview-data-summary-grid strong {
    color: #111827;
    font-size: 14px;
    word-break: break-word;
}

@media (max-width: 1000px) {
    .overview-data-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .overview-data-summary-grid {
        grid-template-columns: 1fr;
    }
}

.data-quality-panel {
    border-left: 4px solid #f59e0b;
}

.data-quality-header h3 {
    margin: 0 0 10px;
}

.data-quality-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.data-quality-list li {
    color: #92400e;
    font-size: 13px;
    line-height: 1.4;
}

.data-quality-list li.info-note {
    color: #374151;
}

.kpi-comparison {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
}

.kpi-comparison.positive {
    color: #16a34a;
}

.kpi-comparison.negative {
    color: #dc2626;
}

.kpi-comparison.neutral {
    color: #6b7280;
}

.platform-summary-panel {
    margin-bottom: 14px;
}

.platform-summary-header h3 {
    margin: 0 0 12px;
}

.platform-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
    gap: 12px;
}

.platform-summary-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
}

.platform-summary-card strong {
    display: block;
    color: #111827;
    font-size: 15px;
    margin-bottom: 8px;
}

.platform-summary-card span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
}

@media (max-width: 1100px) {
    .platform-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .platform-summary-grid {
        grid-template-columns: 1fr;
    }
}

.top-insights-panel {
    margin-bottom: 14px;
}

.top-insights-header h3 {
    margin: 0 0 12px;
}

.top-insights-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
}

.top-insight-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 13px;
}

.top-insight-card span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 6px;
}

.top-insight-card strong {
    display: block;
    color: #111827;
    font-size: 15px;
    line-height: 1.4;
}

.top-insight-card.blue {
    border-left: 4px solid #2563eb;
}

.top-insight-card.green {
    border-left: 4px solid #16a34a;
}

.top-insight-card.red {
    border-left: 4px solid #dc2626;
}

.top-insight-card.purple {
    border-left: 4px solid #7c3aed;
}

@media (max-width: 1100px) {
    .top-insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .top-insights-grid {
        grid-template-columns: 1fr;
    }
}

.overview-chart-wrapper,
.metric-explorer-chart-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}

.anomaly-warning-panel {
    border-left: 4px solid #f59e0b;
    background: rgba(255, 255, 255, 0.96);
}

.anomaly-warning-header h3 {
    margin: 0 0 10px;
}

.anomaly-warning-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.anomaly-warning-list li {
    color: #92400e;
    font-size: 13px;
    line-height: 1.4;
}

/* Collapsible Overview Panels */
.collapsible-overview-panel {
    padding: 0;
    overflow: visible !important;
}

.collapsible-overview-panel>summary {
    list-style: none;
    cursor: pointer;
    padding: 16px;
    font-weight: 800;
    font-size: 16px;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-overview-panel>summary::-webkit-details-marker {
    display: none;
}

.collapsible-overview-panel>summary::after {
    content: "−";
    color: #2563eb;
    font-size: 20px;
    font-weight: 900;
    margin-left: 12px;
}

.collapsible-overview-panel:not([open])>summary::after {
    content: "+";
}

.collapsible-overview-panel>summary span {
    display: inline-flex;
    align-items: center;
}

.collapsible-overview-panel>.top-insights-grid,
.collapsible-overview-panel>.platform-summary-grid,
.collapsible-overview-panel>.data-quality-list {
    padding: 0 16px 16px;
}

.top-insights-panel,
.data-quality-panel,
.platform-summary-panel {
    margin-top: 0;
}

/* Clean collapsible overview panels */
.collapsible-overview-panel {
    padding: 0 !important;
    overflow: visible !important;
    margin-bottom: 14px;
}

.collapsible-overview-panel>summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    font-weight: 800;
    font-size: 16px;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    user-select: none;
}

.collapsible-overview-panel>summary::-webkit-details-marker {
    display: none;
}

.collapsible-overview-panel>summary::after {
    content: "−";
    color: #2563eb;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    margin-left: auto;
}

.collapsible-overview-panel:not([open])>summary::after {
    content: "+";
}

.collapsible-overview-panel>summary>span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.collapsible-overview-content {
    padding: 0 18px 18px;
}

/* Remove awkward default list spacing inside collapsible panels */
.collapsible-overview-content .data-quality-list {
    margin: 0;
    padding-left: 18px;
}

/* Better spacing for insight/platform cards inside collapsibles */
.collapsible-overview-content .top-insights-grid,
.collapsible-overview-content .platform-summary-grid {
    margin: 0;
}

/* Collapsible Filters Panel */
.collapsible-filters-panel {
    padding: 0 !important;
    overflow: visible !important;
}

.collapsible-filters-panel>summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 800;
    font-size: 15px;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    user-select: none;
}

.collapsible-filters-panel>summary::-webkit-details-marker {
    display: none;
}

.collapsible-filters-panel>summary::after {
    content: "−";
    color: #2563eb;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    margin-left: 8px;
}

.collapsible-filters-panel:not([open])>summary::after {
    content: "+";
}

/* Keep title/help and reset button aligned */
.collapsible-filters-panel>summary>span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.collapsible-filters-panel>summary #resetFiltersBtn {
    margin-left: auto;
}

/* Add padding around actual filters */
.collapsible-filters-panel .global-filter-grid {
    padding: 0 16px 16px;
}

/* Keep filter help tooltip above charts */
.collapsible-filters-panel .help-tip,
.collapsible-filters-panel .help-tip::after,
.collapsible-filters-panel .help-tip::before {
    z-index: 99999;
}

.combined-mini-metrics {
    grid-template-columns: repeat(9, minmax(110px, 1fr));
    gap: 0;
}

.combined-mini-metrics div {
    padding: 0 10px;
}

.combined-mini-metrics span {
    white-space: nowrap;
}

.combined-mini-metrics strong {
    white-space: nowrap;
}

@media (max-width: 1400px) {
    .combined-mini-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .combined-mini-metrics div {
        border-right: none;
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .combined-mini-metrics {
        grid-template-columns: 1fr;
    }
}

/* Expandable combined mini metrics row */
.combined-mini-metrics {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: visible !important;
    padding: 8px 10px;
    position: relative;
    z-index: 5;
}

.combined-mini-metrics>div {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border-right: 1px solid #e5e7eb;
    border-radius: 10px;
    background: transparent;
    transition:
        flex-basis 0.22s ease,
        flex-grow 0.22s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.combined-mini-metrics>div:last-child {
    border-right: none;
}

.combined-mini-metrics>div span {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combined-mini-metrics>div strong {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Expand hovered metric */
.combined-mini-metrics>div:hover,
.combined-mini-metrics>div:focus-within {
    flex: 1.25 0 135px;
    z-index: 20;
    background: white;
    transform: translateY(0px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    border: 1px solid #dbeafe;
}

/* Reveal full text on hover */
.combined-mini-metrics>div:hover span,
.combined-mini-metrics>div:focus-within span {
    overflow: visible;
    text-overflow: clip;
}

/* Keep help icon from being squeezed */
.combined-mini-metrics .help-tip {
    flex-shrink: 0;
}

@media (max-width: 1400px) {
    .combined-mini-metrics {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .combined-mini-metrics>div {
        border-right: none;
        justify-content: flex-start;
    }

    .combined-mini-metrics>div:hover,
    .combined-mini-metrics>div:focus-within {
        flex: initial;
        transform: none;
    }
}

@media (max-width: 700px) {
    .combined-mini-metrics {
        grid-template-columns: 1fr;
    }
}

.chart-note {
    margin: -6px 0 10px;
}

.anomaly-warning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.anomaly-warning-header h3 {
    margin: 0 0 10px;
}

.anomaly-warning-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.anomaly-warning-item span {
    flex: 1;
}

.anomaly-ignore-btn {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
}

.anomaly-ignore-btn:hover {
    background: #ffedd5;
    border-color: #fb923c;
}

.anomaly-all-ignored-message span,
.anomaly-extra-message span {
    color: #6b7280;
    font-style: italic;
}

/* Cleaner anomaly/outlier panel layout */
.anomaly-warning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.anomaly-warning-header h3 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.anomaly-show-ignored-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.anomaly-warning-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.anomaly-warning-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 9px 10px;
}

.anomaly-warning-item span {
    min-width: 0;
    color: #92400e;
    font-size: 13px;
    line-height: 1.4;
}

.anomaly-ignore-btn {
    border: 1px solid #fdba74;
    background: #ffffff;
    color: #9a3412;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

.anomaly-ignore-btn:hover {
    background: #ffedd5;
    border-color: #fb923c;
}

.anomaly-all-ignored-message,
.anomaly-extra-message {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.anomaly-all-ignored-message span,
.anomaly-extra-message span {
    color: #6b7280;
    font-style: italic;
}

/* Mobile-friendly anomaly panel */
@media (max-width: 650px) {
    .anomaly-warning-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .anomaly-show-ignored-btn {
        width: 100%;
    }

    .anomaly-warning-item {
        grid-template-columns: 1fr;
    }

    .anomaly-ignore-btn {
        justify-self: start;
    }
}

.anomaly-warning-item {
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        max-height 0.28s ease,
        margin 0.28s ease,
        padding 0.28s ease;
    overflow: hidden;
    max-height: 120px;
}

.anomaly-warning-item.dismissing {
    opacity: 0;
    transform: translateX(12px);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

.anomaly-show-more-row {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.anomaly-show-more-row span {
    color: #6b7280;
    font-style: italic;
}

.anomaly-show-more-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #374151;
}

.anomaly-show-more-btn:hover {
    background: #f3f4f6;
    border-color: #94a3b8;
}

/* Fresh combined mini metrics hover behavior */
.combined-mini-metrics {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 42px;
    height: 42px;
    padding: 8px 10px;
    overflow: visible !important;
    position: relative;
    z-index: 5;
}

/* Each item has a fixed height and transparent border from the start */
.combined-mini-metrics>div {
    box-sizing: border-box;
    position: relative;

    flex: 1 1 0;
    min-width: 0;

    height: 30px;
    min-height: 30px;
    max-height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 5px 9px;

    border: 1px solid transparent;
    border-right-color: #e5e7eb;
    border-radius: 8px;

    background: transparent;
    overflow: visible;

    transition:
        flex-grow 0.18s ease,
        flex-basis 0.18s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.combined-mini-metrics>div:last-child {
    border-right-color: transparent;
}

/* Label/value stay on one line */
.combined-mini-metrics>div>span,
.combined-mini-metrics>div>strong {
    white-space: nowrap;
}

.combined-mini-metrics>div>span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.combined-mini-metrics>div>strong {
    flex-shrink: 0;
}

/*
  Hover expands horizontally only.
  No height, padding, margin, or transform changes.
*/
.combined-mini-metrics>div:hover,
.combined-mini-metrics>div:focus-within {
    flex: 1.65 0 170px;

    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 5px 9px;

    background: white;
    border-color: #dbeafe;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
    z-index: 20;
}

/* Reveal full label when hovered, without changing height */
.combined-mini-metrics>div:hover>span,
.combined-mini-metrics>div:focus-within>span {
    overflow: visible;
    text-overflow: clip;
}

/* Help icon remains stable */
.combined-mini-metrics .help-tip {
    flex-shrink: 0;
}

.combined-mini-metrics,
.combined-mini-metrics:hover {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
}

.combined-mini-metrics>div,
.combined-mini-metrics>div:hover,
.combined-mini-metrics>div:focus-within {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
}

/* Responsive filter grid fix */
.global-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)) !important;
    gap: 12px;
    align-items: end;
    width: 100%;
    min-width: 0;
}

.global-filter-grid>div {
    min-width: 0;
}

.global-filter-grid input,
.global-filter-grid select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.collapsible-filters-panel>summary {
    flex-wrap: wrap;
}

.collapsible-filters-panel>summary #resetFiltersBtn {
    margin-left: auto;
    flex-shrink: 0;
}

/* Prevent double scrollbar when bottom collapsible panels close */
html {
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* .app and .main should not create their own vertical scrollbars */
.app {
    min-height: 100vh;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.main {
    min-height: 100vh;
    height: auto !important;
    max-height: none !important;

    /*
      Important:
      Do not use overflow-x:hidden here.
      It can cause .main to become its own scroll container.
    */
    overflow: visible !important;

    /*
      Small bottom buffer helps when collapsing the last panel
      while scrolled near the bottom.
    */
    padding-bottom: 80px;
}

.table-sort-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #374151;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.table-sort-btn:hover {
    color: #2563eb;
}

.table-sort-btn.active::after {
    content: "↓";
    font-size: 11px;
    color: #2563eb;
}

.table-sort-btn.active.asc::after {
    content: "↑";
}

.table-sort-btn.active.desc::after {
    content: "↓";
}

.campaign-table-header {
    align-items: flex-start;
}

.campaign-table-controls {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.campaign-table-controls .sort-control label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 4px;
}

.campaign-table-controls .sort-control select {
    min-width: 150px;
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

@media (max-width: 700px) {
    .campaign-table-header {
        flex-direction: column;
        gap: 12px;
    }

    .campaign-table-controls,
    .campaign-table-controls .sort-control,
    .campaign-table-controls .sort-control select {
        width: 100%;
    }
}

.table-sort-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #374151;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-align: left;
}

.table-sort-btn:hover {
    color: #2563eb;
}

.table-sort-btn.active::after {
    content: "↓";
    font-size: 11px;
    color: #2563eb;
}

.table-sort-btn.active.asc::after {
    content: "↑";
}

.table-sort-btn.active.desc::after {
    content: "↓";
}

.csv-platform-modal {
    width: min(520px, 100%);
}

.csv-platform-form label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #374151;
    margin-bottom: 6px;
}

.csv-platform-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.csv-platform-form select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

#csvPlatformDetectionNote {
    margin-top: 10px;
}

.csv-custom-platform-wrap {
    margin-top: 14px;
}

.csv-custom-platform-wrap.hidden {
    display: none;
}

.csv-custom-platform-wrap label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #374151;
    margin-bottom: 6px;
}

.csv-custom-platform-wrap input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.csv-custom-platform-wrap input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.saved-platforms-manager {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.saved-platforms-manager-header {
    display: grid;
    gap: 3px;
    margin-bottom: 10px;
}

.saved-platforms-manager-header strong {
    color: #111827;
    font-size: 14px;
}

.saved-platforms-list {
    display: grid;
    gap: 8px;
}

.saved-platform-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 9px 10px;
}

.saved-platform-row span {
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    word-break: break-word;
}

.saved-platform-delete-btn {
    border: none;
    background: #dc2626;
    color: white;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.saved-platform-delete-btn:hover {
    opacity: 0.9;
}

.saved-platform-delete-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.saved-platforms-list {
    display: grid;
    gap: 8px;
    max-height: 145px;
    overflow-y: auto;
    padding-right: 4px;
}

.saved-platforms-list::-webkit-scrollbar {
    width: 8px;
}

.saved-platforms-list::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 999px;
}

.saved-platforms-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.saved-platforms-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#deleteFilteredRowsBtn {
    white-space: nowrap;
}

/* Improved Source Platform Summary */
.platform-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
    gap: 12px;
    align-items: stretch;
}

.platform-summary-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: 4px solid var(--platform-color, #2563eb);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.platform-summary-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.platform-summary-card-header strong {
    display: block;
    color: #111827;
    font-size: 15px;
    margin-bottom: 3px;
}

.platform-summary-card-header span {
    color: #6b7280;
    font-size: 12px;
}

.platform-summary-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex-shrink: 0;
    margin-top: 3px;
}

.platform-summary-primary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}

.platform-summary-primary span {
    display: block;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

.platform-summary-primary strong {
    color: #111827;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.platform-summary-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.platform-summary-metrics div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    padding: 8px;
    min-width: 0;
}

.platform-summary-metrics span {
    display: block;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
}

.platform-summary-metrics strong {
    display: block;
    color: #111827;
    font-size: 13px;
    word-break: break-word;
}

.platform-summary-metrics .muted-metric {
    opacity: 0.45;
}

@media (max-width: 650px) {
    .platform-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Source platform summary: compact cards */
.platform-summary-card {
    min-width: 0;
    padding: 12px;
}

.platform-summary-primary {
    padding: 9px;
}

.platform-summary-primary strong {
    font-size: 15px;
}

.platform-summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.platform-summary-metrics div {
    min-width: 0;
    padding: 7px;
}

.platform-summary-metrics strong {
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* Try to fit all platform cards in one row on wide screens */
@media (min-width: 1700px) {
    .platform-summary-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    }
}

/* Otherwise wrap evenly */
@media (max-width: 1699px) {
    .platform-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    }
}

@media (max-width: 900px) {
    .platform-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 650px) {
    .platform-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

.color-settings-groups {
    display: grid;
    gap: 18px;
    margin-top: 14px;
}

.color-settings-group {
    display: grid;
    gap: 8px;
}

.color-settings-group h4 {
    margin: 0;
    font-size: 14px;
    color: #111827;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.color-settings-group .channel-color-list {
    margin-top: 0;
}

/* Scrollable Campaign Performance table */
.campaign-table-wrapper {
    max-height: 520px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.campaign-performance-table {
    min-width: 1100px;
}

.campaign-performance-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f9fafb;
}

.campaign-performance-table td,
.campaign-performance-table th {
    white-space: nowrap;
}

.export-panel-btn {
    white-space: nowrap;
}

.btn.tiny.secondary {
    background: #4b5563;
}

.chart-panel-header,
.panel-header {
    flex-wrap: wrap;
}

.export-panel-btn {
    padding: 5px 8px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
}

.export-panel-btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #374151;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.12s ease;
}

.export-panel-btn span {
    font-size: 12px;
    line-height: 1;
}

.export-panel-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.export-panel-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.export-panel-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.chart-panel-header .export-panel-btn,
.panel-header .export-panel-btn,
.metric-explorer-controls .export-panel-btn,
.forecast-chart-controls .export-panel-btn,
.campaign-table-controls .export-panel-btn {
    min-height: 34px;
}

.csv-platform-file-name {
    margin: 6px 0 0;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    word-break: break-word;
}

.csv-platform-queue-status {
    margin-top: 4px;
    font-size: 12px;
}

/* Polished Data Notes panel */
.data-quality-panel {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.92), rgba(255, 255, 255, 0.96));
}

.data-quality-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.data-quality-note-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 9px 10px;
    color: #92400e;
}

.data-quality-note-icon {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: white;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    margin-top: 1px;
}

.data-quality-note-text {
    font-size: 13px;
    line-height: 1.45;
}

.data-quality-note-item.info-note {
    color: #374151;
    border-color: #e5e7eb;
    background: #f9fafb;
}

.data-quality-note-item.info-note .data-quality-note-icon {
    background: #6b7280;
}

/* Modern dashboard buttons */
.btn,
.upload-button,
button.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 10px;
    min-height: 36px;
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18);
    transition:
        transform 0.14s ease,
        box-shadow 0.14s ease,
        background 0.14s ease,
        border-color 0.14s ease,
        opacity 0.14s ease;
}

.btn:hover,
.upload-button:hover,
button.btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(37, 99, 235, 0.24);
}

.btn:active,
.upload-button:active,
button.btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.16);
}

.btn:focus,
.upload-button:focus,
button.btn:focus {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.18),
        0 4px 10px rgba(37, 99, 235, 0.18);
}

/* Small buttons */
.btn.small {
    min-height: 32px;
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 9px;
}

/* Tiny buttons */
.btn.tiny {
    min-height: 28px;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

/* Secondary buttons */
.btn.secondary,
.upload-button.secondary-upload,
.secondary-upload {
    color: white;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 4px 10px rgba(71, 85, 105, 0.18);
}

.btn.secondary:hover,
.upload-button.secondary-upload:hover,
.secondary-upload:hover {
    box-shadow: 0 7px 16px rgba(71, 85, 105, 0.24);
}

/* Danger buttons */
.btn.danger {
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.18);
}

.btn.danger:hover {
    box-shadow: 0 7px 16px rgba(220, 38, 38, 0.24);
}

/* Dark upload button option */
.upload-button.secondary-upload {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* Disabled state */
.btn:disabled,
.upload-button:disabled,
button.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.export-panel-btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    min-height: 32px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.12s ease;
}

.export-panel-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.14);
    transform: translateY(-1px);
}

.export-panel-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.export-panel-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.data-row-actions {
    display: flex;
    gap: 7px;
    align-items: center;
}

.data-row-actions .btn.tiny {
    min-width: 72px;
    height: 30px;
    border-radius: 8px;
}

.data-row-actions .btn.tiny.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

#clearDataBtn,
#clearDataBtnBackup,
#deleteFilteredRowsBtn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2);
}

.toolbar-actions .btn,
.data-actions .btn,
.data-preview-controls .btn {
    border-radius: 999px;
}

.channel-color-row {
    grid-template-columns: 24px 1fr 90px 70px 80px;
}

.save-single-channel-color-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .channel-color-row {
        grid-template-columns: 24px 1fr;
    }

    .channel-color-row input,
    .channel-color-row button {
        grid-column: 2;
    }
}

.channel-color-row {
    grid-template-columns: 24px 1fr 90px 80px !important;
}

.color-settings-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

/* Compact Color Settings columns */
#data .color-settings-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Make each Channel Colors / Source Platform Colors section use columns */
#data .color-settings-group .channel-color-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

/* Make each color row a compact card instead of a full-width row */
#data .channel-color-row {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr) 58px 78px !important;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    min-width: 0;
}

/* Prevent long names from creating empty layout space */
#data .channel-color-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Compact color picker */
#data .channel-color-input {
    width: 58px;
    height: 32px;
    justify-self: end;
}

/* Compact Default button */
#data .reset-single-channel-color-btn {
    width: 78px;
    min-height: 32px;
    padding-left: 8px;
    padding-right: 8px;
    justify-self: end;
}

/* Keep the color dot aligned */
#data .channel-color-swatch {
    width: 16px;
    height: 16px;
}

/* Optional: make headings cleaner */
#data .color-settings-group h4 {
    margin-top: 0;
}

/* Mobile: stack neatly */
@media (max-width: 700px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: 1fr;
    }

    #data .channel-color-row {
        grid-template-columns: 18px minmax(0, 1fr) 58px 78px !important;
    }

    #data .channel-color-row input,
    #data .channel-color-row button {
        grid-column: auto !important;
    }
}

/* Color Settings: force 3 columns on desktop */
#data .color-settings-group .channel-color-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-top: 10px;
}

/* Keep each card compact */
#data .channel-color-row {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr) 58px 78px !important;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    min-width: 0;
}

/* Prevent long names from stretching the card */
#data .channel-color-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Compact color input and default button */
#data .channel-color-input {
    width: 58px;
    height: 32px;
    justify-self: end;
}

#data .reset-single-channel-color-btn {
    width: 78px;
    min-height: 32px;
    padding-left: 8px;
    padding-right: 8px;
    justify-self: end;
}

/* Tablet: 2 columns */
@media (max-width: 1100px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Mobile: 1 column */
@media (max-width: 700px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: 1fr !important;
    }

    #data .channel-color-row {
        grid-template-columns: 18px minmax(0, 1fr) 58px 78px !important;
    }

    #data .channel-color-row input,
    #data .channel-color-row button {
        grid-column: auto !important;
    }
}

/* Color Settings responsive column count */

/* Wide desktop: 4 columns */
#data .color-settings-group .channel-color-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px;
}

/* Middle desktop: 3 columns */
@media (max-width: 1500px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Tablet: 2 columns */
@media (max-width: 1100px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Mobile: 1 column */
@media (max-width: 700px) {
    #data .color-settings-group .channel-color-list {
        grid-template-columns: 1fr !important;
    }
}

/* Possible Outliers action buttons */
.anomaly-warning-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.anomaly-ignore-all-btn {
    white-space: nowrap;
}

/* Mobile-friendly outlier actions */
@media (max-width: 650px) {
    .anomaly-warning-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .anomaly-warning-actions .btn {
        width: 100%;
    }
}

/* Forecast calculator display selector */
.forecast-calculator-display-control {
    display: inline-grid;
    gap: 5px;
    margin: 0 0 14px;
    min-width: 220px;
}

.forecast-calculator-display-control label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #374151;
}

.forecast-calculator-display-control select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 13px;
}

.forecast-calculator-results .metric-subvalue {
    display: inline-block;
    margin-left: 4px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 700;
}

@media (max-width: 700px) {
    .forecast-calculator-display-control {
        width: 100%;
    }
}

/* Rich tooltip for forecast title help */
.rich-help-tip {
    position: relative;
    overflow: visible !important;
}

/* Disable the normal data-help tooltip bubble for rich tooltips */
.rich-help-tip::before,
.rich-help-tip::after {
    display: none !important;
}

.rich-help-bubble {
    position: absolute;
    left: 0;
    top: 135%;
    width: 340px;
    background: #111827;
    color: #ffffff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    padding: 11px 13px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000001;
    white-space: normal;
    text-align: left;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transition-delay: 0s;
}

.rich-help-bubble::before {
    content: "";
    position: absolute;
    left: 12px;
    top: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #111827 transparent;
}

.rich-help-bubble strong {
    color: #ffffff;
    font-weight: 900;
}

.rich-help-tip:hover .rich-help-bubble,
.rich-help-tip:focus .rich-help-bubble,
.rich-help-tip:focus-within .rich-help-bubble {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.8s;
}

/* Mobile tooltip width */
@media (max-width: 600px) {
    .rich-help-bubble {
        width: 260px;
        left: auto;
        right: 0;
    }

    .rich-help-bubble::before {
        left: auto;
        right: 12px;
    }
}

/* Dashboard View Mode setting */

.dashboard-view-setting-control {
    display: grid;
    gap: 6px;
    max-width: 280px;
}

.dashboard-view-setting-control label {
    font-size: 13px;
    font-weight: 800;
    color: #374151;
}

.dashboard-view-setting-control select {
    width: 100%;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

.dashboard-view-note {
    margin-top: 12px;
}

/* ================================
   SIMPLE DASHBOARD MODE
================================ */

/* Simple mode: reduce filter complexity
body.simple-dashboard-mode .global-filter-grid>div:has(#sourcePlatformFilter),
body.simple-dashboard-mode .global-filter-grid>div:has(#chartAggregationMode) {
    display: none !important;
} */

/* Simple mode: show fewer mini metrics */
body.simple-dashboard-mode .combined-mini-metrics>div:nth-child(n + 5) {
    display: none !important;
}

body.simple-dashboard-mode .combined-mini-metrics {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(120px, 1fr)) !important;
    height: auto !important;
    max-height: none !important;
}

body.simple-dashboard-mode .combined-mini-metrics>div {
    border-right: none !important;
    justify-content: flex-start !important;
}

/* Simple mode: hide more technical overview panels */
body.simple-dashboard-mode #anomalyWarningPanel,
body.simple-dashboard-mode #dataQualityPanel,
body.simple-dashboard-mode #platformSummaryPanel {
    display: none !important;
}

/* Simple mode: hide advanced forecast controls */
body.simple-dashboard-mode .forecast-chart-controls>select#forecastMetric,
body.simple-dashboard-mode .forecast-chart-controls>select#forecastMethod,
body.simple-dashboard-mode .forecast-chart-controls>select#forecastTrainingRange,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastMetric),
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastMethod),
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastTrainingRange) {
    display: none !important;
}

/* Simple mode: hide technical forecast details */
body.simple-dashboard-mode .analytics-forecast-summary-grid,
body.simple-dashboard-mode .forecast-table-panel,
body.simple-dashboard-mode .forecast-scenario-table-panel {
    display: none !important;
}

/* Simple mode: simplify calculator choices */
body.simple-dashboard-mode .calculator-mode-btn[data-calculator-mode="trend"],
body.simple-dashboard-mode .calculator-mode-btn[data-calculator-mode="traffic"],
body.simple-dashboard-mode #trendCalculatorPanel,
body.simple-dashboard-mode #trafficCalculatorPanel {
    display: none !important;
}

/* Simple mode: hide advanced data tools */
body.simple-dashboard-mode .channel-color-panel,
body.simple-dashboard-mode .data-preview-controls .sort-control,
body.simple-dashboard-mode #deleteFilteredRowsBtn,
body.simple-dashboard-mode #exportRawPreviewTableBtn,
body.simple-dashboard-mode #addRawDataRowBtn {
    display: none !important;
}

/* Simple mode: keep required format hidden to reduce clutter */
body.simple-dashboard-mode #data .panel:has(.code-box) {
    display: none !important;
}

/* Simple mode: campaign table controls are simplified */
body.simple-dashboard-mode .campaign-table-controls .sort-control,
body.simple-dashboard-mode .campaign-table-controls .export-panel-btn {
    display: none !important;
}

/* Simple mode: campaign chart metric selector can be hidden for guided view */
body.simple-dashboard-mode #campaignChartMetric {
    display: none !important;
}

/* Simple mode: reduce visual density on mobile */
@media (max-width: 700px) {
    body.simple-dashboard-mode .combined-mini-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 520px) {
    body.simple-dashboard-mode .combined-mini-metrics {
        grid-template-columns: 1fr !important;
    }
}

.dashboard-view-mode-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 900;
}

/* Simple Mode: keep useful filters visible */

/* Show all main global filter fields */
body.simple-dashboard-mode .global-filter-grid>div {
    display: block !important;
}

/* Optional: still hide only Chart Detail because it is more technical */
body.simple-dashboard-mode .global-filter-grid>div:has(#chartAggregationMode) {
    display: none !important;
}

/* Keep forecast metric and forecast days visible in Simple Mode */
body.simple-dashboard-mode .forecast-chart-controls>select#forecastMetric,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastMetric),
body.simple-dashboard-mode .forecast-chart-controls>select#forecastDays,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastDays) {
    display: grid !important;
}

/* Keep forecast method/training range hidden in Simple Mode unless you want them visible */
body.simple-dashboard-mode .forecast-chart-controls>select#forecastMethod,
body.simple-dashboard-mode .forecast-chart-controls>select#forecastTrainingRange,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastMethod),
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastTrainingRange) {
    display: none !important;
}

/* Simple Mode: show Forecast Method so users can choose Trend or Pattern Aware */
body.simple-dashboard-mode .forecast-chart-controls>select#forecastMethod,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastMethod) {
    display: grid !important;
}

/* Simple Mode: keep Training Range hidden because it is more advanced */
body.simple-dashboard-mode .forecast-chart-controls>select#forecastTrainingRange,
body.simple-dashboard-mode .forecast-chart-controls>.forecast-control-field:has(#forecastTrainingRange) {
    display: none !important;
}

/* Active filter chips shown on chart panels */
.chart-filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.chart-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.chart-filter-chip strong {
    color: #111827;
    font-weight: 900;
}

/* Keep it compact in Simple Mode */
body.simple-dashboard-mode .chart-filter-summary {
    margin-top: 6px;
}

/* ==================================================
   Simple Mode: keep useful in-panel graph/table controls
   ================================================== */

/* Metric Explorer controls */
body.simple-dashboard-mode #metricExplorerMetric,
body.simple-dashboard-mode #metricExplorerGroupBy,
body.simple-dashboard-mode .metric-explorer-controls {
    display: flex !important;
}

/* Forecast controls */
body.simple-dashboard-mode #forecastMetric,
body.simple-dashboard-mode #forecastMethod,
body.simple-dashboard-mode #forecastDays,
body.simple-dashboard-mode .forecast-chart-controls,
body.simple-dashboard-mode .forecast-chart-controls .forecast-control-field:has(#forecastMetric),
body.simple-dashboard-mode .forecast-chart-controls .forecast-control-field:has(#forecastMethod),
body.simple-dashboard-mode .forecast-chart-controls .forecast-control-field:has(#forecastDays) {
    display: flex !important;
}

/* Keep Training Range hidden in Simple Mode because it is more advanced */
body.simple-dashboard-mode #forecastTrainingRange,
body.simple-dashboard-mode .forecast-chart-controls .forecast-control-field:has(#forecastTrainingRange) {
    display: none !important;
}

/* Campaign chart metric dropdown, ex: ROAS / Revenue / Spend */
body.simple-dashboard-mode #campaignChartMetric {
    display: inline-block !important;
}

/* Campaign table sort controls */
body.simple-dashboard-mode .campaign-table-controls .sort-control {
    display: block !important;
}

/* Data Preview table sort controls */
body.simple-dashboard-mode .data-preview-controls .sort-control {
    display: block !important;
}

/* Keep useful table buttons visible */
body.simple-dashboard-mode #toggleRawRowsBtn {
    display: inline-flex !important;
}

/* Still hide destructive / advanced data actions in Simple Mode */
body.simple-dashboard-mode #deleteFilteredRowsBtn,
body.simple-dashboard-mode #exportRawPreviewTableBtn,
body.simple-dashboard-mode #addRawDataRowBtn {
    display: none !important;
}

/* Mobile cleanup for these controls */
@media (max-width: 700px) {

    body.simple-dashboard-mode .metric-explorer-controls,
    body.simple-dashboard-mode .forecast-chart-controls,
    body.simple-dashboard-mode .campaign-table-controls,
    body.simple-dashboard-mode .data-preview-controls {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    body.simple-dashboard-mode .metric-explorer-controls select,
    body.simple-dashboard-mode .forecast-chart-controls select,
    body.simple-dashboard-mode .campaign-table-controls select,
    body.simple-dashboard-mode .data-preview-controls select {
        width: 100% !important;
    }
}

/* Do not show global filters on Account tab, even in Simple Mode */
body.account-tab-active .global-filters-panel,
body.account-tab-active .toolbar {
    display: none !important;
}

/* In Simple Mode, show filters only when not on Account tab */
body.simple-dashboard-mode:not(.account-tab-active) .global-filters-panel {
    display: block !important;
}

/* Center mini metric items */
.combined-mini-metrics>div,
.mini-metrics>div {
    justify-content: center !important;
    text-align: center;
}

/* Keep label/value nicely centered */
.combined-mini-metrics>div>span,
.combined-mini-metrics>div>strong,
.mini-metrics>div>span,
.mini-metrics>div>strong {
    text-align: center;
}

/* Simple Mode should also stay centered */
body.simple-dashboard-mode .combined-mini-metrics>div,
body.simple-dashboard-mode .mini-metrics>div {
    justify-content: center !important;
    text-align: center;
}

/* Coming Soon / Private Testing strip */

.coming-soon-strip-section {
    padding: 0 0 34px;
}

.coming-soon-strip {
    background: linear-gradient(135deg, #111827 0%, #1e293b 100%);
    color: white;
    border-radius: 22px;
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.coming-soon-strip-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.coming-soon-strip-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.coming-soon-strip h2 {
    margin: 0;
    font-size: clamp(20px, 3vw, 28px);
    letter-spacing: -0.03em;
}

.coming-soon-strip p {
    margin: 7px 0 0;
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.55;
    max-width: 720px;
}

.coming-soon-strip-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.coming-soon-strip .landing-btn-secondary {
    color: #111827;
    background: white;
}

@media (max-width: 860px) {
    .coming-soon-strip {
        flex-direction: column;
        align-items: stretch;
    }

    .coming-soon-strip-content {
        flex-direction: column;
    }

    .coming-soon-strip-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .coming-soon-strip-actions .landing-btn {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .coming-soon-strip-section {
        padding-bottom: 24px;
    }

    .coming-soon-strip {
        padding: 18px;
        border-radius: 18px;
    }
}

/* Remove scrollbar around reCAPTCHA */
.recaptcha-wrapper {
    overflow: visible !important;
}

.auth-card {
    overflow: visible !important;
}

@media (max-width: 420px) {
    .g-recaptcha {
        transform: scale(0.92);
        transform-origin: left top;
    }
}