:root {
    color-scheme: dark;
    --app-bg: #07111f;
    --app-bg-soft: #0d1828;
    --surface: rgba(15, 25, 42, 0.78);
    --surface-strong: rgba(17, 28, 47, 0.94);
    --surface-muted: rgba(30, 41, 59, 0.58);
    --line: rgba(148, 163, 184, 0.16);
    --line-strong: rgba(148, 163, 184, 0.28);
    --text: #e5edf6;
    --muted: #91a2b8;
    --soft: #64748b;
    --cyan: #38bdf8;
    --emerald: #34d399;
    --amber: #fbbf24;
    --rose: #fb7185;
    --violet: #a78bfa;
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

* {
    scrollbar-color: rgba(56, 189, 248, 0.45) rgba(15, 23, 42, 0.65);
}

html {
    background: var(--app-bg);
}

body {
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(7, 17, 31, 0.35), rgba(7, 17, 31, 1) 62%),
        radial-gradient(circle at 14% -10%, rgba(52, 211, 153, 0.18), transparent 34rem),
        radial-gradient(circle at 90% 6%, rgba(56, 189, 248, 0.16), transparent 32rem),
        linear-gradient(135deg, #07111f 0%, #101827 46%, #07111f 100%) !important;
    letter-spacing: 0;
}

/* —— Typography polish —— */
p { line-height: 1.6; }
h1, h2, h3 { letter-spacing: -0.01em; }

a, button, input, select, textarea {
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

/* —— Focus / accessibility —— */
:where(a, button, input, select, textarea, [role="button"], [tabindex]):focus {
    outline: none;
}

:where(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.85);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

/* Inputs already have their own focus ring */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    outline-offset: 0;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16) !important;
}

::selection {
    background: rgba(56, 189, 248, 0.32);
    color: white;
}

/* —— Links —— */
a {
    text-decoration-color: rgba(56, 189, 248, 0.35);
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.app-shell {
    max-width: 1280px;
    margin: 0 auto;
}

.app-topbar {
    position: sticky;
    top: 0.75rem;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: rgba(7, 17, 31, 0.78);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: white;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark::before {
    content: "";
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.75rem;
    background:
        linear-gradient(135deg, rgba(52, 211, 153, 0.95), rgba(56, 189, 248, 0.9)),
        #0ea5e9;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset, 0 12px 24px rgba(14, 165, 233, 0.22);
}

.nav-pill {
    display: inline-flex;
    min-height: 2.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 700;
}

.nav-pill:hover,
.nav-pill.active {
    color: white;
    background: rgba(148, 163, 184, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 0.85rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.1rem;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translateY(0);
}

button:disabled,
.btn-primary[aria-disabled="true"],
.btn-secondary[aria-disabled="true"],
.btn-danger[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

button:disabled:hover {
    transform: none;
}

.btn-primary {
    color: #02111c;
    background: linear-gradient(135deg, #67e8f9, #34d399);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(45, 212, 191, 0.18);
}

.btn-secondary {
    color: #e2e8f0;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.72);
}

.btn-secondary:hover {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(30, 41, 59, 0.82);
}

.btn-danger {
    color: #fecdd3;
    border: 1px solid rgba(251, 113, 133, 0.32);
    background: rgba(127, 29, 29, 0.28);
}

.btn-danger:hover {
    color: white;
    border-color: rgba(251, 113, 133, 0.55);
}

.glass-card,
.kpi-card,
.nav-card,
.glow-card,
.bg-slate-800\/50.backdrop-blur-sm,
#watchlist-container,
#search-results {
    border: 1px solid var(--line) !important;
    background: linear-gradient(180deg, rgba(15, 25, 42, 0.86), rgba(10, 18, 31, 0.72)) !important;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.kpi-card,
.nav-card,
.glow-card {
    border-radius: 1rem !important;
}

.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.kpi-card:hover,
.nav-card:hover,
.glow-card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.35) !important;
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34);
}

.kpi-card h3 {
    color: var(--muted) !important;
    font-size: 0.78rem !important;
    line-height: 1.25;
}

.kpi-card p.text-3xl {
    font-size: clamp(1.45rem, 2vw, 1.9rem) !important;
    line-height: 1.1;
}

.nav-card {
    min-height: 7.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.55);
}

.nav-card svg {
    width: 1.65rem;
    height: 1.65rem;
    margin-bottom: 0.5rem;
}

.nav-card h3 {
    font-size: 0.92rem !important;
    line-height: 1.2;
    font-weight: 800;
}

.nav-card--sky {
    border-color: rgba(56, 189, 248, 0.32);
    background: rgba(56, 189, 248, 0.08);
}

.nav-card--sky svg,
.nav-card--sky h3 {
    color: var(--cyan);
}

.nav-card--emerald {
    border-color: rgba(52, 211, 153, 0.38);
    background: rgba(52, 211, 153, 0.1);
}

.nav-card--emerald svg,
.nav-card--emerald h3 {
    color: var(--emerald);
}

.nav-card--violet {
    border-color: rgba(167, 139, 250, 0.32);
    background: rgba(167, 139, 250, 0.08);
}

.nav-card--violet svg,
.nav-card--violet h3 {
    color: var(--violet);
}

.nav-card--featured {
    border-color: rgba(52, 211, 153, 0.55);
    background: linear-gradient(180deg, rgba(52, 211, 153, 0.14), rgba(15, 23, 42, 0.55));
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.12) inset;
}

