:root {
    color-scheme: light;
    --bg: #f4f6f5;
    --panel: #ffffff;
    --text: #17211b;
    --muted: #66746d;
    --line: #d9e0dc;
    --accent: #0f766e;
    --accent-dark: #0b5f59;
    --danger: #b42318;
    --success: #16803d;
    --analytics-section-gap: 16px;
    --analytics-content-gap: 12px;
    --analytics-control-gap: 8px;
}

/* Customer churn report */
.churn-rules,
.churn-metric-grid,
.churn-dimension-grid {
    display: grid;
    gap: 16px;
}

.churn-rules {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.churn-rules section,
.churn-metric-card {
    border: 1px solid #d9e2de;
    border-radius: 8px;
    background: #f8fbfa;
    padding: 16px;
}

.churn-rules span,
.churn-metric-card span {
    color: #66746d;
    font-size: 13px;
}

.churn-rules strong,
.churn-metric-card strong {
    display: block;
    color: #14231d;
    font-size: 24px;
    line-height: 1.15;
    margin-top: 8px;
}

.churn-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.churn-metric-card > div {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.churn-metric-card p {
    color: #66746d;
    font-size: 13px;
    line-height: 1.45;
    margin: 10px 0 0;
}

.churn-comparison-strip {
    align-items: center;
    background: #eef3f1;
    border-radius: 8px;
    color: #2d3d36;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 16px;
    padding: 12px 14px;
}

.churn-facts {
    border-top: 1px solid #e3ebe7;
    margin-top: 18px;
    padding-top: 16px;
}

.churn-facts strong {
    color: #14231d;
    display: block;
    margin-bottom: 8px;
}

.churn-facts ul {
    color: #405149;
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 18px;
}

.churn-chart-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.churn-segmented {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.churn-segmented label {
    cursor: pointer;
    position: relative;
}

.churn-segmented input {
    position: absolute;
    opacity: 0;
}

.churn-segmented span {
    border: 1px solid #d0dbd6;
    border-radius: 8px;
    color: #405149;
    display: block;
    font-size: 13px;
    padding: 8px 12px;
}

.churn-segmented input:checked + span {
    background: #14231d;
    border-color: #14231d;
    color: #fff;
}

.churn-timeline-explainer {
    margin-bottom: 12px;
}

.churn-methodology-disclosure {
    margin-top: 16px;
}

.churn-settings-disclosure {
    max-width: none;
}

.churn-settings-disclosure > .report-disclosure__toggle {
    width: fit-content;
}

.churn-settings-content {
    display: grid;
    gap: 12px;
}

.churn-settings-intro {
    color: #405149;
    margin: 0;
    max-width: 900px;
}

.churn-interval-card {
    border-top: 1px solid #e3ebe7;
    margin-top: 16px;
    padding-top: 16px;
}

.churn-interval-table thead th {
    min-width: 132px;
    white-space: normal;
}

.churn-interval-table thead th:first-child {
    min-width: 150px;
}

.churn-interval-table tbody th,
.churn-interval-table tbody td {
    white-space: nowrap;
}

.churn-interval-summary {
    color: #405149;
    display: grid;
    gap: 8px;
    margin-top: 14px;
    max-width: 900px;
}

.churn-interval-summary p {
    margin: 0;
}

.churn-interval-card .alert {
    margin-top: 12px;
    max-width: 900px;
}

.churn-interval-method {
    margin-top: 12px;
}

.churn-rules-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.churn-rules-actions + .churn-rules {
    margin-top: 12px;
}

.churn-chart-toolbar + .series-toggle-list {
    margin-bottom: 12px;
}

.churn-chart-note {
    margin: 0;
    max-width: 92ch;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.churn-loss-purchase-count-card .panel-head {
    order: 1;
}

.churn-loss-purchase-count-card .churn-chart-note {
    order: 2;
}

.churn-loss-purchase-count-explainer {
    order: 3;
}

.churn-loss-purchase-count-card .purchase-depth-toolbar {
    order: 4;
}

.churn-loss-purchase-count-card .purchase-depth-groups {
    order: 5;
}

.churn-loss-purchase-count-card .churn-loss-purchase-count-error {
    order: 6;
}

.churn-loss-purchase-count-card .chart-scroll {
    order: 7;
}

.churn-loss-purchase-count-insights {
    order: 8;
}

.churn-timeline-chart {
    min-height: 360px;
    min-width: 760px;
}

.churn-timeline-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
}

.churn-timeline-point {
    stroke: #fff;
    stroke-width: 2;
}

.churn-loss-purchase-count-line {
    stroke-width: 2.5;
}

.churn-loss-purchase-count-line[data-churn-loss-purchase-count-bucket="2"] {
    stroke-dasharray: 9 4;
}

.churn-loss-purchase-count-line[data-churn-loss-purchase-count-bucket="3"] {
    stroke-dasharray: 3 3;
}

.churn-loss-purchase-count-line[data-churn-loss-purchase-count-bucket="4"] {
    stroke-dasharray: 10 4 2 4;
}

.churn-loss-purchase-count-line[data-churn-loss-purchase-count-bucket="5"] {
    stroke-dasharray: 5 5 2 5;
}

.churn-loss-purchase-count-line.muted,
.churn-loss-purchase-count-point.muted {
    opacity: 0.24;
}

.churn-loss-purchase-count-line.active {
    stroke-width: 3.5;
}

.churn-loss-purchase-count-point {
    stroke: #ffffff;
    stroke-width: 2;
}

.churn-loss-purchase-count-point.active {
    stroke-width: 3;
}

.churn-loss-purchase-count-hover-line {
    pointer-events: none;
}

.churn-dimension-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.churn-dimension-card {
    min-width: 0;
}

.churn-dimension-list {
    display: grid;
    gap: 14px;
}

.churn-dimension-row {
    display: grid;
    gap: 7px;
}

.churn-dimension-row__label {
    align-items: baseline;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.churn-dimension-row__label strong {
    color: #14231d;
}

.churn-dimension-row__label span,
.churn-dimension-row__split {
    color: #66746d;
    font-size: 13px;
}

.churn-dimension-row__bar {
    background: #edf3f0;
    border-radius: 999px;
    height: 9px;
    overflow: hidden;
}

.churn-dimension-row__bar span {
    background: linear-gradient(90deg, #dc2626, #7c3aed);
    display: block;
    height: 100%;
}

.churn-dimension-row__split {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.churn-loss-table th,
.churn-loss-table td {
    white-space: nowrap;
}

.churn-summary-table thead th:not(:first-child),
.churn-summary-table td:not(:first-child),
.churn-loss-table thead th:not(:first-child),
.churn-loss-table td:not(:first-child) {
    text-align: right;
}

.churn-summary-table thead th:first-child,
.churn-summary-table tbody th,
.churn-loss-table thead th:first-child,
.churn-loss-table tbody th {
    text-align: left;
}

@media (max-width: 1180px) {
    .churn-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .churn-dimension-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .churn-rules,
    .churn-metric-grid {
        grid-template-columns: 1fr;
    }

    .churn-chart-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .churn-dimension-row__label {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--accent-dark);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

button,
input {
    font: inherit;
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 16px;
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

button.secondary {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
}

button.secondary:hover {
    background: #eef3f1;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 420px);
}

.login-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: clamp(24px, 5vw, 36px);
}

.content-block {
    padding: clamp(8px, 3vw, 20px) 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: 1.9rem;
    line-height: 1.18;
}

h2 {
    margin: 28px 0 12px;
    font-size: 1.1rem;
}

.muted {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.95rem;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    background: #ffffff;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(15, 118, 110, 0.15);
}

.alert {
    margin-top: 18px;
    border: 1px solid rgba(180, 35, 24, 0.35);
    border-radius: 6px;
    background: #fff4f2;
    color: var(--danger);
    padding: 10px 12px;
}

.alert.neutral {
    border-color: var(--line);
    background: #f8fafc;
    color: #374151;
}

.alert.success {
    border-color: rgba(22, 128, 61, 0.25);
    background: #ecfdf3;
    color: var(--success);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    padding: 18px clamp(18px, 4vw, 44px);
}

.topbar h1 {
    margin: 0;
    font-size: 1.55rem;
}

.page {
    width: min(100% - 32px, 980px);
    margin: 32px auto;
}

.page.narrow {
    width: min(100% - 32px, 680px);
}

.link-list,
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.link-list form {
    margin: 0;
}

.link-button {
    min-height: auto;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    padding: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.link-button:hover {
    background: transparent;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 20px 0 0;
}

.status-grid div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
}

.status-grid dt {
    color: var(--muted);
    font-size: 0.88rem;
}

.status-grid dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.status-grid.compact dd {
    font-weight: 500;
}

.system-settings-section {
    border-top: 1px solid var(--line);
    margin-top: 24px;
    padding-top: 24px;
}

.system-settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.system-settings-form label {
    min-width: 0;
}

.system-settings-meta {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 10px 12px;
}

.system-settings-meta strong {
    color: var(--text);
}

.badge {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 10px;
}

.badge.ok {
    background: #e8f7ee;
    color: var(--success);
}

.badge.error {
    background: #fff4f2;
    color: var(--danger);
}

.debug-note {
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar form,
    .topbar button {
        width: 100%;
    }
}

select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    outline-offset: 2px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    padding: 14px clamp(18px, 4vw, 44px);
}

.app-header h1 {
    margin: 0;
    font-size: 1.55rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a,
.button-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border-radius: 6px;
    color: var(--text);
    padding: 8px 12px;
    text-decoration: none;
}

.main-nav a:hover,
.button-link:hover {
    background: #eef3f1;
}

.main-nav a.active {
    background: #dff2ef;
    color: var(--accent-dark);
    font-weight: 700;
}

.main-nav form {
    margin: 0;
}

.nav-toggle {
    display: none;
}

button.compact {
    min-height: 44px;
    padding: 8px 12px;
}

button.danger {
    background: var(--danger);
}

button.danger:hover {
    background: #8f1d14;
}

.page.wide {
    width: min(100% - 32px, 1280px);
}

.filter-panel,
.dashboard-section {
    margin: 0 0 28px;
}

.filter-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: clamp(18px, 3vw, 28px);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head h2,
.section-head p {
    margin-bottom: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
}

.check-group {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0;
    padding: 12px;
}

.check-group legend {
    color: var(--muted);
    font-size: 0.95rem;
    padding: 0 4px;
}

.check-group label,
.check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    color: var(--text);
}

.check-group input,
.check-inline input,
.chart-controls input,
.event-category-filter input {
    width: 18px;
    min-height: 18px;
}

.filter-actions {
    display: flex;
    align-items: end;
}

.filter-actions button {
    width: 100%;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.kpi-card,
.event-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
}

.kpi-card-head,
.row-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.kpi-card h3 {
    margin: 0;
    font-size: 1rem;
}

.icon-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.icon-button,
.modal-close {
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    padding: 0;
}

.icon-button:hover,
.modal-close:hover {
    background: #eef3f1;
}

.kpi-value {
    margin: 18px 0 8px;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-change {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.kpi-change.up {
    color: var(--success);
}

.kpi-change.down {
    color: var(--danger);
}

.chart-controls,
.event-category-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.chart-controls label,
.event-category-filter label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
}

.segmented {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 0;
    margin: 0;
    padding: 0;
}

.segmented legend {
    color: var(--muted);
    padding: 0;
}

.chart-shell {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin: 4px 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-line {
    display: inline-block;
    width: 34px;
    border-top: 3px solid var(--accent);
}

.legend-line.new-line {
    border-color: var(--pink);
}

.legend-line.repeat-line {
    border-color: #2563eb;
}

.legend-line.unidentified-line {
    border-color: #6b7280;
}

.legend-line.dashed {
    border-top-style: dashed;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #b7791f;
}

.summary-chart {
    display: block;
    width: 100%;
    height: 330px;
}

.chart-line {
    fill: none;
    stroke-width: 2.5;
}

.chart-line.compare {
    stroke-dasharray: 7 5;
    opacity: 0.75;
}

.chart-axis {
    stroke: #c9d3ce;
    stroke-width: 1;
}

.chart-event {
    fill: #b7791f;
    stroke: #ffffff;
    stroke-width: 2;
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.bar-cell {
    position: relative;
    display: block;
    min-width: 110px;
}

.bar-cell span {
    position: absolute;
    inset: 3px auto 3px 0;
    border-radius: 4px;
    background: #dff2ef;
}

.bar-cell b {
    position: relative;
    z-index: 1;
}

.event-list {
    display: grid;
    gap: 12px;
}

.compact-list article {
    display: grid;
    grid-template-columns: 120px 150px 1fr;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.event-card h3 {
    margin: 4px 0 8px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-row span {
    border-radius: 999px;
    background: #eef3f1;
    padding: 4px 9px;
}

.row-actions {
    align-items: center;
}

.row-actions form {
    margin: 0;
}

.event-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.wide-field {
    grid-column: 1 / -1;
}

small {
    color: var(--danger);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.help-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

.help-toc {
    position: sticky;
    top: 92px;
    align-self: start;
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
}

.help-toc a {
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    text-decoration: none;
}

.help-toc a:hover {
    background: #eef3f1;
}

.help-page {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.help-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    max-width: 1240px;
}

.help-hero h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.12;
}

.help-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
}

.help-content {
    display: grid;
    gap: 16px;
    min-width: 0;
    max-width: 960px;
}

.help-toc strong {
    color: var(--text);
    font-size: 13px;
}

.help-toc__group {
    display: grid;
    gap: 2px;
    padding-top: 8px;
}

.help-toc__group + .help-toc__group {
    border-top: 1px solid var(--line);
    margin-top: 6px;
}

.help-toc__group > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.help-section,
.help-status-panel {
    scroll-margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    padding: 18px;
}

.help-section__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    margin-bottom: 12px;
}

.help-section__head .help-kicker {
    grid-column: 1 / -1;
}

.help-section h2,
.help-status-panel h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.18;
}

.help-section h3 {
    margin: 18px 0 8px;
    font-size: 15px;
}

.help-section p,
.help-section li,
.help-status-panel p {
    color: #374151;
    line-height: 1.55;
}

.help-section p {
    margin: 0 0 10px;
}

.help-kicker {
    color: var(--pink);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.help-callout {
    display: grid;
    gap: 4px;
    border: 1px solid #d7e7e1;
    border-radius: 8px;
    background: #f8faf9;
    margin: 12px 0;
    padding: 12px;
}

.help-callout span {
    color: #41514b;
}

.help-grid {
    display: grid;
    gap: 12px;
}

.help-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-grid section,
.help-grid > div {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fbfcfd;
    padding: 12px;
}

.help-grid h3 {
    margin-top: 0;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 4px;
}

.help-table th,
.help-table td {
    border-top: 1px solid var(--line);
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
}

.help-table th {
    width: 220px;
    color: var(--text);
}

.help-status-panel {
    display: grid;
    gap: 14px;
}

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

.help-status-grid section {
    display: grid;
    gap: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fbfcfd;
    padding: 12px;
}

.help-status-grid h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.help-status-grid a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-radius: 6px;
    color: var(--text);
    padding: 6px 8px;
    text-decoration: none;
}

.help-status-grid a:hover {
    background: var(--pink-soft);
    color: var(--pink);
}

.help-status-grid strong {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.modal {
    width: min(100% - 32px, 680px);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.modal::backdrop {
    background: rgba(23, 33, 27, 0.4);
}

.modal-close {
    float: right;
}

@media (max-width: 860px) {
    .app-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        display: none;
        flex-basis: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a,
    .main-nav button {
        width: 100%;
        justify-content: center;
    }

    .filters-grid,
    .event-form,
    .help-layout,
    .system-settings-form {
        grid-template-columns: 1fr;
    }

    .help-toc {
        position: static;
    }

    .compact-list article {
        grid-template-columns: 1fr;
    }
}

/* Approved analytics layout */
:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #ec2b7b;
    --accent-dark: #c81f65;
    --pink: #ec2b7b;
    --pink-soft: #fff0f6;
    --danger: #ef4444;
    --danger-soft: #fff0f0;
    --success: #10b981;
    --success-soft: #eafaf4;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    --radius: 14px;
    --sidebar-width: 290px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

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

button {
    border-radius: 9px;
    background: var(--pink);
}

button:hover {
    background: var(--accent-dark);
}

a {
    color: var(--pink);
}

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--line);
    background: #ffffff;
    padding: 18px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.logo {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--pink);
    color: #ffffff;
    font-weight: 800;
}

.brand strong {
    display: block;
    font-size: 14px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a,
.nav-link {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 46px;
    align-items: center;
    column-gap: 8px;
    min-width: 0;
    min-height: 38px;
    border-radius: 10px;
    color: #374151;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
}

.nav a:hover,
.nav-link:hover {
    background: #fafafa;
}

.nav a.active,
.nav-link.active {
    background: var(--pink-soft);
    color: var(--pink);
    font-weight: 600;
}

.nav-link--disabled,
.nav-link--disabled:hover {
    background: transparent;
    color: var(--muted);
    cursor: default;
}

.nav-item__icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: #4b5563;
}

.nav-item__label {
    min-width: 0;
    overflow: visible;
    line-height: 1.15;
    white-space: nowrap;
}

.nav-status {
    justify-self: end;
}

.nav-status--ready {
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(22, 128, 61, 0.28);
    border-radius: 50%;
    background: #ecfdf3;
    color: var(--success);
}

.nav-item__icon svg,
.nav-status--ready svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.nav-link.active .nav-item__icon {
    color: var(--pink);
}

.nav-status--planned {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f6f8f7;
    color: var(--muted);
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    width: 100%;
    margin-bottom: 12px;
}

.sidebar-footer {
    position: absolute;
    right: 14px;
    bottom: 18px;
    left: 14px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafa;
    padding: 10px;
}

.dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sidebar-logout {
    margin-top: 10px;
}

.sidebar-logout .btn {
    width: 100%;
}

.main {
    min-width: 0;
}

.topbar {
    display: block;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    padding: 12px 22px;
}

.topbar-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.topbar-head strong {
    font-size: 13px;
}

.topbar-head span {
    color: var(--pink);
    font-size: 12px;
    font-weight: 700;
}

.filters {
    display: grid;
    grid-template-columns: 1.5fr 1.2fr 1.2fr 1fr auto;
    gap: 10px;
}

.field {
    position: relative;
    min-width: 0;
}

.field label,
.field > label,
.topbar-extra span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.field select,
.field input,
.topbar-extra input {
    width: 100%;
    height: 38px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    padding: 0 10px;
}

.primary {
    align-self: end;
    height: 38px;
    min-height: 38px;
    border: 0;
    border-radius: 9px;
    background: var(--pink);
    color: #ffffff;
    padding: 0 18px;
    font-weight: 700;
}

.dropdown-field {
    align-self: end;
}

.dropdown-field summary {
    display: grid;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    padding: 4px 10px;
    cursor: pointer;
    list-style: none;
}

.dropdown-field summary::-webkit-details-marker {
    display: none;
}

.dropdown-field summary span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dropdown-field summary strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-panel {
    position: absolute;
    z-index: 30;
    right: 0;
    left: 0;
    display: grid;
    gap: 8px;
    min-width: 230px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
    margin-top: 6px;
    padding: 10px;
}

.dropdown-panel label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.dropdown-panel input {
    width: 18px;
    height: 18px;
    min-height: 18px;
}

.topbar-extra {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 10px;
}

.content {
    padding: 22px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.1;
}

.page-head p {
    margin: 0;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 8px;
}

.btn,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    color: #374151;
    padding: 0 13px;
    font-weight: 700;
    text-decoration: none;
}

.btn:hover,
.button-link:hover {
    background: #fafafa;
}

.btn.pink {
    border-color: var(--pink);
    background: var(--pink);
    color: #ffffff;
}

.section-title {
    margin: 22px 0 10px;
    font-size: 16px;
}

.section-sub {
    margin: -6px 0 12px;
    color: var(--muted);
    font-size: 12px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.kpi,
.panel,
.kpi-card,
.event-card {
    border: 1px solid #edf0f4;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.kpi {
    min-height: 154px;
    padding: 15px;
}

.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.kpi-title {
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}

.icon-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
}

.icon-btn,
.icon-button {
    display: grid;
    place-items: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    padding: 0;
}

.icon-btn:hover,
.icon-button:hover {
    background: var(--pink-soft);
    color: var(--pink);
}

.value,
.kpi-value {
    margin: 12px 0 6px;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}

.change,
.kpi-change {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 7px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
}

.change.down,
.kpi-change.down {
    background: var(--danger-soft);
    color: var(--danger);
}

.change.up,
.kpi-change.up {
    background: var(--success-soft);
    color: var(--success);
}

.desc {
    margin: 10px 0 5px;
    color: #4b5563;
    font-size: 11px;
}

.period {
    color: var(--muted);
    font-size: 10px;
}

.link,
.action-link {
    display: inline-block;
    min-height: 0;
    border: 0;
    background: transparent;
    color: var(--pink);
    margin-top: 7px;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.link:hover,
.action-link:hover {
    background: transparent;
    color: var(--accent-dark);
}

.panel {
    margin-top: 14px;
    padding: 16px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}

.panel h3 {
    margin: 0 0 3px;
    font-size: 15px;
}

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

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text);
    padding: 7px 9px;
    font-size: 11px;
}

.chip input {
    width: 16px;
    min-height: 16px;
}

.segmented {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
}

.segmented legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.segmented label {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border-right: 1px solid var(--line);
    color: var(--text);
    padding: 7px 9px;
    font-size: 11px;
    cursor: pointer;
}

.segmented label:last-child {
    border-right: 0;
}

.segmented label.active,
.segmented label:has(input:checked) {
    background: var(--pink-soft);
    color: var(--pink);
    font-weight: 700;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.event-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.chart {
    position: relative;
    height: 300px;
    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);
    margin: 18px 10px 8px 12px;
}

.summary-chart {
    display: block;
    width: 100%;
    height: 300px;
}

.chart-axis {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke-width: 2.5;
}

.chart-line.compare {
    stroke: #94a3b8;
    stroke-dasharray: 7 5;
    opacity: 0.9;
}

.chart-event {
    fill: var(--pink);
    stroke: #ffffff;
    stroke-width: 2;
    cursor: pointer;
    pointer-events: all;
    transition: r 80ms linear, stroke-width 80ms linear, filter 80ms linear;
}

.chart-event.active,
.chart-event:hover,
.chart-event:focus {
    stroke-width: 2.5;
    filter: drop-shadow(0 2px 5px rgba(17, 24, 39, 0.24));
    outline: none;
}

.chart-event-line {
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
    opacity: 0.75;
    pointer-events: stroke;
    transition: opacity 80ms linear, stroke-width 80ms linear;
}

.chart-event-line.active {
    stroke-width: 2;
    opacity: 1;
}

.chart-event-hit-line {
    stroke: transparent;
    stroke-width: 12;
    pointer-events: stroke;
    cursor: pointer;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    color: var(--muted);
    font-size: 11px;
    margin: 8px 0 0;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-line {
    display: inline-block;
    width: 34px;
    border-top: 3px solid var(--pink);
}

.legend-line.dashed {
    border-top-color: #94a3b8;
    border-top-style: dashed;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--pink);
}

.axis {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 10px;
    margin: 0 6px 0 12px;
}

.customer-summary {
    margin-bottom: 18px;
}

.inline-warning,
.empty-state {
    border: 1px solid #facc15;
    border-radius: 8px;
    background: #fef9c3;
    color: #713f12;
    font-size: 12px;
    line-height: 1.45;
    margin: 12px 0;
    padding: 10px 12px;
}

.customer-split-bar {
    display: flex;
    width: 100%;
    height: 18px;
    overflow: hidden;
    border-radius: 8px;
    background: #e5e7eb;
    margin: 14px 0 10px;
}

.customer-split-bar span {
    display: block;
    min-width: 0;
}

.customer-split-bar .new {
    background: #0ea5e9;
}

.customer-split-bar .repeat {
    background: #16a34a;
}

.customer-split-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    color: var(--muted);
    font-size: 12px;
}

.customer-split-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.new {
    background: #0ea5e9;
}

.legend-dot.repeat {
    background: #16a34a;
}

.summary-diagnostics {
    margin-bottom: 18px;
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.diagnostic-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 10px 12px;
}

.diagnostic-item span,
.diagnostic-lists h4 {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.diagnostic-item strong {
    display: block;
    margin-top: 6px;
    color: #111827;
    font-size: 20px;
    line-height: 1.1;
}

.diagnostic-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.diagnostic-lists h4 {
    margin: 0 0 8px;
}

.diagnostic-lists ul {
    display: grid;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.diagnostic-lists li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 7px 0;
}

.diagnostic-lists li span {
    min-width: 0;
}

.diagnostic-lists li strong {
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.insight {
    margin-top: 14px;
    border-left: 3px solid var(--pink);
    border-radius: 8px;
    background: var(--pink-soft);
    padding: 10px 12px;
    font-size: 11px;
}

.insight strong {
    color: #111827;
}

.table-scroll {
    overflow-x: auto;
}

.check-equalities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafa;
    margin-top: 12px;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 12px;
}

.check-equalities strong {
    color: var(--text);
}

.metric-cell {
    min-width: 155px;
}

.bar {
    overflow: hidden;
    height: 8px;
    border-radius: 99px;
    background: #eef2f7;
    margin-top: 4px;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--pink);
}

.bar.blue span {
    background: #8da2c7;
}

.load-more {
    display: flex;
    margin: 14px auto 0;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--analytics-section-gap);
}

.events {
    display: grid;
    gap: 8px;
}

.event-row {
    display: grid;
    grid-template-columns: 86px 110px 1fr;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

.badge {
    width: max-content;
    border-radius: 99px;
    background: var(--pink-soft);
    color: var(--pink);
    padding: 4px 7px;
    font-size: 10px;
    font-weight: 700;
}

.help-list {
    display: grid;
    gap: 8px;
}

.help-list a {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    color: #374151;
    padding: 10px;
    text-decoration: none;
}

.help-list a:hover {
    background: var(--pink-soft);
    color: var(--pink);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
}

.dashboard-section {
    margin-bottom: 18px;
}

.event-card {
    padding: 14px;
}

.modal {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modal-close {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
}

body.modal-open {
    overflow: hidden;
}

.btn.disabled,
button:disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: default;
}

.journal-filters {
    grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
    align-items: end;
}

.journal-filters input[type="date"],
.journal-filters input[type="search"],
.journal-filters select {
    height: 38px;
    min-height: 38px;
}

.journal-filters .check-group {
    grid-column: span 2;
}

.journal-filters .filter-actions {
    align-items: end;
    justify-content: flex-start;
}

.journal-filters .filter-actions button {
    width: auto;
    min-width: 132px;
    height: 38px;
    min-height: 38px;
}

.journal-status-alert {
    margin: 0 0 18px;
}

.journal-page-head {
    margin-top: 0;
}

.action-note {
    display: inline-block;
    max-width: 260px;
    font-size: 12px;
    line-height: 1.35;
}

.required-marker {
    color: var(--pink);
    font-weight: 800;
}

.required-note,
.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.field-hint {
    grid-column: 1 / -1;
}

.provider-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border: 1px solid rgba(180, 35, 24, 0.22);
    border-radius: 999px;
    background: #fff4f2;
    color: var(--danger);
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
}

.badge.warning {
    background: #fff7ed;
    color: #b45309;
}

.modal {
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 22px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    float: none;
}

.modal [data-modal-content] {
    padding-right: 38px;
}

.source-schema-page .alert {
    margin: 0 0 14px;
}

.source-filter {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.45fr) minmax(170px, 0.45fr) auto;
    gap: 10px;
    align-items: end;
    margin: 0 0 14px;
}

.source-filter.narrow {
    grid-template-columns: minmax(240px, 420px) auto;
    justify-content: start;
}

.source-filter label span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.source-filter input,
.source-filter select {
    height: 38px;
    min-height: 38px;
}

.source-table-scroll {
    margin-top: 12px;
}

.source-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    font-size: 11px;
}

.source-table.compact {
    min-width: 620px;
}

.source-table th,
.source-table td {
    border-bottom: 1px solid var(--line);
    padding: 9px;
    text-align: left;
    vertical-align: top;
}

.source-table th {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.source-table td {
    max-width: 320px;
    overflow-wrap: anywhere;
}

.source-table td:first-child {
    min-width: 150px;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.entity-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
}

.entity-card h4 {
    margin: 0 0 4px;
    font-size: 13px;
}

.entity-card p {
    min-height: 32px;
    margin: 0 0 9px;
    color: var(--muted);
    font-size: 11px;
}

.entity-card .tag-row a {
    border-radius: 999px;
    background: var(--pink-soft);
    color: var(--pink);
    padding: 4px 7px;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
}

.source-note-list {
    display: grid;
    gap: 8px;
}

.source-note-list div {
    display: grid;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
}

.source-note-list small {
    color: var(--muted);
}

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

/* Daily analytics UX refinements */
.content {
    padding: 16px 18px;
}

.topbar {
    padding: 10px 18px;
}

.filters {
    grid-template-columns: minmax(145px, 1fr) minmax(150px, 1fr) minmax(180px, 1fr) minmax(190px, 1fr) auto;
}

.dropdown-panel {
    max-height: min(320px, 70vh);
    overflow: auto;
}

.dropdown-panel label {
    min-height: 28px;
}

.kpi-context {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    margin: 0 0 10px;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 11px;
}

.kpi-context strong {
    color: var(--text);
}

.kpi-grid {
    gap: 8px;
}

.kpi {
    min-height: 96px;
    padding: 11px 12px;
}

.value,
.kpi-value {
    margin: 8px 0 6px;
    font-size: 23px;
}

.change,
.kpi-change {
    min-height: 22px;
    padding: 3px 7px;
}

.section-title {
    margin: 16px 0 8px;
}

.panel {
    margin-top: 10px;
    padding: 12px;
}

.panel-head {
    margin-bottom: 9px;
}

.controls {
    gap: 6px;
}

.chip {
    min-height: 28px;
    padding: 5px 8px;
}

.event-category-filter {
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 8px;
}

.chart {
    margin: 10px 8px 6px 10px;
}

.summary-chart {
    height: 285px;
}

.panel.loading {
    position: relative;
}

.panel.loading::after {
    content: "Обновляем график...";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    color: var(--text);
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    transform: translate(-50%, -50%);
}

.chart-point {
    opacity: 0.28;
    pointer-events: none;
    transition: opacity 80ms linear, r 80ms linear;
}

.chart-point.active {
    opacity: 1;
    r: 5.5;
}

.chart-hover-line {
    stroke: #111827;
    stroke-width: 1;
    stroke-dasharray: 4 4;
    opacity: 0.45;
    pointer-events: none;
}

.chart-hover-rect {
    fill: transparent;
    pointer-events: all;
}

.instant-tooltip {
    position: fixed;
    z-index: 1000;
    width: max-content;
    max-width: min(360px, calc(100vw - 16px));
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.94);
    color: #ffffff;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    transition: opacity 40ms linear;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.instant-tooltip.visible {
    opacity: 1;
}

.chart-tooltip {
    position: fixed;
    z-index: 1002;
    display: grid;
    gap: 9px;
    width: max-content;
    max-width: min(330px, calc(100vw - 16px));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.96);
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.22);
    color: #ffffff;
    padding: 13px 14px;
    font-size: 12px;
    line-height: 1.38;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    transition: opacity 40ms linear;
    overflow-wrap: anywhere;
    white-space: normal;
}

