/* ==========================================================================
   Exchange panel — hand-written CSS, no build step.

   Layout uses logical properties (inline-start/end rather than left/right) so
   the same rules serve both the Persian RTL layout and the Turkish/English
   LTR one, without a mirrored stylesheet.
   ========================================================================== */

:root {
    /* Surfaces — cards sit slightly above a near-black navy page. */
    --bg:            #081120;
    --bg-elevated:   #0B1728;
    --surface:       #101F38;
    --surface-muted: #16263F;
    --surface-hover: #1A2C48;
    /* Translucent surface for glass cards sitting over a blurred backdrop. */
    --surface-glass: rgba(16, 31, 56, 0.55);

    /* Text.
       The historical names are kept because they are used in a hundred places;
       what changed is that "on-light" now means "on a card", and a card is
       dark. Measured against #101F38: primary 12.1:1, muted 5.4:1. */
    --text-on-dark:        #E9EFF8;
    --text-on-dark-muted:  #93A7C4;
    --text-on-light:       #E9EFF8;
    --text-on-light-muted: #93A7C4;

    /* Accents. Gold carries active state, as in the reference design. */
    --accent:      #E0A22B;
    --accent-soft: rgba(224, 162, 43, 0.14);
    --accent-ink:  #241800;
    --info:        #3987e5;
    --buy:         #3987e5;
    --sell:        #E0A22B;
    --good:        #199e70;
    --danger:      #f43f5e;

    /* Lines and depth. On a dark theme, separation comes from hairlines
       rather than shadows — a drop shadow on a dark surface reads as nothing. */
    --border:       rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --border-dark:  rgba(255, 255, 255, 0.07);
    --shadow-card:  0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --shadow-raise: 0 8px 30px rgba(0, 0, 0, 0.45);

    /* Shape and rhythm */
    --radius:       14px;
    --radius-sm:    9px;
    --radius-pill:  999px;
    --gap:          18px;
    --page-max:     1400px;

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.lang-fa {
    --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text-on-dark);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    /* Latin digits in every language, by design. */
    font-variant-numeric: lining-nums tabular-nums;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, figure {
    margin: 0;
}

ul {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    color: inherit;
}

svg {
    display: block;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */

.page {
    max-width: var(--page-max);
    margin-inline: auto;
    padding: var(--gap) clamp(14px, 3vw, 28px) 56px;
    display: grid;
    /* Grid items default to min-width:auto, so a single `auto` column would
       stretch to fit the widest content — the nowrap table — and push every
       card off-screen on a narrow viewport. Capping the column at the
       container width keeps horizontal scrolling inside the table, which is
       where it belongs. */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
    background: var(--bg-elevated);
    border-block-end: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Customer branding
   -------------------------------------------------------------------------- */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-inline-size: 0;
}

.brand__name {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-on-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    unicode-bidi: plaintext;
}

/* The ring is drawn whether or not there is an image, so a customer without a
   logo gets a tidy empty disc rather than a broken-image icon. */
.brand__logo {
    flex: 0 0 auto;
    inline-size: 42px;
    block-size: 42px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: rgba(224, 162, 43, 0.08);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.brand__logo img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    display: block;
}

.topbar__row {
    max-width: var(--page-max);
    margin-inline: auto;
    padding: 12px clamp(14px, 3vw, 28px);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* The top row is laid out in physical terms on purpose: the language switch
   belongs on the left and the section menu on the right in every language, so
   the chrome does not jump around when the user switches. Only this row is
   forced to LTR flow; each child restores the document's own direction for its
   text. */
.topbar__row--main {
    direction: ltr;
}

[dir="rtl"] .topbar__row--main > * {
    direction: rtl;
}

.topbar__row--filters {
    padding-block-start: 0;
    padding-block-end: 14px;
}

/* The row runs physically: branding is pinned to one edge and the controls to
   the other in every language, with the menu taking the space between. */
.topbar__row--main {
    padding-block: 0;
    gap: 24px;
}

.topbar__start {
    order: 3;
    padding-block: 12px;
}

.topbar__mid {
    order: 2;
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-inline-size: 0;
}

.topbar__end {
    order: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-block: 12px;
}

/* Filters sit at the reading-start edge — the right in Persian, matching the
   reference design, and the left in the other two languages. */
.topbar__row--filters {
    justify-content: flex-start;
    padding-block: 14px;
}

.topbar__title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text-on-dark);
}

/* --------------------------------------------------------------------------
   Language switch
   -------------------------------------------------------------------------- */

/* A single box showing the current language, opening to the alternatives.
   Built on <details>, so it needs no JavaScript and stays keyboard-operable. */
.langpick {
    position: relative;
}

.langpick__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on-dark);
    background: var(--surface);
    cursor: pointer;
    white-space: nowrap;
    list-style: none;
    transition: border-color 0.15s;
}

/* Hide the native disclosure triangle in every engine. */
.langpick__toggle::-webkit-details-marker { display: none; }
.langpick__toggle::marker { content: ""; }

.langpick__toggle:hover {
    border-color: var(--accent);
}

.langpick__toggle svg {
    inline-size: 15px;
    block-size: 15px;
    color: var(--text-on-dark-muted);
    flex: 0 0 auto;
}

.langpick__chev {
    transition: transform 0.15s;
}

.langpick[open] .langpick__chev {
    transform: rotate(180deg);
}

.langpick__menu {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    inset-inline-start: 0;
    min-inline-size: 100%;
    z-index: 20;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raise);
    display: grid;
    gap: 2px;
}

.langpick__item {
    display: block;
    padding: 8px 13px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-on-dark-muted);
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}

.langpick__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-dark);
}

.langpick__item.is-active {
    color: var(--accent);
    font-weight: 600;
}

/* The login page has no dark header to sit against, so the switch there is a
   plain row of links inside the card. */
.langrow {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-block-end: 22px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}

.langrow__item {
    flex: 1 1 0;
    text-align: center;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on-light-muted);
    transition: background-color 0.15s, color 0.15s;
}

.langrow__item:hover {
    color: var(--text-on-light);
    background: rgba(255, 255, 255, 0.05);
}

.langrow__item.is-active {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Section menu
   -------------------------------------------------------------------------- */

.sections {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

/* Label plus icon, with the active item marked by a gold underline rather
   than a filled pill — the treatment in the reference design. */
.sections__item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-on-dark-muted);
    transition: color 0.15s;
}

.sections__item svg {
    inline-size: 18px;
    block-size: 18px;
    flex: 0 0 auto;
}

.sections__item:not(.is-disabled):hover {
    color: var(--text-on-dark);
}

.sections__item.is-active {
    color: var(--text-on-dark);
    font-weight: 600;
}

.sections__item.is-active::after {
    content: "";
    position: absolute;
    inset-inline: 8px;
    inset-block-end: 0;
    block-size: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--accent);
}

.sections__item.is-active svg {
    color: var(--accent);
}

/* Disabled sections stay visible so the menu shows what is coming, but read as
   clearly inactive. The "coming soon" wording lives in the title attribute
   rather than a badge, which would triple the width of the menu. */
.sections__item.is-disabled {
    color: rgba(167, 184, 212, 0.42);
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Account
   -------------------------------------------------------------------------- */

.account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.account__name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-on-dark-muted);
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.account__logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on-dark);
    padding: 8px 13px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.account__logout svg {
    inline-size: 15px;
    block-size: 15px;
    flex: 0 0 auto;
}

.account__logout:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Range filter
   -------------------------------------------------------------------------- */

.rangefilter {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rangefilter__label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(167, 184, 212, 0.75);
    margin-inline-end: 6px;
}

.rangefilter__item {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on-dark-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.rangefilter__item:hover {
    color: var(--text-on-dark);
    border-color: var(--border-strong);
}

.rangefilter__item.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    color: var(--text-on-light);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 24px 48px -20px rgba(0, 0, 0, 0.65);
    /* Never let a wide child (the table) stretch the card past its column. */
    min-inline-size: 0;
    max-inline-size: 100%;
}

.card__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-on-light-muted);
}

/* Gold, as in the reference design: the subtitle states what slice of the data
   is on screen, which is worth noticing rather than fading into the card. */
.card__hint {
    font-size: 12.5px;
    color: var(--accent);
    margin-block-start: 3px;
}

/* Marks a figure that deliberately ignores the date-range filter, so the
   reader is not left wondering why it does not move with the others. */
.card__badge {
    display: inline-block;
    margin-inline-start: 7px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-on-light-muted);
    letter-spacing: 0;
    vertical-align: middle;
    white-space: nowrap;
}

.card__head {
    margin-block-end: 14px;
}

/* Stat cards ------------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap);
}

/* Icon badge on one edge, label and figure on the other — the arrangement in
   the reference design. */
.card--stat {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
}

/* A coloured edge marks the card the eye should land on first. It sits at the
   reading-start edge, so the eye meets it before the label. */
.card--stat::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: transparent;
}

/* Buy is the one tone in the reference design whose whole card tints, not
   just the edge bar — a soft blue wash against the neutral glass wash every
   other card gets. */
.card--buy {
    background: linear-gradient(150deg, rgba(70, 120, 200, 0.16), rgba(255, 255, 255, 0.02));
}