.nav-card--featured svg,
.nav-card--featured h3 {
    color: var(--emerald);
}

.progress-bar-bg {
    background: var(--surface-muted);
    border-radius: 999px;
}

.progress-bar-fill {
    background: var(--emerald);
    transition: width 0.5s ease-in-out;
    border-radius: 999px;
}

.draggable-item {
    cursor: default;
}

.edit-mode .draggable-item {
    cursor: grab;
    border: 2px dashed rgba(148, 163, 184, 0.45);
    border-radius: 1rem;
    padding: 0.5rem;
    margin: -0.5rem;
}

.sortable-ghost {
    background: rgba(71, 85, 105, 0.5);
    border-radius: 1rem;
    opacity: 0.5;
}

.top-drops-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.top-drops-list .item-name {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#search-results {
    border: 1px solid var(--line-strong) !important;
    background: linear-gradient(180deg, rgba(15, 25, 42, 0.96), rgba(10, 18, 31, 0.92)) !important;
}

#search-results a {
    text-decoration: none;
    color: var(--text);
}

#search-results a:hover {
    background: rgba(56, 189, 248, 0.1);
    text-decoration: none;
}

.app-topbar-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.5rem;
}

.app-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    shrink: 0;
}

.app-topbar-logout {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 0.45rem;
    border-radius: 0.75rem;
    color: #fecdd3;
    border: 1px solid rgba(251, 113, 133, 0.32);
    background: rgba(127, 29, 29, 0.28);
}

.app-topbar-logout:hover {
    color: white;
    border-color: rgba(251, 113, 133, 0.55);
    text-decoration: none;
}

.app-topbar-logout svg {
    width: 1.15rem;
    height: 1.15rem;
}

.login-page {
    flex: 1;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.login-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (min-width: 1024px) {
    .login-hero-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.login-promo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
}

.login-form-card {
    padding: 1.75rem;
}

.login-mini-chart {
    height: 7rem;
    margin-top: 1.25rem;
    border-radius: 0.85rem;
    border: 1px solid var(--line);
    background: rgba(2, 6, 23, 0.45);
    padding: 0.5rem;
}

.login-mini-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title h2 {
    margin: 0;
}

.muted-label {
    color: var(--muted);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.76), rgba(8, 13, 24, 0.92)),
        linear-gradient(90deg, rgba(56, 189, 248, 0.08), rgba(52, 211, 153, 0.08));
    box-shadow: var(--shadow);
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, black, transparent 78%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
}

.hero-dashboard {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1rem;
    background: rgba(2, 6, 23, 0.55);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.32);
}

.mini-chart {
    height: 8rem;
    border-radius: 0.85rem;
    position: relative;
    min-height: 8rem;
}

.mini-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.hero-dashboard-preview {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1rem;
    background: rgba(2, 6, 23, 0.55);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.32);
    overflow: hidden;
}

.hero-dashboard-preview .preview-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.9);
}

.hero-dashboard-preview .preview-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.35);
}

.hero-dashboard-preview .preview-dot:nth-child(1) { background: #fb7185; }
.hero-dashboard-preview .preview-dot:nth-child(2) { background: #fbbf24; }
.hero-dashboard-preview .preview-dot:nth-child(3) { background: #34d399; }

.app-select select,
select,
input,
textarea {
    border-color: var(--line-strong) !important;
    background-color: rgba(15, 23, 42, 0.78) !important;
}

input::placeholder,
textarea::placeholder {
    color: rgba(145, 162, 184, 0.7);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56, 189, 248, 0.62) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16) !important;
}

.pricing-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(15, 25, 42, 0.86), rgba(10, 18, 31, 0.74));
    box-shadow: var(--shadow);
}

