:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --panel-soft: #f8fbff;
    --line: #d9e3f0;
    --line-strong: #c6d3e4;
    --text: #18253a;
    --muted: #6d7b91;
    --brand: #237eff;
    --brand-soft: #edf4ff;
    --success: #168a4a;
    --success-bg: #edf9f2;
    --danger: #e04852;
    --danger-bg: #fff1f2;
    --neutral: #62748a;
    --neutral-bg: #eef3f8;
    --shadow: 0 12px 34px rgba(20, 41, 77, 0.08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(35, 126, 255, 0.10), transparent 22%),
        linear-gradient(180deg, #f8fbff, #f1f5fb 35%, #eef3f8 100%);
    color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell {
    max-width: 1460px;
    margin: 0 auto;
    padding: 5px 2px 2px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 5px;
}
.topbar h1 { margin: 6px 0 0; font-size: 1rem; }
.eyebrow {
    color: var(--brand);
    font-size: .65rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 500;
}
.topbar-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar-nav a {
    color: var(--text);
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: 999px;
}
.topbar-nav a:hover {
    text-decoration: none;
    border-color: var(--brand);
}
.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}
.narrow { max-width: 480px; margin: 48px auto; }
.auth-card h2, .card h2 { margin: 0 0 8px; }
label {
    display: block;
    margin: 0 0 8px;
    color: var(--text);
    font-size: .92rem;
    font-weight: 600;
}
input, select, button {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(35, 126, 255, 0.12);
}
button {
    background: linear-gradient(135deg, #237eff, #165ad9);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(35, 126, 255, 0.22);
}
button:hover { filter: brightness(1.03); }
.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.flash {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.flash-success { background: var(--success-bg); border: 1px solid rgba(22, 138, 74, 0.18); color: var(--success); }
.flash-error { background: var(--danger-bg); border: 1px solid rgba(224, 72, 82, 0.18); color: var(--danger); }
.feature-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text);
    display: grid;
    gap: 10px;
}
.filter-form { display: grid; gap: 12px; }
.filter-field { display: none; }
.dashboard-shell { display: grid; gap: 18px; }
.report-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}
.pill-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-soft);
    color: var(--text);
    font-weight: 600;
}
.pill-action {
    background: var(--brand-soft);
    border-color: rgba(35, 126, 255, 0.2);
    color: var(--brand);
}
.filter-card { padding: 12px 14px; }
.compact-filter-card {
    min-height: 100%;
}
.filter-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    height: 100%;
}
.filter-custom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    grid-column: 1 / span 2;
}
.filter-action-wrap {
    display: grid;
    gap: 5px;
    min-width: 140px;
    align-self: stretch;
}
.filter-action-wrap button {
    min-height: 46px;
}
.dashboard-top-band label {
    margin-bottom: 6px;
    font-size: .82rem;
}
.dashboard-top-band input,
.dashboard-top-band select,
.dashboard-top-band button {
    padding: 10px 12px;
    min-height: 44px;
}
.headline-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.compact-headline-grid {
    align-content: stretch;
}
.metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    min-height: 100%;
}
.metric-card span {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.metric-card strong {
    display: block;
    font-size: 1.32rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}
.metric-card small {
    color: var(--muted);
    font-size: .75rem;
}
.metric-card.good { border-top: 4px solid var(--success); }
.metric-card.bad { border-top: 4px solid var(--danger); }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}
.dashboard-grid > .card {
    height: 100%;
}
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.grid-break {
    grid-column: 1 / -1;
    height: 0;
    margin: 0;
    padding: 0;
}

