/* style.css file */

/* Dimension Cell with Tooltip Styles */
.dimension-cell-with-tooltip {
    position: relative;
    cursor: help;
}

.dimension-cell-with-tooltip:hover {
    background: var(--sl-color-neutral-50);
    border-radius: var(--sl-border-radius-small);
}

a,
a:visited,
a:hover,
a:focus,
a:active {
    color: inherit;
    text-decoration: none;
}

/* Reset - Exclude Shoelace components from global reset */
*:not(sl-button):not(small):not(sl-divider):not(sl-option):not(sl-popup):not(sl-icon):not(sl-badge):not(sl-card):not(sl-tab):not(sl-tab-group):not(sl-tab-panel):not(sl-spinner):not(sl-alert):not(sl-input):not(sl-textarea):not(sl-select):not(sl-menu):not(sl-menu-item):not(sl-dropdown):not(sl-breadcrumb):not(sl-breadcrumb-item) {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--sl-font-sans);
    background: var(--sl-color-gray-50);
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 64px;
    background: var(--sl-color-green-400);
    z-index: 1000;
}

.header-start {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Menu styling - simplified */

.header sl-dropdown sl-button::part(trigger) {
    background-color: transparent;
    color: var(--sl-color-neutral-0);
    font-size: 1.75rem;
}


.header sl-dropdown sl-button::part(trigger):hover,
.header sl-dropdown sl-button ::part(trigger):focus {
    font-size: var(--sl-font-size-large);
}

.header sl-dropdown::part(panel) {
    background: var(--sl-color-green-400);
    border-radius: var(--sl-border-radius-medium);
    box-shadow: var(--sl-shadow-large);
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1100;
}

/* Simplified menu styling - let Shoelace handle the basics */
.main-menu sl-menu-item {
    padding-top: var(--sl-spacing-3x-small);
    padding-bottom: var(--sl-spacing-3x-small);
}

.main-menu .menu-link {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
}

.header-end {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.header-team-form {
    min-width: 12rem;
    max-width: 16rem;
}

.header-team-form sl-select::part(form-control-label) {
    color: #fff;
    font-size: 0.75rem;
}

.header-team-form sl-select::part(combobox) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.header-team-form sl-select::part(display-input) {
    color: #fff;
}

/* Logo */
.logo-container {
    height: 100%;
    display: flex;
    align-items: center;
}

.logo-container img {
    height: 50px;
    width: auto;
}

/* Main content */
.container {
    max-width: 100%;
    padding: 1rem;
}

/* Leader board specific styles */
.leader-board {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Split panel constraints */
sl-split-panel {
    --min-size: 0;
    --max-size: 100%;
    width: 100%;
}

sl-split-panel::part(start) {
    min-width: 0;
}

sl-split-panel::part(end) {
    min-width: 0;
}

/* Remove any old navigation styles */
.sidenav,
.nav-overlay {
    display: none;
}

/* Keep the menu button visible */
.menu-burger {
    color: ghostwhite;
}

.header sl-breadcrumb::part(base) {
    color: white;
    font-size: 1.25rem;
}

/* Global: spacing between icons and titles wherever slot="header" is used */
[slot="header"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header sl-image::part(base) {
    height: 100%;
    max-height: 50px;
    width: auto;
    object-fit: contain;
    padding: 8px 0;
}

.menu-burger svg {
    width: 28px;
    height: 28px;
}

/* Generic filter container styles */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    align-items: flex-start;
    background: var(--sl-color-neutral-0);
    border-radius: var(--sl-border-radius-medium);
    box-shadow: var(--sl-shadow-x-small);
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.filters-container.loaded {
    opacity: 1;
}

/* Filter components styling */
.filters-container sl-select,
.filters-container sl-dropdown,
.filters-container sl-input {
    flex: 1;
    min-width: 200px;
}

.filters-container sl-select::part(form-control) {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
    }

    .filters-container sl-select,
    .filters-container sl-dropdown,
    .filters-container sl-input {
        width: 100%;
    }
}

/* Remove old period-filter styles */
.period-filter {
    /* Remove any existing period-filter specific styles */
}

/* Custom details element styling */
.filters-container sl-details.custom-icons::part(header) {
    padding: var(--sl-spacing-small);
}

sl-select::part(form-control) {
    margin-bottom: 0;
}

.dropdown-container {
    display: flex;
    gap: 12px;
    margin: 24px 0px;
}

.dropdown {
    background: white;
    padding: 8px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 15px;
}

.dropdown label {
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 4px;
}

.dropdown select {
    border: none;
    background: transparent;
    font-size: 15px;
    text-decoration: underline;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    appearance: none;
    height: 100%;
    /* text-decoration: underline; */
}

.dropdown select:focus {
    outline: none;
}

/* Remove default focus outline and add custom one */
.dropdown:focus-within {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    outline-offset: 2px;
}

form label {
    display: block;
    margin-bottom: 10px;
}

form input[type="text"],
form textarea,
form select,
form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
}

input,
select,
textarea {
    padding: initial;
}

button,
input[type="submit"] {
    background-color: #007bff;
    color: #fff;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    height: fit-content;
}

input[type="submit"]:disabled {
    /* Styles for disabled submit buttons */
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    /* Optional, to indicate it's not clickable */
}

button:hover {
    background-color: #0056b3;
}

/* General Flash Message Styling */
.msg {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: bold;
}

/* Success Message */
.msg-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.msg-success::before {
    content: "✅ ";
    /* White Heavy Check Mark emoji */
}

/* Fail Message */
.msg-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.msg-error::before {
    content: "❌ ";
    /* Cross Mark emoji */
}

/* Info Message */
.msg-info {
    background-color: #cce5ff;
    border-color: #b8daff;
    color: #004085;
}

.msg-info::before {
    content: "ℹ️ ";
    /* Information Source emoji */
}

/* Media query for mobile/narrow screens */
@media (max-width: 600px) {
    .container {}

    form {
        width: 100%;
    }

    label {
        display: block;
        margin-bottom: 8px;
    }

    input,
    select,
    textarea {
        width: 100%;
        margin-bottom: 16px;
        box-sizing: border-box;
    }
}

.hidden {
    display: none;
}

caption {
    background: #8e488e;
    color: #fff;
    padding: 0.25em;
}

table {
    border-collapse: collapse;
}

.loadingspinner {
    pointer-events: none;
    width: 2.5em;
    height: 2.5em;
    border: 0.4em solid transparent;
    border-color: #eee;
    border-top-color: #3e67ec;
    border-radius: 50%;
    animation: loadingspin 1s linear infinite;
}

@keyframes loadingspin {
    100% {
        transform: rotate(360deg);
    }
}

.tag-platform {
    background: #deebde;
    border-radius: 3px;
    padding: 3px;
    font-size: x-small;
}

/* Each individual offer on /offers page */
.offer>table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    border: none;
}


.green {
    color: green;
}

.red {
    color: red;
}

.neutral {
    color: gray;
}

.hidden {
    display: none;
}

.loadingspinner {
    /* Add your loading spinner styles here */
}

.box {
    margin-bottom: 10px;
}

.box label {
    margin-right: 10px;
}

.value-growth {
    display: inline-block;
    margin-left: 10px;
}


.tooltip {
    font-size: 16px;
    line-height: 20px;
    padding: 6px 10px;
    background: #444;
    border: 1px solid #222;
    visibility: hidden;
    opacity: 0;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s, visibility 0s 0.3s;
    color: white;
    min-width: 120px;
    max-width: 420px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.tooltip.active {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s, visibility 0s;
}

.login-container {
    max-width: 440px;
    margin: 2rem auto;
    padding: 2.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.login-container .password-note {
    font-size: 0.875em;
    color: #6b7280;
    margin-top: 0.75rem;
    line-height: 1.5;
}

.login-container .security-notice {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875em;
    color: #6b7280;
}

.login-container form {
    text-align: center;
}

.login-container .form-wrapper {
    position: relative;
}

.login-container .input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-container label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.9em;
}

.login-container input[type="email"],
.login-container input[type="password"] {
    width: 90%;
    padding: 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.login-container input[type="email"]:focus,
.login-container input[type="password"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.login-container button[type="submit"] {
    background: #3b82f6;
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    width: 90%;
    cursor: pointer;
    transition: background 0.2s;
}

.login-container button[type="submit"]:hover {
    background: #2563eb;
}

/* Ensure dropdowns are fully visible */
sl-dropdown::part(panel) {
    z-index: 100;
}

.filters-container sl-menu {
    overflow: visible;
    /* Allow select dropdowns to overflow outside menu */
}


.filters-container sl-select::part(listbox) {
    max-height: 300px;
    overflow-y: auto;
}

.filters-container sl-dropdown {
    position: relative;
}

/* Ensure the dropdown panel stays above other content */
.filters-container sl-dropdown::part(panel) {
    z-index: 100;
}

/* Filters menu styling */
.filters-container sl-details {
    min-width: 200px;
    position: relative;
    padding: 0;
}

.filters-container sl-details::part(header) {
    padding: var(--sl-spacing-small);
}

.filters-container sl-details::part(content) {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--sl-color-neutral-0);
    border-radius: var(--sl-border-radius-medium);
    box-shadow: var(--sl-shadow-medium);
    width: 300px;
    z-index: 500;
    /* Ensure it's below the main menu */
    padding: var(--sl-spacing-small);
}

/* Main menu should have higher z-index */
.main-menu {
    z-index: 1000;
}

/* Ensure main menu items stay on top */
.main-menu sl-menu-item {
    z-index: 1001;
}

.filters-menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.filter-item {
    width: 100%;
}

.filters-container sl-select {
    width: 100%;
}

/* Header menu dropdown should always be on top */
.header sl-dropdown::part(panel) {
    z-index: 1000;
    position: relative;
}

/* Menu items use Shoelace defaults */

/* Ensure dropdown menu appears correctly */
.header sl-dropdown {
    position: relative;
}

.header sl-dropdown::part(panel) {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--sl-color-neutral-0);
    border-radius: var(--sl-border-radius-medium);
    box-shadow: var(--sl-shadow-medium);
    z-index: 1100;
    /* Ensure it's above other content */
}

/* Style the menu trigger button */
.header .menu-burger {
    color: ghostwhite;
    padding: 0.5rem;
}

.header .menu-burger sl-icon {
    font-size: 1.5rem;
}

/* Menu trigger button styling */
.header sl-dropdown sl-button::part(base) {
    background: transparent;
    border: none;
    color: var(--sl-color-neutral-0);
    font-size: 1.75rem;
    padding: 0.5rem;
}

.header sl-dropdown sl-button::part(base):hover,
.header sl-dropdown sl-button::part(base):focus {
    background: rgba(255, 255, 255, 0.1);
}

.header sl-dropdown sl-button sl-icon {
    font-size: 1.75rem;
}

/* Pivot Table Styles */
.pivot-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    padding: 20px;
}

.pivot-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.date-range-selector {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.pivot-dimensions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.pivot-section {
    display: flex;
    flex-direction: column;
}

.pivot-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #555;
}

.dimension-dropzone {
    min-height: 100px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    padding: 10px;
    background: #f9f9f9;
    flex-grow: 1;
}

.dimension-dropzone.dragover {
    background: #e9f5ff;
    border-color: #3498db;
}

.dimension-item {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #e9f5ff;
    border: 1px solid #3498db;
    border-radius: 4px;
    margin: 5px;
    cursor: move;
    user-select: none;
}

.dimension-placeholder {
    color: #999;
    text-align: center;
    padding: 20px 0;
}

.remove-dimension {
    margin-left: 8px;
    cursor: pointer;
    color: #e74c3c;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}



/* Tabulator customizations */
.pivot-table-element {
    height: 500px;
    width: 100%;
    margin-top: 20px;
}

.tabulator {
    border-radius: 4px;
    border: 1px solid #ddd;
    font-family: inherit;
}

.tabulator .tabulator-header {
    background-color: #f5f7fa;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: #f5f7fa;
}

.tabulator .tabulator-row.tabulator-group {
    background-color: #edf2f7;
    font-weight: 600;
}

.tabulator .tabulator-row.tabulator-group.tabulator-group-level-1 {
    background-color: #f8fafc;
}

.tabulator .tabulator-footer {
    background-color: #f5f7fa;
    border-top: 1px solid #ddd;
}

.tabulator .tabulator-footer .tabulator-paginator {
    font-family: inherit;
}

/* Loading and error states */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 1.2rem;
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #e74c3c;
    font-size: 1.2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pivot-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .date-range-selector {
        width: 100%;
        flex-wrap: wrap;
    }

    .pivot-dimensions {
        grid-template-columns: 1fr;
    }
}

/* Performance Report Styles */
:root {
    --sl-color-primary-600: #9860ed;
    --header-bg-color: #00c853;
}

/* Header styling */
.header {
    background-color: var(--header-bg-color);
}

/* Report header */
.performance-report-header {
    margin-bottom: 20px;
}

.performance-report-header .performance-report-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1rem;
}

