:root {
    --app-primary: #9ecd27;
    --app-primary-dark: #77a319;
    --app-secondary: #24a3db;
    --app-warning: #b45309;
    --app-warning-tint: #fff7d6;
    --app-danger: #dc2626;
    --app-bg: #f5f7f9;
    --app-surface: rgba(255, 255, 255, 0.92);
    --app-surface-solid: #fff;
    --app-border: #dde4ea;
    --app-text: #273444;
    --app-muted: #6b7787;
    --app-sidebar-width: 18rem;
    --app-radius: 1rem;
    --app-shadow: 0 0.75rem 2rem rgba(31, 45, 61, 0.08);
    color-scheme: light;
}

[data-bs-theme="dark"] {
    --app-warning: #fcd34d;
    --app-warning-tint: rgba(245, 158, 11, 0.16);
    --app-danger: #fca5a5;
    --app-bg: #111820;
    --app-surface: rgba(29, 39, 50, 0.92);
    --app-surface-solid: #1d2732;
    --app-border: #344353;
    --app-text: #eef3f6;
    --app-muted: #a5b1be;
    --app-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.22);
    color-scheme: dark;
}

html {
    min-width: 20rem;
    background: var(--app-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 94% 3%, rgba(36, 163, 219, 0.1), transparent 22rem),
        var(--app-bg);
    color: var(--app-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--app-primary-dark);
}

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

.app-layout {
    display: flex;
}

.app-main {
    min-width: 0;
    flex: 1;
    padding-left: var(--app-sidebar-width);
}

.app-glass {
    border: 1px solid rgba(221, 228, 234, 0.72);
    background: var(--app-surface);
    backdrop-filter: blur(1rem);
}

[data-bs-theme="dark"] .app-glass {
    border-color: rgba(52, 67, 83, 0.82);
}

.app-glass-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(0.75rem);
}

.app-sidebar {
    position: fixed;
    z-index: 1030;
    inset: 0 auto 0 0;
    width: var(--app-sidebar-width);
    padding: 1.5rem 1.25rem;
    border-width: 0 1px 0 0;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0 0 2rem;
    color: var(--app-text);
    text-decoration: none;
}

.app-brand > span:last-child {
    display: grid;
}

.app-brand strong {
    font-size: 1.22rem;
    line-height: 1.2;
}

.app-brand small {
    color: var(--app-muted);
    font-size: 0.76rem;
}

