:root {
    color-scheme: dark;
    --bg: #07101e;
    --panel: rgba(12, 23, 40, 0.88);
    --panel-strong: #0d192b;
    --border: rgba(148, 163, 184, 0.14);
    --border-bright: rgba(148, 163, 184, 0.24);
    --text: #eef4ff;
    --muted: #8fa0b8;
    --muted-strong: #b7c3d4;
    --teal: #2dd4bf;
    --blue: #60a5fa;
    --amber: #fbbf24;
    --rose: #fb7185;
    --purple: #a78bfa;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
        var(--bg);
    background-size: 44px 44px;
    color: var(--text);
    font-family: "Inter", system-ui, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 38rem;
    height: 38rem;
    border-radius: 50%;
    filter: blur(115px);
    opacity: 0.12;
    pointer-events: none;
}

.ambient-one {
    top: -18rem;
    right: -8rem;
    background: var(--teal);
}

.ambient-two {
    bottom: -22rem;
    left: -12rem;
    background: var(--blue);
}

.topbar {
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(28px, calc((100vw - 1440px) / 2));
    border-bottom: 1px solid var(--border);
    background: rgba(7, 16, 30, 0.78);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
    font-family: "Manrope", sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(45, 212, 191, 0.48);
    border-radius: 8px;
    background: rgba(45, 212, 191, 0.08);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
    content: "";
    display: block;
    width: 3px;
    border-radius: 999px;
    background: var(--teal);
}

.brand-mark::before {
    height: 7px;
    transform: translate(-6px, 5px);
}

.brand-mark span {
    height: 15px;
    transform: translate(0, -7px);
}

