/* BellRun Markets styles, layered on Bootstrap 5.3. Colours, sizes and timings come from tokens.css, which loads
   first: there is no colour written out in this file, and both themes (data-bs-theme="dark" or "light") use the
   same rules. */

/* ---------- Base and type ---------- */
html { scroll-padding-top: calc(var(--header-height) + var(--space-2)); }
/* The header's own controls are inside that band and always in view: focusing one must not scroll the page. */
html:has(.topbar:focus-within) { scroll-padding-top: 0; }
html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
}
body {
    margin: 0;
    font-size: var(--type-base);
    line-height: var(--leading-body);
    font-variant-numeric: tabular-nums;
    overflow-wrap: break-word;
    accent-color: var(--action);
}
button, input, select, textarea { font-variant-numeric: inherit; }
::selection { background: var(--info-bg); color: var(--text); }

h1, .h1 { font-size: var(--type-3xl); font-weight: var(--weight-heavy); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2, .h2 { font-size: var(--type-2xl); font-weight: var(--weight-bold); }
h3, .h3 { font-size: var(--type-2xl); font-weight: var(--weight-bold); }
h4, .h4 { font-size: var(--type-xl); font-weight: var(--weight-bold); }
h5, .h5 { font-size: var(--type-lg); font-weight: var(--weight-bold); }
h6, .h6 { font-size: var(--type-base); font-weight: var(--weight-bold); }
.fs-4 { font-size: var(--type-2xl) !important; }
.fs-5 { font-size: var(--type-xl) !important; }
.fs-6 { font-size: var(--type-base) !important; }
small, .small { font-size: var(--type-md); }
code, kbd, samp { font-family: var(--font-mono); font-size: var(--type-md); overflow-wrap: anywhere; }
kbd { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }

.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--flat) !important; }
.muted { color: var(--muted); }
.strong { font-weight: var(--weight-bold); }
.small-caps { font-size: var(--type-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons ----------
   Each variant fills in Bootstrap's own button variables, so hover, pressed and switched-off states follow the theme.
   A switched-off button keeps readable text and gets a dashed edge, instead of fading out. */
.btn {
    --bs-btn-disabled-opacity: 1;
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--panel-2);
    --bs-btn-disabled-border-color: var(--control-line);
    --bs-btn-focus-box-shadow: none;
    --bs-btn-active-shadow: none;
    --bs-btn-box-shadow: none;
    max-width: 100%;
    transition: color var(--motion-fast), background-color var(--motion-fast), border-color var(--motion-fast);
}
.btn:disabled, .btn.disabled { border-style: dashed; }
.btn-lg { --bs-btn-font-size: var(--type-lg); }
.btn-sm { --bs-btn-font-size: var(--type-md); }
.btn-primary {
    --bs-btn-bg: var(--action);
    --bs-btn-border-color: var(--action);
    --bs-btn-color: var(--action-ink);
    --bs-btn-hover-bg: var(--action-hover);
    --bs-btn-hover-border-color: var(--action-hover);
    --bs-btn-hover-color: var(--action-ink);
    --bs-btn-active-bg: var(--action-active);
    --bs-btn-active-border-color: var(--action-active);
    --bs-btn-active-color: var(--action-ink);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--panel-2);
    --bs-btn-disabled-border-color: var(--control-line);
    font-weight: var(--weight-semibold);
}
.btn-buy, .btn-success {
    --bs-btn-bg: var(--buy);
    --bs-btn-border-color: var(--buy);
    --bs-btn-color: var(--buy-ink);
    --bs-btn-hover-bg: var(--buy-hover);
    --bs-btn-hover-border-color: var(--buy-hover);
    --bs-btn-hover-color: var(--buy-ink);
    --bs-btn-active-bg: var(--buy-active);
    --bs-btn-active-border-color: var(--buy-active);
    --bs-btn-active-color: var(--buy-ink);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--panel-2);
    --bs-btn-disabled-border-color: var(--control-line);
    font-weight: var(--weight-bold);
}
.btn-sell, .btn-danger {
    --bs-btn-bg: var(--sell);
    --bs-btn-border-color: var(--sell);
    --bs-btn-color: var(--sell-ink);
    --bs-btn-hover-bg: var(--sell-hover);
    --bs-btn-hover-border-color: var(--sell-hover);
    --bs-btn-hover-color: var(--sell-ink);
    --bs-btn-active-bg: var(--sell-active);
    --bs-btn-active-border-color: var(--sell-active);
    --bs-btn-active-color: var(--sell-ink);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--panel-2);
    --bs-btn-disabled-border-color: var(--control-line);
    font-weight: var(--weight-bold);
}
/* The second choice, in every Bootstrap spelling the pages use. Its edge can be seen on every surface. */
.btn-secondary, .btn-light, .btn-dark, .btn-info, .btn-warning,
.btn-outline-primary, .btn-outline-secondary, .btn-outline-light, .btn-outline-dark, .btn-outline-info, .btn-outline-warning, .btn-outline-success, .btn-outline-danger {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--control-line);
    --bs-btn-color: var(--text);
    --bs-btn-hover-bg: var(--info-bg);
    --bs-btn-hover-border-color: var(--link);
    --bs-btn-hover-color: var(--text);
    --bs-btn-active-bg: var(--info-bg);
    --bs-btn-active-border-color: var(--link);
    --bs-btn-active-color: var(--link);
    --bs-btn-disabled-color: var(--muted);
    --bs-btn-disabled-bg: var(--panel-2);
    --bs-btn-disabled-border-color: var(--control-line);
}
.btn-outline-danger { --bs-btn-color: var(--down); }
.btn-outline-success { --bs-btn-color: var(--up); }
.btn-link {
    --bs-btn-color: var(--link);
    --bs-btn-hover-color: var(--link-hover);
    --bs-btn-active-color: var(--link-hover);
    --bs-btn-disabled-color: var(--muted);
}