.card--accent::after { background: linear-gradient(180deg, #ffc266, var(--accent)); box-shadow: 0 0 20px 2px rgba(224, 162, 43, 0.7); }
.card--buy::after    { background: linear-gradient(180deg, #66a3ff, var(--buy));    box-shadow: 0 0 20px 2px rgba(72, 140, 235, 0.7); }
.card--sell::after   { background: linear-gradient(180deg, #ffc266, var(--sell));   box-shadow: 0 0 20px 2px rgba(224, 162, 43, 0.7); }
/* Green only on the Customers pages: elsewhere a "good" card is deliberately
   left without an edge, so that it does not compete with its neighbours. */
.clientsmain .card--good::after { background: linear-gradient(180deg, #4fd6a4, var(--good));   box-shadow: 0 0 20px 2px rgba(25, 158, 112, 0.7); }

.card__statbody {
    min-inline-size: 0;
}

.card__unit {
    display: block;
    font-size: 12px;
    color: var(--text-on-light-muted);
    margin-block-start: 2px;
}

/* Circular icon holder. */
.staticon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    inline-size: 46px;
    block-size: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
    color: var(--info);
}

.staticon--accent { color: var(--accent); background: rgba(224, 162, 43, 0.14); }
.staticon--buy    { color: var(--buy);    background: rgba(72, 140, 235, 0.16); }
.staticon--sell   { color: var(--sell);   background: rgba(224, 162, 43, 0.14); }
.staticon--good   { color: var(--good);   background: rgba(25, 158, 112, 0.16); }

.staticon svg {
    inline-size: 22px;
    block-size: 22px;
}

.card__value {
    font-size: clamp(28px, 4vw, 34px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-block-start: 6px;
    /* The digits are a single isolated run, so "1,767,054" always reads
       left-to-right. Direction is deliberately NOT forced to ltr: that would
       make `start` mean "left" and strand the number on the opposite side of
       the card from its label in the RTL layout. */
    unicode-bidi: isolate;
    text-align: start;
}

/* A gold weight («۱۴ گرم و ۲۴۰ سوت»): one line, the figures carry the size. */
.card__value--weight {
    white-space: nowrap;
    font-size: clamp(22px, 2.4vw, 30px);
}

.card__wunit {
    font-size: 0.5em;
    font-weight: 600;
    color: var(--text-on-dark-muted, inherit);
    letter-spacing: 0;
}

/* One card alone in its row, and a pair — used by the tickets profit figure
   and the two debt counts. */
.cards--single {
    grid-template-columns: minmax(0, 1fr);
}

/* Several currency amounts inside one card__value (tickets profit) — never
   added together, so each keeps its own unit and the two are visually split
   rather than looking like one combined number. */
.card__value--list {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 14px;
}

.card__value-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    /* Each amount is its own bidi run so a Persian unit word right next to
       Latin digits never drags the digit order or grouping commas around. */
    unicode-bidi: isolate;
}

.card__unit--inline {
    display: inline;
    margin-block-start: 0;
}

.card__value-sep {
    align-self: stretch;
    inline-size: 1px;
    min-block-size: 1.3em;
    background: var(--border);
}

.cards--pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Profit card: green edge bar and a faint green wash, like the buy card's blue. */
.card--profit {
    background: linear-gradient(150deg, rgba(25, 158, 112, 0.14), rgba(255, 255, 255, 0.02));
}

.card--profit::after {
    background: linear-gradient(180deg, #4fd1a1, var(--good));
    box-shadow: 0 0 20px 2px rgba(25, 158, 112, 0.6);
}

/* Section heading -------------------------------------------------------- */

/* Titles a group of cards on a page that holds more than one group (the Trades
   page: one-way and two-way). Icon chip, title, then a hairline that fades out
   across the rest of the row. Logical properties only, so it mirrors with the
   language direction. */
.sectionhead {
    display: flex;
    align-items: center;
    gap: 12px;
    /* `.page` is a grid with its own row gap; these margins only add to it. */
    margin-block: 14px 0;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
}

.sectionhead:first-child {
    margin-block-start: 0;
}

.sectionhead__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    inline-size: 36px;
    block-size: 36px;
    border-radius: 11px;
    color: var(--accent);
    background: rgba(224, 162, 43, 0.14);
    border: 1px solid rgba(224, 162, 43, 0.28);
}

.sectionhead__icon svg {
    inline-size: 20px;
    block-size: 20px;
}

.sectionhead__title {
    flex: 0 0 auto;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.sectionhead::after {
    content: "";
    flex: 1 1 auto;
    block-size: 1px;
    background: linear-gradient(to right, rgba(224, 162, 43, 0.45), rgba(224, 162, 43, 0));
}

[dir="rtl"] .sectionhead::after {
    background: linear-gradient(to left, rgba(224, 162, 43, 0.45), rgba(224, 162, 43, 0));
}

/* Profit figures in the two-way table. */
.table .col--profit {
    color: #4fd1a1;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Balances page

   Visual spec (colours, gradients, spacing, corner radii) ported from a
   Claude Design mockup the user built for this page, rather than reusing
   the flatter `.card`/`.card--stat` system the rest of the app uses —
   every value below is deliberate, not a rounding of an existing token.
   -------------------------------------------------------------------------- */

.balances__heading {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-block-end: 18px;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
}

.balances__heading svg {
    color: var(--accent);
    inline-size: 20px;
    block-size: 20px;
}

.cards--balances {
    /* --balcols is set inline from the number of cards the customer has. */
    grid-template-columns: repeat(var(--balcols, 5), minmax(0, 1fr));
    gap: 20px;
}

/* Glass currency card: a soft diagonal tint (the per-currency colour fading
   into the dark surface) rather than a flat fill, a heavier blur than the
   rest of the app, a plain translucent hairline border, and a glowing
   accent bar along the bottom edge instead of a coloured border all the
   way round. `--card-tint-a/-b`/`--card-glow` are set per currency below;
   nothing here hardcodes a colour, so the same rule serves all five. */
.balcard {
    position: relative;
    display: flex;
    flex-direction: column;
    inline-size: 100%;
    overflow: hidden;
    text-align: start;
    font: inherit;
    color: var(--text-on-dark);
    padding: 20px 20px 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    background: linear-gradient(150deg, var(--card-tint-a), var(--card-tint-b));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 24px 48px -20px rgba(0, 0, 0, 0.65);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.balcard::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    block-size: 3px;
    background: var(--card-glow);
    box-shadow: 0 0 18px 2px var(--card-glow);
}

.balcard:hover {
    transform: translateY(-2px);
}

.balcard.is-active {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 1px var(--card-glow),
        0 24px 48px -20px rgba(0, 0, 0, 0.65);
}

.balcard--toman { --card-tint-a: rgba(242, 194, 48, 0.28); --card-tint-b: rgba(30, 26, 15, 0.35); --card-glow: #f2c230; }
.balcard--usd   { --card-tint-a: rgba(90, 120, 170, 0.22); --card-tint-b: rgba(18, 24, 38, 0.32);  --card-glow: #6b8fc4; }
.balcard--eur   { --card-tint-a: rgba(30, 58, 140, 0.42);  --card-tint-b: rgba(18, 24, 38, 0.32);  --card-glow: #2f5bc9; }
.balcard--usdt  { --card-tint-a: rgba(38, 161, 123, 0.35); --card-tint-b: rgba(18, 26, 38, 0.35);  --card-glow: #26a17b; }
.balcard--try   { --card-tint-a: rgba(227, 10, 23, 0.3);   --card-tint-b: rgba(20, 26, 40, 0.3);   --card-glow: #e6544f; }
.balcard--aed   { --card-tint-a: rgba(0, 115, 47, 0.34);   --card-tint-b: rgba(18, 26, 38, 0.35);  --card-glow: #00a651; }
.balcard--cny   { --card-tint-a: rgba(222, 41, 16, 0.32);  --card-tint-b: rgba(24, 22, 34, 0.35);  --card-glow: #ffde00; }

/* Name/code opposite the flag at the top. `.balcard__names` is first in
   markup so it lands at the reading-start edge (right, in this RTL app)
   and the flag lands at the opposite edge (left) — matching the reference
   design regardless of which language the panel is showing. */
.balcard__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-block-end: 24px;
    inline-size: 100%;
}

.balcard__flag {
    flex: 0 0 auto;
    inline-size: 42px;
    block-size: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.balcard__flag svg {
    inline-size: 100%;
    block-size: 100%;
    display: block;
}

.balcard__names {
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
}

.balcard__name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.balcard__code {
    margin-block-start: 2px;
    font-size: 12px;
    color: #8b93a7;
    /* The code is always Latin, so it keeps its own LTR run even inside
       an RTL card — "TRY" must never reverse to "YRT". */
    direction: ltr;
    unicode-bidi: isolate;
}

/* The amount stays on the same (right) side as the name above it — this
   block only reserves room at its own opposite (left) edge, physically,
   so the wallet mark below never overlaps a long number. */
.balcard__body {
    position: relative;
    padding-inline-end: 44px;
}

.balcard__value {
    display: block;
    font-size: clamp(18px, 1.6vw, 22px);
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    unicode-bidi: isolate;
}

.balcard__unit {
    display: block;
    margin-block-start: 4px;
    font-size: 13px;
    color: #8b93a7;
}

/* Wallet mark as its own small glass chip, pinned to the card's bottom-left
   corner — not a bare icon floating in the corner. */
.balcard__wallet {
    position: absolute;
    inset-block-end: 0;
    inset-inline-end: 0;
    inline-size: 34px;
    block-size: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #c6cbd6;
}

.balcard__wallet svg {
    inline-size: 17px;
    block-size: 17px;
}

/* Detail table area: full width, sits between the cards and the profit
   section, hidden tables toggled by balances.js. */
.balrow__detail {
    margin-block-start: var(--gap);
}

.balrow__table[hidden] {
    display: none;
}

/* .emptystate sets `display: flex`, which outranks the browser's own
   `[hidden] { display: none }` UA rule — see the identical note by
   .obars .emptystate[hidden] below. balances.js toggles `hidden` on the
   placeholder, so it needs the same override. */
.balrow__detail .emptystate[hidden] {
    display: none;
}

/* Net profit shell: a fixed-width headline card beside the chart, always
   visible regardless of which (if any) currency card is open. The
   headline sits first in markup, so — same reasoning as .balcard__head
   above — it lands at the reading-start edge (right) with the flexible
   chart track to its left. */
.balrow {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 22px;
    margin-block-start: 36px;
    align-items: stretch;
}

/* A quieter glass than the currency cards — a faint white wash rather than
   a coloured tint, since neither box belongs to one specific currency —
   but the same blur/hairline-border/soft-shadow family. */
.balrow__profit,
.balrow__chart {
    position: relative;
    border-radius: 20px;
    padding: 26px 24px 20px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

.balrow__profit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-block-end: 22px;
}

.balrow__profit-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balrow__profit-title span {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.balrow__profit-title svg {
    color: var(--accent);
    inline-size: 19px;
    block-size: 19px;
}

.balrow__chart {
    display: flex;
    flex-direction: column;
}

.balrow__chart-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-block-end: 14px;
}

.balrow__chart .emptystate {
    flex: 1 1 auto;
    inline-size: 100%;
    border-color: var(--border-strong);
}

.balrow__profit-value {
    font-size: 34px;
    font-weight: 800;
    color: #27d3a4;
    margin-block-end: 4px;
    unicode-bidi: isolate;
}

.balrow__profit-unit {
    font-size: 13px;
    color: #8b93a7;
}

.balrow__profit-changes {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.profitchange {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-on-light-muted);
}

.profitchange svg {
    inline-size: 14px;
    block-size: 14px;
    flex-shrink: 0;
}

.profitchange__percent {
    font-weight: 700;
    color: var(--text-on-light-muted);
    unicode-bidi: isolate;
}

.profitchange--up .profitchange__percent,
.profitchange--up svg {
    color: var(--good);
}

.profitchange--down .profitchange__percent,
.profitchange--down svg {
    color: var(--danger);
}

.balrow__profit-report {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.balrow__profit-report:hover {
    background: var(--accent);
    color: var(--accent-ink);
}

.balrow__profit-report svg {
    inline-size: 14px;
    block-size: 14px;
    color: currentColor;
}

@media (max-width: 900px) {
    .balrow {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* A stat card beside a chart: the figure stays compact and the plot takes the
   room it needs. */
.summaryrow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
    gap: var(--gap);
    align-items: stretch;
}

/* Charts ----------------------------------------------------------------- */

.charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
}

/* A cartesian plot sizes by its container rather than by an aspect ratio, so
   the line and bar charts keep a sensible height on every width. */
.plot {
    position: relative;
    block-size: 240px;
    min-inline-size: 0;
    margin-block-start: 14px;
}

/* Horizontal bars need height per bar, not a fixed box. */
.plot--bars {
    block-size: 210px;
}

/* One chart on the page. The card spans the full width so it lines up with the
   table beneath it, but the canvas keeps its usual diameter — a lone doughnut
   scaled to fill the row would dwarf everything else. The chart and its legend
   are centred as a pair so the leftover width reads as deliberate margin
   rather than as an empty half. */
.charts--single {
    grid-template-columns: minmax(0, 1fr);
}

.charts--single .chart {
    justify-content: center;
    gap: 40px;
}

.charts--single .legend {
    flex: 0 1 420px;
}

.card--chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
}

.chart {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.chart__canvas {
    position: relative;
    inline-size: 210px;
    block-size: 210px;
    flex: 0 0 auto;
}

.chart__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
    text-align: center;
    padding-inline: 30px;
}

.chart__total {
    font-size: clamp(14px, 1.7vw, 19px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    direction: ltr;
    unicode-bidi: isolate;
    overflow-wrap: anywhere;
}

.chart__totallabel {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-on-light-muted);
}

/* Legend ----------------------------------------------------------------- */

.legend {
    flex: 1 1 180px;
    display: grid;
    gap: 9px;
    align-content: center;
}

.legend__item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}

.legend__swatch {
    inline-size: 11px;
    block-size: 11px;
    border-radius: 3px;
    flex: 0 0 auto;
    background: var(--border);
}

.legend__name {
    flex: 1 1 auto;
    font-weight: 500;
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Persian names next to an English interface. `plaintext` orders the glyphs
       by the text's own direction, while the physical text-align keeps the name
       against the page's own start edge — dir="auto" would do the first but
       flip the second, stranding the name away from its colour swatch. */
    unicode-bidi: plaintext;
    text-align: left;
}

[dir="rtl"] .legend__name {
    text-align: right;
}

.legend__percent {
    font-weight: 600;
    color: var(--text-on-light-muted);
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    min-inline-size: 4.2em;
    text-align: end;
}

/* The cargo legend also carries the amount, since "how much does this person
   owe" is the question the chart exists to answer — a percentage alone would
   send the reader to the table for every slice. */
.legend__amount {
    font-weight: 600;
    color: var(--text-on-light);
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    text-align: end;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.card--table {
    padding-block-end: 12px;
}

.tablewrap {
    max-block-size: 60vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* A table box sized to show exactly 8 body rows under the sticky header; any
   further rows scroll. Row and header heights are fixed so the arithmetic
   holds whether or not a row carries a pill. Doubled selector so the mobile
   `max-block-size: 68vh` rule further down cannot override it. */
.tablewrap.tablewrap--rows8 {
    --th-h: 40px;
    --tr-h: 48px;
    max-block-size: calc(var(--th-h) + 8 * var(--tr-h) + 2px);
}

.tablewrap--rows8 .table thead th {
    block-size: var(--th-h);
    padding-block: 0;
}

.tablewrap--rows8 .table tbody td {
    block-size: var(--tr-h);
    padding-block: 0;
    box-sizing: border-box;
}

.table {
    inline-size: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    white-space: nowrap;
    /* Tables do not inherit colour from their parent in quirks mode — they take
       it from body, which here is near-white and would leave the rows unreadable
       on the white card. Stating it explicitly makes the table immune to
       anything that might push the page out of standards mode. */
    color: var(--text-on-light);
}

.table th,
.table td {
    padding: 10px 14px;
    border-block-end: 1px solid var(--border);
    text-align: start;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-on-light-muted);
    /* The border travels with the sticky header; a plain border would scroll. */
    box-shadow: inset 0 -1px 0 var(--border-strong);
    border-block-end: 0;
}

.table tbody tr:last-child td {
    border-block-end: 0;
}

.table tbody tr:hover td {
    background: var(--surface-hover);
}

/* The date cell carries a small calendar mark, as in the reference design. */
.cellicon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cellicon svg {
    inline-size: 13px;
    block-size: 13px;
    color: var(--text-on-light-muted);
    flex: 0 0 auto;
}

/* Column modifiers.
 *
 * These are all qualified with `.table` on purpose. `.table th, .table td`
 * above sets text-align, and at equal-or-higher specificity it would win over a
 * bare `.col--num`, silently leaving every numeric cell aligned to the start
 * while its header sat at the end. Keeping the modifiers one step more specific
 * than the base rule is what makes them actually apply. */

/* Numeric columns read left-to-right in every language and hug the end edge. */
.table .col--num {
    text-align: end;
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}

.table .col--date {
    direction: ltr;
    unicode-bidi: isolate;
    color: var(--text-on-light-muted);
    text-align: left;
}

[dir="rtl"] .table .col--date {
    text-align: right;
}

/* Free-text cells genuinely mix scripts — Persian names sit beside "walk-in"
   and Turkish labels. `plaintext` orders each value's glyphs by its own
   direction, while the physical alignment keeps the whole column flush against
   the table's start edge so it still reads as a column. */
.table .col--text {
    max-inline-size: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    unicode-bidi: plaintext;
    text-align: left;
}

[dir="rtl"] .table .col--text {
    text-align: right;
}

/* Type pill -------------------------------------------------------------- */

.pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Tinted fills with a matching hairline: on a dark surface a flat tint alone
   reads as a smudge, the outline is what makes it a badge. */
.pill--buy {
    background: rgba(57, 135, 229, 0.16);
    border: 1px solid rgba(57, 135, 229, 0.4);
    color: #8FC0F5;
}

.pill--sell {
    background: rgba(224, 162, 43, 0.14);
    border: 1px solid rgba(224, 162, 43, 0.42);
    color: #EFC077;
}

.pill--other {
    background: rgba(124, 58, 237, 0.16);
    border: 1px solid rgba(124, 58, 237, 0.45);
    color: #C0A9F5;
}

/* Cargo status. Open means money is still owed, so it carries the warmer
   colour; the word itself is what states the meaning, not the hue alone. */
.pill--open {
    background: rgba(224, 162, 43, 0.14);
    border: 1px solid rgba(224, 162, 43, 0.42);
    color: #EFC077;
}

.pill--closed {
    background: rgba(25, 158, 112, 0.16);
    border: 1px solid rgba(25, 158, 112, 0.42);
    color: #6FD3AC;
}

/* Table filter bar --------------------------------------------------------
 *
 * Sits between the card heading and the table itself. Filtering happens
 * client-side against rows already in the DOM (the table is capped at 50
 * server-rendered rows) — there is no submit button, each pick applies right
 * away.
 *
 * Each filter reuses the .langpick "pick" skeleton from the header (see
 * .langpick above) rather than a native <select>: a native option list
 * cannot be themed to match the dark, blurred menus the rest of the
 * dashboard uses, so the toggle/menu/item classes here are deliberately the
 * same shape, just renamed to .tablefilter. */

.tablefilters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-block-end: 14px;
}

.tablefilter {
    display: grid;
    gap: 6px;
    flex: 1 1 170px;
    min-inline-size: 150px;
}

.tablefilter__label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-on-light-muted);
}

.tablefilter__dd {
    position: relative;
}

.tablefilter__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    inline-size: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-on-dark);
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    list-style: none;
    transition: border-color 0.15s;
}

.tablefilter__toggle::-webkit-details-marker { display: none; }
.tablefilter__toggle::marker { content: ""; }

.tablefilter__toggle:hover {
    border-color: var(--accent);
}

.tablefilter__value {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tablefilter__chev {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--text-on-dark-muted);
    transition: transform 0.15s;
}

.tablefilter__chev svg {
    inline-size: 15px;
    block-size: 15px;
}

.tablefilter__dd[open] .tablefilter__chev {
    transform: rotate(180deg);
}

.tablefilter__menu {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 20;
    max-block-size: 260px;
    overflow-y: auto;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raise);
    display: grid;
    gap: 2px;
}

.tablefilter__item {
    display: block;
    padding: 9px 13px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-on-dark-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.15s, color 0.15s;
}

.tablefilter__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-dark);
}

.tablefilter__item.is-active {
    color: var(--accent);
    font-weight: 600;
}

.table td.tablefilters__emptycell {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-on-light-muted);
    font-size: 14px;
    white-space: normal;
}

@media (max-width: 640px) {
    .tablefilter {
        flex: 1 1 45%;
    }
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.emptystate {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fills the space a chart would have taken, so an empty range does not
       leave a card that is mostly blank below the message. */
    flex: 1 1 auto;
    min-block-size: 150px;
    padding: 28px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-on-light-muted);
    font-size: 14px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login {
    min-block-size: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
}

.login__card {
    inline-size: 100%;
    max-inline-size: 400px;
    background: var(--surface);
    color: var(--text-on-light);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-raise);
    padding: 26px 28px 30px;
}

.langswitch--login {
    background: var(--surface-muted);
    border-color: var(--border);
    margin-block-end: 22px;
    inline-size: 100%;
    justify-content: center;
}

.langswitch--login .langswitch__item {
    color: var(--text-on-light-muted);
    flex: 1 1 0;
    text-align: center;
}

.langswitch--login .langswitch__item:hover {
    background: rgba(11, 31, 58, 0.05);
    color: var(--text-on-light);
}

.langswitch--login .langswitch__item.is-active {
    background: var(--accent);
    color: #FFFFFF;
}

.login__brand {
    text-align: center;
    margin-block-end: 22px;
}

.login__mark {
    display: flex;
    justify-content: center;
    margin-block-end: 12px;
}

.login__title {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.login__subtitle {
    font-size: 13.5px;
    color: var(--text-on-light-muted);
    margin-block-start: 5px;
}

.login__form {
    display: grid;
    gap: 15px;
}

.field {
    display: grid;
    gap: 6px;
}

.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-on-light-muted);
}

.field__input {
    inline-size: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-on-light);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.field__input::placeholder {
    color: rgba(147, 167, 196, 0.55);
}

.field__input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
    padding: 12px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.05s;
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    margin-block-start: 4px;
}

.btn--primary:hover {
    background: #EFB44A;
}

.btn--primary:active {
    transform: translateY(1px);
}

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-block-end: 16px;
}

.alert--error {
    background: rgba(244, 63, 94, 0.12);
    color: #FBA6B4;
    border: 1px solid rgba(244, 63, 94, 0.38);
}

/* --------------------------------------------------------------------------
   Order bars

   One <details> per open order. The always-visible part — the name, the two
   figures and the fill — lives inside <summary>, so opening a bar to see who
   paid needs no JavaScript and the live feed can rewrite the numbers
   underneath a bar the reader has left open.
   -------------------------------------------------------------------------- */

.obars {
    display: grid;
    gap: 14px;
    margin-block-end: var(--gap);
}

.obar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.obar__summary {
    display: block;
    cursor: pointer;
    list-style: none;
}
.obar__summary::-webkit-details-marker { display: none; }
.obar__summary::marker { content: ""; }

/* The coloured strip. The gradient is physical rather than logical on purpose:
   it reads as one continuous band across a stack of bars, which it would stop
   doing if it flipped with the text direction. */
.obar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    background: linear-gradient(90deg, #3d6fe0 0%, #5a4ae0 100%);
    color: #FFFFFF;
}

.obar__person {
    font-size: 14.5px;
    font-weight: 600;
    /* The name is a person's, in whatever script; isolate it so it cannot drag
       the label around it. */
    unicode-bidi: isolate;
}

.obar__chev {
    display: inline-flex;
    flex: 0 0 auto;
    transition: transform 0.15s;
    opacity: 0.9;
}
.obar__chev svg { inline-size: 18px; block-size: 18px; }
.obar[open] .obar__chev { transform: rotate(180deg); }

.obar__body {
    display: block;
    padding: 14px 18px 18px;
}

.obar__figures {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-block-end: 11px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-on-light);
}

.obar__figure {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    /* Same reason as .card__value--list: a Persian label beside Latin digits
       beside a Persian unit is three bidi runs, and only isolation keeps the
       grouping commas where they were written. */
    unicode-bidi: isolate;
    white-space: nowrap;
}

.obar__num {
    font-variant-numeric: lining-nums tabular-nums;
}

.obar__unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-on-light-muted);
}

/* The track fills from the inline start, so it grows leftwards in Persian and
   rightwards in Turkish and English without a second rule. */
.obar__track {
    display: block;
    position: relative;
    block-size: 11px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.obar__fill {
    display: block;
    block-size: 100%;
    min-inline-size: 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, #12B981 0%, #34D399 100%);
    /* A polled update moves this; easing it turns a jump into something a
       reader can follow. */
    transition: inline-size 0.6s ease;
    position: relative;
    overflow: hidden;
}

/* The sheen. A soft white band crossing the filled part so a bar that has not
   changed in an hour still reads as live. Physical right-to-left in every
   language, which is what was asked for. */
.obar__fill::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.45) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: obar-sheen 2.4s linear infinite;
}