.performance-report-header .performance-report-title h2 {
    margin-bottom: 0;
}

.performance-report-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.report-detail-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.report-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #1f2937;
    text-decoration: none;
}

.report-detail-back:hover {
    text-decoration: underline;
}

.report-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    font-size: 0.95rem;
    color: #4a5568;
}

.report-detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Report mapping assistant */
.report-mapping {
    margin: 16px 0;
}

.report-mapping-card {
    border-radius: 12px;
}

.report-mapping-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.report-mapping-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px 16px;
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.report-mapping-readonly {
    margin: 8px 0 12px;
    padding: 8px 12px;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 0.9rem;
}

.report-mapping-section {
    margin-top: 8px;
}

.report-mapping-section-title {
    font-weight: 600;
}

.report-mapping-note {
    margin: 6px 0 10px;
    color: #64748b;
    font-size: 0.9rem;
}

.report-mapping-empty {
    padding: 8px 0;
    color: #64748b;
    font-size: 0.95rem;
}

.report-mapping-table {
    display: grid;
    gap: 8px;
    overflow-x: auto;
}

.report-mapping-row {
    display: grid;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 0.9rem;
    min-width: 980px;
}

.report-mapping-row--integration {
    grid-template-columns: 140px 140px 120px 80px minmax(200px, 1fr) minmax(200px, 1fr) minmax(180px, 1fr) 140px;
}

