* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f1ea;
    --surface: #fffaf2;
    --surface-strong: #fff;
    --surface-soft: #fffdf9;
    --surface-soft-2: #fff4e5;
    --surface-soft-active-1: #fff5d8;
    --surface-soft-active-2: #ffe7b8;
    --text: #1f2933;
    --text-muted: #5e6873;
    --text-soft: #6b7280;
    --accent: #7c4f22;
    --accent-strong: #a55d19;
    --accent-contrast: #fff;
    --border: #e8dcc7;
    --border-soft: #eadfce;
    --border-strong: #d7c7af;
    --shadow: rgba(31, 41, 51, 0.08);
    --row-hover: #f7efe1;
    --analytics-table-border: #ded6ca;
    --analytics-row-alt: #fbf8f2;
    --analytics-row-hover: #eef4fb;
    --analytics-selection-bg: #dcecff;
    --analytics-selection-strong: #c9e0ff;
    --analytics-selection-border: #5a9df8;
    --notice-success-bg: #e7f5ec;
    --notice-success-text: #1e5a35;
    --notice-error-bg: #fdecec;
    --notice-error-text: #8a2525;
    --notice-info-bg: #efe7db;
    --notice-info-text: #6e4f2d;
    --status-uploaded-bg: #efe6d5;
    --status-uploaded-text: #6c5432;
    --status-imported-bg: #e3f5e8;
    --status-imported-text: #21633b;
    --status-failed-bg: #fde7e7;
    --status-failed-text: #922b2b;
    --status-active-bg: #e3f5e8;
    --status-active-text: #21633b;
    --status-disabled-bg: #ece9e4;
    --status-disabled-text: #5f5a52;
    --status-neutral-bg: #e6ecf2;
    --status-neutral-text: #3d5468;
    --analytics-group-row-height: 36px;
    --group-meta-head: #d9e5f0;
    --group-meta-cell: #f4f8fc;
    --group-discovery-head: #f6dec0;
    --group-discovery-cell: #fff8ef;
    --group-funnel-head: #d7ebd1;
    --group-funnel-cell: #f5fbf2;
    --group-money-head: #efd8cc;
    --group-money-cell: #fff7f3;
    --group-ad-head: #e5def8;
    --group-ad-cell: #f8f5ff;
    --group-efficiency-head: #f2d8ea;
    --group-efficiency-cell: #fff6fc;
    --group-forecast-head: #dfeacb;
    --group-forecast-cell: #f8fbef;
    --group-action-head: #e7edf5;
    --group-action-cell: #f6f9fd;
}

[data-theme="dark"] {
    --bg: #171a1f;
    --surface: #20242b;
    --surface-strong: #262b34;
    --surface-soft: #252a31;
    --surface-soft-2: #2c3139;
    --surface-soft-active-1: #3a2d1f;
    --surface-soft-active-2: #4a3722;
    --text: #eef2f7;
    --text-muted: #b4bdc9;
    --text-soft: #9da8b6;
    --accent: #d59b62;
    --accent-strong: #f0b171;
    --accent-contrast: #171a1f;
    --border: #353b45;
    --border-soft: #313741;
    --border-strong: #49515d;
    --shadow: rgba(0, 0, 0, 0.35);
    --row-hover: #2d3138;
    --analytics-table-border: #3a424d;
    --analytics-row-alt: #252b33;
    --analytics-row-hover: #2b3744;
    --analytics-selection-bg: #263f5f;
    --analytics-selection-strong: #315174;
    --analytics-selection-border: #77aef6;
    --notice-success-bg: #173423;
    --notice-success-text: #b4f0c7;
    --notice-error-bg: #3b1d21;
    --notice-error-text: #ffb6bd;
    --notice-info-bg: #33281f;
    --notice-info-text: #f2cfab;
    --status-uploaded-bg: #3a3024;
    --status-uploaded-text: #f1d2ab;
    --status-imported-bg: #1a3a27;
    --status-imported-text: #b9efc9;
    --status-failed-bg: #442127;
    --status-failed-text: #ffbac2;
    --status-active-bg: #1a3a27;
    --status-active-text: #b9efc9;
    --status-disabled-bg: #2f2c28;
    --status-disabled-text: #c3bdb3;
    --status-neutral-bg: #24313d;
    --status-neutral-text: #b9d2e8;
    --analytics-group-row-height: 36px;
    --group-meta-head: #263545;
    --group-meta-cell: #202b36;
    --group-discovery-head: #443424;
    --group-discovery-cell: #2d261f;
    --group-funnel-head: #2c402a;
    --group-funnel-cell: #222f22;
    --group-money-head: #443229;
    --group-money-cell: #302620;
    --group-ad-head: #332d4b;
    --group-ad-cell: #28243a;
    --group-efficiency-head: #422c3e;
    --group-efficiency-cell: #302431;
    --group-forecast-head: #34412a;
    --group-forecast-cell: #273020;
    --group-action-head: #303845;
    --group-action-cell: #262d37;
}

body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 24px;
}

.page-analytics {
    width: 100%;
    max-width: none;
    padding: 28px clamp(8px, 0.9vw, 16px) 36px;
}

.page-analytics .stack {
    gap: 18px;
}

.page-analytics .stack > *,
.page-analytics #cluster-list,
.page-analytics .card {
    min-width: 0;
}

.page-analytics .card {
    padding: 18px;
    border-radius: 12px;
}

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

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

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

.nav-account {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.nav-account strong {
    color: var(--text);
}

.nav a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.theme-toggle {
    background: var(--surface-strong);
    color: var(--accent);
    border: 1px solid var(--border-strong);
}

.hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 12px 30px var(--shadow);
}

.hero h1 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 2rem;
}

.hero p {
    margin: 0;
    line-height: 1.6;
}

.hero p + p {
    margin-top: 16px;
}

.button-link,
button {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-contrast);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 30px var(--shadow);
}

.stack {
    display: grid;
    gap: 24px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.data-page-header h1,
.data-page-header p {
    margin: 0;
}

.data-page-header p {
    margin-top: 8px;
    color: var(--text-muted);
}

.token-settings {
    padding: 0;
    overflow: hidden;
}

.token-settings > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    cursor: pointer;
    list-style-position: inside;
}

