/* ------------------------------------------------------------------------
   FinVentures component layer.

   The product-neutral half of the merchant portal's stylesheet: shell and
   sidebar, cards, grids, tables, badges, buttons, form controls, switches,
   stat tiles and the responsive breakpoints. Everything here is reusable
   across FinVentures products.

   What is deliberately NOT here: charts (bar, donut, trend), the transaction
   drawer, and the screen-specific blocks for Fees, Reports, Reconciliation,
   Settlements, Notifications and Team. Those encode one product's screens and
   belong with it.

   Requires tokens.css, loaded first. Not one raw hex value appears below —
   every colour resolves through a token, which is what makes a rebrand a
   one-file change.

   Extracted from merchant-portal/src/main/resources/static/css/app.css.
   That file remains the working copy; this is the shareable one.
   ------------------------------------------------------------------------ */
/* --- Shell -------------------------------------------------------------- */

/* height, not min-height, and the overflow hidden with it. Together these
   stop the PAGE scrolling and hand scrolling to the two columns instead, so
   the navigation stays put while a long table moves under it.

   With min-height the shell grew to fit its content, .content had nothing to
   overflow against, and its overflow:auto did nothing - the whole document
   scrolled and took the sidebar with it. */
.shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}


/* --- Sidebar ------------------------------------------------------------ */

.sidebar {
    width: 264px;
    flex: 0 0 264px;
    background: var(--fv-navy);
    display: flex;
    flex-direction: column;
    padding: 28px 16px;
    /* Eight nav rows plus the user block can exceed a short viewport, so the
       sidebar scrolls on its own rather than being clipped. */
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

/* The approved logo asset.

   96px rather than the prototype's 64px: it sits on the 4px spacing grid and
   clears the 80px minimum size the brand guidelines require, which the
   prototype's 64px tile did not.

   Deliberately NO border-radius. The logo is a square tile with its own black
   keyline; rounding the corners would clip that border, which counts as
   cropping the approved asset. object-fit: contain keeps it undistorted. */
.sidebar__logo {
    width: 96px;
    height: 96px;
    display: block;
    object-fit: contain;
}

.sidebar__wordmark {
    color: var(--fv-white);
    font-weight: var(--weight-bold);
    font-size: 15px;
    letter-spacing: var(--tracking-wide);
}

.sidebar__merchant {
    padding: 14px 12px 20px;
    border-bottom: 1px solid var(--fv-navy-800);
    margin-bottom: 12px;
}

.eyebrow-dark {
    color: var(--fv-slate-400);
    font-size: 11px;
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.sidebar__merchant-name {
    color: var(--fv-white);
    font-size: 16px;
    font-weight: var(--weight-bold);
    margin-top: 4px;
}

.sidebar__merchant-meta {
    color: var(--fv-slate-400);
    font-size: 12px;
    margin-top: 6px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
    text-decoration: none;
    color: var(--fv-slate-400);
    font-weight: var(--weight-regular);
    transition: background var(--motion-fast) var(--ease),
                color var(--motion-fast) var(--ease);
}

.nav__row:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--fv-white);
}

.nav__row.is-active {
    background: var(--fv-navy-800);
    color: var(--fv-white);
    font-weight: var(--weight-semibold);
}

.nav__icon {
    width: 18px;
    text-align: center;
}

.nav__label {
    flex: 1;
}

.nav__count {
    background: var(--fv-yellow);
    color: var(--fv-black);
    font-size: 11px;
    font-weight: var(--weight-bold);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    min-width: 20px;
    text-align: center;
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--fv-navy-800);
}

.sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fv-yellow);
    color: var(--fv-black);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 16px;
}

.sidebar__user-name {
    color: var(--fv-white);
    font-size: 14px;
    font-weight: var(--weight-bold);
}

.sidebar__user-role {
    color: var(--fv-slate-400);
    font-size: 12px;
}

/* One-shot confirmation banner at the top of the content column.
   Uses the existing success tokens rather than inventing a green ramp:
   --state-success-bg is the same tint the alert icons use. */
.page-notice {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 20px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--state-success-bg);
    border-left: 3px solid var(--fv-success);
    color: var(--text-body);
}

.page-notice i {
    color: var(--fv-success);
}

/* Same banner, used to report that something could not be loaded rather than
   that something succeeded. Warning rather than danger: the merchant has lost
   nothing, the screen just cannot show it right now. */