.brand-mark::after {
    height: 10px;
    transform: translate(6px, -19px);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 500;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-actions form {
    margin: 0;
}

.user-label,
.topbar-link {
    color: var(--muted-strong);
    font-size: 0.72rem;
}

.topbar-link {
    text-decoration: none;
}

.topbar-link:hover {
    color: var(--teal);
}

.topbar-button {
    padding: 0;
    border: 0;
    background: transparent;
}

.login-page {
    display: grid;
    place-items: center;
}

.login-shell {
    width: min(440px, calc(100% - 32px));
    padding: 48px 0;
}

.login-card {
    padding: 36px;
    border: 1px solid var(--border-bright);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-brand {
    width: fit-content;
    margin-bottom: 42px;
}

.login-card h1 {
    margin: 0;
    font-family: "Manrope", sans-serif;
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.login-copy {
    margin: 14px 0 26px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.7;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form input {
    width: 100%;
    margin-top: 8px;
    padding: 12px 13px;
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    outline: none;
    background: rgba(7, 16, 30, 0.72);
    color: var(--text);
}

.login-form input:focus {
    border-color: rgba(45, 212, 191, 0.65);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.08);
}

.login-form .primary-button {
    width: 100%;
    justify-content: space-between;
}

.page-shell {
    width: min(1440px, calc(100% - 56px));
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: end;
    gap: 64px;
    padding: 58px 0 42px;
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    color: var(--teal);
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 820px;
    margin: 0;
    font-family: "Manrope", sans-serif;
    font-size: clamp(2.3rem, 4vw, 4.6rem);
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.hero-copy {
    max-width: 670px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.hero-note {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    padding-left: 24px;
    border-left: 1px solid var(--border-bright);
}

.hero-note span {
    color: var(--teal);
    font-family: "Manrope", sans-serif;
    font-weight: 700;
}

.hero-note p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.workspace {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.control-panel {
    position: sticky;
    top: 20px;
    padding: 24px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.panel-heading h2,
.chart-toolbar h2 {
    margin: 0;
    font-family: "Manrope", sans-serif;
    font-size: 1.18rem;
    letter-spacing: -0.025em;
}

.panel-index {
    color: #42516a;
    font-family: "Manrope", sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted-strong);
    font-size: 0.76rem;
    font-weight: 600;
}

textarea,
select {
    width: 100%;
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    outline: none;
    background: rgba(5, 12, 23, 0.72);
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
    min-height: 132px;
    padding: 13px 14px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.84rem;
    line-height: 1.65;
    text-transform: uppercase;
}

select {
    height: 44px;
    padding: 0 12px;
}

textarea:focus,
select:focus {
    border-color: rgba(45, 212, 191, 0.68);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.08);
}

.field-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 7px;
    color: #65758e;
    font-size: 0.65rem;
    line-height: 1.4;
}

.field-error,
.errorlist {
    margin: 7px 0 0;
    padding: 0;
    color: #fda4af;
    font-size: 0.7rem;
    line-height: 1.5;
    list-style: none;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.primary-button {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    background: var(--teal);
    color: #04211f;
    font-size: 0.8rem;
    font-weight: 700;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(45, 212, 191, 0.18);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.button-loader {
    display: none;
    width: 17px;
    height: 17px;
    margin-left: auto;
    border: 2px solid rgba(4, 33, 31, 0.25);
    border-top-color: #04211f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.primary-button.is-loading .button-loader {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.method-card {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.weight-row {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.67rem;
}

.weight-row strong {
    color: var(--muted-strong);
}

.weight-bar {
    height: 2px;
    margin-top: 6px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.1);
}

.weight-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--blue));
}

.results-column {
    min-width: 0;
}

.results-panel {
    overflow: hidden;
}

.results-heading {
    align-items: center;
    margin: 0;
    padding: 24px 26px;
    border-bottom: 1px solid var(--border);
}

.legend {
    display: flex;
    gap: 14px;
    color: var(--muted);
    font-size: 0.67rem;
}

.legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.legend-dot.strong { background: var(--teal); }
.legend-dot.intermediate { background: var(--blue); }
.legend-dot.weak { background: var(--rose); }

.analysis-errors {
    margin: 18px 26px 0;
    padding: 12px 14px;
    border: 1px solid rgba(251, 113, 133, 0.18);
    border-radius: 9px;
    background: rgba(251, 113, 133, 0.05);
    color: #fecdd3;
    font-size: 0.72rem;
}

.analysis-errors ul {
    margin: 10px 0 0;
    padding-left: 18px;
}

.scan-progress {
    margin: 18px 26px 0;
    padding: 14px 16px;
    border: 1px solid rgba(45, 212, 191, 0.14);
    border-radius: 10px;
    background: rgba(45, 212, 191, 0.035);
}

.scan-progress-heading,
.scan-progress-heading > div,
.scan-progress-stats {
    display: flex;
    align-items: center;
}

.scan-progress-heading {
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 0.68rem;
}

.scan-progress-heading > div {
    gap: 8px;
}

.scan-progress-heading strong {
    color: var(--muted-strong);
}

.scan-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.scan-status-dot.running {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.08);
}

.scan-status-dot.paused {
    background: var(--amber);
}

.scan-status-dot.completed {
    background: var(--blue);
}

.scan-status-dot.failed {
    background: var(--rose);
}

.scan-progress-track {
    height: 4px;
    margin: 11px 0 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.11);
}

.scan-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--blue));
    transition: width 300ms ease;
}

.scan-progress-stats {
    flex-wrap: wrap;
    gap: 8px 18px;
    color: #66758d;
    font-size: 0.62rem;
}

.scan-progress-stats strong {
    margin-left: 4px;
    color: var(--muted-strong);
}

.results-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 130px 145px 110px auto;
    gap: 9px;
    padding: 18px 26px;
    border-bottom: 1px solid var(--border);
}

.results-toolbar input,
.results-toolbar select,
.results-toolbar button {
    height: 39px;
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    background: rgba(5, 12, 23, 0.72);
    color: var(--muted-strong);
    font-size: 0.68rem;
}