.token-settings > summary > span:first-child {
    display: grid;
    gap: 4px;
}

.token-settings summary small,
.source-status-row small {
    color: var(--text-muted);
    font-weight: 400;
}

.token-settings-state {
    color: var(--notice-error-text);
    font-weight: 700;
}

.token-settings-state.is-ready {
    color: var(--notice-success-text);
}

.token-settings-body {
    display: grid;
    gap: 16px;
    padding: 0 24px 24px;
    border-top: 1px solid var(--border);
}

.token-settings-body > :first-child {
    margin-top: 20px;
}

.token-settings-body .form-grid {
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
}

.api-token-section {
    display: grid;
    gap: 12px;
}

.api-token-section + .api-token-section {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.api-token-section h3,
.api-token-section p {
    margin: 0;
}

.api-token-section h3 small {
    color: var(--text-muted);
    font-size: 0.8em;
    font-weight: 500;
}

.danger-button {
    color: var(--notice-error-text);
    border: 1px solid color-mix(in srgb, var(--notice-error-text) 45%, var(--border-strong));
    background: transparent;
}

.source-status-list {
    display: grid;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}

.source-status-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.source-status-row > span {
    display: grid;
    gap: 4px;
}

@media (max-width: 620px) {
    .token-settings > summary,
    .source-status-row {
        align-items: start;
    }

    .token-settings-body .form-grid,
    .source-status-row {
        grid-template-columns: 1fr;
    }
}

.analytics-period-filter {
    display: grid;
    gap: 14px;
}

.analytics-filter-fields {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.2fr) 110px auto auto;
    gap: 14px;
    align-items: end;
}

.analytics-filter-fields label {
    display: grid;
    gap: 6px;
    min-width: 0;
    font-weight: 600;
}

