/* Dummy Stock — new shell (vNext) */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #0c0f14;
    --surface: #151a22;
    --surface-raised: #1c2330;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8eaed;
    --text-muted: #9aa3b2;
    --accent: #6b9fff;
    --accent-hover: #8ab4ff;
    --banner-bg: #3d2e12;
    --banner-border: #c9922e;
    --banner-text: #ffe8b8;
    --radius: 12px;
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    --header-h: 3.5rem;
    --banner-h: 3rem;
    --panel-w: min(22rem, 100vw);
    --touch-min: 2.75rem;
    --bottom-nav-h: 0px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

html,
body {
    height: 100%;
}

body.shell {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

.shell-frame {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: transform 0.45s var(--ease);
    flex: 1;
    min-width: 0;
}

body.shell {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    display: flex;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}

body.shell.shell--has-rail {
    --nav-w: 16rem;
}

body.shell.shell--signed-in {
    --nav-w: 16rem;
}

body.shell.shell--has-rail .shell-frame {
    margin-left: var(--nav-w);
}

/* Left navigation */

.shell-nav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    width: var(--nav-w, 16rem);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.shell-nav__brand {
    flex-shrink: 0;
    padding: 0.85rem 1rem 0.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.shell-nav__account {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.shell-nav__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-raised);
    font-size: 0.875rem;
    font-weight: 700;
}

.shell-nav__account-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.shell-nav__account-name {
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-nav__account-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.shell-nav__menu {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.35rem 0.5rem 0.75rem;
}

.shell-nav__category {
    border-radius: 8px;
}

.shell-nav__category + .shell-nav__category {
    margin-top: 0.15rem;
}

.shell-nav__category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.shell-nav__category-toggle::-webkit-details-marker {
    display: none;
}

.shell-nav__category-toggle::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s var(--ease);
    opacity: 0.7;
    flex-shrink: 0;
}

.shell-nav__category[open] > .shell-nav__category-toggle::after {
    transform: rotate(-135deg);
    margin-top: 0.2rem;
}

.shell-nav__category-toggle:hover {
    color: var(--text);
    background: var(--surface-raised);
    border-radius: 8px;
}

.shell-nav__category-items {
    padding: 0.15rem 0 0.35rem 0.35rem;
}

.shell-nav__link {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.shell-nav__link:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.shell-nav__link.is-active {
    background: rgba(107, 159, 255, 0.12);
    color: var(--accent);
}

.shell-nav__footer {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.shell-header {
    min-height: var(--header-h);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.shell-header__left,
.shell-header__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.shell-header__left {
    justify-self: start;
}

.shell-header__right {
    justify-self: end;
}

.shell-header__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 0;
    max-width: 36rem;
    width: 100%;
    justify-self: center;
}

.shell-header__server {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.8125rem;
    color: inherit;
    font-family: inherit;
    line-height: 1.25;
    text-align: left;
}

.shell-header__server.is-expandable {
    cursor: pointer;
}

.shell-header__server.is-expandable:hover {
    border-color: rgba(91, 156, 255, 0.45);
    background: var(--surface-raised);
}

.shell-header__server.is-error {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.08);
}

.shell-header__server:disabled {
    cursor: default;
}

.shell-header__server-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
    gap: 0.05rem;
}

.shell-header__server-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.shell-header__server-dot.is-live { background: #58c482; box-shadow: 0 0 0 3px rgba(88, 196, 130, 0.15); }
.shell-header__server-dot.is-idle { background: #f5a623; }
.shell-header__server-dot.is-offline { background: #ff6b6b; }
.shell-header__server-dot.is-error { background: #ff6b6b; box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15); }

.shell-header__server-state {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.shell-header__server-hint {
    color: var(--text-muted);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.shell-header__server-hint[hidden],
.shell-header__server-phase[hidden],
.shell-header__server-chevron[hidden] {
    display: none;
}

.shell-header__server-phase {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.shell-header__server-chevron,
.shell-header__update-chevron {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
}

.shell-header__update {
    display: none;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    max-width: 100%;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--banner-border);
    background: var(--banner-bg);
    color: var(--banner-text);
    font-size: 0.75rem;
    font-family: inherit;
    text-align: left;
}

.shell-header__update.is-expandable {
    cursor: pointer;
}

.shell-header__update.is-expandable:hover {
    filter: brightness(1.05);
}

.shell-header__update.is-visible {
    display: flex;
}

.shell-header__update-label {
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.shell-header__update-track {
    flex: 1;
    min-width: 4rem;
    height: 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.shell-header__update-fill {
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #e8b44a, #ffe8b8);
    animation: shell-update-indeterminate 1.6s ease-in-out infinite;
}

@keyframes shell-update-indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

.shell-header__update-text {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.92;
}

.shell-header__badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.shell-header__badge.is-signed-in {
    color: #9be7b5;
    border-color: rgba(88, 196, 130, 0.35);
}

.shell-header__user {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.shell-nav-toggle {
    display: none;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
}

body.shell.shell--has-rail .shell-nav-toggle {
    display: none;
}

@media (max-width: 900px) {
    body.shell.shell--has-rail .shell-nav-toggle {
        display: inline-flex;
    }

    .shell-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 0.45rem 0.6rem;
        padding: 0.45rem 0.75rem;
    }

    .shell-header__left {
        grid-column: 1;
        grid-row: 1;
        gap: 0.45rem;
    }

    .shell-header__right {
        grid-column: 3;
        grid-row: 1;
        gap: 0.45rem;
    }

    .shell-header__center {
        display: contents;
    }

    .shell-header__server {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.15rem 0.5rem;
    }

    .shell-header__server-phase {
        display: none;
    }

    .shell-header__server-hint {
        display: block;
    }

    .shell-header__update {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        border-radius: 10px;
    }

    .shell-header__badge {
        display: none;
    }

    .shell-header__user {
        max-width: 5.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8125rem;
    }

    .shell-header__right .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.8125rem;
    }

    .shell-nav-toggle {
        padding: 0.35rem 0.6rem;
        font-size: 0.8125rem;
    }

    body.shell:not(.shell--has-rail) .shell-header__left {
        display: none;
    }

    body.shell:not(.shell--has-rail) .shell-header__server {
        grid-column: 1 / 3;
    }
}

@media (max-width: 420px) {
    .shell-header__user {
        display: none;
    }
}

.login-panel__notice--error {
    border-color: rgba(255, 120, 120, 0.35);
    background: rgba(120, 24, 24, 0.25);
    color: #ffc9c9;
}

.page-placeholder,
.auth-card {
    width: min(32rem, 100%);
    margin: 0 auto;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.page-placeholder h1,
.auth-card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.page-placeholder p,
.auth-card__lead,
.auth-card__footer {
    margin: 0;
    color: var(--text-muted);
}

.auth-card__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.25rem;
}

.auth-card__footer {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.auth-card a,
.login-panel__hint a {
    color: var(--accent);
}

@media (max-width: 900px) {
    body.shell.shell--has-rail .shell-frame {
        margin-left: 0;
    }

    .shell-nav {
        transform: translateX(-100%);
        transition: transform 0.35s var(--ease);
        box-shadow: var(--shadow);
        z-index: 120;
    }

    body.shell.shell-nav-open .shell-nav {
        transform: translateX(0);
    }
}

.shell-main {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.25rem;
}

.shell-main > * {
    width: 100%;
    min-width: 0;
}

/* Settings page */

.settings-page {
    width: min(72rem, 100%);
    margin: 0 auto;
}

.settings-page__intro {
    margin-bottom: 1rem;
}

.settings-page__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.settings-page__lead {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.settings-page__alert {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.settings-page__alert--error {
    border: 1px solid rgba(255, 120, 120, 0.35);
    background: rgba(120, 24, 24, 0.25);
    color: #ffc9c9;
}

.settings-page__alert--success {
    border: 1px solid rgba(88, 196, 130, 0.35);
    background: rgba(36, 110, 62, 0.2);
    color: #9be7b5;
}

.settings-page__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 17rem);
    gap: 1.25rem;
    align-items: start;
}

.settings-page__panels {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.settings-loading {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.settings-loading--error {
    color: #ffc9c9;
}

.settings-dock {
    position: sticky;
    top: 1rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.settings-dock__card--presets {
    padding-bottom: 0.85rem;
}

.settings-dock__hint--top {
    margin: 0 0 0.75rem;
}

.settings-presets {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.settings-presets__empty {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.settings-preset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.settings-preset:hover:not(:disabled) {
    border-color: rgba(107, 159, 255, 0.45);
    background: rgba(107, 159, 255, 0.08);
}

.settings-preset:active:not(:disabled) {
    transform: scale(0.99);
}

.settings-preset:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-preset__label {
    font-size: 0.8125rem;
    font-weight: 600;
}

.settings-preset__hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.settings-preset--quality { border-left: 3px solid rgba(107, 159, 255, 0.75); }
.settings-preset--evolution { border-left: 3px solid rgba(160, 120, 255, 0.75); }
.settings-preset--pressure { border-left: 3px solid rgba(255, 140, 100, 0.75); }
.settings-preset--trading { border-left: 3px solid rgba(88, 196, 130, 0.75); }
.settings-preset--vault { border-left: 3px solid rgba(180, 140, 255, 0.75); }
.settings-preset--diversity { border-left: 3px solid rgba(255, 200, 80, 0.75); }
.settings-preset--relief { border-left: 3px solid rgba(140, 180, 200, 0.75); }

.settings-dock__card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.settings-dock__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.settings-dock__status {
    margin: 0 0 0.85rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.settings-dock__status.is-dirty {
    color: #f5c26b;
}

.settings-dock__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-dock__hint {
    margin: 0.75rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.settings-category {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.settings-category__head {
    padding: 1rem 1.1rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.settings-category__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.settings-category__desc {
    margin: 0.3rem 0 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.settings-category__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
}

.settings-field {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.settings-field__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.settings-field__labels {
    min-width: 0;
}

.settings-field__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.settings-field__description {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.settings-field__graph {
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.settings-field__control .field__input {
    width: 100%;
}

.settings-field__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.45rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
}

.settings-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-toggle__track {
    width: 2.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border);
    position: relative;
    transition: background 0.2s var(--ease);
}

.settings-toggle__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.settings-toggle input:checked + .settings-toggle__track {
    background: rgba(107, 159, 255, 0.25);
    border-color: rgba(107, 159, 255, 0.45);
}

.settings-toggle input:checked + .settings-toggle__track::after {
    transform: translateX(1rem);
    background: var(--accent);
}

.settings-toggle__text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .settings-page__layout {
        grid-template-columns: 1fr;
    }

    .settings-dock {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: 0 -0.25rem;
    }

    .settings-category__grid {
        grid-template-columns: 1fr;
    }
}

/* Login side panel */

.shell-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.shell-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.shell-backdrop[hidden] {
    display: block;
}

.login-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    width: var(--panel-w);
    height: 100dvh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    display: flex;
    flex-direction: column;
}

.login-panel.is-open {
    transform: translateX(0);
}

.login-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.login-panel__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.login-panel__close {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.login-panel__close:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.login-panel__form {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-panel__hint,
.login-panel__notice {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.login-panel__notice {
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
}

/* Server status detail panel */

.shell-status-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.shell-status-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.shell-status-backdrop[hidden] {
    display: block;
}

.shell-status-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 95;
    width: min(28rem, 100vw);
    height: 100dvh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    display: flex;
    flex-direction: column;
}

.shell-status-panel.is-open {
    transform: translateX(0);
}

.shell-status-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.shell-status-panel__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.shell-status-panel__close {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.shell-status-panel__close:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.shell-status-panel__body {
    padding: 1rem 1.25rem 1.5rem;
    overflow: auto;
}

.shell-status-facts {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shell-status-fact {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.shell-status-fact dt {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.shell-status-fact dd {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.shell-status-fact--emphasis dd {
    color: #ffc9c9;
}

.shell-status-error-text {
    color: #ffc9c9;
}

.shell-status-subtitle {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.9rem;
}

.shell-status-lines {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.shell-status-note,
.shell-status-panel__loading {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 700px) {
    .shell-status-fact {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

/* Form */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.field__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.field__input {
    width: 100%;
    padding: 0.7rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.field__input:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 1px;
    border-color: var(--accent);
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--ghost {
    border-color: var(--border);
    color: var(--text-muted);
}

.btn--ghost:hover {
    background: var(--surface);
    color: var(--text);
}

.btn--primary {
    background: var(--accent);
    color: #0b1020;
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--block {
    width: 100%;
}

/* Public empty page */

.public-canvas {
    text-align: center;
    max-width: 28rem;
}

.public-canvas__mark {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.public-canvas__title {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Error page */

.error-card {
    width: min(28rem, 100%);
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.error-card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.error-card p {
    margin: 0;
    color: var(--text-muted);
}

.error-card__detail {
    margin-top: 0.75rem !important;
    font-size: 0.875rem;
}

/* Home page */

.home-layout {
    width: min(72rem, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
    gap: 1.25rem;
    align-items: start;
}

.home-layout__main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.home-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 120, 120, 0.35);
    background: rgba(120, 24, 24, 0.25);
    color: #ffc9c9;
    font-size: 0.9rem;
}

.home-section__head {
    margin-bottom: 0.875rem;
}

.home-section__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.home-section__lead {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.home-employees {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.875rem;
}

.home-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.home-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.home-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.home-card__meta {
    margin: 0.5rem 0 0.875rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.home-metrics {
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.home-metrics div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
}

.home-metrics dt {
    color: var(--text-muted);
}

.home-metrics dd {
    margin: 0;
    font-weight: 500;
}

.home-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.home-pill.is-live {
    border-color: rgba(88, 196, 130, 0.35);
    color: #9be7b5;
    background: rgba(36, 110, 62, 0.2);
}

.home-recommendations {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.home-rec-table__head,
.home-rec-table__row {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr 1fr 1.1fr;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    align-items: center;
}

.home-rec-table__head {
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-rec-table__row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.home-rec-table__row--link {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.home-rec-table__row--link:hover,
.home-rec-table__row--link:focus-visible {
    background: rgba(255, 255, 255, 0.04);
}

.home-rec-symbol {
    font-weight: 600;
}

.home-rec-checked {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.home-label {
    display: inline-flex;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.home-label--strong-buy { color: #9be7b5; border-color: rgba(88, 196, 130, 0.35); }
.home-label--buy { color: #9fd0ff; border-color: rgba(107, 159, 255, 0.35); }
.home-label--watch { color: #ffe08a; border-color: rgba(245, 166, 35, 0.35); }
.home-label--avoid { color: #ffb4b4; border-color: rgba(255, 120, 120, 0.35); }
.home-label--danger { color: #ff8f8f; border-color: rgba(255, 80, 80, 0.45); }

.home-status {
    position: sticky;
    top: 1rem;
}

.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}

.home-leaderboard__body {
    min-height: 0;
}

.home-leaderboard__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.home-leaderboard__item {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) auto;
    gap: 0.625rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.home-leaderboard__item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.home-leaderboard__rank {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}

.home-leaderboard__item:nth-child(1) .home-leaderboard__rank { color: #f5d06b; }
.home-leaderboard__item:nth-child(2) .home-leaderboard__rank { color: #c8d0db; }
.home-leaderboard__item:nth-child(3) .home-leaderboard__rank { color: #d9a066; }

.home-leaderboard__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.home-leaderboard__name {
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-leaderboard__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.home-leaderboard__tag {
    display: inline-flex;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.home-leaderboard__tag--tier {
    color: #9fd0ff;
    border-color: rgba(107, 159, 255, 0.25);
}

.home-leaderboard__item--employee .home-leaderboard__tag:first-child {
    color: #9be7b5;
    border-color: rgba(88, 196, 130, 0.25);
}

.home-leaderboard__worth {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.home-status__card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem;
}

.home-status__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.home-status__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.home-status__dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.home-status__dot.is-live { background: #58c482; box-shadow: 0 0 0 4px rgba(88, 196, 130, 0.15); }
.home-status__dot.is-idle { background: #f5a623; }
.home-status__dot.is-offline { background: #ff6b6b; }

.home-status__list {
    margin: 0;
    display: grid;
    gap: 0.625rem;
}

.home-status__row {
    display: grid;
    gap: 0.15rem;
}

.home-status__row dt {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.home-status__row dd {
    margin: 0;
    font-size: 0.875rem;
    word-break: break-word;
}

.home-loading,
.home-empty {
    margin: 0;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.home-empty--warn {
    color: #ffc9c9;
}

@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .home-sidebar {
        position: static;
    }

    .home-status {
        position: static;
    }

    .home-rec-table__head {
        display: none;
    }

    .home-rec-table__row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "symbol label"
            "current expected"
            "checked checked";
    }

    .home-rec-table__row .home-rec-symbol { grid-area: symbol; }
    .home-rec-table__row span:nth-child(2) { grid-area: label; justify-self: end; }
    .home-rec-table__row span:nth-child(3) { grid-area: current; }
    .home-rec-table__row span:nth-child(4) { grid-area: expected; justify-self: end; }
    .home-rec-table__row .home-rec-checked { grid-area: checked; }
}

/* Market data page */

.market-page {
    width: min(80rem, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.market-page__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.market-page__lead {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.market-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.market-page__alert--error {
    border: 1px solid rgba(255, 120, 120, 0.35);
    background: rgba(120, 24, 24, 0.25);
    color: #ffc9c9;
}

.market-loading {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.market-loading--error {
    color: #ffc9c9;
}

.market-summary__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
}

.market-summary__card {
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.market-summary__label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.market-summary__value {
    font-size: 0.95rem;
    font-weight: 600;
}

.market-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
}

.market-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.market-card__head {
    padding: 0.9rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.market-card__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.market-card__lead {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.market-chart {
    min-height: 260px;
    padding: 0.75rem;
}

.market-chart__svg {
    width: 100%;
    height: 260px;
    display: block;
}

.market-chart__grid {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1;
}

.market-chart__axis {
    fill: var(--text-muted);
    font-size: 10px;
}

.market-toolbar {
    display: grid;
    grid-template-columns: minmax(12rem, 1.4fr) repeat(5, minmax(7rem, 1fr));
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}

.market-toolbar__label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.market-table-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.market-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.market-pagination__label {
    white-space: nowrap;
}

.market-table-wrap {
    overflow: auto;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.market-table th,
.market-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.market-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--surface-raised);
}

.market-symbol-row {
    cursor: pointer;
}

.market-symbol-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.market-symbol-row.is-selected {
    background: rgba(107, 159, 255, 0.12);
}

.market-symbol-row.is-missing {
    opacity: 0.72;
}

.market-table .is-up {
    color: #9be7b5;
}

.market-table .is-down {
    color: #ffc9c9;
}

@media (max-width: 1100px) {
    .market-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .market-table-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .market-charts {
        grid-template-columns: 1fr;
    }
}

/* Portfolio */
.portfolio-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.portfolio-page__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.portfolio-page__title {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.65rem;
}

.portfolio-page__lead {
    margin: 0;
    max-width: 52ch;
    color: var(--text-muted);
    line-height: 1.5;
}

.portfolio-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.portfolio-page__alert--error {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.08);
    color: #ffc9c9;
}

.portfolio-page__alert--success {
    border-color: rgba(46, 160, 90, 0.35);
    background: rgba(46, 160, 90, 0.08);
    color: #b7e4c7;
}

.portfolio-gate {
    padding: 1.25rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    text-align: center;
}

.portfolio-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.portfolio-stat {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.portfolio-stat.is-good .portfolio-stat__value {
    color: #9be7b5;
}

.portfolio-stat.is-bad .portfolio-stat__value {
    color: #ffc9c9;
}

.portfolio-stat__label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.portfolio-stat__value {
    font-size: 1.15rem;
    font-weight: 700;
}

.portfolio-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: var(--surface);
}

.portfolio-card__head {
    margin-bottom: 0.85rem;
}

.portfolio-card__title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.portfolio-card__lead {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.portfolio-loading {
    margin: 0;
    color: var(--text-muted);
}

.portfolio-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portfolio-alert-chip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.portfolio-alert-chip.is-caution {
    border-color: rgba(240, 180, 41, 0.35);
    background: rgba(240, 180, 41, 0.08);
}

.portfolio-alert-chip.is-warning {
    border-color: rgba(220, 80, 80, 0.35);
    background: rgba(220, 80, 80, 0.08);
}

.portfolio-add-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.portfolio-add-actions {
    display: flex;
    align-items: flex-end;
}

.portfolio-holdings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.85rem;
}

.portfolio-holding-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface-raised);
}

.portfolio-holding-card.portfolio-alert-warning {
    border-color: rgba(220, 80, 80, 0.4);
    box-shadow: inset 3px 0 0 rgba(220, 80, 80, 0.75);
}

.portfolio-holding-card.portfolio-alert-caution {
    border-color: rgba(240, 180, 41, 0.4);
    box-shadow: inset 3px 0 0 rgba(240, 180, 41, 0.75);
}

.portfolio-holding-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.portfolio-holding-symbol {
    font-size: 1.2rem;
    font-weight: 700;
}

.portfolio-holding-notes {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
}

.portfolio-holding-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.portfolio-holding-metrics dt {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.portfolio-holding-metrics dd {
    margin: 0.1rem 0 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.portfolio-holding-signal {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.portfolio-holding-signal.is-ok {
    border-color: rgba(46, 160, 90, 0.25);
    background: rgba(46, 160, 90, 0.06);
}

.portfolio-holding-signal-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.portfolio-holding-signal.is-ok .portfolio-holding-signal-label {
    color: #9be7b5;
}

.portfolio-holding-signal-text {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.portfolio-holding-signal-text.is-muted {
    color: var(--text-muted);
}

.portfolio-holding-freshness {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portfolio-holding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.portfolio-holding-card.is-checking {
    position: relative;
}

.portfolio-holding-card.is-checking::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: rgba(8, 12, 18, 0.35);
    pointer-events: none;
}

.portfolio-check-status-wrap.is-error .portfolio-check-status {
    color: #ffc9c9;
}

.portfolio-table-wrap {
    overflow: auto;
}

.portfolio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.portfolio-table th,
.portfolio-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.portfolio-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.portfolio-table .is-up {
    color: #9be7b5;
}

.portfolio-table .is-down {
    color: #ffc9c9;
}

.rec-action-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.rec-action-strong-buy { background: rgba(46, 160, 90, 0.2); color: #7dffb0; }
.rec-action-buy { background: rgba(91, 156, 255, 0.2); color: #9ec5ff; }
.rec-action-watch { background: rgba(240, 180, 41, 0.2); color: #f0c451; }
.rec-action-avoid { background: rgba(220, 120, 60, 0.2); color: #ffb07a; }
.rec-action-danger { background: rgba(220, 80, 80, 0.25); color: #ff9a9a; }
.rec-action-unknown { background: rgba(128, 128, 128, 0.2); color: var(--text-muted); }

.portfolio-trade-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.portfolio-trade-modal[hidden] {
    display: none !important;
}

body.portfolio-trade-open {
    overflow: hidden;
}

.portfolio-trade-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 8, 20, 0.72);
}

.portfolio-trade-dialog {
    position: relative;
    width: min(420px, 100%);
    margin: 0;
    padding: 1.1rem;
    z-index: 1;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.portfolio-trade-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.portfolio-trade-title {
    margin: 0;
    font-size: 1.15rem;
}

.portfolio-trade-close-btn {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.portfolio-trade-close-btn:hover {
    opacity: 1;
}

.portfolio-trade-symbol-pill {
    margin: 0.5rem 0 0.75rem;
}

.portfolio-trade-symbol {
    font-size: 1.2rem;
}

.portfolio-trade-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.portfolio-trade-status.is-error {
    color: #ffc9c9;
}

@media (max-width: 700px) {
    .portfolio-holding-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portfolio-add-form {
        grid-template-columns: 1fr;
    }
}

/* Profile */
.profile-page,
.membership-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.profile-page__eyebrow,
.membership-page__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.profile-page__title,
.membership-page__title {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.65rem;
}

.membership-page__lead,
.profile-hero-subtitle {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.profile-page__alert,
.membership-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.profile-page__alert--error,
.membership-page__alert--error {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.08);
    color: #ffc9c9;
}

.membership-page__alert--success {
    border-color: rgba(46, 160, 90, 0.35);
    background: rgba(46, 160, 90, 0.08);
    color: #b7e4c7;
}

.profile-gate,
.membership-gate {
    padding: 1.25rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    text-align: center;
}

.profile-content,
.membership-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-card,
.membership-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: var(--surface);
}

.profile-card--hero {
    background: linear-gradient(145deg, rgba(91, 156, 255, 0.08) 0%, var(--surface) 50%);
    border-color: rgba(91, 156, 255, 0.22);
}

.profile-card__title,
.membership-card__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.profile-card__lead,
.membership-card__lead {
    margin: 0 0 0.85rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.profile-card__head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-hero-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 999px;
    background: linear-gradient(145deg, #4f8cff, #6366f1);
    color: #fff;
    font-size: 1.45rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.profile-kind-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.profile-kind-admin {
    border-color: rgba(91, 156, 255, 0.35);
    color: #9ec5ff;
}

.profile-kind-moderator {
    border-color: rgba(240, 180, 41, 0.35);
    color: #f0c451;
}

.profile-kind-bot {
    border-color: rgba(180, 140, 255, 0.35);
    color: #c4a8ff;
}

.profile-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.85rem 1.25rem;
    margin: 0;
}

.profile-facts dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.profile-facts dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.profile-facts dd.is-up {
    color: #9be7b5;
}

.profile-facts dd.is-down {
    color: #ffc9c9;
}

.profile-profit-chart-host {
    margin-top: 0.75rem;
    min-height: 120px;
}

.profile-profit-chart-svg {
    display: block;
    width: 100%;
    height: auto;
}

.profile-bots {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.profile-bot-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.profile-bot-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.profile-bot-name {
    font-size: 0.95rem;
}

.profile-bot-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.profile-bot-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.15);
    color: var(--text-muted);
}

.profile-bot-status.is-living {
    background: rgba(46, 160, 90, 0.15);
    color: #9be7b5;
}

.profile-loading,
.membership-loading {
    margin: 0;
    color: var(--text-muted);
}

/* Membership */
.membership-card--current {
    border-color: rgba(91, 156, 255, 0.25);
}

.membership-card--exclusive {
    border-color: rgba(180, 140, 255, 0.3);
}

.membership-current-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.membership-current-label {
    display: block;
    font-size: 1.1rem;
}

.membership-current-limits {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.membership-current-desc,
.membership-tier-desc {
    margin: 0.65rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.membership-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.membership-tier-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-raised);
}

.membership-tier-card.is-owned {
    opacity: 0.82;
}

.membership-tier-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.membership-tier-price {
    font-size: 1.2rem;
    font-weight: 700;
}

.membership-tier-perks {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    flex: 1;
}

.membership-tier-owned,
.membership-tier-exclusive {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.membership-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    overflow: hidden;
    isolation: isolate;
}

.membership-badge-compact {
    padding: 0.12rem 0.45rem;
    font-size: 0.65rem;
}

.membership-badge-label {
    position: relative;
    z-index: 1;
}

.membership-badge-shine {
    position: absolute;
    inset: -40% -80%;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        105deg,
        transparent 38%,
        rgba(255, 255, 255, 0.15) 44%,
        rgba(255, 255, 255, 0.65) 50%,
        rgba(255, 255, 255, 0.15) 56%,
        transparent 62%
    );
    transform: translateX(-120%) skewX(-18deg);
    animation: membership-badge-shine 2.8s ease-in-out infinite;
}

@keyframes membership-badge-shine {
    0%, 72% { transform: translateX(-120%) skewX(-18deg); }
    100% { transform: translateX(120%) skewX(-18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .membership-badge-shine {
        animation: none;
        opacity: 0;
    }
}

.membership-badge-bronze {
    color: #5c3d1e;
    background: linear-gradient(135deg, #e8c4a0, #c98b5f);
    border-color: #a66b42;
}

.membership-badge-silver {
    color: #2f3540;
    background: linear-gradient(135deg, #f0f3f8, #b8c0cc);
    border-color: #98a3b3;
}

.membership-badge-gold {
    color: #4a3b12;
    background: linear-gradient(135deg, #ffe9a8, #e8b84a);
    border-color: #c99a2e;
}

.membership-badge-platinum {
    color: #1f2a38;
    background: linear-gradient(135deg, #e8f4ff, #9eb8d9);
    border-color: #6f8fb8;
}

.membership-badge-diamond {
    color: #e8f4ff;
    background: linear-gradient(135deg, #4f8cff, #6366f1 45%, #a855f7);
    border-color: #7c9fff;
}

.membership-badge-free {
    color: var(--text-muted);
    background: rgba(128, 128, 128, 0.15);
    border-color: var(--border);
}

.membership-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.membership-modal[hidden] {
    display: none !important;
}

body.membership-modal-open {
    overflow: hidden;
}

.membership-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 8, 20, 0.72);
}

.membership-modal-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.membership-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.membership-modal-title {
    margin: 0;
    font-size: 1.15rem;
}

.membership-modal-close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.membership-modal-close:hover {
    opacity: 1;
}

.membership-modal-tier,
.membership-modal-price {
    margin: 0.35rem 0;
}

.membership-modal-status {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.membership-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

@media (max-width: 700px) {
    .profile-card__head-row {
        flex-direction: column;
    }

    .profile-hero-main {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Recommendations */
.rec-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.rec-page__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.rec-page__title {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.65rem;
}

.rec-page__lead {
    margin: 0;
    max-width: 52ch;
    color: var(--text-muted);
    line-height: 1.5;
}

.rec-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.rec-page__alert--error {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.08);
    color: #ffc9c9;
}

.rec-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.rec-toolbar {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.rec-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}

.rec-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.rec-filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.rec-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rec-filter-btn {
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.rec-filter-btn:hover {
    color: var(--text);
    border-color: rgba(107, 159, 255, 0.35);
}

.rec-filter-btn.is-active {
    color: var(--accent);
    border-color: rgba(107, 159, 255, 0.45);
    background: rgba(107, 159, 255, 0.12);
}

.rec-toolbar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.rec-filter-status,
.rec-refresh-status {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.rec-page-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.rec-loading,
.rec-empty {
    margin: 0;
    color: var(--text-muted);
}

.rec-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rec-item {
    overflow: hidden;
}

.rec-item__summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.rec-item__summary::-webkit-details-marker {
    display: none;
}

.rec-item[open] .rec-item__summary {
    border-bottom: 1px solid var(--border);
}

.rec-item__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.rec-item__symbol {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.rec-item__asset {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.rec-item__metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.rec-item__metrics .is-up {
    color: #9be7b5;
}

.rec-item__metrics .is-down {
    color: #ffc9c9;
}

.rec-item__votes {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.rec-item__body {
    padding: 0.85rem 1rem 1rem;
}

.rec-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.65rem 1rem;
    margin: 0 0 0.85rem;
}

.rec-facts dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.rec-facts dd {
    margin: 0.1rem 0 0;
    font-weight: 600;
    font-size: 0.875rem;
}

.rec-profile-link {
    color: var(--accent, #5b9cff);
    text-decoration: none;
}

.rec-profile-link:hover {
    text-decoration: underline;
}

.chart-grid-line {
    stroke: var(--border);
    stroke-width: 1;
    opacity: 0.6;
}

.chart-axis-label {
    fill: var(--text-muted);
    font-size: 10px;
}

.rec-pick-chart-wrap {
    margin: 0.85rem 0;
    padding: 0.55rem 0.65rem 0.45rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.rec-pick-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 0.75rem;
    margin-bottom: 0.45rem;
}

.rec-pick-chart-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.rec-pick-checkpoint-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.45);
    background: rgba(96, 165, 250, 0.18);
    color: #dbeafe;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.rec-pick-legend-item.rec-pick-checkpoint-count {
    flex: 1 1 100%;
    margin-bottom: 0.15rem;
}

.rec-pick-checkpoint-note {
    display: inline-block;
    margin-right: 0.2rem;
    color: #bfdbfe;
    font-weight: 600;
}

.rec-pick-chart-host {
    width: 100%;
    min-height: 200px;
}

.rec-pick-chart-interactive {
    position: relative;
}

.rec-pick-chart-tooltip {
    position: absolute;
    z-index: 6;
    min-width: 168px;
    max-width: 240px;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 36, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    font-size: 0.76rem;
    line-height: 1.35;
}

.rec-pick-tooltip-time {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.rec-pick-tooltip-tag {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #fde68a;
    background: rgba(251, 191, 36, 0.14);
}

.rec-pick-tooltip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.rec-pick-tooltip-row span:first-child {
    color: var(--text-muted);
    min-width: 4.8rem;
}

.rec-pick-tooltip-row strong {
    color: var(--text);
    font-weight: 600;
}

.rec-pick-tooltip-sub {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.rec-pick-tooltip-real strong {
    color: #6ee7b7;
}

.rec-pick-tooltip-expected strong {
    color: #93c5fd;
}

.rec-pick-tooltip-council strong {
    color: #fcd34d;
}

.rec-pick-checkpoint.is-hovered .rec-pick-dot {
    stroke: #f8fafc;
    stroke-width: 1.5;
}

.rec-pick-hover-guide {
    stroke: rgba(148, 163, 184, 0.45);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    pointer-events: none;
}

.rec-pick-chart-svg {
    display: block;
    width: 100%;
    height: 200px;
}

.rec-pick-forecast-bridge {
    stroke-width: 1.25;
    stroke-dasharray: 4 3;
    opacity: 0.55;
}

.rec-pick-bridge-ok {
    stroke: #34d399;
}

.rec-pick-bridge-miss {
    stroke: #f87171;
}

.rec-pick-note-real {
    color: #6ee7b7;
}

.rec-pick-note-expected {
    color: #93c5fd;
}

.rec-pick-legend-bridge-swatch {
    background: repeating-linear-gradient(
        90deg,
        #94a3b8 0 4px,
        transparent 4px 7px
    ) !important;
    height: 2px !important;
}

.rec-pick-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rec-pick-chart-note {
    margin: 0.45rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #fde68a;
}

.rec-pick-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.rec-pick-legend-item strong {
    color: var(--text);
    font-weight: 600;
}

.rec-pick-legend-swatch {
    width: 14px;
    height: 3px;
    border-radius: 999px;
    flex-shrink: 0;
}

.rec-learning-panel {
    margin: 0.75rem 0;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.rec-learning-panel-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
}

.rec-learning-chart-host {
    width: 100%;
    min-height: 160px;
}

.rec-reason {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.rec-reason__title {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
}

.rec-reason p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-muted);
    white-space: pre-wrap;
}

.rec-specialist-detail {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.rec-whynot {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.rec-whynot__title {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
}

.rec-whynot__gates {
    display: grid;
    gap: 0.3rem;
    margin: 0 0 0.5rem;
}

.rec-gate {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.82rem;
}

.rec-gate dt {
    color: var(--text-muted);
}

.rec-gate dd {
    margin: 0;
    text-align: right;
}

.rec-gate__flag {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.05rem 0.35rem;
    border-radius: 6px;
}

.rec-gate.is-pass .rec-gate__flag {
    color: #0b7a3b;
    background: rgba(16, 185, 129, 0.16);
}

.rec-gate.is-fail .rec-gate__flag {
    color: #b42318;
    background: rgba(239, 68, 68, 0.16);
}

.rec-whynot__line {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.rec-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.rec-vote-panel {
    margin-bottom: 0.9rem;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.rec-vote-panel__title {
    margin: 0 0 0.55rem;
    font-size: 0.9rem;
}

.rec-vote-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.rec-vote-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--surface);
}

.rec-vote-chip strong {
    color: var(--text);
    font-weight: 700;
}

.rec-vote-strong-buy {
    border-color: rgba(125, 255, 176, 0.35);
    color: #7dffb0;
}

.rec-vote-buy {
    border-color: rgba(125, 200, 255, 0.35);
    color: #9ec5ff;
}

.rec-vote-watch {
    border-color: rgba(255, 210, 125, 0.35);
    color: #ffd27d;
}

.rec-vote-avoid,
.rec-vote-danger {
    border-color: rgba(255, 154, 154, 0.35);
    color: #ff9a9a;
}

.rec-vote-muted {
    opacity: 0.85;
}

.rec-focused-run-status {
    margin: 0.65rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.rec-focused-run-status.is-error {
    color: #ffc9c9;
}

.rec-action-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.rec-action-strong-buy { background: rgba(46, 160, 90, 0.2); color: #7dffb0; }
.rec-action-buy { background: rgba(91, 156, 255, 0.2); color: #9ec5ff; }
.rec-action-watch { background: rgba(240, 180, 41, 0.2); color: #f0c451; }
.rec-action-avoid { background: rgba(220, 120, 60, 0.2); color: #ffb07a; }
.rec-action-danger { background: rgba(220, 80, 80, 0.25); color: #ff9a9a; }
.rec-action-unknown { background: rgba(128, 128, 128, 0.2); color: var(--text-muted); }

@media (max-width: 700px) {
    .rec-item__metrics {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Users admin */
.users-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.users-page__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.users-page__title {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.65rem;
}

.users-page__lead {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.users-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.users-page__alert--error {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.08);
    color: #ffc9c9;
}

.users-page__alert--success {
    border-color: rgba(46, 160, 90, 0.35);
    background: rgba(46, 160, 90, 0.08);
    color: #b7e4c7;
}

.users-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: var(--surface);
}

.users-card__head {
    margin-bottom: 0.85rem;
}

.users-card__head--row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem;
}

.users-card__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.users-card__lead {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.users-create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.users-search {
    min-width: min(100%, 16rem);
}

.users-table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.users-table th,
.users-table td {
    padding: 0.75rem 0.55rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.users-table th {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.users-account {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.users-account__name {
    font-weight: 600;
}

.users-account__meta,
.users-account__desc,
.users-muted {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.users-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.users-tag--employee {
    border-color: rgba(91, 156, 255, 0.35);
    color: #9ec5ff;
}

.users-tag--staff {
    border-color: rgba(180, 140, 255, 0.35);
    color: #d6c4ff;
}

.users-tag--member {
    border-color: rgba(120, 160, 120, 0.35);
    color: #b7e4c7;
}

.users-tag--system {
    align-self: flex-start;
    margin-top: 0.2rem;
}

.users-tier-pill {
    display: inline-flex;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.users-tier-select {
    min-width: 8rem;
    padding: 0.35rem 0.5rem;
}

.users-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.btn--small {
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
}

.users-delete-btn {
    color: #ffc9c9;
}

.users-loading,
.users-empty {
    margin: 0;
    color: var(--text-muted);
}

.users-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.users-modal[hidden] {
    display: none;
}

.users-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.users-modal-card {
    position: relative;
    width: min(24rem, 100%);
    padding: 1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.users-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.users-modal-title {
    margin: 0;
    font-size: 1.05rem;
}

.users-modal-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.users-modal-user,
.users-modal-status {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
}

.users-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

/* Pool page */
.pool-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pool-page__eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pool-page__title {
    margin: 0;
    font-size: 1.75rem;
}

.pool-page__lead {
    margin: 0.5rem 0 0;
    max-width: 48rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.pool-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.pool-page__alert--error {
    background: rgba(220, 80, 80, 0.12);
    border-color: rgba(220, 80, 80, 0.35);
    color: #ffc9c9;
}

.pool-loading,
.pool-muted {
    color: var(--text-muted);
}

.pool-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

.pool-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.pool-card__title {
    margin: 0;
    font-size: 1.1rem;
}

.pool-card__lead,
.pool-card__meta {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.pool-subtitle {
    margin: 1rem 0 0.65rem;
    font-size: 0.95rem;
}

.pool-grid {
    display: grid;
    gap: 1.25rem;
}

.pool-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pool-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pool-stats-grid {
    display: grid;
    gap: 0.75rem;
}

.pool-stats-grid--primary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 0.75rem;
}

.pool-stats-grid--secondary {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.pool-thinking-patterns-table {
    margin-top: 0.85rem;
}

.pool-stat {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pool-stat__label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pool-stat__value {
    font-size: 1rem;
    font-weight: 600;
}

.pool-table-wrap {
    overflow-x: auto;
}

.pool-table-wrap--wide {
    max-width: 100%;
}

.pool-table-wrap--scroll {
    max-height: 28rem;
    overflow: auto;
}

.pool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.pool-table th,
.pool-table td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.pool-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
}

.pool-table--compact th,
.pool-table--compact td {
    padding: 0.35rem 0.45rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.pool-row--warn td:first-child {
    color: #ffb07a;
}

.pool-reason-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pool-reason-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--border);
}

.pool-chart-host {
    width: 100%;
    min-height: 3rem;
    overflow-x: auto;
}

.pool-chart-svg,
.pool-run-dev-svg {
    width: 100%;
    height: auto;
    display: block;
}

.pool-chart-axis,
.pool-chart-legend {
    fill: var(--text-muted);
    font-size: 11px;
}

.pool-chart-grid {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.pool-chart-boundary {
    stroke: rgba(240, 180, 41, 0.35);
    stroke-width: 1;
    stroke-dasharray: 4;
}

.pool-chart-link {
    text-decoration: none;
}

.pool-chart-link-text {
    fill: var(--text);
}

.pool-combined-charts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pool-lifetime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.pool-lifetime-item {
    margin: 0;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
}

.pool-lifetime-item figcaption {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pool-lifetime-item img {
    width: 100%;
    height: auto;
    display: block;
}

.pool-analyzer__toolbar {
    align-items: center;
}

.pool-analyzer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pool-analyzer__status {
    margin: 0 0 0.75rem;
}

.pool-analyzer .alert {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

.pool-analyzer .alert-info {
    background: rgba(91, 156, 255, 0.1);
    border-color: rgba(91, 156, 255, 0.3);
    color: #9ec5ff;
}

.pool-analyzer .alert-success {
    background: rgba(46, 160, 90, 0.12);
    border-color: rgba(46, 160, 90, 0.35);
    color: #7dffb0;
}

.pool-analyzer .alert-error,
.pool-analyzer .alert-danger {
    background: rgba(220, 80, 80, 0.12);
    border-color: rgba(220, 80, 80, 0.35);
    color: #ffc9c9;
}

.pool-analyzer__headline {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.pool-analyzer__summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.pool-analyzer__summary-grid .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pool-analyzer__summary-grid .stat-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.pool-notes {
    margin: 0.75rem 0;
    padding-left: 1.1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.pool-action-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.875rem;
}

.dna-pools-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dna-pool-section {
    border-left: 4px solid var(--border);
    padding-left: 1rem;
}

.dna-pool-section.rec-source-elite-section {
    border-left-color: rgba(45, 212, 191, 0.75);
}

.dna-pool-section.rec-source-precision-section {
    border-left-color: rgba(192, 132, 252, 0.75);
}

.dna-pool-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dna-pool-title-block {
    flex: 1 1 16rem;
}

.dna-pool-subtitle {
    margin: 0.5rem 0 0;
    max-width: 42rem;
    line-height: 1.45;
}

.dna-pool-capacity-block {
    text-align: right;
    flex: 0 0 auto;
}

.dna-pool-count {
    font-size: 2rem;
    font-weight: 700;
}

.dna-pool-council-hint {
    margin-top: 0.25rem;
}

.dna-pool-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.dna-pool-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dna-member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.dna-member-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    padding: 0.85rem;
}

.dna-member-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.dna-member-name {
    font-weight: 600;
    font-size: 1rem;
    color: inherit;
    text-decoration: none;
}

.dna-member-name:hover {
    color: var(--accent);
}

.dna-member-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
    font-size: 0.88rem;
}

.dna-member-metrics > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.text-positive { color: #7dffb0; }
.text-negative { color: #ff9a9a; }

@media (max-width: 900px) {
    .pool-grid--two,
    .pool-grid--three {
        grid-template-columns: 1fr;
    }
}

/* Dashboard page */
.dashboard-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-page__eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dashboard-page__title {
    margin: 0;
    font-size: 1.75rem;
}

.dashboard-page__lead {
    margin: 0.5rem 0 0;
    max-width: 48rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.dashboard-page__alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.dashboard-page__alert--error {
    background: rgba(220, 80, 80, 0.12);
    border-color: rgba(220, 80, 80, 0.35);
    color: #ffc9c9;
}

.dashboard-loading,
.dashboard-muted {
    color: var(--text-muted);
}

.dashboard-loading[hidden] {
    display: none !important;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.dashboard-panel--wide {
    grid-column: 1 / -1;
}

.dashboard-panel-error {
    margin: 0;
    color: #ffc9c9;
    font-size: 0.9rem;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.dashboard-stats-grid--compact {
    margin-bottom: 0.65rem;
}

.dashboard-info {
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.dashboard-info > div {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) 1fr;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.dashboard-info > div:first-child {
    border-top: 0;
    padding-top: 0;
}

.dashboard-info dt {
    color: var(--text-muted);
}

.dashboard-info dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.dashboard-employees {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.875rem;
}

.dashboard-dna-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-dna-card {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
}

.dashboard-dna-members {
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.45rem;
}

.dashboard-dna-member {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.dashboard-dna-member:first-child {
    border-top: 0;
    padding-top: 0;
}

.dashboard-dna-member__name {
    font-weight: 600;
}

.dashboard-dna-member__meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dashboard-table {
    margin-top: 0.35rem;
}

.dashboard-hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.dashboard-hero__title {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.35;
}

.dashboard-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.dashboard-pill--good {
    color: #7dffb0;
    border-color: rgba(125, 255, 176, 0.35);
    background: rgba(24, 80, 48, 0.35);
}

.dashboard-pill--warn {
    color: #ffd27d;
    border-color: rgba(255, 210, 125, 0.35);
    background: rgba(96, 72, 16, 0.35);
}

.dashboard-pill--bad {
    color: #ff9a9a;
    border-color: rgba(255, 154, 154, 0.35);
    background: rgba(96, 24, 24, 0.35);
}

.dashboard-progress {
    margin-top: 0.85rem;
    padding: 0.55rem 0 0;
    border-top: 1px solid var(--border);
}

.dashboard-progress__bar {
    height: 0.45rem;
    width: 0;
    max-width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #7dffb0);
    transition: width 0.35s ease;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 1.25rem;
}

.dashboard-activity-list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.45rem;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.45;
}

.dashboard-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.dashboard-link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-raised);
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dashboard-subtitle {
    margin: 1rem 0 0.45rem;
    font-size: 0.95rem;
}

.service-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 72rem;
}

.service-page__intro {
    margin-bottom: 0.25rem;
}

.service-page__eyebrow {
    margin: 0 0 0.35rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.service-page__title {
    margin: 0;
    font-size: 1.65rem;
}

.service-page__lead {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    max-width: 42rem;
    line-height: 1.55;
}

.service-page__alert {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.service-page__alert--error {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.service-hero {
    padding: 1rem 1.1rem;
}

.service-hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.service-hero__title {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.service-panel--wide {
    grid-column: 1 / -1;
}

.service-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.65rem;
}

.service-actions--inline {
    margin-bottom: 0.25rem;
}

.service-command-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem;
    margin-top: 0.65rem;
}

.service-command-field {
    flex: 1 1 16rem;
    margin: 0;
}

.service-hint {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
}

.service-hint code {
    font-size: 0.85em;
}

.service-output {
    margin: 0.65rem 0 0;
    padding: 0.85rem 1rem;
    min-height: 8rem;
    max-height: 16rem;
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.dashboard-service-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.65rem;
}

.dashboard-service-note {
    margin: 0.65rem 0 0;
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .service-grid {
        grid-template-columns: 1fr;
    }

    .service-actions .btn {
        flex: 1 1 calc(50% - 0.55rem);
    }

    .dashboard-page {
        gap: 0.85rem;
    }

    .dashboard-page__lead {
        font-size: 0.9rem;
    }

    .dashboard-content {
        gap: 0.85rem;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .dashboard-grid,
    .dashboard-dna-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-panel.pool-card,
    .dashboard-hero.pool-card {
        padding: 0.85rem 0.9rem;
    }

    .dashboard-hero__top {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-hero__top .btn {
        width: 100%;
    }

    .dashboard-hero__title {
        font-size: 1.15rem;
        line-height: 1.4;
    }

    .dashboard-panel .pool-card__meta,
    .dashboard-panel .pool-card__lead {
        font-size: 0.82rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .dashboard-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .dashboard-stats-grid--compact {
        grid-template-columns: 1fr;
    }

    .dashboard-stats-grid .pool-stat {
        padding: 0.55rem 0.6rem;
    }

    .dashboard-stats-grid .pool-stat__value {
        font-size: 0.92rem;
        overflow-wrap: anywhere;
    }

    .dashboard-info > div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        padding: 0.55rem 0;
    }

    .dashboard-info dt {
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .dashboard-info dd {
        font-size: 0.875rem;
    }

    .dashboard-employees {
        grid-template-columns: 1fr;
    }

    .dashboard-employees .home-card__top {
        flex-wrap: wrap;
    }

    .dashboard-employees .home-metrics div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .dashboard-panel .pool-table-wrap {
        margin: 0 -0.25rem;
        padding-bottom: 0.15rem;
    }

    .dashboard-panel .pool-table {
        min-width: 32rem;
        font-size: 0.82rem;
    }

    .dashboard-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .dashboard-link {
        justify-content: center;
        min-height: var(--touch-min);
        padding: 0.55rem 0.65rem;
    }

    .dashboard-service-actions {
        flex-direction: column;
    }

    .dashboard-service-actions .btn {
        width: 100%;
    }

    .dashboard-activity-list {
        padding-left: 1rem;
        font-size: 0.85rem;
    }

    .dashboard-dna-member__meta {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 420px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-links {
        grid-template-columns: 1fr;
    }

    .dashboard-hero__title {
        font-size: 1.05rem;
    }
}

/* Storage page */
.storage-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1100px;
}

.storage-page__intro {
    margin: 0;
}

.storage-page__eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.storage-page__title {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.3;
}

.storage-page__lead {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 52rem;
}

.storage-page__alert {
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

.storage-page__alert--error {
    color: #ff9a9a;
    border-color: rgba(255, 154, 154, 0.35);
    background: rgba(96, 24, 24, 0.35);
}

.storage-overview__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.storage-cap {
    margin-bottom: 0.85rem;
}

.storage-cap__bar-wrap {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    overflow: hidden;
}

.storage-cap__bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #7dffb0);
    transition: width 0.35s ease;
}

.storage-cap__bar--warn {
    background: linear-gradient(90deg, #ffd27d, #ffb347);
}

.storage-cap__bar--bad {
    background: linear-gradient(90deg, #ff7d7d, #ff4d4d);
}

.storage-muted {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.storage-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0.85rem;
}

.storage-overview-panel {
    min-width: 0;
}

.storage-subtitle {
    margin: 0 0 0.55rem;
    font-size: 0.95rem;
}

.storage-table td,
.storage-table th {
    white-space: nowrap;
}

.storage-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.storage-toolbar__field,
.storage-toolbar__toggle {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.storage-toolbar__field input[type="search"] {
    min-width: 16rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
}

.storage-toolbar__toggle {
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    padding-bottom: 0.45rem;
}

.storage-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.storage-section__head {
    margin-bottom: 0.85rem;
}

.storage-op-list {
    display: grid;
    gap: 0.75rem;
}

.storage-op {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.storage-op--danger {
    border-color: rgba(255, 154, 154, 0.25);
}

.storage-op__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.storage-op-btn {
    min-width: 10rem;
}

.storage-op-btn--danger {
    color: #ff9a9a;
    border-color: rgba(255, 154, 154, 0.35);
}

.storage-op-btn--danger:hover {
    color: #fff;
    background: rgba(160, 40, 40, 0.55);
    border-color: rgba(255, 154, 154, 0.55);
}

.storage-method {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.storage-method--get {
    color: #7dffb0;
    border-color: rgba(125, 255, 176, 0.35);
}

.storage-method--post {
    color: #9ec5ff;
    border-color: rgba(158, 197, 255, 0.35);
}

.storage-op__desc {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.storage-result {
    margin: 0.55rem 0 0;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 16rem;
    overflow: auto;
}

.storage-result--error {
    color: #ff9a9a;
    border-color: rgba(255, 154, 154, 0.35);
}

.storage-empty-filter {
    padding: 1rem;
    border-radius: 10px;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 900px) {
    .storage-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile-friendly layout (phones & small tablets) */

.shell-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.shell-nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.shell-nav-backdrop[hidden] {
    display: block;
}

.shell-bottom-nav {
    display: none;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    body.shell.shell--signed-in {
        --bottom-nav-h: 4rem;
    }

    body.shell.shell-nav-open {
        overflow: hidden;
    }

    body.shell.shell--signed-in .shell-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        z-index: 80;
        min-height: var(--bottom-nav-h);
        margin: 0;
        padding: 0.25rem max(0.2rem, env(safe-area-inset-right)) calc(0.25rem + env(safe-area-inset-bottom)) max(0.2rem, env(safe-area-inset-left));
        border-top: 1px solid var(--border);
        background: color-mix(in srgb, var(--surface) 96%, transparent);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        overflow: hidden;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    body.shell.shell--signed-in .shell-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        min-height: calc(var(--bottom-nav-h) - 0.55rem - env(safe-area-inset-bottom));
        padding: 0.15rem 0.1rem;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--text-muted);
        text-decoration: none;
        font: inherit;
        font-size: 0.625rem;
        font-weight: 600;
        line-height: 1.1;
        cursor: pointer;
        touch-action: manipulation;
        overflow: hidden;
    }

    body.shell.shell--signed-in .shell-bottom-nav__item.is-active {
        color: var(--accent);
        background: rgba(107, 159, 255, 0.12);
    }

    body.shell.shell--signed-in .shell-bottom-nav__icon {
        flex-shrink: 0;
        font-size: 1.05rem;
        line-height: 1;
    }

    body.shell.shell--signed-in .shell-bottom-nav__label {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: center;
        font-size: clamp(0.58rem, 2.6vw, 0.68rem);
    }

    .shell-header {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .shell-main {
        padding: 0.85rem max(0.75rem, env(safe-area-inset-right)) calc(0.85rem + var(--bottom-nav-h) + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    }

    body.shell:not(.shell--signed-in) .shell-main {
        padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
    }

    .shell-nav {
        width: min(18rem, 88vw);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .shell-nav__link,
    .shell-nav__category-toggle {
        min-height: var(--touch-min);
        display: flex;
        align-items: center;
    }

    .login-panel,
    .shell-status-panel {
        width: 100vw;
        max-width: 100vw;
    }

    .btn {
        min-height: var(--touch-min);
        touch-action: manipulation;
    }

    .btn--block,
    .rec-page-actions .btn,
    .rec-item__actions .btn,
    .dashboard-service-actions .btn,
    .portfolio-trade-actions .btn,
    .portfolio-add-actions .btn,
    .storage-op__row .storage-op-btn,
    .settings-dock__actions .btn {
        width: 100%;
    }

    .rec-page__title,
    .portfolio-page__title,
    .pool-page__title,
    .dashboard-page__title,
    .storage-page__title {
        font-size: 1.45rem;
    }

    .rec-filters {
        flex-direction: column;
        gap: 0.75rem;
    }

    .rec-filter-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 0.15rem;
    }

    .rec-filter-btn {
        flex: 0 0 auto;
        min-height: var(--touch-min);
        padding: 0.45rem 0.85rem;
    }

    .rec-toolbar__meta,
    .rec-page-actions,
    .storage-toolbar,
    .storage-overview__head {
        flex-direction: column;
        align-items: stretch;
    }

    .rec-item__summary {
        padding: 0.85rem 0.85rem;
    }

    .rec-item__main {
        flex-direction: column;
        align-items: flex-start;
    }

    .rec-item__metrics {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem 0.65rem;
    }

    .rec-facts {
        grid-template-columns: 1fr;
    }

    .rec-item__actions {
        flex-direction: column;
    }

    .home-employees {
        grid-template-columns: 1fr;
    }

    .home-section__head,
    .pool-card__head,
    .dna-member-card-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .pool-table-wrap,
    .market-table-wrap,
    .pool-table-wrap--wide,
    .pool-table-wrap--scroll {
        margin: 0 -0.15rem;
        -webkit-overflow-scrolling: touch;
    }

    .pool-table {
        min-width: 36rem;
    }

    .market-toolbar {
        grid-template-columns: 1fr;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .dashboard-dna-grid,
    .dashboard-employees {
        grid-template-columns: 1fr;
    }

    .dashboard-info > div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .dashboard-stats-grid,
    .pool-stats-grid--primary,
    .pool-stats-grid--secondary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dna-member-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portfolio-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portfolio-trade-dialog {
        width: calc(100vw - 1.5rem);
        max-width: none;
        margin: 0.75rem;
    }

    .membership-modal-actions,
    .portfolio-trade-actions {
        flex-direction: column;
    }

    .storage-op__row {
        flex-direction: column;
        align-items: stretch;
    }

    .storage-toolbar__field input[type="search"] {
        width: 100%;
        min-width: 0;
    }
}

@media (min-width: 901px) {
    body.shell.shell--signed-in .shell-bottom-nav {
        display: none !important;
    }

    body.shell.shell--signed-in {
        --bottom-nav-h: 0px;
    }
}

@media (max-width: 420px) {
    .shell-header__server-copy {
        max-width: 12rem;
    }

    .shell-header__server-state,
    .shell-header__server-hint {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .rec-item__metrics {
        grid-template-columns: 1fr;
    }

    .dashboard-links {
        grid-template-columns: 1fr;
    }

    .portfolio-summary {
        grid-template-columns: 1fr;
    }
}

/* Live operation board (shell header + status panel + dashboard) */
.live-ops-section {
    margin-bottom: 1rem;
}

.live-ops-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, #8b95a8);
    margin: 0 0 0.5rem;
}

.live-ops-empty {
    margin: 0;
    color: var(--text-muted, #8b95a8);
    font-size: 0.875rem;
}

.live-ops-cards {
    display: grid;
    gap: 0.5rem;
}

.live-ops-card {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
}

.live-ops-card--running {
    border-color: rgba(61, 214, 140, 0.35);
}

.live-ops-card--paused {
    border-color: rgba(255, 193, 7, 0.35);
}

.live-ops-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.live-ops-card__pct {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent-green, #3dd68c);
}

.live-ops-card__detail {
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted, #8b95a8);
    line-height: 1.4;
}

.live-ops-progress {
    margin-top: 0.5rem;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.live-ops-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, #3dd68c, #2eb872);
    border-radius: inherit;
    transition: width 0.35s ease;
}

.live-ops-queue {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.live-ops-queue-item {
    font-size: 0.8125rem;
    color: var(--text-secondary, #c5cdd9);
}

.live-ops-queue-pos {
    font-weight: 700;
    color: var(--text-muted, #8b95a8);
}

.live-ops-queue-detail {
    color: var(--text-muted, #8b95a8);
}

.dashboard-operations {
    margin-top: 0.75rem;
}

.page-panel-loading {
    opacity: 0.85;
}


/* —— Dashboard live trends —— */
.dashboard-live-chart-card {
    margin: 1.25rem 0 0;
}

.dashboard-live-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.dashboard-live-chart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-live-chart-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.dashboard-live-chart-tab {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.78);
    border-radius: 0.55rem;
    padding: 0.4rem 0.7rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    min-height: 2.25rem;
}

.dashboard-live-chart-tab:hover {
    border-color: rgba(91, 156, 255, 0.45);
    color: #fff;
}

.dashboard-live-chart-tab.is-active {
    background: rgba(91, 156, 255, 0.18);
    border-color: rgba(91, 156, 255, 0.55);
    color: #fff;
}

.dashboard-live-chart-meta {
    display: grid;
    gap: 0.2rem;
    margin-bottom: 0.65rem;
}

.dashboard-live-chart-current {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
}

.dashboard-live-chart-stall {
    margin: 0;
    color: #fbbf24;
}

.dashboard-live-chart-stall.is-danger {
    color: #fb7185;
}

.dashboard-live-chart-stage {
    display: grid;
    gap: 0.65rem;
}

.dashboard-live-chart-panels {
    display: grid;
    gap: 0.65rem;
}

.dashboard-live-chart-svg {
    width: 100%;
    height: 15rem;
    min-height: 220px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
}

.dashboard-live-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
}

.dashboard-live-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dashboard-live-chart-legend-swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: currentColor;
}

.dashboard-live-changefeed {
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-live-changefeed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.78);
}

.dashboard-live-change-time {
    display: inline-block;
    min-width: 4.6rem;
    margin-right: 0.45rem;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .dashboard-live-chart-head {
        flex-direction: column;
    }

    .dashboard-live-chart-svg {
        min-height: 180px;
    }
}
