:root {
    --bg:#f7f8fa;
    --surface:#fff;
    --text:#17212f;
    --muted:#778393;
    --border:#e4e8ed;
    --accent:#2563eb;
    --soft:#eff5ff;
    --green:#16845c;
    --red:#c94343
}
html[data-theme=dark] {
    --bg:#10151c;
    --surface:#19212b;
    --text:#edf1f7;
    --muted:#9aa9ba;
    --border:#303d4b;
    --accent:#80aaff;
    --soft:#253447;
    --green:#56c59b;
    --red:#ff8888
}
* {
    box-sizing:border-box
}
body {
    margin:0;
    background:var(--bg);
    color:var(--text);
    font:14px/1.55 Inter,system-ui,-apple-system,Segoe UI,sans-serif
}
button,input,select,textarea {
    font:inherit
}
button {
    cursor:pointer
}
button:disabled {
    opacity:.5;
    cursor:not-allowed
}
.shell {
    min-height:100vh;
    display:grid;
    grid-template-columns:224px minmax(0,1fr)
}
.sidebar {
    background:var(--surface);
    border-right:1px solid var(--border);
    padding:28px 16px;
    display:flex;
    flex-direction:column;
    gap:26px
}
.brand {
    font-size:22px;
    font-weight:750;
    letter-spacing:-.7px;
    padding:0 13px
}
.nav {
    display:grid;
    gap:5px
}
.nav button {
    width:100%;
    display:flex;
    align-items:center;
    gap:12px;
    text-align:left;
    padding:11px 13px;
    border:0;
    background:transparent;
    color:var(--muted);
    border-radius:7px;
    font-weight:550
}
.nav button.active {
    background:var(--soft);
    color:var(--accent)
}
.nav button:hover {
    background:var(--soft)
}
.nav svg {
    width:18px;
    height:18px;
    stroke:currentColor;
    fill:none;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round
}
.side-bottom {
    margin-top:auto;
    padding:12px 13px;
    color:var(--muted);
    font-size:12px;
    overflow-wrap:anywhere
}
.main {
    min-width:0
}
.topbar {
    background:var(--surface);
    border-bottom:1px solid var(--border);
    height:70px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 36px;
    gap:15px
}
.topbar h1 {
    font-size:19px;
    margin:0;
    letter-spacing:-.35px
}
.top-actions {
    display:flex;
    gap:10px;
    align-items:center
}
.content {
    max-width:1350px;
    margin:0 auto;
    padding:30px 36px 60px
}
.pagehead {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:23px
}
.pagehead h2 {
    font-size:23px;
    margin:0 0 3px;
    letter-spacing:-.6px
}
.muted {
    color:var(--muted)
}
.small {
    font-size:12px
}
.btn {
    border:1px solid var(--border);
    border-radius:7px;
    padding:9px 15px;
    background:var(--surface);
    color:var(--text);
    font-weight:600;
    white-space:nowrap
}
.btn:hover {
    background:var(--soft)
}
.btn.primary {
    background:var(--accent);
    border-color:var(--accent);
    color:white
}
.btn.danger {
    color:var(--red)
}
.select,input,select,textarea {
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface);
    color:var(--text);
    padding:10px 12px;
    min-width:0
}
select {
    max-width:100%
}
input,textarea {
    width:100%
}
textarea {
    min-height:90px;
    resize:vertical
}
.metrics {
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:15px;
    margin-bottom:18px
}
.panel {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:10px;
    padding:21px
}
.metric-label {
    font-size:12px;
    color:var(--muted);
    margin-bottom:10px
}
.metric-value {
    font-size:26px;
    font-weight:720;
    letter-spacing:-.7px
}
.positive {
    color:var(--green)
}
.negative {
    color:var(--red)
}
.dashboard-grid {
    display:grid;
    grid-template-columns:1.55fr 1fr;
    gap:18px;
    margin-bottom:18px
}
.panel-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:15px
}
.panel h3 {
    font-size:15px;
    margin:0
}
.chart {
    height:250px;
    display:flex;
    align-items:center;
    justify-content:center
}
.chart svg {
    width:100%;
    height:100%
}
.empty {
    padding:55px 15px;
    text-align:center;
    color:var(--muted)
}
.tablewrap {
    overflow-x:auto;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--surface)
}
table {
    width:100%;
    border-collapse:collapse;
    min-width:720px
}
th,td {
    padding:13px 17px;
    text-align:left;
    border-bottom:1px solid var(--border)
}
th {
    color:var(--muted);
    font-size:12px;
    font-weight:600;
    background:var(--bg)
}
tbody tr:last-child td {
    border-bottom:0
}
tbody tr:hover {
    background:var(--soft)
}
.right {
    text-align:right
}
.clickable {
    cursor:pointer
}
.toolbar {
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
    margin-bottom:17px
}
.toolbar input {
    max-width:290px
}
.toolbar select {
    max-width:210px
}
.result {
    display:inline-block;
    border-radius:5px;
    padding:2px 9px;
    font-size:12px;
    background:var(--bg)
}
.result.win {
    color:var(--green)
}
.result.loss {
    color:var(--red)
}
.calendar-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:18px;
    gap:12px
}
.calgrid {
    display:grid;
    grid-template-columns:repeat(7,minmax(0,1fr));
    gap:7px
}
.weekday {
    text-align:center;
    color:var(--muted);
    font-size:12px;
    padding:8px 0
}
.day {
    min-height:88px;
    padding:9px;
    border:1px solid var(--border);
    background:var(--surface);
    border-radius:7px;
    text-align:left;
    color:var(--text)
}
.day:disabled {
    background:transparent;
    border-color:transparent
}
.day:not(:disabled):hover {
    border-color:var(--accent)
}
.day .number {
    font-size:12px
}
.day .amount {
    font-size:13px;
    font-weight:700;
    margin-top:10px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis
}
.day.win {
    background:color-mix(in srgb,var(--green) 9%,var(--surface))
}
.day.loss {
    background:color-mix(in srgb,var(--red) 8%,var(--surface))
}
.day.selected {
    outline:2px solid var(--accent)
}
.settings-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px
}
.settings-grid .panel {
    min-width:0
}
.account-row {
    display:flex;
    justify-content:space-between;
    gap:10px;
    align-items:center;
    padding:12px 0;
    border-bottom:1px solid var(--border)
}
.account-row:last-child {
    border:0
}
.form-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:15px
}
.field {
    display:grid;
    gap:5px
}
.field label {
    font-size:12px;
    font-weight:600;
    color:var(--muted)
}
.full {
    grid-column:1/-1
}
.dialog {
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--surface);
    color:var(--text);
    width:min(580px,calc(100% - 24px));
    max-height:90vh;
    padding:0;
    box-shadow:0 18px 65px #0003
}
.dialog::backdrop {
    background:#0a152288
}
.dialog-head,.dialog-foot {
    padding:19px 23px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    border-bottom:1px solid var(--border)
}
.dialog-foot {
    border-top:1px solid var(--border);
    border-bottom:0;
    justify-content:flex-end
}
.dialog-body {
    padding:23px;
    overflow-y:auto;
    max-height:65vh
}
.dialog-head h3 {
    margin:0;
    font-size:18px
}
.auth {
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:20px
}
.auth-card {
    width:min(420px,100%);
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:12px;
    padding:32px
}
.auth-card h1 {
    margin:0 0 8px
}
.auth-card form {
    display:grid;
    gap:14px;
    margin-top:24px
}
.auth-switch {
    border:0;
    background:transparent;
    color:var(--accent);
    padding:10px 0
}
.notice {
    padding:12px 14px;
    background:var(--soft);
    border-radius:7px;
    color:var(--text);
    margin:12px 0
}
.footer {
    margin-top:40px;
    border-top:1px solid var(--border);
    padding-top:16px;
    color:var(--muted);
    font-size:11px;
    display:flex;
    justify-content:space-between;
    gap:20px
}
#toast {
    position:fixed;
    bottom:20px;
    left:50%;
    transform:translateX(-50%);
    z-index:20;
    background:var(--text);
    color:var(--surface);
    border-radius:8px;
    padding:10px 17px;
    display:none;
    max-width:90vw
}
#toast.show {
    display:block
}
@media(max-width:1000px) {
    .metrics {
        grid-template-columns:repeat(2,1fr)
    }
    .dashboard-grid,.settings-grid {
        grid-template-columns:1fr
    }
}
@media(max-width:680px) {
    .shell {
        display:block
    }
    .sidebar {
        padding:12px 15px;
        gap:8px;
        border-right:0;
        border-bottom:1px solid var(--border)
    }
    .brand {
        font-size:19px
    }
    .nav {
        display:flex;
        overflow-x:auto
    }
    .nav button {
        white-space:nowrap;
        padding:9px
    }
    .side-bottom {
        display:none
    }
    .topbar {
        height:auto;
        min-height:60px;
        padding:12px 18px
    }
    .content {
        padding:22px 16px
    }
    .pagehead {
        align-items:flex-start;
        flex-wrap:wrap
    }
    .metrics {
        gap:10px
    }
    .panel {
        padding:16px
    }
    .metric-value {
        font-size:21px
    }
    .form-grid {
        grid-template-columns:1fr
    }
    .calgrid {
        gap:3px
    }
    .day {
        min-height:67px;
        padding:5px
    }
    .day .amount {
        font-size:10px
    }
    .footer {
        display:block
    }
    .top-actions select {
        max-width:130px
    }
}
/* Clean horizontal website header */
html[data-theme=dark] {
    --bg:#000000;
    --surface:#101010;
    --text:#f2f2f2;
    --muted:#a0a0a0;
    --border:#292929;
    --accent:#79a9ff;
    --soft:#1b1b1b;
    --green:#57c997;
    --red:#fa8181
}
.shell {
    display:block;
    min-height:100vh
}
.topbar {
    height:auto;
    min-height:76px;
    padding:15px max(28px,calc((100vw - 1350px)/2));
    gap:24px
}
.header-right {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:22px;
    min-width:0
}
.nav {
    display:flex;
    align-items:center;
    gap:4px
}
.nav button {
    width:auto;
    padding:9px 13px;
    border-radius:6px;
    white-space:nowrap;
    font-weight:600
}
.nav button.active {
    background:var(--soft);
    color:var(--accent)
}
.brand {
    padding:0;
    white-space:nowrap
}
.metrics .panel {
    padding:20px 22px;
    min-height:125px;
    border-radius:10px;
    position:relative
}
.metrics .metric-label {
    font-size:13px;
    font-weight:600;
    margin-bottom:15px
}
.metrics .metric-value {
    font-size:clamp(22px,2.3vw,30px);
    font-weight:750;
    letter-spacing:-.8px;
    line-height:1.2
}
.metrics .panel::after {
    content:'';
    position:absolute;
    top:20px;
    right:20px;
    width:7px;
    height:7px;
    border-radius:50%;
    background:var(--border)
}
.metrics .panel:first-child::after {
    background:var(--accent)
}
.metrics .panel:nth-child(2)::after {
    background:var(--green)
}
.metrics .panel:nth-child(3)::after {
    background:var(--muted)
}
.metrics .panel:nth-child(4)::after {
    background:var(--accent)
}
.result.long,.result.short,.result.open,.result.win,.result.loss,.result.breakeven {
    border:1px solid var(--border);
    border-radius:5px;
    padding:3px 10px;
    font-weight:650
}
.result.long {
    color:var(--green);
    background:color-mix(in srgb,var(--green) 9%,var(--surface));
    border-color:color-mix(in srgb,var(--green) 26%,var(--border))
}
.result.short {
    color:var(--red);
    background:color-mix(in srgb,var(--red) 9%,var(--surface));
    border-color:color-mix(in srgb,var(--red) 26%,var(--border))
}
.result.open {
    color:var(--accent);
    background:var(--soft)
}
.dashboard-grid + .panel {
    margin-top:18px
}
.recent-trades {
    margin-top:18px
}
@media(max-width:1000px) {
    .topbar {
        padding:14px 22px;
        flex-wrap:wrap
    }
    .header-right {
        flex-wrap:wrap;
        gap:10px
    }
    .nav {
        flex-wrap:wrap
    }
}
@media(max-width:680px) {
    .topbar {
        display:flex;
        align-items:flex-start;
        flex-direction:column;
        padding:16px;
        gap:12px
    }
    .header-right {
        width:100%;
        display:flex;
        align-items:stretch;
        flex-direction:column
    }
    .nav {
        width:100%;
        overflow-x:auto;
        flex-wrap:nowrap
    }
    .nav button {
        padding:8px 10px
    }
    .top-actions {
        justify-content:space-between
    }
    .metrics .panel {
        min-height:105px;
        padding:15px
    }
    .metrics .metric-value {
        font-size:21px
    }
}
/* Reference-inspired performance cards */
html[data-theme=dark] {
    --bg:#000;
    --surface:#0d0d0f;
    --text:#f2f2f5;
    --muted:#9999a4;
    --border:#252529;
    --soft:#19191d;
    --green:#24bb54;
    --red:#f25a65
}
.dashboard-quote {
    color:var(--muted);
    font-size:14px;
    margin-top:5px;
    max-width:800px;
    overflow-wrap:anywhere
}
.metrics-ref .panel {
    min-height:145px;
    background:var(--surface);
    border-radius:8px;
    padding:17px 19px
}
.metrics-ref .panel::after {
    display:none
}
.metrics-ref .metric-label {
    font-size:11px;
    letter-spacing:.12em;
    font-weight:650;
    display:flex;
    justify-content:space-between;
    gap:8px;
    margin-bottom:18px
}
.metrics-ref .metric-label span {
    font-size:15px;
    letter-spacing:0;
    opacity:.7
}
.metrics-ref .metric-value {
    font-size:25px;
    font-weight:700
}
.metric-sub {
    font-size:12px;
    color:var(--muted);
    margin-top:7px
}
.gauge-row {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:8px
}
.gauge {
    width:90px;
    height:57px;
    position:relative;
    display:grid;
    place-items:end center;
    flex-shrink:0
}
.gauge:before {
    content:'';
    position:absolute;
    inset:0 0 auto;
    height:90px;
    border-radius:50%;
    background:conic-gradient(from 270deg,#189de5 0 calc(var(--pct)*.5%),var(--border) calc(var(--pct)*.5%) 50%,transparent 50% 100%);
    clip-path:inset(0 0 50% 0)
}
.gauge:after {
    content:'';
    position:absolute;
    width:68px;
    height:68px;
    border-radius:50%;
    background:var(--surface);
    top:11px;
    clip-path:inset(0 0 50% 0)
}
.gauge strong {
    position:relative;
    z-index:1;
    font-size:17px;
    line-height:1
}
.gauge-side {
    font-size:11px;
    color:var(--muted);
    text-align:right;
    line-height:1.6
}
.ratio-bar {
    height:7px;
    border-radius:8px;
    overflow:hidden;
    background:var(--red);
    margin-top:9px
}
.ratio-bar span {
    height:100%;
    display:block;
    background:var(--green)
}
.trade-summary {
    display:grid;
    gap:15px;
    margin-top:25px
}
.trade-summary>div {
    display:flex;
    justify-content:space-between;
    gap:15px
}
.trade-summary strong {
    font-size:18px
}
/* Full-width calendar with a weekly total column */
.dashboard-calendar {
    margin:0 0 20px
}
.calendar-panel {
    padding:18px 15px
}
.calendar-head {
    justify-content:center;
    gap:20px
}
.calendar-head h3 {
    min-width:170px;
    text-align:center
}
.calendar-scroll {
    overflow-x:auto
}
.calgrid {
    grid-template-columns:repeat(7,minmax(0,1fr)) minmax(85px,.75fr);
    gap:4px;
    min-width:720px
}
.weekday {
    text-align:left;
    padding:4px 8px 8px
}
.week-head {
    text-align:center
}
.day {
    height:83px;
    min-height:83px;
    display:flex;
    flex-direction:column;
    gap:3px;
    border:0;
    background:var(--bg);
    border-radius:6px;
    padding:8px;
    overflow:hidden
}
.day-empty {
    background:transparent;
    pointer-events:none
}
.day .number {
    font-size:12px;
    color:var(--muted)
}
.day .amount {
    font-size:12px;
    font-weight:700;
    margin-top:1px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis
}
.day .small {
    font-size:11px;
    color:var(--muted)
}
.day.win {
    background:#dcefdc
}
.day.loss {
    background:#f8e0de
}
.day.even {
    background:#e8e8e8
}
.day.win .amount,.day.loss .amount,.day.even .amount {
    color:#252525
}
html[data-theme=dark] .day.win {
    background:#143c29
}
html[data-theme=dark] .day.loss {
    background:#442325
}
html[data-theme=dark] .day.even {
    background:#242424
}
html[data-theme=dark] .day.win .amount,html[data-theme=dark] .day.loss .amount,html[data-theme=dark] .day.even .amount {
    color:#f5f5f5
}
.week-total {
    height:83px;
    background:var(--bg);
    border-radius:6px;
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    justify-content:center;
    padding:8px;
    gap:3px;
    font-size:12px;
    white-space:nowrap
}
.week-total span {
    font-size:11px;
    color:var(--muted)
}
.calendar-footer {
    display:flex;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
    color:var(--muted);
    padding:13px 3px 0;
    font-size:13px
}
.calendar-footer strong {
    font-weight:700
}
.selected-day {
    margin:18px 0
}
.recent-trades {
    margin-top:18px
}
/* Uniform trade status labels */
.result {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:62px;
    padding:3px 10px;
    border:1px solid transparent;
    border-radius:5px;
    font-size:12px;
    font-weight:650;
    line-height:1.5
}
.result.long,.result.open {
    color:#2787ec;
    background:rgba(39,135,236,.11);
    border-color:rgba(39,135,236,.28)
}
.result.short,.result.loss {
    color:#e45360;
    background:rgba(228,83,96,.11);
    border-color:rgba(228,83,96,.28)
}
.result.win {
    color:#20a75c;
    background:rgba(32,167,92,.11);
    border-color:rgba(32,167,92,.28)
}
.result.breakeven {
    color:var(--muted);
    background:var(--soft);
    border-color:var(--border)
}
.settings-appearance {
    display:grid;
    align-content:start;
    gap:15px
}
.settings-appearance hr {
    width:100%;
    border:0;
    border-top:1px solid var(--border);
    margin:5px 0
}
.accent-row {
    display:flex;
    align-items:center;
    gap:12px
}
.accent-row input[type=color] {
    width:65px;
    height:42px;
    padding:3px;
    cursor:pointer
}
.settings-appearance textarea {
    min-height:82px
}
.settings-appearance .field button {
    justify-self:start
}
@media(max-width:680px) {
    .metrics-ref .panel {
        min-height:130px;
        padding:14px
    }
    .metrics-ref .metric-label {
        font-size:10px;
        letter-spacing:.05em
    }
    .metrics-ref .metric-value {
        font-size:21px
    }
    .calendar-panel {
        padding:12px
    }
    .calendar-footer {
        font-size:12px
    }
}
/* Refined dashboard and trade grid */
.metrics-ref .metric-label {
    font-size:13px;
    letter-spacing:0;
    text-transform:none;
    font-weight:600;
    color:var(--muted);
    margin-bottom:14px
}
.metrics-ref .metric-label span {
    display:none
}
.dashboard-grid .chart svg {
    overflow:visible
}
.results-chart {
    height:250px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:10px 16px
}
.results-bars {
    width:100%;
    height:205px;
    display:flex;
    align-items:end;
    justify-content:space-around;
    gap:24px
}
.results-bar-col {
    flex:1;
    min-width:0;
    display:flex;
    align-items:center;
    flex-direction:column;
    gap:7px;
    font-size:12px;
    color:var(--muted)
}
.results-bar-col strong {
    color:var(--text);
    font-size:17px
}
.results-bar-track {
    height:145px;
    width:min(100%,72px);
    display:flex;
    align-items:end;
    background:var(--bg);
    border-radius:5px;
    overflow:hidden
}
.results-bar {
    width:100%;
    border-radius:4px 4px 0 0
}
.tablewrap table {
    table-layout:auto;
    min-width:790px
}
.tablewrap th,.tablewrap td {
    text-align:center;
    vertical-align:middle;
    padding:13px 12px
}
.tablewrap th:first-child,.tablewrap td:first-child {
    text-align:left;
    padding-left:20px
}
.tablewrap th:nth-child(2),.tablewrap td:nth-child(2) {
    text-align:left
}
.tablewrap th:last-child,.tablewrap td:last-child {
    text-align:right;
    padding-right:20px
}
.instrument {
    display:inline-flex;
    align-items:center;
    gap:10px;
    white-space:nowrap
}
.asset-icon {
    position:relative;
    display:inline-grid;
    place-items:center;
    flex:0 0 25px;
    width:25px;
    height:25px;
    border-radius:50%;
    overflow:hidden;
    background:var(--soft);
    border:1px solid var(--border)
}
.asset-icon img {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
    background:var(--surface)
}
.asset-fallback {
    font-size:9px;
    font-weight:750;
    color:var(--muted)
}
/* Instrument logos, per-instrument P&L and individual screenshot controls */
.asset-pair {
    display:inline-flex;
    align-items:center;
    width:29px;
    min-width:29px;
    height:25px
}
.asset-pair img {
    width:19px;
    height:19px;
    border-radius:50%;
    object-fit:cover;
    border:1px solid var(--surface)
}
.asset-pair img+img {
    margin-left:-8px
}
.instrument-chart {
    display:grid;
    gap:18px;
    padding:18px 0 5px;
    min-height:230px;
    align-content:center
}
.instrument-chart-row {
    display:grid;
    grid-template-columns:78px minmax(0,1fr) 105px;
    gap:12px;
    align-items:center;
    font-size:12px
}
.instrument-chart-row>span {
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis
}
.instrument-chart-row strong {
    text-align:right;
    font-size:12px
}
.instrument-chart-track {
    height:10px;
    background:var(--soft);
    border-radius:5px;
    overflow:hidden
}
.instrument-chart-fill {
    height:100%;
    background:var(--green);
    border-radius:5px
}
.instrument-chart-fill.is-loss {
    background:var(--red)
}
.screenshot-list {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(115px,1fr));
    gap:12px;
    margin-top:8px
}
.screenshot-item {
    position:relative;
    border:1px solid var(--border);
    border-radius:8px;
    overflow:hidden;
    aspect-ratio:4/3
}
.screenshot-item img {
    width:100%;
    height:100%;
    object-fit:cover
}
.screenshot-remove {
    position:absolute;
    top:6px;
    right:6px;
    display:grid;
    place-items:center;
    width:24px;
    height:24px;
    padding:0;
    border:1px solid #d1d5db;
    border-radius:5px;
    background:#fff;
    color:#374151;
    font:400 18px/1 Arial,sans-serif;
    cursor:pointer;
    box-shadow:0 1px 3px #0002
}
.screenshot-remove:hover {
    background:#f3f4f6;
    color:#111827
}
.screenshot-remove:focus-visible {
    outline:2px solid var(--accent,#2563eb);
    outline-offset:2px
}
/* Performance radar and cumulative P&L hover targets */
.radar-wrap {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-height:350px
}
.radar-wrap svg {
    width:min(100%,490px);
    max-height:420px
}
.radar-caption {
    font-size:11px;
    color:var(--muted);
    text-align:center;
    margin-top:-2px
}
.curve-hit {
    cursor:crosshair
}
.curve-hit:hover,.curve-hit:focus {
    fill:var(--accent);
    fill-opacity:.55;
    stroke:var(--surface);
    stroke-width:2;
    outline:none
}
/* Open status follows the selected accent colour, not the fixed blue direction colour. */
.result.open {
    color:var(--accent);
    background:color-mix(in srgb,var(--accent) 12%,transparent);
    border-color:color-mix(in srgb,var(--accent) 32%,transparent)
}
/* Trading account details and responsive standard layout */
.gauge:before {
    background:conic-gradient(from 270deg,var(--accent) 0 calc(var(--pct)*.5%),var(--border) calc(var(--pct)*.5%) 50%,transparent 50% 100%)
}
.account-list {
    display:grid;
    gap:13px;
    margin-top:16px
}
.account-card {
    border:1px solid var(--border);
    border-radius:9px;
    padding:17px;
    min-width:0
}
.account-card-head,.account-foot {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px
}
.account-card-head strong {
    font-size:15px
}
.account-card-head .muted {
    margin-top:3px
}
.account-figures {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px 12px;
    padding:18px 0;
    margin:15px 0;
    border-top:1px solid var(--border);
    border-bottom:1px solid var(--border)
}
.account-figures>div {
    min-width:0
}
.account-figures span {
    display:block;
    color:var(--muted);
    font-size:11px;
    margin-bottom:6px
}
.account-figures strong {
    font-size:14px;
    overflow-wrap:anywhere
}
.account-foot .muted {
    line-height:1.4
}
.flow-history {
    grid-column:1/-1;
    margin-top:16px;
    border-top:1px solid var(--border);
    padding-top:15px
}
.flow-history h4 {
    margin:0 0 10px
}
.flow-row {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    padding:10px 0;
    border-bottom:1px solid var(--border)
}
.flow-row strong {
    font-size:13px
}
@media(max-width:1100px) {
    .account-figures {
        grid-template-columns:repeat(2,minmax(0,1fr))
    }
}
@media(max-width:680px) {
    .topbar {
        gap:12px
    }
    .header-right,.nav {
        min-width:0
    }
    .nav {
        scrollbar-width:thin
    }
    .nav button {
        flex:0 0 auto
    }
    .content {
        padding:18px 12px 35px
    }
    .metrics {
        grid-template-columns:repeat(2,minmax(0,1fr))
    }
    .metrics-ref .panel {
        min-width:0;
        padding:13px
    }
    .dashboard-grid,.settings-grid {
        grid-template-columns:minmax(0,1fr)
    }
    .account-card {
        padding:13px
    }
    .account-figures {
        gap:13px 9px
    }
    .account-figures strong {
        font-size:13px
    }
    .account-foot {
        align-items:flex-start;
        flex-direction:column
    }
    .account-foot .btn {
        width:100%
    }
    .calendar-panel {
        overflow-x:auto
    }
    .calendar-grid {
        min-width:0
    }
    .tablewrap {
        max-width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch
    }
    .dialog {
        width:calc(100% - 16px);
        max-height:94dvh
    }
    .dialog-body {
        padding:15px;
        max-height:70dvh
    }
    .dialog-head,.dialog-foot {
        padding:14px;
        flex-wrap:wrap
    }
    .dialog-foot .btn {
        flex:1
    }
    .pagehead h2 {
        font-size:21px
    }
    .toolbar {
        gap:8px
    }
    .toolbar input {
        max-width:100%;
        flex:1 1 160px
    }
    .footer {
        line-height:1.6
    }
}
@media(max-width:380px) {
    .metrics {
        grid-template-columns:minmax(0,1fr)
    }
    .account-figures {
        grid-template-columns:repeat(2,minmax(0,1fr))
    }
}
/* Settings: accounts full-width above two equal lower panels */
.settings-stack {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:20px
}
.settings-lower {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:20px;
    align-items:stretch
}
.settings-lower>.panel {
    min-width:0
}
.settings-data {
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:18px
}
.settings-data .toolbar {
    display:flex;
    flex-wrap:wrap;
    gap:10px
}
.settings-data .danger {
    margin-top:auto
}
@media(max-width:760px) {
    .settings-lower {
        grid-template-columns:minmax(0,1fr);
        gap:16px
    }
    .settings-stack {
        gap:16px
    }
}
/* Standard footer links and Settings-only risk disclaimer */
.footer {
    align-items:center;
    flex-wrap:wrap;
    line-height:1.6
}
.footer a {
    color:inherit;
    text-decoration:none
}
.footer a:hover {
    text-decoration:underline;
    color:var(--accent)
}
.risk-disclaimer {
    margin-top:8px;
    padding-top:18px;
    border-top:1px solid var(--border);
    font-size:12px;
    line-height:1.7;
    color:var(--muted)
}
.risk-disclaimer strong {
    color:var(--text)
}
/* Mobile calendar: compact, consistently aligned arrow buttons */
.calendar-head {
    display:grid;
    grid-template-columns:40px minmax(0,1fr) 40px;
    align-items:center;
    gap:10px
}
.calendar-head h3 {
    text-align:center;
    min-width:0;
    margin:0
}
.calendar-head>.btn {
    width:40px;
    height:40px;
    min-width:0;
    padding:0;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
    line-height:1;
    border-radius:8px
}
@media(max-width:680px) {
    .calendar-head {
        grid-template-columns:34px minmax(0,1fr) 34px;
        gap:6px;
        margin-bottom:12px
    }
    .calendar-head>.btn {
        width:34px;
        height:34px;
        font-size:17px
    }
    .calendar-head h3 {
        font-size:15px
    }
    .footer {
        display:flex;
        flex-direction:column;
        align-items:flex-start;
        gap:5px
    }
}
/* Final layout polish: centred footer and balanced mobile headings/navigation. */
.footer {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    gap:4px;
    width:100%
}
.footer span {
    display:block;
    max-width:100%;
    overflow-wrap:anywhere
}
@media(max-width:680px) {
    .footer {
        align-items:center;
        justify-content:center;
        text-align:center;
        gap:7px;
        margin-top:30px;
        padding:18px 8px 0
    }
    .topbar {
        align-items:center;
        text-align:center;
        gap:12px
    }
    .brand {
        align-self:center
    }
    .header-right {
        align-items:center;
        width:100%;
        gap:12px
    }
    .nav {
        display:flex;
        justify-content:center;
        align-items:center;
        flex-wrap:wrap;
        overflow:visible;
        width:100%;
        gap:5px
    }
    .nav button {
        width:auto;
        flex:0 0 auto;
        min-height:40px;
        padding:9px 12px;
        text-align:center;
        justify-content:center;
        white-space:nowrap
    }
    .top-actions {
        width:100%;
        justify-content:center;
        flex-wrap:wrap;
        gap:8px
    }
    .pagehead {
        justify-content:center;
        text-align:center;
        gap:12px
    }
    .pagehead>div:first-child {
        min-width:0
    }
    .pagehead h2 {
        margin-left:auto;
        margin-right:auto
    }
    .pagehead .dashboard-quote,.pagehead .muted {
        margin-left:auto;
        margin-right:auto
    }
    .pagehead:has(>div:nth-child(2)) {
        justify-content:space-between;
        text-align:left
    }
    .pagehead:has(>div:nth-child(2)) h2,.pagehead:has(>div:nth-child(2)) .muted {
        margin-left:0;
        margin-right:0
    }
    .panel-head h3 {
        line-height:1.4
    }
    .calendar-head h3 {
        text-align:center
    }
    .settings-lower>.panel>h3 {
        text-align:center
    }
    .settings-stack>.panel>.panel-head {
        flex-wrap:wrap
    }
    .account-card-head {
        align-items:center
    }
}
@media(max-width:390px) {
    .nav {
        gap:3px
    }
    .nav button {
        padding:8px 9px;
        font-size:12px
    }
    .pagehead:has(>div:nth-child(2)) {
        flex-direction:column;
        align-items:center;
        text-align:center
    }
    .pagehead:has(>div:nth-child(2)) h2,.pagehead:has(>div:nth-child(2)) .muted {
        margin-left:auto;
        margin-right:auto
    }
}
/* Mobile alignment: trade-history heading/actions and data management */
.risk-disclaimer {
    text-align:justify;
    text-justify:inter-word;
    hyphens:auto;
    overflow-wrap:break-word
}
@media(max-width:680px) {
    .pagehead:has([data-action="import"]):has([data-action="export"]) {
        display:flex;
        flex-direction:column;
        align-items:center;
        justify-content:center;
        text-align:center;
        gap:14px
    }
    .pagehead:has([data-action="import"]):has([data-action="export"])>div {
        width:100%;
        text-align:center
    }
    .pagehead:has([data-action="import"]):has([data-action="export"])>div:last-child {
        display:flex;
        align-items:center;
        justify-content:center;
        flex-wrap:wrap;
        gap:8px
    }
    .pagehead:has([data-action="import"]):has([data-action="export"])>div:last-child .btn {
        margin:0
    }
    .settings-data>p.muted {
        text-align:center;
        margin-left:auto;
        margin-right:auto
    }
    .settings-data>.toolbar {
        display:flex;
        justify-content:center;
        align-items:center;
        flex-wrap:wrap;
        gap:10px
    }
    .settings-data>.danger {
        display:block;
        width:100%;
        text-align:center
    }
}
/* Brand mark and content-aligned desktop header */
.brand {
    display:inline-flex;
    align-items:center;
    gap:0;
    font-size:24px;
    font-weight:750;
    letter-spacing:-.7px;
    line-height:1;
    white-space:nowrap
}
.brand-icon {
    display:block;
    width:32px;
    height:38px;
    object-fit:contain;
    flex:none;
    margin-right:1px
}
@media(min-width:1001px) {
    .topbar {
        padding-left:max(36px,calc((100vw - 1278px)/2));
        padding-right:max(36px,calc((100vw - 1278px)/2))
    }
}
@media(max-width:680px) {
    .brand {
        font-size:23px
    }
    .brand-icon {
        width:30px;
        height:35px
    }
}
/* Consistent wordmark on sign-in, sign-up and password reset */
.auth-brand {
    display:inline-flex;
    align-items:center;
    justify-content:flex-start;
    gap:0;
    padding:0;
    margin:0 0 12px;
    font-size:27px;
    font-weight:750;
    letter-spacing:-.7px;
    line-height:1
}
.auth-brand .brand-icon {
    width:37px;
    height:44px;
    object-fit:contain;
    flex:none;
    margin-right:1px
}
@media(max-width:680px) {
    .auth-brand {
        font-size:25px
    }
    .auth-brand .brand-icon {
        width:34px;
        height:40px
    }
}
/* Auth inputs must remain accessible and interactive. */
.auth-card {
    position:relative;
    isolation:isolate
}
.auth-card form,.auth-card .field,.auth-card input {
    position:relative;
    z-index:1
}
.auth-card input {
    pointer-events:auto;
    user-select:text;
    -webkit-user-select:text;
    touch-action:manipulation
}
.auth-card input:focus {
    outline:2px solid var(--accent);
    outline-offset:1px
}
/* Authentication links: consistent spacing and alignment. */
.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.auth-links .auth-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 6px 0;
    text-align: center;
    white-space: nowrap;
}
@media (max-width: 380px) {
    .auth-links {
        justify-content: center;
        column-gap: 20px;
    }
}

