:root {
    --field: #1f5d3a;
    --field-dark: #15442a;
    --clay: #ba5b34;
    --clay-dark: #944426;
    --cream: #f8f1e4;
    --paper: #fffdf8;
    --ink: #1e2430;
    --muted: #4f5d6d;
    --line: #d9d2c2;
    --up-bg: #d9efdf;
    --up-ink: #13633e;
    --down-bg: #f8d9dc;
    --down-ink: #7f1a21;
    --hold-bg: #dce9fb;
    --hold-ink: #1f4f8a;
}

[x-cloak] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body,
.app-body {
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(186, 91, 52, 0.12) 0, transparent 35%),
        radial-gradient(circle at 90% 12%, rgba(31, 93, 58, 0.10) 0, transparent 36%),
        linear-gradient(180deg, #fbf6eb 0%, #f5ecdc 100%);
}

h1,
h2,
h3,
h4,
.brand-title {
    font-family: "Bree Serif", Georgia, serif;
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12) 0, transparent 45%),
        linear-gradient(140deg, var(--field) 0%, var(--clay) 100%);
}

.login-card {
    width: 100%;
    max-width: 460px;
    border: 1px solid color-mix(in srgb, var(--field) 20%, white) !important;
    background: var(--paper);
}

.app-header {
    background: color-mix(in srgb, var(--cream) 82%, white);
    border-bottom: 1px solid color-mix(in srgb, var(--field) 16%, var(--line));
    backdrop-filter: blur(8px);
}

.app-brand {
    min-width: 0;
}

.app-signout {
    white-space: nowrap;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.35rem;
    border: 1px solid color-mix(in srgb, var(--field) 14%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--paper) 86%, var(--cream));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.app-nav-link:hover {
    color: var(--field-dark);
    background: rgba(255, 255, 255, 0.6);
}

.app-nav-link.active {
    color: var(--field-dark);
    background: color-mix(in srgb, var(--field) 14%, white);
    box-shadow: 0 6px 16px rgba(21, 68, 42, 0.12);
}

.app-nav-link.is-disabled {
    opacity: 0.62;
}

.app-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.55rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
}

.form-control,
.form-select {
    border-color: color-mix(in srgb, var(--field) 20%, var(--line));
    background: #fff;
}

.followed-card,
.card {
    background: var(--paper);
    border: 1px solid color-mix(in srgb, var(--field) 12%, var(--line)) !important;
}

.followed-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.followed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.65rem 1.35rem rgba(17, 27, 38, 0.13) !important;
}

.player-toolbar {
    padding: 0.95rem 1rem;
    border: 1px solid color-mix(in srgb, var(--field) 12%, var(--line));
    border-radius: 0.95rem;
    background: color-mix(in srgb, var(--paper) 78%, var(--cream));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.sparkline-label {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
}

.sparkline-box {
    height: 64px;
    overflow: hidden;
}

.sparkline-bars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sparkline-bar {
    position: absolute;
    border-radius: 2px;
    transform: translateX(-50%);
    opacity: 0.62;
}

.sparkline-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.sparkline-dot-hover {
    width: 10px;
    height: 10px;
}

.sparkline-tooltip {
    position: absolute;
    transform: translateX(-50%);
    pointer-events: none;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.25rem 0.4rem;
    border-radius: 0.3rem;
    background: rgba(30, 36, 48, 0.93);
    color: #fff;
    white-space: nowrap;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--muted);
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 600;
}

.verdict-pill {
    font-size: 0.75rem;
}

.verdict-pill.status-up {
    background-color: var(--up-bg);
    color: var(--up-ink);
}

.verdict-pill.status-down {
    background-color: var(--down-bg);
    color: var(--down-ink);
}

.verdict-pill.status-hold {
    background-color: var(--hold-bg);
    color: var(--hold-ink);
}

.summary-chip {
    padding: 0.85rem 1rem 0.95rem;
    border: 1px solid color-mix(in srgb, var(--field) 12%, var(--line));
    border-radius: 0.95rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(241, 236, 226, 0.96) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.summary-chip-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--field-dark) 58%, var(--muted));
}

.summary-chip-copy {
    color: #27405f;
    font-size: 0.98rem;
    line-height: 1.45;
}

.btn-primary {
    --bs-btn-bg: var(--field);
    --bs-btn-border-color: var(--field);
    --bs-btn-hover-bg: var(--field-dark);
    --bs-btn-hover-border-color: var(--field-dark);
    --bs-btn-active-bg: var(--field-dark);
    --bs-btn-active-border-color: var(--field-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--field);
    --bs-btn-border-color: var(--field);
    --bs-btn-hover-bg: var(--field);
    --bs-btn-hover-border-color: var(--field);
}

.btn-outline-secondary {
    --bs-btn-color: var(--muted);
    --bs-btn-border-color: color-mix(in srgb, var(--field) 20%, var(--line));
    --bs-btn-hover-bg: #efe7d8;
    --bs-btn-hover-border-color: color-mix(in srgb, var(--field) 30%, var(--line));
    --bs-btn-hover-color: var(--ink);
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.modal-card {
    width: 100%;
    max-width: 540px;
    z-index: 1;
    background: var(--paper);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--field);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #eee5d4;
}

::-webkit-scrollbar-thumb {
    background: #af9d82;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #968567;
}

.settings-section {
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(122, 136, 117, 0.18);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.42);
}

.settings-section + .settings-section {
    margin-top: 1rem;
}

.settings-section__header {
    margin-bottom: 1rem;
}

.settings-section__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.settings-section__copy {
    margin-top: 0.2rem;
    color: var(--muted);
}

.settings-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 0;
    margin: 0;
    border-bottom: 1px solid rgba(122, 136, 117, 0.14);
    cursor: pointer;
}

.settings-checkbox:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.settings-checkbox:only-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.settings-checkbox input {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.2rem;
    accent-color: var(--field);
    flex-shrink: 0;
}

.settings-checkbox strong {
    display: block;
    font-size: 0.98rem;
    color: var(--ink);
}

.settings-checkbox small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    line-height: 1.45;
}

.billing-summary-card {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: 1rem;
    background: rgba(236, 232, 221, 0.78);
    border: 1px solid rgba(122, 136, 117, 0.16);
}

.billing-summary-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.98rem;
    color: var(--ink);
}

.billing-summary-card__label {
    color: var(--muted);
    font-weight: 600;
}

.billing-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.billing-status-pill.is-active {
    background: rgba(30, 120, 69, 0.12);
    color: #21653c;
}

.billing-status-pill.is-inactive {
    background: rgba(38, 104, 176, 0.12);
    color: #245388;
}

.billing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (max-width: 767.98px) {
    .app-header .container {
        align-items: flex-start !important;
    }

    .app-brand h1 {
        font-size: 1.55rem;
    }

    .app-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.55rem;
        padding: 0.55rem;
        border-radius: 0.95rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .app-nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav-link {
        min-height: 2.65rem;
        min-width: max-content;
        justify-content: center;
        padding: 0.75rem 0.95rem;
        text-align: center;
        border: 1px solid transparent;
        background: rgba(255, 255, 255, 0.4);
        font-size: 0.9rem;
    }

    .app-nav-link.active {
        border-color: color-mix(in srgb, var(--field) 28%, var(--line));
    }

    .app-nav-count {
        min-width: 1.45rem;
        height: 1.45rem;
        font-size: 0.74rem;
    }

    .settings-section {
        padding: 1rem;
    }

    .billing-summary-card__row {
        flex-direction: column;
        align-items: flex-start;
    }

    .billing-actions .btn {
        width: 100%;
    }
}