.page-notice--warn {
    background: var(--state-warning-bg);
    border-left-color: var(--fv-gold);
}

.page-notice--warn i {
    color: var(--fv-gold);
}

/* Pushes the sign-out button to the far edge of the user row. */
.sidebar__logout {
    margin-left: auto;
}

.sidebar__logout-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--fv-slate-400);
    font-size: 14px;
    line-height: 1;
    border-radius: 4px;
}

.sidebar__logout-btn:hover {
    color: var(--fv-white);
    background: var(--fv-navy-800);
}

/* Keyboard users need to see focus; the button is icon-only, so without this
   there is no indication of where they are. */
.sidebar__logout-btn:focus-visible {
    outline: 2px solid var(--fv-yellow);
    outline-offset: 2px;
}


/* --- Content column ----------------------------------------------------- */

.content {
    flex: 1;
    min-width: 0;
    padding: 40px 48px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 32px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 16px;
}


/* --- Card --------------------------------------------------------------- */

.card {
    background: var(--surface-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow var(--motion-base) var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Table cards carry no padding; their header and table supply their own. */
.card--flush {
    padding: 0;
}

.card__header {
    padding: 20px 24px;
    font-size: 16px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    border-bottom: 1px solid var(--border-subtle);
}

.card__title {
    font-size: 16px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 20px;
}


/* --- Grids -------------------------------------------------------------
   Always auto-fit + minmax, never a fixed track count, so columns reflow
   and collapse by available width. */

.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.grid--kpi {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid--charts {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Three-up stat tiles: slightly wider minimum than the four-up KPI grid. */
.grid--stats {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}


/* --- KPI tile ----------------------------------------------------------- */

.kpi__label {
    color: var(--text-muted);
    font-size: 14px;
}

.kpi__value {
    font-size: 28px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-top: 10px;
}

.kpi__sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 14px;
    font-weight: var(--weight-semibold);
}


/* --- Table -------------------------------------------------------------
   Wrapped in .table-wrap so wide tables scroll inside their card rather
   than clipping or stretching the page. */

.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th {
    text-align: left;
    padding: 12px 24px;
    font-size: 11px;
    font-weight: var(--weight-bold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

table.data td {
    padding: 14px 24px;
    color: var(--text-body);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}


/* --- Badge -------------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    text-transform: capitalize;
}

.badge--success {
    background: var(--state-success-bg);
    color: var(--fv-success);
}

.badge--warning {
    background: var(--state-warning-bg);
    color: var(--fv-warning);
}

.badge--danger {
    background: var(--state-danger-bg);
    color: var(--fv-danger);
}

.badge--neutral {
    background: var(--fv-slate-200);
    color: var(--text-muted);
}

.badge--navy {
    background: var(--fv-navy);
    color: var(--fv-white);
}


/* --- Not-yet-built screens ---------------------------------------------- */

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.placeholder__icon {
    font-size: 28px;
    color: var(--fv-slate-400);
    margin-bottom: 16px;
}

.placeholder__title {
    font-size: 16px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 8px;
}

.placeholder__body {
    font-size: 14px;
    max-width: 48ch;
    margin: 0;
}


/* --- Page header with a right-aligned action --------------------------- */

.page-header--split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}


/* --- Buttons -----------------------------------------------------------
   Two variants from the design: alt (navy fill) and outline. Press scales
   to 98%; hover lifts navy to navy-800 and gives outline a slate wash. */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border-radius: var(--radius-input);
    font-family: inherit;
    font-size: 14px;
    font-weight: var(--weight-semibold);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--motion-fast) var(--ease),
                border-color var(--motion-fast) var(--ease),
                transform var(--motion-fast) var(--ease);
}

.btn:active {
    transform: scale(.98);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .35);
}

.btn--alt {
    background: var(--fv-navy);
    color: var(--fv-white);
}

.btn--alt:hover {
    background: var(--fv-navy-800);
}

.btn--outline {
    background: transparent;
    color: var(--text-heading);
    border-color: var(--border-default);
}

.btn--outline:hover {
    background: var(--fv-slate-100);
}


/* --- Form controls ------------------------------------------------------ */

.input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-body);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-input);
}

.input:focus {
    outline: none;
    border-color: var(--fv-navy);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .35);
}


/* --- Filter bar --------------------------------------------------------- */

.filters {
    margin-bottom: 24px;
}

.filters__row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters__search {
    flex: 1;
    min-width: 240px;
}