/* ---------- Other Bootstrap parts that carry colours of their own ---------- */
.dropdown-menu {
    --bs-dropdown-color: var(--text);
    --bs-dropdown-bg: var(--panel);
    --bs-dropdown-border-color: var(--line);
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--panel-2);
    --bs-dropdown-link-active-color: var(--action-ink);
    --bs-dropdown-link-active-bg: var(--action);
    --bs-dropdown-link-disabled-color: var(--muted);
    --bs-dropdown-header-color: var(--muted);
    --bs-dropdown-box-shadow: var(--shadow-2);
    --bs-dropdown-font-size: var(--type-md);
}
.nav-link:focus-visible { box-shadow: none; }
.nav-pills { --bs-nav-pills-link-active-color: var(--action-ink); --bs-nav-pills-link-active-bg: var(--action); }
.nav { --bs-nav-link-color: var(--link); --bs-nav-link-hover-color: var(--link-hover); --bs-nav-link-disabled-color: var(--muted); }
.alert { overflow-wrap: break-word; }
.alert > :last-child { margin-bottom: 0; }

/* ---------- Keyboard focus ----------
   One ring for everything a keyboard can reach: set off the control so it sits on the page background and stays
   visible around the green, red and blue buttons as well as the plain ones. It shows for keyboard focus only
   (:focus-visible), not for mouse clicks. The !important is deliberate: Bootstrap removes the outline on .btn,
   .form-control, .form-select, .form-check-input and .nav-link in favour of a faint glow. */
