:root {
    --dsl-brand: #4f46e5;
    --dsl-brand-2: #0ea5e9;
    --dsl-ink: #0f172a;
}

/* Darker dark theme than Bootstrap's default grey. */
[data-bs-theme="dark"] {
    --bs-body-bg: #101216;
    --bs-body-color: #d6dae1;
    --bs-secondary-bg: #191c21;
    --bs-tertiary-bg: #191c21;
    --bs-border-color: #2b2f36;
    --bs-card-bg: #191c21;
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bs-body-bg);
}

.app-navbar {
    background: linear-gradient(100deg, #312e81 0%, #4f46e5 45%, #0ea5e9 100%);
    box-shadow: 0 2px 14px rgba(15, 23, 42, .18);
}

.app-navbar .navbar-brand,
.app-navbar .nav-link {
    color: rgba(255, 255, 255, .9);
}

.app-navbar .nav-link {
    border-radius: .5rem;
    padding: .35rem .65rem;
}

/* Keep every state white-on-translucent (the default navbar active/hover colours are
   dark, which flashed black on click). */
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link:focus-visible,
.app-navbar .nav-link:active,
.app-navbar .nav-link.active,
.app-navbar .nav-link.show {
    color: #fff;
    background-color: rgba(255, 255, 255, .14);
    outline: 0;
    box-shadow: none;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .4);
}

.app-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .2);
}

.app-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%23e2e8f0' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    filter: none;
}

.app-navbar a,
.app-navbar button,
.app-navbar select {
    -webkit-tap-highlight-color: transparent;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-size: 1.05rem;
}

.app-footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
}

.card {
    border: 1px solid var(--bs-border-color);
    border-radius: .85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.table-card {
    overflow: hidden;
}

.table-card .table-responsive > .table > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

.stat-tile {
    border-radius: .85rem;
    padding: 1rem 1.1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    height: 100%;
}

.stat-tile .stat-value {
    font-size: 1.6rem;
    font-weight: 650;
    line-height: 1.1;
}

.stat-tile .stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
}

.stat-tile .stat-icon {
    font-size: 1.4rem;
    opacity: .75;
}

.hero {
    background: radial-gradient(1200px 400px at 10% -10%, rgba(79, 70, 229, .18), transparent),
                radial-gradient(900px 380px at 90% -20%, rgba(14, 165, 233, .18), transparent);
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
}

.member-dashboard {
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--bs-body-bg);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .06);
}

.member-dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    background: radial-gradient(900px 260px at 5% 0%, rgba(79, 70, 229, .14), transparent),
                radial-gradient(700px 260px at 95% 0%, rgba(14, 165, 233, .12), transparent);
}

.member-dashboard-heading .hero-eyebrow {
    margin-bottom: .65rem;
    color: #3730a3;
}

.member-dashboard-heading h1 {
    overflow-wrap: anywhere;
}

.dashboard-line-summary {
    margin: 0 1.25rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .9rem;
    background: var(--bs-tertiary-bg);
}

.dashboard-line-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.dashboard-metric {
    min-width: 0;
    padding: 1.25rem;
}

.dashboard-metric + .dashboard-metric {
    border-left: 1px solid var(--bs-border-color);
}

