:root {
    --stats-red: #df1717;
    --stats-red-dark: #ba1010;
    --stats-ink: #172033;
    --stats-muted: #6b7280;
    --stats-soft: #f5f7fb;
    --stats-line: #e5e7eb;
    --stats-green: #0f9f63;
    --stats-blue: #276eea;
    --stats-purple: #8d4ff5;
    --stats-orange: #ff7a1a;
    --stats-teal: #11998e;
    --stats-radius: 8px;
    --stats-shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f8fafc;
    color: var(--stats-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button,
select,
input {
    font: inherit;
}

button,
select {
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: var(--stats-ink);
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.stats-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.stats-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100vh;
    border-right: 1px solid var(--stats-line);
    background: #fff;
    padding: 24px 18px;
}

.stats-brand {
    display: block;
    padding: 0 6px 18px;
}

.stats-brand img {
    display: block;
    width: min(210px, 100%);
    height: auto;
}

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

.stats-nav__item,
.stats-actions button,
.stats-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
}

.stats-nav__item {
    border-radius: 7px;
    color: #677184;
    font-weight: 700;
    padding: 11px 12px;
}

.stats-nav__item.is-active {
    background: var(--stats-red);
    box-shadow: 0 8px 18px rgba(223, 23, 23, 0.23);
    color: #fff;
}

.stats-icon {
    position: relative;
    display: inline-grid;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    place-items: center;
}

.stats-icon::before,
.stats-icon::after {
    content: "";
    position: absolute;
    display: block;
}

.stats-icon--grid::before {
    inset: 3px;
    border: 2px solid currentColor;
    border-radius: 4px;
    box-shadow: 0 7px 0 -5px currentColor, 7px 0 0 -5px currentColor;
}

.stats-icon--users::before {
    width: 14px;
    height: 8px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 9px 9px;
    bottom: 3px;
}

.stats-icon--users::after {
    width: 7px;
    height: 7px;
    border: 2px solid currentColor;
    border-radius: 50%;
    top: 2px;
}

.stats-icon--trend::before {
    width: 15px;
    height: 11px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: skew(-12deg);
}

.stats-icon--trend::after {
    width: 11px;
    height: 7px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    right: 2px;
    top: 4px;
    transform: rotate(-12deg);
}

.stats-icon--file::before,
.stats-icon--calendar::before,
.stats-icon--download::before,
.stats-icon--refresh::before,
.stats-icon--filter::before,
.stats-icon--map::before,
.stats-icon--settings::before,
.stats-icon--search::before,
.stats-icon--check::before,
.stats-icon--upload::before,
.stats-icon--export::before {
    inset: 3px;
    border: 2px solid currentColor;
    border-radius: 4px;
}

.stats-actions {
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding: 14px;
}

.stats-actions h2 {
    margin: 0 0 4px;
    font-size: 15px;
}

.stats-actions button {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
    color: #49566c;
    font-weight: 700;
}

.stats-user {
    position: relative;
    border-top: 1px solid var(--stats-line);
    padding: 18px 8px 0;
}

.stats-user__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 7px;
    cursor: pointer;
    list-style: none;
}

.stats-user__summary::-webkit-details-marker {
    display: none;
}

.stats-user__summary:hover {
    background: #f8fafc;
}

.stats-user__avatar {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: var(--stats-red);
    color: #fff;
    font-weight: 800;
}

.stats-user__identity {
    min-width: 0;
}

.stats-user strong,
.stats-user small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-user small {
    margin-top: 3px;
    color: var(--stats-muted);
}

.stats-user__menu {
    position: absolute;
    right: 8px;
    bottom: calc(100% - 10px);
    z-index: 20;
    display: grid;
    width: min(220px, calc(100vw - 32px));
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: var(--stats-shadow);
    padding: 8px;
}

.stats-user__menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 6px;
    color: #3f4b5f;
    font-weight: 800;
    padding: 10px;
}

.stats-user__menu a:hover {
    background: #f8fafc;
    color: var(--stats-red);
}

.stats-main {
    min-width: 0;
    padding: 24px 28px 32px;
}

.stats-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.stats-header h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
}

.stats-header p {
    margin: 7px 0 0;
    color: var(--stats-muted);
    font-weight: 600;
}

.stats-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.stats-snapshot,
.stats-freshness {
    color: #4b5563;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.stats-freshness {
    color: var(--stats-green);
}

.stats-freshness span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
}

.stats-freshness.is-warning {
    color: var(--stats-orange);
}

.stats-button {
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    color: #4b5563;
    font-weight: 800;
}

.stats-button--primary {
    border-color: transparent;
    background: var(--stats-red);
    color: #fff;
}

.stats-button--ai {
    border-color: #ead8ff;
    background: #f7edff;
    color: #7c35d8;
}

.stats-login {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(223, 23, 23, 0.08), rgba(39, 110, 234, 0.08)),
        var(--stats-soft);
    padding: 28px;
}

.stats-login__panel {
    width: min(440px, 100%);
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: var(--stats-shadow);
    padding: 30px;
}

.stats-login__brand {
    display: block;
    width: min(250px, 100%);
    margin-bottom: 28px;
    margin-left: auto;
    margin-right: auto;
}

