* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg: #eef3fa;
    --surface: #ffffff;
    --surface-alt: #f5f8fd;
    --border: #dbe4f1;
    --border-soft: #e8eef7;
    --text: #18253a;
    --muted: #69768b;
    --heading: #101a2d;
    --nav-bg: #162947;
    --primary: #2b63d9;
    --primary-dark: #214eb0;
    --teal: #21b6c5;
    --cyan: #3ea7ff;
    --green: #3dbb69;
    --amber: #f0a631;
    --red: #ec5b55;
    --violet: #8a62d5;
    --blue: #2b63d9;
    --sky: #28a3c7;
    --shadow: 0 8px 24px rgba(12, 30, 66, 0.06);
    --radius: 10px;
}

body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.auth-shell-bar {
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
}

.auth-shell-bar-inner {
    width: min(1680px, calc(100% - 24px));
    margin: 0 auto;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.auth-shell-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-shell-brand strong {
    color: var(--heading);
    font-size: 14px;
}

.auth-shell-brand span {
    color: var(--muted);
    font-size: 12px;
}

.auth-shell-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-shell-inline-form {
    margin: 0;
}

.auth-shell-inline-form label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.auth-shell-inline-form select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
}

.auth-shell-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f9fc;
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.auth-shell-link--button {
    cursor: pointer;
}