.pricing-card.has-badge {
    overflow: visible;
    padding-top: 3.25rem;
}

.pricing-badge {
    white-space: nowrap;
    line-height: 1.2;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.pricing-card.featured {
    border-color: rgba(56, 189, 248, 0.58);
}

.pricing-card.best {
    border-color: rgba(52, 211, 153, 0.58);
}

.pricing-card:hover {
    transform: translateY(-3px);
}

.stat-strip {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.58);
}

.metric-card,
.mini-metric,
.insight-panel {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(15, 25, 42, 0.88), rgba(9, 16, 28, 0.74));
    box-shadow: var(--shadow);
}

.metric-card {
    position: relative;
    min-height: 10.25rem;
    overflow: hidden;
    padding: 1.25rem;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.25rem;
    background: var(--cyan);
}

.metric-emerald::before { background: var(--emerald); }
.metric-amber::before { background: var(--amber); }
.metric-sky::before { background: var(--cyan); }
.metric-violet::before { background: var(--violet); }

.metric-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 0.65rem;
    color: white;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 900;
    line-height: 1.05;
}

.metric-value.small {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.metric-hint {
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.mini-metric {
    min-height: 7.5rem;
    padding: 1rem;
}

.insight-panel {
    padding: 1.25rem;
}

.insight-row {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 0.85rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.58);
}

.insight-emerald { border-color: rgba(52, 211, 153, 0.28); }
.insight-amber { border-color: rgba(251, 191, 36, 0.28); }
.insight-sky { border-color: rgba(56, 189, 248, 0.28); }
.insight-violet { border-color: rgba(167, 139, 250, 0.28); }

.dashboard-overview + .hidden + [data-id="navigation"],
.dashboard-overview + [data-id="navigation"] {
    margin-top: 0.5rem;
}

/* —— Scroll reveal —— */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .kpi-card:hover,
    .nav-card:hover,
    .glow-card:hover,
    .pricing-card:hover,
    .btn-primary:hover {
        transform: none;
    }
}

/* —— Empty states —— */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border: 1px dashed var(--line-strong);
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.45);
}

.empty-state-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    color: var(--cyan);
    opacity: 0.85;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
}

.empty-state-desc {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

/* —— Data tables —— */
.app-table-wrap {
    overflow: auto;
    max-height: min(70vh, 42rem);
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.5);
}

.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.app-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.app-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: rgba(30, 41, 59, 0.98);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}

.app-table tbody td,
.app-table tbody th {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.app-table tbody tr:nth-child(even) {
    background: rgba(30, 41, 59, 0.22);
}

.app-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.08);
}

.app-table .cell-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.app-table .cell-item img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 0.35rem;
    background: rgba(15, 23, 42, 0.6);
}

.app-table .cell-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-table .cell-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.app-table .cell-account img {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Mobile table cards */
.app-table-mobile-list {
    display: none;
}

@media (max-width: 768px) {
    .app-table-wrap--responsive {
        display: none;
    }

    .app-table-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }

    .app-table-mobile-card {
        border: 1px solid var(--line);
        border-radius: 0.85rem;
        padding: 0.85rem 1rem;
        background: rgba(15, 23, 42, 0.65);
    }

    .app-table-mobile-card .row {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        font-size: 0.85rem;
        padding: 0.2rem 0;
    }

    .app-table-mobile-card .row strong {
        color: var(--muted);
        font-weight: 600;
    }
}

/* —— Skeleton loaders —— */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(51, 65, 85, 0.35) 0%,
        rgba(71, 85, 105, 0.55) 50%,
        rgba(51, 65, 85, 0.35) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: rgba(51, 65, 85, 0.45);
    }
}

.is-loading .skeleton-block {
    display: block;
}

.is-loading .skeleton-hide {
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

/* —— Mobile bottom nav —— */
.app-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(7, 17, 31, 0.94);
    backdrop-filter: blur(14px);
    justify-content: space-around;
    gap: 0.25rem;
}

.app-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--muted);
    border-radius: 0.65rem;
    min-width: 3.5rem;
}

.app-mobile-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
}

.app-mobile-nav-item.active,
.app-mobile-nav-item:hover {
    color: white;
    background: rgba(56, 189, 248, 0.12);
}