.dashboard-metric-value {
    margin-top: .45rem;
    font-size: clamp(1.25rem, 2.2vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.dashboard-metric-value span {
    color: var(--bs-secondary-color);
    font-size: .75em;
    font-weight: 400;
}

.dashboard-advice {
    padding: .8rem 1.25rem;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: .875rem;
}

.dashboard-onboarding {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 1.25rem 1.25rem;
    padding: 1.5rem;
    border: 1px dashed rgba(79, 70, 229, .38);
    border-radius: .9rem;
    background: rgba(79, 70, 229, .045);
}

.dashboard-onboarding-icon {
    display: grid;
    flex: 0 0 3.25rem;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    border-radius: .9rem;
    background: rgba(79, 70, 229, .12);
    color: var(--dsl-brand);
    font-size: 1.5rem;
}

.dashboard-steps {
    flex-direction: column;
    gap: .55rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: .8rem;
    white-space: nowrap;
}

.dashboard-steps b {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    margin-right: .35rem;
    place-items: center;
    border-radius: 50%;
    background: rgba(79, 70, 229, .13);
    color: var(--dsl-brand);
}

.line-insights-card .card-header p {
    max-width: 48rem;
}

.line-insight-metric {
    min-height: 7.2rem;
    padding: .8rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.line-insight-value {
    margin: .3rem 0 .15rem;
    font-size: 1.05rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.line-insight-change {
    color: var(--bs-emphasis-color);
}

.line-event-heading {
    margin-top: 1.2rem;
    margin-bottom: .55rem;
    padding-top: .9rem;
    border-top: 1px solid var(--bs-border-color);
}

.line-event-list {
    display: grid;
    gap: .2rem;
}

.line-event {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .55rem .25rem;
}

.line-event-icon {
    display: grid;
    flex: 0 0 1.8rem;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 50%;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

.line-event-retrain .line-event-icon {
    background: rgba(220, 38, 38, .1);
    color: #dc2626;
}

.line-event-sync-change .line-event-icon {
    background: rgba(124, 58, 237, .1);
    color: #7c3aed;
}

.line-event-content {
    flex: 1;
    min-width: 0;
}

.line-badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    vertical-align: middle;
}

/* A transparent border keeps every badge the same height, whether it carries a
   visible border (DLM, dark-mode tinted badges) or not (Bootstrap text-bg fills). */
.line-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .24rem .5rem;
    border: 1px solid transparent;
    border-radius: .45rem;
    font-size: .72rem;
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;
}

/* Icons must not push the badge taller than its text (the DLM badge uses a dot).
   Sizing in em keeps the icon just above the text size, including compact badges. */
.line-badge .bi {
    font-size: 1.04em;
    line-height: 1;
}

.line-badge-dlm {
    --line-dlm-bg: #f1f5f9;
    --line-dlm-border: #cbd5e1;
    --line-dlm-text: #475569;
    border: 1px solid var(--line-dlm-border);
    background: var(--line-dlm-bg);
    color: var(--line-dlm-text);
}

.line-badge-dlm.line-status-dlm-green {
    --line-dlm-bg: #dcfce7;
    --line-dlm-border: #86efac;
    --line-dlm-text: #166534;
}

.line-badge-dlm.line-status-dlm-amber {
    --line-dlm-bg: #fef3c7;
    --line-dlm-border: #fcd34d;
    --line-dlm-text: #92400e;
}

.line-badge-dlm.line-status-dlm-red {
    --line-dlm-bg: #fee2e2;
    --line-dlm-border: #fca5a5;
    --line-dlm-text: #991b1b;
}

.line-badge-dlm.line-status-dlm-crimson {
    --line-dlm-bg: #ffe4e6;
    --line-dlm-border: #fda4af;
    --line-dlm-text: #9f1239;
}

.line-badge-dlm.line-status-dlm-scarlet {
    --line-dlm-bg: #fee2e2;
    --line-dlm-border: #fecaca;
    --line-dlm-text: #7f1d1d;
}

.line-badge-dlm.line-status-dlm-black {
    --line-dlm-bg: #e2e8f0;
    --line-dlm-border: #94a3b8;
    --line-dlm-text: #1e293b;
}

.line-badge-dlm.line-status-dlm-grey,
.line-badge-dlm.line-status-dlm-collecting {
    --line-dlm-bg: #f1f5f9;
    --line-dlm-border: #cbd5e1;
    --line-dlm-text: #475569;
}

[data-bs-theme="dark"] .line-badge-dlm {
    --line-dlm-bg: #1e293b;
    --line-dlm-border: #475569;
    --line-dlm-text: #cbd5e1;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-green {
    --line-dlm-bg: rgba(22, 163, 74, .18);
    --line-dlm-border: rgba(74, 222, 128, .42);
    --line-dlm-text: #86efac;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-amber {
    --line-dlm-bg: rgba(245, 158, 11, .18);
    --line-dlm-border: rgba(251, 191, 36, .42);
    --line-dlm-text: #fcd34d;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-red {
    --line-dlm-bg: rgba(220, 38, 38, .18);
    --line-dlm-border: rgba(248, 113, 113, .42);
    --line-dlm-text: #fca5a5;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-crimson {
    --line-dlm-bg: rgba(190, 18, 60, .18);
    --line-dlm-border: rgba(251, 113, 133, .42);
    --line-dlm-text: #fda4af;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-scarlet {
    --line-dlm-bg: rgba(127, 29, 29, .25);
    --line-dlm-border: rgba(248, 113, 113, .42);
    --line-dlm-text: #fca5a5;
}

[data-bs-theme="dark"] .line-badge-dlm.line-status-dlm-black {
    --line-dlm-bg: #1f2937;
    --line-dlm-border: #475569;
    --line-dlm-text: #f1f5f9;
}

.line-badge .dlm-dot {
    flex: 0 0 .55rem;
    width: .55rem;
    height: .55rem;
    margin: 0;
    box-shadow: none;
}

.line-badges-compact {
    gap: .25rem;
}

.line-badges-compact .line-badge {
    gap: .28rem;
    padding: .18rem .4rem;
    font-size: .66rem;
}

.chart-event-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-top: .65rem;
    color: var(--bs-secondary-color);
    font-size: .78rem;
}

.chart-event-legend span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.chart-event-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
}

.chart-event-dot-retrain { background: #dc2626; }
.chart-event-dot-sync { background: #7c3aed; }
.chart-event-dot-gap { background: #64748b; }

[data-bs-theme="dark"] .dashboard-onboarding-icon,
[data-bs-theme="dark"] .dashboard-steps b {
    color: #a5b4fc;
}

[data-bs-theme="dark"] .member-dashboard-heading .hero-eyebrow {
    color: #8be9f3;
}

@media (max-width: 767.98px) {
    .member-dashboard-heading {
        align-items: flex-start;
        flex-direction: column;
        padding: 1.35rem;
    }

    .dashboard-line-summary,
    .dashboard-onboarding {
        margin-right: .75rem;
        margin-left: .75rem;
    }

    .dashboard-line-topline {
        align-items: flex-start;
        flex-direction: column;
        padding: .85rem 1rem;
    }

    .dashboard-metric {
        padding: 1rem;
    }

    .dashboard-metric:nth-child(odd) {
        border-left: 0;
    }

    .dashboard-metric:nth-child(n+3) {
        border-top: 1px solid var(--bs-border-color);
    }

    .dashboard-onboarding {
        align-items: flex-start;
        padding: 1.1rem;
    }
}

.metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 420px;
}

.chart-wrap.spectrum {
    height: 320px;
}

.spectrum-finding {
    border-left: 4px solid var(--bs-warning);
    background: var(--bs-tertiary-bg);
    border-radius: .375rem;
    padding: .65rem .85rem;
    margin-bottom: .5rem;
}

.spectrum-finding-critical {
    border-left-color: var(--bs-danger);
}

.spectrum-finding-warning {
    border-left-color: var(--bs-warning);
}

.spectrum-recommendation {
    color: var(--bs-secondary-color);
}

.table-members td, .table-members th {
    vertical-align: middle;
}

.field-table {
    font-size: .85rem;
}

.latest-fields-body {
    max-height: 30rem;
    overflow: auto;
}

.dlm-coverage-progress {
    display: block;
    width: 100%;
    height: 6px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background-color: var(--bs-tertiary-bg);
}

.dlm-coverage-progress::-webkit-progress-bar {
    background-color: var(--bs-tertiary-bg);
}

.dlm-coverage-progress::-webkit-progress-value,
.dlm-coverage-progress::-moz-progress-bar {
    border-radius: 999px;
    background-color: var(--bs-info);
}

.code-block {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    padding: .85rem 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.upload-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .02em;
}

.clipboard-fallback-textarea {
    position: fixed;
    top: -1000px;
    opacity: 0;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary-color);
}

.empty-state i {
    font-size: 2.4rem;
    display: block;
    margin-bottom: .5rem;
}

/* DLM status indicators */
.dlm-dot {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .06);
}

.dlm-light {
    display: inline-block;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .06), inset 0 -3px 6px rgba(0, 0, 0, .25);
}