.stats-login__brand img {
    display: block;
    width: 100%;
    height: auto;

}

.stats-login__header {
    margin-bottom: 22px;
}

.stats-login__header h1 {
    margin: 0;
    color: var(--stats-ink);
    font-size: 34px;
    line-height: 1.1;
}

.stats-login__header p {
    margin: 8px 0 0;
    color: var(--stats-muted);
    font-weight: 700;
    line-height: 1.5;
}

.stats-login__error {
    border: 1px solid #ffd6d6;
    border-radius: 6px;
    background: #fff7f7;
    color: var(--stats-red);
    font-weight: 800;
    line-height: 1.45;
    margin: 0 0 18px;
    padding: 11px 12px;
}

.stats-login__form {
    display: grid;
    gap: 16px;
}

.stats-login__field {
    display: grid;
    gap: 8px;
    color: #566176;
    font-size: 12px;
    font-weight: 900;
}

.stats-login__field input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: var(--stats-ink);
    font-weight: 700;
    outline: 0;
    padding: 0 12px;
}

.stats-login__field input:focus {
    border-color: color-mix(in srgb, var(--stats-red) 45%, var(--stats-line));
    box-shadow: 0 0 0 3px rgba(223, 23, 23, 0.08);
}

.stats-login__password {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-login__password input {
    min-width: 0;
    flex: 1;
}

.stats-login__password-toggle {
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: var(--stats-ink);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.stats-login__password-toggle:hover {
    background: #f5f6f8;
}

.stats-login__password-toggle:focus-visible {
    outline: 2px solid var(--stats-red);
    outline-offset: 2px;
}

.stats-login__submit {
    width: 100%;
    margin-top: 4px;
}

.stats-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stats-kpis--overview {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.stats-kpis--geography {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.stats-kpis--overview .stats-kpi {
    grid-template-columns: 48px minmax(90px, 1fr) 82px;
}

.stats-kpi {
    display: grid;
    grid-template-columns: 48px minmax(82px, 1fr) 68px;
    align-items: center;
    gap: 9px;
    min-height: 134px;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: var(--stats-shadow);
    padding: 16px 14px;
}

.stats-kpi__icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tone) 12%, #fff);
}

.stats-kpi__icon::before {
    content: "";
    display: none;
}

.stats-kpi--red {
    --tone: var(--stats-red);
}

.stats-kpi--green {
    --tone: var(--stats-green);
}

.stats-kpi--purple {
    --tone: var(--stats-purple);
}

.stats-kpi--orange {
    --tone: var(--stats-orange);
}

.stats-kpi--blue {
    --tone: var(--stats-blue);
}

.stats-kpi h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    color: #2c3548;
    font-size: 13px;
}

.stats-kpi__info {
    position: relative;
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tone) 12%, #fff);
    padding: 0;
    color: var(--tone);
    cursor: help;
}

.stats-kpi__info:focus-visible {
    outline: 2px solid var(--tone);
    outline-offset: 2px;
}

.stats-kpi__tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    z-index: 20;
    width: min(280px, 70vw);
    padding: 10px 12px;
    border-radius: 8px;
    background: #172033;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translate(-50%, 4px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.stats-kpi__info:hover .stats-kpi__tooltip,
.stats-kpi__info:focus-visible .stats-kpi__tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.stats-kpi strong {
    display: block;
    font-size: 30px;
    line-height: 1;
}

.stats-kpi small {
    display: block;
    margin-top: 8px;
    color: var(--stats-green);
    font-weight: 700;
}

.stats-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: var(--stats-shadow);
    margin-bottom: 18px;
    padding: 16px;
}

.stats-filters > .stats-filter {
    flex: 1 1 108px;
}

.stats-filters > .stats-filter:first-child {
    flex-basis: 280px;
}

.stats-filters > fieldset {
    flex: 0 1 185px;
}

.stats-filters > .stats-button--ai {
    flex: 1 1 220px;
}

.stats-filters > .stats-button--primary {
    flex: 0 1 130px;
}

.stats-filters > .stats-button:not(.stats-button--ai):not(.stats-button--primary) {
    flex: 0 1 86px;
}

.stats-filters--members .stats-search {
    flex: 1 1 100%;
}

.stats-member-controls {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.stats-member-controls > .stats-filters {
    margin-bottom: 0;
}

.stats-filters--members > .stats-button--ai {
    flex: 0 1 240px;
    margin-left: auto;
}

.stats-filters--members > .stats-filter {
    flex: 1 1 185px;
}

.stats-filters--members > .stats-button--primary {
    margin-left: auto;
}

.stats-filters > .stats-filter--hospital {
    flex: 1 1 100%;
}

.stats-search {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: #667085;
    padding: 0 12px;
}

.stats-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--stats-ink);
    font-weight: 700;
}

.stats-search input::placeholder {
    color: #7b8496;
}

.stats-filter,
.stats-filters fieldset {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
    color: #566176;
    font-size: 12px;
    font-weight: 800;
}

.stats-filters button,
.stats-filters select,
.stats-filters .stats-button {
    width: 100%;
    min-height: 38px;
    margin-top: 8px;
    padding: 0 10px;
}

.stats-filter__label {
    display: block;
}