/* Trade history: stable column widths, consistent alignment and compact logos. */
.trades-table { width:100%; min-width:850px; table-layout:fixed; border-collapse:collapse; }
.trades-table .col-date { width:13%; }
.trades-table .col-instrument { width:23%; }
.trades-table .col-direction { width:12%; }
.trades-table .col-account { width:19%; }
.trades-table .col-size { width:9%; }
.trades-table .col-result { width:11%; }
.trades-table .col-pnl { width:13%; }
.trades-table th,.trades-table td { vertical-align:middle; padding:13px 12px; }
.trades-table th:nth-child(n+3):nth-child(-n+6),
.trades-table td:nth-child(n+3):nth-child(-n+6) { text-align:center; }
.trades-table th:last-child,.trades-table td:last-child { text-align:right; }
.trades-table .instrument { display:flex; min-width:0; gap:9px; align-items:center; }
.trades-table .instrument strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.trades-table .asset-icon { flex-shrink:0; }
.trades-table .asset-pair { flex-shrink:0; }
.asset-pair img { display:block; flex-shrink:0; }
@media(max-width:700px) {
    .trades-table { min-width:780px; }
    .trades-table th,.trades-table td { padding:11px 9px; }
}

/* Compact performance insights and trade review additions */
.daily-pnl-panel { margin-bottom: 16px; }
.daily-pnl-chart { position: relative; height: 175px; display: flex; align-items: stretch; gap: 3px; padding: 0 8px; }
.daily-pnl-baseline { position: absolute; top: 48%; left: 8px; right: 8px; height: 1px; background: var(--border); pointer-events: none; }
.daily-pnl-item { position: relative; flex: 1 1 0; min-width: 3px; }
.daily-pnl-bar { position: absolute; left: 10%; width: 80%; border-radius: 2px; min-height: 2px; }
.daily-pnl-item:hover .daily-pnl-bar { filter: brightness(1.25); }
.trade-summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.trade-summary-item { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; }
.trade-summary-item span { color: var(--muted); font-size: 12px; }
.trade-summary-item strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.review-checkbox { display: flex; gap: 10px; align-items: center; }
.review-checkbox input { width: auto; height: auto; }
@media (max-width: 680px) { .trade-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .trade-summary-item { padding: 12px; } }