.results-toolbar input {
    min-width: 0;
    padding: 0 12px;
    outline: none;
}

.results-toolbar select {
    padding: 0 10px;
}

.results-toolbar button {
    padding: 0 14px;
    color: var(--teal);
    font-weight: 700;
}

.results-toolbar input:focus,
.results-toolbar select:focus {
    border-color: rgba(45, 212, 191, 0.6);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: #66758d;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
}

th a {
    color: inherit;
    text-decoration: none;
}

th a:hover {
    color: var(--teal);
}

td {
    padding: 15px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.075);
    color: var(--muted-strong);
    font-size: 0.73rem;
}

.submetric {
    display: block;
    margin-top: 4px;
    color: #5f6d82;
    font-size: 0.58rem;
}

tbody tr:not(.detail-row):hover {
    background: rgba(148, 163, 184, 0.025);
}

.rank {
    color: #516078;
    font-family: ui-monospace, monospace;
}

.ticker-value,
.price-value {
    color: var(--text);
    font-size: 0.78rem;
}

.verdict {
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.verdict.strong {
    background: rgba(45, 212, 191, 0.11);
    color: var(--teal);
}

.verdict.interesting {
    background: rgba(96, 165, 250, 0.11);
    color: var(--blue);
}

.verdict.intermediate {
    background: rgba(96, 165, 250, 0.11);
    color: var(--blue);
}

.verdict.watch {
    background: rgba(251, 191, 36, 0.11);
    color: var(--amber);
}

.verdict.weak {
    background: rgba(251, 113, 133, 0.11);
    color: var(--rose);
}

.score-cell {
    min-width: 92px;
}

.score-cell strong {
    color: var(--text);
    font-family: "Manrope", sans-serif;
    font-size: 0.9rem;
}

.score-cell > span {
    color: #5f6d82;
    font-size: 0.61rem;
}

.score-track {
    width: 74px;
    height: 3px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.score-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.score-track i.strong { background: var(--teal); }
.score-track i.interesting { background: var(--blue); }
.score-track i.intermediate { background: var(--blue); }
.score-track i.watch { background: var(--amber); }
.score-track i.weak { background: var(--rose); }

.positive { color: var(--teal); }
.negative { color: var(--rose); }

.change-value {
    font-size: 0.61rem;
    font-weight: 600;
}

.chart-button {
    padding: 7px 10px;
    border: 1px solid var(--border-bright);
    border-radius: 7px;
    background: transparent;
    color: var(--muted-strong);
    font-size: 0.65rem;
    font-weight: 600;
    transition: border-color 150ms ease, color 150ms ease;
}

.chart-button:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.detail-row td {
    padding: 0;
    background: rgba(5, 12, 23, 0.28);
}

.result-detail {
    padding: 13px 20px 15px 54px;
}

.detail-reasons > p {
    margin: 0;
    color: #8494aa;
    font-size: 0.67rem;
    line-height: 1.5;
    white-space: normal;
}

.detail-label {
    margin-bottom: 4px !important;
    color: #526079 !important;
    font-size: 0.57rem !important;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.metrics-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.metrics-strip span {
    padding: 5px 8px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    color: #66758d;
    font-size: 0.6rem;
}

.metrics-strip strong {
    color: #aebbd0;
}

.warning-line {
    margin-top: 9px !important;
    color: #d8b866 !important;
}

.chart-panel {
    margin-top: 20px;
    padding: 24px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 17px 22px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.67rem;
}

.pagination a {
    color: var(--teal);
    text-decoration: none;
}

.chart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    transition: border-color 150ms ease, color 150ms ease;
}

.chart-action:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.chart-action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.close-chart {
    font-size: 1.25rem;
}

.compress-icon {
    display: none;
}

.chart-panel:fullscreen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    min-height: 100vh;
    box-sizing: border-box;
    margin: 0;
    padding: 24px;
    overflow: auto;
    border: 0;
    border-radius: 0;
    background: #0b1220;
}

.chart-panel:fullscreen #plotly-chart,
.chart-panel:fullscreen #plotly-chart .plot-container,
.chart-panel:fullscreen #plotly-chart .svg-container {
    width: 100% !important;
    max-width: none !important;
}