:where(a, button, input, select, textarea, summary, [tabindex], [role="button"], [role="tab"]):focus-visible,
.btn:focus-visible, .btn-check:focus-visible + .btn,
.form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible, .form-range:focus-visible,
.nav-link:focus-visible, .btn-close:focus-visible {
    outline: var(--focus-width) solid var(--focus) !important;
    outline-offset: var(--focus-offset);
}
/* Rows and cards that are links or click targets keep the ring inside their own edge so it isn't clipped. */
.index-card:focus-visible, .tape:focus-visible, .table tr.clickable:focus-visible, .mainnav a:focus-visible, .usermenu-panel a:focus-visible, .symbol-chip:focus-visible, .tabs button:focus-visible, .seg-sm button:focus-visible, .content:focus-visible {
    outline-offset: calc(-1 * var(--focus-width));
}
.visually-hidden-focusable:focus-visible { outline-offset: 0; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.skip-link { position: absolute; top: var(--space-2); left: var(--space-2); z-index: var(--z-skip); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: var(--action); color: var(--action-ink); font-weight: var(--weight-bold); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.skip-link:hover { color: var(--action-ink); }

.topbar {
    position: sticky; top: 0; z-index: var(--z-header);
    display: flex; align-items: center; gap: var(--space-2) var(--space-6);
    min-height: var(--header-height);
    padding: var(--space-2) var(--content-x); background: var(--header);
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; gap: var(--space-1-5); color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-name { font-size: var(--type-xl); font-weight: var(--weight-heavy); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
.brand-name span { color: var(--link); }
.brand small { font-size: var(--type-2xs); font-weight: var(--weight-bold); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: var(--control-size); height: var(--control-size); padding: 0;
    border: 1px solid var(--control-line); border-radius: var(--radius-md); background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.menu-toggle { display: none; }

.mainnav { display: flex; flex: 1; flex-wrap: wrap; gap: var(--space-1); min-width: 0; }
.mainnav a { display: inline-flex; align-items: center; min-height: var(--control-size); padding: var(--space-1-5) var(--space-3); border-radius: var(--radius-md); color: var(--muted); text-decoration: none; font-weight: var(--weight-medium); white-space: nowrap; }
.mainnav a:hover { color: var(--text); background: var(--panel-2); }
.mainnav a.active { color: var(--text); background: var(--info-bg); box-shadow: inset 0 -2px 0 var(--link); }
.mainnav a.nav-narrow { display: none; }

.userbox { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; min-width: 0; }
.userbox-link { color: var(--link); padding: var(--space-2) var(--space-1); white-space: nowrap; }
.userbox form { margin: 0; }

/* The switch shows, and is named for, the theme it would change to. */
.theme-to-light { display: inline-flex; }
.theme-to-dark { display: none; }
[data-bs-theme="light"] .theme-to-light { display: none; }
[data-bs-theme="light"] .theme-to-dark { display: inline-flex; }

.usermenu { position: relative; min-width: 0; }
.usermenu > summary { display: flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-size); max-width: 14rem; padding: 0 var(--space-3); border: 1px solid var(--control-line); border-radius: var(--radius-md); color: var(--text); cursor: pointer; list-style: none; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover, .usermenu[open] > summary { background: var(--panel-2); }
.usermenu svg { flex: none; }
.who-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--type-md); }
.usermenu-panel {
    position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: var(--z-menu);
    display: grid; gap: var(--space-1); width: min(18rem, calc(100vw - 2 * var(--space-4)));
    padding: var(--space-2); background: var(--panel); border: 1px solid var(--control-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
}
.usermenu-email { margin: 0; padding: var(--space-1-5) var(--space-3); color: var(--muted); font-size: var(--type-sm); overflow-wrap: anywhere; }
.usermenu-panel a, .usermenu-panel button { display: flex; align-items: center; width: 100%; min-height: var(--control-size); padding: var(--space-1-5) var(--space-3); border: 0; border-radius: var(--radius-md); background: none; color: var(--text); text-decoration: none; text-align: left; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--panel-2); color: var(--text); }

.linkbtn { min-height: var(--target-min); background: none; border: 0; color: var(--muted); padding: 0; }
.linkbtn:hover { color: var(--text); text-decoration: underline; }
.sandbox-banner {
    padding: var(--space-2) var(--content-x); font-size: var(--type-sm); color: var(--warn);
    background: var(--warn-bg); border-bottom: 1px solid var(--warn);
}
.sandbox-banner strong { font-size: var(--type-md); font-weight: var(--weight-heavy); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.content { box-sizing: border-box; flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-6) var(--content-x) var(--space-12); }
.footer { color: var(--muted); font-size: var(--type-sm); padding: var(--space-6) var(--content-x); border-top: 1px solid var(--line); text-align: center; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin-bottom: var(--space-2); font-size: var(--type-md); }
.footer-links a { display: inline-flex; align-items: center; min-height: var(--target-min); padding: var(--space-1); color: var(--muted); }
.footer-links a:hover, .footer-links a.active { color: var(--text); }

/* Phones and tablets: the links are a menu under the header, opened with the menu button (js/shell.js). */
@media (max-width: 991.98px) {
    .topbar { gap: var(--space-2); padding-inline: var(--space-3); }
    .topbar .brand { flex-direction: column; align-items: flex-start; gap: 0; }
    .menu-toggle { display: inline-flex; }
    .mainnav {
        display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: var(--z-menu);
        flex-direction: column; flex-wrap: nowrap; max-height: calc(100vh - var(--header-height)); overflow-y: auto;
        padding: var(--space-2) var(--space-3); background: var(--header); border-bottom: 1px solid var(--control-line); box-shadow: var(--shadow-2);
    }
    .menu-toggle[aria-expanded="true"] + .mainnav { display: flex; }
    .menu-toggle[aria-expanded="true"] { background: var(--info-bg); }
    .mainnav a, .mainnav a.nav-narrow { display: flex; min-height: 2.75rem; }
    .userbox { gap: var(--space-1-5); }
    /* The name is only clipped, so it stays in the accessible name. */
    .who-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .usermenu > summary { width: var(--control-size); padding: 0; }
    .usermenu { position: static; }
    .usermenu-panel { left: auto; right: var(--space-3); top: 100%; }
}
@media (max-width: 639.98px) {
    .userbox .btn-start { display: none; }
}
/* Without script the menu button and the theme switch can't work, so the links are simply shown. */
@media (scripting: none) {
    .menu-toggle, .theme-toggle { display: none; }
}
@media (max-width: 991.98px) and (scripting: none) {
    .topbar { flex-wrap: wrap; }
    .mainnav { display: flex; position: static; order: 3; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; box-shadow: none; border: 0; }
}

.legal { max-width: var(--prose-max); margin: 0 auto; line-height: var(--leading-prose); }
.legal h1 { margin-bottom: var(--space-1); }
.legal h2 { font-size: var(--type-lg); margin-top: var(--space-6); }
.legal .muted { margin-bottom: var(--space-6); }

/* ---------- Sign-in, sign-up and account settings ---------- */
.auth { width: 100%; max-width: 30rem; margin: var(--space-4) auto; padding: var(--space-6); }
.auth h1 { font-size: var(--type-2xl); margin-bottom: var(--space-3); }
.auth .auth-intro { color: var(--muted); }
.auth h2 { font-size: var(--type-base); }
.auth-links { margin: var(--space-4) 0 0; padding: 0; list-style: none; }
.auth-links a { display: inline-flex; align-items: center; min-height: var(--target-min); }
.auth-alt { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.manage h1 { margin-bottom: var(--space-4); }
.manage-body { min-width: 0; overflow-wrap: break-word; }
.manage .manage-body h2 { font-size: var(--type-xl); }
.manage .manage-body h3 { font-size: var(--type-lg); margin-top: var(--space-4); }
.manage-nav { flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
@media (max-width: 991.98px) {
    .manage-nav { flex-direction: row; }
}

/* ---------- Panels, tiles, tables ---------- */
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); }
.panel h2, .panel h3 { font-size: var(--type-base); font-weight: var(--weight-bold); margin-bottom: var(--space-4); }
.grid { display: grid; gap: var(--space-4); }
.grid > *, .trade-grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 960px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.tile { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
.tile .label { font-size: var(--type-xs); color: var(--muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.tile .value { font-size: var(--type-2xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; margin-top: var(--space-1); overflow-wrap: anywhere; }
.tile .sub { font-size: var(--type-md); margin-top: var(--space-half); }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head > * { min-width: 0; max-width: 100%; }
.page-head h1 { font-size: var(--type-2xl); font-weight: var(--weight-heavy); margin: 0; letter-spacing: var(--tracking-tight); }

/* Field widths that the pages used to set inline. */
.field-search { width: 220px; }
.field-filter { width: 180px; }
.field-symbol { width: 150px; }
.field-amount { flex: 1 1 8rem; width: auto; min-width: 0; }
.field-country { max-width: 26rem; }
.btn-wide { min-width: 10.5rem; }

/* Scrolling boxes are positioned, so the screen-reader text inside them can't widen the page. */
.table-wrap { position: relative; max-width: 100%; overflow-x: auto; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--panel-2); --bs-table-hover-color: var(--text); --bs-table-border-color: var(--line); margin: 0; }
.table th { color: var(--muted); font-weight: var(--weight-semibold); font-size: var(--type-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); border-bottom-color: var(--line); }
.table td { border-bottom-color: var(--line); vertical-align: middle; }
/* A long table has a height of its own, so its header can stay in view while it scrolls. */
.table-wrap.tall { max-height: 70vh; overflow: auto; scroll-padding-top: var(--space-12); }
/* The same for the buttons in a sticky header. */
.table-wrap.tall:has(thead:focus-within) { scroll-padding-top: 0; }
/* Bootstrap puts a caption under the table, where a hidden one's box overflows by a pixel and adds a scrollbar. */
.table-wrap caption { caption-side: top; }
.table thead th { position: sticky; top: 0; z-index: var(--z-raised); background: var(--panel); }
/* Rows that change places must not drag the scroll position with them. */
.table.live { overflow-anchor: none; }
.table .form-check-input { width: var(--target-min); height: var(--target-min); }
.sort-btn { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--target-min); padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; white-space: nowrap; }
.sort-btn:hover { color: var(--text); }
th[aria-sort] .sort-btn { color: var(--text); }
.sort-arrow { font-family: var(--font-sans); }
.table tr.clickable { cursor: pointer; }
.sym { display: inline-block; min-width: var(--target-min); min-height: var(--target-min); font-weight: var(--weight-bold); color: var(--text); text-decoration: none; }
.sym:hover { color: var(--link); }
.name { color: var(--muted); font-size: var(--type-md); }
.empty { color: var(--muted); padding: var(--space-6) 0; text-align: center; }

.chip { display: inline-block; padding: var(--space-half) var(--space-2); border-radius: var(--radius-pill); font-size: var(--type-xs); font-weight: var(--weight-semibold); background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.chip.ok { color: var(--up); background: var(--up-bg); border-color: var(--up); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.chip.bad { color: var(--down); background: var(--down-bg); border-color: var(--down); }

.pill-change { display: inline-block; min-width: 76px; text-align: right; padding: var(--space-half) var(--space-2); border-radius: var(--radius-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.pill-change.up { background: var(--up-bg); }
.pill-change.down { background: var(--down-bg); }

@keyframes flashUp { from { background: var(--up-bg); } to { background: transparent; } }
@keyframes flashDown { from { background: var(--down-bg); } to { background: transparent; } }
.tick-up { animation: flashUp var(--motion-flash) var(--ease-out); }
.tick-down { animation: flashDown var(--motion-flash) var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .tick-up, .tick-down { animation: none; } }

.spark { display: block; max-width: 100%; overflow: visible; }
.spark polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark.up polyline { stroke: var(--up); }
.spark.down polyline { stroke: var(--down); }
.spark .base { stroke: var(--control-line); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }

.alert-inline { border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); border: 1px solid; }
.alert-inline.ok { color: var(--up); background: var(--up-bg); border-color: var(--up); }
.alert-inline.bad { color: var(--down); background: var(--down-bg); border-color: var(--down); }
.alert-inline.info { color: var(--text); background: var(--info-bg); border-color: var(--link); }
/* A warning, or a note that a price is simulated: amber. */
.alert-inline.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }

/* An optional section folded away under the main one (the full application on the onboarding page). */
.more { margin-top: var(--space-5); }
.more > summary { cursor: pointer; padding: var(--space-3) var(--space-4); border: 1px dashed var(--control-line); border-radius: var(--radius-lg); color: var(--muted); font-weight: var(--weight-semibold); }
.more > summary:hover, .more[open] > summary { color: var(--text); }
.more[open] > summary { margin-bottom: var(--space-4); }

/* ---------- Forms ---------- */
.form-control, .form-select { background-color: var(--panel-2); border-color: var(--control-line); color: var(--text); }
.form-control:focus, .form-select:focus { background-color: var(--panel-2); color: var(--text); border-color: var(--focus); box-shadow: none; }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-control:disabled, .form-select:disabled { background-color: var(--panel); color: var(--muted); border-style: dashed; }
.form-check-input { --bs-form-check-bg: var(--panel-2); background-color: var(--panel-2); border-color: var(--control-line); }
.form-check-input:focus { border-color: var(--focus); box-shadow: none; }
.form-check-input:checked, .form-check-input[type="checkbox"]:indeterminate { background-color: var(--action); border-color: var(--action); }
.form-check-input:disabled { opacity: .6; }
.form-label { color: var(--muted); font-size: var(--type-md); margin-bottom: var(--space-1); }
.input-group-text { background-color: var(--panel-2); color: var(--text); border-color: var(--control-line); font-size: var(--type-base); }
/* Bootstrap fades and fills a floated label with colours of its own. */
.form-floating > label { margin: 0; color: var(--muted); font-size: var(--type-base); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label,
.form-floating > :disabled ~ label,
.form-floating > .form-control:disabled ~ label { color: var(--muted); }
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-select ~ label::after { background-color: var(--panel-2); }
.form-floating > :disabled ~ label::after,
.form-floating > .form-control:disabled ~ label::after { background-color: var(--panel); }
/* On its own: a browser that does not know the selector would drop the whole list. */
.form-floating > .form-control:-webkit-autofill ~ label { color: var(--muted); }
.form-hint { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--type-sm); }
.check-label { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target-min); }
.check-label .form-check-input { margin: 0; }
.validation-message { color: var(--down); font-size: var(--type-sm); margin-top: var(--space-1); }
.invalid { border-color: var(--down) !important; }
.valid.modified:not([type=checkbox]) { border-color: var(--up); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-8); align-items: center; padding: var(--space-6) 0 var(--space-10); }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.eyebrow { color: var(--link); font-weight: var(--weight-semibold); font-size: var(--type-md); letter-spacing: var(--tracking-wide); text-transform: uppercase; margin-bottom: var(--space-3); }
.hero h1 { font-size: var(--type-display); font-weight: var(--weight-heavy); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); margin-bottom: var(--space-4); }
.hero .lead { color: var(--muted); font-size: var(--type-lg); font-weight: inherit; max-width: 34rem; }
.cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-6); }
.hero-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); min-width: 0; }
.index-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-4); align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); text-decoration: none; color: var(--text); transition: border-color var(--motion-fast); }
.index-card:hover { border-color: var(--link); color: var(--text); }
.index-card .px { font-size: var(--type-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.index-card .spark { grid-column: 1 / -1; width: 100%; height: 44px; }
@media (max-width: 420px) { .index-card { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Ticker (Ticker.razor), both variants ----------
   The marquee is .ticker > .tape > .tape-track > .tape-item. The strip is .symbol-strip > .symbol-chip. They are kept
   to names of their own, so the marquee's animation can never reach the strip's buttons. */
.ticker { position: relative; margin: 0 calc(-1 * var(--content-x)) var(--space-8); }
.tape { position: relative; overflow: hidden; border-block: 1px solid var(--line); background: var(--panel); mask-image: linear-gradient(90deg, transparent, var(--mask) 6%, var(--mask) 94%, transparent); }
.tape-track { display: inline-flex; gap: var(--space-8); padding-block: var(--space-2); white-space: nowrap; animation: tape var(--motion-ticker) linear infinite; }
.tape-item { font-variant-numeric: tabular-nums; font-size: var(--type-md); }
.tape-item b { margin-right: var(--space-1-5); }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
/* The ticker stops while the pointer is over it, while anything in it has focus, and when it is paused with its button. */
.tape:hover .tape-track, .tape:focus-within .tape-track, .tape.paused .tape-track { animation-play-state: paused; }
.ticker-toggle { position: absolute; right: var(--space-2); top: 50%; transform: translateY(-50%); z-index: var(--z-raised); min-height: var(--target-min); padding: 0 var(--space-2); font-size: var(--type-xs); font-weight: var(--weight-semibold); border-radius: var(--radius-sm); border: 1px solid var(--control-line); background: var(--panel-2); color: var(--text); }
.ticker-toggle:hover { background: var(--bg); }
/* People who ask for less motion get a still list they can scroll sideways themselves, without the repeated copy. */
@media (prefers-reduced-motion: reduce) {
    .tape { overflow-x: auto; mask-image: none; scrollbar-width: thin; }
    .tape-track { animation: none; padding-inline: var(--space-6); }
    .tape-item[aria-hidden="true"] { display: none; }
    .ticker-toggle { display: none; }
}
/* The strip never moves by itself: it scrolls sideways when the reader scrolls it. */
.symbol-strip { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); margin-bottom: var(--space-4); scrollbar-width: thin; }
.symbol-strip-track { display: flex; gap: var(--space-1); padding: var(--space-1-5); white-space: nowrap; }
.symbol-chip { min-height: var(--target-min); font-variant-numeric: tabular-nums; font-size: var(--type-md); background: none; border: 1px solid var(--control-line); border-radius: var(--radius-md); color: var(--text); padding: var(--space-1) var(--space-2); }
.symbol-chip:hover { background: var(--panel-2); }
/* The symbol on screen: a blue edge, a bar under it and bold text, so it doesn't rest on colour alone. */
.symbol-chip.on { border-color: var(--link); box-shadow: inset 0 -3px 0 var(--link); background: var(--panel-2); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: var(--space-4); margin-top: var(--space-8); }
.feature h3 { font-size: var(--type-base); font-weight: var(--weight-bold); margin-bottom: var(--space-1-5); }
.feature p { color: var(--muted); margin: 0; font-size: var(--type-md); }

/* ---------- Stock page and ticket ---------- */
.quote-head { display: flex; align-items: baseline; gap: var(--space-2) var(--space-4); flex-wrap: wrap; }
.quote-head .big { font-size: var(--type-4xl); font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight); }
@media (max-width: 420px) { .quote-head .big { font-size: var(--type-3xl); } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: var(--space-3) var(--space-5); margin-top: var(--space-5); }
.stats div span { display: block; font-size: var(--type-xs); color: var(--muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.stats div b { font-variant-numeric: tabular-nums; }


.ticket .row-line { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--type-md); padding: var(--space-1) 0; color: var(--muted); }
.ticket .row-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.ticket .mb { margin-bottom: var(--space-3); }
.confirm { border: 1px dashed var(--control-line); border-radius: var(--radius-md); padding: var(--space-3); margin: var(--space-2) 0 var(--space-4); overflow-wrap: anywhere; }

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); flex-wrap: wrap; }
.tabs button { min-height: var(--control-size); background: none; border: 0; color: var(--muted); padding: var(--space-2) var(--space-3); font-weight: var(--weight-semibold); border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--link); }