.report-mapping-row--publisher {
    grid-template-columns: minmax(200px, 1fr) 160px 160px 80px minmax(220px, 1fr) 160px;
}

.report-mapping-row--header {
    background: #f8fafc;
    border-color: #e2e8f0;
    font-weight: 600;
    color: #475569;
}

.report-mapping-row--header div {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.report-mapping-row sl-select {
    width: 100%;
}

.report-mapping-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.report-mapping-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.report-mapping-pill--missing,
.report-mapping-pill--ambiguous {
    background: #fee2e2;
    color: #b91c1c;
}

.report-mapping-pill--app_only {
    background: #fef3c7;
    color: #b45309;
}

.report-mapping-pill--exact {
    background: #dcfce7;
    color: #15803d;
}

.report-mapping-toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.report-map-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #f8fafc;
    cursor: pointer;
}

.report-map-btn sl-icon {
    font-size: 1.05rem;
}

.scope-tooltip-icon {
    font-size: 0.85rem;
    color: #64748b;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.report-map-btn--ok {
    color: #15803d;
    border-color: #bbf7d0;
    background: #dcfce7;
}

.report-map-btn--warn {
    color: #b45309;
    border-color: #fde68a;
    background: #fef3c7;
}

.report-map-btn--bad {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fee2e2;
}