.chart-panel:fullscreen .expand-icon {
    display: none;
}

.chart-panel:fullscreen .compress-icon {
    display: block;
}

.chart-message {
    color: var(--muted);
    font-size: 0.76rem;
}

#plotly-chart {
    position: relative;
}

.cross-subplot-guide {
    position: absolute;
    z-index: 20;
    width: 0;
    border-left: 1px dashed rgba(148, 163, 184, 0.8);
    pointer-events: none;
}

.interval-checks ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 10px 0;
    padding: 0;
    list-style: none;
}

.check-line,
.watch-row,
.alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watch-row {
    justify-content: space-between;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.72rem;
}

.alert-center {
    margin-bottom: 20px;
    padding: 18px 22px;
}

.alert-list {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.alert-item {
    justify-content: space-between;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.72rem;
}

.alert-item.unread {
    border-color: rgba(45, 212, 191, 0.45);
    color: var(--text);
}

.empty-state {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
}

.empty-state.compact {
    min-height: 300px;
}

.empty-state h2,
.empty-state h3 {
    margin: 4px 0 10px;
    font-family: "Manrope", sans-serif;
    letter-spacing: -0.03em;
}

.empty-state p:not(.section-kicker) {
    max-width: 490px;
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.65;
}

.empty-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border: 1px solid rgba(251, 113, 133, 0.3);
    border-radius: 50%;
    color: var(--rose);
}

.empty-visual {
    position: relative;
    width: 150px;
    height: 150px;
    margin-bottom: 30px;
}

.radar-ring {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(45, 212, 191, 0.16);
    border-radius: 50%;
}

.ring-two {
    inset: 28px;
}

.radar-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48%;
    height: 1px;
    transform-origin: left center;
    transform: rotate(-32deg);
    background: linear-gradient(90deg, var(--teal), transparent);
}

.radar-dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 18px rgba(45, 212, 191, 0.8);
}

.dot-one { top: 27px; right: 34px; }
.dot-two { right: 22px; bottom: 43px; }
.dot-three { left: 38px; bottom: 25px; }

.feature-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
    margin-top: 22px;
}

.feature-list span {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted-strong);
    font-size: 0.65rem;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 2px 38px;
    color: #536178;
    font-size: 0.62rem;
}

footer p {
    margin: 0;
}

.alert {
    margin-bottom: 18px;
    padding: 11px;
    border-radius: 8px;
    font-size: 0.7rem;
    line-height: 1.5;
}

.alert-error {
    border: 1px solid rgba(251, 113, 133, 0.22);
    background: rgba(251, 113, 133, 0.06);
    color: #fecdd3;
}

@media (max-width: 1120px) {
    .page-shell {
        width: min(calc(100% - 36px), 980px);
    }

    .workspace {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-note {
        display: none;
    }
}

@media (max-width: 820px) {
    .topbar {
        padding: 0 18px;
    }

    .page-shell {
        width: min(calc(100% - 24px), 680px);
    }

    .hero {
        padding: 38px 0 28px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .control-panel {
        position: static;
    }

    .legend {
        display: none;
    }

    .result-detail {
        padding-left: 20px;
    }

    .results-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    footer {
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .status-pill {
        font-size: 0;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .control-panel,
    .chart-panel {
        padding: 18px;
    }

    .results-heading {
        padding: 20px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .results-toolbar {
        grid-template-columns: 1fr;
        padding: 15px 18px;
    }

    .scan-progress {
        margin: 15px 18px 0;
    }

    .empty-state {
        min-height: 420px;
        padding: 28px 20px;
    }
}