/* Dashboard performance insights */
.dashboard-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dashboard-insights > .daily-pnl-panel { grid-column: 1 / -1; margin-bottom: 0; }
.insight-panel { min-width: 0; }
.insight-bars { height: 175px; display: flex; align-items: stretch; gap: 2px; border-top: 1px solid var(--border); margin: 18px 0 12px; }
.insight-bar-slot { flex: 1; position: relative; min-width: 1px; }
.insight-bar { position: absolute; top: 0; left: 12%; width: 76%; background: var(--red); opacity: .85; }
.insight-line { height: 175px; margin: 16px 0 12px; }
.insight-line svg { display: block; width: 100%; height: 100%; overflow: visible; }
.insight-panel > p { margin-top: 12px; }
@media (max-width: 720px) { .dashboard-insights { grid-template-columns: minmax(0, 1fr); } .dashboard-insights > .daily-pnl-panel { grid-column: auto; } }

/* Dashboard comparison charts */
.comparison-description { margin: 4px 0 16px; }
.comparison-chart { display: grid; gap: 12px; min-height: 180px; align-content: start; }
.comparison-row { display: grid; grid-template-columns: minmax(55px, 85px) minmax(0, 1fr) minmax(75px, 110px); gap: 10px; align-items: center; font-size: 12px; }
.comparison-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.comparison-track { position: relative; height: 18px; border-radius: 3px; background: var(--surface, transparent); }
.comparison-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .6; }
.comparison-bar { position: absolute; top: 3px; height: 12px; min-width: 0; border-radius: 2px; }
.comparison-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) { .comparison-row { grid-template-columns: 65px minmax(0, 1fr) 80px; gap: 6px; font-size: 11px; } }