.report-map-drawer::part(body) {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-map-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 4px 10px;
    font-size: 0.85rem;
    color: #475569;
}

.report-map-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 10px;
    font-size: 0.85rem;
    color: #475569;
}

.report-map-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #475569;
}

.report-map-status-pill--ok {
    background: #dcfce7;
    color: #15803d;
}

.report-map-status-pill--warn {
    background: #fef3c7;
    color: #b45309;
}

.report-map-status-pill--bad {
    background: #fee2e2;
    color: #b91c1c;
}

.report-map-readonly {
    padding: 8px 12px;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 0.9rem;
}

.report-map-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-map-debug {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.report-map-section::part(header) {
    padding: 0;
}

.report-map-section-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.report-map-section-title--sub {
    font-size: 0.85rem;
}

.report-map-key {
    color: #64748b;
    font-size: 0.85rem;
}

.report-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
    align-items: end;
}

.report-map-grid--baseline {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
}

.report-map-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    align-items: center;
}

.report-map-note {
    font-size: 0.72rem;
    color: #64748b;
}

.report-map-subsection {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 8px;
    background: #f8fafc;
}

.report-map-subsection::part(header) {
    padding: 0;
}

.report-map-baseline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.report-map-toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

/* Report filters */
.report-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.report-filters .period-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-filters .custom-range-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    color: #6b7280;
}

.report-filters .custom-date-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.report-filters .custom-date-range sl-input {
    min-width: 160px;
}

.report-filters sl-select,
.report-filters sl-button {
    min-width: 200px;
}

.report-filters .calendar-range-btn {
    min-width: auto;
}

.report-filters .calendar-range-btn::part(base) {
    padding: 0.35rem;
}