.app-footer {
    margin-top: 3rem;
    padding: 2rem 0 1.5rem;
    text-align: center;
    color: var(--soft);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.app-footer-links a {
    color: var(--cyan);
    font-weight: 600;
}

.app-topbar--minimal {
    justify-content: center;
}

body.has-mobile-nav {
    padding-bottom: 4.5rem;
}

@media (max-width: 768px) {
    .app-mobile-nav {
        display: flex;
    }

    body.has-mobile-nav {
        padding-bottom: 5rem;
    }
}

.switch { position: relative; display: inline-block; width: 52px; height: 30px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0;
    background-color: rgba(71, 85, 105, 0.85);
    transition: 0.3s; border-radius: 999px;
}
.switch .slider:before {
    position: absolute; content: ""; height: 22px; width: 22px;
    left: 4px; bottom: 4px; background-color: white;
    transition: 0.3s; border-radius: 50%;
}
.switch input:checked + .slider { background-color: rgba(52, 211, 153, 0.85); }
.switch input:checked + .slider:before { transform: translateX(22px); }

/* —— Preference pills (currency / language) —— */
.pref-switch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.pref-group {
    display: inline-flex;
    align-items: center;
    gap: 0.12rem;
    padding: 0.18rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
}

.pref-pill {
    display: inline-flex;
    min-width: 2rem;
    min-height: 1.85rem;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--muted);
    text-decoration: none;
    line-height: 1;
}

.pref-pill:hover {
    color: white;
    background: rgba(148, 163, 184, 0.14);
    text-decoration: none;
}

.pref-pill--currency.active {
    color: #1a1200;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.96), rgba(250, 204, 21, 0.9));
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.22);
}

.pref-pill--lang.active {
    color: white;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.78), rgba(52, 211, 153, 0.68));
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.18);
}

/* —— Shared panels & cards —— */
.app-panel {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(15, 25, 42, 0.78), rgba(9, 16, 28, 0.62));
    box-shadow: var(--shadow);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
}

.sub-card {
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: rgba(30, 41, 59, 0.52);
    padding: 1rem;
}

.item-card-inner,
.item-content {
    border: 1px solid var(--line-strong);
    border-radius: 0.75rem;
    background: rgba(30, 41, 59, 0.55);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.item-card-inner:hover,
.item-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.sort-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.65rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--muted);
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.65);
    text-decoration: none;
}

.sort-pill:hover {
    color: white;
    border-color: rgba(56, 189, 248, 0.45);
    text-decoration: none;
}

.sort-pill.active {
    color: white;
    background: rgba(14, 165, 233, 0.88);
    border-color: transparent;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
    padding-bottom: 0.35rem;
}

.tab-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    border-radius: 0.45rem 0.45rem 0 0;
    cursor: pointer;
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
}

.flash-banner {
    padding: 1rem 1.25rem;
    border-radius: 0.85rem;
    text-align: center;
    font-weight: 600;
}

.flash-banner--success {
    color: #6ee7b7;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.flash-banner--error {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.flash-banner--info {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.btn-danger--icon {
    min-height: 2rem;
    min-width: 2rem;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 0.5rem;
}

.help-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.12);
    color: var(--cyan);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}

.help-hint:hover,
.help-hint.is-open {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.65);
}

.help-hint-popover {
    position: fixed;
    z-index: 60;
    max-width: min(18rem, calc(100vw - 2rem));
    padding: 0.65rem 0.85rem;
    border-radius: 0.65rem;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    font-size: 0.8rem;
    line-height: 1.45;
    box-shadow: var(--shadow);
    pointer-events: none;
}

[data-theme="light"] .help-hint-popover {
    background: rgba(255, 255, 255, 0.98);
    color: #334155;
}

.public-mobile-nav {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.public-mobile-nav::-webkit-scrollbar {
    display: none;
}

.public-mobile-nav .app-mobile-nav-item {
    flex: 0 0 auto;
    min-width: 4.1rem;
}

/* —— Page hero (inner pages) —— */
.page-hero {
    margin-bottom: 2rem;
}

.page-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    color: white;
}

.page-hero p {
    margin-top: 0.5rem;
    color: var(--muted);
}