.dlm-green { background: #16a34a; }
.dlm-amber { background: #f59e0b; }
.dlm-red { background: #dc2626; }
.dlm-crimson { background: #be123c; }
.dlm-scarlet { background: #7f1d1d; }
.dlm-black { background: #111827; }
.dlm-grey { background: #9ca3af; }
.dlm-collecting { background: #94a3b8; }

.dlm-light-provisional {
    outline: 2px dashed var(--bs-warning);
    outline-offset: 4px;
}

.dlm-status-value {
    font-weight: 600;
}

.dlm-summary-row {
    min-height: 2.75rem;
}

.dlm-summary-text {
    min-width: 0;
}

.dlm-summary-meta {
    max-width: 100%;
}

.dlm-summary-actions {
    flex: 0 0 auto;
}

.dlm-panel-toggle .bi-chevron-down {
    display: inline-block;
    transition: transform .18s ease;
}

.dlm-panel-toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.dlm-panel-expanded > .card-body {
    border-top: 1px solid var(--bs-border-color);
}

@media (prefers-reduced-motion: reduce) {
    .dlm-panel-toggle .bi-chevron-down {
        transition: none;
    }
}

.dlm-signals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.dlm-signal {
    min-width: 0;
    padding: .75rem .85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-tertiary-bg);
}

.dlm-signal-provisional {
    border-style: dashed;
}

.dlm-signal-label {
    font-size: .82rem;
    font-weight: 600;
}

.dlm-signal-value {
    margin-top: .2rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
}

.dlm-signal-threshold {
    margin-top: .35rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.35;
}

.dlm-profiles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

.dlm-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .32rem .6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    font-size: .8rem;
    line-height: 1.2;
}

.dlm-profile-chip .dlm-dot {
    margin-right: 0;
}

.dlm-profile-current {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--bs-primary) 18%, transparent);
}

.dlm-detail-table {
    font-size: .8rem;
}

/* The DLM tables sit in half-width columns at large sizes, so let their cells
   wrap instead of inheriting the global 640px minimum and always scrolling. */
.table-responsive > .table.dlm-detail-table {
    min-width: 0;
}

.dlm-detail-table th[scope="row"] {
    font-weight: 500;
}

@media (max-width: 767.98px) {
    .dlm-signals {
        grid-template-columns: 1fr;
    }

    .dlm-profile-chip {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Country flag glyphs for browsers that don't render flag emoji (e.g. Chromium on Windows).
   Font: "Twemoji Country Flags" (subset of Twemoji Mozilla, CC-BY 4.0), via the MIT-licensed
   country-flag-emoji-polyfill package. Self-hosted so there are no third-party requests. */
@font-face {
    font-family: "Twemoji Country Flags";
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
        U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
    src: url('/fonts/TwemojiCountryFlags.woff2') format('woff2');
    font-display: swap;
}

.country-flag {
    font-family: "Twemoji Country Flags", "Twemoji Mozilla", "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color",
        "Android Emoji", sans-serif;
    font-size: 1.05em;
    line-height: 1;
    vertical-align: -0.05em;
    margin-right: .25rem;
}

/* Hoverable DLM summary text (opens a styled Bootstrap popover with the detail). */
.dlm-summary {
    cursor: help;
    border-bottom: 1px dotted currentColor;
}

.dlm-popover {
    --bs-popover-max-width: min(340px, 90vw);
}

.dlm-popover-table > div {
    padding: .1rem 0;
}

.dlm-popover-table > div > span:last-child {
    text-align: right;
}

/* ---------------------------------------------------------------------------
   Dark-mode fixes
   --------------------------------------------------------------------------- */

/* Bootstrap's .table-light header is a light grey, which looks wrong on a dark page. */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #20242b;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
    --bs-table-striped-bg: #23272f;
    --bs-table-striped-color: var(--bs-body-color);
    --bs-table-hover-bg: #262b33;
    --bs-table-hover-color: var(--bs-body-color);
}

/* Give cards a touch more separation from the page in dark mode. */
[data-bs-theme="dark"] .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

/* Keep long values (emails, GUIDs) from breaking the layout. */
.table td,
.table th {
    overflow-wrap: anywhere;
}

/* Responsive tables scroll horizontally rather than squeezing columns into wrapping. */
.table-responsive > .table {
    min-width: 640px;
}

/* Compact card layout used instead of member tables on small screens. */
.mobile-member {
    padding: .85rem 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.mobile-member:first-child {
    border-top: 0;
}

.mobile-member .stat-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
}

/* ---------------------------------------------------------------------------
   Mobile
   --------------------------------------------------------------------------- */

/* Anchor targets (#profile, #upload-setup) clear the sticky navbar. */
#profile,
#upload-setup {
    scroll-margin-top: 5rem;
}

@media (max-width: 575.98px) {
    .container {
        padding-left: .85rem;
        padding-right: .85rem;
    }

    .chart-wrap {
        height: 280px;
    }

    .chart-wrap.spectrum {
        height: 240px;
    }

    .hero {
        border-radius: .9rem;
    }

    .stat-tile {
        padding: .75rem .8rem;
    }

    .stat-tile .stat-value {
        font-size: 1.3rem;
    }

    .stat-tile .stat-label {
        font-size: .7rem;
    }

    .dlm-light {
        width: 2.25rem;
        height: 2.25rem;
    }

    .app-navbar .navbar-nav {
        padding-bottom: .5rem;
    }
}

/* ---------------------------------------------------------------------------
   DSL WebStats visual refresh
   --------------------------------------------------------------------------- */

:root {
    --dsl-brand: #2563eb;
    --dsl-brand-2: #06b6d4;
    --dsl-ink: #14243a;
    --dsl-surface: #ffffff;
    --dsl-canvas: #f3f6fb;
    --dsl-line: #e1e8f0;
    --dsl-muted: #65758b;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
    --dsl-chart-grid: rgba(15, 35, 64, .09);
    --dsl-chart-tick: #65758b;
    --dsl-chart-tooltip-bg: #14243a;
    --dsl-chart-tooltip-border: #31445c;
    color-scheme: light;
}

:root[data-bs-theme="dark"] {
    --dsl-brand: #60a5fa;
    --dsl-brand-2: #22d3ee;
    --dsl-ink: #e6edf7;
    --dsl-surface: #141e2c;
    --dsl-canvas: #0b1220;
    --dsl-line: #263447;
    --dsl-muted: #9aabc0;
    --bs-primary: #60a5fa;
    --bs-primary-rgb: 96, 165, 250;
    --bs-link-color: #8abaff;
    --bs-link-hover-color: #bfdbfe;
    --dsl-chart-grid: rgba(226, 237, 250, .11);
    --dsl-chart-tick: #aebed1;
    --dsl-chart-tooltip-bg: #101a29;
    --dsl-chart-tooltip-border: #3b4d64;
    --bs-body-bg: var(--dsl-canvas);
    --bs-body-color: #e2eaf5;
    --bs-secondary-bg: #141e2c;
    --bs-tertiary-bg: #111a27;
    --bs-border-color: #263447;
    --bs-card-bg: #141e2c;
    color-scheme: dark;
}

html {
    background-color: var(--dsl-canvas);
}

body {
    color: var(--dsl-ink);
    background-color: var(--dsl-canvas);
    background-image: radial-gradient(ellipse at 12% 0%, rgba(37, 99, 235, .055), transparent 36rem);
    background-position: center top;
    background-repeat: no-repeat;
    background-size: 100% 38rem;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -.012em;
    -webkit-font-smoothing: antialiased;
}

.page-shell {
    width: min(100% - 2rem, 1320px);
    max-width: 1320px;
    padding-top: 2rem !important;
    padding-bottom: 2.5rem !important;
}

.app-navbar {
    background: rgba(12, 24, 42, .96);
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .16);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.app-navbar .container {
    min-height: 68px;
}

.app-navbar .navbar-brand {
    color: #f7fbff;
    letter-spacing: -.035em;
    font-size: 1.08rem;
}

.app-navbar .nav-link {
    color: #bdc9d9;
    font-size: .9rem;
    font-weight: 550;
    padding: .55rem .75rem;
    transition: color .18s ease, background-color .18s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link:focus-visible,
.app-navbar .nav-link:active,
.app-navbar .nav-link.active,
.app-navbar .nav-link.show {
    color: #fff;
    background-color: rgba(148, 190, 255, .13);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(125, 211, 252, .35);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(37, 99, 235, .5), rgba(6, 182, 212, .22));
    color: #a5f3fc;
    box-shadow: inset 0 1px rgba(255, 255, 255, .12);
}

.app-navbar .theme-toggle {
    display: inline-flex;
    width: 46px;
    height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(203, 213, 225, .24);
    border-radius: .7rem;
    background: rgba(255, 255, 255, .06);
    box-shadow: none;
    color: #dbeafe;
    font-size: 1rem;
}

.app-navbar .theme-toggle::after {
    margin-left: .4rem;
}

.app-navbar .theme-toggle:hover,
.app-navbar .theme-toggle:focus-visible {
    border-color: rgba(125, 211, 252, .5);
    background: rgba(125, 211, 252, .14);
    color: #fff;
}

.app-navbar .theme-toggle:focus-visible {
    outline: 2px solid #7dd3fc;
    outline-offset: 2px;
}

.app-navbar .btn-light {
    border: 0;
    border-radius: .65rem;
    color: #10233b !important;
    font-weight: 650;
    padding: .55rem .9rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--dsl-ink);
    letter-spacing: -.035em;
}

.text-body-secondary {
    --bs-secondary-color: var(--dsl-muted);
}

.btn {
    --bs-btn-border-radius: .65rem;
    font-weight: 600;
    letter-spacing: -.01em;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.btn-primary {
    --bs-btn-bg: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af;
    --bs-btn-active-border-color: #1e40af;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .2);
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: #1e40af;
    --bs-btn-active-border-color: #1e40af;
    --bs-btn-active-color: #ffffff;
}

/* Bootstrap's outline-secondary grey is too faint on the deeper dark surface. */
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #cbd5e1;
    --bs-btn-border-color: #64748b;
    --bs-btn-hover-bg: #334155;
    --bs-btn-hover-border-color: #94a3b8;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: #475569;
    --bs-btn-active-border-color: #94a3b8;
    --bs-btn-active-color: #ffffff;
}

/* The light blue primary colour is fine for links, but not as a badge background. */
[data-bs-theme="dark"] .text-bg-primary {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}

/* Keep line metadata readable without the saturated Bootstrap fills on dark surfaces.
   The same accent/tint pairs are used by the share-badge SVG. */
[data-bs-theme="dark"] .line-badge.text-bg-primary {
    --line-badge-bg: rgba(59, 130, 246, .16);
    --line-badge-border: rgba(96, 165, 250, .42);
    --line-badge-color: #93c5fd;
}

[data-bs-theme="dark"] .line-badge.text-bg-secondary {
    --line-badge-bg: rgba(100, 116, 139, .18);
    --line-badge-border: rgba(148, 163, 184, .38);
    --line-badge-color: #cbd5e1;
}

[data-bs-theme="dark"] .line-badge.text-bg-success {
    --line-badge-bg: rgba(16, 185, 129, .14);
    --line-badge-border: rgba(52, 211, 153, .42);
    --line-badge-color: #86efac;
}

[data-bs-theme="dark"] .line-badge.text-bg-warning {
    --line-badge-bg: rgba(245, 158, 11, .15);
    --line-badge-border: rgba(251, 191, 36, .42);
    --line-badge-color: #fcd34d;
}

[data-bs-theme="dark"] .line-badge.text-bg-danger {
    --line-badge-bg: rgba(239, 68, 68, .15);
    --line-badge-border: rgba(248, 113, 113, .42);
    --line-badge-color: #fca5a5;
}

[data-bs-theme="dark"] .line-badge.text-bg-info {
    --line-badge-bg: rgba(6, 182, 212, .14);
    --line-badge-border: rgba(34, 211, 238, .42);
    --line-badge-color: #67e8f9;
}

[data-bs-theme="dark"] .line-badge.text-bg-primary,
[data-bs-theme="dark"] .line-badge.text-bg-secondary,
[data-bs-theme="dark"] .line-badge.text-bg-success,
[data-bs-theme="dark"] .line-badge.text-bg-warning,
[data-bs-theme="dark"] .line-badge.text-bg-danger,
[data-bs-theme="dark"] .line-badge.text-bg-info {
    border: 1px solid var(--line-badge-border);
    background-color: var(--line-badge-bg) !important;
    color: var(--line-badge-color) !important;
}

/* Apply the same restrained semantic palette to Bootstrap status badges site-wide.
   Neutral secondary/light badges keep their existing treatment. */
[data-bs-theme="dark"] .badge.text-bg-primary {
    --status-badge-bg: rgba(59, 130, 246, .16);
    --status-badge-border: rgba(96, 165, 250, .42);
    --status-badge-color: #93c5fd;
}

[data-bs-theme="dark"] .badge.text-bg-success {
    --status-badge-bg: rgba(16, 185, 129, .14);
    --status-badge-border: rgba(52, 211, 153, .42);
    --status-badge-color: #86efac;
}

[data-bs-theme="dark"] .badge.text-bg-warning {
    --status-badge-bg: rgba(245, 158, 11, .15);
    --status-badge-border: rgba(251, 191, 36, .42);
    --status-badge-color: #fcd34d;
}

[data-bs-theme="dark"] .badge.text-bg-danger {
    --status-badge-bg: rgba(239, 68, 68, .15);
    --status-badge-border: rgba(248, 113, 113, .42);
    --status-badge-color: #fca5a5;
}

[data-bs-theme="dark"] .badge.text-bg-info {
    --status-badge-bg: rgba(6, 182, 212, .14);
    --status-badge-border: rgba(34, 211, 238, .42);
    --status-badge-color: #67e8f9;
}

[data-bs-theme="dark"] .badge.text-bg-primary,
[data-bs-theme="dark"] .badge.text-bg-success,
[data-bs-theme="dark"] .badge.text-bg-warning,
[data-bs-theme="dark"] .badge.text-bg-danger,
[data-bs-theme="dark"] .badge.text-bg-info {
    border: 1px solid var(--status-badge-border);
    background-color: var(--status-badge-bg) !important;
    color: var(--status-badge-color) !important;
}

.btn:hover {
    transform: translateY(-1px);
}

.form-control,
.form-select {
    min-height: 42px;
    border-color: var(--dsl-line);
    border-radius: .65rem;
    background-color: var(--dsl-surface);
    color: var(--dsl-ink);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .025);
}

.form-control:focus,
.form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .14);
}