.app-brand-mark {
    display: inline-grid;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 0.8rem;
    background: linear-gradient(145deg, #b5df45, var(--app-primary));
    box-shadow: 0 0.5rem 1.15rem rgba(119, 163, 25, 0.25);
    color: #26330c;
    font-size: 1.25rem;
}

.app-nav {
    display: grid;
    gap: 0.4rem;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.78rem 0.9rem;
    border-radius: 0.75rem;
    color: var(--app-muted);
    font-weight: 650;
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.app-nav-link:hover {
    background: rgba(158, 205, 39, 0.1);
    color: var(--app-text);
    transform: translateX(0.15rem);
}

.app-nav-link.is-active {
    background: rgba(158, 205, 39, 0.17);
    color: var(--app-primary-dark);
}

[data-bs-theme="dark"] .app-nav-link.is-active {
    color: #c1e663;
}

.app-nav-link i {
    width: 1.3rem;
    font-size: 1.1rem;
}

.app-system-status {
    display: grid;
    gap: 0.72rem;
    padding: 1rem 0.7rem 0;
    border-top: 1px solid var(--app-border);
}

.app-system-status-heading {
    color: var(--app-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.app-system-status-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-system-status-copy {
    display: grid;
    min-width: 0;
}

.app-system-status-copy strong,
.app-system-status-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-system-status-copy strong {
    font-size: 0.77rem;
    line-height: 1.2;
}

.app-system-status-copy small {
    color: var(--app-muted);
    font-size: 0.7rem;
}

.app-status-led {
    width: 0.62rem;
    height: 0.62rem;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background: var(--app-muted);
    box-shadow: 0 0 0 0.22rem rgba(107, 119, 135, 0.1);
}

.app-status-led-success {
    background: #22c55e;
    box-shadow: 0 0 0 0.22rem rgba(34, 197, 94, 0.12), 0 0 0.65rem rgba(34, 197, 94, 0.34);
}

.app-status-led-info {
    background: var(--app-secondary);
    box-shadow: 0 0 0 0.22rem rgba(36, 163, 219, 0.12), 0 0 0.65rem rgba(36, 163, 219, 0.34);
}

.app-status-led-warning {
    background: #f59e0b;
    box-shadow: 0 0 0 0.22rem rgba(245, 158, 11, 0.12), 0 0 0.65rem rgba(245, 158, 11, 0.3);
}

.app-status-led-danger {
    background: #ef4444;
    box-shadow: 0 0 0 0.22rem rgba(239, 68, 68, 0.12), 0 0 0.65rem rgba(239, 68, 68, 0.3);
}

.app-user-avatar {
    display: inline-grid;
    width: 2.45rem;
    height: 2.45rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: rgba(36, 163, 219, 0.13);
    color: var(--app-secondary);
    font-weight: 750;
}

.app-topbar {
    position: sticky;
    z-index: 1020;
    top: 0;
    display: flex;
    min-height: 4.8rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem clamp(1rem, 3vw, 2rem);
    border-width: 0 0 1px;
}

.app-topbar-title {
    font-size: 1.05rem;
    font-weight: 750;
}

.app-topbar-subtitle,
.app-text-muted {
    color: var(--app-muted);
    font-size: 0.82rem;
}

.app-topbar-user {
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    color: var(--app-text);
    font-size: 0.78rem;
    font-weight: 700;
}

.app-topbar-user-name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user-avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.app-icon-button {
    display: inline-grid;
    width: 2.55rem;
    height: 2.55rem;
    padding: 0;
    place-items: center;
    border-color: var(--app-border);
    border-radius: 0.7rem;
    color: var(--app-text);
}

.app-icon-button:hover {
    border-color: var(--app-primary);
    background: rgba(158, 205, 39, 0.12);
    color: var(--app-text);
}

.app-content {
    width: min(100%, 96rem);
    margin-inline: auto;
    padding: clamp(1.1rem, 3vw, 2rem);
}

.app-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.app-page-header-eyebrow,
.app-login-heading p {
    margin: 0 0 0.35rem;
    color: var(--app-primary-dark);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

[data-bs-theme="dark"] .app-page-header-eyebrow,
[data-bs-theme="dark"] .app-login-heading p {
    color: #c1e663;
}

.app-page-header h1 {
    margin: 0;
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    font-weight: 780;
    letter-spacing: -0.03em;
}

.app-page-header-subtitle {
    max-width: 50rem;
    margin: 0.45rem 0 0;
    color: var(--app-muted);
}

.app-modal .modal-content {
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: var(--app-surface-solid);
    color: var(--app-text);
    box-shadow: var(--app-shadow);
}

.app-modal .modal-header,
.app-modal .modal-footer {
    border-color: var(--app-border);
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.dashboard-kpi-icon-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #d97706;
}

.app-table-card,
.app-detail-panel,
.app-filter-bar,
.history-chart-card {
    min-width: 0;
}

.app-table-card {
    overflow: hidden;
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--app-border);
}

.app-card-header h2,
.app-detail-panel h2,
.history-chart-card h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 750;
}

.history-chart-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.3rem;
    border-radius: 50%;
    background: var(--app-warning-tint);
    color: var(--app-warning);
    cursor: help;
    font-size: 0.78rem;
    vertical-align: -0.08rem;
}

.app-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    color: var(--app-muted);
    font-size: 0.8rem;
}

.app-breadcrumb a {
    color: var(--app-muted);
    text-decoration: none;
}

.app-breadcrumb a:hover,
.app-breadcrumb a:focus-visible {
    color: var(--app-primary-dark);
    text-decoration: underline;
}

.app-card-header p,
.app-detail-panel p {
    margin: 0.25rem 0 0;
    color: var(--app-muted);
    font-size: 0.86rem;
}

.app-url-discovery-actions,
.app-inline-action,
.app-card-header-actions,
#url-selection-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.app-url-discovery-actions {
    justify-content: flex-end;
}

.app-inline-action .form-select {
    width: auto;
    min-width: 6.25rem;
}

.app-card-header-actions {
    justify-content: flex-end;
}