.chart-tooltip.visible {
    opacity: 1;
}

.chart-tooltip__title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.chart-tooltip__subtitle {
    color: rgba(255, 255, 255, 0.86);
    font-weight: 700;
}

.chart-tooltip__primary {
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
}

.chart-tooltip__secondary {
    color: rgba(255, 255, 255, 0.78);
}

.chart-tooltip__meta,
.chart-tooltip__section {
    display: grid;
    gap: 5px;
}

.chart-tooltip__row {
    display: grid;
    grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.chart-tooltip__label {
    color: rgba(255, 255, 255, 0.62);
    font-weight: 700;
}

.chart-tooltip__value {
    min-width: 0;
    color: rgba(255, 255, 255, 0.94);
    text-align: right;
}

.chart-tooltip__description {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    padding-top: 8px;
}

.chart-tooltip__section {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 8px;
}

.chart-tooltip__section-title {
    color: #ffffff;
    font-weight: 800;
}

.tooltip-section {
    display: grid;
    gap: 2px;
    min-width: 0;
    white-space: normal;
}

.tooltip-section + .tooltip-section {
    margin-top: 8px;
}

.tooltip-section strong {
    color: #ffffff;
    font-weight: 800;
}

.tooltip-section span {
    color: rgba(255, 255, 255, 0.9);
}

.split-bar-block {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.split-bar-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.split-bar-label strong {
    color: var(--text);
}

.split-bar {
    display: flex;
    width: 100%;
    height: 20px;
    overflow: hidden;
    border-radius: 8px;
    background: #e5e7eb;
}

.split-bar span {
    min-width: 0;
}

.split-bar .new,
.legend-dot.new {
    background: #0ea5e9;
}

.split-bar .repeat,
.legend-dot.repeat {
    background: #16a34a;
}

.split-bar .unidentified,
.legend-dot.unidentified {
    background: #6b7280;
}

.diagnostics-details {
    margin-top: 18px;
}

.diagnostics-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.diagnostics-details > summary::-webkit-details-marker {
    display: none;
}

.diagnostics-details > summary span {
    font-size: 15px;
    font-weight: 800;
}

.diagnostics-details > summary strong {
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--muted);
    padding: 4px 8px;
    font-size: 11px;
}

.diagnostics-details[open] > summary {
    margin-bottom: 10px;
}

.metric-cell {
    min-width: 120px;
}

.bar {
    height: 5px;
    margin-top: 3px;
}

@media (max-width: 1150px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .primary {
        grid-column: span 2;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .topbar-extra {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand {
        margin-bottom: 12px;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

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

    .nav-link {
        grid-template-columns: 18px minmax(0, 1fr) 16px;
        align-items: center;
        padding: 9px 10px;
    }

    .nav-item__label {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-status--planned {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        padding: 0;
        overflow: hidden;
        color: transparent;
        font-size: 0;
    }

    .nav.open {
        display: grid;
    }

    .sidebar-footer {
        display: none;
    }

    .filters,
    .topbar-extra,
    .filters-grid,
    .event-form,
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-page {
        padding: 14px;
    }

    .help-hero,
    .help-section__head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .help-toc {
        position: static;
    }

    .help-grid--two,
    .help-status-grid {
        grid-template-columns: 1fr;
    }

    .help-table th,
    .help-table td {
        display: block;
        width: 100%;
    }

    .help-table td {
        border-top: 0;
        padding-top: 0;
    }

    .primary {
        grid-column: auto;
    }

    .content {
        padding: 14px;
    }

    .page-head {
        display: block;
    }

    .actions {
        margin-top: 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .panel-head {
        display: block;
    }

    .controls {
        justify-content: flex-start;
        margin-top: 10px;
    }

    .event-row {
        grid-template-columns: 1fr;
    }

    .journal-filters .check-group {
        grid-column: auto;
    }

    .journal-filters .filter-actions button {
        width: 100%;
    }

    .journal-page-head .actions {
        justify-content: flex-start;
    }

    .journal-page-head .actions .btn {
        justify-content: center;
        width: 100%;
    }

    .source-filter,
    .source-filter.narrow,
    .source-two-columns {
        grid-template-columns: 1fr;
    }

    .source-filter .primary,
    .source-filter button {
        width: 100%;
    }

    .modal {
        width: calc(100% - 24px);
        padding: 18px;
    }
}

/* Final dashboard UX pass */
.app,
.main,
.topbar,
.content,
.panel,
.page-head,
.filters,
.filter-group,
.table-scroll,
.chart {
    min-width: 0;
    max-width: 100%;
}

.topbar {
    padding: 12px 18px;
}

.topbar-head {
    align-items: baseline;
    margin-bottom: 8px;
}

.topbar-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.filters {
    align-items: stretch;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.45fr) minmax(0, 0.9fr) auto;
    gap: 8px;
}

.filter-group {
    display: grid;
    align-content: start;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    margin: 0;
    background: #fbfcfc;
    padding: 8px;
}

.filter-group legend {
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    padding: 0 3px;
}

.filter-row {
    display: grid;
    gap: 7px;
}

.filter-group-period .filter-row {
    grid-template-columns: minmax(120px, 1.2fr) repeat(2, minmax(112px, 1fr));
}

.filter-group-compare .filter-row {
    grid-template-columns: minmax(92px, 0.7fr) minmax(145px, 1.1fr) repeat(2, minmax(112px, 0.9fr));
}

.filter-group-data .filter-row {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
}

.filter-group .field > span,
.toggle-field > span:first-child {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.filter-group .field select,
.filter-group .field input {
    height: 34px;
    min-height: 34px;
    padding: 0 8px;
}

.toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    padding: 0 9px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.filter-group .toggle-control input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
}

.comparison-mode-field {
    display: grid;
    align-content: start;
    grid-template-rows: auto auto;
    gap: 6px;
    min-width: 0;
}

.comparison-alignment-toggle {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    min-height: 22px;
    color: var(--text);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.comparison-alignment-toggle.disabled {
    color: var(--muted);
    opacity: 0.58;
    cursor: default;
}

.comparison-alignment-toggle input {
    width: 14px;
    min-width: 14px;
    height: 14px;
    min-height: 14px;
    margin: 0;
    accent-color: var(--accent);
}

.date-control {
    position: relative;
    display: block;
    min-width: 0;
}

.filter-group .field .date-control [data-date-display] {
    padding-right: 34px;
}

.filter-group .field .date-control input[type="date"] {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 1;
    width: 30px;
    min-width: 30px;
    height: calc(100% - 4px);
    min-height: 30px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.date-picker-button {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    display: inline-grid;
    place-items: center;
    width: 30px;
    min-width: 30px;
    height: calc(100% - 4px);
    min-height: 30px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    padding: 0;
}

.date-picker-button:hover,
.date-picker-button:focus-visible {
    background: #eef3f1;
    color: var(--accent-dark);
}

.date-picker-button span {
    position: relative;
    display: block;
    width: 14px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
}

.date-picker-button span::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 0;
    width: 100%;
    border-top: 1.5px solid currentColor;
}

.date-picker-button span::after {
    content: "";
    position: absolute;
    top: -3px;
    left: 3px;
    width: 6px;
    height: 4px;
    border-right: 1.5px solid currentColor;
    border-left: 1.5px solid currentColor;
}

.filter-submit {
    display: flex;
    align-items: end;
}

.filter-submit .primary {
    min-width: 118px;
    height: 52px;
    min-height: 52px;
}

.dropdown-field {
    align-self: auto;
}

.dropdown-field summary {
    height: 34px;
    min-height: 34px;
    padding: 3px 8px;
}

.dropdown-panel {
    width: min(320px, calc(100vw - 32px));
    max-height: min(300px, 70vh);
    overflow: auto;
}

.filter-group-data .dropdown-field:last-child .dropdown-panel {
    right: 0;
    left: auto;
}

.actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.kpi-context {
    margin-bottom: 8px;
}

.kpi-table-panel {
    padding: 10px;
}

.compact-panel-head {
    margin-bottom: 6px;
}

.compact-panel-head h3 {
    margin: 0;
    font-size: 15px;
}

.kpi-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.change-cell {
    color: var(--muted);
    font-weight: 800;
}

.change-cell.up {
    color: var(--success);
}

.change-cell.down {
    color: var(--danger);
}

.change-cell span {
    margin-left: 6px;
    color: var(--muted);
    font-weight: 700;
}

.help-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #f8faf9;
    color: var(--muted);
    padding: 0;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
}

.help-button:hover,
.help-button[aria-expanded="true"] {
    border-color: #cbd8d2;
    background: #eef3f1;
    color: var(--accent-dark);
}

.help-button:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.28);
    outline-offset: 2px;
}

.help-button:disabled,
.help-button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

.segmented input {
    width: 1px;
    min-width: 1px;
    height: 1px;
    min-height: 1px;
}

.customer-split-component {
    margin-top: 10px;
}

.customer-split-legend {
    gap: 8px 14px;
    font-size: 12px;
}

.chart .summary-chart {
    max-width: 100%;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.controls .segmented {
    margin-left: 4px;
}

.business-metric {
    border-color: rgba(236, 43, 123, 0.24);
    background: #fff7fb;
    font-weight: 800;
}

.event-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
}

.metric-cell {
    min-width: 0;
}

.bar {
    height: 4px;
    margin-top: 1px;
}

.diagnostics-details.summary-diagnostics {
    margin-top: 12px;
}

.report-body .diagnostics-details {
    margin-top: 14px;
}

.report-body .diagnostics-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
}

.report-body .diagnostics-details > summary span {
    flex: 1 1 auto;
    min-width: 0;
}

.report-body .diagnostics-details > summary strong {
    flex: 0 0 auto;
}

.report-body .diagnostics-details[open] > summary {
    margin-bottom: 12px;
}

.diagnostics-details > summary strong.ok {
    background: #ecfdf3;
    color: var(--success);
}

.diagnostics-details > summary strong.attention {
    background: #fff4e5;
    color: #b45309;
}

.unidentified-note {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
}

.unidentified-note p {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

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

.frequency-chart {
    height: 280px;
}

.frequency-chart text {
    font-size: 10px;
}

@media (max-width: 1500px) {
    .filters {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .filter-group {
        grid-column: 1;
    }

    .filter-submit {
        grid-column: 2;
        grid-row: 1 / span 3;
    }

    .filter-submit .primary {
        height: 100%;
        min-height: 52px;
    }
}

@media (max-width: 1180px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .filter-group,
    .filter-submit {
        grid-column: auto;
        grid-row: auto;
    }

    .filter-submit {
        justify-content: flex-end;
    }

    .filter-submit .primary {
        height: 52px;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding: 10px 12px;
    }

    .topbar-head {
        display: block;
    }

    .topbar-head span {
        display: block;
        margin-top: 2px;
    }

    .filters,
    .filter-group-period .filter-row,
    .filter-group-compare .filter-row,
    .filter-group-data .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-submit .primary,
    .actions .btn {
        width: 100%;
    }

    .page-head {
        display: block;
    }

    .actions {
        justify-content: stretch;
    }

    .split-bar-label {
        display: block;
    }

    .controls {
        justify-content: flex-start;
    }

    .frequency-chart-grid {
        grid-template-columns: 1fr;
    }
}

/* Unified analytics UX refinements after Stage D */
.dashboard-container {
    width: 100%;
    max-width: none;
    margin: 0;
}

.main {
    min-width: 0;
}

.topbar.dashboard-container,
.content.dashboard-container {
    min-width: 0;
}

.topbar.dashboard-container {
    margin-top: 0;
}

.content.dashboard-container {
    padding-inline: 18px;
}

.filters {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.45fr) minmax(360px, 0.95fr) auto;
    align-items: start;
}

.filter-group,
.filter-row,
.filter-group .field,
.dropdown-field summary strong {
    min-width: 0;
}

.filter-group-data .filter-row {
    grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.15fr);
}

.filter-group .field select,
.filter-group .field input,
.dropdown-field summary,
.toggle-control {
    height: 36px;
    min-height: 36px;
}

.dropdown-field summary {
    gap: 1px;
    padding: 4px 10px;
}

.dropdown-field summary strong {
    font-size: 12.5px;
    line-height: 1.15;
}

.filter-submit {
    align-items: end;
    align-self: stretch;
}

.filter-submit .primary {
    width: auto;
    min-width: 116px;
    height: 36px;
    min-height: 36px;
    padding-inline: 16px;
}

.chart-grid-line {
    stroke: #eef2f7;
    stroke-width: 1;
}

.summary-chart text {
    font-size: 11px;
}

.chart .summary-chart {
    overflow: visible;
}

.load-more {
    margin-top: 8px;
}

.placeholder-panel {
    max-width: 760px;
}

.badge,
.provider-badge {
    width: auto;
    max-width: 100%;
}

@media (max-width: 1500px) {
    .filters {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .filter-group,
    .filter-submit {
        grid-column: auto;
        grid-row: auto;
    }

    .filter-submit {
        justify-content: flex-end;
        align-self: end;
    }
}

@media (max-width: 1180px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .filter-submit {
        justify-content: flex-end;
    }
}

@media (max-width: 760px) {
    .dashboard-container {
        max-width: 100%;
    }

    .content.dashboard-container {
        padding-inline: 12px;
    }

    .filters,
    .filter-group-period .filter-row,
    .filter-group-compare .filter-row,
    .filter-group-data .filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-submit .primary {
        width: 100%;
    }

}

/* Dashboard UX repair: full workspace, compact analytics components */
.app {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    column-gap: 0;
    width: 100%;
}

.main,
.dashboard-container,
.topbar.dashboard-container,
.content.dashboard-container {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
}

.report-shell {
    box-sizing: border-box;
    display: grid;
    gap: var(--analytics-section-gap);
    width: 100%;
    min-width: 0;
}

.report-body {
    box-sizing: border-box;
    display: grid;
    gap: var(--analytics-section-gap);
    width: 100%;
    max-width: 1250px;
    min-width: 0;
    margin-left: 0;
    margin-right: auto;
}

.report-body.report-body--wide {
    max-width: 1450px;
}

.report-body + .report-body {
    margin-top: 0;
}

.report-context {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    margin: 0;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 11px;
}

.report-context__item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
}

.report-context__label {
    flex: 0 0 auto;
    color: var(--muted);
    font-weight: 600;
}

.report-context__label::after {
    content: ":";
}

.report-context__value {
    min-width: 0;
    color: var(--text);
    font-weight: 700;
}

.report-context__note {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .report-context {
        gap: 6px 12px;
    }

    .report-context__item {
        flex: 1 1 100%;
    }
}

.content.dashboard-container {
    padding: 16px 18px 22px;
}

.topbar.dashboard-container {
    border-bottom: 0;
    padding: 10px 18px 8px;
}

.filters-bar.dashboard-container {
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    padding: 0 18px 12px;
}

.topbar-head {
    align-items: baseline;
    gap: 14px;
    margin-bottom: 8px;
}

.topbar-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

.filters {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(500px, 1.25fr) minmax(360px, 0.95fr) max-content;
    align-items: end;
    gap: 10px;
}

.filter-group {
    display: grid;
    align-content: start;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    padding: 8px 10px 10px;
}

.filter-group legend {
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    padding-inline: 4px;
}

.filter-row {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.filter-group-period .filter-row {
    grid-template-columns: minmax(150px, 1.25fr) repeat(2, minmax(120px, 1fr));
}

.filter-group-compare .filter-row {
    grid-template-columns: minmax(104px, 0.72fr) minmax(178px, 1.18fr) repeat(2, minmax(120px, 1fr));
    align-items: start;
}

.filter-group-compare .field,
.filter-group-compare .comparison-mode-field {
    align-self: start;
}

.filter-group-data .filter-row {
    grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.15fr);
}

.filter-group .field,
.filter-group .field select,
.filter-group .field input,
.dropdown-field,
.dropdown-field summary {
    min-width: 0;
}

.filter-group .field > span:not(.toggle-control),
.toggle-field > span:first-child {
    display: block;
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.filter-group .field select,
.filter-group .field input,
.dropdown-field summary,
.toggle-control {
    height: 38px;
    min-height: 38px;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    margin: 0;
    padding: 0 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
}

.toggle-control span {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
}

.filter-group .toggle-control input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
}

.dropdown-field summary {
    display: grid;
    grid-template-rows: auto auto;
    gap: 2px;
    padding: 4px 10px;
}

.dropdown-field summary strong {
    overflow: visible;
    min-width: 0;
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.1;
    text-overflow: clip;
    white-space: nowrap;
}

.dropdown-panel {
    right: auto;
    left: 0;
    width: max-content;
    min-width: 100%;
    max-width: min(360px, calc(100vw - 32px));
    max-height: min(320px, 70vh);
    overflow: auto;
}

.filter-group-data .dropdown-field:last-child .dropdown-panel {
    right: 0;
    left: auto;
}

.filter-submit {
    display: flex;
    align-self: end;
    align-items: end;
    justify-content: flex-end;
}

.filter-submit .primary {
    width: auto;
    min-width: 116px;
    height: 38px;
    min-height: 38px;
    padding-inline: 20px;
    white-space: nowrap;
}

.page-head {
    align-items: flex-start;
    gap: 14px;
    margin: 14px 0 12px;
}

.page-head h1 {
    margin-bottom: 5px;
    font-size: 26px;
}

.page-head .actions {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.analytics-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
    padding: 14px 16px;
}

.chart-card {
    padding: 16px 18px;
}

.panel-head {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.panel h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.panel-head p,
.panel p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.report-body .panel.analytics-card,
.report-body .bottom-grid > .panel {
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
    overflow: visible;
    padding: 14px 16px;
}

.report-body .bottom-grid > .panel {
    margin-top: 0;
    margin-bottom: 0;
}

.report-body > .panel,
.report-body > .analytics-card,
.report-body > .analytics-section,
.report-body > .bottom-grid {
    margin-top: 0;
    margin-bottom: 0;
}

.report-body .chart-card {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
}

.report-body .panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    margin: 0 0 12px;
}

.report-body .panel-head > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.report-body .panel-head > :not(:first-child) {
    flex: 0 0 auto;
}

.report-body .panel-head h3 {
    margin: 0;
}

.report-body .panel-head p {
    margin: 4px 0 0;
}

.report-body .panel.analytics-card > :last-child,
.report-body .bottom-grid > .panel > :last-child {
    margin-bottom: 0;
}

.ltv-data-quality {
    display: grid;
    gap: 14px;
}

.ltv-guide-content,
.ltv-block-explainer {
    display: grid;
    gap: 18px;
    max-width: 960px;
}

.ltv-data-quality-summary {
    display: grid;
    gap: 7px;
    max-width: 960px;
}

.ltv-data-quality-summary p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.ltv-data-quality-summary strong {
    color: var(--text);
}

.ltv-guide-section,
.ltv-block-explainer section {
    display: grid;
    gap: 7px;
}

.ltv-guide-section h4,
.ltv-block-explainer h4 {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.ltv-guide-section p,
.ltv-block-explainer p {
    margin: 0;
    max-width: 92ch;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.ltv-guide-section strong,
.ltv-block-explainer strong {
    color: var(--text);
}

.ltv-fact-list {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.ltv-fact-list li {
    padding-left: 2px;
}

.ltv-chart-controls {
    display: grid;
    gap: 8px;
    max-width: 960px;
}

.ltv-chart-controls__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ltv-chart-controls__head > strong {
    color: var(--text);
    font-size: 14px;
}

.ltv-horizon-segmented {
    flex: 0 1 auto;
}

.ltv-chart-controls p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.ltv-chart-window {
    font-weight: 700;
}

.ltv-chart-error {
    max-width: 640px;
}

[data-ltv-chart-card] .chart-scroll {
    overflow-x: hidden;
}

.ltv-bar-chart {
    width: 100%;
    min-width: 0;
}

.ltv-legend-current {
    background: #ec2b7b;
}

.ltv-legend-comparison {
    background: #94a3b8;
}

.lifecycle-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.report-disclosure {
    display: grid;
    gap: 0;
    max-width: 1180px;
}

.report-disclosure__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: fit-content;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, outline-color 180ms ease;
}

.report-disclosure__toggle:hover {
    border-color: var(--line);
    background: #eef3f1;
}

.report-disclosure__toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--line);
    background: #eef3f1;
}

.report-disclosure.is-open .report-disclosure__toggle {
    background: #eef3f1;
}

.report-disclosure__open {
    display: none;
}

.report-disclosure.is-open .report-disclosure__closed {
    display: none;
}

.report-disclosure.is-open .report-disclosure__open {
    display: inline;
}

.report-disclosure__body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 240ms ease, opacity 240ms ease, margin-top 240ms ease;
}

.report-disclosure__body[hidden] {
    display: none;
}

.report-disclosure.is-open .report-disclosure__body {
    margin-top: 10px;
    opacity: 1;
}

.report-disclosure__content {
    display: grid;
    gap: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .report-disclosure__toggle,
    .report-disclosure__body {
        transition: none;
    }
}

.report-disclosure__content > .ltv-block-explainer {
    margin: 0;
}

.diagnostics-details.report-disclosure {
    max-width: none;
}

.diagnostics-details .report-disclosure__toggle {
    width: 100%;
}

.diagnostics-details .report-disclosure__toggle strong {
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--muted);
    padding: 4px 8px;
    font-size: 11px;
}