.stats-filter__text {
    width: 100%;
    min-height: 38px;
    margin-top: 8px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: var(--stats-ink);
    font-size: 13px;
    font-weight: 700;
    padding: 0 10px;
}

.stats-filter__text:focus {
    border-color: color-mix(in srgb, var(--stats-red) 45%, var(--stats-line));
    box-shadow: 0 0 0 3px rgba(223, 23, 23, 0.08);
    outline: 0;
}

.stats-multi-select {
    position: relative;
    margin-top: 8px;
}

.stats-multi-select summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    overflow: hidden;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: var(--stats-ink);
    cursor: pointer;
    list-style: none;
    padding: 0 10px;
}

.stats-multi-select summary::-webkit-details-marker {
    display: none;
}

.stats-multi-select summary span {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-multi-select[open] summary {
    border-color: color-mix(in srgb, var(--stats-red) 45%, var(--stats-line));
    box-shadow: 0 0 0 3px rgba(223, 23, 23, 0.08);
}

.stats-multi-select__menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    width: min(340px, 92vw);
    max-height: 270px;
    overflow: auto;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: 0 18px 38px rgba(23, 32, 51, 0.16);
    padding: 7px;
}

.stats-multi-select__menu label {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    color: #344055;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    padding: 8px;
}

.stats-multi-select__menu label:hover {
    background: #f8fafc;
}

.stats-multi-select__menu label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-multi-select__menu small,
.stats-multi-select__empty {
    color: var(--stats-muted);
    font-size: 12px;
    font-weight: 800;
}

.stats-multi-select__empty {
    padding: 8px;
}

.stats-multi-select__search {
    position: sticky;
    top: 0;
    width: 100%;
    min-height: 38px;
    margin-bottom: 6px;
    padding: 8px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    font: inherit;
}

.stats-multi-select__menu [hidden] {
    display: none;
}

.stats-multi-select summary:has([data-selected-tags]) {
    padding: 5px 10px;
}

.stats-multi-select summary .stats-multi-select__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    white-space: normal;
}

.stats-multi-select summary .stats-multi-select__tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 5px 3px 8px;
    border: 1px solid var(--stats-line);
    border-radius: 4px;
    background: #f1f5f9;
    white-space: normal;
}

.stats-multi-select summary .stats-multi-select__tag-label {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.stats-multi-select .stats-multi-select__remove {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--stats-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.stats-multi-select__remove:hover,
.stats-multi-select__remove:focus-visible {
    background: #e2e8f0;
    color: var(--stats-ink);
}

.stats-role-tree__menu {
    right: 0;
    left: auto;
    width: min(430px, 92vw);
    max-height: 360px;
}

.stats-role-tree__list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stats-role-tree__children {
    margin-left: 24px;
}

.stats-role-tree__row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
}

.stats-role-tree__toggle,
.stats-role-tree__spacer {
    display: grid;
    width: 24px;
    height: 34px;
    place-items: center;
}

.stats-role-tree .stats-role-tree__toggle {
    width: 24px;
    min-height: 34px;
    margin: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    padding: 0;
}

.stats-role-tree__toggle .lucide {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.stats-role-tree__toggle[aria-expanded="false"] .lucide {
    transform: rotate(-90deg);
}

.stats-role-tree__row label {
    grid-template-columns: 18px minmax(0, 1fr) auto;
    margin: 0;
}

.stats-role-tree__row input:indeterminate {
    accent-color: var(--stats-red);
}

.stats-filters fieldset label {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
}

.stats-filters input {
    accent-color: var(--stats-red);
}

.stats-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.stats-grid--top {
    grid-template-columns: minmax(0, 1fr) 380px;
}

.stats-grid--middle {
    grid-template-columns: 1fr 1fr 1.15fr;
}

.stats-grid--bottom {
    grid-template-columns: 1.15fr 0.9fr 1.25fr;
}

.stats-panel {
    min-width: 0;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: var(--stats-shadow);
    padding: 16px;
}

.stats-empty-state {
    margin: 0;
    color: var(--stats-muted);
    font-weight: 700;
}

.stats-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.stats-panel__header h2 {
    margin: 0;
    font-size: 18px;
}

.stats-panel__header button,
.stats-panel__header select,
.stats-panel__header a,
.stats-panel__header span {
    min-height: 32px;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--stats-red);
    font-size: 12px;
    font-weight: 800;
}

.stats-panel__header button,
.stats-panel__header span {
    border: 0;
    background: #fff0f0;
}

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

.stats-panel__actions > a,
.stats-columns-menu > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    border: 0;
    border-radius: 6px;
    background: #fff0f0;
    color: var(--stats-red);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    list-style: none;
    padding: 6px 10px;
}

.stats-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.stats-chart-controls label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    color: var(--stats-muted);
    font-size: 12px;
    font-weight: 800;
}

.stats-chart-controls select {
    min-height: 32px;
    padding: 5px 28px 5px 10px;
}

.stats-chart-toggle {
    border-radius: 6px;
    background: #fff0f0;
    padding: 5px 10px;
}

.stats-chart-toggle input[type="checkbox"] {
    accent-color: var(--stats-red);
}

.stats-columns-menu {
    position: relative;
}

.stats-columns-menu > summary::-webkit-details-marker {
    display: none;
}

