/* ==========================================================================
   Phone layout (≤ 640px) — loaded after app.css and assistant.css.

   Everything that changes the look sits inside the media query, so desktop
   stays exactly as it was. The only thing outside it is the tint tokens and
   the rule that hides the phone-only markup on wide screens.
   ========================================================================== */

:root {
    /* Tint triplets (fill, hairline, ink) used by badges, chips and tiles. */
    --buy-fill:    rgba(57, 135, 229, 0.16);
    --buy-line:    rgba(57, 135, 229, 0.4);
    --buy-ink:     #8FC0F5;
    --sell-fill:   rgba(224, 162, 43, 0.14);
    --sell-line:   rgba(224, 162, 43, 0.42);
    --sell-ink:    #EFC077;
    --good-fill:   rgba(25, 158, 112, 0.16);
    --good-line:   rgba(25, 158, 112, 0.42);
    --good-ink:    #6FD3AC;
    --danger-fill: rgba(244, 63, 94, 0.16);
    --danger-line: rgba(244, 63, 94, 0.45);
    --danger-ink:  #FBA6B4;
    --other-fill:  rgba(124, 58, 237, 0.16);
    --other-line:  rgba(124, 58, 237, 0.45);
    --other-ink:   #C0A9F5;

    --border-glass: rgba(255, 255, 255, 0.12);
    --glass-fill:   linear-gradient(150deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    --surface-input: rgba(255, 255, 255, 0.04);
}

/* Phone-only markup is invisible on wider screens. */
.mshell {
    display: none;
}

/* Row cards and the filter button are the phone view of a table; invisible elsewhere. */
.modegroup {
    display: contents;
}

.rowcards,
.mfilter,
.mfiltersheet,
.clientsmore,
.stackbar-wrap,
.charttabs,
.toprows,
.obar__pct,
.ucards,
.loginpw__toggle {
    display: none;
}

.loginpw {
    position: relative;
    display: block;
}

@media (max-width: 640px) {

    /* ----------------------------------------------------------------------
       Shell
       ---------------------------------------------------------------------- */

    .topbar {
        display: none;
    }

    .mshell {
        display: block;
    }

    .page {
        padding: 14px 16px calc(96px + env(safe-area-inset-bottom, 0px));
        gap: 12px;
    }

    /* -- Header ----------------------------------------------------------- */

    .mhead {
        position: sticky;
        inset-block-start: 0;
        z-index: 40;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        block-size: 60px;
        padding-inline: 16px;
        padding-block-start: env(safe-area-inset-top, 0px);
        box-sizing: content-box;
        background: var(--bg-elevated);
        border-block-end: 1px solid var(--border-strong);
    }

    .mhead__start {
        display: flex;
        align-items: center;
        gap: 10px;
        min-inline-size: 0;
    }

    .mhead__back,
    .macct__toggle {
        flex: none;
        display: grid;
        place-items: center;
        inline-size: 36px;
        block-size: 36px;
        border: 1px solid var(--border-strong);
        color: var(--text-on-dark);
        cursor: pointer;
        list-style: none;
    }

    .mhead__back {
        border-radius: 9px;
    }

    [dir="ltr"] .mhead__back svg {
        transform: scaleX(-1);
    }

    .mhead__back svg,
    .macct__toggle svg {
        inline-size: 17px;
        block-size: 17px;
    }

    .mhead__logo {
        flex: none;
        inline-size: 32px;
        block-size: 32px;
        border-radius: 50%;
        border: 1.5px solid var(--accent);
        background: var(--accent-soft);
        color: var(--accent);
        font-size: 13px;
        font-weight: 700;
        display: grid;
        place-items: center;
        overflow: hidden;
    }

    .mhead__logo img {
        inline-size: 100%;
        block-size: 100%;
        object-fit: cover;
    }

    .mhead__titles {
        display: flex;
        flex-direction: column;
        min-inline-size: 0;
    }

    .mhead__title {
        font-size: 15px;
        font-weight: 700;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mhead__sub {
        font-size: 12px;
        line-height: 1.3;
        color: var(--text-on-dark-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        unicode-bidi: plaintext;
    }

    /* -- Account popover (<details>) -------------------------------------- */

    .macct {
        position: relative;
        flex: none;
    }

    .macct__toggle {
        border-radius: 50%;
        background: var(--surface-input);
    }

    .macct__toggle::-webkit-details-marker { display: none; }
    .macct__toggle::marker { content: ""; }

    .macct[open] .macct__toggle {
        border-color: var(--sell-line);
    }

    .macct__menu {
        position: absolute;
        inset-block-start: calc(100% + 8px);
        inset-inline-end: 0;
        z-index: 50;
        inline-size: 220px;
        padding: 6px;
        display: flex;
        flex-direction: column;
        background: var(--surface);
        border: 1px solid var(--border-strong);
        border-radius: 14px;
        box-shadow: var(--shadow-raise);
    }

    .macct__who {
        display: flex;
        flex-direction: column;
        padding: 8px 10px 10px;
        border-block-end: 1px solid var(--border);
    }

    .macct__name {
        font-size: 14px;
        font-weight: 600;
        overflow-wrap: anywhere;
        unicode-bidi: plaintext;
    }

    .macct__user {
        font-size: 12px;
        color: var(--text-on-dark-muted);
        direction: ltr;
        text-align: start;
    }

    .macct__item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px;
        border-radius: 9px;
        font-size: 14px;
        color: var(--text-on-dark);
    }

    .macct__item:active {
        background: var(--surface-hover);
    }

    .macct__item svg,
    .macct__langlabel svg {
        inline-size: 16px;
        block-size: 16px;
        flex: none;
    }

    .macct__item--danger {
        margin-block-start: 2px;
        border-block-start: 1px solid var(--border);
        border-radius: 0 0 9px 9px;
        color: var(--danger-ink);
    }

    .macct__lang {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 8px 10px;
    }

    .macct__langlabel {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
    }

    .mseg {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        padding: 2px;
        border-radius: 9px;
        background: var(--surface-input);
        border: 1px solid var(--border-strong);
    }

    .mseg__item {
        text-align: center;
        padding: 5px 0;
        border-radius: 7px;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-on-dark-muted);
    }

    .mseg__item.is-active {
        background: var(--accent);
        color: var(--accent-ink);
    }

    /* -- Date-range chips -------------------------------------------------- */

    .mchips {
        display: flex;
        gap: 6px;
        padding: 10px 16px;
        overflow-x: auto;
        scrollbar-width: none;
        border-block-end: 1px solid var(--border);
    }

    .mchips::-webkit-scrollbar { display: none; }

    .mchip {
        flex: none;
        padding: 6px 12px;
        border-radius: var(--radius-pill);
        border: 1px solid var(--border-strong);
        font-size: 12.5px;
        font-weight: 600;
        line-height: 1.5;
        white-space: nowrap;
        color: var(--text-on-dark-muted);
    }

    .mchip.is-active {
        background: var(--accent-soft);
        border-color: var(--sell-line);
        color: var(--accent);
    }

    /* -- Bottom tab bar ---------------------------------------------------- */

    .mtabs {
        position: fixed;
        inset-inline: 0;
        inset-block-end: 0;
        z-index: 45;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        padding: 0 4px calc(6px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-elevated);
        border-block-start: 1px solid var(--border-strong);
    }

    .mtabs__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 9px 0 4px;
        background: transparent;
        border: 0;
        font: inherit;
        font-size: 11px;
        line-height: 1.4;
        color: var(--text-on-dark-muted);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .mtabs__item svg {
        inline-size: 20px;
        block-size: 20px;
    }

    .mtabs__item span {
        max-inline-size: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mtabs__item.is-active {
        color: var(--text-on-dark);
        font-weight: 600;
    }

    .mtabs__item.is-active svg {
        color: var(--accent);
    }

    .mtabs__item.is-active::before {
        content: "";
        position: absolute;
        inset-block-start: 0;
        inset-inline: 18px;
        block-size: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--accent);
    }

    /* -- Bottom sheet (shared by «More», filters, balance detail) ---------- */

    .msheet {
        position: fixed;
        inset: auto 0 0 0;
        margin: 0;
        inline-size: 100%;
        max-inline-size: none;
        max-block-size: 82%;
        padding: 0 0 env(safe-area-inset-bottom, 0px);
        flex-direction: column;
        color: var(--text-on-dark);
        background: var(--bg-elevated);
        border: 1px solid var(--border-strong);
        border-block-end: 0;
        border-radius: 20px 20px 0 0;
        overflow: hidden;
    }

    .msheet[open] {
        display: flex;
    }

    .msheet::backdrop {
        background: rgba(4, 9, 18, 0.6);
    }

    .msheet__handle {
        flex: none;
        align-self: center;
        inline-size: 40px;
        block-size: 4px;
        margin-block-start: 8px;
        border-radius: 999px;
        background: var(--border-strong);
    }

    .msheet__head {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 16px 12px;
        border-block-end: 1px solid var(--border);
    }

    .msheet__title {
        font-size: 15px;
        font-weight: 700;
    }

    .msheet__close {
        display: grid;
        place-items: center;
        inline-size: 32px;
        block-size: 32px;
        padding: 0;
        border-radius: 8px;
        border: 1px solid var(--border-strong);
        background: transparent;
        color: var(--text-on-dark-muted);
        cursor: pointer;
    }

    .msheet__close svg {
        inline-size: 15px;
        block-size: 15px;
    }

    .msheet__grid {
        padding: 10px 12px 18px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow-y: auto;
    }

    .mmore {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 12px;
        border-radius: 14px;
        background: var(--glass-fill);
        border: 1px solid var(--border-glass);
    }

    .mmore.is-active {
        background: var(--accent-soft);
        border-color: var(--sell-line);
    }

    .mmore__ico {
        inline-size: 34px;
        block-size: 34px;
        margin-block-end: 6px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        background: var(--accent-soft);
        color: var(--accent);
    }

    .mmore__ico svg {
        inline-size: 18px;
        block-size: 18px;
    }

    .mmore__label {
        font-size: 14px;
        font-weight: 600;
    }

    .mmore__hint {
        font-size: 11px;
        line-height: 1.5;
        color: var(--text-on-dark-muted);
    }

    /* -- AI assistant button: small, above the tab bar, hides on scroll ---- */

    .asst .asst__launcher {
        left: 14px;
        right: auto;
        bottom: calc(78px + env(safe-area-inset-bottom, 0px));
        inline-size: 46px;
        block-size: 46px;
        min-inline-size: 46px;
        box-shadow: 0 8px 20px -6px rgba(224, 162, 43, 0.55);
    }

    [dir="ltr"] .asst .asst__launcher {
        left: auto;
        right: 14px;
    }

    .asst .asst__launcher-ico svg {
        inline-size: 20px;
        block-size: 20px;
    }

    .asst.is-scrolled-down .asst__launcher {
        transform: translateY(130px);
        opacity: 0;
        pointer-events: none;
    }

    /* ----------------------------------------------------------------------
       Tables → expandable row cards
       ---------------------------------------------------------------------- */

    .tablewrap,
    .tablefilters {
        display: none;
    }

    .rowcards {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .card--table,
    .card--table .card__head {
        min-inline-size: 0;
    }

    .card__head--bar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .card__head--bar > div:first-child {
        flex: 1 1 100%;
    }

    .rowtools {
        flex-wrap: wrap;
        inline-size: 100%;
    }

    .rowtools .btn {
        block-size: 36px;
    }

    .rowcards__all {
        display: none;
        align-items: center;
        gap: 10px;
        padding: 4px 4px 2px;
        font-size: 13px;
        color: var(--text-on-dark-muted);
    }

    .is-selecting .rowcards__all {
        display: flex;
    }

    .rowcard {
        display: flex;
        align-items: flex-start;
        gap: 10px;
    }

    .rowcard[hidden] {
        display: none;
    }

    .rowcard__select {
        display: none;
        padding-block-start: 18px;
    }

    .is-selecting .rowcard__select {
        display: block;
    }

    .rowcard__select input,
    .rowcards__all input {
        inline-size: 20px;
        block-size: 20px;
        margin: 0;
        accent-color: var(--accent);
    }

    .rowcard__body {
        flex: 1 1 auto;
        min-inline-size: 0;
        border-radius: 14px;
        background: var(--glass-fill);
        border: 1px solid var(--border-glass);
    }

    .rowcard__body[open] {
        border-color: var(--sell-line);
    }

    .rowcard__sum {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 12px;
        cursor: pointer;
        list-style: none;
        -webkit-tap-highlight-color: transparent;
    }

    .rowcard__sum::-webkit-details-marker { display: none; }
    .rowcard__sum::marker { content: ""; }

    .rowcard__badge {
        flex: none;
        inline-size: 36px;
        block-size: 36px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        font-size: 11px;
        font-weight: 700;
        text-align: center;
        line-height: 1.2;
        background: var(--surface-input);
        border: 1px solid var(--border-strong);
        color: var(--text-on-dark-muted);
    }

    .rowcard__badge--buy    { background: var(--buy-fill);    border-color: var(--buy-line);    color: var(--buy-ink); }
    .rowcard__badge--sell   { background: var(--sell-fill);   border-color: var(--sell-line);   color: var(--sell-ink); }
    .rowcard__badge--good   { background: var(--good-fill);   border-color: var(--good-line);   color: var(--good-ink); }
    .rowcard__badge--danger { background: var(--danger-fill); border-color: var(--danger-line); color: var(--danger-ink); }
    .rowcard__badge--other  { background: var(--other-fill);  border-color: var(--other-line);  color: var(--other-ink); }

    .rowcard__main,
    .rowcard__side {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-inline-size: 0;
    }

    .rowcard__main {
        flex: 1 1 auto;
    }

    .rowcard__side {
        flex: none;
        align-items: flex-end;
        max-inline-size: 46%;
    }

    .rowcard__title,
    .rowcard__sub,
    .rowcard__amount,
    .rowcard__meta {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .rowcard__title  { font-size: 14px; font-weight: 600; }
    .rowcard__sub    { font-size: 12px; color: var(--text-on-dark-muted); unicode-bidi: plaintext; }
    .rowcard__amount { font-size: 14px; font-weight: 700; }
    .rowcard__meta   { font-size: 11px; color: var(--text-on-dark-muted); }

    /* The opened card is a small ruled table: two cells per row, a line
       between every cell and a frame round the lot. */
    .rowcard__grid {
        margin: 10px 12px;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        overflow: hidden;
    }

    .rowcard__kv {
        min-inline-size: 0;
        padding: 8px 10px;
        border-block-end: 1px solid var(--border-strong);
    }

    .rowcard__kv:nth-child(odd) {
        border-inline-end: 1px solid var(--border-strong);
    }

    /* An odd last cell fills the row instead of leaving an empty half. */
    .rowcard__kv:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        border-inline-end: 0;
    }

    /* No line under the last row: the frame closes it. */
    .rowcard__kv:last-child,
    .rowcard__kv:nth-last-child(2):nth-child(odd) {
        border-block-end: 0;
    }

    /* Values line up under their labels, numbers included (plaintext would
       push a bare figure to the far side). */
    [dir="rtl"] .rowcard__kv dd { text-align: right; }
    [dir="ltr"] .rowcard__kv dd { text-align: left; }

    .rowcard__kv dt {
        font-size: 11px;
        color: var(--text-on-dark-muted);
    }

    .rowcard__kv dd {
        margin: 0;
        font-size: 13px;
        font-weight: 600;
        overflow-wrap: anywhere;
        unicode-bidi: plaintext;
    }

    .rowcard__extra {
        padding: 0 12px 12px;
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .rowcard__extra .btn {
        inline-size: 100%;
        block-size: 36px;
    }

    .rowcard__actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 0 12px 12px;
    }

    .rowcard__actions .btn {
        block-size: 36px;
    }

    .rowcards__more {
        block-size: 40px;
    }

    /* -- Filter button and sheet ------------------------------------------ */

    .mfilter {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .mfilter .ico svg {
        inline-size: 15px;
        block-size: 15px;
    }

    .mfilter__count {
        min-inline-size: 18px;
        block-size: 18px;
        padding-inline: 4px;
        border-radius: 999px;
        background: var(--accent);
        color: var(--accent-ink);
        font-size: 11px;
        font-weight: 700;
        display: grid;
        place-items: center;
    }

    .mfiltersheet[open] {
        display: flex;
    }

    .mfiltersheet__form {
        display: flex;
        flex-direction: column;
        min-block-size: 0;
        max-block-size: 82vh;
        inline-size: 100%;
    }

    .mfiltersheet__body {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 14px 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .mfgroup {
        margin: 0;
        padding: 0;
        border: 0;
        min-inline-size: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mfgroup__label {
        padding: 0;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-on-dark-muted);
    }

    .mfgroup__search {
        block-size: 38px;
        padding-inline: 12px;
        border-radius: 9px;
        border: 1px solid var(--border-strong);
        background: var(--surface-input);
        color: var(--text-on-dark);
        font-size: 16px;
    }

    .mfgroup__chips {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mfopt input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .mfopt {
        position: relative;
    }

    .mfopt[hidden] {
        display: none;
    }

    .mfopt span {
        display: block;
        padding: 7px 14px;
        border-radius: var(--radius-pill);
        border: 1px solid var(--border-strong);
        font-size: 13px;
        font-weight: 600;
        color: var(--text-on-dark-muted);
        cursor: pointer;
        unicode-bidi: plaintext;
    }

    .mfopt input:checked + span {
        background: var(--accent-soft);
        border-color: var(--sell-line);
        color: var(--accent);
    }

    .mfopt input:focus-visible + span {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .mfiltersheet__foot {
        flex: none;
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 8px;
        padding: 12px 16px 16px;
        border-block-start: 1px solid var(--border);
    }

    .mfiltersheet__foot .btn {
        block-size: 44px;
    }

    .rowcards__empty {
        padding: 20px;
        text-align: center;
        font-size: 13px;
        color: var(--text-on-dark-muted);
    }

    /* -- Customers page ---------------------------------------------------- */

    .clientslayout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    /* The list and its controls join the page's own column, so the tabs can sit
       between the tiles and the list. */
    .clientsmain {
        display: contents;
    }

    .pagehead {
        display: none;
    }

    .clientslayout:not(.clientslayout--detail) .clientsbar { order: 1; }
    .clientslayout:not(.clientslayout--detail) .clientsmain > .cards { order: 2; }
    .clientslayout:not(.clientslayout--detail) .sidenav { order: 3; }
    .clientslayout:not(.clientslayout--detail) .clientsmain > .card--table { order: 4; }

    .clientsbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .searchbar {
        position: relative;
        flex: 0 0 auto;
        inline-size: 100%;
    }

    .searchbar__input {
        inline-size: 100%;
        block-size: 42px;
        padding-inline-start: 40px;
        font-size: 16px;
    }

    .searchbar__icon {
        position: absolute;
        inset-inline-start: 12px;
        inset-block-start: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .searchbar button[type="submit"] {
        display: none;
    }

    .sidenav {
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    .sidenav__title {
        display: none;
    }

    .sidenav__list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .sidenav__item {
        justify-content: center;
        block-size: 40px;
        padding: 0 8px;
        border-radius: 9px;
        border: 1px solid var(--border-strong);
        background: transparent;
        color: var(--text-on-dark-muted);
        font-size: 13px;
        font-weight: 600;
        box-shadow: none;
    }

    .sidenav__item.is-active {
        background: var(--accent-soft);
        border-color: var(--sell-line);
        color: var(--accent);
    }

    .rowcard__link {
        color: inherit;
    }

    .pager__sizes {
        display: none;
    }

    .clientsmore {
        display: flex;
        block-size: 40px;
    }

    /* ----------------------------------------------------------------------
       Stat cards → compact tiles
       ---------------------------------------------------------------------- */

    .cards,
    .cards--pair,
    .cards--single {
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 8px;
    }

    .cards--single {
        grid-template-columns: minmax(0, 1fr);
    }

    .card--stat {
        display: block;
        padding: 10px 12px;
        border-radius: 14px;
        background: var(--glass-fill);
        border: 1px solid var(--border-glass);
    }

    .card--stat::after,
    .card--stat .staticon {
        display: none;
    }

    .card--stat .card__label {
        font-size: 12px;
        letter-spacing: 0;
        line-height: 1.5;
    }

    .card--stat .card__badge {
        margin-inline-start: 4px;
        padding: 1px 6px;
        font-size: 10px;
    }

    .card--stat .card__value {
        margin-block-start: 2px;
        font-size: 20px;
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    .card--stat .card__unit {
        margin-block-start: 0;
    }

    .card--stat .card__value--list {
        gap: 4px 12px;
    }

    /* Long figures and tiles that carry a unit take the whole row. */
    .card--stat:has(.card__unit:not(.card__unit--inline)),
    .card--stat:has(.card__value--list) {
        grid-column: 1 / -1;
    }

    .card--buy    { background: var(--buy-fill);    border-color: var(--buy-line); }
    .card--sell,
    .card--accent { background: var(--sell-fill);   border-color: var(--sell-line); }
    .card--good,
    .card--profit { background: var(--good-fill);   border-color: var(--good-line); }

    .card--buy    .card__label { color: var(--buy-ink); }
    .card--sell   .card__label,
    .card--accent .card__label { color: var(--sell-ink); }
    .card--good   .card__label,
    .card--profit .card__label { color: var(--good-ink); }

    /* ----------------------------------------------------------------------
       Charts: doughnuts become a stacked bar + a list
       ---------------------------------------------------------------------- */

    .chart__canvas {
        display: none;
    }

    .stackbar-wrap {
        display: block;
        inline-size: 100%;
    }

    .stackbar__total {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
        margin: 0 0 8px;
    }

    .stackbar__totallabel {
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .stackbar__total b {
        font-size: 16px;
        font-weight: 700;
        unicode-bidi: isolate;
    }

    .stackbar {
        display: flex;
        gap: 2px;
        block-size: 8px;
        inline-size: 100%;
    }

    .stackbar__seg {
        flex-basis: 0;
        min-inline-size: 4px;
        border-radius: 999px;
        background: var(--border-strong);
    }

    .chart {
        gap: 10px;
    }

    .legend {
        gap: 0;
    }

    .legend__item {
        gap: 8px;
        padding-block: 8px;
        font-size: 13px;
        border-block-end: 1px solid var(--border);
    }

    .legend__item:last-child {
        border-block-end: 0;
    }

    .legend__swatch {
        inline-size: 8px;
        block-size: 8px;
        border-radius: 50%;
    }

    .legend__percent {
        min-inline-size: 3.4em;
        font-size: 12px;
    }

    /* Debts: one chart at a time, chosen with two separate buttons. */
    .charttabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .charttabs__btn {
        block-size: 40px;
        padding: 0 8px;
        border-radius: 9px;
        border: 1px solid var(--border-strong);
        background: transparent;
        color: var(--text-on-dark-muted);
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
    }

    .charttabs__btn.is-active {
        background: var(--accent-soft);
        border-color: var(--sell-line);
        color: var(--accent);
    }

    [data-chart-tabs] {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    [data-chart-tabs] > .card--chart:not(.is-active) {
        display: none;
    }

    /* Trades: the two cards are separate, 12px apart. */
    .charts {
        gap: 12px;
    }

    /* Line charts and the top-expenses bars shrink to a glance. */
    .plot {
        block-size: 90px;
        margin-block-start: 8px;
    }

    .plot--bars {
        display: none;
    }

    .card--chart {
        min-block-size: 0;
    }

    .toprows {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-block-start: 8px;
    }

    .toprows__item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 10px;
        align-items: baseline;
    }

    .toprows__name {
        font-size: 13px;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        unicode-bidi: plaintext;
    }

    .toprows__amount {
        font-size: 13px;
        font-weight: 700;
        unicode-bidi: isolate;
    }

    .toprows__bar {
        grid-column: 1 / -1;
        block-size: 6px;
        border-radius: 999px;
        background: var(--border);
        overflow: hidden;
    }

    .toprows__bar > span {
        display: block;
        block-size: 100%;
        border-radius: 999px;
        background: var(--accent);
    }

    /* ----------------------------------------------------------------------
       Balances
       ---------------------------------------------------------------------- */

    /* Net profit first, then the currencies. */
    .page > .balrow { order: -3; }
    .page > .balances__heading { order: -2; }
    .page > .cards--balances { order: -1; }

    .balances__heading {
        justify-content: space-between;
        margin: 0;
        font-size: 15px;
    }

    .balances__heading svg {
        display: none;
    }

    .balrow {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
    }

    .balrow__profit,
    .balrow__chart {
        padding: 14px 16px;
        border-radius: 20px;
    }

    .balrow__profit-head {
        margin-block-end: 6px;
    }

    .balrow__profit-title svg {
        display: none;
    }

    .balrow__profit-title span {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-on-dark-muted);
    }

    .balrow__profit-report {
        padding: 4px 10px;
        font-size: 12px;
        border-color: var(--sell-line);
        background: var(--sell-fill);
        color: var(--sell-ink);
    }

    .balrow__profit-report svg {
        display: none;
    }

    .balrow__profit-value {
        display: inline;
        font-size: 26px;
        line-height: 1.1;
        color: var(--good-ink);
    }

    .balrow__profit-unit {
        display: inline;
        margin-inline-start: 6px;
        font-size: 12px;
    }

    .balrow__profit-changes {
        margin-block-start: 10px;
        flex-direction: row;
        gap: 6px;
    }

    .profitchange {
        flex: 1 1 0;
        min-inline-size: 0;
        flex-wrap: wrap;
        align-content: flex-start;
        gap: 0 4px;
        padding: 6px 8px;
        border-radius: 9px;
        background: var(--surface-input);
        border: 1px solid var(--border);
    }

    .profitchange--up   { background: var(--good-fill);   border-color: var(--good-line); }
    .profitchange--down { background: var(--danger-fill); border-color: var(--danger-line); }

    .profitchange--up .profitchange__percent,
    .profitchange--up svg   { color: var(--good-ink); }
    .profitchange--down .profitchange__percent,
    .profitchange--down svg { color: var(--danger-ink); }

    .profitchange__percent {
        font-size: 13px;
    }

    .profitchange__label {
        flex: 1 1 100%;
        font-size: 10.5px;
        line-height: 1.4;
        color: var(--text-on-dark-muted);
    }

    .balrow__chart-title {
        margin-block-end: 0;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-on-dark-muted);
    }

    /* Currency cards: two columns, the whole card is the tap target. */
    .cards--balances {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .balcard {
        padding: 12px;
        border-radius: 14px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        background: var(--glass-fill);
    }

    .balcard::after {
        block-size: 2px;
        box-shadow: none;
    }

    .balcard__head {
        flex-direction: row;
        margin-block-end: 10px;
        align-items: center;
    }

    .balcard__flag {
        order: -1;
        inline-size: 28px;
        block-size: 28px;
    }

    .balcard__names {
        flex: 1 1 auto;
        align-items: flex-start;
    }

    .balcard__name {
        font-size: 13.5px;
        font-weight: 600;
        line-height: 1.2;
    }

    .balcard__code {
        font-size: 10.5px;
    }

    .balcard__body {
        padding: 0;
    }

    .balcard__wallet,
    .balcard__unit {
        display: none;
    }

    .balcard__value {
        font-size: 17px;
        font-weight: 700;
    }

    /* The detail lives in the bottom sheet here. */
    .balrow__detail {
        display: none;
    }

    .balsheet {
        overflow-y: auto;
        padding: 12px 16px 18px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .balsheet[hidden] {
        display: none;
    }

    .balsheet__total {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 14px;
        background: var(--sell-fill);
        border: 1px solid var(--sell-line);
    }

    .balsheet__total--usd,
    .balsheet__total--eur { background: var(--buy-fill); border-color: var(--buy-line); }
    .balsheet__total--usdt,
    .balsheet__total--aed { background: var(--good-fill); border-color: var(--good-line); }
    .balsheet__total--try,
    .balsheet__total--cny { background: var(--danger-fill); border-color: var(--danger-line); }

    .balsheet__totallabel {
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .balsheet__totalvalue {
        font-size: 18px;
        font-weight: 700;
        unicode-bidi: isolate;
    }

    .balsheet__totalvalue small {
        font-size: 12px;
        font-weight: 500;
        color: var(--text-on-dark-muted);
    }

    .balsheet__rows {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .balsheet__row {
        display: grid;
        grid-template-columns: 22px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding-block: 10px;
        border-block-end: 1px solid var(--border);
    }

    .balsheet__n {
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .balsheet__who {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-inline-size: 0;
    }

    .balsheet__title,
    .balsheet__sub {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        unicode-bidi: plaintext;
    }

    .balsheet__title {
        font-size: 14px;
        font-weight: 600;
    }

    .balsheet__sub {
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .balsheet__amount {
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        unicode-bidi: isolate;
    }

    .balsheet__empty {
        padding: 20px;
        text-align: center;
        font-size: 13px;
        color: var(--text-on-dark-muted);
    }

    /* ----------------------------------------------------------------------
       Open orders: one card, a thin bar per order
       ---------------------------------------------------------------------- */

    .obars {
        gap: 0;
        padding-inline: 16px;
        background: var(--glass-fill);
        border: 1px solid var(--border-glass);
        border-radius: 20px;
    }

    .obar {
        background: none;
        border: 0;
        border-radius: 0;
        border-block-end: 1px solid var(--border);
    }

    .obar:last-of-type {
        border-block-end: 0;
    }

    .obar__head {
        padding: 12px 0 6px;
        background: none;
        color: var(--text-on-dark);
    }

    .obar__person {
        font-size: 14px;
        font-weight: 600;
    }

    .obar__pct {
        display: inline;
        margin-inline-start: auto;
        font-size: 13px;
        font-weight: 700;
        color: var(--accent);
    }

    .obar__chev {
        color: var(--text-on-dark-muted);
    }

    .obar__body {
        display: flex;
        flex-direction: column;
        padding: 0 0 12px;
    }

    .obar__track {
        order: 0;
        block-size: 6px;
    }

    .obar__fill {
        background: var(--accent);
    }

    .obar__fill::after {
        display: none;
    }

    .obar__figures {
        order: 1;
        margin: 6px 0 0;
        flex-wrap: nowrap;
        gap: 8px;
        font-size: 12px;
        font-weight: 500;
        color: var(--text-on-dark-muted);
    }

    .obar__payers {
        padding-inline: 0;
    }

    /* ----------------------------------------------------------------------
       One customer's page
       ---------------------------------------------------------------------- */

    .clientslayout--detail .sidenav,
    .crumbs,
    .clienthead__facts {
        display: none;
    }

    .clienthead {
        padding: 14px 16px;
    }

    .clienthead__top {
        gap: 10px;
    }

    .avatar--lg {
        inline-size: 48px;
        block-size: 48px;
    }

    .clienthead__name {
        font-size: 17px;
        font-weight: 700;
    }

    /* Four totals in a 2 x 2 grid. */
    .cards--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card--statlist {
        align-items: stretch;
    }

    .statlist {
        margin-block-start: 4px;
        gap: 2px;
    }

    .statlist__amount {
        font-size: 15px;
    }

    .statlist__currency {
        font-size: 11px;
    }

    .statlist__none {
        margin-block-start: 4px;
        font-size: 15px;
    }

    .infogrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 14px;
    }

    .infogrid__item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .infogrid__item:nth-last-child(2) {
        border-block-end: 0;
    }

    .infogrid__value {
        font-size: 13.5px;
    }

    /* History tabs: two separate buttons. */
    .tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        border-block-end: 0;
    }

    .tabs__tab {
        justify-content: center;
        block-size: 40px;
        padding: 0 8px;
        margin: 0;
        border: 1px solid var(--border-strong);
        border-radius: 9px;
        font-size: 13px;
    }

    .tabs__tab svg {
        display: none;
    }

    .tabs__tab.is-active {
        background: var(--accent-soft);
        border-color: var(--sell-line);
    }

    /* ----------------------------------------------------------------------
       Profile
       ---------------------------------------------------------------------- */

    .custgrid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .logobox {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .logobox__preview {
        inline-size: 56px;
        block-size: 56px;
    }

    .logobox .subcard__hint {
        flex: 1 1 100%;
    }

    .custsection__head {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ucards {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .ucard {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 14px;
        background: var(--glass-fill);
        border: 1px solid var(--border-glass);
    }

    .ucard__avatar {
        flex: none;
        inline-size: 36px;
        block-size: 36px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        font-size: 13px;
        font-weight: 700;
        background: var(--sell-fill);
        border: 1px solid var(--sell-line);
        color: var(--sell-ink);
    }

    .ucard__main {
        flex: 1 1 auto;
        min-inline-size: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .ucard__title {
        font-size: 14px;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

    .ucard__sub {
        font-size: 12px;
        color: var(--text-on-dark-muted);
    }

    .ucard__pills {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-block-start: 2px;
    }

    .ucard .rowactions {
        flex: none;
        gap: 6px;
    }

    .ucard .iconbtn {
        inline-size: 34px;
        block-size: 34px;
    }

    /* Add / edit dialogs open from the bottom edge. */
    dialog.custdialog,
    dialog.rowdialog {
        inset: auto 0 0 0;
        margin: 0;
        inline-size: 100%;
        max-inline-size: none;
        max-block-size: 90vh;
        border-radius: 20px 20px 0 0;
        border-block-end: 0;
    }

    /* ----------------------------------------------------------------------
       Login
       ---------------------------------------------------------------------- */

    .login {
        min-block-size: 100dvh;
        padding: 20px 24px 28px;
        align-items: stretch;
        background: var(--backdrop-page, var(--bg));
    }

    .login__card {
        max-inline-size: none;
        min-block-size: calc(100dvh - 48px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 22px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }

    .login .langrow {
        align-self: center;
        inline-size: 220px;
    }

    .login__mark svg {
        inline-size: 64px;
        block-size: 64px;
    }

    .login__title {
        font-size: 26px;
        font-weight: 700;
    }

    .login__subtitle {
        font-size: 14px;
    }

    .login__form {
        gap: 14px;
    }

    .login .field__input {
        block-size: 48px;
        font-size: 16px;
    }

    .login .loginpw .field__input {
        padding-inline-end: 48px;
    }

    .loginpw__toggle {
        position: absolute;
        inset-inline-end: 6px;
        inset-block-start: 6px;
        display: grid;
        place-items: center;
        inline-size: 36px;
        block-size: 36px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--text-on-dark-muted);
        cursor: pointer;
    }

    .loginpw__toggle svg {
        inline-size: 17px;
        block-size: 17px;
    }

    .login .btn--primary {
        block-size: 50px;
        font-size: 15px;
        font-weight: 700;
    }

    .login .alert--error {
        padding: 10px 14px;
        background: var(--danger-fill);
        border: 1px solid var(--danger-line);
        color: var(--danger-ink);
    }

    /* Trades: «one-way / two-way» buttons; only the chosen section is shown. */
    .modegroup {
        display: none;
        flex-direction: column;
        gap: 12px;
    }

    .modegroup.is-active {
        display: flex;
    }

    .modegroup > .sectionhead {
        display: none;
    }

    .charttabs[data-mode-tabs] {
        display: grid;
    }
}

/* Gold trades on phones: a deal's pieces inside its card, each a small
   card of its own drawn with the same pieces as .rowcard (head line, the
   label/value grid, the two action buttons). */
@media (max-width: 640px) {
    .dealpieces {
        display: grid;
        gap: 8px;
        margin-block-end: 10px;
    }

    .dealpiece {
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-muted);
        overflow: hidden;
    }

    .dealpiece__head {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .dealpiece__n {
        flex: none;
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--accent-soft);
        color: var(--accent);
        font-size: 11px;
        font-weight: 700;
    }

    .dealpiece__title {
        flex: 1;
        min-inline-size: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-on-dark);
    }

    .dealpiece__price {
        flex: none;
        font-size: 14px;
        font-weight: 700;
        direction: ltr;
    }

    /* A piece's details as a small table: two columns of label/value
       cells with lines between them, so the figures line up and read apart. */
    .rowcard__extra .dealpiece__grid {
        gap: 0;
        margin: 0 12px;
        padding: 0;
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        overflow: hidden;
    }

    .rowcard__extra .dealpiece__grid .rowcard__kv {
        padding: 8px 10px;
        border-block-end: 1px solid var(--border-strong);
    }

    .rowcard__extra .dealpiece__grid .rowcard__kv:nth-child(odd) {
        border-inline-end: 1px solid var(--border-strong);
    }

    /* Values line up under their labels, numbers included (plaintext would
       push a bare figure to the far side). */
    [dir="rtl"] .rowcard__extra .dealpiece__grid dd { text-align: right; }
    [dir="ltr"] .rowcard__extra .dealpiece__grid dd { text-align: left; }

    /* An odd last cell fills the row instead of leaving an empty half. */
    .rowcard__extra .dealpiece__grid .rowcard__kv:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        border-inline-end: 0;
    }

    /* No line under the last row: the frame closes it. */
    .rowcard__extra .dealpiece__grid .rowcard__kv:last-child,
    .rowcard__extra .dealpiece__grid .rowcard__kv:nth-last-child(2):nth-child(odd) {
        border-block-end: 0;
    }

    .rowcard__extra .dealpiece__grid .rowcard__kv:nth-child(4n+1),
    .rowcard__extra .dealpiece__grid .rowcard__kv:nth-child(4n+2) {
        background: rgba(255, 255, 255, 0.02);
    }

    /* .rowcard__extra mutes its text; a piece's figures read like the card's own. */
    .rowcard__extra .dealpiece__grid dd,
    .rowcard__extra .dealpiece__price {
        color: var(--text-on-dark);
    }

    .rowcard__extra .dealpiece__actions {
        padding: 10px 12px 12px;
    }

    .rowcard__extra .dealpiece__actions .btn {
        block-size: 36px;
    }

    .rowcard__extra .dealadd {
        display: block;
        margin: 0;
    }

    .rowcard__extra .dealadd .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .rowcard__extra .dealadd svg {
        inline-size: 15px;
        block-size: 15px;
    }

    .tablenote {
        margin: 0 0 10px;
        font-size: 12px;
    }
}

/* Notifications bell in the phone header: a link to the notifications page. */
.mbell { display: none; }
@media (max-width: 640px) {
    .mbell {
        position: relative;
        flex: none;
        display: grid;
        place-items: center;
        inline-size: 36px;
        block-size: 36px;
        margin-inline-start: auto;
        border: 1px solid var(--border-strong);
        border-radius: 50%;
        background: var(--surface-input);
        color: var(--text-on-dark);
    }
    .mbell.is-active { border-color: var(--sell-line); }
    .notifymaster { flex-direction: column; align-items: stretch; }
    .notifyitem { flex-wrap: wrap; }
    .notifyitem__btn { margin-inline-start: 18px; }
}

/* ==========================================================================
   2026-11-12 design refresh, phone side (Claude Design mobile handoff).
   Every page: tinted stat tiles that lift when touched, roomier row cards
   with a gold edge when open, 44px tap targets, and the add/edit sheet that
   slides up from the bottom.
   ========================================================================== */
@media (max-width: 640px) {
    .cards,
    .cards--pair {
        gap: 10px;
    }

    .card--stat {
        min-block-size: 104px;
        padding: 14px;
        border-radius: 16px;
        background: linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }
    .card--good,
    .card--profit { background: linear-gradient(160deg, rgba(25, 158, 112, 0.13), rgba(255, 255, 255, 0.01)); border-color: rgba(25, 158, 112, 0.5); }
    .card--buy    { background: linear-gradient(160deg, rgba(57, 135, 229, 0.15), rgba(255, 255, 255, 0.01)); border-color: rgba(57, 135, 229, 0.5); }
    .card--sell,
    .card--accent { background: linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)); border-color: rgba(224, 162, 43, 0.55); }

    .card--stat .card__label {
        font-size: 13px;
        font-weight: 700;
    }
    .card--stat .card__value {
        font-size: 24px;
    }
    .card--stat .card__sub {
        font-size: 12px;
    }
    .card--stat:active {
        transform: translateY(-3px);
        box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.7);
    }

    /* The coin value card spans the row under the four coin types (2 × 2). */
    .cards--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cards--four .card--wide {
        grid-column: 1 / -1;
    }
    .card--stat .card__value--money {
        font-size: 22px;
    }

    /* Buttons: 44px tap targets. */
    .btn {
        min-block-size: 44px;
        border-radius: 12px;
    }
    .rowtools .btn {
        min-block-size: 48px;
    }

    /* Row cards. */
    .rowcard__body {
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.035);
        border-color: rgba(255, 255, 255, 0.1);
        transition: border-color 0.3s ease, background 0.3s ease;
    }
    .rowcard__body[open] {
        border-color: rgba(224, 162, 43, 0.45);
        background: linear-gradient(160deg, rgba(224, 162, 43, 0.06), rgba(255, 255, 255, 0.02));
    }
    .rowcard__sum {
        gap: 12px;
        padding: 14px;
    }
    /* The badge carries a product code on the gold pages, so it grows. */
    .rowcard__badge {
        inline-size: auto;
        min-inline-size: 44px;
        block-size: 44px;
        padding: 0 6px;
        border-radius: 12px;
        font-size: 13px;
        max-inline-size: 30%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .rowcard__title  { font-size: 15.5px; font-weight: 700; }
    .rowcard__sub    { font-size: 12.5px; }
    .rowcard__amount { font-size: 15px; }
    .rowcard__meta   { font-size: 12.5px; }
    .rowcard__actions .btn {
        min-block-size: 48px;
    }

    /* Add / edit: a sheet that slides up, over a dimmed, blurred page. */
    dialog.rowdialog,
    dialog.custdialog {
        max-block-size: 88vh;
        border-radius: 22px 22px 0 0;
        background: linear-gradient(180deg, rgba(26, 44, 72, 0.96), rgba(14, 27, 48, 0.97));
    }
    dialog.rowdialog[open],
    dialog.custdialog[open] {
        animation: sheet-up 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    }
    dialog.rowdialog::backdrop,
    dialog.custdialog::backdrop {
        background: rgba(4, 9, 18, 0.7);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .rowdialog .field__input {
        min-block-size: 46px;
        border-radius: 10px;
    }
    .rowdialog .chips {
        grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    }

    .searchbar .searchbar__input {
        block-size: 52px;
        border-radius: 12px;
    }
}

@keyframes sheet-up {
    from { transform: translateY(105%); }
    to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    dialog.rowdialog[open],
    dialog.custdialog[open] { animation: none; }
}