.diagnostics-details .report-disclosure__toggle strong.ok {
    background: #ecfdf3;
    color: var(--success);
}

.diagnostics-details .report-disclosure__toggle strong.attention {
    background: #fff4e5;
    color: #b45309;
}

.metric-pair {
    white-space: nowrap;
}

.analytics-table--distribution thead th:not(:first-child) {
    text-align: right;
}

.analytics-table--distribution thead th:not(:first-child) .kpi-name {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    gap: 6px;
}

.analytics-table--dimension thead th:not(:first-child) {
    text-align: right;
}

.analytics-table--dimension thead th:not(:first-child) .kpi-name {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    gap: 6px;
    white-space: nowrap;
}

.analytics-table--dimension thead th:not(:first-child) .help-button {
    flex: 0 0 auto;
}

.related-reports,
.report-summary {
    display: grid;
    gap: var(--analytics-content-gap);
}

.related-report-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.related-report-list a {
    display: grid;
    gap: 5px;
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    padding: 12px;
    text-decoration: none;
}

.related-report-list a:hover,
.related-report-list a:focus-visible {
    background: #eef3f1;
}

.related-report-list strong {
    font-size: 14px;
}

.related-report-list span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.omnichannel-alert {
    align-items: center;
    display: flex;
    gap: var(--analytics-content-gap);
    justify-content: space-between;
}