/* ---------- Global markets ---------- */
.world { margin: 0 0 var(--space-6); min-width: 0; }
.world-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.world-head h2 { margin: 0; }
.world-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-2); }
.world.compact .world-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.venue { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); min-width: 0; }
.world.compact .venue { padding: var(--space-2); }
.venue-top { display: flex; align-items: center; gap: var(--space-1-5); }
.venue-top b { font-size: var(--type-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A narrow card lets the city wrap: there is nowhere else to read the rest of it. */
.world.compact .venue-top b { min-width: 0; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.venue-ccy { margin-left: auto; font-size: var(--type-2xs); color: var(--muted); }
.venue-code { font-size: var(--type-xs); color: var(--muted); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.venue-time { font-size: var(--type-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; margin-top: var(--space-half); }
.world.compact .venue-time { font-size: var(--type-base); margin: 0; }
.venue-status { font-size: var(--type-xs); color: var(--muted); margin-top: var(--space-half); }
.venue-country { font-size: var(--type-xs); color: var(--muted); overflow-wrap: anywhere; }
.venue.open .venue-status { color: var(--text); font-weight: var(--weight-semibold); }
.trading-now { margin: 0 0 var(--space-2); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.dot { display: inline-block; box-sizing: border-box; width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); flex: none; }
.open .dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-bg); }
.lunch .dot { background: transparent; border: 2px solid var(--muted); }
.venue.open { border-color: var(--up); }
.venue.closed .venue-time { color: var(--muted); }
.mkt { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--type-md); white-space: nowrap; }
.venue-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); background: var(--panel-2); }
.venue-card .dot { margin-right: var(--space-1-5); }