.filters__select {
    width: 160px;
}

.filters__select--wide {
    width: 200px;
}

.filters__meta {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}


/* --- Table link --------------------------------------------------------- */

.tx-link {
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.tx-link:hover {
    text-decoration: underline;
}


/* --- Small uppercase section label -------------------------------------- */

.eyebrow {
    font-size: 11px;
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
}


/* --- Three-line stat tile ----------------------------------------------
   The settlements and fees variant: 26px value, coloured sub-line, and a
   muted second line. Distinct from the dashboard's 28px KPI with an arrow. */

.stat__label {
    color: var(--text-muted);
    font-size: 14px;
}

.stat__value {
    font-size: 26px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-top: 10px;
}

.stat__sub {
    font-size: 14px;
    font-weight: var(--weight-semibold);
    margin-top: 8px;
}

.stat__sub2 {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}


/* --- Small button ------------------------------------------------------- */

.btn--sm {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
}


/* --- Negative money in a table cell ------------------------------------- */

.amount--negative {
    color: var(--fv-danger);
}


/* --- Table cell variants -------------------------------------------------- */

/* Long prose in a table should wrap rather than force a scrollbar. */
.cell--wrap {
    white-space: normal;
    min-width: 280px;
}

.cell--actions {
    display: flex;
    gap: 14px;
}

/* Two lines in one cell: identifier above, human name beneath. */
.cell__primary {
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
}

.cell__secondary {
    font-size: 12px;
    color: var(--text-muted);
}


/* --- Amount emphasis in tables -------------------------------------------- */

.amount--positive {
    color: var(--fv-success);
    font-weight: var(--weight-bold);
}

/* An em dash where a figure would be: muted, not alarming. */
.amount--none {
    color: var(--text-muted);
}

.icon--danger {
    color: var(--fv-danger);
    margin-right: 8px;
}

.icon--muted {
    color: var(--text-muted);
    margin-right: 8px;
}


/* --- Switch --------------------------------------------------------------
   Built on a real <input type="checkbox">: focusable, operable with Space,
   and announced correctly by screen readers. The input is made transparent
   and the track and thumb are painted over it. A div-based toggle would look
   the same and lose every one of those behaviours. */

.switches {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.switches--roomy {
    gap: 20px;
}

.switch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
}

.switch__control {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.switch__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.switch__track {
    position: absolute;
    inset: 0;
    background: var(--fv-slate-200);
    border-radius: var(--radius-pill);
    pointer-events: none;
    transition: background var(--motion-base) var(--ease);
}

.switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fv-white);
    pointer-events: none;
    box-shadow: var(--shadow-sm);
    transition: transform var(--motion-base) var(--ease);
}

.switch__input:checked ~ .switch__track {
    background: var(--fv-navy);
}

.switch__input:checked ~ .switch__thumb {
    transform: translateX(18px);
}

.switch__input:focus-visible ~ .switch__track {
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .35);
}

.switch__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.switch__label {
    font-size: 14px;
    color: var(--text-heading);
    font-weight: var(--weight-semibold);
}

.switch__desc {
    font-size: 12px;
    color: var(--text-muted);
}


/* ==================================================================
   Placeholder data
   ==================================================================
   `ph` marks a value, a row or a whole card whose figures are invented
   rather than fetched. It exists because the portal now mixes the two:
   terminal *identity* is live while terminal *economics* are not, and a
   screen that mixes them without saying so is more misleading than one
   that is honestly all fake.

   Applied at the largest honest granularity — a whole card where the
   card is entirely placeholder, a single cell where the row is mixed.

   Why the descendant selectors rather than plain inheritance: several
   value classes set their own colour (.amount--negative, .amount--fee,
   .metric__value via an inline style). Inherited colour loses to those.
   `.ph td` is specificity (0,1,1) and beats `.amount--negative` at
   (0,1,0), so the grey wins without a single !important.

   Card headers and column headings deliberately keep their normal
   colour. They are labels, not data, and grey headings would make the
   page hard to scan for no gain. */

.ph,
.ph td,
.ph th,
.ph div,
.ph span,
.ph a:not(.btn) {
    color: var(--text-placeholder);
}