.analytics-date-button {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.analytics-date-button:hover,
.analytics-date-button:focus-visible {
    border-color: var(--accent-strong);
    outline: 2px solid color-mix(in srgb, var(--accent-strong) 28%, transparent);
    outline-offset: 1px;
}

.analytics-date-icon {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 17px;
    border: 2px solid var(--accent);
    border-radius: 3px;
}

.analytics-date-icon::before {
    position: absolute;
    top: 3px;
    right: 0;
    left: 0;
    border-top: 2px solid var(--accent);
    content: "";
}

.analytics-date-icon::after {
    position: absolute;
    top: -4px;
    right: 3px;
    left: 3px;
    height: 4px;
    border-right: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
    content: "";
}

.analytics-period-filter select,
.analytics-period-filter input[type="search"],
.analytics-period-filter input[type="date"],
.analytics-period-filter input[type="number"] {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px 14px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font: inherit;
}

.analytics-comparison-field input {
    text-align: center;
}

.analytics-export-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.seller-article-picker {
    position: relative;
    display: block;
    min-width: 0;
}

.seller-article-options {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: 0 12px 30px var(--shadow);
}

.seller-article-option {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border-radius: 5px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.seller-article-option:hover,
.seller-article-option.is-active {
    background: var(--row-hover);
    color: var(--text);
}

.seller-article-empty {
    display: block;
    padding: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

.analytics-period-filter input[type="date"] {
    color-scheme: dark;
    font-weight: 700;
}

.analytics-period-filter input[type="date"]::-webkit-calendar-picker-indicator {
    width: 20px;
    height: 20px;
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.9;
    filter: invert(81%) sepia(22%) saturate(722%) hue-rotate(349deg) brightness(93%) contrast(89%);
}

.analytics-period-filter input[type="date"]:focus {
    border-color: var(--accent-strong);
    outline: 2px solid color-mix(in srgb, var(--accent-strong) 35%, transparent);
    outline-offset: 1px;
}

.analytics-period-presets {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.analytics-period-presets-label {
    margin-right: 2px;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.analytics-period-presets .period-preset-button {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    white-space: nowrap;
}

.analytics-period-presets .period-preset-button:hover,
.analytics-period-presets .period-preset-button:focus-visible {
    border-color: var(--accent-strong);
}

.period-calendar-dialog {
    position: fixed;
    z-index: 1000;
    width: min(840px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: auto;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: 0 16px 40px var(--shadow);
}

.period-calendar-panel {
    padding: 16px;
}

.period-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.period-calendar-header strong {
    font-size: 1rem;
}

.period-calendar-header span {
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.period-calendar-month-header {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.period-calendar-nav {
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface-soft);
    font-size: 1.7rem;
    line-height: 1;
}

.period-calendar-nav:hover,
.period-calendar-nav:focus-visible {
    color: var(--accent);
    border-color: var(--accent-strong);
}

.period-calendar-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

.period-calendar-month h3 {
    margin: 0;
    font-size: 1rem;
    text-align: center;
    text-transform: capitalize;
}

.period-calendar-weekdays,
.period-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.period-calendar-weekdays {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
}

.period-calendar-day {
    position: relative;
    min-width: 0;
    height: 36px;
    padding: 0;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-weight: 650;
    isolation: isolate;
}

.period-calendar-day.is-data-available {
    border-color: color-mix(in srgb, var(--border-strong) 72%, transparent);
    background: color-mix(in srgb, var(--surface-soft) 88%, var(--surface-strong));
}

.period-calendar-day:hover:not(:disabled),
.period-calendar-day:focus-visible:not(:disabled) {
    border-color: var(--accent-strong);
    background: var(--row-hover);
}

.period-calendar-day.is-in-range {
    border-color: color-mix(in srgb, var(--accent-strong) 72%, transparent);
    background: color-mix(in srgb, var(--accent) 24%, var(--surface-soft));
    box-shadow: inset 0 -4px 0 var(--accent);
}

.period-calendar-day.is-range-start,
.period-calendar-day.is-range-end {
    color: var(--button-text);
    border-color: var(--accent-strong);
    background: var(--accent);
}

.period-calendar-day.is-today:not(.is-range-start):not(.is-range-end) {
    border-color: var(--border-strong);
}

.period-calendar-day.has-cpc-spend {
    background: color-mix(in srgb, #805ad5 64%, var(--surface-soft));
}

.period-calendar-day.has-manual-spend {
    background: color-mix(in srgb, #2f855a 64%, var(--surface-soft));
}

.period-calendar-day.has-unified-spend {
    background: color-mix(in srgb, #2563a6 68%, var(--surface-soft));
}

.period-calendar-day.has-unknown-spend:not(.has-cpc-spend):not(.has-manual-spend):not(.has-unified-spend) {
    background: color-mix(in srgb, var(--text-muted) 48%, var(--surface-soft));
}

.period-calendar-day.has-cpc-spend.has-manual-spend:not(.has-unified-spend) {
    background: linear-gradient(135deg, #805ad5 0 50%, #2f855a 50% 100%);
}

.period-calendar-day.has-cpc-spend.has-unified-spend:not(.has-manual-spend) {
    background: linear-gradient(135deg, #805ad5 0 50%, #2563a6 50% 100%);
}

.period-calendar-day.has-manual-spend.has-unified-spend:not(.has-cpc-spend) {
    background: linear-gradient(135deg, #2f855a 0 50%, #2563a6 50% 100%);
}

.period-calendar-day.has-cpc-spend.has-manual-spend.has-unified-spend {
    background: linear-gradient(135deg, #805ad5 0 33.33%, #2f855a 33.33% 66.66%, #2563a6 66.66% 100%);
}

.period-calendar-day.has-ad-spend {
    color: #fff;
    border-color: color-mix(in srgb, currentColor 28%, transparent);
}

.period-calendar-day.is-in-range.has-ad-spend {
    border-color: var(--accent-strong);
    box-shadow: inset 0 0 0 999px rgb(255 255 255 / 10%), inset 0 -4px 0 var(--accent);
}

.period-calendar-day:is(.is-range-start, .is-range-end),
.period-calendar-day:is(.is-range-start, .is-range-end).has-ad-spend {
    color: var(--button-text);
    border: 2px solid var(--surface-strong);
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-strong);
}

.period-calendar-day:disabled {
    color: var(--text-muted);
    cursor: default;
    background: transparent;
    border-color: transparent;
    opacity: 0.16;
}

.period-calendar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.period-calendar-legend,
.period-calendar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.period-calendar-actions button {
    min-height: 38px;
}

.period-calendar-ad-legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.period-calendar-ad-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.period-calendar-ad-legend.is-cpc i {
    background: #805ad5;
}

.period-calendar-ad-legend.is-manual i {
    background: #2f855a;
}

.period-calendar-ad-legend.is-unified i {
    background: #2563a6;
}

.period-calendar-ad-legend.is-selection i {
    border-radius: 2px;
    background: var(--accent);
    box-shadow: inset 0 -3px 0 var(--accent-strong);
}

.period-calendar-threshold {
    color: var(--text-muted);
    font-size: 0.82rem;
}

@media (max-width: 980px) {
    .analytics-filter-fields {
        grid-template-columns: minmax(0, 1fr) 110px auto auto;
    }

    .analytics-article-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .analytics-filter-fields {
        grid-template-columns: 1fr;
    }

    .analytics-filter-submit,
    .analytics-export-button {
        width: 100%;
    }

    .period-calendar-months {
        grid-template-columns: 1fr;
    }

    .period-calendar-month:last-child {
        display: none;
    }

    .period-calendar-header,
    .period-calendar-footer,
    .period-calendar-legend {
        align-items: stretch;
        flex-direction: column;
    }
}

.inline-form {
    margin: 0;
}

.field-label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-grid select,
.form-grid input[type="file"],
.form-grid input[type="text"],
.form-grid input[type="password"] {
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface-strong);
    font: inherit;
}

.dropzone {
    display: grid;
    gap: 8px;
    padding: 28px 20px;
    border: 2px dashed var(--border-strong);
    border-radius: 14px;
    background: linear-gradient(180deg, var(--surface-soft) 0%, var(--surface-soft-2) 100%);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.dropzone.is-active {
    border-color: var(--accent-strong);
    background: linear-gradient(180deg, var(--surface-soft-active-1) 0%, var(--surface-soft-active-2) 100%);
    box-shadow: 0 0 0 4px rgba(165, 93, 25, 0.18);
    transform: translateY(-1px);
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 4px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 1.75rem;
    line-height: 1;
}

.dropzone.is-active .dropzone-icon {
    background: var(--accent-strong);
    transform: scale(1.06);
}

.dropzone-title {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.1rem;
}

.dropzone-subtitle {
    color: var(--text-muted);
}

.queue-meta {
    margin: 12px 0 0;
    color: var(--accent);
    font-weight: 600;
}

.file-list {
    margin: 8px 0 0;
    padding-left: 20px;
}

.file-list li + li {
    margin-top: 6px;
}

.notice {
    padding: 12px 16px;
    border-radius: 10px;
}

.notice.success {
    background: var(--notice-success-bg);
    color: var(--notice-success-text);
}

.notice.error {
    background: var(--notice-error-bg);
    color: var(--notice-error-text);
}

.notice.info {
    background: var(--notice-info-bg);
    color: var(--notice-info-text);
}

.search-sync-progress {
    display: grid;
    gap: 8px;
    margin: 14px 0 16px;
    padding: 14px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-strong) 84%, var(--notice-info-bg));
}

.search-sync-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-sync-progress-header [data-search-sync-state],
.search-sync-progress-header [data-background-sync-state] {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.analytics-data-status {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.analytics-data-status-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--notice-success-text);
}

.analytics-data-status.is-running .analytics-data-status-dot {
    background: var(--accent);
    animation: search-sync-pulse 1s ease-in-out infinite;
}

.analytics-data-status.is-error .analytics-data-status-dot {
    background: var(--notice-error-text);
}

.analytics-data-status [data-analytics-sync-refresh] {
    margin-left: auto;
}

.analytics-data-status-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 620px) {
    .analytics-data-status {
        flex-wrap: wrap;
    }

    .analytics-data-status [data-analytics-sync-refresh] {
        margin-left: 18px;
    }
}

.search-sync-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.search-sync-progress-message {
    font-weight: 700;
}

.search-sync-progress-meta {
    color: var(--text-muted);
    font-size: 0.86rem;
}

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

.sync-freshness {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    color: var(--text-muted);
}

.sync-freshness strong {
    color: var(--text);
}

.sync-stage-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 4px 0;
    padding: 0;
    list-style: none;
}

.sync-stage-list li {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    text-align: center;
}

.sync-stage-list li.is-active {
    border-color: var(--accent);
    color: var(--text);
    font-weight: 700;
}

.sync-stage-list li.is-done {
    color: var(--notice-success-text);
}

@media (max-width: 720px) {
    .sync-stage-list {
        grid-template-columns: 1fr;
    }
}

.search-sync-progress.is-running {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong));
}

.search-sync-progress.is-running .search-sync-progress-dot {
    background: var(--accent);
    animation: search-sync-pulse 1s ease-in-out infinite;
}

.search-sync-progress.is-error {
    border-color: color-mix(in srgb, var(--notice-error-text) 45%, var(--border-strong));
    background: color-mix(in srgb, var(--surface-strong) 76%, var(--notice-error-bg));
}

.search-sync-progress.is-error .search-sync-progress-dot {
    background: var(--notice-error-text);
}

.search-sync-progress.is-done .search-sync-progress-dot {
    background: var(--notice-success-text);
}

@keyframes search-sync-pulse {
    0%,
    100% {
        opacity: 0.45;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.notice-action {
    display: inline-block;
    margin-left: 10px;
    color: inherit;
    font-weight: 800;
}

.copy-hint {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.analytics-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
}

.metric-highlight-card {
    display: grid;
    gap: 12px;
}

.metric-highlight-form {
    display: grid;
    gap: 12px;
}

.metric-highlight-header,
.metric-highlight-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-highlight-header h2 {
    margin: 0 0 8px;
    font-size: 1.08rem;
}

.metric-highlight-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.metric-highlight-swatch {
    display: inline-block;
    width: 34px;
    height: 16px;
    border-radius: 5px;
}

.metric-highlight-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface-strong);
    font-weight: 800;
}

.metric-highlight-toggle input {
    width: 16px;
    height: 16px;
}

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

.metric-threshold-group {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--analytics-table-border) 78%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-soft) 66%, var(--surface-strong));
}

.metric-threshold-group legend {
    padding: 0 4px;
    color: var(--accent);
    font-weight: 900;
}

.metric-threshold-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.metric-threshold-input {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-weight: 800;
}

.metric-threshold-input input {
    width: 78px;
    min-height: 34px;
    padding: 7px 8px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font: inherit;
    text-align: right;
}

.metric-highlight-actions {
    justify-content: flex-start;
}

.copy-feedback-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--accent-strong) 42%, var(--border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-strong) 92%, var(--accent-strong));
    color: var(--text);
    box-shadow: 0 16px 36px var(--shadow);
    font-size: 0.95rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-feedback-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.selection-stats-bar {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 990;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    max-width: min(880px, calc(100vw - 48px));
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--analytics-selection-border) 48%, var(--border-strong));
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-strong) 92%, var(--analytics-selection-bg));
    box-shadow: 0 16px 36px var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.selection-stats-bar.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.selection-stat-item {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-soft) 86%, var(--surface-strong));
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
}