@keyframes obar-sheen {
    from { transform: translateX(100%); }
    to   { transform: translateX(-100%); }
}

/* Who paid. Hidden until the bar is opened, which <details> handles on its own
   — this only styles it. */
.obar__payers {
    padding: 0 18px 18px;
}

.obar__payerhead {
    margin-block-end: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-on-light-muted);
}

.obar__payerlist {
    display: grid;
    gap: 8px;
}

.obar__payer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 12px 15px;
    border: 1px solid rgba(224, 162, 43, 0.28);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}

.obar__payername {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--accent);
    unicode-bidi: isolate;
}

.obar__payersum {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-size: 13px;
    color: var(--text-on-light-muted);
    unicode-bidi: isolate;
    white-space: nowrap;
}

.obar__nopayers {
    padding: 12px 15px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-on-light-muted);
}

/* The browser's own `[hidden] { display: none }` is a UA rule, so any class
   above that sets `display` outranks it. The feed toggles `hidden` on all three
   of these, and without this they would stay on screen. */
.obars .emptystate[hidden],
.obar__payerlist[hidden],
.obar__nopayers[hidden] {
    display: none;
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
    .topbar__brand {
        display: none;
    }

    .topbar__end {
        flex: 1 1 auto;
        justify-content: flex-end;
    }
}