/* ---------- Data-state badge (DataBadge.razor): SIMULATED, LIVE, DELAYED, CLOSED ----------
   The word carries the meaning. Colour and border style only reinforce it: simulated and delayed are both amber,
   with a dashed and a double edge. */
.data-badge { display: inline-block; margin-left: var(--space-1-5); padding: 0 var(--space-1-5); border-radius: var(--radius-xs); font-size: var(--type-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); line-height: var(--leading-body); vertical-align: middle; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); background: var(--panel-2); }
.data-badge.live { color: var(--up); border-color: var(--up); }
.data-badge.simulated { color: var(--warn); border-color: var(--warn); border-style: dashed; }
.data-badge.delayed { color: var(--warn); border-color: var(--warn); border-style: double; border-width: 3px; }
.data-badge.closed { color: var(--muted); }
/* The source and the time, written next to a badge for everyone (not in a tooltip). It sits outside the badge's box
   and wraps at its spaces, so a long one ("Finnhub (Binance) · last price Nov 20, 16:00 ET") goes onto more lines
   and never forces a table column wide on a phone. In a right-aligned number cell it goes under the price. */
.data-detail { display: inline-block; margin-left: var(--space-1); font-size: var(--type-xs); font-weight: 400; letter-spacing: 0; line-height: var(--leading-snug); color: var(--muted); white-space: normal; vertical-align: middle; text-align: left; }
.num .data-detail, .row-line .data-detail { display: block; margin-left: 0; text-align: right; }
.ticker-note { margin: calc(-1 * var(--space-6)) 0 var(--space-6); }
.data-line { font-size: var(--type-sm); color: var(--muted); }
.index-card .data-line { grid-column: 1 / -1; }
.index-card .data-line .data-badge { margin-left: 0; margin-right: var(--space-1-5); }
.venue-data { font-size: var(--type-2xs); color: var(--muted); margin-top: var(--space-1); }
.venue-data .data-badge { margin-left: var(--space-half); }
.sim-panel { margin-top: var(--space-4); border: 1px dashed var(--warn); }
.table tr.sim-divider th { color: var(--warn); font-size: var(--type-sm); letter-spacing: var(--tracking-wide); border-top: 1px dashed var(--warn); padding-top: var(--space-3); }
.chart-wrap { position: relative; min-width: 0; }
.chart-note { position: absolute; top: var(--space-2); left: var(--space-2); z-index: var(--z-note); max-width: calc(100% - 5.5rem); padding: var(--space-half) var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: var(--type-xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); pointer-events: none; }
.chart-note.sim { color: var(--warn); background: var(--warn-bg); border: 1px dashed var(--warn); }