/* Table cells need a higher-specificity selector than the block above.
   `table.data td` is (0,1,2) — one class, two elements — and beats `.ph td`
   at (0,1,1), so every placeholder TABLE on every screen was rendering in
   the normal body colour and looking exactly like live data. The comment
   above reasoned about .amount--negative at (0,1,0) and missed the table
   rule, which sits higher than both.

   `.ph table.data td` is (0,2,2) and wins cleanly. `.row--total td` is
   listed too: it sets its own heading colour for the totals row, which
   would otherwise survive inside a placeholder card. */
.ph table.data td,
.ph table.data .row--total td {
    color: var(--text-placeholder);
}

/* Structural labels stay legible. */
.ph .card__header,
.ph .card__header *,
.ph .card__subtitle,
.ph thead th,
.ph .eyebrow {
    color: var(--text-muted);
}
.ph .card__header {
    color: var(--text-heading);
}

/* Inline styles set colour directly on the element, and no selector can
   outrank a style attribute. These are chart marks and coloured figures
   whose colour is computed in Java, so they are desaturated instead —
   the shape survives, the false confidence of brand colour does not. */
.ph [style*="color"],
.ph [style*="background"] {
    filter: grayscale(1) opacity(0.75);
}

/* Badges carry a background as well as text; flag the whole pill. */
.ph .badge {
    background: var(--state-danger-bg);
    color: var(--text-placeholder);
}

/* Chart areas: keep the geometry, flag the colour.

   Desaturating alone is no longer enough. Grey said "de-emphasised" and a
   grey chart is easy to walk past; the point now is that an invented chart
   should be as obvious as an invented figure. sepia+hue-rotate pushes the
   marks red whatever colour Java computed for them, which a flat override
   cannot do for inline styles. */
.ph .bars__bar,
.ph .donut,
.ph .legend__dot,
.ph .brand__fill,
.ph svg.trend,
.ph .progress__fill {
    filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-28deg) opacity(0.85);
}

/* The legend that explains the red. Sits under the page title. */
.ph-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-placeholder);
}
.ph-note__swatch {
    width: 26px;
    height: 10px;
    border-radius: 3px;
    background: var(--text-placeholder);
    flex: none;
}

/* `live` opts a cell back out of `ph`, for rows that mix the two — a
   terminal's id and name come from the API while its money does not.
   Specificity (0,2,0) and (0,2,1) beat the `.ph` rules above. */
.ph .live,
.ph .live * {
    color: var(--text-body);
}
.ph td.live,
.ph th.live,
.ph div.live,
.ph span.live {
    color: var(--text-body);
}

/* And inside a table, above `.ph table.data td` at (0,2,2). Without this the
   fix for placeholder tables would have swallowed the escape hatch, turning
   genuinely live cells — a terminal's real id and name beside its invented
   volume — red along with everything around them. */
.ph table.data td.live,
.ph table.data th.live {
    color: var(--text-body);
}
.ph .live .cell__secondary {
    color: var(--text-muted);
}

/* Explains an empty fee-profile card. Muted, because it is an explanation
   rather than a warning: "no profile assigned yet" is a normal state for a
   newly onboarded merchant, not an error to alarm them about. */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

.pager__label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Explains an empty table. Muted, because "no transactions yet" is a normal
   state for a newly onboarded merchant, not an error to alarm them with. */
.table-empty {
    margin: 0;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
}

/* ========================================================================
   Responsive

   The shell was built at one width: a fixed 264px sidebar beside a content
   column with 48px of side padding. That is fine on a desktop and falls apart
   on anything narrower, so these are the breakpoints that keep it usable.

   Ordered largest to smallest, each one only overriding what the previous
   rules got wrong at that size. No layout is redefined from scratch.
   ======================================================================== */