@media (max-width: 900px) {
    .charts {
        grid-template-columns: minmax(0, 1fr);
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .cards--balances {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* The figure stacks above its chart rather than being squeezed beside it. */
    .summaryrow {
        grid-template-columns: minmax(0, 1fr);
    }

    .balrow {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .cards,
    .cards--pair,
    .cards--balances {
        grid-template-columns: minmax(0, 1fr);
    }

    .chart {
        flex-direction: column;
        gap: 18px;
    }

    .legend {
        inline-size: 100%;
        flex: 1 1 auto;
    }

    /* The single-chart rules above are more specific than the two directly
       above, so they have to be restated here or the desktop centring gap
       survives into the stacked mobile layout. */
    .charts--single .chart {
        gap: 18px;
    }

    .charts--single .legend {
        flex: 1 1 auto;
    }

    .card {
        padding: 18px 16px;
    }

    .tablewrap {
        max-block-size: 68vh;
    }
}

/* --------------------------------------------------------------------------
   Adding, editing and deleting rows (Trades table; Debts will reuse these)

   The three button variants below are also defined in admin.css, which is
   loaded after this file and only on admin pages. The rules are identical, so
   the admin panel is unaffected; they are repeated here because the tenant
   pages never load admin.css.
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn--sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn--ghost {
    background: var(--surface-muted);
    color: var(--text-on-light);
    border: 1px solid var(--border-strong);
}

.btn--ghost:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.btn--danger {
    background: rgba(244, 63, 94, 0.16);
    color: #FBA6B4;
    border: 1px solid rgba(244, 63, 94, 0.45);
}

.btn--danger:hover {
    background: rgba(244, 63, 94, 0.28);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* `.btn` sets `display`, which would otherwise beat the [hidden] attribute the
   row tools toggle. */
.btn[hidden],
.rowtools__hint[hidden],
.alert[hidden],
.field__error[hidden] {
    display: none;
}

.btn .ico {
    display: inline-flex;
}

.btn .ico svg {
    inline-size: 15px;
    block-size: 15px;
}

/* Title on one edge, the row tools on the other. */
.card__head--bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.rowtools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Beside the primary button the shared `margin-block-start` would sit it
   lower than its neighbours. */
.rowtools .btn--primary {
    margin-block-start: 0;
}

.rowtools__hint {
    font-size: 12.5px;
    color: var(--accent);
}

.iconbtn {
    display: inline-grid;
    place-items: center;
    inline-size: 30px;
    block-size: 30px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-on-light);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.iconbtn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.iconbtn svg {
    inline-size: 15px;
    block-size: 15px;
}

.iconbtn--danger {
    color: #FBA6B4;
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.1);
}

.iconbtn--danger:hover {
    border-color: var(--danger);
    background: rgba(244, 63, 94, 0.24);
}

.table .col--actions {
    inline-size: 1%;
    white-space: nowrap;
}

.table .col--actions .iconbtn + .iconbtn {
    margin-inline-start: 6px;
}

/* The checkbox column exists only while choosing rows to delete. */
.table .col--select {
    display: none;
    inline-size: 1%;
    text-align: center;
}

.is-selecting .table .col--select {
    display: table-cell;
}

.col--select input {
    inline-size: 16px;
    block-size: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.is-selecting .table tbody tr:has(input[data-row-select]:checked) td {
    background: rgba(244, 63, 94, 0.1);
}

/* Dialogs ------------------------------------------------------------------- */

.rowdialog {
    inline-size: min(560px, calc(100vw - 32px));
    max-block-size: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text-on-light);
    box-shadow: var(--shadow-raise);
}

.rowdialog--narrow {
    inline-size: min(420px, calc(100vw - 32px));
}

.rowdialog::backdrop {
    background: rgba(4, 9, 18, 0.7);
    backdrop-filter: blur(3px);
}

.rowdialog__form {
    display: grid;
    gap: 15px;
    padding: 22px;
}

.rowdialog__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.rowdialog__text {
    margin: 0;
    line-height: 1.7;
    color: var(--text-on-light-muted);
}

.rowdialog__actions {
    display: flex;
    gap: 10px;
}

.rowdialog__actions .btn--primary {
    margin-block-start: 0;
}

.rowdialog .alert {
    margin-block-end: 0;
}

.rowdialog .fieldrow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

/* Tells the browser to draw its own widgets (the time picker, the date picker,
   scrollbars) dark. The <select> lists are replaced by .dropdown below, because
   the browser's own list cannot be restyled. */
.rowdialog {
    color-scheme: dark;
}

/* Dropdown ------------------------------------------------------------------ */

.dropdown {
    position: relative;
}

/* The real <select> stays in the form (it holds the value that is submitted)
   but is not shown. */
.dropdown__native {
    display: none;
}

.dropdown__btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: start;
    font: inherit;
    cursor: pointer;
}

.dropdown__text {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown__btn.is-placeholder .dropdown__text {
    color: rgba(147, 167, 196, 0.6);
}

.dropdown__chevron {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--text-on-light-muted);
    transition: transform 0.15s;
}

.dropdown__chevron svg {
    inline-size: 16px;
    block-size: 16px;
}

.dropdown.is-open .dropdown__btn {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.dropdown.is-open .dropdown__chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

/* The open list: the same frosted-glass surface as the panel's cards. */
.dropdown__list {
    position: absolute;
    inset-inline: 0;
    inset-block-start: calc(100% + 6px);
    z-index: 30;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-block-size: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: rgba(16, 31, 56, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-raise);
}

.dropdown__list[hidden] {
    display: none;
}

.dropdown.is-up .dropdown__list {
    inset-block-start: auto;
    inset-block-end: calc(100% + 6px);
}

.dropdown__item {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-on-light);
    cursor: pointer;
}

.dropdown__item.is-placeholder {
    color: rgba(147, 167, 196, 0.6);
}

.dropdown__item.is-active,
.dropdown__item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.dropdown__item[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

/* Suggestion list on a text box (rows.js enhanceSuggest): the same glass list
   as .dropdown, the box stays typeable, a chevron opens the whole list. A list
   with columns (products) is a small table with a header row. */
.suggest__toggle {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 4px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border: 0;
    background: none;
    color: var(--text-on-light-muted);
    cursor: pointer;
    transition: transform 0.15s;
}

.suggest__toggle svg {
    inline-size: 16px;
    block-size: 16px;
}

.suggest.is-open .suggest__toggle {
    color: var(--accent);
    transform: rotate(180deg);
}

.suggest__list {
    max-block-size: 260px;
}

.suggest__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.suggest__sub {
    font-size: 12px;
    color: var(--text-on-light-muted);
}

.suggest__list--table {
    min-inline-size: 460px;
    padding-block: 0;
}

.suggest__head,
.suggest__row {
    display: grid;
    grid-template-columns: var(--suggest-grid, minmax(0, 1fr));
    align-items: stretch;
}

/* Ruled like a table: a line under every row and between the columns, every
   cell centred, so the figures of one column sit exactly under each other. */
.suggest__head {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    margin-inline: -6px;
    padding-inline: 6px;
    border-block-end: 1px solid var(--border-strong);
    background: rgba(16, 31, 56, 0.98);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-on-light-muted);
}

.suggest__row {
    margin-inline: -6px;
    padding: 0 6px;
    border-block-end: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0;
}

.suggest__row:last-child {
    border-block-end: 0;
}

.suggest__cell {
    min-inline-size: 0;
    padding: 9px 8px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: isolate;
}

.suggest__cell + .suggest__cell {
    border-inline-start: 1px solid rgba(255, 255, 255, 0.07);
}

.suggest__head .suggest__cell {
    padding-block: 9px 8px;
}

/* A plain heading stays centred when a grouped one makes the row taller. */
.suggest__head > .suggest__cell:not(.suggest__group) {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* A grouped heading (وزن over گرم | سوت): the title, a line, then the
   sub-columns, each as wide as the cells under it. */
.suggest__head .suggest__group {
    display: grid;
    grid-template-rows: auto auto;
    padding: 0;
}

.suggest__group-title {
    padding: 6px 8px 5px;
    border-block-end: 1px solid rgba(255, 255, 255, 0.07);
}

.suggest__group-subs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
}

.suggest__group-subs > span {
    padding: 5px 8px 6px;
}

.suggest__group-subs > span + span {
    border-inline-start: 1px solid rgba(255, 255, 255, 0.07);
}

.suggest__row .suggest__cell:first-child {
    font-weight: 600;
}

/* The dialog's own close button, in its top corner. */
.rowdialog {
    position: relative;
}

.rowdialog__x {
    position: absolute;
    inset-block-start: 14px;
    inset-inline-end: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 32px;
    block-size: 32px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-on-light-muted);
    cursor: pointer;
}

.rowdialog__x:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-on-light);
}

.rowdialog__x svg {
    inline-size: 16px;
    block-size: 16px;
}

.rowdialog__title {
    padding-inline-end: 40px;
}

.datefields {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1.4fr;
    gap: 8px;
}

/* Read-only figures the form works out (two-way trade totals): laid out like
   fields so they line up with the inputs, but visibly not editable. */
.calcbox {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}

.calcbox--pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calcbox__item {
    display: grid;
    gap: 6px;
    min-inline-size: 0;
}