.omnichannel-alert p {
    margin: 0;
}

.omnichannel-alert strong {
    white-space: nowrap;
}

.omnichannel-summary-table th:first-child {
    width: 58%;
}

.omnichannel-chart-card .chart-scroll {
    margin-top: var(--analytics-content-gap);
}

.omnichannel-series label {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: var(--analytics-control-gap);
    min-height: 32px;
    padding: 6px 9px;
    white-space: nowrap;
}

.omnichannel-series label:has(input:checked) {
    background: #f5faf8;
    border-color: #b9cbc5;
}

.omnichannel-series input {
    inline-size: 14px;
}

.omnichannel-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
}

.omnichannel-point {
    stroke: #fff;
    stroke-width: 1.5;
}

.omnichannel-matrix th,
.omnichannel-matrix td {
    min-width: 96px;
}

.omnichannel-group-row th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.omnichannel-value-facts {
    margin-top: var(--analytics-content-gap);
}

.omnichannel-path-list {
    display: grid;
    gap: var(--analytics-control-gap);
    margin: 0;
    padding-left: 22px;
}

.omnichannel-path-list li {
    border-bottom: 1px solid var(--line);
    padding: 0 0 9px;
}

.omnichannel-path-list span {
    color: var(--text);
}

.omnichannel-path-list strong {
    float: right;
    margin-left: 12px;
}

