/* =========================================================
   META DASHBOARD — DESKTOP STYLES
   All page-specific styles are grouped below with comment
   headers so you can find which CSS belongs to which
   template. Responsive/mobile overrides live in
   responsive.css, NOT in this file.
========================================================= */

* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #f8f9fa;

    --border: #e1e4e8;
    --border-light: #edf0f2;

    --text: #1c2b33;
    --text-secondary: #46545c;
    --muted: #68757d;
    --muted-light: #8a959b;

    --blue: #1877f2;
    --blue-dark: #0f65d8;
    --blue-soft: #eaf3ff;

    --green: #22a447;
    --green-soft: #eaf8ee;

    --red: #d93025;
    --red-soft: #fdeceb;

    --orange: #f0a71b;

    --shadow-sm: 0 1px 2px rgba(28, 43, 51, 0.04);
    --shadow-md: 0 4px 18px rgba(28, 43, 51, 0.07);
}


/* =========================================================
   RESET
   (used everywhere)
========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   BASE.HTML — MAIN LAYOUT
========================================================= */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    width: calc(100% - 220px);
    min-width: 0;
    min-height: 100vh;
    margin-left: 220px;
}

.page-content {
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    padding: 26px 30px 44px;
}


/* =========================================================
   BASE.HTML — SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-light);
}

.meta-logo {
    color: var(--blue);
    font-size: 28px;
    font-weight: 800;
}

.sidebar-nav {
    padding: 12px 8px;
}

.sidebar-item {
    position: relative;
    width: calc(100% - 16px);
    height: 44px;
    margin: 3px 8px;
    padding: 0 12px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #46545c;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: #edf4ff;
    color: var(--blue);
}

.sidebar-icon {
    width: 20px;
    flex: 0 0 20px;
    font-size: 17px;
    text-align: center;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 10px 8px;
}


/* =========================================================
   BASE.HTML — TOPBAR
========================================================= */

.topbar {
    height: 64px;
    padding: 0 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-selector {
    min-width: 190px;
    padding: 9px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 12px;
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e8edf1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}


/* =========================================================
   BASE.HTML — TOP TABS (Overview / Diagnostics)
========================================================= */

.tabs-bar-wrapper {
    padding: 0 28px;
    background: #ffffff;
}

.dashboard-tabs,
.tabs {
    height: 46px;
    margin-bottom: 18px;
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-bar-wrapper .dashboard-tabs {
    margin-bottom: 0;
}

.dashboard-tabs::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
    display: none;
}

.dashboard-tabs a,
.tab {
    position: relative;
    height: 46px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    color: #59666e;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.dashboard-tabs a:hover,
.tab:hover {
    color: var(--text);
}

.dashboard-tabs a.active,
.tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 700;
}


/* =========================================================
   GENERAL PAGE HELPERS
   (used across businesses / datasets / settings pages)
========================================================= */

.meta-page,
.dashboard-page {
    width: 100%;
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.page-heading {
    margin-bottom: 6px;
}

.page-heading h1 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 4px;
}

.section-header h2 {
    margin: 0 0 3px;
    font-size: 15px;
}

.section-header p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.page-link {
    color: var(--blue);
    text-decoration: none;
}

.page-link:hover {
    text-decoration: underline;
}


/* =========================================================
   BUTTONS
   (used everywhere)
========================================================= */

.meta-button,
.primary-button,
.secondary-button {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.05s ease;
}

.meta-button:active,
.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.meta-button.primary,
.primary-button {
    color: #ffffff;
    background: var(--blue);
    border-color: var(--blue);
}

.meta-button.primary:hover,
.primary-button:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.18);
}

.meta-button.secondary,
.secondary-button {
    color: #27363e;
    background: #ffffff;
    border-color: #ccd3d8;
}

.meta-button.secondary:hover,
.secondary-button:hover {
    background: #f7f8f9;
    border-color: #bcc5cb;
}

.full-button {
    width: 100%;
    margin-top: 15px;
}

.meta-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}


/* =========================================================
   CARDS (generic)
   (used everywhere)
========================================================= */

.meta-card,
.card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
}

.meta-card-header,
.card-header {
    min-height: 70px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border-light);
}

.meta-card-header-content {
    min-width: 0;
}

.meta-card-title,
.card-header h2 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
}