.calendar-section .calendar-months {
    grid-template-columns: minmax(0, 1fr);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 14px;
    margin-bottom: 14px;
}
.section-head h2 { margin-bottom: 4px; }
.equity-card .equity-section-head {
    display: grid;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 12px;
}
.equity-card .equity-head-main {
    display: grid;
    grid-template-columns: minmax(180px, 0.82fr) minmax(0, 1.5fr);
    gap: 12px;
    align-items: start;
}
.equity-card .embedded-filter-card {
    padding: 8px 10px;
    border-radius: 14px;
    box-shadow: none;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(242, 247, 255, 0.98));
}
.equity-card .filter-grid-embedded {
    grid-template-columns: minmax(104px, 0.82fr) minmax(118px, 0.95fr) auto;
    gap: 6px;
}
.equity-card .embedded-filter-card .filter-custom {
    gap: 6px;
}
.equity-card .embedded-filter-card .filter-action-wrap {
    min-width: 68px;
    gap: 2px;
    justify-items: start;
}
.equity-card .embedded-filter-card label {
    margin-bottom: 3px;
    font-size: .74rem;
}
.equity-card .embedded-filter-card input,
.equity-card .embedded-filter-card select {
    min-height: 34px;
    padding: 7px 9px;
    font-size: .86rem;
    border-radius: 12px;
}
.equity-card .embedded-filter-card button {
    width: auto;
    min-height: 24px;
    padding: 4px 7px;
    font-size: .492rem;
    line-height: 1;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(35, 126, 255, 0.16);
    white-space: nowrap;
}
.equity-card .embedded-filter-card .small {
    font-size: .62rem;
    line-height: 1.1;
}
.equity-card .embedded-headline-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.equity-card .embedded-headline-grid .metric-card {
    padding: 10px 12px;
    border-radius: 16px;
    box-shadow: none;
}
.equity-card .embedded-headline-grid .metric-card span {
    font-size: .76rem;
    margin-bottom: 5px;
}
.equity-card .embedded-headline-grid .metric-card strong {
    font-size: 1.14rem;
    margin-bottom: 3px;
}
.equity-card .embedded-headline-grid .metric-card small {
    font-size: .72rem;
    line-height: 1.2;
}
.chart-card canvas {
    width: 100%;
    min-height: 210px;
    max-height: 230px;
}
.chart-primary canvas {
    min-height: 190px;
    max-height: 205px;
}
.equity-card canvas {
    min-height: 300px;
    max-height: 340px;
}
.mini-chart canvas {
    min-height: 210px;
    max-height: 235px;
}
.halfhour-card canvas {
    min-height: 250px;
    max-height: 280px;
}
.standalone-drawdown-card canvas {
    width: 100%;
    min-height: 260px;
    max-height: 300px;
}
.stats-card .stats-list div {
    padding: 9px 0;
}
.stats-card .mini-metrics-grid {
    gap: 8px;
}
.stats-card .mini-metric {
    padding: 12px;
}
.stats-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.stats-list {
    display: grid;
    gap: 10px;
    margin: 0;
}
.stats-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.stats-list dt {
    color: var(--muted);
    font-size: .92rem;
}
.stats-list dd {
    margin: 0;
    font-weight: 700;
    color: var(--text);
    text-align: right;
}
.mini-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.mini-metric {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
}
.mini-metric span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    margin-bottom: 6px;
}
.mini-metric strong {
    font-size: 1.1rem;
}
.calendar-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-height: 680px;
    overflow: auto;
    padding-right: 2px;
}
.month-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}
.month-label {
    font-weight: 800;
    margin-bottom: 10px;
}
.calendar-weekdays,
.calendar-grid {
    display: grid;
    gap: 6px;
}
.calendar-weekdays {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.weekday-calendar-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.calendar-weekdays span {
    text-align: center;
    font-size: .76rem;
    color: var(--muted);
    font-weight: 700;
    padding-bottom: 4px;
}
.week-total-heading {
    color: var(--text);
}
.day-cell {
    min-height: 72px;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 8px 7px 7px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: flex-start;
    align-items: flex-start;
    overflow: hidden;
}
.day-cell strong {
    display: block;
    width: 100%;
    margin-top: 2px;
    font-size: .78rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.day-cell small {
    display: block;
    width: 100%;
    color: #5f6f86;
    font-size: .69rem;
    line-height: 1.1;
}
.day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    font-size: .76rem;
    font-weight: 700;
    color: #1f2b3d;
    flex: 0 0 auto;
}
.day-win { background: #dff4e7; border-color: rgba(22, 138, 74, 0.32); }
.day-loss { background: #fde4e7; border-color: rgba(224, 72, 82, 0.32); }
.day-flat { background: #deebff; border-color: rgba(35, 126, 255, 0.28); }
.no-trade { background: #e9eef5; border-color: rgba(109, 123, 145, 0.18); }
.out-range { opacity: 0.48; background: #f5f8fc; border-color: rgba(109, 123, 145, 0.10); }
.empty { background: transparent; }
.week-total-cell {
    min-height: 72px;
    border-radius: 12px;
    border: 1px dashed rgba(109, 123, 145, 0.22);
    background: #f7f9fc;
    padding: 8px 7px 7px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
}
.week-total-cell span {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
}
.week-total-cell strong {
    display: block;
    width: 100%;
    font-size: .84rem;
    line-height: 1.15;
    font-weight: 800;
    white-space: nowrap;
}
.week-total-cell.positive {
    background: #e6f6ec;
    border-color: rgba(22, 138, 74, 0.26);
}
.week-total-cell.negative {
    background: #feecee;
    border-color: rgba(224, 72, 82, 0.24);
}
.week-total-cell.flat {
    background: #eaf2ff;
    border-color: rgba(35, 126, 255, 0.22);
}
.week-total-cell.empty {
    background: transparent;
    border: 0;
    padding: 0;
}
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .94rem;
}
th, td {
    text-align: left;
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
th {
    color: var(--muted);
    font-weight: 700;
    font-size: .83rem;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.pos { color: var(--success); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.ghost-link {
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--brand-soft);
    border: 1px solid rgba(35, 126, 255, 0.18);
}
.data-note p { margin-bottom: 0; }
@media (max-width: 1280px) {
    .equity-head-main {
        grid-template-columns: 1fr;
    }
    .filter-grid,
    .headline-grid,
    .mini-metrics-grid,
    .calendar-months {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .embedded-headline-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
    .equity-card canvas {
        min-height: 260px;
        max-height: 300px;
    }
}
@media (max-width: 900px) {
    .topbar,
    .report-hero,
    .section-head {
        flex-direction: column;
        align-items: start;
    }
    .filter-grid,
    .headline-grid,
    .stats-grid-two,
    .mini-metrics-grid,
    .calendar-months,
    .embedded-headline-grid,
    .filter-grid-embedded {
        grid-template-columns: 1fr;
    }
    .filter-custom {
        grid-column: auto;
    }
    .equity-section-head {
        gap: 12px;
    }
    .embedded-filter-card {
        width: 100%;
    }
    .filter-action-wrap {
        min-width: 0;
        width: 100%;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: auto; }
    .chart-primary canvas,
    .mini-chart canvas,
    .halfhour-card canvas,
    .equity-card canvas {
        min-height: 220px;
        max-height: none;
    }
}

.day-cell.empty {
    min-height: 72px;
    background: transparent;
    border: 0;
    padding: 0;
}