/* ---------- Virtual label (VirtualBadge.razor): one per card or table heading ----------
   Marks balances, buying power, orders, holdings and returns as practice money. The word carries the meaning. */
.virtual-badge { display: inline-block; margin-left: var(--space-1-5); padding: 0 var(--space-1-5); border-radius: var(--radius-xs); font-size: var(--type-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); line-height: var(--leading-body); text-transform: uppercase; vertical-align: middle; white-space: nowrap; border: 1px solid var(--warn); color: var(--warn); background: var(--warn-bg); }
.panel h2 .virtual-badge, .page-head h1 .virtual-badge { position: relative; top: -.1em; }

/* ---------- Modal and confirm (Modal.razor) ----------
   The browser's own <dialog>, opened with showModal(). No display is set here: that would show a closed one. */
.dialog { position: fixed; inset: 0; z-index: var(--z-dialog); margin: auto; width: min(34rem, calc(100% - 2 * var(--space-4))); max-width: 100%; height: fit-content; max-height: calc(100vh - 2 * var(--space-4)); overflow-y: auto; background: var(--panel); color: var(--text); border: 1px solid var(--control-line); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-3); }
.dialog::backdrop { background: var(--scrim); }
.dialog h2 { font-size: var(--type-lg); font-weight: var(--weight-heavy); margin-bottom: var(--space-3); }
.dialog ul { padding-left: var(--space-5); margin-bottom: var(--space-4); }
.dialog li { margin-bottom: var(--space-1-5); }
.dialog-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }

.exposure { display: grid; gap: var(--space-2); }
.exp-row { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; }
.exp-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-bar { height: .5rem; background: var(--panel-2); border-radius: var(--radius-pill); overflow: hidden; }
.exp-bar span { display: block; height: 100%; background: var(--action); border-radius: var(--radius-pill); }
.exp-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
    .exp-row { grid-template-columns: minmax(0, 1fr) auto; }
    .exp-bar { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
    /* On phones the compact clock is a swipeable strip instead of a tall grid. */
    .world.compact .world-grid { grid-auto-flow: column; grid-auto-columns: 112px; grid-template-columns: none; overflow-x: auto; padding-bottom: var(--space-1-5); scroll-snap-type: x proximity; }
    .world.compact .venue { scroll-snap-align: start; }
}

/* ---------- Prompts 17-24: chart, order book, notifications, trade dashboard ---------- */

.chart-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.seg-sm { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--control-line); border-radius: var(--radius-md); overflow: hidden; }
.seg-sm button { min-height: var(--target-min); background: var(--panel-2); color: var(--text); border: 0; border-right: 1px solid var(--control-line); padding: var(--space-1) var(--space-3); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.seg-sm button:last-child { border-right: 0; }
/* The ticket's variant: two columns of wide buttons. */
.seg-sm.block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); margin-bottom: var(--space-4); border: 0; border-radius: 0; overflow: visible; }
.seg-sm.block button { border: 1px solid var(--control-line); border-radius: var(--radius-md); padding: var(--space-2); font-size: var(--type-md); font-weight: var(--weight-bold); }
/* The chosen one is marked by a thick bar under it as well as by colour. A choice that is neither buying nor selling
   is blue. These follow the variant, so its border doesn't hide theirs. */
.seg-sm button.on { background: var(--info-bg); color: var(--link); border-color: var(--link); box-shadow: inset 0 -3px 0 var(--link); }
.seg-sm button.on-buy { background: var(--up-bg); color: var(--up); border-color: var(--up); box-shadow: inset 0 -3px 0 var(--up); }
.seg-sm button.on-sell { background: var(--down-bg); color: var(--down); border-color: var(--down); box-shadow: inset 0 -3px 0 var(--down); }
.chart-box { width: 100%; height: 360px; }
@media (max-width: 760px) { .chart-box { height: 260px; } }

.book .book-head, .book .lvl { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.book .book-head { padding: 0 var(--space-1-5) var(--space-1); }
.book .lvl { position: relative; padding: var(--space-half) var(--space-1-5); font-size: var(--type-md); }
.book .lvl::before { content: ""; position: absolute; top: 1px; bottom: 1px; right: 0; width: var(--w); border-radius: var(--radius-xs); }
.book .lvl.ask::before { background: var(--down-bg); }
.book .lvl.bid::before { background: var(--up-bg); }
.book .lvl.ask span:first-child { color: var(--down); }
.book .lvl.bid span:first-child { color: var(--up); }
.book .lvl span { position: relative; }
.book .book-spread { text-align: center; color: var(--muted); padding: var(--space-1) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: var(--space-1) 0; }

.bell { position: relative; }
.bell-btn { position: relative; display: grid; place-items: center; width: var(--control-size); height: var(--control-size); padding: 0; background: none; border: 1px solid var(--control-line); border-radius: var(--radius-md); color: var(--text); }
.bell-btn:hover { background: var(--panel-2); color: var(--text); }
.badge-count { position: absolute; top: -6px; right: -6px; background: var(--sell); color: var(--sell-ink); border-radius: var(--radius-pill); font-size: var(--type-2xs); font-weight: var(--weight-bold); min-width: 17px; height: 17px; padding: 0 var(--space-1); display: grid; place-items: center; }
.bell-menu { position: absolute; right: 0; top: calc(100% + var(--space-2)); z-index: var(--z-menu); width: min(340px, calc(100vw - 2 * var(--space-4))); max-height: min(420px, 75vh); overflow-y: auto; background: var(--panel); border: 1px solid var(--control-line); border-radius: var(--radius-lg); padding: var(--space-3); box-shadow: var(--shadow-2); }
.bell-menu .note { padding: var(--space-2); border-radius: var(--radius-md); border-left: 3px solid transparent; }
.bell-menu .note.unread { background: var(--panel-2); border-left-color: var(--link); }
.bell-menu .note.bad { border-left-color: var(--down); }
@media (max-width: 991.98px) {
    .bell { position: static; }
    .bell-menu { right: var(--space-3); top: 100%; }
}

.trade-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "chart ticket" "positions book" "orders book"; align-items: start; }
.trade-chart { grid-area: chart; }
.trade-ticket { grid-area: ticket; }
.trade-book { grid-area: book; }
.trade-positions { grid-area: positions; }
.trade-orders { grid-area: orders; }
@media (max-width: 960px) {
    .trade-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "ticket" "book" "positions" "orders"; }
}