.stats-columns-menu form {
    position: absolute;
    z-index: 25;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    width: 230px;
    gap: 4px;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    background: #fff;
    box-shadow: 0 18px 38px rgba(23, 32, 51, 0.16);
    padding: 8px;
    overflow: hidden;
    height: 500px;
    max-height: 70vh;
}

.stats-columns-menu__options {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.stats-columns-menu__footer {
    flex-shrink: 0;
    border-top: 1px solid var(--stats-line);
    padding-top: 8px;
}

.stats-columns-menu label {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    color: #344055;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    padding: 8px;
}

.stats-columns-menu label:hover {
    background: #f8fafc;
}

.stats-columns-menu .stats-button {
    width: 100%;
    min-height: 36px;
    margin-top: 4px;
}

.stats-linechart svg,
.stats-forecast svg {
    display: block;
    width: 100%;
    height: 270px;
}

.stats-linechart line,
.stats-forecast line {
    stroke: var(--stats-line);
}

.stats-linechart text,
.stats-forecast text {
    fill: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.stats-linechart .axis-label {
    text-anchor: middle;
}

.stats-linechart circle {
    fill: var(--series);
    stroke: #fff;
    stroke-width: 3;
}

.series-line {
    fill: none;
    stroke: var(--series);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.stats-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    padding: 4px 6px 0;
}

.stats-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #485367;
    font-size: 12px;
    font-weight: 800;
}

.stats-legend i {
    width: 23px;
    height: 4px;
    border-radius: 999px;
    background: var(--series);
}

.stats-side {
    display: grid;
    gap: 16px;
}

.stats-insights,
.stats-map ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.stats-insights {
    display: grid;
    gap: 13px;
}

.stats-insights li {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    color: #536075;
    font-weight: 700;
}

.stats-insights li span {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e8f8ef;
}

.stats-insights li:nth-child(2) span {
    background: #eaf2ff;
}

.stats-insights li:nth-child(3) span {
    background: #fff0e8;
}

.stats-bars {
    display: grid;
    grid-template-columns: repeat(12, minmax(22px, 1fr));
    align-items: end;
    min-height: 190px;
    gap: 10px;
    padding-top: 26px;
}

.stats-bars__group {
    display: grid;
    grid-template-columns: repeat(3, 7px);
    justify-content: center;
    align-items: end;
    gap: 3px;
}

.stats-bars__group span {
    width: 7px;
    border-radius: 2px 2px 0 0;
    background: var(--series);
}

.stats-bars__group small,
.stats-stacked small {
    grid-column: 1 / -1;
    margin-top: 9px;
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.stats-stacked {
    display: grid;
    grid-template-columns: repeat(6, minmax(34px, 1fr));
    align-items: end;
    min-height: 190px;
    gap: 18px;
    padding: 12px 12px 0;
}

.stats-stacked div {
    display: grid;
    align-items: end;
    justify-items: center;
}

.stats-stacked span {
    width: 42px;
}

.stats-stacked .main {
    border-radius: 3px 3px 0 0;
    background: var(--stats-red);
}

.stats-stacked .legacy {
    border-radius: 0 0 3px 3px;
    background: #9ca3af;
}

.stats-map {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) 1fr;
    gap: 20px;
    align-items: center;
}

.stats-map svg {
    width: 100%;
    max-height: 205px;
}

.stats-map .map {
    stroke: #fff;
    stroke-width: 5;
}

.stats-map .map--scotland {
    fill: #ff8a8a;
}

.stats-map .map--england {
    fill: #df1717;
}

.stats-map .map--wales {
    fill: #ff5959;
}

.stats-map .map--ni {
    fill: #ffb1b1;
}

.stats-map li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #eef1f5;
    padding: 7px 0;
    color: #4b5563;
    font-weight: 800;
}

.stats-map strong {
    color: #253049;
}

.stats-forecast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 16px;
    align-items: center;
}

.stats-forecast .actual,
.stats-forecast .forecast {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.stats-forecast .actual {
    stroke: var(--stats-red);
}

.stats-forecast .forecast {
    stroke: #ff7777;
    stroke-dasharray: 8 9;
}

.stats-forecast circle {
    fill: #fff;
    stroke-width: 4;
}

.stats-forecast .actual-point {
    stroke: var(--stats-red);
}

.stats-forecast .forecast-point {
    stroke: #ff7777;
}

.stats-forecast aside {
    border: 1px solid #ffd6d6;
    border-radius: var(--stats-radius);
    background: #fff7f7;
    padding: 18px;
}

.stats-forecast aside small,
.stats-forecast aside span {
    display: block;
    color: #6b7280;
    font-weight: 800;
}

.stats-forecast aside strong {
    display: block;
    margin: 12px 0;
    color: var(--stats-red);
    font-size: 38px;
}

.stats-forecast aside span {
    color: var(--stats-green);
}

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

    .stats-kpis,
    .stats-kpis--overview,
    .stats-kpis--geography,
    .stats-grid--middle,
    .stats-grid--bottom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-kpi {
        grid-template-columns: 58px minmax(0, 1fr) 96px;
    }

    .stats-doughnut-panel {
        grid-template-columns: 150px minmax(0, 1fr);
    }

    .stats-chart--member-doughnut {
        width: 150px;
        height: 150px;
    }

    .stats-filters {
        grid-template-columns: repeat(4, minmax(130px, 1fr));
    }
}