@media (max-width: 760px) {
    .omnichannel-alert {
        align-items: flex-start;
        flex-direction: column;
    }

    .omnichannel-alert strong,
    .omnichannel-series label {
        white-space: normal;
    }
}

.customer-base-card {
    gap: 12px;
}

.customer-base-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 1180px;
}

.customer-base-toolbar__group {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.customer-base-toolbar__group > strong {
    color: var(--text);
    font-size: 13px;
}

.customer-base-segmented {
    flex-wrap: wrap;
}

.series-toggle-list,
.customer-base-series,
.purchase-depth-groups {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--analytics-control-gap);
    max-width: 100%;
}

.series-toggle,
.customer-base-check,
.purchase-depth-check {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: 7px;
    min-height: 32px;
    padding: 6px 9px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
    user-select: none;
    white-space: nowrap;
}

.series-toggle:hover,
.customer-base-check:hover,
.purchase-depth-check:hover {
    background: #f8fbfa;
    border-color: #c9d6d1;
}

.series-toggle:has(input:checked),
.customer-base-check:has(input:checked),
.purchase-depth-check:has(input:checked) {
    background: #f5faf8;
    border-color: #b9cbc5;
}

.series-toggle:has(input:focus-visible),
.customer-base-check:has(input:focus-visible),
.purchase-depth-check:has(input:focus-visible) {
    outline: 2px solid rgba(15, 118, 110, 0.24);
    outline-offset: 2px;
}

