﻿:root {
    --bg: #0f1419;
    --bg-panel: #1a2332;
    --bg-card: #243044;
    --border: #2d3b52;
    --text: #e8eef7;
    --text-muted: #8b9cb3;
    --accent: #3d8bfd;
    --accent-hover: #5ca0ff;
    --accent-soft: rgba(61, 139, 253, 0.18);
    --danger: #f87171;
    --danger-bg: #3f1d24;
    --success: #4ade80;
    --link: #aabdd9;
    --link-hover: #dce6f5;
    --link-underline: rgba(170, 189, 217, 0.4);
    --input-bg-top: #1c2738;
    --input-bg-bottom: #131b28;
    --input-border: rgba(61, 139, 253, 0.22);
    --input-border-hover: rgba(92, 160, 255, 0.35);
    --input-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.38);
    --radius: 10px;
    --font: "DM Sans", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

html {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #151c28 0%, #0f1419 100%);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar__logo {
    font-size: 1.5rem;
    color: var(--accent);
}

.sidebar__title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.sidebar__sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 0.65rem;
}

.nav-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 0.6rem 0.35rem;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text);
}

.nav-link--active,
.nav-link--active:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.app-main {
    flex: 1;
    min-width: 0;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.75rem 4rem;
}

.content--wide {
    max-width: min(96vw, 1520px);
}

h1 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.35rem;
}

.lead,
.muted {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.5rem;
}

.lead {
    font-size: 1rem;
}

code {
    font-family: var(--mono);
    font-size: 0.82em;
    background: var(--bg-panel);
    padding: 0.12em 0.35em;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.1rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.15s;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-card__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card__view-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.panel__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem 1.25rem;
    align-items: start;
}

.form-row {
    margin-bottom: 0.75rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* Unified dark inputs (text, number, url, textarea, select) */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="password"],
textarea {
    width: 100%;
    max-width: 28rem;
    padding: 0.58rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--input-bg-top) 0%, var(--input-bg-bottom) 100%);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: var(--input-shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 5.5rem;
    max-width: 40rem;
    resize: vertical;
}

select {
    width: 100%;
    max-width: 28rem;
    padding: 0.58rem 2.35rem 0.58rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: var(--input-shadow);
    cursor: pointer;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: var(--input-bg-bottom);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%238b9cb3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(180deg, var(--input-bg-top) 0%, var(--input-bg-bottom) 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: right 0.7rem center, 0 0;
    background-size: 11px 7px, 100% 100%;
}

input::placeholder,
textarea::placeholder {
    color: rgba(139, 156, 179, 0.72);
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--input-border-hover);
}

select:hover {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23aabdd9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #1e2a3d 0%, #151f2e 100%);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--input-shadow), 0 0 0 2px var(--accent-soft);
}

select:focus {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%235ca0ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #1e2a3d 0%, #151f2e 100%);
}

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.input-wide {
    max-width: 40rem;
}

.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.45;
    max-width: 36rem;
}

label.form-check {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.55rem;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 0;
}

label.form-check input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.5rem;
}

.whale-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1.15rem;
    max-height: 22rem;
    overflow: auto;
    padding: 1rem 1.1rem;
    margin-top: 0.5rem;
    background: rgba(18, 26, 38, 0.65);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    scrollbar-color: var(--border) transparent;
    scrollbar-width: thin;
}

.whale-picker label.form-check {
    min-width: 14rem;
    padding: 0.45rem 0.55rem;
    margin: 0;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.whale-picker label.form-check:hover {
    background: rgba(61, 139, 253, 0.06);
    border-color: rgba(61, 139, 253, 0.2);
}

.whale-picker__item {
    min-width: 16.5rem;
    max-width: 23rem;
    padding: 0.2rem 0;
}

.whale-picker__min {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.whale-picker__min input[type="number"] {
    max-width: none;
    width: 100%;
    margin-top: 0.25rem;
}

.page-hint a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--link-underline);
    transition: color 0.15s, border-color 0.15s;
}

.page-hint a:hover {
    color: var(--link-hover);
    border-bottom-color: rgba(220, 230, 245, 0.55);
}

.profile-editor-form {
    margin-bottom: 2rem;
}

.profile-editor-form__panel {
    margin-bottom: 0;
}

.profile-section__hint {
    margin-top: -0.35rem;
    margin-bottom: 1rem;
}