@media (max-width: 1050px) {
    .stats-shell {
        display: block;
    }

    .stats-sidebar {
        position: relative;
        height: auto;
    }

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

    .stats-grid--top,
    .stats-kpis,
    .stats-kpis--overview,
    .stats-kpis--geography,
    .stats-grid--middle,
    .stats-grid--bottom,
    .stats-dashboard-grid,
    .stats-members-grid {
        grid-template-columns: 1fr;
    }

    .stats-dashboard-grid .stats-panel--wide {
        grid-row: auto;
    }

    .stats-header,
    .stats-header__meta {
        justify-content: flex-start;
    }

    .stats-header {
        display: grid;
    }
}

@media (max-width: 680px) {
    .stats-login {
        align-items: start;
        padding: 18px 14px;
    }

    .stats-login__panel {
        padding: 22px;
    }

    .stats-login__header h1 {
        font-size: 30px;
    }

    .stats-main,
    .stats-sidebar {
        padding: 18px 14px;
    }

    .stats-nav,
    .stats-filters {
        grid-template-columns: 1fr;
    }

    .stats-filters > * {
        flex-basis: 100%;
    }

    .stats-kpi,
    .stats-forecast,
    .stats-map,
    .stats-doughnut-panel {
        grid-template-columns: 1fr;
    }

    .stats-chart--sparkline {
        height: 42px;
    }

    .stats-bars {
        overflow-x: auto;
        grid-template-columns: repeat(12, 36px);
        justify-content: flex-start;
    }

    .stats-chart--member-doughnut {
        width: min(220px, 100%);
        height: 190px;
        margin: 0 auto;
    }

    .stats-geography-map {
        min-height: 420px;
    }

    .stats-chart--location-heatmap {
        height: 420px;
    }

    .stats-heatmap-legend {
        right: 10px;
        bottom: 10px;
        grid-template-columns: auto 82px auto;
    }

    .stats-pagination {
        justify-content: center;
    }
}

.lucide {
    display: block;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
}

.stats-button .lucide,
.stats-actions .lucide,
.stats-nav .lucide {
    width: 18px;
    height: 18px;
}

.stats-nav__item.is-active .lucide {
    color: #fff;
}

.stats-snapshot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.stats-snapshot .lucide {
    width: 17px;
    height: 17px;
    color: #566176;
}

.stats-button .lucide:last-child,
.stats-filters label > button .lucide,
.stats-panel__header button .lucide {
    margin-left: 4px;
}

.stats-user__summary > .lucide {
    margin-left: auto;
    color: #64748b;
}

.stats-user[open] .stats-user__summary > .lucide {
    transform: rotate(180deg);
}

.stats-user__menu .lucide {
    width: 17px;
    height: 17px;
}

.stats-kpi__icon .lucide {
    width: 30px;
    height: 30px;
    color: var(--tone);
}

.stats-chart {
    min-width: 0;
}

.stats-chart--sparkline {
    width: 68px;
    height: 50px;
}

.stats-chart--doughnut {
    width: 76px;
    height: 76px;
}

.stats-chart--line {
    width: 100%;
    height: 500px;
}

.stats-chart--bars,
.stats-chart--scheme,
.stats-chart--map {
    width: 100%;
    height: 210px;
}

.stats-chart--forecast {
    width: 100%;
    height: 250px;
}

.stats-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.stats-dashboard-grid .stats-panel--wide {
    grid-row: auto;
}

.stats-members-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.stats-members-directory {
    overflow: hidden;
}

.stats-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #edf0f5;
    border-radius: 6px;
}

.stats-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    color: #344055;
    font-size: 12px;
}

.stats-table th,
.stats-table td {
    border-bottom: 1px solid #edf0f5;
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.stats-table th {
    background: #fbfcfe;
    color: #293349;
    font-size: 11px;
    font-weight: 900;
}

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

.stats-table td {
    font-weight: 700;
}

.stats-table td strong {
    color: #202a40;
}

.stats-table--system-report {
    min-width: 1120px;
}

.stats-table--system-report th:last-child,
.stats-table--system-report td:last-child {
    min-width: 280px;
    white-space: normal;
}

.stats-table--unpaginated {
    min-width: 0;
}

.stats-table--unpaginated th,
.stats-table--unpaginated td {
    white-space: normal;
    overflow-wrap: anywhere;
}

.stats-table--unpaginated th:last-child,
.stats-table--unpaginated td:last-child {
    min-width: 0;
}

.stats-table__empty {
    height: 160px;
    color: var(--stats-muted);
    text-align: center;
}

.stats-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 5px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 900;
}

.stats-status--active {
    background: #def8eb;
    color: #087545;
}

.stats-status--expiring {
    background: #fff0d9;
    color: #a65300;
}

.stats-status--cancelled,
.stats-status--lapsed {
    background: #ffe3e3;
    color: var(--stats-red);
}

.stats-status--unknown {
    background: #eef1f5;
    color: #566176;
}

.stats-icon-button {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 0;
    background: transparent;
    color: #475569;
    padding: 0;
}