.calcbox__value {
    display: block;
    min-block-size: 22px;
    overflow-wrap: anywhere;
    text-align: end;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-on-light);
    cursor: default;
    user-select: text;
}

.calcbox__value--profit {
    color: #6FD3AC;
}

.calcbox__value--profit.is-loss {
    color: #FBA6B4;
}

@media (max-width: 640px) {
    .calcbox {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Who registered / last edited the row, and what that edit changed.
   Two "event" rows with a coloured badge (blue: registered, amber: edited) and,
   under the edit, one small line per changed field: old value struck through in
   red, new value in green, so what was there and what is there now cannot be
   mixed up. */
.rowmeta {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
}

.rowmeta[hidden] {
    display: none;
}

.rowmeta__row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 13px;
}

.rowmeta__badge {
    flex: 0 0 auto;
    min-inline-size: 84px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-align: center;
}

.rowmeta__row--created .rowmeta__badge {
    background: rgba(59, 130, 246, 0.16);
    color: #8DB8F5;
}

.rowmeta__row--edited .rowmeta__badge {
    background: var(--accent-soft);
    color: var(--accent);
}

.rowmeta__who {
    font-weight: 700;
    color: var(--text-on-light);
    unicode-bidi: plaintext;
}

.rowmeta__time {
    color: var(--text-on-light-muted);
    font-size: 12.5px;
    direction: ltr;
    unicode-bidi: isolate;
}

.rowmeta__changes {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 8px 10px;
    list-style: none;
    border-inline-start: 3px solid var(--accent);
    border-radius: 6px;
    background: rgba(224, 162, 43, 0.06);
}

.rowmeta__change {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12.5px;
}

.rowmeta__field {
    min-inline-size: 84px;
    color: var(--text-on-light-muted);
}

.rowmeta__old,
.rowmeta__new {
    padding: 1px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    unicode-bidi: plaintext;
}

.rowmeta__old {
    background: rgba(244, 63, 94, 0.12);
    color: #FBA6B4;
    text-decoration: line-through;
    text-decoration-color: rgba(251, 166, 180, 0.6);
}

.rowmeta__new {
    background: rgba(25, 158, 112, 0.14);
    color: #6FD3AC;
}

.rowmeta__arrow {
    color: var(--text-on-light-muted);
}

[dir="rtl"] .rowmeta__arrow {
    display: inline-block;
    transform: scaleX(-1);
}

/* Activity page ---------------------------------------------------------- */

.table--activity .col--wide {
    white-space: normal;
    min-inline-size: 260px;
}

.table--activity .col--actions {
    inline-size: 1%;
    white-space: nowrap;
}

.activity__summary {
    font-weight: 600;
    unicode-bidi: plaintext;
}

.activity__changes {
    display: grid;
    gap: 2px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12.5px;
    color: var(--text-on-light-muted);
}

.activity__label {
    color: var(--text-on-light);
}

.activity__tag {
    margin-inline-start: 6px;
    font-size: 11.5px;
    color: var(--accent);
}

.activity__why {
    font-size: 12.5px;
    color: var(--text-on-light-muted);
    white-space: normal;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-block: 14px 4px;
}

.pager__info {
    font-size: 13px;
    color: var(--text-on-light-muted);
    font-variant-numeric: tabular-nums;
}

.datefields--day {
    grid-template-columns: 1.3fr 1fr 1fr;
}

.field__hint {
    font-size: 12px;
    color: var(--text-on-light-muted);
}

.field__error {
    font-size: 12.5px;
    color: #FBA6B4;
}

@media (max-width: 640px) {
    .rowdialog .fieldrow {
        grid-template-columns: minmax(0, 1fr);
    }

    .rowtools {
        inline-size: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   Customers page

   A side menu of its own beside the content: the page has two views (the
   registered list, and the names still waiting to be registered) and they are
   siblings, not filters of one table. The menu sits at the reading-start edge.
   -------------------------------------------------------------------------- */

.clientslayout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
}

.clientsmain {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
    min-inline-size: 0;
}

.sidenav {
    padding: 16px 12px;
}

.sidenav__title {
    font-size: 15px;
    font-weight: 700;
    padding: 2px 8px 12px;
    margin-block-end: 10px;
    border-block-end: 1px solid var(--border-strong);
}

.sidenav__list {
    display: grid;
    gap: 6px;
}

.sidenav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-on-light-muted);
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.sidenav__item svg {
    flex: 0 0 auto;
    inline-size: 18px;
    block-size: 18px;
}

.sidenav__item:hover {
    color: var(--text-on-light);
    background: var(--surface-hover);
}

.sidenav__item.is-active {
    color: var(--accent);
    font-weight: 700;
    background: var(--accent-soft);
    border-color: rgba(224, 162, 43, 0.45);
    box-shadow: inset 3px 0 0 var(--accent);
}

[dir="rtl"] .sidenav__item.is-active {
    box-shadow: inset -3px 0 0 var(--accent);
}

.pagehead {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagehead__icon {
    color: var(--accent);
}

.pagehead__icon svg {
    inline-size: 22px;
    block-size: 22px;
}

.pagehead__title {
    font-size: 18px;
    font-weight: 700;
}

/* Search on one edge and growing, the row tools on the other. */
.clientsbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.searchbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 320px;
    min-inline-size: 0;
}

.searchbar__icon {
    position: absolute;
    inset-inline-start: 13px;
    color: var(--text-on-light-muted);
    pointer-events: none;
}

.searchbar__icon svg {
    inline-size: 17px;
    block-size: 17px;
}

.searchbar__input {
    flex: 1 1 auto;
    min-inline-size: 0;
    padding-inline-start: 40px;
}

.searchbar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.namecell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-inline-size: 100%;
}

.namecell__text {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    inline-size: 28px;
    block-size: 28px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(160deg, #4f8ff0, #2f62c4);
}

.avatar svg {
    inline-size: 16px;
    block-size: 16px;
}

/* The list is paged by the database, so a page is shown whole: a second,
   inner scrollbar under a pager would only hide rows. Doubled selector so the
   mobile `max-block-size` rule cannot override it. */
.tablewrap.tablewrap--paged {
    max-block-size: none;
}

.table .col--index {
    inline-size: 1%;
    color: var(--text-on-light-muted);
    font-variant-numeric: tabular-nums;
}

.field__req {
    color: var(--accent);
}

/* Page numbers on one edge, the page size on the other. */
.pager--numbered {
    justify-content: space-between;
    flex-wrap: wrap;
}

.pager__sizes,
.pager__pages {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pager__sizes .pager__info {
    margin-inline-end: 8px;
}

.pager__num {
    display: inline-grid;
    place-items: center;
    min-inline-size: 34px;
    block-size: 34px;
    padding-inline: 8px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s, background-color 0.15s;
}

.pager__num:hover {
    border-color: var(--accent);
}

.pager__num.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

.pager__num svg {
    inline-size: 15px;
    block-size: 15px;
}

/* The chevron is drawn pointing down; turned, it points to the previous page
   (towards the reading start) or the next one. */
.pager__num--prev svg { transform: rotate(90deg); }
.pager__num--next svg { transform: rotate(-90deg); }
[dir="rtl"] .pager__num--prev svg { transform: rotate(-90deg); }
[dir="rtl"] .pager__num--next svg { transform: rotate(90deg); }

.pager__gap {
    color: var(--text-on-light-muted);
    padding-inline: 2px;
}

@media (max-width: 900px) {
    .clientslayout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The menu becomes a row of two tabs above the content. */
    .sidenav__title {
        display: none;
    }

    .sidenav__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidenav__item.is-active,
    [dir="rtl"] .sidenav__item.is-active {
        box-shadow: none;
    }
}

@media (max-width: 640px) {
    .pager--numbered {
        justify-content: center;
    }
}

/* Customers page, waiting list ------------------------------------------- */

/* Where a waiting name was found, and how many rows there mention it. */
.srctag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    font-size: 12px;
    color: var(--text-on-light-muted);
}

.srctag + .srctag {
    margin-inline-start: 6px;
}

.srctag b {
    color: var(--text-on-light);
    font-variant-numeric: tabular-nums;
}

/* Not registered yet: the same mark as a customer, without the colour. */
.avatar--pending {
    color: var(--text-on-light-muted);
    background: var(--surface-muted);
    border: 1px dashed var(--border-strong);
}

/* Inside a table cell the primary button's shared top margin would push it
   off the row's centre line. */
.table .btn--primary {
    margin-block-start: 0;
}

/* When one field of a row shows an error line the row grows; without this the
   neighbouring field would stretch its input to fill the extra height. */
.rowdialog .fieldrow > .field {
    align-content: start;
}

/* --------------------------------------------------------------------------
   Customers page — one customer's own page
   -------------------------------------------------------------------------- */

/* "Details" beside a row's icon buttons. */
.table .col--actions .rowlink {
    display: inline-block;
    padding: 6px 12px;
    margin-inline-end: 6px;
    vertical-align: middle;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-on-light-muted);
}

.crumbs svg {
    inline-size: 17px;
    block-size: 17px;
}

.crumbs a:hover {
    color: var(--accent);
}

.crumbs__here {
    color: var(--text-on-light);
    font-weight: 700;
}

.clienthead__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.clienthead__who {
    display: flex;
    align-items: center;
    gap: 14px;
    min-inline-size: 0;
}

.avatar--lg {
    inline-size: 54px;
    block-size: 54px;
}

.avatar--lg svg {
    inline-size: 28px;
    block-size: 28px;
}

.clienthead__name {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.clienthead__code {
    font-size: 12.5px;
    color: var(--text-on-light-muted);
    margin-block-start: 2px;
}

.clienthead__facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 0;
    padding-block-start: 16px;
    border-block-start: 1px solid var(--border-strong);
}

.clienthead__fact {
    display: flex;
    align-items: center;
    gap: 10px;
    min-inline-size: 0;
}

.clienthead__fact + .clienthead__fact {
    padding-inline-start: 12px;
    border-inline-start: 1px solid var(--border);
}

.clienthead__facticon {
    flex: 0 0 auto;
    color: var(--text-on-light-muted);
}

.clienthead__facticon svg {
    inline-size: 19px;
    block-size: 19px;
}

.clienthead__factvalue {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    unicode-bidi: isolate;
    text-align: start;
}

[dir="rtl"] .clienthead__factvalue[dir="ltr"] {
    text-align: right;
}

.clienthead__factlabel {
    font-size: 12px;
    color: var(--text-on-light-muted);
}

/* Four totals in a row; each is a short list of "amount currency" lines rather
   than one figure, because amounts in different currencies are never added. */
.cards--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card--statlist {
    align-items: flex-start;
}

.statlist {
    display: grid;
    gap: 4px;
    margin-block-start: 8px;
}

.statlist__row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.statlist__amount {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    unicode-bidi: isolate;
}

.statlist__currency {
    font-size: 12.5px;
    color: var(--text-on-light-muted);
}

.statlist__none {
    margin-block-start: 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-on-light-muted);
}

.infogrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    margin: 0;
}

.infogrid__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding-block: 11px;
    border-block-end: 1px solid var(--border);
}

.infogrid__item:nth-last-child(-n + 2) {
    border-block-end: 0;
}

.infogrid__label {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--text-on-light-muted);
}

.infogrid__value {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    min-inline-size: 0;
    overflow-wrap: anywhere;
    unicode-bidi: isolate;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-block-end: 14px;
    border-block-end: 1px solid var(--border-strong);
}

.tabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-block-end: 2px solid transparent;
    margin-block-end: -1px;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-on-light-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tabs__tab svg {
    inline-size: 17px;
    block-size: 17px;
}

.tabs__tab:hover {
    color: var(--text-on-light);
}

.tabs__tab.is-active {
    color: var(--accent);
    border-block-end-color: var(--accent);
}

.tabs__count {
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--text-on-light-muted);
}

@media (max-width: 1080px) {
    .cards--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .cards--four,
    .clienthead__facts,
    .infogrid {
        grid-template-columns: minmax(0, 1fr);
    }

    .clienthead__fact + .clienthead__fact {
        padding-inline-start: 0;
        border-inline-start: 0;
    }

    .infogrid__item:nth-last-child(2) {
        border-block-end: 1px solid var(--border);
    }
}

/* A section heading used as the title of a card rather than between cards. */
.card > .sectionhead {
    font-size: 16px;
    margin-block-end: 8px;
}

/* A Trades or Debts table drawn inside a customer's history card: the same
   markup as on its own page, without a card of its own. */
.embedtable + .embedtable {
    margin-block-start: 22px;
    padding-block-start: 18px;
    border-block-start: 1px solid var(--border);
}

.embedtable .card__label {
    font-size: 14px;
    color: var(--text-on-light);
}

/* --------------------------------------------------------------------------
   Installed app (home-screen icon) and touch screens
   -------------------------------------------------------------------------- */

/* No grey flash on tap, and no 300 ms wait for a possible double-tap zoom. */
a, button, summary, label, select, [role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Keep content clear of the gesture bar / notch (needs viewport-fit=cover). */
.page {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* Opened from the home screen there is no browser bar: stop the page from
   rubber-banding sideways and keep long tables from dragging the whole app. */
@media (display-mode: standalone) {
    html, body {
        overscroll-behavior-x: none;
    }
}

/* Gold sellers ------------------------------------------------------------ */

/* A weight in a form: grams and سوت side by side, each box with its unit after
   it. Follows the page direction, so in Persian the grams come first (right). */
.weightfields {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 8px;
}

.weightfields__box {
    display: flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
}

.weightfields__box .field__input {
    min-inline-size: 0;
    flex: 1 1 auto;
}

.weightfields__unit {
    flex: none;
    font-size: 13px;
    color: var(--text-on-light-muted);
}

/* The debts form's toman or gold boxes, whichever unit is not chosen (gold.js). */
[data-unit-only][hidden] {
    display: none !important;
}

/* A heading over several columns («وزن طلا» over grams and سوت), drawn inside
   one header cell so the header stays a single row like every other table's.
   The columns under it are equally wide (.col--pair), so splitting the cell
   in equal halves puts each label over its own column. */
.table .col--group {
    text-align: center;
    padding-block: 6px;
}

.thgroup {
    display: grid;
    gap: 3px;
}

.thgroup__subs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding-block-start: 3px;
    border-block-start: 1px solid var(--border);
    font-weight: 500;
    /* Out to the cell's edges, so each half is exactly one column wide. */
    margin-inline: -14px;
}

.table .col--pair {
    inline-size: 3.5em;
    min-inline-size: 3.5em;
}

/* Short numbers (karat, grams, سوت): tight and centred, like an invoice. */
.table .col--narrow {
    padding-inline: 8px;
    text-align: center;
}

/* A header drawn as one surface instead of cell by cell. Each sticky header
   cell normally carries its own translucent background and blur; with many
   narrow cells (the gold trades table) every cell blurs a different patch of
   the card and the header comes out in uneven blocks. Here the whole header
   row sticks and is tinted and blurred once, so it is one even shade. */
.table--onehead thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 -1px 0 var(--border-strong);
}

.table--onehead thead th {
    position: static;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

/* Thin dividers between columns, for a table with many narrow columns (the
   gold trades table, laid out like a paper invoice). The last column keeps its
   outer edge clean; the grams/سوت labels inside the «وزن طلا» heading get the
   same divider, so it lines up with the one between their two columns.

   The side is physical (left in Persian, right otherwise), not `inline-end`:
   number and Latin cells are forced left-to-right, and their inline end would
   be the opposite side from their neighbours', leaving gaps. */
[dir="rtl"] .table--ruled th:not(:last-child),
[dir="rtl"] .table--ruled td:not(:last-child) {
    border-left: 1px solid var(--border);
}

[dir="ltr"] .table--ruled th:not(:last-child),
[dir="ltr"] .table--ruled td:not(:last-child) {
    border-right: 1px solid var(--border);
}

[dir="rtl"] .table--ruled .thgroup__subs > span + span {
    border-right: 1px solid var(--border);
}

[dir="ltr"] .table--ruled .thgroup__subs > span + span {
    border-left: 1px solid var(--border);
}

/* Gold trades: a deal of several pieces. The summary row opens its pieces'
   rows (assets/js/gold.js); the pieces sit slightly inset under it. */
.dealtoggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.dealtoggle svg {
    inline-size: 14px;
    block-size: 14px;
    transition: transform 0.15s;
}

[dir="rtl"] .dealtoggle svg { transform: rotate(90deg); }
[dir="ltr"] .dealtoggle svg { transform: rotate(-90deg); }
.dealtoggle[aria-expanded="true"] svg { transform: none; }

.table .dealrow.is-open td {
    background: var(--accent-soft);
}

.table .dealitem td {
    background: var(--surface-muted);
    font-size: 0.95em;
}

.dealitem__n {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.dealadd {
    display: inline-block;
    margin-inline-start: 6px;
}

.table .col--strong {
    font-weight: 700;
}

/* The gold price formula: a quiet note between the heading and the rows. */
.tablenote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--accent-soft);
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text-on-dark-muted);
}

.tablenote svg {
    flex: none;
    inline-size: 16px;
    block-size: 16px;
    margin-block-start: 3px;
    color: var(--accent);
}

.field__input--calc {
    display: flex;
    align-items: center;
    font-weight: 700;
    direction: ltr;
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   Notifications: the bell, reminder switches, the notifications page
   -------------------------------------------------------------------------- */

.bellpick { position: relative; }

.bellpick__toggle {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: 38px;
    block-size: 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-on-dark-muted);
    background: var(--surface);
    cursor: pointer;
    list-style: none;
    transition: border-color 0.15s, color 0.15s;
}
.bellpick__toggle::-webkit-details-marker { display: none; }
.bellpick__toggle::marker { content: ""; }
.bellpick__toggle:hover,
.bellpick[open] .bellpick__toggle { border-color: var(--accent); color: var(--text-on-dark); }
.bellpick__toggle svg,
.mbell svg { inline-size: 18px; block-size: 18px; }

.bellpick__badge {
    position: absolute;
    inset-block-start: -6px;
    inset-inline-end: -6px;
    min-inline-size: 18px;
    block-size: 18px;
    padding-inline: 5px;
    border-radius: var(--radius-pill);
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}
.bellpick__badge[hidden] { display: none; }

/* The bell sits at the screen's left edge in every language, so its menu
   opens towards the right — physical, like the top row itself. */
.bellpick__menu {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    left: 0;
    z-index: 30;
    inline-size: min(360px, calc(100vw - 32px));
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raise);
    display: grid;
    gap: 6px;
}
.bellpick__head {
    padding: 4px 6px 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-on-dark);
    border-block-end: 1px solid var(--border);
}
.bellpick__list {
    display: grid;
    gap: 4px;
    max-block-size: 360px;
    overflow-y: auto;
}
.bellpick__empty {
    margin: 0;
    padding: 18px 6px;
    text-align: center;
    font-size: 13px;
    color: var(--text-on-dark-muted);
}
.bellpick__more { justify-content: center; inline-size: 100%; }

/* One notification: in the bell and on the page. */
.notifyitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-on-dark);
}
.notifyitem.is-unread { background: var(--accent-soft); }
.notifyitem.is-resolved { opacity: 0.6; }
.notifyitem__dot {
    flex: none;
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--sell);
}
.notifyitem__dot--buy { background: var(--buy); }
.notifyitem__main { flex: 1 1 auto; min-inline-size: 0; display: grid; gap: 2px; }
.notifyitem__text { line-height: 1.6; }
.notifyitem__time { font-size: 11.5px; color: var(--text-on-dark-muted); }
.notifyitem__btn { flex: none; padding: 6px 12px; font-size: 12.5px; }

/* The on/off switch. */
.rswitch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    color: var(--text-on-dark-muted);
    font-size: 13px;
}
.rswitch input {
    position: absolute;
    opacity: 0;
    inline-size: 1px;
    block-size: 1px;
}
.rswitch__track {
    position: relative;
    flex: none;
    inline-size: 36px;
    block-size: 20px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    border: 1px solid var(--border-strong);
    transition: background-color 0.15s, border-color 0.15s;
}
.rswitch__track::after {
    content: "";
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: 2px;
    inline-size: 14px;
    block-size: 14px;
    border-radius: 50%;
    background: var(--text-on-dark-muted);
    transition: transform 0.15s, background-color 0.15s;
}
.rswitch input:checked + .rswitch__track { background: var(--accent); border-color: var(--accent); }
.rswitch input:checked + .rswitch__track::after { background: var(--accent-ink); transform: translateX(16px); }
[dir="rtl"] .rswitch input:checked + .rswitch__track::after { transform: translateX(-16px); }
.rswitch input:focus-visible + .rswitch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.rswitch input:disabled + .rswitch__track { opacity: 0.5; }
.rswitch__icon svg,
.rswitch__label svg { inline-size: 14px; block-size: 14px; }
.rswitch__icon { display: inline-flex; }
.rswitch input:checked ~ .rswitch__icon { color: var(--accent); }
.rswitch__label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-on-dark); }
.rswitch--big .rswitch__label { font-size: 15px; font-weight: 700; }
.col--actions .rswitch { margin-inline-end: 6px; }
.rowcard__extra .rswitch { padding-block: 4px; }

/* The page. */
.notifypage { display: grid; gap: var(--gap); max-inline-size: 900px; margin-inline: auto; }
.notifymaster {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 0;
    border-block-end: 1px solid var(--border);
}
.notifyhours { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notifyhours__field { display: inline-flex; align-items: center; gap: 8px; color: var(--text-on-dark); font-size: 14px; }
.notifyhours__input { inline-size: 84px; text-align: center; }
.notifyhours__msg { font-size: 12.5px; color: var(--good); }
.notifyhours__msg.is-error { color: var(--danger); }
.notifytg { display: grid; gap: 4px; padding-block-start: 14px; }
.notifygroups { display: grid; gap: 18px; }
.notifygroup__title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.notifygroup__count { color: var(--text-on-dark-muted); font-size: 12.5px; font-weight: 500; }
.notifydebts, .notifylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.notifydebt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 8px;
    border-block-end: 1px solid var(--border);
}
.notifydebt:last-child { border-block-end: 0; }
.notifydebt__main { display: grid; gap: 2px; min-inline-size: 0; }
.notifydebt__name { font-weight: 600; color: var(--text-on-dark); }
.notifydebt__sub { font-size: 12.5px; color: var(--text-on-dark-muted); }
.notifylist .notifyitem { border-block-end: 1px solid var(--border); border-radius: 0; }
.notifylist .notifyitem:last-child { border-block-end: 0; }

