/* ---------------------------------------------------------------
   app.css - shared design tokens and base shell for algo-trading.
   Theme is driven by data-bs-theme on <html> (same attribute
   Bootstrap 5.3 uses), so one switch themes both this file and
   Bootstrap. See www/static/js/theme.js.

   Type scale is deliberately generous: on a desktop screen every
   control and value should be readable without leaning in, and on a
   phone nothing drops below 14px. Controls are 38px tall on desktop
   and 44px on touch screens (Apple/Google minimum tap target), and
   text inputs go to 16px on small screens because iOS Safari zooms
   the page when a focused input is smaller than that.
   --------------------------------------------------------------- */

/* The site's font (ROADMAP F56, DECISIONS 2026-10-13): Inter, served by our own site (static/fonts/, SIL Open Font
   License next to it), one variable file for every weight; the system font shows until it has loaded (swap) */
@font-face {
    font-family: "Inter";
    src: url("../fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
/* Arabic letters (ROADMAP F66 step 2): IBM Plex Sans Arabic, served by our own site (SIL Open Font License next to it),
   Arabic letters only (unicode-range), so an English page never loads it; Latin letters and digits stay Inter */
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+204F, U+2E41;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+204F, U+2E41;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+204F, U+2E41;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2011, U+204F, U+2E41;
}

/* Dark is the default palette. */
:root,
[data-bs-theme="dark"] {
    /* three background depths (ROADMAP F85): the page (--surface), a card (--panel) and a raised card - menus,
       dialogs, pop-ups (--raised); --panel-2 / -3 are the shades inside a card (hover, a field) */
    --surface:      #080b11;
    --panel:        #131a24;
    --raised:       #1c2533;
    --panel-2:      #1a2230;
    --panel-3:      #212b3a;
    --scrollbar:    #4a5568;       /* the scroll bar's thumb: seen on the page and in a card (owner, 2026-10-24) */
    --border:       #253040;
    --border-soft:  #1c2533;
    /* a field to type in (ROADMAP F130, owner 2026-10-13: "i can't differentiate between the fields that needs input
       and the notes"): darker than its card, a border >= 3:1 on every background (test_contrast); buttons are lighter
       than the card, so a field never looks like a button or a note */
    --field-bg:     #0b1018;
    --field-border: #64748b;
    --field-border-hover: #8b9ab0;
    /* text whiter on dark (owner, 2026-10-12: "more white than now"; was #e9edf4 / #a3b1c4 / #8a99ad) */
    --ink:          #f8fafc;
    --ink-dim:      #cbd5e1;
    /* contrast (bug 2026-10-01, owner): every text colour >= 4.5:1 on panel, panel-2, panel-3 and surface;
       tests/www/test_contrast.py checks it. --accent = button / border colour (white text on it), --link = text */
    --ink-faint:    #94a3b8;       /* notes: muted, apart from labels (F130, owner 2026-10-13; was #a7b4c6) */
    --accent:       #2563eb;
    --link:         #60a5fa;
    --accent-ink:   #ffffff;
    --accent-soft:  rgb(59 130 246 / 0.16);
    /* the brand colour (ROADMAP F85): teal, apart from the "click me" blue and from the up green - the logo, the
       active menu item, highlights; never a number's colour */
    --brand:        #2dd4bf;
    --brand-soft:   rgb(45 212 191 / 0.14);
    --raised-glass: rgb(28 37 51 / 0.90);   /* the menu bar's dropdowns, a little see-through (--raised) */
    --up-ink:       #34d399;
    --down-ink:     #f87171;
    --danger:       #dc2626;       /* a harmful action's button (white text on it): Delete, Sell all */
    --danger-soft:  rgb(248 113 113 / 0.16);
    /* chart marks (candles): validated vs the dark chart surface - L band, CVD dE 9.3 */
    --chart-up:     #0f9f6e;
    --chart-down:   #f0513f;
    --chart-compare: #f59e0b;      /* a second, dashed line: "the same money in BTC" (ROADMAP F38) */
    /* colours of a kind of thing, each style may set its own (ROADMAP F133; were written out in the pages' CSS) */
    --gold:         #eab308;       /* a highlight: an alert, an economic event */
    --gold-soft:    rgb(234 179 8 / 0.16);
    --violet:       #c084fc;       /* a new listing; Getting started's glow */
    --pro-ink:      #f5b942;       /* the Pro plan's marks (access.css) */
    --pro-soft:     rgb(245 185 66 / 0.14);
    --app-bar:      #0E1420;       /* behind the phone's status bar in the installed app (the brand navy) */
    --focus-ring:   rgb(59 130 246 / 0.45);
    --focus:        #60a5fa;       /* keyboard focus outline (ROADMAP F107): >= 3:1 on every background, test_contrast */
    --row-alt:      rgb(255 255 255 / 0.025);
    --row-hover:    rgb(59 130 246 / 0.12);
    --shadow-sm:    0 1px 2px rgb(0 0 0 / 0.30);
    --shadow-md:    0 4px 12px rgb(0 0 0 / 0.35);
    /* Bootstrap's own text colour (forms, cards) follows ours, so it is as white (owner, 2026-10-12) */
    --bs-body-color: var(--ink);
}

[data-bs-theme="light"] {
    --surface:      #eef1f5;
    --panel:        #ffffff;
    --raised:       #ffffff;
    --panel-2:      #f7f9fc;
    --panel-3:      #eceff4;
    --scrollbar:    #a3adbb;
    --border:       #d4dce7;
    --border-soft:  #e6ebf2;
    --field-bg:     #ffffff;
    --field-border: #7b8799;
    --field-border-hover: #4a5768;
    --ink:          #0f172a;
    --ink-dim:      #4a5768;
    --ink-faint:    #5b6a80;
    --accent:       #1d4ed8;
    --link:         #1d4ed8;
    --accent-ink:   #ffffff;
    --accent-soft:  rgb(29 78 216 / 0.10);
    --brand:        #0f766e;
    --brand-soft:   rgb(15 118 110 / 0.10);
    --raised-glass: rgb(255 255 255 / 0.90);
    --up-ink:       #06714f;
    --down-ink:     #b3261e;
    --danger:       #b91c1c;
    --danger-soft:  rgb(179 38 30 / 0.10);
    /* chart marks (candles): validated vs white - CVD dE 8.2 */
    --chart-up:     #06714f;
    --chart-down:   #b3261e;
    --chart-compare: #b45309;
    --gold:         #975a06;
    --gold-soft:    rgb(202 138 4 / 0.12);
    --violet:       #9333ea;
    --pro-ink:      #8a5a00;
    --pro-soft:     rgb(180 120 0 / 0.10);
    --app-bar:      #0E1420;
    --focus-ring:   rgb(29 78 216 / 0.30);
    --focus:        #1d4ed8;
    --row-alt:      rgb(15 23 42 / 0.03);
    --row-hover:    rgb(29 78 216 / 0.08);
    --shadow-sm:    0 1px 2px rgb(15 23 42 / 0.06);
    --shadow-md:    0 4px 12px rgb(15 23 42 / 0.10);
    --bs-body-color: var(--ink);
}

/* Sizing / typography tokens (theme-independent).
   The three --fs-* / --ctl-* values are what the media queries at the
   bottom of this file change, so every page scales from one place. */
:root {
    --radius:      8px;
    --radius-sm:   6px;
    --radius-lg:   12px;
    --radius-pill: 999px;
    --gap:         10px;

    --font-ui:   "Inter", "IBM Plex Sans Arabic", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    /* numbers in the page font with fixed-width digits (ROADMAP F116, like Binance / CoinMarketCap): every rule that
       uses --font-num also sets font-variant-numeric: tabular-nums, so columns still line up */
    --font-num:  var(--font-ui);
    --font-code: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;   /* code-like text: keys, copy boxes */

    --fs-body:   calc(17px * var(--text-scale, 1));   /* page text */
    --fs-ctl:    calc(16.5px * var(--text-scale, 1)); /* selects, inputs, buttons */
    --fs-data:   calc(16px * var(--text-scale, 1));   /* table cells - never smaller than this */
    --fs-label:  calc(15px * var(--text-scale, 1));   /* field labels, column headers */
    --fs-meta:   calc(15.5px * var(--text-scale, 1)); /* secondary / status text */
    --fs-note:   calc(14.5px * var(--text-scale, 1)); /* a note or hint: smaller and muted, never boxed (F130) */

    --ctl-h:     calc(38px * var(--text-scale, 1));   /* control height */
    --ctl-pad:   8px 12px;
}

* { box-sizing: border-box; }

/* Text size (ROADMAP F108, Profile > Display: 90 / 100 / 110 / 125 / 140 %): every font size of our stylesheets is
   "its size x --text-scale" (tests/www/test_text_size.py checks none is left out), the control height too; the root
   size follows, so Bootstrap's rem sizes grow with it. static/js/text_size.js sets it on <html> before the first
   paint. */
:root { --text-scale: 1; }
html { font-size: calc(18px * var(--text-scale, 1)); }

html, body { height: 100%; }

body {
    margin: 0;
    background-color: var(--surface);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: var(--fs-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;   /* no surprise reflow in landscape */
}

/* ---------------- navbar (Bootstrap handles the collapse) ------ */

.navbar {
    background-color: var(--panel) !important;
    border-bottom: 1px solid var(--border);
    padding-top: 7px;
    padding-bottom: 7px;
}

.navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: calc(18.5px * var(--text-scale, 1));
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}
/* the logo: the mark alone (images/brand/symbol*.svg, setup/brand/make_brand_files.py), one per theme */
.navbar .brand-symbol { display: block; flex: 0 0 auto; }
.navbar .brand-symbol-light,
[data-bs-theme="light"] .navbar .brand-symbol-dark { display: none; }
[data-bs-theme="light"] .navbar .brand-symbol-light { display: block; }

/* the market space switcher after the logo (ROADMAP F2, navbar.html .space-switch): the space's icon and name; on a
   phone the list opens from the bottom, above the tab bar */
.navbar .space-switch { margin-inline-end: 12px; }
.navbar .space-switch-btn {
    display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 11px;
    border: 1px solid var(--brand); border-radius: var(--radius-sm); background-color: var(--brand-soft);
    color: var(--ink); font-size: calc(15px * var(--text-scale, 1)); font-weight: 600; white-space: nowrap;
}
.navbar .space-switch-btn .menu-icon { width: 17px; height: 17px; color: var(--brand); }
.navbar .space-switch-caret { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.navbar .space-menu { min-width: 330px; }
.navbar .space-menu .dropdown-header { text-transform: uppercase; letter-spacing: 0.06em; }
.navbar .space-menu .menu-item.is-locked .menu-item-icon,
.navbar .space-menu .menu-item.is-locked .menu-item-hint { opacity: .55; }        /* a visitor's / Free account's space */
.navbar .space-menu-note { margin: 6px 12px 4px; color: var(--ink-faint); font-size: var(--fs-meta); }
.space-subs {
    display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: calc(100% - 32px);
    margin: 14px 16px 0; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background-color: var(--panel);
}
.space-subs .space-sub {
    display: inline-flex; align-items: center; min-height: 34px; padding: 0 15px; border-radius: 6px;
    color: var(--ink-dim); text-decoration: none; font-weight: 500;
}
.space-subs .space-sub:hover { background-color: var(--row-hover); color: var(--ink); }
.space-subs .space-sub.active { background-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
/* a laptop: the full menu leaves no room for the space's name (the bar ran 30 px past a 1280 px screen,
   2026-11-21); the icon alone says the space, the name is in the button's title and its aria-label */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .navbar .space-switch { margin-inline-end: 6px; }
    .navbar .space-switch-btn { gap: 4px; padding: 0 8px; }
    .navbar .space-switch-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
                                 white-space: nowrap; }
}
@media (max-width: 991.98px) {
    .navbar .space-switch { margin-inline-start: auto; margin-inline-end: 8px; }
    .navbar .space-switch-btn { border-radius: 999px; min-height: 36px; }
}
@media (max-width: 767.98px) {
    .navbar .space-switch-btn .menu-icon { display: none; }
    .navbar .space-menu.show {
        position: fixed; inset-inline: 0; bottom: calc(60px + env(safe-area-inset-bottom)); top: auto; min-width: 0;
        margin: 0; max-height: calc(100vh - 140px); overflow-y: auto; border-radius: 18px 18px 0 0; z-index: 1060;
    }
}

.navbar .nav-link {
    color: var(--ink-dim);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    font-size: calc(16.5px * var(--text-scale, 1));
}

.navbar .nav-link:hover    { color: var(--ink); background-color: var(--panel-2); }
.navbar .nav-link.active   { color: var(--ink); background-color: var(--brand-soft); font-weight: 600;
                             box-shadow: inset 0 -2px 0 var(--brand); }
.navbar .nav-link.disabled { color: var(--ink-faint); }

.navbar .navbar-toggler {
    padding: 7px 10px;
    border-color: var(--border);
}


.navbar .dropdown-menu {
    background-color: var(--raised);
    border-color: var(--border);
    font-size: calc(16.5px * var(--text-scale, 1));
}
/* the dropdowns a little see-through, the page blurred behind them (ROADMAP F85; not the bar itself: it does not float
   over the page, and a pinned bar would cover the tables' pinned header rows) */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .navbar .dropdown-menu { background-color: var(--raised-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}

.navbar .dropdown-item { color: var(--ink-dim); padding: 8px 14px; }
.navbar .dropdown-item:hover { color: var(--ink); background-color: var(--panel-2); }
.navbar .dropdown-item.active { color: var(--ink); background-color: var(--brand-soft); font-weight: 600; }

/* the menu like CoinMarketCap's (owner, 2026-10-12): an icon before every name (site_menu.ICONS, navbar.html), each
   dropdown line an icon tile, the page's name and its short line under it; a long group in two columns */
.navbar .menu-icon {
    width: calc(18px * var(--text-scale, 1));
    height: calc(18px * var(--text-scale, 1));
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.navbar .nav-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* the bar's own icons only where the bar has room for them; the dropdowns always have theirs */
@media (min-width: 992px) and (max-width: 1799.98px) { .navbar .nav-link > .menu-icon { display: none; } }
/* a laptop-wide bar (owner, 2026-10-12, with the 2px bigger text): the price light without its word, so the bar keeps
   to one line (Search is its magnifier on every screen since 2026-11-22) */
@media (min-width: 992px) and (max-width: 1599.98px) {
    .navbar .freshness-text { display: none; }
}
.navbar .nav-link .menu-icon { opacity: .85; }
.navbar .menu-panel { padding: 8px; min-width: 280px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.navbar .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius);
    white-space: normal;
}
.navbar .menu-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(36px * var(--text-scale, 1));
    height: calc(36px * var(--text-scale, 1));
    flex: 0 0 auto;
    color: var(--link);
    background-color: var(--panel-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}
.navbar .menu-item:hover .menu-item-icon,
.navbar .menu-item.active .menu-item-icon { color: var(--accent-ink); background-color: var(--accent); border-color: var(--accent); }
.navbar .menu-item.active .menu-item-icon { color: var(--brand); background-color: var(--brand-soft); border-color: var(--brand); }
/* the Account menu's buttons (theme, Logout) look like its links, not like the page's buttons */
.navbar button.menu-item { justify-content: flex-start; min-height: 0; border: 0; border-radius: var(--radius);
                           background-color: transparent; font-size: inherit; font-weight: 400; text-align: start; }
.navbar button.menu-item:hover { background-color: var(--panel-2); }
.navbar button.menu-item:active { transform: none; }
.navbar .menu-item-text { display: flex; flex-direction: column; min-width: 0; }
.navbar .menu-item-label { color: var(--ink); font-weight: 600; }
.navbar .menu-item-hint { color: var(--ink-faint); font-size: var(--fs-meta); font-weight: 400; line-height: 1.35; }
.navbar .menu-item:hover .menu-item-hint { color: var(--ink-dim); }

@media (min-width: 992px) {
    .navbar .menu-wide { grid-template-columns: repeat(2, minmax(290px, 1fr)); gap: 2px 6px; min-width: 620px; }
    .navbar .nav-hover > .dropdown-menu-end { inset-inline-end: 0; inset-inline-start: auto; }
    .navbar .menu-wide.show { display: grid; }
    .navbar .menu-wide > li:has(> .dropdown-header), .navbar .menu-wide > li:has(> .dropdown-divider) { grid-column: 1 / -1; }
}

/* opens when the mouse is over it, no click (owner, 2026-10-12); only where there is a mouse and the bar is wide.
   The menu sits right under its name (no gap the mouse could fall into); static/js/menu_hover.js closes a menu
   opened by a click when the mouse moves to another group */
@media (hover: hover) and (min-width: 992px) {
    .navbar .nav-hover > .dropdown-menu { top: 100%; margin-top: 0; }
    .navbar .nav-hover:hover > .dropdown-menu { display: block; }
    .navbar .nav-hover:hover > .menu-wide { display: grid; }
    .navbar .nav-hover:hover > .dropdown-toggle { color: var(--ink); background-color: var(--panel-2); }
}

/* the Admin menu: one line per group, its pages in a sub-menu (owner, 2026-11-09; navbar.html, menu_hover.js).
   Wide bar: beside the group, under the mouse or after a click (.open), on the other side when there is no room
   (.admin-flip). Folded bar (phones): under the group, after a tap; the open page's group starts open. */
.navbar .admin-menu { min-width: 250px; }
.navbar .admin-group { position: relative; }
.navbar .admin-group-toggle { width: 100%; }
.navbar .admin-group-here > .admin-group-toggle .menu-item-label { color: var(--brand); }
.navbar .admin-group-toggle::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; flex: 0 0 auto;
                             border-block-start: 2px solid var(--ink-faint); border-inline-end: 2px solid var(--ink-faint);
                             transform: rotate(45deg); }
[dir="rtl"] .navbar .admin-group-toggle::after { transform: rotate(-45deg); }
.navbar .admin-group.admin-flip > .admin-group-toggle::after { transform: rotate(-135deg); }   /* points to the side it opens on */
[dir="rtl"] .navbar .admin-group.admin-flip > .admin-group-toggle::after { transform: rotate(135deg); }
.navbar .admin-sub { display: none; margin: 0; list-style: none; background-color: var(--raised); border: 1px solid var(--border); }
.navbar .admin-group.open > .admin-sub { display: block; }
.navbar .admin-group.open > .admin-group-toggle { background-color: var(--panel-2); }
@media (min-width: 992px) {
    .navbar .admin-sub { position: absolute; top: -9px; inset-inline-start: 100%; z-index: 1001; min-width: 240px; }
    .navbar .admin-group.admin-flip > .admin-sub { inset-inline-start: auto; inset-inline-end: 100%; }
}
@media (hover: hover) and (min-width: 992px) {
    .navbar .admin-group:hover > .admin-sub { display: block; }
    .navbar .admin-group:hover > .admin-group-toggle { background-color: var(--panel-2); }
}
@media (max-width: 991.98px) {
    .navbar .admin-sub { min-width: 0; padding: 2px 0 6px; padding-inline-start: 22px; background-color: transparent;
                         border: 0; box-shadow: none; }
    .navbar .admin-group.open > .admin-group-toggle::after { transform: rotate(135deg); }
}

/* ---------------- menu search, Ctrl+K (static/js/site_search.js, ROADMAP F44) ---------- */

.site-search-open {
    display: inline-flex;
    align-items: center;
    padding: 6px 9px;
    color: var(--ink-faint);
    background-color: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: calc(16px * var(--text-scale, 1));
    cursor: pointer;
}

.site-search-open:hover { color: var(--ink); border-color: var(--accent); }
.site-search-hint kbd {
    padding: 1px 6px;
    color: var(--ink-dim);
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: calc(13.5px * var(--text-scale, 1));
    box-shadow: none;
}

dialog.site-search {
    width: min(620px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 80px));
    margin: 70px auto auto;
    padding: 0;
    color: var(--ink);
    background-color: var(--raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

dialog.site-search::backdrop { background-color: rgb(0 0 0 / 0.45); }

.site-search-box { display: flex; flex-direction: column; max-height: inherit; }

.site-search-input {
    width: 100%;
    padding: 14px 16px;
    color: var(--ink);
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    font-size: calc(18px * var(--text-scale, 1));
    outline: none;
}
/* the Ctrl+K search box fills its window: a line in the focus colour under it instead of a ring (ROADMAP F107) */
.site-search-input:focus-visible { outline: none; border-bottom-color: var(--focus); box-shadow: inset 0 -2px 0 var(--focus); }

.site-search-results { flex: 1; margin: 0; padding: 6px; list-style: none; overflow-y: auto; }

.site-search-section {
    padding: 8px 10px 4px;
    color: var(--ink-faint);
    font-size: calc(14px * var(--text-scale, 1));
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.site-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.site-search-item[aria-selected="true"] { background-color: var(--accent-soft); }
.site-search-item .coin-name { font-weight: 600; }
.site-search-name { margin-inline-start: 8px; color: var(--ink-dim); font-weight: 400; }
.site-search-sub { margin-inline-start: auto; color: var(--ink-faint); font-size: var(--fs-meta); white-space: nowrap; }
.site-search-empty { padding: 14px 10px; color: var(--ink-faint); }

.site-search-hint {
    margin: 0;
    padding: 8px 14px;
    color: var(--ink-faint);
    font-size: calc(14.5px * var(--text-scale, 1));
    border-top: 1px solid var(--border-soft);
}

/* a laptop-wide screen: the menu bar (eight groups since News & Events, ROADMAP F82) and the visitor's Pricing /
   Sign in / Sign up keep to one line - tighter links */
@media (min-width: 992px) and (max-width: 1439.98px) {
    .navbar .nav-link { padding: 7px 7px; font-size: calc(16px * var(--text-scale, 1)); }
    .navbar-nav .dropdown-toggle::after { margin-inline-start: 3px; }
}
/* an admin's bar has one group more (Admin): on a 1280 / 1366 laptop it ran 70px past the screen and the whole page
   scrolled sideways (2026-10-30), so there the groups lose their arrows, as every bar does below 1200px */
@media (min-width: 1200px) and (max-width: 1439.98px) {
    .navbar-nav:has(> .nav-admin) .dropdown-toggle::after { display: none; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar .nav-link { padding: 6px 4px; font-size: calc(14px * var(--text-scale, 1)); }
    .navbar-nav .dropdown-toggle::after { display: none; }   /* the bar keeps to one line with the bigger text (2026-10-12) */
    .navbar .navbar-brand { margin-inline-end: 8px; font-size: calc(17.5px * var(--text-scale, 1)); }
    .navbar:not(.navbar-guest) .nav-install { display: none; }
}
/* the visitor's bar (Pricing, the language, the theme, Sign in, Sign up free) was wider than a laptop screen and moved
   the whole page sideways (owner, 2026-10-24); leaving the theme and Sign in off hid them (owner, 2026-10-25: "i can't
   see the login button ... i can't even see the theme button"). So from 992px Pricing, Install app, the language and
   the theme fold into a menu of their own (the burger by Sign in; on every wide screen, as the Arabic bar still ran
   wider than 1920px), Sign in and Sign up stay on the bar, shortened where the bar is tightest
   (Sign up free to Sign up; in Arabic Sign in to its one word). Elsewhere
   the menu's panel is display: contents: the items stand on the bar (below 992px the folded bar wraps them) */
.navbar-guest .guest-more, .navbar-guest .guest-extras { display: contents; }
.navbar-guest .guest-more-toggle { display: none; }
.navbar .signup-short { display: none; }
@media (min-width: 992px) {
    .navbar-guest .guest-more { display: block; position: relative; }
    .navbar-guest .guest-more-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--ctl-h);
        height: var(--ctl-h);
        padding: 0;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
    }
    .navbar-guest .guest-more-toggle .navbar-toggler-icon { width: 20px; height: 20px; }
    .navbar-guest .guest-more-toggle:hover, .navbar-guest .guest-more-toggle[aria-expanded="true"] { background-color: var(--panel-2); }
    .navbar-guest .guest-extras { display: none; min-width: 200px; padding: 6px; }
    .navbar-guest .guest-extras.show { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
    .navbar-guest .guest-extras > .nav-link, .navbar-guest .guest-extras > #theme_toggle {
        padding: 8px 12px;
        font-size: var(--fs-ctl);
        font-weight: 400;
        color: var(--ink);
        text-align: start;
        justify-content: flex-start;
        background: transparent;
        border: 0;
        border-radius: var(--radius-sm);
    }
    .navbar-guest .guest-extras > .nav-link:hover, .navbar-guest .guest-extras > #theme_toggle:hover { background-color: var(--panel-2); }
    .navbar-guest .nav-signin { padding: 6px 10px; white-space: nowrap; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar-guest .signup-long { display: none; }
    .navbar-guest .signup-short { display: inline; }
}
@media (min-width: 992px) and (max-width: 1099.98px) {
    .navbar-guest .nav-link { padding: 6px 3px; }
    .navbar-guest .navbar-brand { margin-inline-end: 4px; }
}
@media (min-width: 992px) and (max-width: 1059.98px) {   /* Sign in back on the narrowest bar (measured, Arabic too) */
    .navbar-guest .nav-link { padding: 6px 1px; font-size: calc(13px * var(--text-scale, 1)); }
    .navbar-guest .nav-signin { padding: 6px 7px; }
    .navbar a.btn-accent.access-signup { padding: 0 9px; }
    .navbar-guest .navbar-collapse > .d-flex { gap: 6px !important; }
}
@media (min-width: 1200px) and (max-width: 1319.98px) {
    .navbar-guest .nav-link { padding: 6px 4px; font-size: calc(14px * var(--text-scale, 1)); }
    .navbar-guest .navbar-nav .dropdown-toggle::after { display: none; }
}

@media (max-width: 991.98px) {
    .navbar .navbar-collapse > .d-flex { flex-wrap: wrap; }
    dialog.site-search { margin-top: 16px; }
    /* the Account menu is end-aligned for the wide bar; folded, its name sits at the start, so the menu opens from
       there and fits the screen (owner, 2026-10-23: it opened off the left edge on a phone) */
    .navbar .nav-hover > .dropdown-menu-end { inset-inline-start: 0; inset-inline-end: auto; }
    .navbar .menu-panel { max-width: calc(100vw - 32px); }
}

/* ---------------- side menu (templates/side_menu.html, owner 2026-11-22) ----------
   The pages of the open page's group beside the page, like CoinMarketCap's; folded: icons only (js/side_menu.js).
   Wide screens only, so the wide tables keep their room (tests/smoke/test_tables_fit.py): none under 1400 px (laptops,
   phones: the top menu and the tab bar); its fold button leaves only the icons whenever the user wants (js/side_menu.js:
   kept per browser; with no choice yet, folded under 1600 px). */
.side-menu { display: none; }
@media (min-width: 1400px) {
    .side-layout { display: flex; align-items: flex-start; }
    .side-layout > main { flex: 1 1 auto; min-width: 0; }
    .side-menu {
        display: block; flex: 0 0 236px; width: 236px;
        position: sticky; top: 0; max-height: 100vh; overflow-y: auto;
        padding: 14px 10px 24px; border-inline-end: 1px solid var(--border); background: var(--surface);
    }
    .side-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 4px 8px 10px; }
    .side-menu-title { color: var(--ink-faint); font-size: var(--fs-meta); font-weight: 600; text-transform: uppercase;
                       letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .side-menu-fold { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
                      border: 0; border-radius: 8px; background: transparent; color: var(--ink-dim); }
    .side-menu-fold:hover { background: var(--panel-2); color: var(--ink); }
    /* bigger (owner, 2026-11-22: "increase the size of the folding icon") */
    .side-menu-fold svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; }
    .side-menu-foot { display: flex; justify-content: flex-end; margin: 10px 4px 0; padding-top: 8px; border-top: 1px solid var(--border); }
    [dir="rtl"] .side-menu-fold svg { transform: scaleX(-1); }
    .side-menu-heading { margin: 14px 10px 4px; color: var(--ink-faint); font-size: var(--fs-meta); font-weight: 600; }
    .side-menu-line { margin: 8px 10px; border-color: var(--border); opacity: 1; }
    .side-menu-list { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--border); margin-inline-start: 10px; }
    .side-menu-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin-block: 1px; margin-inline-start: 6px; border-radius: 8px;
                      color: var(--ink-dim); text-decoration: none; font-weight: 500; }
    .side-menu-item:hover { color: var(--ink); background: var(--panel-2); }
    .side-menu-item.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
    .side-menu-item .menu-icon { width: calc(17px * var(--text-scale, 1)); height: calc(17px * var(--text-scale, 1)); flex: 0 0 auto;
                                 fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .side-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* folded (the button, any time): the icons-only rail, the names in the tips */
@media (min-width: 1400px) {
    [data-side-fold] .side-menu { flex-basis: 58px; width: 58px; padding-inline: 6px; }
    [data-side-fold] .side-menu-head,
    [data-side-fold] .side-menu-foot { justify-content: center; margin-inline: 0; }
    [data-side-fold] .side-menu-title,
    [data-side-fold] .side-menu-heading,
    [data-side-fold] .side-menu-label { display: none; }
    [data-side-fold] .side-menu-fold svg { transform: scaleX(-1); }
    [dir="rtl"][data-side-fold] .side-menu-fold svg { transform: none; }
    [data-side-fold] .side-menu-list { border: 0; margin-inline-start: 0; }
    [data-side-fold] .side-menu-item { justify-content: center; margin-inline: 0; padding-inline: 0; }
}
@media print { .side-menu { display: none !important; } }

/* ---------------- footer menu (templates/footer.html) ---------- */

footer.site-footer {
    margin-top: 40px;
    padding: 26px 16px 18px;
    background-color: var(--panel);
    border-top: 1px solid var(--border);
    color: var(--ink-faint);
    font-size: var(--fs-meta);
}

.site-footer-inner { max-width: 1400px; margin: 0 auto; }

.site-footer-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 18px 24px;
}

.site-footer-menu h2 {
    margin: 0 0 8px;
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.site-footer-menu ul { list-style: none; margin: 0; padding: 0; }
.site-footer-menu li { margin: 0 0 6px; }
.site-footer-menu a { color: var(--ink-dim); font-size: calc(16px * var(--text-scale, 1)); }
.site-footer-menu a:hover { color: var(--ink); }

.site-footer-note { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.navbar .dropdown-divider { border-color: var(--border); }
/* small headings inside a long dropdown (ROADMAP F122: Markets > Coins / Whole market / Futures / News) */
.navbar .dropdown-header { color: var(--ink-faint); font-size: var(--fs-label); font-weight: 600; letter-spacing: .06em;
                           text-transform: uppercase; padding: 6px 16px 2px; }

/* ---------------- form controls ------------------------------- */

/* Text levels (ROADMAP F130): title (h1), section heading (h2), label, value, note - each its own size, weight and
   colour. A label is the field's name: --ink, bold. A note explains: --fs-note, --ink-faint, never boxed
   (.note / .field-hint / .si-note, components.css). */
label { color: var(--ink); font-size: var(--fs-label); }

/* A field to type in or pick from (F130): darker than its card, a clear border, the value in --ink */
select,
textarea,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"]:not(.site-search-input),
.form-control,
.form-select {
    appearance: none;
    padding: var(--ctl-pad);
    min-height: var(--ctl-h);
    color: var(--ink);
    background-color: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--fs-ctl);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus { color: var(--ink); background-color: var(--field-bg); }
/* an empty field's example text is lighter than a value, so "none" never reads as a setting */
::placeholder { color: var(--ink-faint); opacity: 1; }
/* the date / time pickers' calendar icon in the theme's colour */
[data-bs-theme="dark"] input[type="date"], [data-bs-theme="dark"] input[type="time"],
[data-bs-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }

/* a field that must be filled: a red star after its label (label.is-required); a value the browser refuses after
   the user typed it: a red border (F130) */
label.is-required::after, legend.is-required::after { content: " *"; color: var(--down-ink); }
input:user-invalid, select:user-invalid, textarea:user-invalid, [aria-invalid="true"] { border-color: var(--down-ink); }
/* a setting changed from the page's default (static/js/field_changed.js, forms with data-mark-changed): a bar in
   the accent colour on the field's left edge */
.is-changed:is(select, input, textarea) { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
label.field-inline.is-changed { color: var(--ink); font-weight: 600; }

select {
    padding-inline-end: 30px;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
                      linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
    background-position: calc(100% - 16px) calc(50% + 2px), calc(100% - 11px) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

select:hover:not(:disabled),
textarea:hover:not(:disabled),
input:is([type="text"], [type="number"], [type="date"], [type="email"], [type="password"]):hover:not(:disabled) { border-color: var(--field-border-hover); }

/* Keyboard focus (ROADMAP F107): one solid outline in --focus (3:1 on every background, both themes) on everything
   reached with Tab, Bootstrap's parts included (their own fainter ring is replaced). :focus-visible = keyboard only,
   a mouse click shows nothing. Inside scrolling areas the ring sits just inside the edge so it is not cut off. */
:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.navbar-toggler:focus-visible,
.btn-close:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    box-shadow: none;
}
select:focus-visible,
input:focus-visible,
textarea:focus-visible { border-color: var(--accent); }
.si-chart:focus-visible,
.cm-list:focus-visible,
.cm-list :focus-visible,
.table-wrap :focus-visible,
.dropdown-menu :focus-visible,
.site-search-results :focus-visible { outline-offset: -2px; }

/* "Skip to content" (ROADMAP F107): the first thing on every page, shown when the keyboard reaches it; jumps to
   <main id="main"> (base.html) past the menu bar and the price strip */
.skip-link {
    position: absolute;
    top: -80px;
    inset-inline-start: 12px;
    z-index: 2000;
    padding: 8px 14px;
    color: var(--link);
    background-color: var(--panel);
    border: 2px solid var(--focus);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible { top: 10px; outline: none; }
#main:focus { outline: none; }

input[type="checkbox"] { accent-color: var(--accent); }

/* ---------------- buttons ------------------------------------- */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--ctl-pad);
    min-height: var(--ctl-h);
    color: var(--ink);
    background-color: var(--panel-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--fs-ctl);
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .06s ease;
}

button:hover  { background-color: var(--panel-2); border-color: var(--ink-faint); }
button:active { transform: translateY(1px); }

button.btn-accent,
a.btn-accent {
    color: var(--accent-ink);
    background-color: var(--accent);
    border: 1px solid var(--accent);
    font-weight: 600;
}

button.btn-accent:hover,
a.btn-accent:hover { filter: brightness(1.08); border-color: var(--accent); color: var(--accent-ink); }

/* Bootstrap buttons that appear inside our chrome */
.navbar .btn-primary,
.btn-primary, .btn-secondary, .btn-warning, .btn-danger, .btn-close {
    min-height: var(--ctl-h);
    font-size: var(--fs-ctl);
}

/* Bootstrap's own blue follows the theme style (ROADMAP F133): the main button and a ticked box in --accent */
.btn-primary {
    --bs-btn-color: var(--accent-ink);
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: var(--accent-ink);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-color: var(--accent-ink);
    --bs-btn-active-bg: var(--accent);
    --bs-btn-active-border-color: var(--accent);
    --bs-btn-disabled-color: var(--accent-ink);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

.navbar .btn-primary {
    color: var(--ink);
    background-color: transparent;
    border: 1px solid var(--border);
}

.navbar .btn-primary:hover {
    filter: none;
    color: var(--ink);
    background-color: var(--panel-2);
    border-color: var(--ink-faint);
}

/* ---------------- small shared helpers (kept from style.css) -- */

.hidden_tag    { display: none; }

.disabled-link { pointer-events: none; cursor: not-allowed; opacity: .55; }

.space-right   { margin-inline-end: 10px; }

.action-buttons { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }

hr {
    height: 1px;
    margin: 14px 0;
    border: 0;
    background-color: var(--border);
    opacity: 1;
}

/* ---------------- scrollbars --------------------------------- */

/* its own colour, not --panel-3: that one is the page's own shade, so the bar did not show (owner, 2026-10-24) */
* { scrollbar-color: var(--scrollbar) transparent; }

::-webkit-scrollbar             { width: 12px; height: 12px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: var(--scrollbar); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ---------------- responsive scale ---------------------------- */

/* Tablet and below: keep data legible, grow the tap targets. */
@media (max-width: 992px) {
    :root {
        --fs-body:  calc(17px * var(--text-scale, 1));
        --fs-ctl:   calc(17px * var(--text-scale, 1));
        --fs-data:  calc(16px * var(--text-scale, 1));
        --fs-label: calc(15px * var(--text-scale, 1));
        --ctl-h:    calc(42px * var(--text-scale, 1));
    }

    /* the navbar's right-hand cluster drops below the links */
    .navbar .navbar-collapse > .d-flex { margin-top: 10px; }
}

/* Phones: 16px inputs so iOS Safari does not zoom on focus. */
@media (max-width: 576px) {
    :root {
        --fs-body:  calc(17px * var(--text-scale, 1));
        --fs-ctl:   calc(18px * var(--text-scale, 1));
        --fs-data:  calc(16px * var(--text-scale, 1));
        --fs-label: calc(15px * var(--text-scale, 1));
        --fs-meta:  calc(15px * var(--text-scale, 1));
        --ctl-h:    calc(44px * var(--text-scale, 1));
        --ctl-pad:  10px 12px;
        --gap:      8px;
    }

    /* full-width controls read better than a cramped row */
    .navbar .navbar-collapse > .d-flex { width: 100%; }
    .navbar .navbar-collapse > .d-flex > form,
    .navbar .navbar-collapse > .d-flex > form > button,
    .navbar .navbar-collapse > .d-flex > button { flex: 1 1 auto; }

    /* nav links get finger-sized rows when the menu is open */
    .navbar .nav-link { padding: 11px 12px; }
}

/* Coarse pointers (touch) at any width still get big targets. */
@media (pointer: coarse) {
    :root { --ctl-h: calc(44px * var(--text-scale, 1)); }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* print / PDF layout (ROADMAP F109): the header and footer lines exist only on paper (print.css shows them) */
.print-only { display: none; }