.stats-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 16px;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.stats-pagination nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.stats-pagination a,
.stats-pagination button,
.stats-pagination nav span {
    display: inline-grid;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.stats-pagination a.is-active,
.stats-pagination button.is-active {
    border-color: transparent;
    background: var(--stats-red);
    color: #fff;
}

.stats-pagination a.is-disabled,
.stats-pagination button.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.stats-pagination label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.stats-pagination select {
    min-height: 34px;
    padding: 0 28px 0 10px;
    font-weight: 800;
}

.stats-pagination form {
    display: contents;
}

.stats-ai-query {
    display: grid;
    gap: 18px;
}

.stats-ai-query__prompt {
    display: grid;
    gap: 8px;
}

.stats-ai-query__prompt span,
.stats-ai-query__columns > span,
.stats-member-columns > span {
    color: #293349;
    font-size: 12px;
    font-weight: 900;
}

.stats-ai-query textarea {
    width: 100%;
    min-height: 118px;
    resize: vertical;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    padding: 12px 14px;
    color: var(--stats-ink);
}

.stats-ai-query__columns,
.stats-member-columns {
    display: grid;
    gap: 10px;
}

.stats-ai-query__columns > div,
.stats-member-columns > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stats-ai-query__columns label,
.stats-member-columns label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    padding: 0 10px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.stats-ai-query__actions,
.stats-member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-ai-query__saved {
    display: grid;
    grid-template-columns: minmax(240px, 420px) auto;
    gap: 10px;
    align-items: end;
}

.stats-ai-query__saved label,
.stats-ai-query__name {
    display: grid;
    gap: 8px;
}

.stats-ai-query__saved span,
.stats-ai-query__name span {
    color: #293349;
    font-size: 12px;
    font-weight: 900;
}

.stats-ai-query__saved select,
.stats-ai-query__name input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--stats-line);
    border-radius: 6px;
    background: #fff;
    padding: 0 12px;
    color: var(--stats-ink);
    font-weight: 700;
}

.stats-ai-query .stats-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.stats-ai-cache {
    padding: 12px 16px;
}

.stats-ai-cache p {
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.stats-ai-alert {
    border-color: #ffd0d0;
    background: #fff7f7;
}

.stats-ai-alert p {
    margin: 0;
    color: var(--stats-red-dark);
    font-weight: 800;
}

.stats-ai-sql summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    color: #293349;
    font-size: 13px;
    font-weight: 900;
}

.stats-ai-sql summary::-webkit-details-marker {
    display: none;
}

.stats-ai-sql summary .lucide {
    transition: transform 0.16s ease;
}

.stats-ai-sql[open] summary .lucide {
    transform: rotate(180deg);
}

.stats-ai-sql pre {
    max-height: 260px;
    overflow: auto;
    margin: 14px 0 0;
    border: 1px solid #edf0f5;
    border-radius: 6px;
    background: #111827;
    color: #e5e7eb;
    padding: 14px;
    font-size: 12px;
    line-height: 1.55;
}

.stats-table--ai {
    min-width: 760px;
}

.stats-members-charts {
    display: grid;
    margin-top: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.stats-doughnut-panel {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.stats-chart--member-doughnut {
    width: 180px;
    height: 180px;
}

@media (max-width: 1050px) {
    .stats-members-charts {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 680px) {
    .stats-doughnut-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .stats-chart--member-doughnut {
        width: min(220px, 100%);
        height: 190px;
        margin: 0 auto;
    }
}

.stats-doughnut-legend {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stats-doughnut-legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: #344055;
    font-size: 12px;
    font-weight: 800;
}

.stats-doughnut-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--series);
}

.stats-doughnut-legend span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-doughnut-legend strong {
    color: #253049;
    font-weight: 900;
    text-align: right;
}

.stats-doughnut-legend small {
    margin-left: 6px;
    color: #667085;
    font-weight: 800;
}

.stats-hidden-form {
    display: none;
}

.stats-import-status {
    display: grid;
    margin: 0;
}

.stats-import-status div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eef1f5;
    padding: 9px 0;
}

.stats-import-status div:first-child {
    padding-top: 0;
}

.stats-import-status div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.stats-import-status dt {
    color: #4b5563;
    font-weight: 800;
}

.stats-import-status dd {
    margin: 0;
    color: #253049;
    font-weight: 800;
    text-align: right;
}

.stats-import-status .is-warning dd {
    color: var(--stats-orange);
}

.stats-import-status .is-danger dd {
    color: var(--stats-red);
}

.stats-import-status .is-success dd {
    color: var(--stats-green);
}

.stats-geography-map-section {
    margin-bottom: 16px;
}

.stats-geography-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.stats-geography-side {
    display: grid;
    gap: 16px;
}

.stats-geography-map-panel {
    overflow: hidden;
}

.stats-geography-map {
    position: relative;
    min-height: 560px;
    border: 1px solid #edf0f5;
    border-radius: 6px;
    background: #fbfcfe;
}

.stats-chart--location-heatmap {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 560px;
}

.stats-heatmap-legend {
    position: absolute;
    right: 16px;
    bottom: 14px;
    display: grid;
    grid-template-columns: auto 120px auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #ffd6d6;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(23, 32, 51, 0.08);
    color: #566176;
    font-size: 11px;
    font-weight: 900;
    padding: 8px 10px;
}