/* Unread notifications: the bell rings every few seconds, its badge sends out
   a pulse, and the button glows. Nothing moves when there is nothing new. */
@keyframes bell-ring {
    0%, 62%, 100% { transform: rotate(0); }
    66% { transform: rotate(16deg); }
    70% { transform: rotate(-14deg); }
    74% { transform: rotate(10deg); }
    78% { transform: rotate(-8deg); }
    82% { transform: rotate(4deg); }
    86% { transform: rotate(0); }
}
@keyframes bell-badge-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.65); }
    70%  { box-shadow: 0 0 0 9px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}
@keyframes bell-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(224, 162, 43, 0); }
    50%      { box-shadow: 0 0 14px 1px rgba(224, 162, 43, 0.35); }
}
@keyframes bell-badge-pop {
    0%   { transform: scale(0.4); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.bellpick__toggle.has-unread,
.mbell.has-unread {
    color: var(--accent);
    border-color: rgba(224, 162, 43, 0.55);
    animation: bell-glow 2.4s ease-in-out infinite;
}
.bellpick__toggle.has-unread svg,
.mbell.has-unread svg {
    transform-origin: 50% 12%;
    animation: bell-ring 3.2s ease-in-out infinite;
}
.has-unread .bellpick__badge {
    animation: bell-badge-pop 0.35s ease-out, bell-badge-pulse 1.8s ease-out 0.35s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .bellpick__toggle.has-unread,
    .mbell.has-unread,
    .bellpick__toggle.has-unread svg,
    .mbell.has-unread svg,
    .has-unread .bellpick__badge { animation: none; }
}

/* «N روز گذشته» next to a debt or notification. */
.notifyage {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-weight: 600;
}
.notifyage svg { inline-size: 12px; block-size: 12px; }

/* ==========================================================================
   2026-11-12 design refresh (Claude Design handoff: gold inventory in tabs)
   Shared by every page: glass sticky header, buttons and controls that lift
   on hover, livelier stat cards, a gold-tinted table head, taller search.
   Desktop and tablet only — the phone layout lives in mobile.css.
   ========================================================================== */

:root {
    --page-max: 1680px;
    --lift: translateY(-2px);
    --ease-ui: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body {
    background: var(--bg);
}

/* The page glow sits on its own fixed layer. `background-attachment: fixed`
   repainted all three gradients on every scroll frame (colour flicker). */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    transform: translateZ(0);
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(22, 48, 90, 0.9), transparent 60%),
        radial-gradient(900px 500px at 10% 60%, rgba(57, 135, 229, 0.10), transparent 60%),
        radial-gradient(700px 400px at 70% 100%, rgba(224, 162, 43, 0.06), transparent 60%);
}

/* Every button and button-like control answers the pointer the same way. */
.btn,
.iconbtn,
.langpick__toggle,
.bellpick__toggle,
.account__logout,
.sections__item,
.rangefilter__item,
.chip,
.kindtabs__tab {
    transition: var(--ease-ui);
}

@media (hover: hover) {
    .btn:not(:disabled):hover,
    .iconbtn:hover,
    .langpick__toggle:hover,
    .bellpick__toggle:hover,
    .account__logout:hover,
    .rangefilter__item:not(.is-active):hover,
    .chip:hover {
        transform: var(--lift);
    }
    .btn--primary:not(:disabled):hover {
        background: #EFB44A;
        box-shadow: 0 10px 24px -8px rgba(224, 162, 43, 0.55);
    }
    .btn--danger:not(:disabled):hover {
        border-color: var(--danger);
    }
    .btn:not(:disabled):active,
    .iconbtn:active {
        transform: translateY(0);
    }
}

@media (min-width: 641px) {
    .page {
        padding: 22px clamp(16px, 6vw, 120px) 120px;
        gap: 22px;
    }

    /* Header: glass, stays on top while the page scrolls. */
    .topbar {
        position: sticky;
        inset-block-start: 0;
        z-index: 30;
        background: rgba(11, 23, 40, 0.75);
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
    }
    .topbar__row {
        padding-inline: clamp(16px, 6vw, 120px);
    }
    .brand__logo {
        inline-size: 50px;
        block-size: 50px;
    }
    .brand__name {
        font-size: 17px;
    }

    .sections {
        gap: 6px;
    }
    .sections__item {
        font-size: 15px;
        border-radius: 10px;
    }
    .sections__item.is-active {
        font-weight: 700;
    }

    .langpick__toggle,
    .account__logout {
        block-size: 46px;
        padding: 0 16px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        background: #0F1D33;
    }
    .bellpick__toggle {
        inline-size: 46px;
        block-size: 46px;
        border-radius: 10px;
        background: #0F1D33;
    }
    .langpick__toggle:hover,
    .account__logout:hover,
    .bellpick__toggle:hover {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: #EFC077;
    }

    /* Stat cards: taller, bigger figure and icon, lift on hover. */
    .cards {
        gap: 22px;
    }
    .card--stat {
        min-block-size: 132px;
        padding: 22px;
        transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    }
    .card--stat .card__label {
        font-size: 14.5px;
        font-weight: 700;
        letter-spacing: 0;
    }
    .card--stat .card__value {
        font-size: clamp(28px, 2.6vw, 38px);
        line-height: 1.1;
    }
    .card--stat .staticon {
        inline-size: 58px;
        block-size: 58px;
        border: 0;
    }
    .card--stat .staticon svg {
        inline-size: 24px;
        block-size: 24px;
    }

    /* Buttons: one height, rounder. */
    .btn {
        min-block-size: 46px;
        padding: 0 18px;
        border-radius: 10px;
        font-size: 14.5px;
        font-weight: 700;
    }
    .btn--sm {
        min-block-size: 42px;
        padding: 0 16px;
        font-size: 14px;
    }
    .btn--ghost {
        background: transparent;
    }

    .iconbtn {
        inline-size: 38px;
        block-size: 38px;
        border-radius: 9px;
        background: transparent;
    }
    .iconbtn:hover {
        color: #EFC077;
    }
    .iconbtn--danger {
        background: rgba(244, 63, 94, 0.16);
        border-color: rgba(244, 63, 94, 0.45);
    }
    .iconbtn--danger:hover {
        color: #FBA6B4;
        background: rgba(244, 63, 94, 0.3);
    }
    .table .col--actions .iconbtn + .iconbtn {
        margin-inline-start: 10px;
    }

    /* Table: gold-tinted head, roomier rows inside a framed box. */
    .card--table .tablewrap {
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        background: rgba(8, 17, 32, 0.25);
    }
    .table {
        font-size: 14.5px;
    }
    .table td {
        padding: 16px 18px;
        font-weight: 600;
    }
    .table thead th {
        padding: 12px 18px;
        background: linear-gradient(180deg, rgba(224, 162, 43, 0.16), rgba(224, 162, 43, 0.07)), rgba(11, 23, 40, 0.85);
        color: #EFC077;
        font-size: 13.5px;
        letter-spacing: 0;
    }
    .table tbody tr:hover td {
        background: rgba(255, 255, 255, 0.05);
    }

    /* Search: one tall glass bar. */
    .searchbar .searchbar__input {
        block-size: 58px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.04);
        font-size: 14.5px;
    }
    .searchbar .btn {
        min-block-size: 58px;
        border-radius: 12px;
    }
}

@media (min-width: 641px) and (hover: hover) {
    .sections__item:not(.is-disabled):not(.is-active):hover {
        background: rgba(255, 255, 255, 0.05);
        transform: var(--lift);
    }
    .card--stat:hover {
        transform: translateY(-4px);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 28px 50px -20px rgba(0, 0, 0, 0.75);
    }
}

/* --------------------------------------------------------------------------
   Gold Inventory: tabs, coin and melted-gold bits
   -------------------------------------------------------------------------- */

.kindtabs {
    --tab-index: 0;
    position: relative;
    justify-self: start;
    display: grid;
    grid-template-columns: repeat(var(--tab-count, 3), minmax(140px, 1fr));
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.kindtabs__indicator {
    position: absolute;
    inset-block: 6px;
    inset-inline-start: 6px;
    inline-size: calc((100% - 12px) / var(--tab-count, 3));
    border: 1px solid rgba(224, 162, 43, 0.45);
    border-radius: 11px;
    background: rgba(224, 162, 43, 0.14);
    box-shadow: 0 6px 18px -8px rgba(224, 162, 43, 0.45);
    transform: translateX(calc(100% * var(--tab-index)));
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
[dir="rtl"] .kindtabs__indicator {
    transform: translateX(calc(-100% * var(--tab-index)));
}
.kindtabs.is-instant .kindtabs__indicator {
    transition: none;
}

.kindtabs__tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-block-size: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text-on-dark-muted);
    font: inherit;
    cursor: pointer;
}
.kindtabs__tab:hover {
    color: var(--text-on-dark);
}
.kindtabs__tab.is-active {
    color: #fff;
}
.kindtabs__label {
    font-size: 15px;
    font-weight: 700;
}
.kindtabs__chip {
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.kindtabs__tab.is-active .kindtabs__chip {
    background: var(--accent);
    color: var(--accent-ink);
}

.kindpanel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}
.kindpanel[hidden] {
    display: none;
}