.form-check-input {
    border-color: #a9b7c8;
}

.card {
    border: 1px solid var(--dsl-line);
    border-radius: 1rem;
    background: var(--dsl-surface);
    box-shadow: 0 5px 18px rgba(26, 47, 75, .045), 0 1px 2px rgba(26, 47, 75, .035);
}

.card-header,
.card-footer {
    padding: .95rem 1.2rem;
    border-color: var(--dsl-line);
    color: var(--dsl-ink);
}

.card-body {
    color: var(--dsl-ink);
}

.card .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--dsl-ink);
    --bs-table-border-color: var(--dsl-line);
    margin-bottom: 0;
}

.table-light {
    --bs-table-bg: #f5f8fc;
    --bs-table-color: #53647a;
    --bs-table-border-color: var(--dsl-line);
    --bs-table-striped-bg: #f5f8fc;
    --bs-table-hover-bg: #eef4fb;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .055em;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #192638;
    --bs-table-color: #aebed1;
    --bs-table-border-color: var(--dsl-line);
    --bs-table-striped-bg: #192638;
    --bs-table-hover-bg: #1d2c41;
}

.table > :not(caption) > * > * {
    padding: .8rem .85rem;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: rgba(37, 99, 235, .035);
}

.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(148, 190, 255, .19);
    border-radius: 1.35rem;
    background:
        radial-gradient(ellipse at 88% 10%, rgba(6, 182, 212, .2), transparent 27rem),
        radial-gradient(ellipse at 15% 115%, rgba(37, 99, 235, .34), transparent 36rem),
        linear-gradient(125deg, #10213a 0%, #132a46 56%, #10243a 100%);
    box-shadow: 0 22px 55px rgba(20, 46, 81, .17);
}