.selection-stat-item-strong {
    color: var(--text);
    background: color-mix(in srgb, var(--analytics-selection-bg) 62%, var(--surface-strong));
}

.analytics-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--analytics-table-border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-soft) 76%, var(--surface-strong));
}

.cluster-search-field {
    display: grid;
    gap: 6px;
    min-width: min(360px, 100%);
    font-weight: 700;
}

.cluster-search-field input {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font: inherit;
}

.secondary-button {
    padding: 9px 12px;
    color: var(--accent);
    border: 1px solid var(--border-strong);
    background: var(--surface-strong);
}

.cluster-filter-summary {
    margin: 0 0 0 auto;
    color: var(--text-muted);
    font-weight: 600;
}

.cluster-status-filter {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.cluster-status-filter legend {
    float: left;
    margin: 0 4px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.cluster-status-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.cluster-status-filter label:has(input:not(:checked)) {
    color: var(--text-muted);
    opacity: 0.58;
}

.cluster-status-filter input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--accent);
}

.empty-state {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-muted);
}

.empty-state.is-hidden,
.is-filtered-out {
    display: none;
}

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

.section-header h3 {
    margin: 0 0 6px;
}

.section-subtitle {
    margin: 0;
    color: var(--text-muted);
}

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    position: relative;
}

.page-analytics .table-wrap {
    border: 1px solid var(--analytics-table-border);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface-strong) 82%, white);
    scrollbar-width: thin;
    scrollbar-color:
        color-mix(in srgb, var(--border-strong) 72%, var(--accent))
        color-mix(in srgb, var(--surface-soft) 82%, var(--surface-strong));
}

.page-analytics .table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.page-analytics .table-wrap::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--surface-soft) 82%, var(--surface-strong));
    border-radius: 999px;
}

.page-analytics .table-wrap::-webkit-scrollbar-thumb {
    border: 2px solid color-mix(in srgb, var(--surface-soft) 82%, var(--surface-strong));
    border-radius: 999px;
    background: color-mix(in srgb, var(--border-strong) 72%, var(--accent));
}

.page-analytics .table-wrap::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--accent-strong) 64%, var(--border-strong));
}

.page-analytics .table-wrap > table {
    margin-right: auto;
    margin-left: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 0.9rem;
    color: var(--accent);
}

.analytics-table thead th,
.detail-metrics-table thead th {
    position: sticky;
    top: var(--analytics-group-row-height);
    z-index: 20;
    background: var(--surface-strong);
    box-shadow: 0 1px 0 var(--border-soft);
}

thead .group-row th {
    top: 0;
    z-index: 26;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.76rem;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    white-space: nowrap;
}

thead .column-header-row th {
    top: var(--analytics-group-row-height);
    z-index: 22;
}

td,
th {
    font-variant-numeric: tabular-nums;
}