.report-filters .more-filters-btn::part(base) {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.report-filters .more-filters-btn::part(base):hover,
.report-filters .more-filters-btn::part(base):focus {
    background: #15803d;
    border-color: #15803d;
}

/* Report diagnostics */
.report-diagnostics {
    margin: 12px 0 16px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: var(--sl-shadow-x-small);
}

.report-diagnostics .diagnostics-card {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #1f2937;
}

.report-diagnostics .diagnostics-details {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.report-diagnostics .diagnostics-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
    padding: 6px 10px;
    margin: -6px -10px 8px;
    border-radius: 6px;
}

.report-diagnostics .diagnostics-details[open] summary {
    background: #eef2f7;
    border-bottom: 1px solid #e2e8f0;
}

.report-diagnostics .diagnostics-details ul {
    padding-left: 18px;
}

.report-diagnostics .diagnostics-sql {
    margin: 0;
    padding: 10px 12px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    overflow: auto;
    font-size: 0.85rem;
    line-height: 1.4;
}

.report-diagnostics .diagnostics-sql code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: pre;
}

/* Filter tags/pills */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-tag {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 14px;
    color: #4a5568;
}

.filter-tag .remove-tag {
    margin-left: 6px;
    cursor: pointer;
    color: #64748b;
    font-weight: bold;
}

.filter-tag .remove-tag:hover {
    color: #e53e3e;
}

/* More filters button */
/* More filters button now uses Shoelace sl-button component */