.series-toggle:has(input:disabled),
.customer-base-check:has(input:disabled),
.purchase-depth-check:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
}

.series-toggle input,
.customer-base-check input,
.purchase-depth-check input {
    flex: 0 0 auto;
    height: 14px;
    margin: 0;
    min-height: 14px;
    padding: 0;
    width: 14px;
}

.series-toggle input:focus,
.customer-base-check input:focus,
.purchase-depth-check input:focus {
    outline: none;
}

.series-toggle__swatch,
.purchase-depth-swatch {
    border-radius: 999px;
    flex: 0 0 auto;
    height: 10px;
    width: 10px;
}

.customer-base-error {
    max-width: 720px;
}

.customer-base-chart {
    width: 100%;
    min-width: 0;
}

.customer-base-line {
    stroke-width: 2.6;
}

.customer-base-line.incomplete {
    stroke-dasharray: 6 5;
}

.customer-base-line.muted,
.customer-base-point.muted {
    opacity: 0.24;
}

.customer-base-line.active {
    stroke-width: 3.6;
}

.customer-base-point {
    stroke: #ffffff;
    stroke-width: 2;
}

.customer-base-point.active {
    stroke-width: 3;
}

.customer-base-point.incomplete {
    stroke-dasharray: 3 3;
}

.customer-base-hover-line {
    pointer-events: none;
}