.auth-shell-user {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.global-flash {
    width: min(1680px, calc(100% - 24px));
    margin: 12px auto 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}

.global-flash--error {
    background: #fff0ef;
    color: #a33a36;
    border: 1px solid #ffd4d1;
}

.global-flash--success {
    background: #edf9f1;
    color: #21784a;
    border: 1px solid #cfe9d8;
}

body.modal-open {
    overflow: hidden;
}

.app-shell {
    min-height: 100vh;
}

.dashboard {
    width: 100%;
    padding-bottom: 40px;
}

.app-topbar,
.main-nav,
.sub-nav,
.filters-panel,
.metrics-section,
.matrix-panel,
.panel,
.kpi-card {
    width: calc(100% - 48px);
    margin-left: auto;
    margin-right: auto;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 4px 10px;
    background: #fff;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(180deg, #5f6bf2 0%, #443bb8 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.brand-lockup strong,
.brand-lockup span {
    display: block;
}

.brand-lockup strong {
    color: var(--heading);
    font-size: 16px;
    line-height: 1.1;
}

.brand-lockup span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eafbf3;
    color: #139266;
    font-weight: 700;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 16px;
    background: linear-gradient(180deg, var(--nav-bg) 0%, #13233d 100%);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.sub-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
}

.main-nav a,
.sub-nav a {
    text-decoration: none;
    white-space: nowrap;
}

.main-nav a {
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.main-nav a.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sub-nav a {
    position: relative;
    padding: 4px 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sub-nav a.is-active {
    color: var(--heading);
}

.sub-nav a.is-active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -11px;
    left: 0;
    height: 2px;
    background: var(--blue);
}

.filters-panel {
    margin-top: 14px;
    margin-bottom: 12px;
    padding: 12px 16px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.filters-header,
.panel-header,
.section-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filters-header h2,
.panel-header h2,
.section-headline h2 {
    margin: 0;
    color: var(--heading);
    font-size: 15px;
    font-weight: 700;
}

.panel-header p,
.filters-meta {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.section-kicker {
    margin: 0 0 2px;
    color: #7a869a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.filters-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button {
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

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

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

.button-secondary:hover {
    background: #dbe6f6;
}

.button-excel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.button-excel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #1f7a43;
    color: #fff;
    flex: 0 0 18px;
}

.button-excel-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.button-icon span[aria-hidden="true"] {
    font-size: 14px;
    line-height: 1;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0 8px;
}

.field-group {
    margin-top: 10px;
}

.field-group-label {
    display: block;
    margin-bottom: 6px;
    color: #707b8e;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field span {
    font-size: 10px;
    font-weight: 700;
    color: #707b8e;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field input,
.field select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 0 10px;
    font-size: 12px;
}

.field input:focus,
.field select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.5);
}

.date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.multi-select-wrapper {
    position: relative;
}

.multi-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 10px;
    background: #f8fbff;
    cursor: pointer;
}

.multi-select-wrapper.open .multi-tags {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 4px 10px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 999px;
    background: #eef5ff;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
}

.tag .remove {
    font-size: 13px;
    line-height: 1;
    opacity: 0.8;
}

.multi-placeholder {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    color: var(--muted);
    font-size: 11px;
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(15, 31, 56, 0.14);
    z-index: 20;
}

.multi-select-wrapper.open .dropdown-panel {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    font-size: 13px;
    font-weight: 600;
    color: #244ccf;
    background: #f4f8ff;
    cursor: pointer;
}

.dropdown-item:last-child {
    border-bottom: 0;
}

.dropdown-item.selected {
    background: #edf4ff;
}

.dropdown-item input {
    width: 16px;
    height: 16px;
    accent-color: #2f5bd3;
    cursor: pointer;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.center-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.center-chip,
.filter-chip,
.inline-action {
    display: inline-flex;
    position: relative;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 4px 10px;
    border: 1px solid #d9e4f3;
    border-radius: 999px;
    background: #f7fafe;
    color: #46607f;
    font-size: 11px;
    font-weight: 700;
}

.center-chip {
    cursor: pointer;
    min-height: 22px;
    padding: 3px 8px;
    font-size: 10px;
    line-height: 1.1;
}

.center-chip.is-selected {
    border-color: #8eb2ff;
    background: #2b63d9;
    color: #fff;
}

.metrics-section {
    margin-top: 14px;
    margin-bottom: 10px;
}

.kpi-grid {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]:not(.kpi-card)::before,
[data-tooltip]::after {
    position: absolute;
    left: 50%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 500;
}

[data-tooltip]:not(.kpi-card)::before {
    content: "";
    bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(4px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.96) transparent transparent transparent;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: min(280px, calc(100vw - 32px));
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
}

[data-tooltip]:not(.kpi-card):hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:not(.kpi-card):focus-visible::before,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.data-table [data-tooltip]:not(.kpi-card)::before,
.data-table [data-tooltip]::before {
    top: calc(100% + 4px);
    bottom: auto;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent rgba(15, 23, 42, 0.96) transparent;
}

.data-table [data-tooltip]::after {
    top: calc(100% + 10px);
    bottom: auto;
}

.kpi-card,
.panel {
    position: relative;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--blue);
}

.kpi-card {
    padding: 14px 16px 12px;
}

.accent-blue::before {
    background: var(--blue);
}

.accent-violet::before {
    background: var(--violet);
}

.accent-teal::before {
    background: var(--teal);
}

.accent-green::before {
    background: var(--green);
}

.accent-cyan::before {
    background: var(--cyan);
}

.accent-sky::before {
    background: var(--sky);
}

.accent-amber::before {
    background: var(--amber);
}

.accent-red::before {
    background: var(--red);
}

.kpi-label {
    display: block;
    margin-bottom: 8px;
    color: #6f7b8f;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.kpi-value {
    display: block;
    position: relative;
    color: var(--heading);
    font-size: 31px;
    font-weight: 800;
    line-height: 1.05;
}

.kpi-value.fm-loading,
.inline-action.fm-loading {
    color: transparent !important;
}

.kpi-value.fm-loading::after,
.inline-action.fm-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(148, 163, 184, 0.28);
    border-top-color: #2563eb;
    border-radius: 999px;
    animation: fm-spin 0.75s linear infinite;
}

@keyframes fm-spin {
    to {
        transform: rotate(360deg);
    }
}

.kpi-value-text {
    max-width: 100%;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-note {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.matrix-panel {
    margin-top: 12px;
    padding: 14px 16px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
}

.settings-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 19, 38, 0.5);
    backdrop-filter: blur(3px);
}

.settings-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(760px, calc(100% - 24px));
    max-height: min(88vh, 900px);
    margin: 44px auto;
    padding: 18px 18px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(12, 30, 66, 0.24);
    overflow: hidden;
}

.settings-modal-header,
.settings-modal-footer,
.settings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-modal-copy,
.settings-summary {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.settings-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.settings-search-input {
    flex: 1;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    font-size: 13px;
}

.settings-toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 220px;
    max-height: 52vh;
    padding-right: 4px;
    overflow: auto;
}

.settings-activity-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.settings-activity-item.is-included {
    border-color: rgba(61, 187, 105, 0.28);
    background: #f6fcf8;
}

.settings-activity-item.is-excluded {
    border-color: rgba(236, 91, 85, 0.2);
    background: #fff8f7;
}

.settings-activity-item input {
    width: 18px;
    height: 18px;
    accent-color: #2f5bd3;
    cursor: pointer;
}

.settings-activity-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.settings-activity-copy strong {
    color: var(--heading);
    font-size: 13px;
    line-height: 1.3;
}

.settings-activity-copy span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.settings-activity-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #35558a;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.settings-empty-state {
    display: grid;
    place-items: center;
    min-height: 200px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #fbfcff;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 12px;
    width: calc(100% - 48px);
    margin: 14px auto 0;
}

.panel {
    padding: 14px 16px;
}

.table-wrap {
    margin-top: 10px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #edf2f8;
    text-align: left;
    font-size: 12px;
}

.data-table thead th {
    color: #748097;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
}