.hero::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 38px 38px;
    content: "";
    mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
    opacity: .46;
}

.hero h1 {
    max-width: 760px;
    color: #f7fbff;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.08;
    letter-spacing: -.055em;
}

.hero .lead {
    max-width: 720px;
    color: #bac9dc !important;
    font-size: 1.03rem;
    line-height: 1.75;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 1rem;
    color: #8be9f3;
    font-size: .71rem;
    font-weight: 750;
    letter-spacing: .15em;
}

.hero-pulse {
    width: .48rem;
    height: .48rem;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, .13), 0 0 14px rgba(52, 211, 153, .65);
}

.hero-note {
    margin-top: 1.15rem;
    color: #9fb1c7;
    font-size: .8rem;
}

.hero-note i {
    color: #67e8f9;
}

.hero .stat-tile {
    min-height: 108px;
    padding: 1rem;
    border-color: rgba(199, 220, 255, .15);
    border-radius: .9rem;
    background: rgba(8, 19, 34, .47);
    box-shadow: inset 0 1px rgba(255, 255, 255, .045);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.hero .stat-tile .stat-value {
    color: #f3f8ff;
}

.hero .stat-label {
    color: #9eb3cc;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .1em;
}

.hero .stat-value {
    margin-top: .75rem;
    color: #f3f8ff;
    font-size: 1.75rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.045em;
}

.hero .stat-icon {
    font-size: 1rem;
    opacity: 1;
}

.hero .btn-lg {
    padding: .72rem 1.05rem;
    font-size: .92rem;
}

.hero .btn-outline-light {
    --bs-btn-color: #d8e8fa;
    --bs-btn-border-color: rgba(216, 232, 250, .35);
    --bs-btn-hover-color: #13243b;
    --bs-btn-hover-bg: #eaf4ff;
    --bs-btn-hover-border-color: #eaf4ff;
}

.stat-tile {
    border-color: var(--dsl-line);
    border-radius: .9rem;
    background: var(--dsl-surface);
    box-shadow: 0 3px 12px rgba(26, 47, 75, .035);
}

.stat-tile .stat-value {
    color: var(--dsl-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.045em;
}

.stat-tile .stat-label {
    font-weight: 650;
    letter-spacing: .075em;
}

.empty-state {
    padding: 3.5rem 1.25rem;
}

.empty-state i {
    color: #7b9ac0;
}

.mobile-member + .mobile-member {
    border-color: var(--dsl-line);
}

.list-group-item {
    border-color: var(--dsl-line);
    background-color: transparent;
    color: var(--dsl-ink);
}

.badge {
    font-weight: 650;
    letter-spacing: .005em;
}

/* Compact site-owner icon sits beside the country flag; Bootstrap supplies the tooltip. */
.site-owner-badge {
    display: inline-flex;
    align-items: center;
    margin-left: .2rem;
    color: #9a6b00;
    font-size: 1.05em;
    line-height: 1;
    vertical-align: -.05em;
    cursor: help;
}

.site-owner-badge:focus-visible {
    border-radius: .15rem;
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.tooltip.site-owner-tooltip {
    /* A fixed dark surface keeps white tooltip text legible in either theme. */
    --bs-tooltip-bg: #14243a;
    --bs-tooltip-color: #fff;
}

:root[data-bs-theme="dark"] .site-owner-badge {
    color: #f4c95d;
}

.app-footer {
    border-top: 1px solid var(--dsl-line);
    background: var(--dsl-surface);
}

.app-footer .container {
    gap: .5rem 1.5rem;
    color: var(--dsl-muted);
}

.app-footer a {
    text-decoration: underline;
    text-underline-offset: .15em;
}

.app-footer a:hover {
    text-decoration-thickness: 2px;
}

.dropdown-menu {
    border: 1px solid var(--dsl-line);
    border-radius: .8rem;
    background: var(--dsl-surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}

.dropdown-item {
    padding: .55rem .9rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(37, 99, 235, .08);
}

.theme-menu {
    min-width: 11rem;
}

.theme-menu .dropdown-item {
    display: flex;
    align-items: center;
    border-radius: .45rem;
}

.theme-option-check {
    width: 1rem;
    color: #10b981;
    visibility: hidden;
}

.theme-option-check.is-selected {
    visibility: visible;
}

.member-search {
    width: min(100%, 590px);
}

.member-search .input-group-text {
    border-color: var(--dsl-line);
    background: var(--dsl-canvas);
    color: var(--dsl-muted);
}

.member-search .form-control {
    min-width: 12rem;
}

.member-range {
    white-space: nowrap;
}

.member-range strong {
    color: var(--dsl-ink);
    font-weight: 700;
}

.members-pagination .page-link {
    border-color: var(--dsl-line);
    background: var(--dsl-surface);
    color: var(--dsl-brand);
}

.members-pagination .page-item.active .page-link {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

[data-bs-theme="dark"] .members-pagination .page-item.active .page-link {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #071426;
}

.members-pagination .page-item.disabled .page-link {
    background: var(--dsl-canvas);
    color: var(--dsl-muted);
}

.compare-member-search .input-group-text {
    border-color: var(--dsl-line);
    background: var(--dsl-canvas);
    color: var(--dsl-muted);
}

.compare-member-list {
    max-height: 270px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--dsl-line) transparent;
}

.compare-member-option {
    padding: .35rem .45rem .35rem 1.5em;
    border-radius: .45rem;
}

.compare-member-option:hover {
    background: rgba(37, 99, 235, .06);
}

.compare-member-option .form-check-label {
    cursor: pointer;
}

.code-block {
    border-color: var(--dsl-line);
    border-radius: .75rem;
    background: color-mix(in srgb, var(--dsl-canvas) 78%, var(--dsl-surface));
    line-height: 1.65;
}

.chart-wrap {
    height: 390px;
}

.dlm-light {
    flex: 0 0 auto;
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding: .75rem 0 1rem;
    }

    .app-navbar .navbar-nav {
        align-items: stretch !important;
    }

    .app-navbar .theme-toggle {
        margin: .35rem 0;
    }

    .app-navbar .btn-light {
        display: inline-block;
        margin: .35rem 0 0;
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .page-shell {
        width: min(100% - 1rem, 1320px);
        padding-top: 1rem !important;
        padding-bottom: 1.5rem !important;
    }

    .stats-meta {
        flex: 0 0 100%;
        text-align: left !important;
    }

    .hero {
        padding: 1.35rem !important;
        border-radius: 1rem;
    }

    .hero .stat-tile {
        min-height: 90px;
        padding: .75rem;
    }

    .hero .stat-value {
        margin-top: .55rem;
        font-size: 1.45rem;
    }

    .card-header,
    .card-footer {
        padding: .8rem 1rem;
    }

    .member-search {
        width: 100%;
    }

    .member-search .form-control {
        min-width: 0;
    }

    .member-range {
        align-self: flex-start;
    }

    .chart-wrap {
        height: 280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ---------------------------------------------------------------------------
   Admin FTP & upload operations
   --------------------------------------------------------------------------- */

.ftp-page-heading {
    padding: .15rem 0 .25rem;
}

.ftp-page-heading h1 {
    font-weight: 720;
    letter-spacing: -.045em;
}

.ftp-eyebrow {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .35rem;
    color: var(--dsl-brand);
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .13em;
}

.ftp-server-card {
    overflow: hidden;
}

.ftp-server-card .card-header {
    background: color-mix(in srgb, var(--dsl-brand) 5%, var(--dsl-surface));
}

.ftp-server-card .card-body {
    padding: 1.35rem;
}

.ftp-server-card .stat-label {
    margin-bottom: .3rem;
    color: var(--dsl-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.ftp-stat-tile {
    position: relative;
    min-height: 132px;
    overflow: hidden;
    padding: 1rem 1.05rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

.ftp-stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(26, 47, 75, .09);
}

.ftp-stat-tile .stat-label,
.ftp-stat-tile .stat-value,
.ftp-stat-tile .small {
    position: relative;
    z-index: 1;
}

.ftp-stat-tile .stat-value {
    margin: .6rem 0 .3rem;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    letter-spacing: -.05em;
}

.ftp-stat-icon {
    position: absolute;
    top: .8rem;
    right: .85rem;
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--dsl-brand) 16%, transparent);
    border-radius: .7rem;
    background: color-mix(in srgb, var(--dsl-brand) 8%, var(--dsl-surface));
    color: var(--dsl-brand);
    font-size: 1rem;
}

.ftp-stat-active {
    border-top: 3px solid #10b981;
}

.ftp-stat-active .ftp-stat-icon {
    border-color: rgba(16, 185, 129, .18);
    background: rgba(16, 185, 129, .09);
    color: #059669;
}

.ftp-stat-attention {
    border-top: 3px solid #f59e0b;
}

.ftp-stat-attention .ftp-stat-icon {
    border-color: rgba(245, 158, 11, .2);
    background: rgba(245, 158, 11, .1);
    color: #b45309;
}

[data-bs-theme="dark"] .ftp-stat-active .ftp-stat-icon {
    color: #34d399;
}

[data-bs-theme="dark"] .ftp-stat-attention .ftp-stat-icon {
    color: #fbbf24;
}

.ftp-filter-bar {
    padding: .85rem 1rem;
    border: 1px solid var(--dsl-line);
    border-radius: .85rem;
    background: var(--dsl-surface);
}

.ftp-filter-group {
    max-width: 100%;
}

.ftp-filter-group .btn {
    white-space: nowrap;
}

.ftp-data-card {
    overflow: hidden;
}

.ftp-data-card .table-responsive {
    border-radius: inherit;
}

.ftp-list-scroll {
    max-height: 24rem;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--dsl-line) transparent;
}

.ftp-list-scroll:focus-visible {
    outline: 2px solid var(--dsl-brand);
    outline-offset: -2px;
}

.ftp-list-table {
    min-width: 640px;
}

.ftp-list-table thead th {
    position: sticky;
    z-index: 1;
    top: 0;
    background-color: var(--bs-table-bg);
}

.ftp-data-card .ftp-members-table {
    min-width: 940px;
}

.ftp-members-table thead th {
    white-space: nowrap;
}

.ftp-members-table tbody tr {
    transition: background-color .14s ease;
}

.ftp-members-table .upload-key {
    font-size: .8rem;
}

.ftp-detail-grid {
    --bs-gutter-y: 1.25rem;
}

.ftp-detail-card .card-header {
    display: flex;
    align-items: center;
    min-height: 58px;
    background: color-mix(in srgb, var(--dsl-brand) 4%, var(--dsl-surface));
}

.ftp-detail-card dl dt {
    color: var(--dsl-muted);
    font-size: .8rem;
    font-weight: 600;
}

.ftp-detail-card dl dd {
    margin-bottom: .85rem;
    font-size: .9rem;
}

.ftp-detail-card .quota-progress {
    display: block;
    width: 100%;
    height: .55rem;
    appearance: none;
    overflow: hidden;
    border: 1px solid var(--dsl-line);
    border-radius: 999px;
    background: var(--dsl-canvas);
}

.ftp-detail-card .quota-progress::-webkit-progress-bar {
    background: var(--dsl-canvas);
}

.ftp-detail-card .quota-progress::-webkit-progress-value,
.ftp-detail-card .quota-progress::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #06b6d4);
}

.ftp-detail-card .quota-progress.is-danger::-webkit-progress-value,
.ftp-detail-card .quota-progress.is-danger::-moz-progress-bar {
    background: var(--bs-danger);
}

.ftp-data-card .upload-key {
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    .ftp-page-heading {
        align-items: flex-start !important;
    }

    .ftp-stat-tile {
        min-height: 118px;
        padding: .8rem;
    }

    .ftp-stat-tile .stat-value {
        margin-top: .7rem;
    }

    .ftp-stat-tile .small {
        max-width: 90%;
        font-size: .72rem;
    }

    .ftp-filter-bar {
        align-items: flex-start !important;
        padding: .75rem;
    }

    .ftp-filter-group {
        display: flex;
        width: 100%;
        overflow-x: auto;
        padding-bottom: .2rem;
        scrollbar-width: thin;
    }

    .ftp-filter-group .btn {
        flex: 0 0 auto;
    }

    .ftp-detail-card .card-body {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ftp-stat-tile,
    .ftp-members-table tbody tr {
        transition: none;
    }
}

/* Keep the authenticator verification-code input to a natural width. */
.mfa-code-input {
    max-width: 12rem;
}

/* Off-screen field used as a spam tripwire on the contact form. */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Cohesive, readable framing for the new support and account-security flows. */
.support-heading,
.security-heading {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: .65rem;
}

.support-heading-icon,
.security-heading-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    flex: 0 0 3rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--dsl-brand) 18%, var(--dsl-line));
    border-radius: .9rem;
    background: color-mix(in srgb, var(--dsl-brand) 8%, var(--dsl-surface));
    color: var(--dsl-brand);
    font-size: 1.3rem;
}

[data-bs-theme="dark"] .support-heading-icon,
[data-bs-theme="dark"] .security-heading-icon {
    color: #a5b4fc;
}

.support-eyebrow,
.security-eyebrow {
    margin: 0 0 .15rem;
    color: var(--dsl-brand);
    font-size: .67rem;
    font-weight: 750;
    letter-spacing: .13em;
}

.support-intro,
.security-intro {
    max-width: 48rem;
    line-height: 1.7;
}

.support-page .card,
.security-setup-card {
    overflow: hidden;
}

.support-page .card-body,
.security-setup-card .card-body {
    padding: clamp(1.15rem, 4vw, 2rem);
}

.support-validation:not(:empty) {
    padding: .75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--bs-danger) 26%, transparent);
    border-radius: .65rem;
    background: color-mix(in srgb, var(--bs-danger) 7%, var(--dsl-surface));
    color: var(--bs-danger-text-emphasis, var(--bs-danger));
}