th button {
    font: inherit;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.status-uploaded {
    background: var(--status-uploaded-bg);
    color: var(--status-uploaded-text);
}

.status-imported {
    background: var(--status-imported-bg);
    color: var(--status-imported-text);
}

.status-failed {
    background: var(--status-failed-bg);
    color: var(--status-failed-text);
}

.status-active,
.status-login_success,
.status-import_processed {
    background: var(--status-active-bg);
    color: var(--status-active-text);
}

.status-disabled {
    background: var(--status-disabled-bg);
    color: var(--status-disabled-text);
}

.status-logout,
.status-file_uploaded {
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
}

.status-login_failed,
.status-login_locked,
.status-import_failed {
    background: var(--status-failed-bg);
    color: var(--status-failed-text);
}

.file-name {
    overflow-wrap: anywhere;
}

.file-context {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 0.86rem;
    line-height: 1.35;
}

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

.file-context-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.file-context-link:hover {
    text-decoration: underline;
}

.cluster-card {
    display: grid;
    gap: 20px;
}

.analytics-table {
    min-width: 0;
}

.analytics-table,
.detail-metrics-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: max-content;
    background: var(--surface-strong);
}

.analytics-table th,
.analytics-table td,
.detail-metrics-table th,
.detail-metrics-table td {
    padding: 9px 16px;
    border-right: 1px solid color-mix(in srgb, var(--analytics-table-border) 54%, transparent);
    border-bottom: 1px solid var(--analytics-table-border);
    vertical-align: middle;
    line-height: 1.35;
}

.analytics-table th:first-child,
.analytics-table td:first-child,
.detail-metrics-table th:first-child,
.detail-metrics-table td:first-child {
    padding-left: 18px;
}

.analytics-table th:last-child,
.analytics-table td:last-child,
.detail-metrics-table th:last-child,
.detail-metrics-table td:last-child {
    padding-right: 18px;
}