.sortable-header:hover,
.sortable-header.is-sorted {
    color: var(--primary);
}

.matrix-wrap {
    overflow-x: auto;
}

.matrix-table {
    min-width: 1440px;
    background: #fff;
    table-layout: fixed;
}

.matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fbff;
}

.matrix-table thead tr:first-child th {
    z-index: 20;
}

.matrix-table thead tr:nth-child(2) th {
    z-index: 15;
}

.matrix-table thead th[data-tooltip]:hover,
.matrix-table thead th[data-tooltip]:focus-visible,
.matrix-table thead th:has([data-tooltip]:hover),
.matrix-table thead th:has([data-tooltip]:focus-visible) {
    z-index: 120;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff;
}

.matrix-table th:first-child {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
}

.matrix-activity-name {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    font-weight: 700;
    background: #fff;
    white-space: normal;
    word-break: break-word;
}

.matrix-header-activity-cell {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
}

.matrix-header-data-cell {
    width: 368px;
    vertical-align: top;
}

.matrix-subhead-cell {
    width: 92px;
    color: #708099;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: center;
    background: #f4f8ff;
}

.matrix-visibility-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.matrix-visibility-controls .inline-action {
    cursor: pointer;
    opacity: 0.7;
}

.matrix-visibility-controls .inline-action.is-active {
    border-color: #8eb2ff;
    background: #2b63d9;
    color: #fff;
    opacity: 1;
}

.matrix-header-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.matrix-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.matrix-header-title {
    color: var(--heading);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.matrix-header-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.matrix-header-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border: 1px solid #d8e3f5;
    border-radius: 999px;
    background: #f7fafe;
    color: #47627f;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
}

.matrix-header-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.matrix-header-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid #e5ecf7;
    border-radius: 10px;
    background: #f8fbff;
}

.matrix-header-metric strong {
    color: var(--heading);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
}

.matrix-header-metric small {
    color: #7d899c;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.matrix-metric-cell {
    width: 92px;
    text-align: center;
    background: #fff;
}

.matrix-metric-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    color: #18253a;
    line-height: 1.1;
}

.matrix-metric-badge.is-high {
    background: #dff6e6;
}

.matrix-metric-badge.is-medium {
    background: #fff0c7;
}

.matrix-metric-badge.is-low {
    background: #ffe0df;
}

.matrix-total-row td {
    position: relative;
    border-top: 2px solid #c9d8ee;
    border-bottom: 2px solid #c9d8ee;
    background: #f1f6ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.matrix-total-row .matrix-activity-name {
    color: var(--heading);
    background: #eaf2ff;
    font-weight: 900;
    letter-spacing: .06em;
}

.matrix-total-row .matrix-metric-cell {
    background: #f1f6ff;
}

.matrix-total-row .matrix-metric-badge {
    border: 1px solid rgba(43, 99, 217, 0.16);
    box-shadow: 0 4px 12px rgba(12, 30, 66, 0.08);
}

.compact-table-wrap {
    max-height: 440px;
}

.compact-table {
    min-width: 100%;
}

.list-stack {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.list-card {
    padding: 12px 12px 10px;
    border: 1px solid #e9eef6;
    border-radius: 10px;
    background: var(--surface-alt);
}

.list-card-head,
.list-card-meta,
.progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.list-card-head {
    margin-bottom: 8px;
}

.list-card-head strong {
    color: var(--heading);
    font-size: 13px;
}

.list-card-meta,
.progress-row,
.placeholder {
    color: var(--muted);
    font-size: 11px;
}

.list-card-meta {
    margin-bottom: 8px;
}

.placeholder {
    padding: 12px 0;
}

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

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

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

@media (max-width: 760px) {
    .app-topbar,
    .filters-panel,
    .metrics-section,
    .panel,
    .main-nav,
    .sub-nav,
    .kpi-card {
        width: min(100%, calc(100% - 16px));
    }

    .app-topbar,
    .filters-header,
    .panel-header,
    .section-headline {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav,
    .sub-nav {
        overflow-x: auto;
    }

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

    .dashboard-grid {
        width: min(100%, calc(100% - 16px));
    }

    .date-range {
        grid-template-columns: 1fr;
    }

    .settings-modal-panel {
        width: min(100%, calc(100% - 16px));
        max-height: calc(100vh - 16px);
        margin: 8px auto;
        padding: 14px;
    }

    .settings-modal-header,
    .settings-modal-footer,
    .settings-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-activity-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .settings-activity-state {
        grid-column: 2;
        justify-self: start;
    }

    .matrix-table th:first-child,
    .matrix-table td:first-child,
    .matrix-table th:nth-child(2),
    .matrix-table td:nth-child(2) {
        position: static;
    }
}