.support-validation ul {
    margin: 0;
    padding-left: 1.2rem;
}

.recaptcha-error {
    margin: 1rem 0 0;
    padding: .7rem .9rem;
    border: 1px solid color-mix(in srgb, var(--bs-danger) 26%, transparent);
    border-radius: .65rem;
    background: color-mix(in srgb, var(--bs-danger) 7%, var(--dsl-surface));
    color: var(--bs-danger-text-emphasis, var(--bs-danger));
}

.support-privacy-note {
    margin: 1.25rem 0;
    padding: .75rem .9rem;
    border-left: 3px solid var(--dsl-brand-2);
    border-radius: 0 .55rem .55rem 0;
    background: color-mix(in srgb, var(--dsl-brand-2) 7%, var(--dsl-surface));
    color: var(--dsl-muted);
    font-size: .83rem;
}

.support-privacy-note i {
    color: var(--dsl-brand-2);
}

.support-submit {
    min-width: 10rem;
}

.security-step-title {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.security-step-title span {
    display: inline-grid;
    width: 1.7rem;
    height: 1.7rem;
    flex: 0 0 1.7rem;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dsl-brand) 11%, var(--dsl-surface));
    color: var(--dsl-brand);
    font-size: .85rem;
    font-weight: 700;
}

.authenticator-qr-wrap {
    display: grid;
    width: fit-content;
    margin: 1.25rem auto 1.5rem;
    padding: .75rem;
    border: 1px solid var(--dsl-line);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(26, 47, 75, .08);
}