/* --- Laptops and small desktops ---------------------------------------- */
@media (max-width: 1280px) {
    .content {
        padding: 32px 28px;
    }

    /* Below this the three-up chart row leaves each card too narrow for a
       donut and its legend side by side. Two columns reads better than three
       cramped ones. */
    .grid--charts {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* --- Tablets ------------------------------------------------------------
   The sidebar becomes a horizontal strip above the content. Hiding it would
   remove the only navigation, and a 264px column on a 900px screen costs a
   third of the width for eight links. */
@media (max-width: 1024px) {
    /* Stacked, so the two columns no longer scroll independently - the page
       scrolls again and the height/overflow lock above must be released, or
       everything below the first viewport becomes unreachable. */
    .shell {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        overflow-y: visible;
    }

    .sidebar {
        width: 100%;
        flex: 0 0 auto;
        padding: 16px 20px;
    }

    /* Brand and merchant sit side by side rather than stacked, so the strip
       stays shallow and the content is not pushed off the first screen. */
    .sidebar__brand {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }

    .sidebar__logo {
        width: 48px;
        height: 48px;
    }

    .sidebar__merchant {
        padding: 0 0 12px;
        margin-bottom: 12px;
    }

    /* Nav becomes a wrapping row of pills. */
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav__row {
        padding: 8px 12px;
        font-size: 14px;
    }

    .nav__label {
        flex: 0 0 auto;
    }

    .sidebar__user {
        margin-top: 12px;
        padding-top: 12px;
    }

    .content {
        padding: 24px 20px;
        /* The column no longer scrolls independently of the page once the
           sidebar is above it; leaving overflow:auto here would create a
           second scrollbar inside the first. */
        overflow: visible;
    }
}

/* --- Phones ------------------------------------------------------------- */
@media (max-width: 680px) {
    .content {
        padding: 20px 14px;
    }

    .page-title {
        font-size: 24px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    /* One card per row. auto-fit with a 220px minimum would still try to fit
       two on a 360px phone and clip the figures. */
    .grid--kpi,
    .grid--charts,
    .grid--stats {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px;
    }

    /* A split header stacks rather than squeezing the action button. */
    .page-header--split {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Filter controls go full width instead of shrinking to unusable slivers. */
    .filters__row {
        flex-direction: column;
        align-items: stretch;
    }

    .filters__select,
    .filters__select--wide,
    .filters__search {
        width: 100%;
        min-width: 0;
    }

    .filters__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* The drawer is a full-screen sheet on a phone; a 480px panel would sit
       off the edge of the viewport. */
    .drawer {
        width: 100%;
        max-width: 100%;
    }

    .pager {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* --- Print and reduced motion -------------------------------------------
   Not screen sizes, but the same idea: the interface adapting to how it is
   actually being used. */
@media print {
    .sidebar,
    .pager,
    .filters {
        display: none;
    }

    .content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-subtle);
        break-inside: avoid;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* "Not built yet" panel for Settlements and Reconciliation.

   Deliberately calm: gold rather than red, an hourglass rather than a warning
   triangle. Nothing has failed and nothing is lost — this data is not captured
   anywhere yet — and an alarming panel would send merchants to support over a
   roadmap item. */
.notbuilt {
    background: var(--surface-card);
    border-radius: var(--radius-card);
    border-left: 3px solid var(--fv-gold);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    max-width: 72ch;
    /* .card carries no vertical margin in this stylesheet - spacing comes from
       wrappers (.grid margin-bottom, .grid--spaced margin-top, .kpicard
       margin-bottom). A not-built panel replaces one of those cards, so it has
       to supply the same rhythm or whatever follows sits flush against it. */
    margin-bottom: 24px;
}

/* Inside a grid the gap already spaces siblings; the margin would add to it. */
.grid .notbuilt {
    margin-bottom: 0;
    max-width: none;
}

.notbuilt__head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: var(--weight-bold);
    color: var(--text-heading);
}

.notbuilt__head i {
    color: var(--fv-gold);
}

.notbuilt__detail {
    margin: 10px 0 0 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}


/* --------------------------------------------------------------------------
   Agreed rate vs charged

   A flagged cell marks a charge that does not match the merchant's own agreed
   rate. Deliberately not the placeholder red: that red means "this figure is
   invented". These figures are real — the disagreement between them is the
   point, and conflating the two would teach the reader to ignore both.

   Background rather than colour alone, so the flag does not rely on colour
   vision to be noticed.
   -------------------------------------------------------------------------- */
table.data td.cell--flag {
    background: var(--state-warning-bg);
    font-weight: 600;
}

/* Absence of an agreed rule, which is information rather than a fault. */
table.data td.cell--muted {
    color: var(--text-muted);
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Period label above the dashboard tiles

   The summary endpoint is called without dates, which ledger defines as the
   merchant's whole history. Saying so costs one line and stops every figure
   below being read as this month's.
   -------------------------------------------------------------------------- */
.kpi-period {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Empty state for the activity feed. Nothing to report is a real answer -
   no oversized sales, no refunds, no silent terminals - and saying so reads
   very differently from a card that failed to load. */
.alert--empty .alert__title {
    color: var(--text-muted);
}

.alert--empty .alert__body {
    padding-left: 0;
}