/* Unified cumulative P&L and drawdown chart */
.cumulative-combined-chart { width: 100%; min-width: 0; }
.cumulative-combined-chart svg { display: block; width: 100%; height: auto; min-height: 260px; }
.cumulative-combined-chart .curve-hit:focus { outline: none; stroke: var(--accent); stroke-width: 1; }

/* Destructive account controls stay aligned and wrap cleanly on mobile. */
.account-danger-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.account-danger-actions .btn { width: 100%; min-width: 0; white-space: normal; text-align: center; }
@media (max-width: 520px) { .account-danger-actions { grid-template-columns: 1fr; } }
.cumulative-combined-chart svg { min-height: 0; }

/* Cumulative P&L: clean baseline, one hover marker and a compact value tooltip. */
.cumulative-combined-chart { position: relative; }
.cumulative-hover-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.cumulative-hover-tooltip {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 12px));
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.cumulative-hover-tooltip[hidden] { display: none; }

/* Compact dashboard performance cards and calendar/activity layout */
.metrics-compact .panel { position: relative; min-height: 136px; padding: 16px 18px; overflow: hidden; }
.metrics-compact .metric-label { margin-bottom: 10px; font-size: 12px; letter-spacing: 0; font-weight: 500; }
.metrics-compact .metric-value { font-size: 23px; }
.metrics-compact .gauge:before { background: conic-gradient(from 270deg, var(--accent) 0 calc(var(--pct)*.5%), var(--border) calc(var(--pct)*.5%) 50%, transparent 50% 100%); }
.metrics-compact .ratio-bar { height: 6px; margin-top: 9px; }
.metrics-compact .ratio-bar span { background: var(--green); }
.metrics-compact .mini-ring { position: absolute; right: 18px; top: 49px; width: 37px; height: 37px; border-radius: 50%; background: conic-gradient(var(--accent) 0 calc(var(--ring)*1%), var(--green) calc(var(--ring)*1%) 80%, var(--border) 80% 100%); }
.metrics-compact .mini-ring::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.metrics-compact .metric-mini-line { height: 3px; width: 42%; margin-top: 12px; border-radius: 3px; background: var(--accent); }
.dashboard-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(260px, 1fr); gap: 18px; align-items: stretch; }
.dashboard-bottom-grid .dashboard-calendar { min-width: 0; margin: 0; }
.dashboard-bottom-grid .recent-trades { margin: 0; min-width: 0; }
.recent-list { display: flex; flex-direction: column; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.recent-row:last-child { border-bottom: 0; }
.recent-instrument { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { color: var(--muted); }
.recent-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trade-summary-item small { font-size: 10px; line-height: 1.35; }
@media (max-width: 1050px) { .dashboard-bottom-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .metrics-compact .panel { min-height: 126px; padding: 13px; } .metrics-compact .metric-value { font-size: 20px; } .recent-row { grid-template-columns: minmax(0, 1fr) auto; } .recent-date { display: none; } }

/* Compact average win/loss labels, aligned directly beneath the comparison bar. */
.metrics-compact .avg-win-loss-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    font-size: 11px;
    line-height: 1.5;
    white-space: normal;
}
.metrics-compact .avg-win-loss-detail .avg-caption {
    color: var(--muted);
}
.metrics-compact .avg-win-loss-detail .avg-separator {
    color: var(--muted);
    margin: 0 4px;
}

/* Calendar-first dashboard: balanced with a compact, fuller recent-trades list. */
@media (min-width: 1051px) {
    .dashboard-bottom-grid {
        grid-template-columns: minmax(0, 2.5fr) minmax(260px, 1fr);
        gap: 16px;
    }
}
.dashboard-bottom-grid .calendar-panel { min-width: 0; }
.dashboard-bottom-grid .recent-trades { padding: 18px; }
.dashboard-bottom-grid .recent-list { margin-top: 6px; }
.dashboard-bottom-grid .recent-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 11px 0;
    font-size: 12px;
}
.dashboard-bottom-grid .recent-instrument {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}
.dashboard-bottom-grid .recent-symbol { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-bottom-grid .recent-date { display: none; }
.dashboard-bottom-grid .recent-instrument .asset-icon,
.dashboard-bottom-grid .recent-instrument .asset-pair { flex: 0 0 auto; }
.dashboard-bottom-grid .recent-open { color: var(--accent); }
.dashboard-calendar .selected-day {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.dashboard-calendar .selected-day .trade-table-wrap { max-width: 100%; overflow-x: auto; }
@media (max-width: 1050px) {
    .dashboard-bottom-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Reference-inspired compact dashboard cards: scoped to the four dashboard metrics. */
.metrics-reference .panel { min-height: 122px; padding: 15px 17px; }
.metrics-reference .metric-label { font-size: 11px; margin-bottom: 8px; color: var(--muted); }
.metrics-reference .metric-value { font-size: clamp(21px, 1.7vw, 27px); font-weight: 750; line-height: 1.2; }
.metrics-reference .metric-sub { font-size: 11px; margin-top: 5px; }
.metrics-reference .metric-week-change { display: inline-block; border-radius: 12px; padding: 3px 7px; font-size: 10px; margin-top: 6px; background: color-mix(in srgb, currentColor 12%, transparent); }
.metrics-reference .compact-win-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; }
.metrics-reference .compact-win-value { font-size: clamp(17px, 1.5vw, 24px); font-variant-numeric: tabular-nums; }
.metrics-reference .compact-win-gauge { --gauge-color: var(--accent); position: relative; width: 67px; height: 36px; flex: 0 0 67px; overflow: hidden; }
.metrics-reference .compact-win-gauge::before { content: ''; position: absolute; width: 62px; height: 62px; top: 2px; left: 2px; border-radius: 50%; background: conic-gradient(from 270deg, var(--gauge-color) 0 calc(var(--pct) * .5%), var(--border) calc(var(--pct) * .5%) 50%, transparent 50%); transform: rotate(0deg); }
.metrics-reference .compact-win-gauge::after { content: ''; position: absolute; width: 48px; height: 48px; top: 9px; left: 9px; border-radius: 50%; background: var(--surface); }
.metrics-reference .compact-win-gauge-value { position: absolute; bottom: 0; left: 0; width: 100%; z-index: 1; text-align: center; font-size: 10px; font-weight: 700; }
.metrics-reference .compact-win-counts { display: flex; flex-direction: column; font-size: 10px; white-space: nowrap; gap: 2px; }
.metrics-reference .compact-profit-ring { position: absolute; right: 16px; top: 47px; width: 38px; height: 38px; border-radius: 50%; background: conic-gradient(var(--green) 0 calc(var(--ring) * 1%), var(--accent) calc(var(--ring) * 1%) 100%); }
.metrics-reference .compact-profit-ring::after { content: ''; position: absolute; inset: 6px; background: var(--surface); border-radius: 50%; }
.metrics-reference .ratio-bar { margin-top: 9px; }
.metrics-reference .avg-win-loss-detail { justify-content: flex-start; gap: 7px; flex-wrap: wrap; }
.metrics-reference .avg-win-loss-detail .avg-caption { color: var(--muted); }
@media (max-width: 600px) { .metrics-reference .panel { min-height: 118px; padding: 12px; } .metrics-reference .compact-win-gauge { width: 57px; flex-basis: 57px; transform: scale(.85); transform-origin: center; } .metrics-reference .compact-win-row { gap: 3px; } .metrics-reference .compact-win-counts { font-size: 9px; } }

/* Keep weekly totals centred within the final calendar column. */
.calgrid .week-total {
    width: 100%;
    height: 100%;
    min-height: 83px;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
    box-sizing: border-box;
    gap: 4px;
}
.calgrid .week-total strong,
.calgrid .week-total span {
    display: block;
    max-width: 100%;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* Match the compact reference cards while keeping amounts legible. */
.metrics-reference .metric-week-change {
    width: fit-content;
    font-variant-numeric: tabular-nums;
}
.metrics-reference .avg-win-loss-detail {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    font-size: 10px;
    line-height: 1.5;
}
.metrics-reference .avg-win-loss-detail .avg-caption { color: var(--muted); }
.metrics-reference .avg-win-loss-detail .avg-separator { color: var(--muted); padding: 0 2px; }
@media (max-width: 650px) {
    .calgrid .week-total { min-height: 88px; }
    .metrics-reference .avg-win-loss-detail { font-size: 10px; }
}


/* Trade Win %: reference-inspired, compact segmented half-gauge. */
.metrics-reference .win-reference-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}
.metrics-reference .win-reference-value {
    font-size: clamp(21px, 2vw, 29px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.metrics-reference .win-reference-right {
    width: 116px;
    flex: 0 0 116px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.metrics-reference .win-reference-arc {
    display: block;
    width: 114px;
    height: 64px;
    overflow: visible;
}
.metrics-reference .win-reference-counts {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 3px;
    margin-top: -3px;
}
.metrics-reference .win-reference-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 999px;
    white-space: nowrap;
}
.metrics-reference .win-reference-wins {
    color: var(--green);
    background: color-mix(in srgb, var(--green) 12%, transparent);
}
.metrics-reference .win-reference-even {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.metrics-reference .win-reference-losses {
    color: var(--red);
    background: color-mix(in srgb, var(--red) 12%, transparent);
}
@media (max-width: 520px) {
    .metrics-reference .win-reference-layout { gap: 6px; }
    .metrics-reference .win-reference-right { width: 99px; flex-basis: 99px; }
    .metrics-reference .win-reference-arc { width: 99px; height: 56px; }
    .metrics-reference .win-reference-pill { font-size: 9px; padding: 2px 3px; }
}

/* Full-width dashboard calendar and evenly distributed trade summary. */
.dashboard-calendar-full { width: 100%; min-width: 0; }
.dashboard-calendar-full .calendar-panel { width: 100%; }
.trade-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trade-toolbar-sum { font-weight: 600; margin-left: 6px; }
@media (max-width: 680px) { .trade-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 460px) { .trade-summary-grid { grid-template-columns: 1fr; } }

/* Three equal-width dashboard performance cards. */
.metrics.metrics-reference {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 760px) {
    .metrics.metrics-reference {
        grid-template-columns: 1fr;
    }
}


/* Consistent typography and spacing for the primary dashboard metrics. */
.metrics.metrics-reference .panel {
    min-width: 0;
    padding: 20px;
}
.metrics.metrics-reference .metric-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.4;
    margin-bottom: 14px;
}
.metrics.metrics-reference .metric-value,
.metrics.metrics-reference .win-reference-value {
    font-size: clamp(24px, 2vw, 30px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}
.metrics.metrics-reference .metric-sub,
.metrics.metrics-reference .avg-win-loss-detail {
    font-size: 12px;
    line-height: 1.5;
}
.metrics.metrics-reference .win-reference-layout {
    min-height: 52px;
}
/* Native month/year selectors permit direct navigation without repeated clicks. */
.calendar-head.calendar-picker {
    display: flex;
    align-items: end;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.calendar-picker-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
.calendar-picker-field select {
    min-width: 145px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}
.calendar-picker-field:has(#calendar-year) select { min-width: 100px; }
.calendar-today { height: 40px; }
@media (max-width: 680px) {
    .calendar-head.calendar-picker { gap: 8px; }
    .calendar-picker-field select { min-width: 120px; }
    .calendar-picker-field:has(#calendar-year) select { min-width: 90px; }
    .metrics.metrics-reference .panel { padding: 16px; }
}

/* Calendar controls: balanced, left-aligned, consistent sizing. */
.calendar-head.calendar-picker {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 10px;
    margin-bottom: 22px;
    width: 100%;
}
.calendar-picker-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.calendar-picker-field select,
.calendar-picker-field:has(#calendar-year) select {
    display: block;
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 34px 0 13px;
    font-size: 14px;
    font-weight: 600;
    line-height: normal;
}
.calendar-picker-field:has(#calendar-month) { width: 180px; }
.calendar-picker-field:has(#calendar-year) { width: 116px; }
.calendar-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    min-width: 82px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}
@media (max-width: 480px) {
    .calendar-head.calendar-picker { gap: 10px; }
    .calendar-picker-field:has(#calendar-month) { width: min(45%, 180px); }
    .calendar-picker-field:has(#calendar-year) { width: min(29%, 116px); }
    .calendar-today { min-width: 76px; }
}

/* Centred month and year selectors, without visible labels or Today button. */
.calendar-head.calendar-picker {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 22px;
}
.calendar-picker-field {
    margin: 0;
}
.calendar-picker-field:has(#calendar-month) {
    width: min(180px, 55%);
}
.calendar-picker-field:has(#calendar-year) {
    width: min(116px, 38%);
}
@media (max-width: 480px) {
    .calendar-head.calendar-picker {
        gap: 10px;
    }
}

/* Trade detail view and read-only calculated fields */
.trade-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.trade-detail-cell { display:flex; flex-direction:column; gap:3px; min-width:0; overflow-wrap:anywhere; }
.trade-detail-cell strong { font-size:14px; font-weight:650; }
.trade-detail-notes { margin-top:22px; white-space:pre-wrap; overflow-wrap:anywhere; }
.trade-detail-shots { display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.trade-detail-image { width:110px; height:90px; object-fit:cover; border-radius:7px; border:1px solid var(--border); }
.trade-auto-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:13px; border:1px solid var(--border); border-radius:8px; }
.trade-auto-summary > div { display:flex; flex-direction:column; min-width:0; gap:4px; }
.trade-auto-summary span { font-size:12px; color:var(--muted); }
.trade-auto-summary strong { font-size:13px; overflow-wrap:anywhere; }
@media (max-width:600px) { .trade-auto-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Compact estimated balance, positioned immediately before dashboard navigation. */
.header-balance { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.header-balance.positive { color: #16a34a; }
.header-balance.negative { color: #ef4444; }
.header-right { gap: 14px; }
@media (max-width: 680px) { .header-balance { font-size: 13px; } .header-right { gap: 8px; } }

/* Current account balance beside the Trades result count. */
.trade-toolbar-balance {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Clearer gain/loss colours and authentic-looking instrument presentation. */
:root {
    --green: #138a45;
    --red: #d93b45;
}
html[data-theme="dark"] {
    --green: #27d765;
    --red: #ff5968;
}
.asset-icon {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}
.asset-icon img {
    object-fit: contain;
    background: transparent;
    padding: 2px;
}
.asset-fallback {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: -.25px;
}
.asset-pair {
    display: inline-flex;
    align-items: center;
    width: 32px;
    min-width: 32px;
    height: 27px;
}
.asset-flag {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    overflow: hidden;
    border-radius: 50%;
    border: 1.5px solid var(--surface);
    background: var(--soft);
}
.asset-flag + .asset-flag { margin-left: -11px; }
.asset-flag img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 50%;
    margin: 0;
}
.asset-flag-fallback {
    font-size: 8px;
    font-weight: 700;
    color: var(--muted);
}

/* Show the source SVG itself rather than wrapping it in an artificial gold badge. */
.instrument .asset-icon-native {
    border: 0;
    background: transparent;
    border-radius: 50%;
    overflow: hidden;
}
.instrument .asset-icon-native img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: contain;
    background: transparent;
}
.instrument .asset-icon-native .asset-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

/* Native logo presentation for all instrument categories. */
.asset-icon-native { position: relative; border: 0; background: transparent; }
.asset-icon-native img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 0; }
.asset-icon-native .asset-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; }

/* Calendar: compact, evenly aligned navigation for month and year. */
.calendar-head.calendar-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 20px;
}
.calendar-picker .calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.calendar-picker .calendar-nav-btn:hover {
    background: var(--soft);
}
.calendar-picker-field:has(#calendar-month) { width: 150px; }
.calendar-picker-field:has(#calendar-year) { width: 100px; }
.calendar-picker-field select { width: 100%; height: 38px; min-width: 0; }
@media (max-width: 480px) {
    .calendar-head.calendar-picker { gap: 5px; }
    .calendar-picker .calendar-nav-btn { flex-basis: 28px; width: 28px; height: 36px; font-size: 17px; }
    .calendar-picker-field:has(#calendar-month) { width: min(32vw, 135px); }
    .calendar-picker-field:has(#calendar-year) { width: min(22vw, 90px); }
    .calendar-picker-field select { height: 36px; padding-left: 8px; padding-right: 20px; font-size: 13px; }
}

/* Profile settings: balanced desktop grid and mobile stacking. */
.settings-profile .profile-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.settings-profile .profile-fields .field { min-width: 0; align-items: flex-start; }
.settings-profile .profile-value { width: 100%; overflow-wrap: anywhere; min-height: 24px; font-weight: 600; }
.settings-profile .profile-fields .btn { margin-top: 8px; }
.settings-profile > p { margin-top: 16px; }
@media (max-width: 700px) { .settings-profile .profile-fields { grid-template-columns: 1fr; gap: 14px; } }

/* Signed-in username immediately before the Dashboard navigation. */
.header-username { color: var(--accent, #2563eb); font-size: 14px; font-weight: 650; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .header-username { max-width: 115px; font-size: 12px; } }


/* Neutral dark palette: true black canvas, charcoal surfaces, no navy/purple tint.
   Keep --accent user-configurable in Settings. */
html[data-theme="dark"] {
    --bg: #000000;
    --surface: #111113;
    --text: #f1f1f3;
    --muted: #a4a4ad;
    --border: #2b2b30;
    --soft: #1c1c20;
    --green: #35d977;
    --red: #ff6570;
    color-scheme: dark;
}
html[data-theme="light"] {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --text: #1c1c20;
    --muted: #707079;
    --border: #dedee2;
    --soft: #f0f0f2;
    --green: #148e4c;
    --red: #d83f4c;
    color-scheme: light;
}
/* Calendar uses subdued profit/loss fills while keeping the numbers readable. */
html[data-theme="dark"] .day.win {
    background: #123523;
}
html[data-theme="dark"] .day.loss {
    background: #3c1d23;
}
html[data-theme="dark"] .day.even {
    background: #202024;
}
html[data-theme="dark"] .day.win .amount,
html[data-theme="dark"] .day.loss .amount,
html[data-theme="dark"] .day.even .amount {
    color: var(--text);
}
/* Preserve coloured data labels and a neutral default for buttons/cards. */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    color: var(--text);
}


/* Wider desktop workspace: remove excessive side gutters without browser zoom. */
@media (min-width: 1101px) {
    .content {
        width: 100%;
        max-width: 1760px;
        margin-inline: auto;
        padding: 28px clamp(24px, 2.4vw, 48px) 60px;
    }
    .topbar {
        padding-inline: max(clamp(24px, 2.4vw, 48px), calc((100vw - 1760px) / 2));
    }
}

/* Account selection lives in the Trades toolbar, not the global header. */
.toolbar #account-filter { min-width: 140px; max-width: 220px; flex: 0 1 190px; }
@media (max-width: 640px) {
    .toolbar #account-filter { min-width: 0; flex: 1 1 135px; max-width: none; }
}

/* Standard understated calendar arrow controls. */
.calendar-picker .calendar-nav-btn {
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: var(--muted);
    transition: background-color .15s ease, color .15s ease;
}
.calendar-picker .calendar-nav-btn span { display: block; line-height: 1; transform: translateY(-1px); }
.calendar-picker .calendar-nav-btn:hover { color: var(--text); }
.calendar-picker .calendar-nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Four compact dashboard KPI cards with legible secondary values. */
.metrics-dashboard-four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metrics-dashboard-four .panel { min-width: 0; min-height: 148px; padding: 17px 18px; }
.metrics-dashboard-four .metric-label { margin-bottom: 12px; letter-spacing: .04em; }
.metrics-dashboard-four .metric-value,
.metrics-dashboard-four .win-reference-value { font-weight: 750; font-size: clamp(22px, 1.9vw, 28px); line-height: 1.18; }
.metrics-dashboard-four .metric-sub { font-size: 11px; line-height: 1.4; }
.metrics-dashboard-four .metric-micro { font-size: 10px; margin-top: 6px; line-height: 1.4; }
.metrics-dashboard-four .ratio-bar { margin-top: 10px; }
@media (max-width: 1050px) { .metrics-dashboard-four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .metrics-dashboard-four { grid-template-columns: 1fr; } }

/* Four reference-style cards: one even row on desktop, responsive below. */
.metrics-dashboard-four {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.metrics-dashboard-four .panel {
    min-width: 0;
    min-height: 112px;
    padding: 13px 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.metrics-dashboard-four .metric-label {
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .01em;
}
.metrics-dashboard-four .metric-value,
.metrics-dashboard-four .win-reference-value {
    font-size: clamp(18px, 1.55vw, 23px);
    font-weight: 700;
    line-height: 1.2;
}
.metrics-dashboard-four .metric-sub {
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.35;
}
.metrics-dashboard-four .metric-week-change {
    margin-top: 5px;
    font-size: 10px;
}
.metrics-dashboard-four .win-reference-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
}
.metrics-dashboard-four .win-reference-right {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
}
.metrics-dashboard-four .win-reference-arc {
    width: 46px;
    height: 46px;
    display: block;
}
.metrics-dashboard-four .win-reference-counts { display: none; }
.metrics-dashboard-four .ratio-bar {
    margin-top: 7px;
    height: 7px;
}
@media (max-width: 900px) {
    .metrics-dashboard-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .metrics-dashboard-four { grid-template-columns: 1fr; }
}

/* Final dashboard layout fix.
   Earlier .metrics.metrics-reference (two classes) overrode the four-card
   rule (one class), leaving the fourth card on a second row. */
.metrics.metrics-reference.metrics-dashboard-four {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
    width: 100%;
}
.metrics.metrics-reference.metrics-dashboard-four > .panel {
    min-width: 0;
    width: 100%;
    min-height: 136px;
    padding: 17px 18px;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.metrics.metrics-reference.metrics-dashboard-four .metric-value,
.metrics.metrics-reference.metrics-dashboard-four .win-reference-value {
    font-size: clamp(21px, 1.65vw, 28px);
    font-weight: 750;
}
.metrics.metrics-reference.metrics-dashboard-four .metric-label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}
.dashboard-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}
.dashboard-grid > .panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.dashboard-grid .panel-head h3 { font-size: 15px; font-weight: 650; }
.dashboard-grid .radar-wrap { min-height: 350px; }
.dashboard-grid .radar-wrap svg { width: min(100%, 490px); }
html[data-theme="dark"] {
    --bg: #000000;
    --surface: #111111;
    --soft: #1c1c1c;
    --border: #303034;
    --text: #f4f4f5;
    --muted: #a6a6ad;
    --green: #35d977;
    --red: #ff6570;
    color-scheme: dark;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main { background: #000000; }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar { background: #111111; }
@media (max-width: 950px) {
    .metrics.metrics-reference.metrics-dashboard-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
    .metrics.metrics-reference.metrics-dashboard-four {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Compact comparison percentages on the existing four cards. */
.metrics-dashboard-four .metric-change { display: inline-block; vertical-align: baseline; margin-left: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.metrics-dashboard-four .metric-inline-change { min-height: 0; line-height: 1; }
.metrics-dashboard-four .metric-inline-change .metric-change { margin-left: 0; }

/* Uniform dashboard gutters: all four metrics, both charts and calendar. */
:root { --dashboard-card-gap: 14px; }
.metrics.metrics-reference.metrics-dashboard-four {
    column-gap: var(--dashboard-card-gap);
    row-gap: var(--dashboard-card-gap);
    margin-bottom: var(--dashboard-card-gap);
}
.dashboard-grid.dashboard-analytics {
    column-gap: var(--dashboard-card-gap);
    row-gap: var(--dashboard-card-gap);
    margin-bottom: var(--dashboard-card-gap);
}
.dashboard-calendar-full { margin-top: 0; }
.dashboard-grid.dashboard-analytics > .panel {
    box-sizing: border-box;
    min-width: 0;
    height: 100%;
}

/* Stronger, consistent profit/loss colours across both themes. */
html[data-theme="dark"] { --green: #00e676; --red: #ff4055; }
html[data-theme="light"] { --green: #009e49; --red: #e5223e; }
html[data-theme="dark"] .day.win { background: #07512e; }
html[data-theme="dark"] .day.loss { background: #631b2a; }
html[data-theme="light"] .day.win { background: #c5f5d9; }
html[data-theme="light"] .day.loss { background: #ffd0d7; }
.header-balance.positive { color: var(--green); }
.header-balance.negative { color: var(--red); }

/* Dashboard indicators: semicircular trade outcomes and circular profit factor. */
.metrics-dashboard-four .win-reference-right { width: 100px; height: auto; flex: 0 0 100px; }
.metrics-dashboard-four .win-reference-arc { width: 100px; height: 68px; display: block; }
.metrics-dashboard-four .win-gauge-counts { display: flex; justify-content: space-around; gap: 3px; margin-top: -12px; font-size: 10px; font-weight: 700; }
.metrics-dashboard-four .win-gauge-counts > span:nth-child(2) { color: var(--muted); }
@media (max-width: 600px) {
 .metrics-dashboard-four .win-reference-right { width: 85px; flex-basis: 85px; }
 .metrics-dashboard-four .win-reference-arc { width: 85px; height: 60px; }
 .metrics-dashboard-four .win-gauge-counts { font-size: 9px; }
}

/* Final dashboard: consistent gaps and reference-accurate win-rate gauge. */
.metrics.metrics-dashboard-four, .dashboard-grid.dashboard-analytics { gap: 14px !important; }
.metrics-dashboard-four .win-card { display: flex; flex-direction: column; justify-content: space-between; }
.metrics-dashboard-four .win-card .metric-label { margin-bottom: 6px; }
.metrics-dashboard-four .win-card .win-reference-layout { width: 100%; flex: 1; min-height: 75px; align-items: center; gap: 10px; }
.metrics-dashboard-four .win-card .win-reference-right { width: 116px; flex: 0 0 116px; height: auto; align-self: center; }
.metrics-dashboard-four .win-card .win-reference-arc { width: 116px; height: 77px; display: block; }
.metrics-dashboard-four .win-card .win-gauge-counts { display: flex; justify-content: space-between; gap: 5px; width: 100%; margin-top: -12px; font-size: 10px; font-weight: 700; }
.metrics-dashboard-four .win-gauge-counts span { border-radius: 999px; padding: 3px 5px; white-space: nowrap; }
.metrics-dashboard-four .win-gauge-counts .win-pill { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.metrics-dashboard-four .win-gauge-counts .even-pill { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.metrics-dashboard-four .win-gauge-counts .loss-pill { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
@media (max-width: 600px) { .metrics-dashboard-four .win-card .win-reference-right { width: 106px; flex-basis: 106px; } .metrics-dashboard-four .win-card .win-reference-arc { width: 106px; height: 72px; } }
/* Four dashboard cards: aligned headings and compact win/loss legend. */
.metrics.metrics-reference.metrics-dashboard-four > .panel { display:flex; flex-direction:column; justify-content:flex-start; }
.metrics.metrics-reference.metrics-dashboard-four .metric-label { height:24px; min-height:24px; display:flex; align-items:flex-start; margin:0 0 12px; padding:0; line-height:20px; }
.metrics.metrics-reference.metrics-dashboard-four .win-card .metric-label { margin-bottom:12px; flex:0 0 24px; }
.metrics-dashboard-four .win-gauge-counts .even-pill { color:var(--accent); background:color-mix(in srgb,var(--accent) 15%,transparent); }
.metrics-dashboard-four .win-gauge-counts > span:nth-child(2) { color:var(--accent); }
.metrics-dashboard-four .avg-win-loss-detail { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:11px; line-height:1.4; margin-top:5px; }
.metrics-dashboard-four .avg-win-loss-detail span { white-space:nowrap; }

/* Average Win / Loss: neutral labels, coloured figures. */
.metrics-dashboard-four .avg-win-loss-detail .avg-detail-label { color:var(--text); }