.app-url-setup {
    display: grid;
    gap: 0.85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-url-setup-panel {
    margin-bottom: 1rem;
}

.app-url-setup-step,
.app-url-manual {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-url-setup-step > div {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.app-url-setup-number {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: rgba(158, 205, 39, 0.16);
    color: var(--app-primary-dark);
    font-weight: 800;
}

.app-url-setup h2,
.app-url-manual h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.app-url-setup p,
.app-url-manual p {
    margin: 0.15rem 0 0;
    color: var(--app-muted);
    font-size: 0.82rem;
}

.app-url-manual {
    margin-top: 1rem;
}

.app-url-filter {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--app-border);
}

.app-url-filter label {
    flex: 0 0 auto;
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.app-url-filter .form-control {
    max-width: 25rem;
}

.app-url-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.app-url-filter-options .app-check-field {
    font-size: 0.8rem;
    font-weight: 600;
}

.app-url-manual small {
    color: var(--app-muted);
    font-size: 0.8em;
    font-weight: 500;
}

.app-crux-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-crux-status.is-available { color: #16803c; }
.app-crux-status.is-unavailable { color: var(--app-muted); }
.app-crux-status.is-unverified { color: var(--app-secondary); }

[data-bs-theme="dark"] .app-crux-status.is-available { color: #86efac; }

.app-crux-checked {
    display: block;
    margin-top: 0.18rem;
    color: var(--app-muted);
    font-size: 0.72rem;
}

.app-data-table {
    min-width: 58rem;
    margin: 0;
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-text);
    --bs-table-border-color: var(--app-border);
}

.app-data-table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
}

.app-data-table thead th {
    border-bottom-width: 1px;
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
}

.app-sort-link:hover,
.app-sort-link:focus-visible,
.app-sort-link.is-active {
    color: var(--app-secondary);
}

.app-sort-link:focus-visible {
    border-radius: 0.2rem;
    outline: 2px solid color-mix(in srgb, var(--app-secondary) 55%, transparent);
    outline-offset: 0.2rem;
}

.app-sort-link .bi {
    font-size: 0.72rem;
}

.app-data-table tbody tr {
    transition: background-color 120ms ease;
}

.app-data-table tbody tr:hover {
    background: rgba(158, 205, 39, 0.055);
}

.app-table-primary {
    display: block;
    color: var(--app-text);
    font-weight: 720;
    text-decoration: none;
}

.app-table-primary:hover {
    color: var(--app-primary-dark);
}

.app-data-table td small {
    display: block;
    max-width: 26rem;
    overflow: hidden;
    margin-top: 0.18rem;
    color: var(--app-muted);
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-data-table td small a {
    color: var(--app-muted);
    text-decoration: none;
}

.app-data-table td small a:hover,
.app-data-table td small a:focus-visible {
    color: var(--app-primary-dark);
    text-decoration: underline;
}

.metric-value,
.status-badge,
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 750;
    white-space: nowrap;
}

.metric-value {
    min-width: 4.8rem;
    justify-content: center;
    padding: 0.32rem 0.55rem;
}

.metric-value-good {
    background: rgba(34, 197, 94, 0.13);
    color: #16803a;
}

.metric-value-needs-improvement {
    background: rgba(245, 158, 11, 0.15);
    color: #b85d05;
}

.metric-value-poor {
    background: rgba(239, 68, 68, 0.13);
    color: #c62f2f;
}

.metric-value-missing {
    background: rgba(107, 119, 135, 0.1);
    color: var(--app-muted);
}

.metric-heading {
    display: inline-grid;
    gap: 0.1rem;
    white-space: nowrap;
}

.metric-heading > span:last-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.metric-help {
    position: relative;
    display: inline-grid;
    width: 1rem;
    height: 1rem;
    place-items: center;
    border-radius: 50%;
    border: 0;
    background: var(--app-secondary);
    color: #fff;
    cursor: help;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
}

.comparison-updates {
    min-width: 0;
}

.comparison-updates > span {
    display: block;
    white-space: nowrap;
}

.comparison-updates .source-badge {
    margin-left: 0.2rem;
    padding: 0.08rem 0.3rem;
    font-size: 0.62rem;
    font-style: normal;
}

.app-data-table-comparison {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.app-data-table-comparison > :not(caption) > * > * {
    padding: 0.65rem 0.4rem;
}

.app-data-table-comparison thead th {
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.app-data-table-comparison th:first-child,
.app-data-table-comparison td:first-child {
    width: 18%;
}

.app-data-table-comparison > :not(caption) > * > :first-child {
    padding-left: 1rem;
}

.app-data-table-comparison th:nth-child(2),
.app-data-table-comparison td:nth-child(2) {
    width: 14%;
}

.app-data-table-comparison .comparison-updates {
    font-size: 0.76rem;
}

[data-bs-theme="dark"] .metric-value-good { color: #6ee795; }
[data-bs-theme="dark"] .metric-value-needs-improvement { color: #f7bd58; }
[data-bs-theme="dark"] .metric-value-poor { color: #ff8585; }

.status-badge {
    padding: 0.3rem 0.55rem;
}

.status-badge-success { background: rgba(34, 197, 94, 0.13); color: #16803a; }
.status-badge-queued { background: rgba(107, 119, 135, 0.12); color: var(--app-muted); }
.status-badge-partial { background: rgba(245, 158, 11, 0.15); color: #b85d05; }
.status-badge-error { background: rgba(239, 68, 68, 0.13); color: #c62f2f; }
.status-badge-running { background: rgba(36, 163, 219, 0.13); color: #157ca9; }
.status-badge-cancelled { background: rgba(107, 119, 135, 0.12); color: var(--app-muted); }

[data-bs-theme="dark"] .status-badge-success { color: #6ee795; }
[data-bs-theme="dark"] .status-badge-partial { color: #f7bd58; }
[data-bs-theme="dark"] .status-badge-error { color: #ff8585; }
[data-bs-theme="dark"] .status-badge-running { color: #71cdf4; }

.source-badge {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--app-border);
    color: var(--app-muted);
}

.source-badge-psi_lab {
    border-color: rgba(245, 158, 11, 0.35);
    color: #b85d05;
}

[data-bs-theme="dark"] .source-badge-psi_lab {
    color: #f7bd58;
}

.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--app-muted);
}

.status-dot.is-active {
    background: #22c55e;
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.12);
}

.is-spinning {
    animation: app-spin 1s linear infinite;
}

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

.app-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.app-filter-bar > .btn {
    height: 3rem !important;
    min-height: 3rem !important;
}

.app-filter-field {
    display: grid;
    min-width: 10rem;
    gap: 0.35rem;
}

.app-filter-field-grow {
    min-width: 15rem;
    flex: 1;
}

.app-filter-field label {
    color: var(--app-muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.form-select {
    min-height: 3rem;
    border-color: var(--app-border);
    border-radius: 0.7rem;
    background-color: var(--app-surface-solid);
    color: var(--app-text);
}

.app-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.app-detail-panel {
    padding: 1.25rem;
}

.app-definition-list {
    display: grid;
    gap: 0.7rem;
    margin: 1rem 0 0;
}

.app-definition-list > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--app-border);
}

.app-definition-list dt {
    color: var(--app-muted);
    font-weight: 500;
}

.app-definition-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

.app-highlight-value {
    margin-top: 1rem;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 800;
}

.history-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.history-stat {
    display: grid;
    gap: 0.25rem;
    padding: 1rem;
}

.history-stat span {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 750;
}

.history-stat strong {
    font-size: 1.15rem;
}

.history-stat small {
    color: var(--app-muted);
    font-size: 0.7rem;
}

.histogram-panel { margin-bottom: 1rem; padding: 1rem; }
.histogram-metric-buttons { display: inline-flex; flex-wrap: nowrap; justify-content: flex-end; gap: .25rem; white-space: nowrap; }
.histogram-metric-buttons .btn { min-width: 3.25rem; padding-inline: .4rem; }
.histogram-opportunity { margin: .45rem 0 0; color: var(--app-text); font-size: .82rem; }
.histogram-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.histogram-grid h3 { font-size: 0.85rem; margin: 0 0 0.65rem; }
.histogram-bars { display: flex; align-items: end; gap: 0.25rem; height: 9rem; padding: 0.5rem; overflow: hidden; border-bottom: 1px solid var(--app-border); background: repeating-linear-gradient(to top, transparent 0 2.2rem, rgba(127,140,153,.14) 2.2rem 2.25rem); }
.histogram-bin { flex: 1; min-width: 0.8rem; max-height: 100%; cursor: help; transition: filter .15s ease, transform .15s ease; }
.histogram-bin:hover { filter: saturate(1.15) brightness(.94); transform: translateY(-2px); }
.histogram-bin-good { background: #67d691; }
.histogram-bin-needs_improvement { background: #fdc583; }
.histogram-bin-poor { background: #ff8c8c; }
.histogram-summary { display: flex; justify-content: space-between; gap: 0.4rem; margin-top: .5rem; color: var(--app-muted); font-size: .72rem; }

.history-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.history-change-legend {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
}

.history-change-legend-title {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.55rem;
    min-height: 1.7rem;
    font-size: 0.78rem;
}

.history-change-line-sample {
    position: relative;
    width: 1.25rem;
    height: 1.35rem;
    border-left: 2px dashed var(--app-secondary);
}

.history-change-line-sample::before {
    position: absolute;
    top: 0.05rem;
    left: -0.3rem;
    width: 0.48rem;
    height: 0.48rem;
    background: var(--app-secondary);
    content: "";
    transform: rotate(45deg);
}

.history-change-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.history-change-item {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.55rem;
    border: 1px solid rgba(36, 163, 219, 0.22);
    border-radius: 999px;
    background: rgba(36, 163, 219, 0.08);
    color: var(--app-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.history-change-item:hover,
.history-change-item:focus-visible,
.history-change-item.is-active {
    border-color: var(--app-secondary);
    background: rgba(36, 163, 219, 0.17);
    box-shadow: 0 0 0 0.18rem rgba(36, 163, 219, 0.1);
    color: var(--app-text);
    outline: none;
}

.history-change-item time,
.history-change-item.is-active time {
    color: var(--app-secondary);
    font-weight: 750;
}

.history-chart-card {
    padding: 1rem;
}

.history-chart {
    height: 16rem;
    margin-top: 0.75rem;
}

.change-note {
    display: flex;
    gap: 0.35rem;
    max-width: 18rem;
    margin-top: 0.4rem;
    color: var(--app-secondary);
    font-size: 0.74rem;
}

.app-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
}

.app-empty-inline {
    padding: 2rem;
    color: var(--app-muted);
    text-align: center;
}

.change-timeline {
    padding: 1.25rem;
}

.change-timeline-item {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--app-border);
}

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

.change-timeline-item time {
    color: var(--app-muted);
    font-size: 0.82rem;
}

.change-timeline-item h2 {
    margin: 0;
    font-size: 1rem;
}

.change-timeline-item p {
    margin: 0.3rem 0 0;
    color: var(--app-muted);
}

.dashboard-kpi {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    min-height: 7rem;
    padding: 1.15rem;
}

.dashboard-kpi > div {
    display: grid;
    gap: 0.18rem;
}

.dashboard-kpi-icon {
    display: inline-grid;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 0.85rem;
    background: rgba(158, 205, 39, 0.14);
    color: var(--app-primary-dark);
    font-size: 1.25rem;
}

.dashboard-kpi-icon-secondary {
    background: rgba(36, 163, 219, 0.13);
    color: var(--app-secondary);
}

.dashboard-kpi-label {
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-kpi strong {
    font-size: 1.04rem;
}

.dashboard-kpi small {
    color: var(--app-muted);
    font-size: 0.72rem;
}

.dashboard-card {
    padding: clamp(1.1rem, 3vw, 1.5rem);
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--app-border);
}

.dashboard-card-header h2,
.app-empty-state h2 {
    margin: 0;
    font-size: 1.08rem;
}

.dashboard-card-header p,
.app-empty-state p {
    margin: 0.3rem 0 0;
    color: var(--app-muted);
}

.dashboard-card-header > i {
    color: var(--app-secondary);
    font-size: 1.35rem;
}

.app-empty-state {
    display: grid;
    justify-items: center;
    padding: clamp(2rem, 6vw, 4rem) 1rem;
    text-align: center;
}

.app-empty-state > i {
    margin-bottom: 0.8rem;
    color: var(--app-primary-dark);
    font-size: 2.2rem;
}

.app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

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

.app-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    white-space: nowrap;
}

.app-table-actions form,
.app-actions form {
    margin: 0;
}

.app-form-panel {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.app-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

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

.app-form-field small {
    color: var(--app-muted);
    font-size: 0.75rem;
}

.app-form-field textarea {
    resize: vertical;
}

.app-code-input {
    font-family: var(--bs-font-monospace);
    font-size: 0.86rem;
}

.app-check-field {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--app-text);
    font-weight: 700;
}

.app-check-field input,
.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    border-color: var(--app-border);
}

.app-check-field input:checked,
.form-check-input:checked {
    border-color: var(--app-primary-dark);
    background-color: var(--app-primary-dark);
}

.app-inline-form {
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
}

.app-inline-form .app-form-field {
    flex: 1;
}

.app-admin-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-end;
    gap: 1rem;
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.admin-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    color: var(--app-text);
    text-decoration: none;
    transition: border-color 120ms ease, transform 120ms ease;
}

.admin-card:hover {
    border-color: rgba(158, 205, 39, 0.65);
    color: var(--app-text);
    transform: translateY(-2px);
}

.admin-card > i:first-child {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    place-items: center;
    border-radius: 0.8rem;
    background: rgba(158, 205, 39, 0.14);
    color: var(--app-primary-dark);
    font-size: 1.2rem;
}

.admin-card span {
    display: grid;
    gap: 0.2rem;
}

.admin-card small {
    color: var(--app-muted);
}

.admin-card > i:last-child {
    color: var(--app-muted);
}

.app-mobile-nav {
    --bs-offcanvas-width: min(19rem, 88vw);
    background: var(--app-surface-solid);
}

.app-login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1rem;
}

.app-login-shell {
    display: grid;
    width: min(100%, 68rem);
    min-height: min(42rem, calc(100vh - 2rem));
    grid-template-columns: minmax(0, 1.2fr) minmax(22rem, 0.8fr);
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 1.35rem;
    box-shadow: var(--app-shadow);
}

.app-login-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
    background:
        linear-gradient(150deg, rgba(28, 49, 61, 0.15), rgba(21, 33, 44, 0.85)),
        radial-gradient(circle at 20% 15%, #b7dc58, transparent 32%),
        linear-gradient(135deg, #24a3db, #182634 72%);
    color: #fff;
}

.app-login-visual::after {
    position: absolute;
    width: 18rem;
    height: 18rem;
    border: 3rem solid rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    content: "";
    inset: -6rem -4rem auto auto;
}

.app-login-visual-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-login-visual-mark {
    display: inline-grid;
    width: 4.25rem;
    height: 4.25rem;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.75rem;
    backdrop-filter: blur(0.5rem);
}

.app-login-visual-content p {
    margin: 0 0 0.15rem;
    opacity: 0.78;
}

.app-login-visual-content strong {
    font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.app-login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.app-login-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: clamp(2rem, 6vw, 4rem);
}

.app-login-brand > div {
    display: grid;
}

.app-login-brand span:not(.app-brand-mark) {
    font-weight: 800;
}

.app-login-brand small {
    color: var(--app-muted);
    font-size: 0.75rem;
}

.app-login-heading {
    margin-bottom: 1.5rem;
}

.app-login-heading h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 780;
}

.app-login-form {
    display: grid;
    gap: 1rem;
}

.app-form-field {
    display: grid;
    gap: 0.42rem;
}

.app-form-field label {
    color: var(--app-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.form-control {
    min-height: 3rem;
    border-color: var(--app-border);
    border-radius: 0.7rem;
    background: var(--app-surface-solid);
    color: var(--app-text);
}

.form-control:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(158, 205, 39, 0.16);
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-color: #26330c;
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
    --bs-btn-hover-color: #fff;
    font-weight: 750;
}

.app-login-submit {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 0.3rem;
    border-radius: 0.7rem;
}

@media (max-width: 991.98px) {
    .app-main {
        padding-left: 0;
    }

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

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

    .app-login-shell {
        grid-template-columns: 1fr;
    }

    .app-login-visual {
        min-height: 14rem;
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem;
    }

    .app-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .app-filter-bar,
    .app-detail-grid,
    .app-form-grid,
    .app-admin-split,
    .admin-card-grid,
    .history-chart-grid {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .app-filter-field,
    .app-filter-field-grow {
        min-width: 0;
        width: 100%;
    }

    .app-inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .app-url-setup-step,
    .app-url-manual {
        align-items: stretch;
        flex-direction: column;
    }

    .app-url-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .app-url-filter .form-control {
        max-width: none;
    }

    .app-url-filter-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .history-stat-grid {
        grid-template-columns: 1fr;
    }

    .history-change-legend {
        flex-direction: column;
        gap: 0.55rem;
    }

    .change-timeline-item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .app-login-body {
        padding: 0;
    }

    .app-login-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .app-login-visual {
        display: none;
    }

    .app-login-panel {
        padding: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .is-spinning {
        animation: none;
    }
}