.customer-base-insights {
    display: grid;
    gap: 7px;
    max-width: 980px;
}

.customer-base-insights h4 {
    margin: 0;
    font-size: 14px;
}

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

.ltv-365-summary section {
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
}

.ltv-365-summary h4 {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.ltv-365-summary strong {
    color: var(--text);
    font-size: 22px;
    line-height: 1.2;
}

.ltv-365-summary p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.purchase-depth-card {
    gap: 12px;
}

.purchase-depth-card .panel-head {
    order: 1;
}

.purchase-depth-explainer {
    order: 2;
}

.purchase-depth-toolbar {
    order: 3;
}

.purchase-depth-groups {
    order: 4;
}

.purchase-depth-error {
    order: 5;
}

.purchase-depth-card .chart-scroll {
    order: 6;
}

.purchase-depth-insights {
    order: 7;
}

.purchase-depth-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 1180px;
}

.purchase-depth-toolbar__group {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.purchase-depth-toolbar__group > strong {
    color: var(--text);
    font-size: 13px;
}

.purchase-depth-segmented {
    flex-wrap: wrap;
}

.purchase-depth-explainer .ltv-block-explainer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 1180px;
    gap: 14px 22px;
}

.purchase-depth-error {
    max-width: 720px;
}

.purchase-depth-chart {
    width: 100%;
    min-width: 0;
}

.purchase-depth-line {
    stroke-width: 2.5;
}

.purchase-depth-line:not(.incomplete)[data-purchase-depth-bucket="2"] {
    stroke-dasharray: 9 4;
}

.purchase-depth-line:not(.incomplete)[data-purchase-depth-bucket="3"] {
    stroke-dasharray: 3 3;
}

.purchase-depth-line:not(.incomplete)[data-purchase-depth-bucket="4"] {
    stroke-dasharray: 10 4 2 4;
}

.purchase-depth-line:not(.incomplete)[data-purchase-depth-bucket="5"] {
    stroke-dasharray: 5 5 2 5;
}

.purchase-depth-line.incomplete {
    stroke-dasharray: 6 5;
}

.purchase-depth-line.muted,
.purchase-depth-point.muted {
    opacity: 0.24;
}

.purchase-depth-line.active {
    stroke-width: 3.5;
}

.purchase-depth-point {
    stroke: #ffffff;
    stroke-width: 2;
}

.purchase-depth-point.active {
    stroke-width: 3;
}

.purchase-depth-point.incomplete {
    stroke-dasharray: 3 3;
}

.purchase-depth-hover-line {
    pointer-events: none;
}

.purchase-depth-insights {
    display: grid;
    gap: 7px;
    max-width: 980px;
}

.purchase-depth-insights h4 {
    margin: 0;
    font-size: 14px;
}

.purchase-milestones {
    gap: 14px;
}

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

.milestone-kpis section {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
}

.milestone-kpis span,
.milestone-kpis small,
.muted-note {
    color: var(--muted);
}

.milestone-kpis strong {
    color: var(--text);
    font-size: 26px;
    line-height: 1.1;
}

.milestone-kpis p {
    margin: 4px 0 0;
    color: var(--muted);
}

.milestone-chart-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 10px;
}

.purchase-milestone-chart {
    width: 100%;
    height: 300px;
}

.purchase-milestone-bar {
    cursor: pointer;
}

.purchase-milestone-table th:not(:first-child),
.purchase-milestone-table td:not(:first-child),
.compact-milestone-table th:not(:first-child),
.compact-milestone-table td:not(:first-child) {
    text-align: right;
}

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

.milestone-breakdowns section {
    min-width: 0;
}

.milestone-breakdowns h4 {
    margin: 0 0 8px;
    font-size: 14px;
}

.compact-milestone-table {
    width: 100%;
}

.muted-note {
    margin: 0;
    max-width: 980px;
    font-size: 13px;
}

.analytics-section {
    max-width: 100%;
}

.analytics-card--compact,
.analytics-section--compact {
    width: fit-content;
    max-width: 100%;
}

.analytics-card--medium,
.analytics-section--medium {
    width: 100%;
    max-width: 900px;
}

.analytics-card--wide,
.analytics-section--wide {
    width: 100%;
    max-width: 100%;
}

.analytics-card--table,
.analytics-section--table {
    width: 100%;
    max-width: 100%;
}

.analytics-card--table .panel-head,
.analytics-section--table .panel-head {
    width: 100%;
    max-width: 100%;
}

.analytics-card--compact .panel-head,
.analytics-section--compact .panel-head {
    width: fit-content;
    max-width: 100%;
}

.analytics-card--compact .panel-head p,
.analytics-section--compact .panel-head p {
    max-width: 58ch;
}

.analytics-card--compact.analytics-card--table .panel-head,
.analytics-section--compact.analytics-section--table .panel-head {
    width: 100%;
}

.analytics-table-wrap {
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

.analytics-card--compact .analytics-table-wrap,
.analytics-section--compact .analytics-table-wrap {
    width: fit-content;
    max-width: 100%;
}

.analytics-card--table .analytics-table-wrap,
.analytics-section--table .analytics-table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.analytics-card--table .analytics-table,
.analytics-section--table .analytics-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
}

.analytics-card--table .analytics-table col,
.analytics-section--table .analytics-table col {
    width: auto;
}

.analytics-card--table .analytics-table thead th,
.analytics-section--table .analytics-table thead th {
    white-space: normal;
}

.analytics-card--table .analytics-table td,
.analytics-section--table .analytics-table td {
    white-space: nowrap;
}

.analytics-card--table .analytics-table tbody th,
.analytics-card--table .analytics-table tbody td,
.analytics-section--table .analytics-table tbody th,
.analytics-section--table .analytics-table tbody td {
    transition: background-color 120ms ease;
}

.analytics-card--table .analytics-table tbody tr:hover th,
.analytics-card--table .analytics-table tbody tr:hover td,
.analytics-section--table .analytics-table tbody tr:hover th,
.analytics-section--table .analytics-table tbody tr:hover td {
    background: rgba(236, 43, 123, 0.055);
}

.analytics-table {
    width: max-content;
    max-width: none;
    border-collapse: collapse;
    table-layout: auto;
    background: #ffffff;
    font-size: 13px;
    line-height: 1.35;
}

.analytics-table--compact {
    width: max-content;
    min-width: 0;
}

.analytics-table--wide {
    width: max-content;
    min-width: 0;
}

.analytics-table col.col-metric {
    width: 260px;
}

.analytics-table col.col-value {
    width: 150px;
}

.analytics-table col.col-comparison {
    width: 170px;
}

.analytics-table col.col-change {
    width: 150px;
}

.analytics-table col.col-count {
    width: 90px;
}

.analytics-table col.col-money {
    width: 140px;
}

.analytics-table col.col-percent {
    width: 125px;
}

.analytics-table th,
.analytics-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.analytics-table thead th {
    background: #f5f7f8;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-align: right;
    text-transform: uppercase;
}

.analytics-table thead th:first-child,
.analytics-table tbody th {
    text-align: left;
}

.analytics-table tbody th {
    position: static;
    background: transparent;
    color: var(--text);
    font-weight: 700;
}

.analytics-table tbody tr:hover td,
.analytics-table tbody tr:hover th {
    background: #fbfcfd;
}

.analytics-table tfoot th,
.analytics-table tfoot td {
    background: #f8faf9;
    font-weight: 800;
}

.analytics-table .numeric,
.analytics-table td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.analytics-table-help {
    margin-top: var(--analytics-content-gap);
}

.kpi-table-panel {
    padding: 12px;
}

.kpi-table-panel .analytics-table--compact {
    min-width: 0;
}

.kpi-name {
    justify-content: flex-start;
    gap: 8px;
}

.change-cell {
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.change-cell.up {
    color: var(--success);
}

.change-cell.down {
    color: var(--danger);
}

.change-cell span {
    margin-left: 8px;
    color: var(--muted);
    font-weight: 700;
}

.weekly-sales-card {
    padding: 20px 24px;
}

.weekly-sales-card .panel-head {
    align-items: flex-start;
    margin-bottom: 14px;
}

.weekly-sales-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.weekly-compare-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    min-height: 34px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
}

.weekly-compare-control.disabled {
    color: var(--muted);
    opacity: 0.58;
    cursor: default;
}

.weekly-compare-control input {
    width: 15px;
    min-width: 15px;
    height: 15px;
    min-height: 15px;
    margin: 0;
    accent-color: var(--accent);
}

.weekly-sales-card.loading .weekly-sales-scroll {
    opacity: 0.72;
}

.weekly-sales-card .panel-head h3 {
    font-size: 16px;
}

.weekly-sales-card .panel-head p {
    margin-top: 4px;
    font-size: 13px;
}

.weekly-sales-scroll {
    margin-top: 14px;
}

.analytics-table--weekly {
    width: max-content;
    min-width: 820px;
    max-width: none;
    table-layout: auto;
}

.analytics-table--weekly th,
.analytics-table--weekly td {
    height: 34px;
    padding: 6px 8px;
    text-align: right;
}

.analytics-table--weekly thead th {
    position: sticky;
    z-index: 4;
    background: #f5f7f8;
}

.analytics-table--weekly thead tr:first-child th {
    top: 0;
}

.analytics-table--weekly thead tr:nth-child(2) th {
    top: 30px;
}

.analytics-table--weekly th:first-child,
.analytics-table--weekly td:first-child {
    width: 190px;
    min-width: 180px;
    max-width: 210px;
    text-align: left;
}

.analytics-table--weekly th:not(:first-child),
.analytics-table--weekly td:not(:first-child) {
    width: 125px;
    min-width: 115px;
    max-width: 135px;
}