.meta-card-description,
.card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}


/* =========================================================
   EMPTY STATE CARD
   (used on: businesses.html "connect meta" prompt,
   connect_meta.html, datasets.html empty state,
   overview.html empty table)
========================================================= */

.empty-card {
    padding: 45px 20px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
    text-align: center;
}

.empty-card-narrow {
    max-width: 480px;
    margin: 60px auto;
}

.empty-icon {
    margin-bottom: 10px;
    font-size: 25px;
}

.empty-card h3 {
    margin: 0 0 6px;
    font-size: 14px;
}

.empty-card p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.empty-table,
.empty-state {
    padding: 40px 20px !important;
    text-align: center !important;
    color: #77838a !important;
}


/* =========================================================
   BUSINESSES.HTML + DATASETS.HTML — CARD GRID
========================================================= */

.business-list,
.dataset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.business-card,
.dataset-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}

.business-card:hover,
.dataset-card:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.business-card.selected {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.business-card-icon,
.dataset-card-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-soft);
    color: var(--blue);
    border-radius: 10px;
    font-size: 20px;
}

.business-card-content,
.dataset-card-content {
    min-width: 0;
    flex: 1;
}

.business-card-content h3,
.dataset-card-content h3 {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.business-card-content p,
.dataset-card-content p,
.dataset-id {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dataset-meta {
    margin-top: 6px;
}

.dataset-meta span {
    font-size: 10px;
    color: var(--muted-light);
}

.business-card-arrow {
    flex: 0 0 auto;
    color: var(--muted-light);
    font-size: 16px;
}

.dataset-card-action {
    flex: 0 0 auto;
}


/* =========================================================
   OVERVIEW.HTML + DIAGNOSTICS.HTML — DATASET HEADER
========================================================= */

.dataset-header {
    min-height: 62px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dataset-header-left,
.dataset-title-area {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dataset-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #697780;
    font-size: 18px;
}

.dataset-title,
.dataset-title-area h1 {
    min-width: 0;
    margin: 0;
    color: var(--text);
    font-size: 19px;
    line-height: 1.25;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dataset-subtitle,
.dataset-title-area p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.dataset-header-actions,
.header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataset-header-actions form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataset-title-edit {
    margin-left: 6px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.dataset-title-edit:hover {
    color: var(--blue);
}


/* =========================================================
   OVERVIEW.HTML — DATE PICKER / CHART CONTROLS
========================================================= */

.chart-date-selector {
    padding: 7px 10px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #53616a;
    font-size: 10px;
    white-space: nowrap;
}

input[type="date"].chart-date-selector {
    border: 1px solid #dcdfe4;
    border-radius: 6px;
    padding: 6px 10px;
}

.chart-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.chart-title-icon {
    color: var(--blue);
    font-size: 15px;
}


/* =========================================================
   OVERVIEW.HTML — SUMMARY GRID
========================================================= */

.summary-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.summary-card,
.stat-card {
    min-width: 0;
    min-height: 108px;
    padding: 16px 17px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.summary-card:hover,
.stat-card:hover {
    border-color: #d5dadd;
    box-shadow: var(--shadow-md);
}

.summary-card-label,
.stat-card span {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.summary-card-value,
.stat-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 23px;
    line-height: 1.1;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-card-meta,
.stat-card small {
    color: #7b878e;
    font-size: 10px;
}

.stat-card-sync {
    font-size: 17px !important;
}


/* =========================================================
   OVERVIEW.HTML — MAIN GRID (chart + side card)
========================================================= */

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.35fr) minmax(280px, 0.65fr);
    gap: 14px;
    margin-bottom: 14px;
}


/* =========================================================
   OVERVIEW.HTML — MAIN CHART
========================================================= */

.meta-chart {
    position: relative;
    display: flex;
    min-height: 345px;
    padding: 18px 18px 15px;
}

.chart-y-axis {
    width: 44px;
    height: 260px;
    flex: 0 0 44px;
    padding-right: 7px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #849097;
    font-size: 9px;
    line-height: 1;
    text-align: right;
}

.chart-y-axis span {
    display: block;
    min-height: 10px;
    white-space: nowrap;
}

.chart-main {
    min-width: 0;
    flex: 1;
}

.chart-canvas {
    position: relative;
    width: 100%;
    height: 260px;
    min-width: 0;
    overflow: visible;
}

.event-chart-svg {
    width: 100%;
    height: 260px;
    display: block;
    overflow: visible;
    pointer-events: none;
}

.event-chart-svg line,
.chart-grid-line {
    stroke: #e7eaed;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.event-chart-svg polyline,
.event-chart-line {
    fill: none;
    stroke: #58b7f2;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.event-chart-svg .event-chart-point,
.event-chart-svg .chart-point,
.chart-point {
    fill: #ffffff;
    stroke: #1995dc;
    stroke-width: 2;
    opacity: 0;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    transition:
        opacity 0.12s ease,
        r 0.12s ease;
}

.event-chart-svg .event-chart-point:hover,
.event-chart-svg .chart-point:hover {
    opacity: 1;
    r: 5;
}

/*
   JS hover surface handles the mouse.
   Do NOT use crosshair cursor because it creates the
   unwanted "+" / cross symbol over the graph.
*/

.chart-hover-surface,
.mini-chart-hover-surface {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: default;
    background: transparent;
}

.chart-hover-line,
.mini-chart-hover-line {
    stroke: #8a959b;
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.chart-hover-dot,
.mini-chart-hover-dot {
    fill: #ffffff;
    stroke: var(--blue);
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

#chartHoverLine,
#chartHoverDot,
#miniChartHoverLine,
#miniChartHoverDot,
.mini-chart-hover-line,
.mini-chart-hover-dot {
    pointer-events: none;
}


/* =========================================================
   OVERVIEW.HTML — TOOLTIP
========================================================= */

.chart-tooltip {
    position: absolute;
    display: none;
    z-index: 50;
    min-width: 240px;
    max-width: 290px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e1e5e8;
    border-radius: 9px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    pointer-events: none;
    overflow: hidden;
}

.chart-tooltip.visible {
    display: block;
}

.tooltip-time {
    margin-bottom: 10px;
    color: #4a565d;
    font-size: 12px;
    font-weight: 700;
}

.tooltip-section-label {
    margin-bottom: 8px;
    color: #6b777e;
    font-size: 11px;
}

.tooltip-events {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.tooltip-event-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 12px;
}

.tooltip-event-row span {
    color: #46545c;
}

.tooltip-event-row strong {
    color: var(--text);
}

.tooltip-no-events {
    color: #8a959b;
    font-size: 11px;
}

.tooltip-total-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-bottom: 0;
}

.tooltip-total-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #58b7f2;
}

.tooltip-total-label {
    flex: 1;
    color: #46545c;
    font-size: 12px;
}

.tooltip-total-value {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.tooltip-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: middle;
}

.tooltip-dot-total {
    background: #58b7f2;
}

.tooltip-dot-browser {
    background: var(--green);
}

.tooltip-dot-server {
    background: var(--orange);
}

/*
   Timezone is intentionally hidden from hover.
*/

.tooltip-timezone,
.tooltip-timezone-label,
.tooltip-timezone-value {
    display: none !important;
}


/* =========================================================
   OVERVIEW.HTML — CHART X AXIS
========================================================= */

.chart-labels,
.mini-chart-labels {
    width: 100%;
    margin-top: 9px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: start;
    min-width: 0;
    color: #77838a;
    font-size: 8px;
    line-height: 1;
}

.chart-labels span,
.mini-chart-labels span {
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}


/* =========================================================
   OVERVIEW.HTML — DATASET DETAILS SIDE CARD
========================================================= */

.info-card {
    height: 100%;
    padding: 18px;
}

.info-card-title {
    margin-bottom: 11px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:first-of-type {
    padding-top: 4px;
}

.info-row:last-child {
    border-bottom: 0;
}

.info-row-flush {
    border-bottom: 0;
}

.info-label {
    color: #7a868d;
    font-size: 10px;
}

.info-row strong {
    color: #27363e;
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
}

.success-text {
    color: var(--green) !important;
}

.error-text {
    color: var(--red) !important;
}

.na-text {
    color: var(--muted-light) !important;
    font-weight: 500 !important;
}

.side-card-link {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--blue);
    font-size: 11px;
    text-decoration: none;
}

.side-card-link:hover {
    text-decoration: underline;
}


/* =========================================================
   OVERVIEW.HTML — EVENTS TABLE
========================================================= */

.events-card {
    overflow: hidden;
}

.toolbar,
.events-toolbar {
    min-height: 70px;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.toolbar h2,
.events-toolbar h2 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 14px;
}

.toolbar p,
.events-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.toolbar-controls {
    flex: 0 0 auto;
}

.toolbar-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.events-toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.column-select-button {
    padding: 7px 10px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #53616a;
    font-size: 11px;
    white-space: nowrap;
}

.event-search-count {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.event-search {
    width: 220px;
    height: 35px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid #ccd3d8;
    border-radius: 7px;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.event-search:focus-within {
    border-color: #8abaf7;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.08);
}

.event-search span {
    color: #758189;
    font-size: 15px;
}

.event-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 11px;
}

.event-search input::placeholder {
    color: #9aa4aa;
}

.events-table-wrapper,
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.events-table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
}

.events-table th {
    padding: 11px 17px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    color: #6e7a81;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.events-table td {
    padding: 12px 17px;
    border-bottom: 1px solid var(--border-light);
    color: #46545c;
    font-size: 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.events-table tbody tr.event-main-row:hover,
.events-table tbody tr:not(.event-detail-row):hover {
    background: #fafcff;
}

.events-table tr:last-child td {
    border-bottom: 0;
}

.events-table td:last-child {
    text-align: right;
}

.events-table th:last-child {
    text-align: right;
}

.event-main-row td {
    height: 58px;
}

.event-name-cell {
    display: flex;
    align-items: center;
    gap: 9px;
}

.event-icon {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f5f7;
    border-radius: 6px;
    color: #617079;
    font-size: 12px;
}

.event-name-cell strong {
    display: block;
    color: #26353d;
    font-size: 11px;
    font-weight: 700;
}

.event-name-cell small {
    display: block;
    margin-top: 2px;
    color: #8a959b;
    font-size: 8px;
}

.event-total {
    color: var(--text);
    font-weight: 700;
}

.event-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #25843c;
    font-size: 9px;
    font-weight: 600;
}

.event-status i {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    display: block;
    border-radius: 50%;
    background: #26a641;
}

.event-status.inactive {
    color: #7b868d;
}

.event-status.inactive i {
    background: #9aa4aa;
}

.event-expand-cell {
    width: 52px;
    padding-left: 8px !important;
    padding-right: 12px !important;
    text-align: right !important;
}

.event-expand-button {
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: auto;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #65737b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.event-expand-button:hover {
    background: #edf4ff;
    color: var(--blue);
}

.event-expand-button .chevron,
.event-expand-button svg {
    transition: transform 0.15s ease;
}

.event-expand-button[aria-expanded="true"] .chevron,
.event-expand-button[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.event-detail-row {
    background: #fbfcfd;
}

.event-detail-row > td {
    padding: 0;
    white-space: normal;
}

.event-detail-content {
    padding: 18px 20px 20px;
    border-bottom: 1px solid var(--border);
}


/* =========================================================
   OVERVIEW.HTML — MINI EVENT CHART (inside expanded row)
========================================================= */

.event-mini-chart-wrapper {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.event-mini-chart-title {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.mini-chart {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 190px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.mini-chart-y-axis {
    width: 40px;
    height: 160px;
    flex: 0 0 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding-right: 5px;
    box-sizing: border-box;
    color: #849097;
    font-size: 9px;
    line-height: 1;
    text-align: right;
}

.mini-chart-y-axis span {
    display: block;
    min-height: 9px;
    white-space: nowrap;
}

.mini-chart-main {
    flex: 1;
    min-width: 0;
}

.mini-chart-canvas {
    position: relative;
    width: 100%;
    height: 160px;
    min-width: 0;
    overflow: visible;
}

.mini-chart-svg {
    width: 100%;
    height: 160px;
    display: block;
    overflow: visible;
    pointer-events: none;
}

.mini-chart-svg line,
.mini-chart-grid-line {
    stroke: #e7eaed;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.mini-chart-line {
    fill: none;
    stroke: #58b7f2;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.mini-chart-point {
    fill: #ffffff;
    stroke: #1995dc;
    stroke-width: 2;
    opacity: 0;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.mini-chart-tooltip {
    min-width: 170px;
    max-width: 220px;
    padding: 10px 12px;
}

.mini-chart-tooltip-time {
    margin-bottom: 6px;
    color: #4a565d;
    font-size: 11px;
    font-weight: 700;
}

.mini-chart-labels {
    margin-top: 7px;
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    color: #77838a;
    font-size: 8px;
}

.mini-chart-labels span {
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}


/* =========================================================
   DIAGNOSTICS.HTML
========================================================= */

.diagnostic-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.diagnostic-summary-card {
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
}

.diagnostic-summary-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
}

.diagnostic-summary-card strong {
    color: var(--text);
    font-size: 21px;
}

.diagnostic-card {
    overflow: hidden;
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.diagnostic-card-header {
    padding: 16px 17px;
    border-bottom: 1px solid var(--border-light);
}

.diagnostic-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.diagnostic-title-row h2 {
    margin: 0;
    font-size: 14px;
}

.diagnostic-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
}

.diagnostic-card-header p {
    margin: 6px 0 0 27px;
    color: var(--muted);
    font-size: 10px;
}

.diagnostic-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.diagnostic-notice-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e9eef3;
    color: #66747d;
    font-size: 11px;
    font-weight: 700;
}

.diagnostic-notice strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.diagnostic-notice p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}


/* =========================================================
   ALERTS
   (used on overview.html sync success, datasets.html
   sync warning, login/signup error messages)
========================================================= */

.alert-card {
    padding: 14px 16px;
    margin-bottom: 14px;
    background: #fff8e5;
    border: 1px solid #f0df9e;
    border-radius: 8px;
}

.alert-card strong {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
}

.alert-card p {
    margin: 0 0 4px;
    font-size: 11px;
}

.alert-card span {
    color: var(--muted);
    font-size: 10px;
}

.alert-card-info {
    background-color: #e7f3ff;
    border: 1px solid #b3d7ff;
    color: #0b5ed7;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    transition: opacity 0.5s ease;
}

.alert-card-error {
    background-color: #fdeceb;
    border: 1px solid #f2c4c0;
}


/* =========================================================
   AUTH PAGES
   (login.html, signup.html, password_reset*.html)
========================================================= */

.auth-page-wrapper {
    max-width: 380px;
    margin: 80px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.auth-page-wrapper.auth-page-wide {
    max-width: 420px;
    text-align: center;
}

.auth-page-wrapper h1 {
    font-size: 20px;
    margin-bottom: 20px;
}

.auth-page-wrapper.auth-page-wide h1 {
    margin-bottom: 10px;
}

.auth-page-lead {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 20px;
}

.auth-page-wide .auth-page-lead {
    margin-bottom: 0;
}

.auth-footnote {
    margin-top: 16px;
    font-size: 12px;
    text-align: center;
}


/* =========================================================
   FORMS (generic)
   (used on: login, signup, settings, password reset)
========================================================= */

.form-group {
    margin-bottom: 14px;
}

.form-group-top {
    margin-bottom: 14px;
    margin-top: 12px;
}

.form-group-last {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
}

.form-input,
.auth-page-wrapper input[type="text"],
.auth-page-wrapper input[type="email"],
.auth-page-wrapper input[type="password"] {
    width: 100%;
    padding: 9px;
    border: 1px solid #ccd3d8;
    border-radius: 6px;
}

.form-note {
    margin-top: 14px;
    font-size: 12px;
}


/* =========================================================
   CONNECT_META.HTML / BUSINESSES.HTML CONNECT PROMPT
========================================================= */

.connect-meta-icon {
    margin-bottom: 10px;
    font-size: 25px;
}


/* =========================================================
   SETTINGS.HTML
========================================================= */

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.settings-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8edf1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 64px;
}

.settings-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-avatar-fallback {
    font-size: 22px;
    font-weight: 700;
    color: #66737b;
}

.settings-avatar-form {
    flex: 1;
}

.settings-avatar-form input[type="file"] {
    margin-bottom: 10px;
    font-size: 12px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-card {
    padding: 20px;
}

.settings-card h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.setting-row {
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-row:last-child {
    border-bottom: 0;
}

.setting-row strong {
    display: block;
    font-size: 11px;
    color: var(--text);
}

.setting-row p {
    margin: 3px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 14px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    flex: 0 0 9px;
}

.status-dot-inactive {
    background: var(--muted-light);
}