/* New Filters panel based on screenshot */
.filters-panel {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin: 10px 0 20px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.filters-menu-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-column {
    flex: 1;
    min-width: 180px;
}

.filter-dropdown {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: #4a5568;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%234a5568' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 8px) center;
    padding-right: 30px;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
    color: #4a5568;
}

.period-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-dropdown .filter-dropdown {
    flex: 1;
}

.remove-period {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.remove-period:hover {
    color: #e53e3e;
}

.add-advertiser-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px dashed #9860ed;
    border-radius: 4px;
    color: #9860ed;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.add-advertiser-btn:hover {
    background-color: rgba(152, 96, 237, 0.05);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Apply filters button now uses Shoelace sl-button component */

/* Loading skeleton */
.filters-skeleton {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.skeleton-rect {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Table container */
.table-container {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Reports3: allow wide metric sets without breaking page layout */
.table-container .reports3-datatable {
    min-width: 100%;
    width: max-content;
}

/* DataTable styling */
.dataTable-wrapper .dataTable-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 1rem 0;
}

.dataTable-wrapper .dataTable-container {
    border: none;
}

/* Pagination info */
.pagination-info {
    margin-top: 16px;
    color: #4a5568;
    font-size: 14px;
}

/* DataTable selector and search */
.dataTable-selector {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background-color: white;
    color: #4a5568;
}

.dataTable-input {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background-color: white;
    color: #4a5568;
    width: 200px;
}



/* Advertiser row styling */
.dimension-row {
    cursor: pointer;
}

.dimension-row td:first-child {
    position: relative;
    padding-left: 24px;
}

.dimension-row td:first-child::before {
    content: '▼';
    position: absolute;
    left: 8px;
    color: #9860ed;
    font-size: 10px;
}

.dimension-name {
    font-weight: 600;
    color: #2d3748;
    display: block;
    margin-bottom: 4px;
}


/* Dimension links */
tr .dimension-links {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    tr:hover .dimension-links,
    tr:focus-within .dimension-links {
        opacity: 1;
    }
}

@media (hover: none), (pointer: coarse) {
    tr .dimension-links {
        opacity: 1;
    }
}

.dimension-links a {
    color: #9860ed;
    text-decoration: none;
    font-size: small;
}

.dimension-links a:hover {
    text-decoration: underline;
}

/* Offer field styling */
.offer-field-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.offer-field-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.offer-app-icon-wrapper {
    position: relative;
    flex-shrink: 0;
}

.offer-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.platform-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.offer-field-content {
    flex: 1;
    min-width: 0;
}

.dimension-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.dimension-title-row .advertiser-name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.dimension-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offer-field-content .advertiser-name {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.dimension-meta {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.75;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dimension-meta small {
    display: block;
    line-height: 1.4;
}

.app-id-clickable {
    cursor: pointer;
    position: relative;
}

.copyable-app-id {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 3px;
    color: #475569;
    transition: all 0.2s ease;
}

.app-id-clickable:hover .copyable-app-id,
.copyable-app-id:hover {
    background: #e2e8f0;
    color: #334155;
}

.app-id-clickable.copy-feedback .copyable-app-id {
    background: #dcfce7;
    color: #166534;
    animation: copyPulse 0.3s ease;
}

@keyframes copyPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.action-links-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.action-link:hover {
    opacity: 1;
    background: #f1f5f9;
    transform: scale(1.1);
}

.action-link:active {
    transform: scale(0.95);
}

/* Metric styling */
.metric {
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 0;
}

.metric-action:hover {
    color: #334155;
    background: #f1f5f9;
    border-radius: 4px;
}

/* Reports3: row actions hidden until hover (CSS-only; space reserved via opacity) */
.reports3-datatable tbody tr:not(.expandable-row-content) .metric-action,
.reports3-datatable tbody tr:not(.expandable-row-content) .reports3-filter-by-item,
.reports3-datatable tbody tr:not(.expandable-row-content) .report-map-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .reports3-datatable tbody tr:not(.expandable-row-content):hover .metric-action,
    .reports3-datatable tbody tr:not(.expandable-row-content):hover .reports3-filter-by-item,
    .reports3-datatable tbody tr:not(.expandable-row-content):hover .report-map-btn,
    .reports3-datatable tbody tr:not(.expandable-row-content):focus-within .metric-action,
    .reports3-datatable tbody tr:not(.expandable-row-content):focus-within .reports3-filter-by-item,
    .reports3-datatable tbody tr:not(.expandable-row-content):focus-within .report-map-btn {
        opacity: 1;
    }
}

@media (hover: none), (pointer: coarse) {
    .reports3-datatable tbody tr .metric-action,
    .reports3-datatable tbody tr .reports3-filter-by-item,
    .reports3-datatable tbody tr .report-map-btn {
        opacity: 1;
    }
}

.metric-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
}

.metric-item {
    margin-bottom: 5px;
}

.change {
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    width: 70px;
    text-align: center;
}

.change.green,
.change.positive {
    background: #dcfce7;
    color: #166534;
}

.change.red,
.change.negative {
    background: #fee2e2;
    color: #991b1b;
}

.change.neutral {
    background: #f1f5f9;
    color: #64748b;
}

.current-value,
.value {
    font-weight: 500;
}


table.datatable {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    border: none;

    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
}


table.datatable th.selected-column,
table.datatable td.selected-column {
    background-color: rgba(152, 96, 237, 0.05);
}


table.datatable thead th {
    position: -webkit-sticky;
    /* For Safari browser compatibility */
    position: sticky;
    top: 0;
    /* Adjusted: Main header is no longer sticky, so table header sticks to viewport top */
    z-index: 10;
    /* This ensures the sticky header stays above other content in the table body.
                 You might need to adjust this value depending on other z-indexed
                 elements on your page. */

    background: #f8f9fa;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    border-top: none;
    border-left: none;
    border-right: none;
}

/* Override for narrow screens where .table-container scrolls */
@media (max-width: 768px) {
    table.datatable thead th {
        top: 0;
        /* Stick to the top of the .table-container */
    }
}

table.datatable tbody td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    border-top: none;
    border-left: none;
    border-right: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .report-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-container {
        padding: 4px;
        overflow-x: auto;
    }

    .filters-menu-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }
}

/* Icon styles for filter buttons */
.filter-icon,
.plus-icon {
    display: inline-block;
    margin-right: 6px;
    font-style: normal;
}

.plus-icon {
    font-size: 16px;
    font-weight: bold;
}

/* Top section with search only */
.dataTable-top {
    margin-bottom: 15px;
    text-align: right;
}

/* Bottom section with pagination and entries selector */
.dataTable-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* Pagination info on the left */
.pagination-info {
    flex: 1;
    text-align: left;
    font-size: 0.9rem;
    color: #666;
}

.pagination-info p {
    margin: 0;
}

/* Entries per page selector on the right */
.dataTable-dropdown {
    flex: 0 0 auto;
    font-size: 0.9rem;
}

/* Style inputs consistently */
.dataTable-input,
.dataTable-selector {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Ensure sufficient width for search input */
.dataTable-input {
    min-width: 200px;
}

/* Table header styling */
.datatable th {
    padding: 6px 10px;
    vertical-align: middle;
    height: auto;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid #e0e0e0;
}

/* Make table more compact */
.datatable td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

/* Organic switch styling */
.organic-switch-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    height: 100%;
    padding: 6px 0;
}

.organic-switch-container label {
    font-size: 15px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0;
    cursor: pointer;
}

/* Style the switch to match screenshot */
sl-switch::part(base) {
    --height: 22px;
    --width: 42px;
}

sl-switch::part(control) {
    background-color: #e2e8f0;
    border-color: #cbd5e0;
    transition: background-color 0.2s, border-color 0.2s;
}

sl-switch::part(thumb) {
    background-color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

sl-switch[checked]::part(control) {
    background-color: #9860ed;
    border-color: #9860ed;
}

sl-switch:focus-visible::part(base) {
    outline: 2px solid #9860ed;
    outline-offset: 2px;
}

/* Ensure proper alignment in filter column */
.filter-column .organic-switch-container {
    margin-top: 2px;
    padding-left: 3px;
}

/* Position the switch in the right column to match screenshot */
.filter-row:last-child .filter-column:last-child {
    display: flex;
    align-items: center;
}

/* Enhanced Datatable Styles */
.datatable {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: white;
    border-radius: var(--sl-border-radius-medium);
    box-shadow: var(--sl-shadow-x-small);
}

.datatable thead th {
    background-color: var(--sl-color-neutral-50);
    color: var(--sl-color-neutral-700);
    font-weight: var(--sl-font-weight-semibold);
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--sl-color-neutral-200);
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.datatable thead th:hover {
    background-color: var(--sl-color-neutral-100);
}

.datatable thead th.sortable-numeric:after,
.datatable thead th.sortable-text:after,
.datatable thead th.sortable-date:after {
    content: '↕';
    position: absolute;
    right: 0.5rem;
    opacity: 0.5;
}

.datatable thead th.asc:after {
    content: '↑';
    opacity: 1;
}

.datatable thead th.desc:after {
    content: '↓';
    opacity: 1;
}

.datatable tbody tr {
    border-bottom: 1px solid var(--sl-color-neutral-100);
    transition: background-color 0.2s ease;
}

.datatable tbody tr:last-child {
    border-bottom: none;
}

.datatable tbody tr:hover,
.datatable tbody tr.highlight {
    background-color: var(--sl-color-neutral-50);
}

.datatable tbody tr.odd {
    background-color: white;
}

.datatable tbody tr.even {
    background-color: var(--sl-color-neutral-50);
}

.datatable tbody td {
    padding: 0.75rem 1rem;
    color: var(--sl-color-neutral-700);
    vertical-align: middle;
}

/* Action buttons styling */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--sl-border-radius-medium);
    color: var(--sl-color-neutral-700);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--sl-color-neutral-100);
    color: var(--sl-color-primary-600);
}

