:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0b1220;
    --sidebar-muted: #94a3b8;
    --app-bg: #f4f7fb;
    --accent: #2563eb;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow-x: hidden;
    background: var(--app-bg);
    color: #172033;
}

.auth-body {
    background: linear-gradient(145deg, #eef4ff 0%, #f8fafc 55%, #e8eef8 100%);
}

.skip-link {
    position: fixed;
    z-index: 1100;
    top: .75rem;
    left: .75rem;
    padding: .6rem 1rem;
    border-radius: .5rem;
    background: #fff;
    color: #0b1220;
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: translateY(0);
}

.app-sidebar,
.app-offcanvas {
    width: var(--sidebar-width) !important;
    background: var(--sidebar-bg);
    color: #fff;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
}

.sidebar-inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    padding: 1.25rem 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin-bottom: 2rem;
}

.sidebar-brand,
.mobile-brand {
    color: #fff;
    text-decoration: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: .1rem;
    color: var(--sidebar-muted);
    font-size: .7rem;
    letter-spacing: .04em;
}

.brand-mark {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: .75rem;
    background: var(--accent);
    font-weight: 800;
}

.sidebar-nav {
    flex: 1;
}

.nav-section-label {
    display: block;
    margin: 0 .75rem .5rem;
    color: var(--sidebar-muted);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .3rem;
    padding: .7rem .75rem;
    border-radius: .65rem;
    color: #cbd5e1;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    background: #172238;
    color: #fff;
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
}

.sidebar-link:focus-visible,
.sidebar-brand:focus-visible,
.mobile-brand:focus-visible,
.menu-toggle:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.sidebar-account {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid #26334a;
    border-radius: .75rem;
    background: #111b2e;
}

.account-label {
    color: var(--sidebar-muted);
    font-size: .75rem;
}

.account-name {
    overflow: hidden;
    margin: .15rem 0 .85rem;
    font-size: .875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-header {
    position: sticky;
    z-index: 1020;
    top: 0;
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--sidebar-bg);
    box-shadow: 0 2px 12px rgb(15 23 42 / 18%);
}

.mobile-brand {
    font-weight: 700;
}

.menu-toggle {
    display: grid;
    padding: .45rem;
    border-color: #43516a;
    color: #fff;
    place-items: center;
}

.menu-toggle:hover {
    border-color: #64748b;
    background: #172238;
    color: #fff;
}

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

.app-page {
    max-width: 1500px;
}

.eyebrow {
    display: block;
    margin-bottom: .45rem;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.app-card {
    border-radius: 1rem;
}

.scroll-target {
    scroll-margin-top: 5rem;
}

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

.watchlist-count {
    padding: .65rem 1rem;
    border: 1px solid #dbe4f0;
    border-radius: .75rem;
    background: #fff;
    color: #64748b;
    white-space: nowrap;
}

.watchlist-count strong {
    margin-right: .25rem;
    color: #172033;
}

.search-icon {
    width: 20px;
    height: 20px;
    fill: #64748b;
}

.search-results {
    overflow: hidden;
    border: 1px solid #dbe4f0;
    border-radius: .75rem;
    background: #fff;
}

.search-results > h3 {
    padding: 1rem 1rem .25rem;
}

.search-result-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
    padding: .75rem 1rem;
    border-top: 1px solid #edf1f7;
}

.search-result-meta,
.instrument-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.instrument-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .8rem;
}

.instrument-logo {
    position: relative;
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    overflow: hidden;
    place-items: center;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    background: #f8fafc;
}

.instrument-logo img,
.instrument-logo-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.instrument-logo img {
    z-index: 1;
    padding: .6rem;
    background: #fff;
    object-fit: contain;
}

.instrument-logo-fallback {
    display: grid;
    color: #31527e;
    font-size: .75rem;
    font-weight: 800;
    place-items: center;
}

.instrument-name {
    overflow: hidden;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticker {
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .84rem;
    font-weight: 700;
}

.instrument-type-badge {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
}

.watchlist-table thead th {
    padding-block: 1rem;
    border-bottom-color: #dbe4f0;
    background: #f8fafc;
    color: #64748b;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

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

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

.analysis-action {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.analysis-mode-select {
    width: 116px;
}

.instrument-actions svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.analysis-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    color: #475569;
    font-size: .875rem;
}

.analysis-summary small {
    flex-basis: 100%;
    color: #64748b;
}

.min-w-0 {
    min-width: 0;
}

@media (min-width: 992px) {
    .app-content {
        min-height: 100vh;
        margin-left: var(--sidebar-width);
    }

    .scroll-target {
        scroll-margin-top: 1rem;
    }
}

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

    .display-6 {
        font-size: calc(1.35rem + 1.1vw);
    }

    .search-result-item {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: .65rem;
    }

    .search-result-meta {
        grid-column: 1;
        padding-left: 3.55rem;
    }

    .search-result-item > form,
    .search-result-item > button {
        grid-row: 1 / span 2;
        grid-column: 2;
    }

    .instrument-actions {
        justify-content: stretch;
    }

    .instrument-actions form:first-child,
    .instrument-actions form:first-child .btn {
        flex: 1;
    }

    .instrument-actions {
        flex-wrap: wrap;
    }

    .analysis-action {
        flex-basis: 100%;
    }

    .analysis-mode-select {
        flex: 1;
        width: auto;
    }
}