@media (max-width: 767px) {
    .app-topbar-nav {
        display: none;
    }

    .app-topbar-logout {
        display: inline-flex;
    }

    .app-topbar {
        flex-direction: row;
        align-items: center;
        position: sticky;
        top: 0.5rem;
        padding: 0.65rem 0.75rem;
    }

    .app-mobile-nav {
        gap: 0.1rem;
    }

    .app-mobile-nav-item {
        min-width: 0;
        flex: 1;
        font-size: 0.6rem;
        padding: 0.3rem 0.2rem;
    }

    .app-mobile-nav-item span {
        max-width: 4.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 720px) {
    body {
        padding: 1rem !important;
    }

    .nav-pill {
        padding-inline: 0.75rem;
    }

    .kpi-card {
        padding: 1rem !important;
    }

    .hero-panel {
        border-radius: 1.1rem;
    }
}

/* —— Light theme (public / landing) —— */
[data-theme="light"] {
    color-scheme: light;
    --app-bg: #f1f5f9;
    --app-bg-soft: #e2e8f0;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --surface-muted: rgba(241, 245, 249, 0.92);
    --line: rgba(100, 116, 139, 0.2);
    --line-strong: rgba(100, 116, 139, 0.32);
    --text: #0f172a;
    --muted: #475569;
    --soft: #64748b;
    --shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] * {
    scrollbar-color: rgba(14, 165, 233, 0.45) rgba(226, 232, 240, 0.9);
}

[data-theme="light"] body {
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(241, 245, 249, 0.35), rgba(241, 245, 249, 1) 62%),
        radial-gradient(circle at 14% -10%, rgba(52, 211, 153, 0.12), transparent 34rem),
        radial-gradient(circle at 90% 6%, rgba(56, 189, 248, 0.1), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, #e2e8f0 46%, #f1f5f9 100%) !important;
}

[data-theme="light"] ::selection {
    background: rgba(14, 165, 233, 0.22);
    color: #0f172a;
}

[data-theme="light"] .app-topbar {
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .brand-mark {
    color: #0f172a;
}

[data-theme="light"] .page-hero h1 {
    color: #0f172a;
}

[data-theme="light"] .text-white {
    color: #0f172a !important;
}

[data-theme="light"] .text-gray-200 {
    color: #334155 !important;
}

[data-theme="light"] .text-gray-300 {
    color: #475569 !important;
}

[data-theme="light"] .text-gray-400 {
    color: #64748b !important;
}

[data-theme="light"] .text-gray-500 {
    color: #64748b !important;
}

[data-theme="light"] .text-sky-300 {
    color: #0284c7 !important;
}

[data-theme="light"] .text-emerald-300 {
    color: #059669 !important;
}

[data-theme="light"] .border-slate-700,
[data-theme="light"] .border-slate-700\/60 {
    border-color: rgba(100, 116, 139, 0.28) !important;
}

[data-theme="light"] .border-slate-800\/80 {
    border-color: rgba(100, 116, 139, 0.2) !important;
}

[data-theme="light"] .border-slate-600 {
    border-color: rgba(100, 116, 139, 0.35) !important;
}

[data-theme="light"] .bg-slate-800\/50,
[data-theme="light"] .bg-slate-900 {
    background-color: rgba(255, 255, 255, 0.92) !important;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background-color: #fff !important;
    color: #0f172a !important;
}

[data-theme="light"] .glass-card,
[data-theme="light"] .kpi-card,
[data-theme="light"] .nav-card,
[data-theme="light"] .glow-card,
[data-theme="light"] .hero-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9)) !important;
    border-color: var(--line) !important;
    box-shadow: var(--shadow);
}

[data-theme="light"] .nav-pill {
    color: var(--muted);
}

[data-theme="light"] .nav-pill:hover,
[data-theme="light"] .nav-pill.active {
    color: #0f172a;
    background: rgba(14, 165, 233, 0.1);
}

[data-theme="light"] .faq-item,
[data-theme="light"] .feature-card,
[data-theme="light"] .step-card,
[data-theme="light"] .pricing-card {
    background: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .app-mobile-nav,
[data-theme="light"] .public-mobile-nav {
    background: rgba(255, 255, 255, 0.94);
}

[data-theme="light"] .app-table-mobile-card {
    background: rgba(255, 255, 255, 0.92);
}

[data-theme="light"] .tab-btn:hover,
[data-theme="light"] .tab-btn.active {
    color: #0284c7;
}

[data-theme="light"] .flash-banner--success {
    color: #047857;
    background: rgba(52, 211, 153, 0.14);
}

[data-theme="light"] .flash-banner--error {
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.12);
}

[data-theme="light"] .flash-banner--info {
    color: #0369a1;
    background: rgba(56, 189, 248, 0.12);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
}

html:not([data-theme="light"]) .theme-toggle-icon--light {
    display: none;
}

html[data-theme="light"] .theme-toggle-icon--dark {
    display: none;
}