.analytics-table--weekly thead tr:nth-child(2) th:nth-child(3),
.analytics-table--weekly thead tr:nth-child(2) th:nth-child(5),
.analytics-table--weekly thead tr:nth-child(2) th:nth-child(7),
.analytics-table--weekly tbody td:nth-child(3),
.analytics-table--weekly tbody td:nth-child(5),
.analytics-table--weekly tbody td:nth-child(7) {
    width: 62px;
    min-width: 55px;
    max-width: 70px;
}

.analytics-table--weekly thead tr:first-child th:not(:first-child),
.analytics-table--weekly thead tr:nth-child(2) th:nth-child(2),
.analytics-table--weekly thead tr:nth-child(2) th:nth-child(4),
.analytics-table--weekly thead tr:nth-child(2) th:nth-child(6),
.analytics-table--weekly tbody td:nth-child(2),
.analytics-table--weekly tbody td:nth-child(4),
.analytics-table--weekly tbody td:nth-child(6) {
    border-left: 1px solid #e3e7ed;
}

.analytics-table--weekly thead tr:first-child th:not(:first-child) {
    text-align: center;
}

.analytics-table--weekly tbody td:first-child {
    position: static;
    background: transparent;
    font-weight: 700;
}

.weekly-value {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    max-width: 100%;
    white-space: nowrap;
}

.weekly-value__current {
    min-width: 0;
    font-weight: 700;
}

.weekly-value__change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    padding: 1px 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.15;
    white-space: nowrap;
}

.weekly-value__change:hover,
.weekly-value__change:focus-visible {
    background: #eef3f1;
}

.weekly-value__change:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.28);
    outline-offset: 2px;
}

.weekly-value__change--positive {
    color: var(--success);
}

.weekly-value__change--negative {
    color: var(--danger);
}

.weekly-value__change--neutral {
    color: var(--muted);
}

.weekly-value__change--positive::before,
.weekly-value__change--negative::before,
.weekly-value__change--neutral::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.weekly-sales-card--hide-comparison .weekly-value__change {
    display: none;
}

.analytics-table--weekly .bar {
    height: 3px;
    margin-top: 2px;
    opacity: 0.72;
}

.weekly-sales-card .load-more {
    display: inline-flex;
    margin: 10px 0 0;
}

.new-repeat-composition {
    width: 100%;
}

.new-repeat-composition .split-bar {
    height: 16px;
}

.chart-error {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    background: #fff7f8;
    margin-top: 8px;
    padding: 8px 10px;
    color: #9f1239;
    font-size: 12px;
    font-weight: 700;
}

.chart-error[hidden] {
    display: none;
}

.chart-legend [aria-disabled="true"] {
    opacity: 0.55;
}

.new-repeat-comparison-table tbody th,
.new-repeat-comparison-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}

.new-repeat-comparison-table .kpi-name {
    align-items: center;
}

.new-repeat-comparison-table tbody tr.comparison-group-start > th,
.new-repeat-comparison-table tbody tr.comparison-group-start > td {
    padding-top: 18px;
}

[data-frequency-chart-card] .chart-scroll {
    transition: opacity 120ms ease;
}

[data-frequency-chart-card].loading .chart-scroll {
    opacity: 0.48;
}

@media (max-width: 1500px) {
    .filters {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .filter-submit {
        justify-content: flex-end;
    }
}

@media (max-width: 1180px) {
    .filters {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-group-period .filter-row,
    .filter-group-compare .filter-row,
    .filter-group-data .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
        display: block;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .content.dashboard-container {
        padding: 12px;
    }

    .topbar {
        padding: 10px 12px;
    }

    .topbar-head {
        display: block;
    }

    .topbar-head span {
        display: block;
        margin-top: 2px;
        text-align: left;
    }

    .filters,
    .filter-group-period .filter-row,
    .filter-group-compare .filter-row,
    .filter-group-data .filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-submit .primary,
    .page-head .actions,
    .page-head .actions .btn {
        width: 100%;
    }

    .page-head {
        display: block;
    }

    .page-head .actions {
        justify-content: stretch;
        margin-top: 10px;
    }

    .analytics-card,
    .panel,
    .weekly-sales-card {
        padding: 12px;
    }

    .analytics-table--weekly {
        min-width: 760px;
    }

    .weekly-sales-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

/* Frequency report chart refinements */
.frequency-chart-grid {
    grid-template-columns: minmax(0, 1fr) minmax(560px, 1.15fr);
    align-items: stretch;
}

.report-body .bottom-grid {
    align-items: stretch;
    gap: var(--analytics-section-gap);
    margin-top: 0;
}

.report-body .bottom-grid > .panel,
.report-body .frequency-chart-grid > .analytics-card {
    height: 100%;
}

.report-body .frequency-chart-grid .panel-head {
    flex-wrap: wrap;
}

.report-body .frequency-chart-toolbar {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: max-content;
    max-width: 100%;
    margin-left: auto;
    white-space: nowrap;
}

.report-body .frequency-chart-toolbar > label {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
}

.chart-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.chart-card .chart-legend {
    margin: 2px 0 6px;
}

.frequency-chart {
    height: 260px;
}

.frequency-chart text {
    font-size: 11px;
    font-weight: 600;
}

.chart-grid-line {
    stroke: #e3e9e7;
    stroke-width: 1;
}

.chart-bar {
    transition: opacity 80ms linear, stroke-width 80ms linear;
}

.chart-bar.active {
    stroke: #111827;
    stroke-width: 1.5;
}

.chart-bar.muted {
    opacity: 0.38;
}

.legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.frequency-structure-one {
    background: #ec2b7b;
}

.frequency-structure-two {
    background: #2563eb;
}

.frequency-structure-three {
    background: #16a34a;
}

.retention-context-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--analytics-control-gap);
}

.retention-context-grid > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e3e9e7;
    border-radius: 8px;
    background: #f8faf9;
}

.retention-context-grid span,
.retention-quality span {
    color: #64746f;
    font-size: 12px;
}

.retention-context-grid strong {
    overflow-wrap: anywhere;
}

.retention-filter-note {
    margin: 12px 0 0;
    color: #41514b;
}

.retention-maturity-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--analytics-content-gap);
    border-color: #d7e7e1;
    background: #f3faf7;
}

.retention-maturity-note > div {
    display: grid;
    gap: 4px;
}

.retention-maturity-note span,
.retention-method-note {
    color: #52635d;
}

.retention-segmented {
    width: max-content;
    max-width: 100%;
    margin-left: auto;
}

.retention-line {
    fill: none;
    stroke-width: 3;
}

.retention-point {
    fill: #0f766e;
    stroke: #ffffff;
    stroke-width: 2;
}

.retention-heatmap-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.retention-heatmap {
    min-width: 980px;
}

.retention-heatmap .sticky-col {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #ffffff;
}

.retention-cell {
    background: rgba(15, 118, 110, calc(0.03 + var(--retention-intensity) * 0.008));
    color: #0f172a;
    font-weight: 700;
}

.retention-cell.is-immature {
    background: #f1f5f4;
    color: #7a8782;
    font-weight: 600;
}

.retention-facts {
    margin-top: 12px;
}

.retention-facts h4 {
    margin: 0 0 6px;
    font-size: 14px;
}

.retention-facts ul {
    margin: 0;
    padding-left: 18px;
    color: #41514b;
}

.retention-statline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    color: #41514b;
    font-size: 13px;
}

.retention-statline span {
    padding: 6px 8px;
    border: 1px solid #e3e9e7;
    border-radius: 6px;
    background: #f8faf9;
}

.retention-timing-bar {
    fill: #2563eb;
}

.retention-empty-state {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid #d7e7e1;
    border-radius: 8px;
    background: #f8faf9;
    color: #41514b;
}

.retention-empty-state[hidden] {
    display: none;
}

.retention-quality {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: baseline;
}

.report-inline-disclosure {
    margin-top: 8px;
    color: #41514b;
}

.report-inline-disclosure summary {
    cursor: pointer;
    font-weight: 700;
}

.report-inline-disclosure p {
    margin: 6px 0 0;
}

@media (max-width: 1100px) {
    .frequency-chart-grid {
        grid-template-columns: 1fr;
    }

    .retention-context-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .frequency-chart {
        height: 235px;
    }

    .frequency-chart-grid {
        gap: 8px;
    }

    .customer-base-toolbar {
        display: grid;
    }

    .customer-base-series {
        width: 100%;
    }

    .ltv-365-summary {
        grid-template-columns: 1fr;
    }

    .milestone-kpis,
    .milestone-breakdowns {
        grid-template-columns: 1fr;
    }

    .related-report-list {
        grid-template-columns: 1fr;
    }

    .purchase-depth-toolbar {
        display: grid;
    }

    .purchase-depth-explainer .ltv-block-explainer {
        grid-template-columns: 1fr;
    }

    .purchase-depth-segmented {
        width: 100%;
    }

    .retention-context-grid {
        grid-template-columns: 1fr;
    }

    .retention-segmented {
        width: 100%;
        margin-left: 0;
    }

    .retention-statline {
        justify-content: flex-start;
    }

    .retention-maturity-note {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (min-width: 1366px) {
    .report-body .analytics-table--distribution,
    .report-body .analytics-table--dimension {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        table-layout: auto;
    }

    .report-body .analytics-table--distribution col,
    .report-body .analytics-table--dimension col {
        width: auto;
    }

    .report-body .analytics-table--distribution th,
    .report-body .analytics-table--distribution td,
    .report-body .analytics-table--dimension th,
    .report-body .analytics-table--dimension td {
        padding-right: 6px;
        padding-left: 6px;
    }

    .report-body .analytics-table--distribution thead th,
    .report-body .analytics-table--dimension thead th {
        white-space: normal;
    }

    .report-body .analytics-table--distribution tbody th,
    .report-body .analytics-table--distribution td,
    .report-body .analytics-table--dimension tbody th,
    .report-body .analytics-table--dimension td {
        white-space: nowrap;
    }
}