.analytics-table th:last-child,
.analytics-table td:last-child,
.detail-metrics-table th:last-child,
.detail-metrics-table td:last-child {
    border-right: 0;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead th {
    background: var(--surface-strong);
    box-shadow: none;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th {
    height: var(--analytics-group-row-height);
    padding: 8px 12px;
    border-bottom: 0;
    color: color-mix(in srgb, var(--text) 86%, var(--text-muted));
    letter-spacing: 0.035em;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th {
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--analytics-table-border);
    font-size: 0.84rem;
    box-shadow:
        inset 0 4px 0 color-mix(in srgb, var(--border-strong) 58%, transparent),
        inset 1px 0 0 color-mix(in srgb, var(--surface-strong) 48%, transparent);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-meta {
    background: var(--group-meta-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-discovery {
    background: var(--group-discovery-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-funnel {
    background: var(--group-funnel-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-money {
    background: var(--group-money-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-ad {
    background: var(--group-ad-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-efficiency {
    background: var(--group-efficiency-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-forecast {
    background: var(--group-forecast-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .group-row th.group-head-action {
    background: var(--group-action-head);
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-meta-col {
    background: color-mix(in srgb, var(--group-meta-head) 56%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-meta-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-meta-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-discovery-col {
    background: color-mix(in srgb, var(--group-discovery-head) 62%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-discovery-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-discovery-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-funnel-col {
    background: color-mix(in srgb, var(--group-funnel-head) 62%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-funnel-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-funnel-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-money-col {
    background: color-mix(in srgb, var(--group-money-head) 64%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-money-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-money-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-ad-col {
    background: color-mix(in srgb, var(--group-ad-head) 64%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-ad-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-ad-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-efficiency-col {
    background: color-mix(in srgb, var(--group-efficiency-head) 66%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-efficiency-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-efficiency-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.group-forecast-col {
    background: color-mix(in srgb, var(--group-forecast-head) 64%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-forecast-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-forecast-head) 58%, var(--analytics-table-border));
}

.page-analytics :is(.analytics-table, .detail-metrics-table) thead .column-header-row th.action-column {
    background: color-mix(in srgb, var(--group-action-head) 70%, var(--surface-strong));
    box-shadow:
        inset 0 4px 0 var(--group-action-head),
        inset 1px 0 0 color-mix(in srgb, var(--group-action-head) 58%, var(--analytics-table-border));
}

.analytics-row.is-active-row,
.detail-metrics-table > tbody > tr.is-active-row,
.detail-metrics-table > tbody > tr:hover {
    background: transparent;
}

.analytics-row:hover td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient),
.analytics-row.is-active-row td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient),
.detail-metrics-table > tbody > tr:hover > td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient),
.detail-metrics-table > tbody > tr.is-active-row > td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient) {
    background: var(--analytics-row-hover);
}

.cluster-summary-row-divider td {
    border-top: 1px solid var(--analytics-table-border);
}

.cluster-summary-row-divider .sticky-column {
    box-shadow:
        1px 0 0 var(--border-soft),
        12px 0 18px -18px var(--shadow);
}

.period-row-divider td {
    border-top: 1px solid var(--analytics-table-border);
}

.cluster-name-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.page-analytics :is(th, td)[data-column-key="cluster_name"],
.page-analytics :is(th, td)[data-column-key="search_query"] {
    min-width: 0;
    overflow: hidden;
}

.group-start {
    border-left: 1px solid color-mix(in srgb, var(--analytics-table-border) 80%, var(--border-strong));
}

.group-head-meta {
    background: var(--group-meta-head);
}

.group-head-discovery {
    background: var(--group-discovery-head);
}

.group-head-funnel {
    background: var(--group-funnel-head);
}

.group-head-money {
    background: var(--group-money-head);
}

.group-head-ad {
    background: var(--group-ad-head);
}

.group-head-efficiency {
    background: var(--group-efficiency-head);
}

.group-head-action {
    background: color-mix(in srgb, var(--surface-soft-2) 72%, var(--surface-strong));
}

.group-meta-col,
.group-discovery-col,
.group-funnel-col,
.group-money-col,
.group-ad-col,
.group-efficiency-col,
.group-forecast-col {
    background: var(--surface-strong);
}

.sticky-column {
    position: sticky;
    left: 0;
    z-index: 8;
    background: var(--surface-strong);
    background-clip: padding-box;
    box-shadow:
        1px 0 0 var(--analytics-table-border),
        12px 0 18px -20px var(--shadow);
}

thead .sticky-column,
.sticky-header-cell {
    z-index: 30;
}

.sticky-column.group-meta-col,
.sticky-column.group-discovery-col,
.sticky-column.group-funnel-col,
.sticky-column.group-money-col,
.sticky-column.group-ad-col,
.sticky-column.group-efficiency-col,
.sticky-column.group-forecast-col {
    background: var(--surface-strong);
}

.is-column-pinned {
    position: sticky;
    left: var(--pinned-left, 0);
    z-index: 14;
    background-clip: padding-box;
    box-shadow:
        1px 0 0 var(--analytics-table-border),
        12px 0 18px -20px var(--shadow);
}

thead .is-column-pinned {
    position: sticky;
    top: 0;
    left: var(--pinned-left, 0);
    z-index: 32;
}

.is-column-pinned.group-meta-col,
.is-column-pinned.group-discovery-col,
.is-column-pinned.group-funnel-col,
.is-column-pinned.group-money-col,
.is-column-pinned.group-ad-col,
.is-column-pinned.group-efficiency-col,
.is-column-pinned.group-forecast-col {
    background: var(--surface-strong);
}

.analytics-table tbody tr.is-even-row td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient),
.detail-metrics-table > tbody > tr.is-even-row > td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient) {
    background: var(--analytics-row-alt);
}

.numeric-cell,
.money-column,
.action-column {
    white-space: nowrap;
}

.numeric-cell {
    padding-left: 20px;
    padding-right: 14px;
    text-align: left;
}

.money-column {
    padding-left: 14px;
    padding-right: 20px;
    text-align: right;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) :is(th, td).numeric-cell:not(.money-column) {
    padding-left: 20px;
    padding-right: 18px;
    text-align: left;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) :is(th, td).money-column {
    padding-left: 12px;
    padding-right: 16px;
    text-align: right;
}

.page-analytics :is(.analytics-table, .detail-metrics-table) :is(th[data-column-key="period"], th[data-column-key="latest_period"], td.period-cell) {
    padding-right: 24px;
}

.column-header-row th {
    text-align: left;
}

.column-header-row th.numeric-cell {
    padding-left: 20px;
    padding-right: 18px;
    text-align: left;
}

.column-header-row th.money-column {
    padding-left: 12px;
    padding-right: 16px;
    text-align: right;
}

.column-header-row th.numeric-cell .sort-button {
    justify-content: flex-start;
    width: 100%;
    text-align: left;
}

.column-header-row th.money-column .sort-button {
    justify-content: flex-end;
    width: 100%;
    text-align: right;
}

.column-header-row th:not(.numeric-cell) .sort-button {
    justify-content: flex-start;
    text-align: left;
}

.copyable-cell {
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    position: relative;
    --range-top: 0px;
    --range-right: 0px;
    --range-bottom: 0px;
    --range-left: 0px;
}

.copyable-cell.sticky-column,
.copyable-cell.is-column-pinned {
    position: sticky;
}

.copyable-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-style: solid;
    border-color: var(--analytics-selection-border);
    border-width: var(--range-top) var(--range-right) var(--range-bottom) var(--range-left);
}

.copyable-cell.is-range-selected {
    background: var(--analytics-selection-bg);
}

.copyable-cell.sticky-column.is-range-selected {
    background: var(--analytics-selection-bg);
}

.copyable-cell.is-selected {
    background: var(--analytics-selection-strong);
}

.copyable-cell.sticky-column.is-selected {
    background: var(--analytics-selection-strong);
}

.metric-band-good {
    background: color-mix(in srgb, #91c974 58%, var(--surface-strong));
    color: #143513;
    font-weight: 700;
}

.metric-band-warn {
    background: color-mix(in srgb, #ffd76a 66%, var(--surface-strong));
    color: #5a4200;
    font-weight: 700;
}

.metric-gradient {
    background: hsl(var(--metric-hue) 58% 80%);
    color: #29231d;
    font-weight: 700;
}

[data-theme="dark"] .metric-gradient {
    background: hsl(var(--metric-hue) 34% 29%);
    color: var(--text);
}

.metric-gradient-0 { --metric-hue: 4deg; }
.metric-gradient-1 { --metric-hue: 15deg; }
.metric-gradient-2 { --metric-hue: 26deg; }
.metric-gradient-3 { --metric-hue: 36deg; }
.metric-gradient-4 { --metric-hue: 47deg; }
.metric-gradient-5 { --metric-hue: 58deg; }
.metric-gradient-6 { --metric-hue: 69deg; }
.metric-gradient-7 { --metric-hue: 80deg; }
.metric-gradient-8 { --metric-hue: 90deg; }
.metric-gradient-9 { --metric-hue: 101deg; }
.metric-gradient-10 { --metric-hue: 112deg; }

[data-theme="dark"] .metric-band-good {
    color: #eaf8e4;
}

[data-theme="dark"] .metric-band-warn {
    color: #fff1bf;
}

.copyable-cell.metric-band-good.is-range-selected,
.copyable-cell.metric-band-warn.is-range-selected,
.copyable-cell.metric-band-good.sticky-column.is-range-selected,
.copyable-cell.metric-band-warn.sticky-column.is-range-selected {
    background: var(--analytics-selection-bg);
}

.copyable-cell.metric-gradient.is-range-selected,
.copyable-cell.metric-gradient.sticky-column.is-range-selected {
    background: var(--analytics-selection-bg);
}

.copyable-cell.metric-band-good.is-selected,
.copyable-cell.metric-band-warn.is-selected,
.copyable-cell.metric-band-good.sticky-column.is-selected,
.copyable-cell.metric-band-warn.sticky-column.is-selected {
    background: var(--analytics-selection-strong);
}

.copyable-cell.metric-gradient.is-selected,
.copyable-cell.metric-gradient.sticky-column.is-selected {
    background: var(--analytics-selection-strong);
}

.copyable-cell.is-selected.is-single-selection {
    background: var(--analytics-selection-strong);
    --range-top: 1px;
    --range-right: 1px;
    --range-bottom: 1px;
    --range-left: 1px;
}

.copyable-cell.is-copied {
    animation: copy-cell-flash 0.7s ease;
}

@keyframes copy-cell-flash {
    0% {
        background: color-mix(in srgb, var(--analytics-selection-border) 32%, var(--surface-strong));
        filter: saturate(1.08);
    }

    100% {
        background: var(--analytics-selection-bg);
        filter: none;
    }
}

.money-column {
    min-width: 0;
    text-align: right;
}

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

.action-column {
    min-width: 0;
}

.period-cell {
    min-width: 0;
    white-space: nowrap;
}

.period-cell-content {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
}

.period-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.period-change-marker {
    position: relative;
    z-index: 90;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--accent-strong) 64%, var(--border-strong));
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 24%, var(--surface-strong));
    box-shadow: 0 1px 0 color-mix(in srgb, var(--surface-strong) 78%, white);
    cursor: help;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.period-change-marker:focus-visible {
    outline: 2px solid var(--analytics-selection-border);
    outline-offset: 2px;
}

.period-change-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1200;
    display: none;
    width: max-content;
    min-width: 240px;
    max-width: 360px;
    max-height: 280px;
    gap: 6px;
    padding: 10px;
    overflow: auto;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px color-mix(in srgb, black 32%, transparent);
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translateY(-3px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
    visibility: hidden;
    white-space: normal;
}

.period-change-tooltip.is-floating {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    display: grid;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.period-metrics-row:has(.period-change-marker:hover),
.period-metrics-row:has(.period-change-marker:focus-visible),
.period-metrics-row:has(.period-change-marker:focus-within) {
    position: relative;
    z-index: 100;
}

.period-cell:has(.period-change-marker:hover),
.period-cell:has(.period-change-marker:focus-visible),
.period-cell:has(.period-change-marker:focus-within) {
    z-index: 110;
    overflow: visible;
}

.period-change-marker:hover .period-change-tooltip,
.period-change-marker:focus-visible .period-change-tooltip,
.period-change-marker:focus-within .period-change-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.period-change-tooltip-title {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
}

.period-change-tooltip-date {
    margin-top: 2px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
}

.period-change-tooltip-item {
    display: grid;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid color-mix(in srgb, var(--analytics-table-border) 78%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--surface-soft) 78%, var(--surface-strong));
}

.period-change-tooltip-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.period-change-tooltip-metrics span {
    padding: 2px 6px;
    color: var(--accent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-strong) 14%, transparent);
    font-size: 0.74rem;
    font-weight: 800;
}

.period-change-tooltip-comment {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    min-height: 26px;
    padding: 2px 4px;
    overflow: hidden;
    color: var(--accent);
    background: none;
    border: 0;
    border-radius: 6px;
    font-weight: 700;
}

.sort-button span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-header-row th {
    position: sticky;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    bottom: 0;
    z-index: 4;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}

.column-resize-handle::after {
    content: "";
    position: absolute;
    top: 25%;
    right: 3px;
    bottom: 25%;
    width: 1px;
    background: transparent;
}

.column-resize-handle:hover::after,
.column-resize-handle:focus-visible::after,
.is-resizing-columns .column-resize-handle::after {
    background: var(--analytics-selection-border);
}

.is-resizing-columns,
.is-resizing-columns * {
    cursor: col-resize;
    user-select: none;
}

.sort-button:hover {
    background: color-mix(in srgb, var(--accent-strong) 8%, transparent);
}

.sort-button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--analytics-selection-border) 72%, transparent);
    outline-offset: 2px;
}

.sort-indicator {
    color: var(--accent-strong);
    font-size: 0.85rem;
}

.table-toggle {
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
}

.detail-table-row td {
    padding: 0;
    border-bottom: 1px solid var(--analytics-table-border);
    background: var(--surface-soft);
}

.detail-table-row.is-hidden {
    display: none;
}

.detail-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 16px 18px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-weight: 600;
}

.detail-state-loading {
    background: var(--surface-soft);
}

.detail-state-error {
    background: var(--notice-error-bg);
    color: var(--notice-error-text);
}

.detail-retry-button {
    padding: 7px 10px;
    color: var(--notice-error-text);
    border-color: color-mix(in srgb, var(--notice-error-text) 38%, var(--border-strong));
    background: color-mix(in srgb, var(--surface-strong) 80%, var(--notice-error-bg));
}

.detail-table-cell {
    position: sticky;
    left: 0;
    padding: 0;
    width: max(320px, calc(100vw - 72px));
    max-width: max(320px, calc(100vw - 72px));
}

.detail-panel {
    width: 100%;
    padding: 14px 12px;
    background: color-mix(in srgb, var(--surface-soft) 78%, var(--surface-strong));
    border-top: 1px solid var(--analytics-table-border);
    overflow-x: visible;
}

.detail-title {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-section + .detail-section {
    margin-top: 22px;
}

.detail-section-title {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 700;
}

.detail-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 14px;
    margin: 0 0 8px;
}

.detail-section-header .detail-section-title {
    margin: 0;
}

.detail-section-header .detail-title {
    margin: 0;
}

.cluster-queries-body.is-collapsed {
    display: none;
}

.cluster-queries-body .table-wrap > table {
    margin-right: auto;
    margin-left: 0;
}

.query-history-anchor.is-hidden,
.query-history-item.is-hidden {
    display: none;
}

.query-history-anchor > td {
    padding: 0;
}

.query-history-heading-row > td {
    padding: 10px 18px 7px 46px;
    border-top: 1px solid color-mix(in srgb, var(--accent) 22%, var(--analytics-table-border));
    border-bottom: 0;
    background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface-strong));
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 62%, transparent);
}

.query-period-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.query-period-heading strong {
    color: var(--text);
}

.query-period-note {
    margin: 0 0 10px;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.query-period-columns-row > th,
.query-period-data-row > td {
    padding: 7px 10px;
    border-right: 1px solid color-mix(in srgb, var(--analytics-table-border) 54%, transparent);
    border-bottom: 1px solid var(--analytics-table-border);
    vertical-align: middle;
    font-size: 0.8rem;
}

.query-period-columns-row > th {
    position: static;
    color: var(--accent);
    background: color-mix(in srgb, var(--surface-soft) 70%, var(--surface-strong));
}

.query-period-columns-row > th:last-child,
.query-period-data-row > td:last-child {
    border-right: 0;
}

.query-period-data-row.query-period-alt > td:not(.is-selected):not(.is-range-selected):not(.metric-band-good):not(.metric-band-warn):not(.metric-gradient) {
    background: color-mix(in srgb, var(--surface-soft) 48%, var(--surface-strong));
}

.query-history-empty-row > td {
    padding: 12px 18px 12px 46px;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface-strong));
}

.query-name-content {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.query-name-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.query-history-toggle {
    display: inline-grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    padding: 0;
    place-items: center;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
}

.query-history-toggle span {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.14s ease;
}

.query-history-toggle:hover,
.query-history-toggle:focus-visible {
    color: var(--accent);
    border-color: var(--border-strong);
    background: var(--surface-soft);
}

.query-history-toggle.is-open span {
    transform: rotate(90deg);
}

.query-history-toggle:disabled {
    cursor: wait;
    opacity: 0.55;
}

.query-cluster-status {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    border-radius: 4px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.ad-cluster-dot {
    display: inline-block;
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    cursor: help;
}

.ad-cluster-dot.is-active {
    color: var(--status-imported-text);
}

.ad-cluster-dot.is-partially_excluded {
    color: var(--status-uploaded-text);
}

.ad-cluster-dot.is-excluded {
    color: var(--text-muted);
}

.ad-cluster-dot.is-none {
    border: 1px solid var(--border-strong);
    background: transparent;
    color: transparent;
}

.ad-cluster-dot:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.ad-cluster-legend {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.ad-cluster-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ad-cluster-legend .ad-cluster-dot {
    cursor: default;
}

.detail-column-tools {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 12px;
    margin: 0;
    padding: 0;
}

.detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--analytics-table-border) 80%, var(--border-strong));
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-strong) 72%, var(--surface-soft));
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
}

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

.hidden-columns-panel {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding-left: 12px;
    border-left: 1px solid color-mix(in srgb, var(--analytics-table-border) 70%, transparent);
}

.pinned-columns-panel {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px dashed color-mix(in srgb, var(--analytics-table-border) 82%, var(--border-strong));
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
    transition: border-color 0.16s ease, background 0.16s ease;
}

.pinned-columns-panel.is-column-pin-target {
    border-color: var(--analytics-selection-border);
    background: color-mix(in srgb, var(--analytics-selection-bg) 56%, var(--surface-strong));
}

.pinned-columns-title,
.pinned-columns-empty,
.hidden-columns-title,
.hidden-columns-empty {
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

.pinned-columns-list,
.hidden-columns-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pinned-column-chip,
.hidden-column-chip {
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border-strong));
    border-radius: 7px;
    background: color-mix(in srgb, var(--surface-strong) 84%, var(--surface-soft));
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.pinned-column-chip {
    border-color: color-mix(in srgb, var(--analytics-selection-border) 56%, var(--border-strong));
    color: var(--text);
}

.pinned-column-chip:hover,
.hidden-column-chip:hover {
    background: color-mix(in srgb, var(--accent-strong) 8%, var(--surface-strong));
}

.detail-metrics-table {
    min-width: 0;
}

.detail-metrics-table-primary,
.detail-metrics-table-combined {
    min-width: 0;
}

.detail-metrics-table-secondary {
    min-width: 0;
}

.detail-metrics-table-combined thead .column-header-row th {
    top: 0;
    cursor: grab;
}

.detail-metrics-table-combined thead .column-header-row th.is-column-pinned {
    left: var(--pinned-left, 0);
    z-index: 44;
}

.detail-metrics-table-combined thead .column-header-row th:active,
.is-column-dragging .detail-metrics-table-combined thead .column-header-row th {
    cursor: grabbing;
}

.detail-metrics-table-combined .sort-button {
    cursor: inherit;
}

.detail-panel .table-wrap {
    width: 100%;
}

.is-column-hidden {
    display: none;
}

col.is-column-hidden {
    visibility: collapse;
}

.is-empty-ad-period-hidden {
    display: none;
}

.is-dragged-column {
    opacity: 0.64;
}

.is-reordering-columns {
    user-select: none;
}

.is-column-hide-target {
    outline: 2px dashed color-mix(in srgb, var(--accent-strong) 72%, transparent);
    outline-offset: 4px;
}

.detail-empty-state {
    margin: 10px 0 0;
}

.inline-status {
    margin: 0 0 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.inline-status-success {
    background: var(--notice-success-bg);
    color: var(--notice-success-text);
}

.inline-status-error {
    background: var(--notice-error-bg);
    color: var(--notice-error-text);
}

.cluster-change-form {
    display: grid;
    gap: 10px;
    width: min(100%, 1180px);
    margin: 0 0 12px;
}

.cluster-change-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
}

.cluster-change-form label {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.cluster-change-form input,
.cluster-change-form textarea {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font: inherit;
}

.cluster-change-form textarea {
    resize: vertical;
}

.cluster-change-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.cluster-change-form-actions button {
    min-height: 40px;
    white-space: nowrap;
}

.change-feed-card {
    display: grid;
    gap: 12px;
}

.change-feed-header {
    margin-bottom: 0;
}

.change-feed-header h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.change-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.change-feed-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.change-item {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--analytics-table-border) 76%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-soft) 78%, var(--surface-strong));
}

.change-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-start;
    gap: 6px 12px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.change-item-head strong {
    color: var(--accent);
}

.change-item p {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.change-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.change-metrics span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-strong) 12%, var(--surface-strong));
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 800;
}

.change-context-link {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.change-context-link:hover {
    text-decoration: underline;
}

.change-delete-button {
    justify-self: flex-start;
    min-height: 30px;
    padding: 6px 9px;
    color: var(--notice-error-text);
    border-color: color-mix(in srgb, var(--notice-error-text) 36%, var(--border-strong));
    font-size: 0.86rem;
}

.cluster-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.cluster-header h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.cluster-meta {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.metrics-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.metric {
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface-strong);
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 1.1rem;
}

.metric-label {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.cluster-detail-slot {
    padding-top: 4px;
}

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

    .theme-toggle {
        width: 100%;
    }

    .cluster-change-form {
        grid-template-columns: 1fr;
    }
}

.page-login {
    max-width: 420px;
}

.login-card {
    display: grid;
    gap: 20px;
}

.login-header h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.login-header p {
    margin: 0;
    color: var(--text-muted);
}

/* Панель администратора */

.panel-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.panel-tabs a {
    padding: 8px 16px;
    border-radius: 10px 10px 0 0;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}

.panel-tabs a:hover {
    background: var(--surface-strong);
    color: var(--text);
}

.panel-tabs a.is-active {
    background: var(--surface-strong);
    color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.audit-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface-soft);
}

.audit-filters label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.checkbox-label input {
    width: auto;
}

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

.row-actions input[type="password"] {
    width: 150px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.pagination-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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