.btn-icon sl-icon {
    font-size: 1rem;
}

.action-text {
    display: none;
}

/* New Record button styling */
.box_buttons {
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--sl-border-radius-medium);
    font-weight: var(--sl-font-weight-semibold);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background-color: var(--sl-color-primary-600);
    color: white;
}

.btn-primary:hover {
    background-color: var(--sl-color-primary-700);
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--sl-color-neutral-500);
}

.empty-state sl-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-message {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.empty-state-description {
    max-width: 400px;
    margin-bottom: 1.5rem;
}

/* Pagination styling */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem 0;
}

.pagination-info {
    color: var(--sl-color-neutral-600);
}

.pagination-controls {
    display: flex;
    gap: 0.25rem;
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--sl-border-radius-medium);
    background-color: var(--sl-color-neutral-0);
    color: var(--sl-color-neutral-700);
    border: 1px solid var(--sl-color-neutral-200);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-button:hover {
    background-color: var(--sl-color-neutral-100);
}

.pagination-button.active {
    background-color: var(--sl-color-primary-600);
    color: white;
    border-color: var(--sl-color-primary-600);
}

.pagination-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .datatable {
        display: block;
        overflow-x: auto;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

/* Add specific padding to the prefix part for spacing */
sl-input::part(prefix) {
    padding-inline-start: var(--sl-spacing-2x-small);
    padding-inline-end: var(--sl-spacing-2x-small);
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.pagination-info {
    color: #6c757d;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-pagination {
    padding: 5px 12px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #495057;
    text-decoration: none;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-pagination:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.btn-pagination.current {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    cursor: default;
}

.btn-pagination:disabled,
.btn-pagination.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}


#header-team-select {
    margin-right: 30px;
}