.stats-heatmap-legend i {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 210, 210, 0.55), rgba(255, 103, 103, 0.82), var(--stats-red));
}

.stats-heatmap-legend strong {
    color: var(--stats-red);
}

.stats-compact-table {
    width: 100%;
    border-collapse: collapse;
    color: #344055;
    font-size: 12px;
}

.stats-compact-table th,
.stats-compact-table td {
    border-bottom: 1px solid #edf0f5;
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
}

.stats-compact-table th {
    color: #293349;
    font-size: 11px;
    font-weight: 900;
}

.stats-compact-table td {
    font-weight: 800;
}

.stats-compact-table th:not(:first-child),
.stats-compact-table td:not(:first-child) {
    text-align: right;
}

.stats-compact-table tbody tr:last-child td {
    border-bottom: 0;
}

.stats-compact-table--regions td:first-child {
    width: 42%;
}

.stats-region-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.stats-region-toggle[hidden] {
    display: none;
}

.stats-region-toggle__chevron {
    font-size: 20px;
    line-height: 1;
}

.stats-region-toggle[aria-expanded="true"] .stats-region-toggle__chevron {
    transform: rotate(90deg);
}

.stats-authority-row {
    background: #f8fafc;
}

.stats-authority-row td:first-child {
    padding-left: 32px;
}

.stats-meter {
    display: inline-block;
    width: min(170px, 42vw);
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf0f5;
    margin-right: 10px;
    vertical-align: middle;
}

.stats-meter i {
    display: block;
    width: var(--meter);
    height: 100%;
    border-radius: inherit;
    background: var(--stats-red);
}

.stats-trend {
    font-weight: 900;
}

.stats-trend--positive {
    color: var(--stats-green);
}

.stats-trend--negative {
    color: var(--stats-red);
}

.stats-trend--neutral {
    color: #667085;
}

@media (max-width: 1050px) {
    .stats-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-dashboard-grid .stats-panel--wide {
        grid-row: auto;
    }

    .stats-geography-grid {
        grid-template-columns: 1fr;
    }
}

.stats-map .stats-chart--map svg,
.stats-forecast .stats-chart--forecast svg {
    max-height: none;
}

.stats-insights li span {
    display: grid;
    place-items: center;
}

.stats-insights .lucide {
    width: 19px;
    height: 19px;
}

.stats-insights li:first-child .lucide {
    color: var(--stats-green);
}

.stats-insights li:nth-child(2) .lucide {
    color: var(--stats-blue);
}

.stats-insights li:nth-child(3) .lucide {
    color: var(--stats-orange);
}

.stats-chart-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--stats-border, #e5e7eb);
    padding-bottom: 10px;
}

