:root {
    --bg: #eef2f9;
    --panel: #ffffff;
    --panel-contrast: #0b1627;
    --text: #0b1220;
    --muted: #5b6475;
    --accent: #0ea5e9;
    --accent-2: #f97316;
    --border: #d5deeb;
    --shadow: 0 22px 70px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "IBM Plex Mono", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

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

.bg-accent {
    position: absolute;
    width: 520px;
    height: 520px;
    filter: blur(120px);
    opacity: 0.5;
    z-index: 0;
}

.blob-a {
    top: -160px;
    left: -120px;
    background: radial-gradient(circle at 30% 30%, rgba(14, 165, 233, 0.55), transparent 55%);
}

.blob-b {
    bottom: -200px;
    right: -140px;
    background: radial-gradient(circle at 70% 70%, rgba(249, 115, 22, 0.4), transparent 60%);
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(244, 247, 251, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-name {
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.brand-tagline {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.nav {
    display: flex;
    gap: 18px;
    font-weight: 500;
}

.nav a {
    padding: 10px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav a:hover {
    background: #e6eef7;
}

.nav a.active {
    background: #0f172a;
    color: #fff;
}

.mode-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    min-width: 200px;
}

#admin-panel[hidden] {
    display: none !important;
}

.mode-switcher {
    display: inline-flex;
    background: #e9eef5;
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
}

.mode-button {
    border: none;
    border-radius: 12px;
    padding: 6px 14px;
    font-weight: 600;
    background: transparent;
    cursor: pointer;
    color: #475569;
    transition: all 0.15s ease;
}

.mode-button.active {
    background: #0f172a;
    color: #fff;
}

.mode-description {
    font-size: 13px;
    color: #475569;
    max-width: 260px;
    text-align: right;
}

body[data-mode="investor"] #admin-panel {
    display: none;
}

.tiny {
    font-size: 12px;
    line-height: 1.3;
}

.cta {
    display: flex;
    gap: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 14px;
    padding: 11px 16px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: var(--shadow);
}

.button.primary:hover {
    transform: translateY(-1px);
}

.button.ghost {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.8);
}

.lead {
    color: var(--muted);
    max-width: 820px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-size: 12px;
    color: var(--accent-2);
    margin: 0;
    font-weight: 700;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.12);
    color: #0f172a;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid rgba(14, 165, 233, 0.4);
}

.pill-ghost {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.hero-panel {
    background: var(--panel-contrast);
    color: #e6ecf5;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.vault-cta {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    max-width: 320px;
    box-shadow: var(--shadow);
}

.vault-cta h3 {
    margin: 6px 0 10px;
}

.vault-cta p {
    margin: 6px 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.panel-body {
    display: grid;
    gap: 12px;
}

.stat {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat .label {
    margin: 0;
    color: #9fb2c7;
    font-size: 12px;
    letter-spacing: 0.4px;
}

.stat .value {
    margin: 2px 0 4px;
    font-size: 24px;
    font-weight: 700;
}

.stat .sub {
    margin: 0;
    color: #9fb2c7;
    font-size: 13px;
}

.sparkline {
    height: 72px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.section {
    position: relative;
    z-index: 1;
    padding: 56px 36px;
    max-width: 1380px;
    margin: 0 auto;
}

.section.wide {
    max-width: 1380px;
}

.section-alt {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(249, 115, 22, 0.08));
    border-radius: 28px;
    margin-top: 16px;
}

.section-header h2 {
    margin: 6px 0;
    font-size: 32px;
}

.section-lead {
    color: var(--muted);
    max-width: 840px;
}

.grid {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

.cards-3 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cards-3.tall {
    align-items: stretch;
}

.cards-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.cards-4 {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card.contrast {
    background: var(--panel-contrast);
    color: #e8eef7;
    border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 18px;
}

.card-text {
    margin: 0 0 12px;
    color: var(--muted);
}

.card-text.muted {
    color: #7a8497;
}

.card.contrast .card-text {
    color: #c6d4e7;
}

.tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-list li {
    padding: 8px 10px;
    border-radius: 12px;
    background: #eaf0f7;
    font-weight: 600;
    font-size: 13px;
}

.tag-list.vertical {
    flex-direction: column;
    align-items: flex-start;
}

.card.contrast .tag-list li {
    background: rgba(255, 255, 255, 0.08);
    color: #e8eef7;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.summary-grid.kpi-grid .card.metric {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-grid .value {
    font-size: 28px;
    font-weight: 700;
    margin: 2px 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0 8px;
}

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.mini-metrics span {
    color: #c6d4e7;
    font-size: 13px;
}

.mini-metrics strong {
    display: block;
    font-size: 18px;
    margin-top: 4px;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.calendar-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.day {
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.day span {
    display: block;
    margin-top: 6px;
    color: #c6d4e7;
    font-size: 12px;
}

.day.positive { color: #8ef6c2; }
.day.flat { color: #e0e7ff; }
.day.negative { color: #ffc5c5; }

.mode-switch {
    display: inline-flex;
    background: #e9eef5;
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
}

.auth-box {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mode-controls .auth-box {
    flex-direction: column;
    align-items: flex-end;
}

.auth-box input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 220px;
    font-family: "IBM Plex Mono", monospace;
}

.button.small {
    padding: 10px 12px;
    font-size: 14px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 12px 0 18px;
}

.card.small {
    padding: 12px;
}

.mode-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.mode-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0 10px;
}

.filter-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 700;
    color: var(--muted);
    min-width: 140px;
}

.filter-block select,
.filter-block input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-weight: 600;
    font-family: "Space Grotesk", sans-serif;
}

.footer {
    padding: 28px 32px 40px;
    background: #0f172a;
    color: #e6ecf5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #c6d4e7;
}

.footer-note {
    color: #9fb2c7;
    margin: 0;
}

.footer-disclaimer {
    margin: 2px 0 0;
    font-size: 12px;
    color: #9fb2c7;
    max-width: 520px;
    line-height: 1.4;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1100px;
}

.trades-table th,
.trades-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.trades-table th {
    color: #0b1220;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
}

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

.trades-table .pos {
    color: #059669;
    font-weight: 700;
}

.trades-table .neg {
    color: #dc2626;
    font-weight: 700;
}

.trades-table .flat {
    color: #64748b;
    font-weight: 600;
}

.trade-date {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-date.compact {
    gap: 2px;
    font-size: 13px;
}

.session-tag,
.hold-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    width: fit-content;
}

.hold-tag {
    background: #fef3c7;
    color: #92400e;
}

.hold-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hold-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-hint {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.context-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.context-tags span {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.trades-table.compact {
    min-width: 100%;
    font-size: 13px;
}

.trades-table.compact th,
.trades-table.compact td {
    padding: 8px 6px;
}

.live-error {
    margin-top: 16px;
    color: #dc2626;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    min-height: 22px;
}

.live-error.visible {
    opacity: 1;
}

.empty-note {
    display: none;
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px dashed var(--border);
    color: #475569;
    background: rgba(15, 23, 42, 0.02);
    font-size: 14px;
}

.empty-note.visible {
    display: block;
}

.list-card {
    min-height: 120px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.calendar-grid .day {
    background: #eaf0f7;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}

.calendar-grid .day.positive {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

.calendar-grid .day.negative {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.calendar-grid .day.flat {
    background: #f1f5f9;
    color: #475569;
}

.calendar-grid .day strong {
    display: block;
    margin-top: 6px;
    font-size: 16px;
}

.calendar-legend {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    margin-right: 4px;
}

.legend-dot.positive {
    background: #059669;
}

.legend-dot.negative {
    background: #dc2626;
}

.legend-dot.flat {
    background: #94a3b8;
}

.calendar-empty {
    color: var(--muted);
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
}

.bar-chart .bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-chart .label {
    min-width: 110px;
    font-weight: 600;
    text-transform: uppercase;
}

.bar-track {
    flex: 1;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    height: 18px;
}

.bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.bar-meta {
    min-width: 120px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
}

.chart-empty {
    color: var(--muted);
}

.trades-table.pro th,
.trades-table.pro td {
    padding: 10px 8px;
}

.trades-table.pro tbody tr {
    transition: background 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.trades-table.pro tbody tr:hover {
    background: #eaf1ff;
    transform: translateY(-1px);
}

.trades-table.pro td:nth-child(1),
.trades-table.pro td:nth-child(4),
.trades-table.pro td:nth-child(5) {
    font-family: "IBM Plex Mono", monospace;
}

.trades-table.pro td.r-result {
    font-family: "IBM Plex Mono", monospace;
    font-size: 15px;
}

.trades-table.pro td.pnl {
    font-weight: 600;
    color: #475569;
}

.trades-table.pro td.pnl.pos {
    color: #059669;
    opacity: 0.8;
}

.trades-table.pro td.pnl.neg {
    color: #dc2626;
    opacity: 0.8;
}

.trades-table.pro td.pnl.flat {
    color: #94a3b8;
}

.table-note {
    margin: 8px 0 0;
}

.card-cta {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.card-cta .button {
    width: auto;
}

.dual-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.dual-cta .button {
    flex: 1 1 220px;
    text-align: center;
}

.cta-inline {
    margin-top: 12px;
}

.section.page-title {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.section.page-title > div {
    flex: 1;
    min-width: 280px;
}

.section.page-title .vault-cta {
    flex: 0 0 320px;
}

.page-title h1 {
    margin: 6px 0 10px;
    font-size: 40px;
}

.page-title .lead {
    margin: 8px 0 6px;
}

.subtext {
    color: var(--muted);
    font-size: 14px;
}

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

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

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

.trade-chart {
    min-height: 220px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.detail-list {
    margin: 0;
}

.detail-list dt {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.2px;
}

.detail-list dd {
    margin: 2px 0 12px;
    font-weight: 700;
    color: var(--text);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.metric-card .label {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.metric-card .value {
    margin: 4px 0 0;
    font-size: 24px;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.hero .lead {
    max-width: 820px;
}

.section-alt {
    padding: 44px 32px;
}

@media (max-width: 980px) {
    .page-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav {
        width: 100%;
        justify-content: center;
    }

    .mode-controls {
        width: 100%;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .page-header {
        position: static;
    }

    .nav {
        justify-content: flex-start;
    }

    .section {
        padding: 32px 18px;
    }
}