.cards--four {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card__sub {
    margin-block-start: 4px;
    font-size: 12.5px;
    color: var(--text-on-dark-muted);
}
.card--stat .card__value--money {
    font-size: clamp(22px, 2vw, 28px);
}

.table .col--gold { color: #EFC077; }
.table .col--blue { color: #8FC0F5; }
.table tr.is-sold td { opacity: 0.6; }
.table tr.is-sold td.col--actions { opacity: 1; }
.table strong + .pill {
    margin-inline-start: 8px;
}

.pill--muted {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-strong);
    color: var(--text-on-dark-muted);
}

.rowdialog__hint {
    margin-block-start: -6px;
    font-size: 13px;
    color: var(--accent);
}

.chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
}
.chip {
    min-block-size: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-on-light);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.chip.is-on {
    border-color: rgba(224, 162, 43, 0.6);
    background: rgba(224, 162, 43, 0.14);
    color: #EFC077;
}

.calcbox__item--gold .calcbox__value { color: #EFC077; }
.calcbox__item--blue .calcbox__value { color: #8FC0F5; }
.calcbox dt { margin: 0; }
.calcbox dd { margin: 0; text-align: start; }

.field__input.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.14);
}

@media (max-width: 640px) {
    .kindtabs {
        justify-self: stretch;
        grid-template-columns: repeat(var(--tab-count, 3), minmax(0, 1fr));
        padding: 5px;
        border-radius: 14px;
    }
    .kindtabs__indicator {
        inset-block: 5px;
        inset-inline-start: 5px;
        inline-size: calc((100% - 10px) / var(--tab-count, 3));
        border-radius: 10px;
    }
    .kindtabs__tab {
        padding: 0 6px;
        gap: 6px;
    }
    .kindtabs__label { font-size: 14.5px; }
    .kindtabs__chip { padding: 1px 6px; }
    .kindpanel { gap: 14px; }
}

/* A field the form hides (the Parsian weight box) stays hidden. */
.field[hidden] {
    display: none;
}

/* 2026-11-16: the logo must never drop to a line of its own. With the bigger
   menu of the refresh, a shop with many sections (exchange) did not fit and
   the row wrapped, leaving the logo alone under the menu. The main row now
   never wraps: the logo and the controls keep their size, the menu takes what
   is left, tightens its items, and only wraps inside its own box if it must. */
@media (min-width: 641px) {
    .topbar__row--main {
        flex-wrap: nowrap;
        gap: 16px;
        padding-inline: clamp(16px, 3vw, 48px);
    }
    .topbar__start,
    .topbar__end {
        flex: 0 0 auto;
    }
    .topbar__end {
        flex-wrap: nowrap;
    }
    .topbar__mid {
        flex: 1 1 0;
    }
    .sections {
        justify-content: center;
        gap: 2px;
    }
    .sections__item {
        padding-inline: clamp(8px, 0.8vw, 14px);
        white-space: nowrap;
    }
}
@media (min-width: 641px) and (max-width: 1400px) {
    .sections__item {
        font-size: 14px;
    }
    .langpick__toggle,
    .account__logout {
        padding: 0 12px;
    }
}

/* --------------------------------------------------------------------------
   2026-11-25 «صندوق ریالی»: bank tab, bank list and bank page
   -------------------------------------------------------------------------- */

.cards--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.banklink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}
.banklink:hover strong { color: var(--gold, #e0a22b); }
.bankmark {
    display: inline-grid;
    place-items: center;
    inline-size: 30px;
    block-size: 30px;
    border-radius: 9px;
    background: rgba(224, 162, 43, 0.14);
    color: #e0a22b;
}
.bankmark svg { inline-size: 16px; block-size: 16px; }

.cardnum {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.field__input--card { letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

.bankhead__money {
    display: grid;
    gap: 6px;
    margin-block-start: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(224, 162, 43, 0.16), rgba(224, 162, 43, 0.04));
    border: 1px solid rgba(224, 162, 43, 0.3);
}
.bankhead__label { margin: 0; opacity: 0.75; font-size: 14px; }
.bankhead__balance { margin: 0; font-size: 30px; font-weight: 800; color: #e0a22b; }
.bankhead__card {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 17px;
}

@media (max-width: 640px) {
    .cards--two { grid-template-columns: 1fr 1fr; }
    .kindtabs[style*="--tab-count: 4"] .kindtabs__tab {
        flex-direction: column;
        gap: 2px;
        padding: 4px 2px;
        min-block-size: 52px;
    }
    .kindtabs[style*="--tab-count: 4"] .kindtabs__label { font-size: 13px; white-space: nowrap; }
    .kindtabs[style*="--tab-count: 4"] .kindtabs__chip { font-size: 11px; }
    .bankhead__balance { font-size: 24px; }
}

/* 2026-11-25 bank logos (public/assets/img/banks) */
.banklogo {
    inline-size: 32px;
    block-size: 32px;
    flex: none;
    border-radius: 9px;
    background: #fff;
    padding: 2px;
    object-fit: contain;
}
.banklogo--lg { inline-size: 56px; block-size: 56px; border-radius: 14px; padding: 4px; }
.dropdown__logo {
    inline-size: 22px;
    block-size: 22px;
    flex: none;
    margin-inline-end: 8px;
    vertical-align: middle;
    border-radius: 6px;
    background: #fff;
    padding: 1px;
}
.dropdown__item:has(.dropdown__logo), .dropdown__text:has(.dropdown__logo) { display: flex; align-items: center; }
.obank { display: inline-flex; align-items: center; gap: 6px; }
.obank__logo { border-radius: 6px; background: #fff; padding: 1px; flex: none; }
.rowcard__badge--logo { background: #fff !important; padding: 2px; overflow: hidden; }
.rowcard__logo { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }

/* 2026-11-26 «گردش حساب»: money in and money out read apart — a green or red
   edge, a pill and the amount in the same colour (bot-sync #36). */
.bankmove td:first-child { box-shadow: inset -3px 0 0 var(--bankmove-c); }
[dir="ltr"] .bankmove td:first-child { box-shadow: inset 3px 0 0 var(--bankmove-c); }
.bankmove--in  { --bankmove-c: var(--good);   --bankmove-bg: rgba(25, 158, 112, 0.14); }
.bankmove--out { --bankmove-c: var(--danger); --bankmove-bg: rgba(244, 63, 94, 0.13); }
.bankmove > td { background: color-mix(in srgb, var(--bankmove-c) 7%, transparent); }
.bankmove__amount { color: var(--bankmove-c); font-weight: 700; }
.bankmove__pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
    color: var(--bankmove-c); background: var(--bankmove-bg);
}

/* 2026-11-26 a trade's bank (#36): a small chip under the final price. */
.tradebank {
    display: flex; align-items: center; gap: 5px; justify-content: flex-end;
    margin-block-start: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
    color: var(--tradebank-c);
}
.tradebank--in  { --tradebank-c: var(--good); }
.tradebank--out { --tradebank-c: var(--danger); }
.banklogo--xs { inline-size: 16px; block-size: 16px; border-radius: 4px; padding: 1px; }

/* 2026-11-26 «جزئیات» of a trade's move on the bank page (#36). */
.bankmove__toggle { white-space: nowrap; }
.table .bankmove.is-open td { border-block-end-color: transparent; }
.bankmove__details > td {
    padding: 4px 12px 16px;
    background: color-mix(in srgb, var(--accent, #e0a22b) 4%, transparent);
}
.movedeal { display: flex; flex-direction: column; gap: 12px; }
.movedeal__facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px;
    margin: 0;
}
.movedeal__facts > div { display: flex; flex-direction: column; gap: 2px; }
.movedeal__facts dt { font-size: 12px; opacity: 0.7; }
.movedeal__facts dd { margin: 0; font-weight: 700; }
.movedeal__table { font-size: 13px; }
.movedeal__table th, .movedeal__table td { padding-block: 8px; }
.movedeal__actions { display: flex; justify-content: flex-end; }
.movedeal__invoice { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.movedeal__invoice svg { inline-size: 16px; block-size: 16px; flex: none; }
.rowcard__extra .movedeal__invoice { inline-size: 100%; margin-block-start: 10px; }

/* ==========================================================================
   «قیمت لحظه‌ای» — live gold prices (views/gold/prices.php, 2026-11-28)
   ========================================================================== */

.goldlive { display: flex; flex-direction: column; gap: 26px; }

.goldlive__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.goldlive__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-on-light-muted);
}
.goldlive__status strong { color: var(--text-on-light); font-weight: 600; unicode-bidi: isolate; }

.goldlive__dot {
    inline-size: 9px;
    block-size: 9px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 0 0 rgba(25, 158, 112, 0.6);
    animation: goldlive-pulse 2s infinite;
}
.goldlive__dot.is-off { background: var(--danger); animation: none; box-shadow: none; }

@keyframes goldlive-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(25, 158, 112, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(25, 158, 112, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 158, 112, 0); }
}

.goldlive__full {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: var(--surface-glass);
    color: var(--text-on-light);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.goldlive__full:hover { border-color: var(--accent); color: var(--accent); }
.goldlive__full svg, .glcard__arrow svg {
    inline-size: 16px;
    block-size: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.goldlive__error {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(244, 63, 94, 0.12);
    color: var(--danger);
    font-size: 14px;
}

.goldlive__group { display: flex; flex-direction: column; gap: 14px; }

.goldlive__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}
.goldlive__title::after {
    content: "";
    flex: 1;
    block-size: 1px;
    background: linear-gradient(90deg, rgba(224, 162, 43, 0.35), transparent);
}
[dir="rtl"] .goldlive__title::after { background: linear-gradient(270deg, rgba(224, 162, 43, 0.35), transparent); }

.goldlive__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.glcard {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 40px -22px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    min-inline-size: 0;
}

.glcard__label { font-size: 13.5px; font-weight: 600; color: var(--text-on-light-muted); }

.glcard__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.glcard__price [data-gl="price"] {
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-on-light);
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}
.glcard__unit { font-size: 12px; color: var(--text-on-light-muted); }

.glcard__change {
    display: flex;
    align-items: center;
    gap: 6px;
    min-block-size: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-on-light-muted);
    unicode-bidi: isolate;
}
.glcard__arrow { display: none; }
.glcard.is-high .glcard__change { color: var(--good); }
.glcard.is-low  .glcard__change { color: var(--danger); }
.glcard.is-high .glcard__arrow--up,
.glcard.is-low  .glcard__arrow--down { display: inline-flex; }
.glcard__pct {
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
    font-size: 11.5px;
}
.glcard__pct:empty { display: none; }
.glcard.is-high .glcard__pct { background: rgba(25, 158, 112, 0.15); }
.glcard.is-low  .glcard__pct { background: rgba(244, 63, 94, 0.14); }

.glcard__range {
    display: flex;
    gap: 14px;
    margin: 0;
    padding-block-start: 8px;
    border-block-start: 1px solid var(--border);
    font-size: 12px;
}
.glcard__range div { display: flex; gap: 5px; min-inline-size: 0; }
.glcard__range dt { color: var(--text-on-light-muted); }
.glcard__range dd { margin: 0; color: var(--text-on-light); unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.glcard__time {
    position: absolute;
    inset-block-start: 14px;
    inset-inline-end: 16px;
    font-size: 11px;
    color: var(--text-on-light-muted);
    unicode-bidi: isolate;
}

.glcard.flash-up   { animation: glcard-up 1.6s ease-out; }
.glcard.flash-down { animation: glcard-down 1.6s ease-out; }
@keyframes glcard-up   { 0% { border-color: var(--good);   box-shadow: 0 0 0 1px var(--good), 0 0 28px -4px rgba(25, 158, 112, 0.65); } 100% { } }
@keyframes glcard-down { 0% { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger), 0 0 28px -4px rgba(244, 63, 94, 0.6); } 100% { } }

@media (prefers-reduced-motion: reduce) {
    .goldlive__dot, .glcard.flash-up, .glcard.flash-down { animation: none; }
}

.goldlive__source { font-size: 11.5px; color: var(--text-on-light-muted); text-align: center; }

/* Full screen on a shop TV: the board alone, on the page background. */
.goldlive.is-fullscreen {
    overflow-y: auto;
    padding: 28px clamp(16px, 3vw, 48px);
    background: var(--bg);
}
.goldlive.is-fullscreen .goldlive__grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.goldlive.is-fullscreen .glcard__price [data-gl="price"] { font-size: clamp(26px, 2.6vw, 38px); }

@media (max-width: 640px) {
    .goldlive { gap: 20px; }
    .goldlive__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .glcard { padding: 12px 12px 10px; gap: 6px; border-radius: 14px; }
    .glcard__label { font-size: 12px; padding-inline-end: 34px; }
    .glcard__price [data-gl="price"] { font-size: 18px; }
    .glcard__range { flex-direction: column; gap: 2px; font-size: 11px; }
    .glcard__time { inset-block-start: 12px; inset-inline-end: 10px; font-size: 10px; }
}

/* --------------------------------------------------------------------------
   Page-to-page transition (2026-11-28)
   Switching menus cross-fades the page instead of flashing white; the top
   bar and the mobile header/bottom tabs stay put. Browsers without
   cross-document view transitions just navigate as before.
   -------------------------------------------------------------------------- */

@view-transition {
    navigation: auto;
}

.topbar { view-transition-name: topbar; }
.mhead  { view-transition-name: mhead; }
.mtabs  { view-transition-name: mtabs; }

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 160ms;
    animation-timing-function: ease-out;
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
}