/* ---------- First paint: the loading notice in the server-sent shell (App.razor) ----------
   Interactive pages are drawn once the live connection opens. Until then this is what is on screen. It follows the
   page in the document, so it is hidden the moment the page's own shell exists. */
.shell-skeleton { min-height: 100vh; }
.shell ~ .shell-skeleton { display: none; }
body:has(> .shell) .shell-skeleton { display: none; }
.skeleton-status { font-size: var(--type-lg); font-weight: var(--weight-bold); margin-bottom: var(--space-4); }
.skeleton-bars { display: grid; gap: var(--space-3); margin-bottom: var(--space-5); }
.skeleton-bar { height: 3.25rem; border-radius: var(--radius-lg); border: 1px solid var(--line); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: skeleton var(--motion-shimmer) ease-in-out infinite; }
.skeleton-bar.w-40 { width: 40%; height: 2rem; }
.skeleton-bar.w-70 { width: 70%; }
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-bar { animation: none; background: var(--panel); } }

/* ---------- Notes that used to be hover-only tooltips ----------
   A reason, a definition or a "since" time shown as text, so it can be read without a mouse and by a screen reader. */
.reason { display: block; font-size: var(--type-sm); color: var(--muted); margin-top: var(--space-half); white-space: normal; max-width: 34rem; }
.reason.bad { color: var(--down); }
.defs { margin: var(--space-3) 0 0; font-size: var(--type-sm); color: var(--muted); }
.defs dt { display: inline; font-weight: var(--weight-bold); color: var(--text); }
.defs dd { display: inline; margin: 0 var(--space-4) 0 var(--space-1); }
.stats div small { display: block; font-size: var(--type-xs); color: var(--muted); line-height: var(--leading-snug); margin-top: var(--space-half); }
.venue-hours { font-size: var(--type-2xs); color: var(--muted); margin-top: var(--space-half); }

/* ---------- Component library (Components/Ui): what hasn't a place above ---------- */
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 var(--space-3); }
.panel-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }

.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-3); }
.filter-bar > * { max-width: 100%; }
.seg-detail { color: var(--muted); }

.footnote { margin-top: var(--space-3); color: var(--muted); font-size: var(--type-sm); }
.footnote > summary { min-height: var(--target-min); cursor: pointer; }
.footnote > summary:hover { color: var(--text); }
.footnote > p { margin: var(--space-2) 0 0; }

.error-state { max-width: var(--prose-max); overflow-wrap: anywhere; }
.error-title { margin-bottom: var(--space-1); font-weight: var(--weight-bold); }
.error-state > .actions { margin-bottom: 0; }

.skeleton { padding: var(--space-3) 0; }
.skeleton-label { margin-bottom: var(--space-2); color: var(--muted); }
.skeleton .skeleton-bar { height: var(--space-5); }

.chart-state { position: absolute; inset: 0; z-index: var(--z-note); display: grid; place-content: center; padding: var(--space-4); overflow: auto; background: var(--panel); }
.chart-source { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--type-sm); }

/* A toast can't be seen through, so a click on it stops there and never presses what it hides. The gaps between
   toasts let clicks through, and the page keeps room under them so the last control can be scrolled clear. */
.toast-host { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: var(--z-toast); display: grid; gap: var(--space-2); width: min(24rem, calc(100% - 2 * var(--space-4))); pointer-events: none; }
.notice-toast { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--control-line); border-left-width: var(--space-1); border-radius: var(--radius-md); background: var(--panel-2); color: var(--text); box-shadow: var(--shadow-2); font-size: var(--type-md); overflow-wrap: anywhere; pointer-events: auto; }
.notice-toast.ok { border-left-color: var(--up); }
.notice-toast.bad { border-left-color: var(--down); }
.notice-toast.info { border-left-color: var(--link); }
.toast-dismiss { flex: none; display: grid; place-items: center; width: var(--control-size); height: var(--control-size); padding: 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--text); }
.shell:has(.notice-toast) { padding-bottom: var(--toast-room); }
html:has(.notice-toast) { scroll-padding-bottom: var(--toast-room); }
@media (max-width: 559.98px) {
    .toast-host { right: var(--space-2); bottom: var(--space-2); width: calc(100% - 2 * var(--space-2)); }
    /* A phone shows the newest one only, so they cover as little as they can. */
    .toast-host > .notice-toast:not(:last-child) { display: none; }
}

.search-box { max-width: 26rem; }
.list-plain { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.list-plain li { padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }
.news-card h3 { margin-bottom: var(--space-1); }
.research-kind { margin: var(--space-4) 0 0; font-size: var(--type-md); }

/* ---------- Forced colours (Windows high contrast) ----------
   Colours, backgrounds and shadows are replaced there, and they are what marks a chosen control. The chosen one is
   filled with the system's highlight instead. !important: the class rules above are more specific. */
@media (forced-colors: active) {
    [aria-pressed="true"], [role="tab"][aria-selected="true"], nav a[aria-current="page"] { forced-color-adjust: none; background: Highlight !important; color: HighlightText !important; border-color: Highlight !important; }
    [aria-pressed="true"] *, [role="tab"][aria-selected="true"] *, nav a[aria-current="page"] * { color: HighlightText !important; }
    [role="tab"][aria-selected="false"] { border-bottom-color: Canvas; }
}

/* The component gallery (/design, Development only). */
.gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }
.gallery > section { min-width: 0; }
.gallery > section > h2 { font-size: var(--type-xl); margin-bottom: var(--space-3); }