.profile-span-full {
    grid-column: 1 / -1;
}

.profile-whales-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.profile-whales-search {
    min-width: 18rem;
    flex: 1;
}

.profile-whales-search input[type="search"] {
    max-width: none;
}

.profile-whales-toolbar__buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.whale-table-wrap {
    max-height: 26rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(18, 26, 38, 0.65);
    scrollbar-color: var(--border) transparent;
    scrollbar-width: thin;
}

.whale-table {
    width: 100%;
    border-collapse: collapse;
    /* Sized to the six columns the profile picker now has, so a desktop viewport never
       reaches for a horizontal scrollbar. Raising this silently brings the scrollbar back. */
    min-width: 640px;
}

.whale-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #142033;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-align: left;
    padding: 0.6rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

.whale-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(47, 61, 82, 0.55);
    vertical-align: middle;
}

.whale-table tbody tr:hover {
    background: rgba(61, 139, 253, 0.06);
}

.whale-table .whale-min-input {
    max-width: none;
}

/* A two-ended bound rendered as one cell. Splitting min and max into separate columns cost
   more width than the whole rest of the row and forced a horizontal scrollbar over the
   config fields; pairing them is both narrower and closer to what the value actually is. */
.whale-range {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.whale-range > input,
.whale-range__field > input {
    min-width: 0;      /* without this a flex item refuses to shrink below its content width */
    width: 100%;
    max-width: none;
}

.whale-range__field {
    position: relative;
    display: flex;
    flex: 1 1 0;
    align-items: center;
    min-width: 0;
}

/* The unit sits inside the field rather than in the header, because the two ends of the
   duration window are in different units and the header can only name one of them. */
.whale-range__field > input {
    padding-right: 1.35rem;
}

.whale-range__unit {
    position: absolute;
    right: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.whale-range__sep {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* A disabled row must read as disabled all the way through, units included. */
.whale-range__field > input:disabled + .whale-range__unit {
    opacity: 0.45;
}

@media (max-width: 860px) {
    .profile-whales-search {
        min-width: 100%;
    }
}

.flash-message {
    margin: 0 0 0.85rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.88rem;
    max-width: 48rem;
}

.flash-message--ok {
    color: var(--success);
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.flash-message--err {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

button,
.btn {
    display: inline-block;
    padding: 0.52rem 1.05rem;
    border-radius: 9px;
    border: none;
    background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    transition: background 0.15s, box-shadow 0.15s, transform 0.12s;
}

button:hover,
.btn:hover {
    background: linear-gradient(180deg, #6eb0ff 0%, #4f95f0 100%);
    box-shadow: 0 2px 8px rgba(61, 139, 253, 0.35);
}

.btn--secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn--secondary:hover {
    background: #2d3d56;
    border-color: var(--input-border-hover);
    box-shadow: none;
}

.btn--sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.btn--danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #7f1d1d;
}

.btn--danger:hover {
    background: #5c151c;
}

.inline-form {
    display: inline;
    margin-left: 0.35rem;
}

.ml-05 {
    margin-left: 0.5rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.toolbar__label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toolbar__meta {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chip {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}

.chip:hover {
    color: var(--text);
    border-color: var(--accent);
}

.chip--active {
    background: rgba(61, 139, 253, 0.2);
    border-color: var(--accent);
    color: var(--text);
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
    max-width: 100%;
}

.table-scroll--data {
    scrollbar-color: var(--border) transparent;
    scrollbar-width: thin;
}

.table-scroll--data::-webkit-scrollbar {
    height: 6px;
}

.table-scroll--data::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-data {
    table-layout: fixed;
}

/* Whale-finder candidates table: 15 columns don't fit a fixed 100%-wide layout (they crush
   together and the nowrap sort headers overlap). Size columns to content and give the table a
   min-width so the scroll container shows a horizontal scrollbar instead of overlapping cells. */
.table-data--wf {
    table-layout: auto;
    min-width: 1180px;
}

.table-data--wf th,
.table-data--wf td {
    white-space: nowrap;
}

/* Keep long usernames from stretching the Trader column indefinitely. */
.table-data--wf .col-nick {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-data th,
.table-data td {
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    vertical-align: middle;
}

/* Clickable sortable column headers — inherit the header colour, hint on hover. */
.sort-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.sort-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.table-whales .col-address {
    width: 19%;
}

.table-whales .col-nick {
    width: 12%;
}

.table-whales .col-num {
    width: 6.5%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table-whales .col-wl {
    width: 4.5rem;
    text-align: center;
}

.table-whales .col-actions {
    min-width: 17rem;
    width: 17rem;
}

.table-whales .col-last-trade {
    width: 6.5rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-whales th.col-num {
    text-align: right;
}

.table-whale-trades .col-nick {
    width: 9%;
}

.table-whale-trades .col-question {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    font-size: 0.76rem;
    hyphens: auto;
}

.address-clip {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
}

.wl-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wl-sep {
    padding: 0 0.2rem;
    color: var(--text-muted);
    font-weight: 400;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.muted-sm {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.page-hint {
    max-width: 52rem;
    line-height: 1.45;
}

.link-external {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid var(--link-underline);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.link-external:hover {
    color: var(--link-hover);
    border-bottom-color: rgba(220, 230, 245, 0.55);
}

th,
td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.small {
    font-size: 0.78rem;
}

.nowrap {
    white-space: nowrap;
}

.truncate {
    display: inline-block;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.cell-question {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-open-positions {
    table-layout: auto;
    min-width: 1040px;
}

.table-open-positions .col-whale {
    max-width: 11rem;
    width: 11rem;
}

.table-open-positions .cell-whale-name {
    display: block;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-open-positions .cell-whale-name--mono {
    font-size: 0.72rem;
}

.table-open-positions .col-opened {
    width: 6.5rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cell-break {
    word-break: break-word;
    max-width: 24rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-muted);
}

.badge--ok {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.badge--warn {
    background: rgba(251, 191, 36, 0.18);
    color: #facc15;
}

.badge--paper {
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
}

.badge--live {
    background: rgba(248, 113, 113, 0.16);
    color: #fda4af;
}

.analytics-rejections {
    margin-top: 1rem;
}

.analytics-whale-pnl {
    margin-top: 1rem;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.pager__link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.pager__link:hover {
    text-decoration: underline;
}

.pager__muted {
    color: var(--text-muted);
}

.pager__info {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
    font-size: 0.85rem;
}

.field-validation-error {
    color: var(--danger);
}

.form-row--checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row--checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    flex-shrink: 0;
}

.sort-th {
    white-space: nowrap;
}

.sort-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
}

.sort-link:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-underline);
}

.sort-ind {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.15rem;
}

.sort-th:has(.sort-link:hover) .sort-ind {
    color: var(--link-hover);
}

.sort-sep {
    color: var(--text-muted);
    font-weight: 400;
}

.analytics-pipeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.25rem;
}

.analytics-pip {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.85rem;
    overflow: visible;
}

.analytics-pip__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.analytics-pip__label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.3;
}

.analytics-pip__value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--mono);
    margin-top: 0.35rem;
    letter-spacing: -0.02em;
}

@media (max-width: 900px) {
    .analytics-pipeline {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.analytics-kpis {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 1.75rem;
}

@media (max-width: 1100px) {
    .analytics-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .analytics-kpis {
        grid-template-columns: 1fr;
    }
}

.analytics-kpi {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    overflow: visible;
}

.analytics-kpi--wide {
    grid-column: span 1;
}

.analytics-kpi__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.analytics-kpi__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.analytics-kpi__value {
    font-size: 1.65rem;
    font-weight: 700;
    font-family: var(--mono);
    margin: 0.35rem 0 0.25rem;
    letter-spacing: -0.02em;
}

.analytics-kpi__value--profit {
    color: var(--success);
}

.analytics-kpi__value--loss {
    color: var(--danger);
}

.analytics-kpi__value--flat {
    color: var(--text-muted);
}

.analytics-kpi__unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.analytics-kpi__meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.analytics-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.chart-card--span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 1100px) {
    .analytics-charts {
        grid-template-columns: 1fr;
    }

    .chart-card--span-2 {
        grid-column: auto;
    }
}

.chart-card {
    /* Deeper surface than the surrounding panels so the plotted data reads brighter/pops. */
    background: linear-gradient(180deg, #151d2b 0%, #111825 100%);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    min-height: 320px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.chart-card__title {
    letter-spacing: -0.01em;
}

/* Chart header: title left, sort/размер controls right (wraps on narrow screens). */
.chart-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chart-ctl {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.chart-ctl__label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chart-ctl__btn {
    cursor: pointer;
    background: transparent;
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    line-height: 1.5;
}

.chart-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.chart-card__hint {
    margin: 0.35rem 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chart-card__hint code {
    font-size: 0.78rem;
    color: var(--accent-hover);
}

.chart-card__empty {
    margin: auto 0;
    text-align: center;
    padding: 2rem 1rem;
}

.chart-card__canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 260px;
}

.chart-card__canvas-wrap--pie {
    min-height: 300px;
    max-width: 720px;
    margin: 0 auto;
}

.analytics-nick-form {
    margin-bottom: 1.25rem;
}

.analytics-nick-form__lead {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
}

.analytics-nick-form__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.85rem 1rem;
}

.analytics-nick-form__field {
    flex: 1 1 16rem;
    min-width: 0;
}

.analytics-nick-form__field label {
    margin-bottom: 0.4rem;
}

.analytics-nick-form__field input[type="text"],
.analytics-nick-form__field select {
    max-width: none;
    width: 100%;
}

.analytics-nick-form__field input[type="text"] {
    font-family: var(--mono);
    letter-spacing: 0.02em;
    font-size: 0.92rem;
}

.analytics-nick-form__submit {
    flex: 0 0 auto;
    align-self: flex-end;
    padding: 0.62rem 1.25rem;
}

.analytics-hint {
    position: relative;
    flex-shrink: 0;
}

.analytics-hint__btn {
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.analytics-hint__btn:hover,
.analytics-hint__btn:focus-visible {
    border-color: var(--accent);
    color: var(--accent-hover);
    outline: none;
}

.analytics-hint__bubble {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: min(19rem, 92vw);
    padding: 0.65rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text);
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    z-index: 80;
}

.analytics-hint:hover .analytics-hint__bubble,
.analytics-hint:focus-within .analytics-hint__bubble {
    display: block;
}

.analytics-ur-formula {
    margin-top: -0.35rem;
    margin-bottom: 1.5rem;
}

.analytics-ur-formula code {
    font-size: 0.8em;
}

.trade-wl {
    font-weight: 700;
}

.trade-wl--win {
    color: #7eb89a;
}

.trade-wl--loss {
    color: #c49a9a;
}

.table-whale-trades code.truncate {
    max-width: 100%;
}

/* ---- Auth: login page + sidebar session footer ---- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.login-card__brand {
    margin-bottom: 1.5rem;
}

.login-card__error {
    margin-bottom: 1rem;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.9rem;
}

.login-card .form-row {
    margin-bottom: 1rem;
}

.login-card__submit {
    width: 100%;
    margin-top: 0.5rem;
}

.sidebar__session {
    margin-top: auto;
    padding: 1rem 1.25rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar__user {
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel--warn {
    border-left: 3px solid #f7b955;
}

.sparkline {
    display: block;
    overflow: visible;
}

/* ── Profit by whale: retired whales, hidden by default ────────────────────
   The table lists every whale we have ever copied. That is the right history and the wrong
   default — an operator asking "how are my whales doing" means the ones being copied now. The
   eye toggle reveals the rest; when shown, they are dimmed so the distinction survives sorting. */
tr.is-retired {
    opacity: .55;
}

tr.is-retired td:first-child .muted {
    font-size: .85em;
}

/* A chart with every series filtered out must say so. An empty canvas reads as "no data at all",
   which is a different and more alarming statement than "nothing here is still copied". */
.chart-card__canvas-wrap[data-empty]::after {
    content: attr(data-empty);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted, #8b95a5);
    font-size: .9rem;
}

/* ── Whale-finder evidence trades ──────────────────────────────────────────
   The markets that actually produced a candidate's PnL, collapsed by default so
   the table stays scannable and only expands when the operator is reviewing. */
.evidence {
    margin-top: .35rem;
}

.evidence > summary {
    cursor: pointer;
    user-select: none;
}

.evidence[open] > summary {
    margin-bottom: .3rem;
}

.evidence-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}

.evidence-table td {
    padding: .15rem .4rem .15rem 0;
    border: 0;
    vertical-align: top;
}

.evidence-title {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.evidence-table .pos {
    color: var(--success);
}

.evidence-table .neg {
    color: var(--danger);
}

/* Whale-finder tuning panel: collapsed by default so the candidate table stays the focus. */
.finder-tuning > summary {
    cursor: pointer;
    user-select: none;
}

.finder-tuning[open] > summary {
    margin-bottom: .6rem;
}