.stats-chart-tabs button {
    border: 0;
    border-radius: 6px;
    padding: 9px 12px;
    background: transparent;
    color: var(--stats-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.stats-chart-tabs button:hover,
.stats-chart-tabs button[aria-selected="true"] {
    background: #fff0f0;
    color: var(--stats-red);
}

.stats-chart-tabs button:focus-visible {
    outline: 2px solid var(--stats-red);
    outline-offset: 2px;
}

.stats-chart-range {
    color: var(--stats-muted);
    font-size: 12px;
    margin: 12px 0;
}
/* Saved reports */
.stats-report-dialog {
    width: min(480px, calc(100vw - 32px));
    box-sizing: border-box;
    max-height: calc(100vh - 40px);
    padding: 24px;
    border: 1px solid var(--stats-line);
    border-radius: var(--stats-radius);
    color: var(--stats-ink);
    background: #fff;
    box-shadow: var(--stats-shadow);
}

.stats-report-dialog::backdrop {
    background: rgb(15 23 42 / 45%);
}

.stats-report-dialog h2 { margin: 0 0 12px; }
.stats-report-hint { color: #6b7280; font-size: 13px; line-height: 1.5; }
.stats-report-form__field { display: grid; gap: 8px; margin: 20px 0; }
.stats-report-form__field label { font-weight: 600; }
.stats-report-form__field input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}
.stats-report-form__checkbox { display: flex; align-items: center; gap: 8px; }
.stats-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stats-report-actions form { margin: 0; }
.stats-report-actions .stats-button--danger { color: #b91c1c; }
.stats-report-toolbar { margin-bottom: 18px; }
.stats-reports-section { margin-bottom: 24px; }
.stats-report-editor { max-width: 560px; padding: 24px; }
.stats-report-form ul { color: #b91c1c; padding-left: 20px; }
.stats-notice { padding: 12px 16px; border: 1px solid #bbf7d0; border-radius: 8px; background: #f0fdf4; color: #166534; }
.stats-chart--system {
    width: 100%;
    height: 500px;
}

.stats-system-report-description {
    padding: 0 20px;
    color: var(--stats-muted);
    line-height: 1.6;
}

.stats-system-report-data { padding: 16px 20px; }
.stats-system-report-data summary { margin-bottom: 12px; cursor: pointer; font-weight: 600; }
.stats-system-report-data .stats-table {
    min-width: 0;
    table-layout: fixed;
}
.stats-system-report-data .stats-table th,
.stats-system-report-data .stats-table td {
    white-space: normal;
    overflow-wrap: anywhere;
}
.stats-report-form__field select { width: 100%; padding: 10px 12px; margin-top: 8px; }

.stats-dashboard-reports {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
}

.stats-dashboard-reports > .stats-panel {
    flex: 1 1 460px;
    min-width: 0;
    max-width: 100%;
}

.stats-dashboard-reports .stats-panel__header {
    flex-wrap: wrap;
    gap: 12px;
}

.stats-dashboard-reports .stats-chart--system {
    height: 420px;
}

.stats-panel.stats-system-report-card {
    max-width: min(100%, var(--report-card-width, 850px));
}


.stats-system-report-layout { margin-bottom: 32px; }
.stats-report-layout-title { margin-top: 32px; }
.stats-system-report-layout .stats-dashboard-reports > .stats-panel {
    flex-basis: var(--report-card-width, 850px);
    max-width: min(100%, var(--report-card-width, 850px));
}

.stats-dashboard-reports > .stats-report-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 var(--report-card-width, 550px);
    max-width: min(100%, var(--report-card-width, 550px));
    min-width: 0;
}
.stats-report-column > .stats-panel { width: 100%; box-sizing: border-box; }
.stats-system-doughnut {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.stats-system-doughnut__plot {
    position: relative;
    flex: 0 1 180px;
    width: 180px;
    max-width: 100%;
    height: 180px;
    margin: auto;
}
.stats-chart--system-doughnut { width: 100%; height: 100%; }
.stats-system-doughnut__total {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}
.stats-system-doughnut__total strong { color: #253049; font-size: 26px; font-weight: 900; }
.stats-system-doughnut__total span { max-width: 105px; color: #667085; font-size: 12px; }
.stats-system-doughnut__legend {
    flex: 1 1 200px;
    min-width: 0;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}
.stats-system-doughnut__legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}
.stats-system-doughnut__legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--series); }
.stats-system-doughnut__legend span { overflow-wrap: anywhere; }
.stats-system-doughnut__legend strong { color: #253049; text-align: right; }
.stats-system-doughnut__legend small { color: #667085; text-align: right; }

.stats-dashboard-reports--columns { flex-wrap: nowrap; align-items: stretch; }
.stats-dashboard-reports .stats-system-report-card {
    display: flex;
    flex-direction: column;
}
.stats-dashboard-reports .stats-system-report-card > .stats-panel__header,
.stats-dashboard-reports .stats-system-report-card > .stats-system-report-description,
.stats-dashboard-reports .stats-system-report-card > .stats-system-report-data { flex-shrink: 0; }
.stats-dashboard-reports .stats-system-report-card > .stats-chart--system {
    flex: 1 0 420px;
    min-height: 420px;
}
.stats-report-column > .stats-panel { flex: 1 0 auto; }
.stats-dashboard-reports .stats-system-doughnut { flex: 1 0 auto; }
@media (max-width: 900px) {
    .stats-dashboard-reports--columns { flex-wrap: wrap; }
    .stats-dashboard-reports--columns > .stats-panel,
    .stats-dashboard-reports--columns > .stats-report-column { flex-basis: 100%; }
}

.stats-report-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stats-panel__header .stats-report-info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 4px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #667085;
    cursor: pointer;
}
.stats-panel__header .stats-report-info-trigger:hover { color: #df1717; background: #fff0f0; }
.stats-report-info-trigger:focus-visible, .stats-report-info-close:focus-visible { outline: 2px solid #276eea; outline-offset: 3px; }
.stats-report-info {
    position: fixed;
    inset: auto;
    margin: 0;
    width: max-content;
    max-width: min(620px, calc(100vw - 16px));
    max-height: min(560px, calc(100dvh - 16px));
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--stats-line);
    border-radius: 10px;
    background: #fff;
    color: #172033;
    box-shadow: 0 12px 40px rgb(23 32 51 / 20%);
    font-size: 14px;
    line-height: 1.5;
}
.stats-report-info__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.stats-report-info__header h3 { margin: 0; font-size: 16px; }
.stats-panel__header .stats-report-info-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #667085;
    cursor: pointer;
}
.stats-report-info__description { margin: 0; white-space: pre-line; }
.stats-report-info__description + .stats-report-info__table-wrap { margin-top: 12px; }
.stats-report-info__table-wrap { overflow-x: auto; }
.stats-report-info__table { width: 100%; border-collapse: collapse; text-align: left; }
.stats-report-info__table th, .stats-report-info__table td { padding: 8px 10px; border: 1px solid var(--stats-line); vertical-align: top; }
.stats-report-info__table thead th { background: #f6f7f9; }
.stats-report-info__table tbody th { font-weight: 600; white-space: nowrap; }
.stats-report-info__table ul { margin: 0; padding: 0; list-style: none; }

.stats-panel__header .stats-report-info-trigger .lucide,
.stats-panel__header .stats-report-info-close .lucide { margin-left: 0; }

.stats-system-heatmap { position: relative; display: flex; flex-direction: column; min-height: 420px; }
.stats-system-heatmap > .stats-chart--system-heatmap { position: relative; z-index: 2; flex: 1 0 420px; min-height: 420px; }
.stats-dashboard-reports .stats-system-report-card > .stats-system-heatmap { flex: 1 0 420px; }