.authenticator-qr {
    display: block;
    width: min(200px, 55vw);
    height: auto;
}

.authenticator-key {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .7rem .8rem;
    border: 1px solid var(--dsl-line);
    border-radius: .7rem;
    background: var(--dsl-canvas);
}

.authenticator-key code {
    overflow-wrap: anywhere;
    color: var(--dsl-ink);
    letter-spacing: .08em;
}

.authenticator-uri {
    display: block;
    max-height: 5.5rem;
    margin-top: .4rem;
    overflow: auto;
    overflow-wrap: anywhere;
    padding: .55rem .65rem;
    border: 1px solid var(--dsl-line);
    border-radius: .55rem;
    background: var(--dsl-canvas);
    color: var(--dsl-muted);
    font-size: .72rem;
    line-height: 1.5;
    user-select: text;
}

.security-note {
    padding: .85rem 1rem;
    border-radius: .7rem;
    background: color-mix(in srgb, var(--dsl-brand-2) 7%, var(--dsl-surface));
    line-height: 1.65;
}

.security-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

#mfaReauthModal .modal-content {
    overflow: hidden;
    border: 1px solid var(--dsl-line);
    border-radius: 1rem;
    background: var(--dsl-surface);
    color: var(--dsl-ink);
}

#mfaReauthModal .modal-header,
#mfaReauthModal .modal-footer {
    border-color: var(--dsl-line);
}

#mfaReauthModal .modal-body {
    line-height: 1.6;
}

.recovery-code-list {
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid var(--dsl-line);
    border-radius: .7rem;
    background: var(--dsl-canvas);
    color: var(--dsl-ink);
    font-size: .95rem;
    line-height: 1.8;
    user-select: text;
}

@media (max-width: 575.98px) {
    .support-submit {
        width: 100%;
    }

    .security-actions .btn {
        flex: 1 1 100%;
    }

    .authenticator-key {
        align-items: flex-start;
    }
}

/* Opt-in auto-refresh control for live data pages. */
.auto-refresh-pill {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 1030;
}

.auto-refresh-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .75rem;
    border: 1px solid var(--dsl-line);
    border-radius: 999px;
    background: var(--dsl-surface);
    color: var(--dsl-ink);
    box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
}

.auto-refresh-toggle:hover,
.auto-refresh-toggle:focus-visible {
    border-color: var(--dsl-brand-2);
    color: var(--dsl-brand-2);
}

.auto-refresh-pill.is-off .auto-refresh-toggle {
    color: var(--dsl-muted);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}

.auto-refresh-toggle .bi {
    font-size: .95rem;
}

@media (max-width: 575.98px) {
    .auto-refresh-pill {
        right: calc(.75rem + env(safe-area-inset-right, 0px));
        bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    }

    .auto-refresh-toggle {
        padding: .35rem .6rem;
    }
}

/* Dashboard and member-directory polish. */
.member-dashboard {
    border-color: color-mix(in srgb, var(--dsl-brand) 17%, var(--dsl-line));
    background: var(--dsl-surface);
    box-shadow: 0 16px 42px rgba(15, 35, 64, .08);
}

[data-bs-theme="dark"] .member-dashboard {
    box-shadow: 0 18px 44px rgba(0, 0, 0, .2);
}

.member-dashboard-heading {
    position: relative;
    background:
        radial-gradient(ellipse at 94% 0%, color-mix(in srgb, var(--dsl-brand-2) 17%, transparent), transparent 32rem),
        radial-gradient(ellipse at 4% 110%, color-mix(in srgb, var(--dsl-brand) 11%, transparent), transparent 34rem),
        var(--dsl-surface);
}

.member-dashboard-heading .hero-eyebrow {
    font-size: .68rem;
    letter-spacing: .16em;
}

.member-dashboard-heading h1 {
    font-size: clamp(1.65rem, 2.6vw, 2.2rem);
    line-height: 1.15;
}

.dashboard-line-summary {
    margin-top: 1rem;
    border-color: color-mix(in srgb, var(--dsl-brand) 14%, var(--dsl-line));
    background: color-mix(in srgb, var(--dsl-brand) 2.5%, var(--dsl-surface));
}

.member-dashboard > .line-insights-card {
    margin-right: 1.25rem;
    margin-left: 1.25rem;
}

.dashboard-line-topline {
    min-height: 3.5rem;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    margin: 0;
    padding: .85rem 1rem;
}

.dashboard-metrics > .dashboard-metric {
    width: auto;
    max-width: none;
    padding: 1rem 1.05rem;
    border: 1px solid var(--dsl-line);
    border-radius: .8rem;
    background: var(--dsl-surface);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.dashboard-metrics > .dashboard-metric + .dashboard-metric {
    border-left: 1px solid var(--dsl-line);
}

.dashboard-metrics > .dashboard-metric:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--dsl-brand) 30%, var(--dsl-line));
    box-shadow: 0 7px 18px rgba(26, 47, 75, .06);
}

.dashboard-metric .stat-label {
    color: var(--dsl-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.dashboard-metric-value {
    font-variant-numeric: tabular-nums;
}

.dashboard-advice {
    margin: 0 .85rem .8rem;
    padding: .75rem .9rem;
    border: 1px solid color-mix(in srgb, var(--dsl-brand-2) 22%, var(--dsl-line));
    border-radius: .7rem;
    background: color-mix(in srgb, var(--dsl-brand-2) 6%, var(--dsl-surface));
    color: var(--dsl-muted);
}

.member-card {
    overflow: hidden;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.member-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--dsl-brand) 32%, var(--dsl-line));
    box-shadow: 0 12px 28px rgba(26, 47, 75, .1);
}

.member-card .card-body {
    padding: 1.15rem;
}

.member-card .card-body > .d-flex:first-child {
    min-height: 1.8rem;
}

.member-card .card-body > .d-flex:first-child a {
    color: var(--dsl-ink);
    letter-spacing: -.025em;
}

.member-card .card-body > .d-flex:first-child a:hover {
    color: var(--dsl-brand);
}

.member-card .row.text-center.g-2 {
    margin-top: .85rem !important;
}

.member-card .row.text-center.g-2 > div {
    padding-top: .55rem;
    padding-bottom: .55rem;
    border: 1px solid color-mix(in srgb, var(--dsl-line) 86%, transparent);
    border-radius: .65rem;
    background: color-mix(in srgb, var(--dsl-canvas) 64%, var(--dsl-surface));
}

.member-card .row.text-center.g-2 .stat-label {
    color: var(--dsl-muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.member-card .row.text-center.g-2 .fw-semibold {
    margin-top: .15rem;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.member-card .card-footer {
    background: color-mix(in srgb, var(--dsl-canvas) 48%, var(--dsl-surface));
}

.members-toolbar {
    border-color: color-mix(in srgb, var(--dsl-brand) 12%, var(--dsl-line));
    background: linear-gradient(115deg,
        color-mix(in srgb, var(--dsl-brand) 4%, var(--dsl-surface)),
        var(--dsl-surface) 62%);
}

/* Consistent keyboard focus and native control colors in either theme. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--dsl-brand) 72%, white);
    outline-offset: 2px;
}

::selection {
    background: color-mix(in srgb, var(--dsl-brand) 28%, transparent);
}

.form-control::placeholder {
    color: color-mix(in srgb, var(--dsl-muted) 78%, transparent);
    opacity: 1;
}

[data-bs-theme="dark"] .text-bg-light {
    background-color: #243247 !important;
    color: #dbeafe !important;
}

[data-bs-theme="dark"] .text-bg-light.border {
    border-color: #40516a !important;
}

/* The newest client downloads share the same clear hierarchy in both themes. */
.download-page-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.35rem;
    border: 1px solid color-mix(in srgb, var(--dsl-brand) 16%, var(--dsl-line));
    border-radius: 1rem;
    background:
        radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--dsl-brand-2) 10%, transparent), transparent 24rem),
        color-mix(in srgb, var(--dsl-brand) 3%, var(--dsl-surface));
}

.download-heading-icon,
.download-product-icon,
.download-section-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--dsl-brand) 20%, var(--dsl-line));
    background: color-mix(in srgb, var(--dsl-brand) 9%, var(--dsl-surface));
    color: var(--dsl-brand);
}

.download-heading-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    font-size: 1.55rem;
}

.download-eyebrow {
    margin-bottom: .25rem;
    color: var(--dsl-brand);
    font-size: .67rem;
    font-weight: 750;
    letter-spacing: .14em;
}

.download-version,
.download-recommended {
    display: inline-flex;
    align-items: center;
    border: 1px solid color-mix(in srgb, #10b981 28%, var(--dsl-line));
    border-radius: 999px;
    background: color-mix(in srgb, #10b981 10%, var(--dsl-surface));
    color: #047857;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.download-version {
    padding: .4rem .7rem;
}

.download-recommended {
    padding: .25rem .55rem;
    white-space: nowrap;
}

[data-bs-theme="dark"] .download-version,
[data-bs-theme="dark"] .download-recommended {
    border-color: rgba(52, 211, 153, .32);
    background: rgba(16, 185, 129, .14);
    color: #6ee7b7;
}

.download-comparison,
.download-product,
.download-empty-card {
    overflow: hidden;
}

.download-comparison {
    border-color: color-mix(in srgb, var(--dsl-brand) 16%, var(--dsl-line));
}

.download-comparison .card-header,
.download-product .card-header {
    min-height: 3.8rem;
    background: color-mix(in srgb, var(--dsl-brand) 3%, var(--dsl-surface));
}

.download-section-icon,
.download-product-icon {
    width: 2rem;
    height: 2rem;
    border-radius: .65rem;
}

.download-comparison-table {
    min-width: 650px;
}

.download-comparison-table .download-feature-column {
    width: 27%;
}

.download-comparison-table thead th:not(:first-child) {
    color: var(--dsl-ink);
    white-space: nowrap;
}

.download-comparison-table tbody th {
    font-weight: 600 !important;
}

.download-product-agent {
    border-color: color-mix(in srgb, #10b981 34%, var(--dsl-line));
    box-shadow: 0 8px 26px rgba(16, 185, 129, .07);
}

.download-product-agent .card-header {
    background: color-mix(in srgb, #10b981 5%, var(--dsl-surface));
}

.download-file-row {
    gap: 1rem;
    border-color: var(--dsl-line);
}

.download-file-row details summary {
    width: fit-content;
    cursor: pointer;
}

.download-file-row details code {
    margin-top: .35rem;
    padding: .45rem .6rem;
    border: 1px solid var(--dsl-line);
    border-radius: .5rem;
    background: var(--dsl-canvas);
    color: var(--dsl-ink);
}

.download-empty-card .card-body {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.download-empty-icon {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: .75rem;
    place-items: center;
    border-radius: .8rem;
    background: color-mix(in srgb, var(--dsl-brand) 9%, var(--dsl-surface));
    color: var(--dsl-brand);
    font-size: 1.2rem;
}

.download-footer-note {
    padding-top: 1rem;
    border-top: 1px solid var(--dsl-line);
}

@media (max-width: 575.98px) {
    .download-page-heading {
        align-items: flex-start;
        gap: .75rem;
        padding: 1rem;
    }

    .download-heading-icon {
        width: 2.7rem;
        height: 2.7rem;
        border-radius: .8rem;
        font-size: 1.3rem;
    }

    .download-page-heading h1 {
        font-size: 1.45rem;
    }

    .download-comparison .card-body {
        padding: 1rem;
    }
}

.table-card .card-header {
    min-height: 3.5rem;
    background: color-mix(in srgb, var(--dsl-brand) 3%, var(--dsl-surface));
}

@media (max-width: 991.98px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
        padding: .7rem;
    }

    .dashboard-metrics > .dashboard-metric {
        padding: .85rem;
    }

    .dashboard-advice {
        margin: 0 .7rem .7rem;
    }

    .member-card .card-body {
        padding: 1rem;
    }
}

@media (max-width: 767.98px) {
    .member-dashboard > .line-insights-card {
        margin-right: .75rem;
        margin-left: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-metrics > .dashboard-metric,
    .member-card {
        transition: none;
    }
}

/* Live line badge and share controls on a member's own stats page. */
.share-card {
    overflow: hidden;
}

.share-badge-preview {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--dsl-line);
    border-radius: .7rem;
}

.share-code {
    display: flex;
    align-items: center;
    min-height: 31px;
    overflow: hidden;
    font-size: .72rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}
