/* plus-jakarta-sans-cyrillic-ext-400-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/build/fonts/plus-jakarta-sans-cyrillic-ext-400-normal.048f216a.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-cyrillic-ext-400-normal.995a2c8b.woff) format('woff');
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}

/* plus-jakarta-sans-vietnamese-400-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/build/fonts/plus-jakarta-sans-vietnamese-400-normal.218c4ebf.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-vietnamese-400-normal.082a9efa.woff) format('woff');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* plus-jakarta-sans-latin-ext-400-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/build/fonts/plus-jakarta-sans-latin-ext-400-normal.dc5105c7.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-ext-400-normal.c06cb4c0.woff) format('woff');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* plus-jakarta-sans-latin-400-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(/build/fonts/plus-jakarta-sans-latin-400-normal.9eb2a7e5.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-400-normal.39dc2200.woff) format('woff');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* plus-jakarta-sans-cyrillic-ext-500-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(/build/fonts/plus-jakarta-sans-cyrillic-ext-500-normal.ada8bcf7.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-cyrillic-ext-500-normal.0b54dc92.woff) format('woff');
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}

/* plus-jakarta-sans-vietnamese-500-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(/build/fonts/plus-jakarta-sans-vietnamese-500-normal.78866e97.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-vietnamese-500-normal.62b852ab.woff) format('woff');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* plus-jakarta-sans-latin-ext-500-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(/build/fonts/plus-jakarta-sans-latin-ext-500-normal.245f570d.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-ext-500-normal.b24ebd0e.woff) format('woff');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* plus-jakarta-sans-latin-500-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(/build/fonts/plus-jakarta-sans-latin-500-normal.c3130315.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-500-normal.8a919040.woff) format('woff');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* plus-jakarta-sans-cyrillic-ext-600-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/build/fonts/plus-jakarta-sans-cyrillic-ext-600-normal.e1e17320.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-cyrillic-ext-600-normal.74481467.woff) format('woff');
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}

/* plus-jakarta-sans-vietnamese-600-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/build/fonts/plus-jakarta-sans-vietnamese-600-normal.55c541f7.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-vietnamese-600-normal.bd81d255.woff) format('woff');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* plus-jakarta-sans-latin-ext-600-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/build/fonts/plus-jakarta-sans-latin-ext-600-normal.af76dcd2.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-ext-600-normal.aec63264.woff) format('woff');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* plus-jakarta-sans-latin-600-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(/build/fonts/plus-jakarta-sans-latin-600-normal.7720d765.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-600-normal.e325f441.woff) format('woff');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* plus-jakarta-sans-cyrillic-ext-700-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/build/fonts/plus-jakarta-sans-cyrillic-ext-700-normal.a0e96d83.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-cyrillic-ext-700-normal.065a21d8.woff) format('woff');
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}

/* plus-jakarta-sans-vietnamese-700-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/build/fonts/plus-jakarta-sans-vietnamese-700-normal.3324f0f4.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-vietnamese-700-normal.4afaf410.woff) format('woff');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

/* plus-jakarta-sans-latin-ext-700-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/build/fonts/plus-jakarta-sans-latin-ext-700-normal.0e89f541.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-ext-700-normal.569e414c.woff) format('woff');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* plus-jakarta-sans-latin-700-normal */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(/build/fonts/plus-jakarta-sans-latin-700-normal.7cfa1301.woff2) format('woff2'), url(/build/fonts/plus-jakarta-sans-latin-700-normal.2e44f76d.woff) format('woff');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/*
 * The brand's two faces, served from this site instead of Google Fonts (docs/prd/prd-ui-next.md, B1). Imported by the
 * app (app.ts), the landing page (landing.ts) and the public unit pages (unit.ts), so all three render the same type.
 * Plus Jakarta Sans comes with Fontsource's own @font-face rules (font-display: swap, one file per subset); Fraunces is
 * declared here under its plain name so `font-family: 'Fraunces'` keeps working everywhere.
 */

/* Fraunces, latin-ext: one variable file for every weight, with the optical-size axis the landing's large headings use. */
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/build/fonts/fraunces-latin-ext-opsz-normal.b16a2528.woff2) format('woff2-variations');
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Fraunces, latin: one variable file for every weight, with the optical-size axis the landing's large headings use. */
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/build/fonts/fraunces-latin-opsz-normal.252d721d.woff2) format('woff2-variations');
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* MDX UI. Single stylesheet, design tokens at the top: light first, then dark with the same names. */

/* A colour is a token, defined in both blocks (styles.test.ts checks it); nothing below the tokens names a colour. */
:root,
:root[data-theme='light'] {
    color-scheme: light;
    --color-bg: #faf7f2;
    --color-surface: #ffffff;
    --color-border: #e6ded2;
    --color-border-strong: #d6ccbd;
    --color-text: #16201c;
    --color-muted: #5c6b65;
    --color-primary: #155e4b;
    --color-primary-hover: #0d4637;
    --color-primary-soft: #e2efe9;
    /* A row picked for a bulk action. */
    --color-selected-row: #e2efe9;
    --color-danger: #b3261e;
    --color-danger-soft: #fbe9e7;
    --color-warning: #8a5a00;
    --color-warning-soft: #fdf1d8;
    --color-info: #1d4f91;
    --color-info-soft: #e5eefa;
    --color-success: #1f6b3a;
    --color-success-soft: #e2f3e7;
    --color-accent: #6b3fa0;
    --color-accent-soft: #f1eaf8;
    --color-teal: #0e6a6a;
    --color-teal-soft: #dff1f0;
    --color-indigo: #3a4899;
    --color-indigo-soft: #e7e9f7;
    --color-rose: #a3305f;
    --color-rose-soft: #fbe8ef;
    --color-neutral: #3f4a44;
    --color-neutral-soft: #f1ebe1;
    --color-surface-sunken: #f6f1ea;
    --color-placeholder: #ece5da;
    --color-on-primary: #ffffff;
    --color-danger-border: #efc2bd;
    --color-tooltip: #16201c;
    --color-on-tooltip: #ffffff;
    --color-overlay: rgba(20, 30, 25, 0.45);
    --color-edge: rgba(20, 30, 25, 0.06);
    --color-whatsapp-bubble: #e7f8e3;
    --color-on-whatsapp-bubble: #1b2b1a;
    /* The attention counters' pill: grey on the warm neutrals, the danger pair when something in it is urgent. */
    --color-count-bg: #e6dfd3;
    --color-count-text: #3f4a44;
    --color-count-urgent-bg: #b3261e;
    --color-count-urgent-text: #ffffff;
    --color-marker-fill: #2f8f6f;
    --color-logo-plate: transparent;
    /* The landing page's amber: "this needs you" (a tile with work waiting). A border only, never text or an action. */
    --color-attention: #e39b3b;

    /* Containers (cards, modals, tables) take the landing's softer corner; controls keep --radius-sm. */
    --radius: 12px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 1px 3px rgba(20, 30, 25, 0.08);
    --shadow-lg: 0 12px 32px rgba(20, 30, 25, 0.18);
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* Page titles only, as the landing page's headings (fonts.css serves both faces). */
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --gutter: 16px;

    /* Control heights (docs/prd/prd-ui-baseline.md): compact in tables, the default, and a thumb's on a phone. */
    --control-sm: 32px;
    --control-md: 40px;
    --control-lg: 44px;

    /* The type scale: every font-size is one of these seven steps. */
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 20px;
    --text-xl: 24px;
    --text-2xl: 28px;

    /* Motion: one timing for every hover, press and fade. Reduced motion sets both durations to 0. */
    --dur-fast: 120ms;
    --dur: 180ms;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Spacing on a 4 px base (--space-half for the 2 px between a figure and its label). */
    --space-half: 2px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-9: 36px;
    --space-10: 40px;
    --space-12: 48px;

    /* Layers, bottom to top. Leaflet's panes (400+) are pushed under them by .map. */
    --z-sticky: 10;
    --z-tooltip: 20;
    --z-backdrop: 40;
    --z-drawer: 50;
    --z-modal: 100;
    /* Notices sit above an open side panel: a save inside it is confirmed where the reader is looking. */
    --z-toast: 110;
    /* A row's menu: above the side panel it may be opened from, under the notices. */
    --z-popover: 105;
}

/*
 * Dark: the same design on a dark palette. Backgrounds step up in lightness instead of leaning on shadows (bg, then
 * sunken, surface, raised); each hue is a lighter tint of its light-theme self, so "green = confirm" survives, and
 * each -soft is a deep, low-saturation version of it. Every pair used for text keeps 4.5:1 (styles.test.ts).
 */
:root[data-theme='dark'] {
    color-scheme: dark;
    --color-bg: #141411;
    --color-surface: #1c1c18;
    --color-border: #33312a;
    --color-border-strong: #6b6a5f;
    --color-text: #ebe7df;
    --color-muted: #aaa69b;
    --color-primary: #5cb896;
    --color-primary-hover: #7dcbad;
    --color-primary-soft: #173128;
    --color-selected-row: #173128;
    --color-danger: #f28b82;
    --color-danger-soft: #3a1c1a;
    --color-warning: #e6b450;
    --color-warning-soft: #33280f;
    --color-info: #79c2ec;
    --color-info-soft: #172538;
    --color-success: #74cf93;
    --color-success-soft: #15301f;
    --color-accent: #cfa4ea;
    --color-accent-soft: #2a2039;
    --color-teal: #62cfcf;
    --color-teal-soft: #11302f;
    --color-indigo: #7d84e8;
    --color-indigo-soft: #1f2442;
    --color-rose: #f193b9;
    --color-rose-soft: #3a1b29;
    --color-neutral: #c7cfca;
    --color-neutral-soft: #28271f;
    --color-surface-sunken: #181814;
    --color-placeholder: #2a2922;
    --color-on-primary: #0c1712;
    --color-danger-border: #6e302b;
    --color-tooltip: #e4e9e5;
    --color-on-tooltip: #111513;
    --color-overlay: rgba(0, 0, 0, 0.6);
    --color-edge: rgba(0, 0, 0, 0.35);
    --color-whatsapp-bubble: #1d3a2a;
    --color-on-whatsapp-bubble: #dcefe2;
    --color-count-bg: #3a3830;
    --color-count-text: #ebe7df;
    --color-count-urgent-bg: #f28b82;
    --color-count-urgent-text: #2a0f0d;
    --color-marker-fill: #3fae88;
    --color-logo-plate: #f5f6f3;
    --color-attention: #e8a54d;

    /* Shadows in the background's own green-black, not pure black, at the same strength. */
    --shadow: 0 1px 2px rgba(5, 8, 6, 0.4), 0 1px 3px rgba(5, 8, 6, 0.5);
    --shadow-lg: 0 12px 32px rgba(5, 8, 6, 0.6);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

/* A sentence under a title: no single word left alone on its last line. */
.page-subtitle,
.tab-intro p,
.state p {
    text-wrap: pretty;
}

h1 {
    font-size: var(--text-xl);
}

/* A page's title is set like the landing page's headings: the brand's display face. */
.page-header h1 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.015em;
}

h2 {
    font-size: var(--text-md);
}

h3 {
    font-size: var(--text-base);
}

a {
    color: var(--color-primary);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--color-bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: var(--text-sm);
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --dur-fast: 0ms;
        --dur: 0ms;
    }
}

/* Everything that changes on hover changes at the same pace (the rules below with their own transition add to it). */
.date-input-picker,
.chip,
.picker-option,
.nav-link,
.stat,
.icon-btn,
.rich-editor-tool,
.rental-choice-option,
.help-result,
.help-figure-button,
.quick-open,
.quick-results button,
.table td {
    transition:
        color var(--dur-fast) var(--ease),
        background-color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease),
        transform var(--dur-fast) var(--ease);
}

/* Quick search (docs/prd/prd-ui-next.md, Q): "Buscar…" at the top of the sidebar, and its dialog. */
.quick-open {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: calc(100% - var(--space-8));
    margin: 0 var(--space-4) var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
    color: var(--color-muted);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.quick-open:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.quick-open span {
    flex: 1;
}

.quick-open kbd {
    padding: 0 var(--space-1);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--text-xs);
}

.quick-search {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 14vh var(--gutter) 0;
    background: var(--color-overlay);
}

.quick-box {
    width: min(560px, 100%);
    overflow: hidden;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.quick-box input {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border: 0;
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-md);
}

.quick-box input:focus-visible {
    outline: none;
    border-bottom-color: var(--color-primary);
}

.quick-results {
    margin: 0;
    padding: var(--space-2);
    list-style: none;
}

.quick-results button {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.quick-results button:hover,
.quick-results li[aria-selected='true'] button {
    background: var(--color-primary-soft);
}

.quick-kind {
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.quick-none,
.quick-hint {
    margin: 0;
    padding: var(--space-3) var(--space-5);
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.quick-hint {
    border-top: 1px solid var(--color-border);
    font-size: var(--text-xs);
}

/* Utilities */
.muted {
    color: var(--color-muted);
}

.small {
    font-size: var(--text-sm);
}

.strong {
    font-weight: 600;
}

.nowrap {
    white-space: nowrap;
}

.pre-wrap {
    white-space: pre-wrap;
}

/* A token or a command to copy (Asistente): typed as it must be pasted. */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* A secret or a command to copy (Asistente): long words break anywhere rather than widen the modal. */
.break-all {
    word-break: break-all;
}

.uppercase {
    text-transform: uppercase;
}

.capitalize-first::first-letter {
    text-transform: uppercase;
}

.text-danger {
    color: var(--color-danger);
}

/* An amount above what was expected (Proyección's difference): the opposite of .text-danger. */
.text-success {
    color: var(--color-success);
}

/* "Saltar al contenido": off screen until a keyboard user tabs to it, then above everything, top left. */
.skip-link {
    position: fixed;
    top: var(--space-2);
    left: var(--space-2);
    z-index: var(--z-modal);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus-visible {
    transform: none;
}

/* The page area takes the focus from the skip link without drawing a ring around the whole page. */
.content:focus {
    outline: none;
}

/* Shell: sidebar + content; the sidebar becomes a drawer on narrow screens */
.shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 16px 12px 20px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* A logo keeps its own shape: 24 px tall, as wide as it needs up to a point. */
.brand-logo {
    flex: none;
    /* An uploaded logo is usually drawn for a white page: it sits on a light plate so a dark one stays visible. */
    background: var(--color-logo-plate);
    width: auto;
    height: 24px;
    max-width: 96px;
    border-radius: 5px;
    object-fit: contain;
}

.brand-landlord {
    color: var(--color-muted);
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Contract renewal answers */
.renewal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.renewal-note {
    display: block;
    margin-top: 4px;
    font-style: italic;
}

.renewal-badge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    margin-top: 4px;
}

/* Settings */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-section {
    max-width: 640px;
}

/* A settings card that holds a wide table (Ventas › Precios: Portafolio and Ejemplos) takes the page's width (QA-0048). */
.settings-section-wide {
    max-width: none;
}

.settings-section-wide .table input {
    width: 100%;
    min-width: 0;
}

.settings-section form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section .alert {
    margin-bottom: 0;
}

.settings-number {
    max-width: 140px;
}

/* Plataforma → Clientes → Funciones: the explanation under each feature's checkbox. */
.feature-hint {
    margin: 4px 0 0 26px;
}

/* Configuración → Marca (platform and landlord): the two images and the preview. */
.brand-image {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.brand-image-preview {
    flex: none;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.brand-image-preview img {
    max-width: 56px;
    max-height: 56px;
    object-fit: contain;
}

.brand-image-preview--favicon img {
    width: 32px;
    height: 32px;
}

.brand-image-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.brand-image-body p {
    margin: 0;
}

.brand-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.brand-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.brand-preview-sidebar,
.brand-preview-login {
    flex: 1 1 220px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.brand-preview-sidebar {
    background: var(--color-surface);
}

.brand-preview-login {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-bg);
}

/* Configuración → Equipo: the line above the table, and the property picker inside the access modal. */
/* A tab's one line of "what this is for" (ui.jsx TabIntro), with the tab's own action beside it when it has one. */
.tab-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.tab-intro p {
    max-width: 75ch;
    margin: 0;
    color: var(--color-muted);
}

/*
 * DateInput: typed in the landlord's order, with the browser's calendar behind a button. The native input stays
 * rendered (showPicker() needs it) but takes no room and no clicks; its calendar opens under the field.
 */
.date-input {
    position: relative;
    display: flex;
    width: 100%;
}

.date-input > input[type='text'] {
    flex: 1;
    padding-right: 40px;
}

.date-input-picker {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: inline-grid;
    place-items: center;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
}

.date-input-picker:hover,
.date-input-picker:focus-visible {
    color: var(--color-primary);
    background: var(--color-bg);
}

.date-input-native {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.settings-section-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.settings-section-intro p {
    max-width: 70ch;
    margin: 0;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px;
    margin: 0;
}

.checkbox-list legend {
    padding: 0 4px;
    font-size: var(--text-sm);
    color: var(--color-muted);
}

/* Bills: rent + utilities */
.bill-status {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bill-lines {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bill-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.bill-line-label {
    flex: 1 1 60%;
    min-width: 0;
}

.bill-line-amount {
    margin-left: auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.bill-line-total {
    border-bottom: 0;
    font-weight: 700;
}

.bill-total {
    font-size: var(--text-xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

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

.bill-detail .alert {
    margin-bottom: 0;
}

.bill-add-line {
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}

.bill-add-line .alert {
    margin-bottom: 12px;
}

/* A utility invoice's detail (Servicios públicos › Ver detalle): its three figures, the facts in two columns, the bar
   that adds payment proofs above the tabs, and the footer where it is marked paid. */
.utility-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.utility-figure {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
}

.utility-figure-label {
    color: var(--color-muted);
    font-size: var(--text-xs);
}

.utility-figure-value {
    font-size: var(--text-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.utility-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
    margin: 0;
    font-size: var(--text-sm);
}

.utility-facts > div {
    display: grid;
    grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
    gap: var(--space-3);
    align-items: center;
}

.utility-facts dt {
    color: var(--color-muted);
}

.utility-facts dd {
    margin: 0;
    min-width: 0;
}

.utility-proofs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
}

.utility-proofs-bar p {
    margin: 0;
}

.utility-bill-footer {
    align-items: center;
}

/* Paid on, or why it cannot be paid yet: at the footer's start, the buttons at its end. */
.utility-bill-footer-note {
    margin-right: auto;
}

.utility-bill-footer > .alert,
.utility-bill-footer-fields {
    flex-basis: 100%;
}

@media (max-width: 640px) {
    .utility-figures,
    .utility-facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .utility-proofs-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* A line to add: what, how much, and its own button at the end of the row. */
.bill-add-line-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-3) var(--space-4);
}

/* Level with the inputs, below their labels: a hint under one field must not push the row out of line. */
.bill-add-line-row > .btn {
    margin-top: calc(var(--text-sm) * 1.5 + var(--space-1));
}

@media (max-width: 640px) {
    .bill-add-line-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.card-inactive {
    opacity: 0.7;
}

/* The voided note of a bill (Cobros): who and when, the reason, the renter's view, one per line. */
/* The bill's detail (Cobros › Ver detalle, docs/pdr/prd-bill-detail.md): the summary, the date tiles, the void stamp,
   the collapsed utilities and the payment card. */
.bill-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: start;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.bill-summary-who {
    display: grid;
    gap: var(--space-1);
    justify-items: start;
    min-width: 0;
}

.bill-summary-total {
    display: grid;
    gap: var(--space-half);
    justify-items: end;
    text-align: right;
}

.bill-summary-amount {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.bill-summary-amount.is-void {
    color: var(--color-muted);
    text-decoration: line-through;
}

.bill-summary-note {
    color: var(--color-muted);
    font-size: var(--text-sm);
}

@media (max-width: 640px) {
    .bill-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .bill-summary-total {
        justify-items: start;
        text-align: left;
    }
}

.bill-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-2);
    margin: 0;
}

.bill-tiles > div {
    background: var(--color-surface-sunken);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
}

.bill-tiles dt {
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bill-tiles dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.bill-stamp {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--color-neutral-soft);
    border-left: 3px solid var(--color-neutral);
    border-radius: var(--radius-sm);
}

.bill-stamp q {
    font-style: normal;
    quotes: none;
}

.bill-collapsed > summary,
.bill-collapsed-static {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-muted);
}

.bill-collapsed > summary {
    cursor: pointer;
    font-size: var(--text-sm);
    list-style: none;
}

.bill-collapsed > summary::-webkit-details-marker {
    display: none;
}

.bill-collapsed > summary:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.bill-collapsed-more {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-text);
    font-weight: 600;
}

.bill-collapsed-more svg {
    transition: transform var(--dur) var(--ease);
}

.bill-collapsed[open] > summary .bill-collapsed-more svg {
    transform: rotate(180deg);
}

.bill-collapsed[open] > summary {
    margin-bottom: var(--space-3);
}

.bill-payment {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.bill-payment-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
}

/* A bill the landlord voided, in the renter's history: set back on the sunken surface, its text at full contrast. */
.card-void {
    background: var(--color-surface-sunken);
    border-style: dashed;
}

.section-top {
    margin-top: 32px;
}

/* Utility setup and utility bills */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chip {
    min-height: var(--control-sm);
    padding: 4px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    background: var(--color-surface);
    font: inherit;
    line-height: 1.25;
    cursor: pointer;
}

.chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.choice-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.choice > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.choice input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 2px 0 0;
}

.choice-selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.shares-editor,
.charges-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-row,
.charge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}

.share-input {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.share-input input {
    width: 90px;
    text-align: right;
}

.picker-hint {
    margin: 0 0 12px;
}

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

.picker-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.picker-option:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.picker-option:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}





.charge-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.charge-amount input {
    width: 150px;
    text-align: right;
}

.meter-baselines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

/* Amounts line up by their digits, as on a bill. */
.money-input {
    font-variant-numeric: tabular-nums;
}

.chip-sm {
    min-height: 28px;
    padding: 2px 12px;
    font-size: var(--text-sm);
}

.chip-selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 600;
}

/*
 * Metered invoices: one row per unit, previous → current reading, and what that works out to. A grid rather than a
 * <table> so the inputs keep the form's styling; on a phone each unit becomes a small card.
 */
.meter-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.meter-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.4fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(110px, 0.8fr) minmax(120px, 0.8fr);
    align-items: start;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border);
}

.meter-head {
    border-top: none;
    background: var(--color-bg);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.meter-row.is-skipped .charge-unit {
    opacity: 0.7;
}

.meter-input {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.meter-input input {
    width: 100%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.meter-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    align-self: center;
}

.meter-head .meter-number {
    align-self: auto;
}

.meter-total {
    background: var(--color-bg);
    align-items: center;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .meter-head {
        display: none;
    }

    .meter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .meter-row .charge-unit {
        grid-column: 1 / -1;
    }

    .meter-total > span:empty {
        display: none;
    }
}

/* Unit form: photos, videos and links for the public profile */
.media-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.media-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.media-item-pending {
    border-style: dashed;
}

.media-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.media-actions input {
    flex: 1 1 220px;
    width: auto;
}

.impersonation-picker {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px 8px 20px;
}

.impersonation-picker .nav-section-title {
    padding: 0;
}

/* "Tema" in the sidebar footer: the same labelled dropdown as "Actuar como usuario". */
.theme-picker {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-picker .nav-section-title {
    padding: 0;
}

.impersonation-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 14px;
    margin-bottom: 20px;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-sm);
    background: var(--color-warning-soft);
    color: var(--color-warning);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px 16px;
}

.nav-section + .nav-section {
    margin-top: 16px;
}

.nav-section-title {
    padding: 8px 10px 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    text-decoration: none;
    font-weight: 500;
}

.nav-link .icon {
    flex-shrink: 0;
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px 18px;
    border-top: 1px solid var(--color-border);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.mobile-bar,
.sidebar-close,
.sidebar-backdrop {
    display: none;
}

.icon-btn .icon {
    display: block;
}

.content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-block: var(--space-7) var(--space-12);
    padding-inline: max(var(--gutter), 3vw);
}

@media (max-width: 1024px) {
    .shell {
        display: block;
    }

    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: var(--z-sticky);
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 56px;
        padding-inline: var(--gutter);
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-bar .brand {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: var(--z-drawer);
        width: min(280px, 85vw);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-open .sidebar {
        transform: none;
        visibility: visible;
    }

    .sidebar-close {
        display: inline-flex;
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: var(--z-backdrop);
        background: var(--color-overlay);
    }

    .content {
        padding-inline: var(--gutter);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}

/* Page structure */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--color-muted);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    /* Every control carries a label above it, so they line up on their bottom edge, and so does the action. */
    align-items: flex-end;
    gap: 12px 20px;
    margin-bottom: 16px;
}

/*
 * A tab's primary action ("Nueva unidad") sits in its own toolbar rather than the page header, which names
 * the page and not the tab. It anchors to the far end so it reads as the action of the table below, and not
 * as one more filter that ran out of room.
 */
.toolbar > :not(.btn) + .btn {
    margin-left: auto;
}

.section {
    margin-bottom: 32px;
}

.section > h2 {
    margin-bottom: 12px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.card p {
    margin: 0;
}

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

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 16px;
}

/* Stats */
.stat-group-title {
    margin: 0 0 8px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

/*
 * A group whose count would leave a tile alone on the last row (5, 6 or 9 tiles in four columns) sets its own count on
 * a wide window: three for six or nine, five for five. Narrower windows fall back to as many as fit.
 */
@media (min-width: 1025px) {
    .stat-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .stat-grid-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-half);
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

.stat:hover {
    border-color: var(--color-border-strong);
}

/* A tile that opens its list (or filters the table under it) says so, instead of passing for a static figure. */
a.stat,
button.stat {
    position: relative;
}

button.stat {
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

a.stat::after,
button.stat::after {
    content: '→';
    position: absolute;
    top: 14px;
    right: 16px;
    color: var(--color-muted);
    transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

a.stat:hover::after,
a.stat:focus-visible::after,
button.stat:hover::after,
button.stat:focus-visible::after {
    color: var(--color-primary);
    transform: translateX(3px);
}

a.stat:active,
button.stat:active {
    transform: scale(0.99);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Reportes: a tile holding an amount, not a two-digit count. */
.stat-value-money {
    font-size: var(--text-lg);
}

.stat-label {
    color: var(--color-muted);
}

.stat-highlight {
    border-left: 4px solid var(--color-attention);
}

/*
 * Reportes › Proyección: the month's estimate as one bar, split into what is paid, sent, in draft and not created
 * yet. The parts are the row tones of the table under it, so the bar and the rows read the same.
 */
.forecast-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.forecast-heading h2 {
    margin: 0;
    font-size: var(--text-lg);
}

.forecast-bar {
    display: flex;
    height: 22px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-neutral-soft);
}

.forecast-bar > span {
    min-width: 0;
}

.forecast-part-paid {
    background: var(--color-success);
}

.forecast-part-sent {
    background: var(--color-info);
}

.forecast-part-draft {
    background: var(--color-accent);
}

.forecast-part-missing {
    background: var(--color-neutral-soft);
    box-shadow: inset 0 0 0 2px var(--color-warning);
}

.forecast-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin: var(--space-3) 0 0;
    padding: 0;
    list-style: none;
}

.forecast-legend li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.forecast-legend li > span:first-child {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-md);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    /* 1.25 so the words, the padding and the border fit the control's height instead of pushing it half a pixel past. */
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background-color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        color var(--dur-fast) var(--ease),
        transform var(--dur-fast) var(--ease);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* A button at work is not a button switched off: it keeps its colour while its spinner turns. */
.btn[aria-busy='true']:disabled {
    opacity: 1;
    cursor: progress;
}

/* A press moves the button a pixel down, as a physical one would (a disabled button never becomes :active). */
.btn:active,
.icon-btn:active {
    transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
    .btn:active,
    .icon-btn:active,
    a.stat:active,
    button.stat:active {
        transform: none;
    }
}

.btn:focus-visible,
.nav-link:focus-visible,
.tab:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-ghost {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--color-border-strong);
    background: var(--color-bg);
}


.btn-link {
    background: none;
    color: var(--color-primary);
    padding-inline: 4px;
    min-height: auto;
    font-weight: 500;
}

.btn-link:hover:not(:disabled) {
    text-decoration: underline;
}

/*
 * Action buttons (ui.jsx ActionButton, IconButton, actionClass()): outlined in the colour of what they do, on a
 * white face so they stand out as buttons on tinted rows too. Hovering fills them with the soft tone.
 */
.btn-action {
    --action: var(--color-primary);
    --action-soft: var(--color-primary-soft);
    background: var(--color-surface);
    border-color: color-mix(in srgb, var(--action) 50%, transparent);
    color: var(--action);
    box-shadow: 0 1px 0 var(--color-edge);
}

.btn-action:hover:not(:disabled) {
    background: var(--action-soft);
    border-color: var(--action);
}

.btn-action-confirm {
    --action: var(--color-success);
    --action-soft: var(--color-success-soft);
}

.btn-action-danger {
    --action: var(--color-danger);
    --action-soft: var(--color-danger-soft);
}

.btn-action-edit {
    --action: var(--color-info);
    --action-soft: var(--color-info-soft);
}

.btn-action-open {
    --action: var(--color-accent);
    --action-soft: var(--color-accent-soft);
}

.btn-action-file {
    --action: var(--color-teal);
    --action-soft: var(--color-teal-soft);
}

.btn-action-setup {
    --action: var(--color-indigo);
    --action-soft: var(--color-indigo-soft);
}

.btn-action-revert {
    --action: var(--color-warning);
    --action-soft: var(--color-warning-soft);
}

.btn-action-contact {
    --action: var(--color-rose);
    --action-soft: var(--color-rose-soft);
}

.btn-sm {
    min-height: var(--control-sm);
    padding: 4px 10px;
    font-size: var(--text-sm);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--control-sm);
    min-height: var(--control-sm);
    border: none;
    background: none;
    font-size: var(--text-lg);
    line-height: 1;
    padding: 0;
    cursor: pointer;
    color: var(--color-muted);
    border-radius: var(--radius-sm);
}

.icon-btn:hover {
    background: var(--color-bg);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
}

.span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.form-section {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

/* A destructive action ("Quitar", "Rechazar") sits at the opposite edge of a footer, away from the main one (§2). */
.form-actions > .btn-action-danger:not(.is-main) {
    order: -1;
    margin-right: auto;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.field-label {
    font-weight: 600;
    font-size: var(--text-sm);
}

.field-optional {
    font-weight: 400;
    color: var(--color-muted);
}

.field-hint {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.field-error {
    font-size: var(--text-xs);
    color: var(--color-danger);
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--control-md);
    padding: 8px 10px;
    font: inherit;
    color: inherit;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

/* A one-line field is exactly its control height (the .btn note); a textarea keeps the body's leading. */
input,
select {
    line-height: 1.25;
}

input[readonly] {
    background: var(--color-bg);
    color: var(--color-muted);
}

input[type='file'] {
    padding: 6px;
}

/* The file picker's own button, in the app's colours instead of the browser's grey. */
input[type='file']::file-selector-button {
    margin-right: var(--space-2);
    padding: 4px 10px;
    font: inherit;
    font-weight: 600;
    color: var(--color-teal);
    background: var(--color-surface);
    border: 1px solid var(--color-teal);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

textarea {
    resize: vertical;
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
    border-color: var(--color-danger);
}

td select {
    min-height: var(--control-sm);
    padding: 4px 6px;
    min-width: 120px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin: 0;
}

/*
 * Checkboxes, radios, switches, sliders and progress bars are drawn here, not by the browser: the same on every system
 * and in both themes (docs/prd/prd-ui-baseline.md). The tick and the dot are shapes in the control's own colours.
 */
input[type='checkbox'],
input[type='radio'] {
    -webkit-appearance: none;
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex: none;
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 5px;
    background: var(--color-surface);
    cursor: pointer;
    transition:
        background-color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease);
}

input[type='radio'] {
    border-radius: 50%;
}

input[type='checkbox']::before {
    content: '';
    width: 11px;
    height: 11px;
    background: var(--color-on-primary);
    clip-path: polygon(12% 50%, 0 64%, 40% 100%, 100% 22%, 87% 9%, 40% 72%);
    transform: scale(0);
    transition: transform var(--dur-fast) var(--ease);
}

input[type='radio']::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    transform: scale(0);
    transition: transform var(--dur-fast) var(--ease);
}

input[type='checkbox']:checked,
input[type='checkbox']:indeterminate {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

input[type='radio']:checked {
    border-color: var(--color-primary);
}

input[type='checkbox']:checked::before,
input[type='radio']:checked::before {
    transform: scale(1);
}

/* Some of a table's rows picked: a dash, not a tick. */
input[type='checkbox']:indeterminate::before {
    clip-path: none;
    width: 10px;
    height: 2px;
    border-radius: 1px;
    transform: scale(1);
}

input[type='checkbox']:hover:not(:disabled),
input[type='radio']:hover:not(:disabled) {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}

input[type='checkbox']:focus-visible,
input[type='radio']:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

input[type='checkbox']:disabled,
input[type='radio']:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.field-invalid input[type='checkbox']:not(:checked) {
    border-color: var(--color-danger);
}

/* A setting that is saved the moment it is flipped (ui.tsx Switch); a checkbox waits for the form's "Guardar". */
.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    cursor: pointer;
}

.switch-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.switch-hint {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.switch input[type='checkbox'] {
    position: relative;
    display: block;
    width: 38px;
    height: 22px;
    min-height: 22px;
    border: 0;
    border-radius: 11px;
    background: var(--color-border-strong);
}

.switch input[type='checkbox']::before {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-surface);
    box-shadow: var(--shadow);
    clip-path: none;
    transform: none;
}

.switch input[type='checkbox']:checked {
    background: var(--color-primary);
}

.switch input[type='checkbox']:checked::before {
    transform: translateX(16px);
}

/* A slider fills up to its value (--value, set by the page as a percentage). */
input[type='range'] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    min-height: 6px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(to right, var(--color-primary) var(--value, 0%), var(--color-neutral-soft) var(--value, 0%));
    cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 3px solid var(--color-surface);
    box-shadow: var(--shadow);
}

input[type='range']::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 3px solid var(--color-surface);
    box-shadow: var(--shadow);
}

progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 4px;
    background: var(--color-neutral-soft);
    overflow: hidden;
}

progress::-webkit-progress-bar {
    background: var(--color-neutral-soft);
}

progress::-webkit-progress-value {
    background: var(--color-primary);
    border-radius: 4px;
}

progress::-moz-progress-bar {
    background: var(--color-primary);
    border-radius: 4px;
}

/* What someone wrote, quoted in their words, with who and when under it. */
.quote {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-left: 3px solid var(--color-border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--color-surface-sunken);
}

.quote-by {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-muted);
}

/* A button at work: a spinner in its own colours before the words, and the button keeps its place. */
.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.search {
    max-width: 320px;
}

/*
 * A labelled dropdown in a table's filter bar. The label stays visible: a bare select says nothing about what
 * it filters until you open it.
 */
.filter-select {
    display: inline-grid;
    gap: 2px;
    width: auto;
    min-width: 200px;
    max-width: 100%;
}

.filter-select-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-muted);
}

.filter-select > select {
    width: 100%;
}

/* A bare <select class="filter-select"> (no label element) still sizes like one. */
select.filter-select {
    display: inline-block;
}

/* The search box is as wide as the fields it names in its placeholder need, and no wider. */
.filter-search {
    width: 320px;
}

.filter-search .search {
    max-width: none;
}

/* Alerts & badges */
.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.alert .icon-btn {
    font-size: var(--text-md);
    padding: 0 4px;
    color: inherit;
}

.alert-info {
    background: var(--color-info-soft);
    color: var(--color-info);
}

.alert-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

/* Something to look at before going on, not an error ("nobody approved yet"). */
.alert-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.alert-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.card .alert,
.modal .alert {
    margin-bottom: 0;
}

.modal form > .alert {
    margin-bottom: var(--space-4);
}

/* A status in words: square corners and a dot say "information"; a pill is something to click (a chip). */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-neutral {
    background: var(--color-neutral-soft);
    color: var(--color-neutral);
}

.badge-muted {
    background: var(--color-neutral-soft);
    color: var(--color-muted);
}

.badge-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.badge-info {
    background: var(--color-info-soft);
    color: var(--color-info);
}

.badge-accent {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.badge-teal {
    background: var(--color-teal-soft);
    color: var(--color-teal);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: opacity var(--dur-fast) var(--ease);
}

.card .table-wrap {
    box-shadow: none;
}

.table-wrap.is-reloading {
    opacity: 0.6;
}

/*
 * A table with a header (ui.tsx TableHeader, docs/prd/prd-ui-audit.md §4): one card holding the table's name and
 * actions, the search and filters under the column titles, the rows, and the legend and pager at its foot. Everything
 * that acts on the table sits inside it, so nothing floats above it on its own row.
 */
.table-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table-card .table-wrap {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.table-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4) var(--space-3);
}

/* The name and its line take what is left; the actions keep their place at the right end of the row. */
.table-card-heading {
    flex: 1 1 240px;
    min-width: 0;
}

.table-card-heading h2 {
    margin: 0;
    font-size: var(--text-md);
    font-weight: 700;
}

.table-card-count {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-muted);
}

.table-card-heading p {
    max-width: 75ch;
    margin: var(--space-half) 0 0;
    font-size: var(--text-sm);
    color: var(--color-muted);
}

.table-card-actions {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-left: auto;
}

.table-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
}

.table-card-foot .row-legend,
.table-card-foot .pager {
    margin: 0;
}

.table-card-foot .pager {
    margin-left: auto;
}

/* The filter row sits on the column titles' own background, as part of the head. */
.table-has-filters thead tr:first-child th {
    padding-bottom: var(--space-2);
    border-bottom: 0;
}

.table-filters td {
    padding-top: 0;
    vertical-align: middle;
    background: var(--color-surface-sunken);
}

/* Two controls sharing one column (a search and the grouping of a report) stack with a gap. */
.table-filters td > * + * {
    margin-top: var(--space-2);
}

/* "Filtros" stays reachable on a table wider than the window (a report): its cell sticks to the right edge. */
.table-filters td:last-child {
    position: sticky;
    right: 0;
}

/* A filter is as wide as its column and no wider: a long property name never widens the table. */
.table-filters .search,
.column-filter {
    width: 100%;
    min-width: 0;
    max-width: none;
}

/*
 * Each keeps enough room to be read, so its column does not narrow when fewer rows come back nor squeeze the filter to
 * a few letters on a narrow window (the table scrolls sideways first).
 */
.table-filters .search {
    min-width: 160px;
}

.column-filter {
    min-width: 120px;
}

.column-filter.is-active,
.filter-select.is-active > select {
    border-color: var(--color-primary);
    background-color: var(--color-primary-soft);
    font-weight: 600;
}

.filters-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
}

.filters-button.is-active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.filters-count {
    min-width: 20px;
    padding: 0 var(--space-1);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    color: var(--color-on-primary);
    background: var(--color-primary);
}

.filters-panel {
    position: fixed;
    z-index: var(--z-popover);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 260px;
    max-width: min(340px, calc(100vw - 16px));
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: row-menu-in var(--dur-fast) var(--ease);
}

.filters-panel .filter-select {
    display: grid;
    min-width: 0;
}

.filters-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.filters-scrim {
    position: fixed;
    inset: 0;
    z-index: var(--z-popover);
    background: var(--color-overlay);
}

.filters-panel.is-sheet {
    inset: auto 0 0;
    max-width: none;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius) var(--radius) 0 0;
    animation-name: row-sheet-in;
}

.filters-panel.is-sheet select {
    min-height: 44px;
}

.filters-panel-title {
    font-weight: 700;
    font-size: var(--text-md);
}

/* The phone's search and filters: hidden while the column titles are there to hold them. */
.table-card-phone {
    display: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-sm);
    padding: 0 var(--space-3);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    cursor: pointer;
}

/*
 * Long text a person wrote (a message, a description) shows its first three lines in a table, so one long story does not
 * make its row a page tall; the whole text is the cell's tooltip and is in the record's own view.
 */
.cell-clamp {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.table-state td {
    padding: var(--space-4);
}

.table-state .state {
    border: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-3);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--color-border);
}

/* Amounts and dates line up digit by digit down a column. */
.table td {
    font-variant-numeric: tabular-nums;
}

.table th {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    background: var(--color-surface-sunken);
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/*
 * Every row ends in an "Acciones" cell holding everything the user can click there. Worded buttons for actions
 * an icon cannot carry on its own; icon buttons (with their tooltip) for the ones it can.
 */
.table th.col-actions,
.table td.actions {
    width: 1%;
    text-align: left;
    white-space: nowrap;
}

/* Sales: an email has no spaces, so without this one long address widens the whole table. */
.lead-contact {
    overflow-wrap: anywhere;
}

.row-actions {
    display: flex;
    /* One line: the cell is as narrow as it can be and .table-wrap scrolls if the table outgrows the screen. */
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.row-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0 0 10px;
    font-size: var(--text-sm);
}

.row-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* A short flat chip in the row's own tint and bar: a colour key, not a box that looks like it can be ticked. */
.row-legend-item::before {
    content: '';
    width: 22px;
    height: 10px;
    border-radius: 2px;
}

.row-legend-title {
    font-weight: 600;
}



/*
 * Rows are tinted by the item's status (ui.jsx toneFor()), so a list can be scanned by colour. The tint is the
 * same soft colour as the matching badge, plus a bar down the first cell for anyone who cannot rely on it.
 * Only data that actually has a status gets a tone; everything else stays plain.
 */
.table tr.row-tone-success {
    --row-accent: var(--color-success);
    --row-tint: var(--color-success-soft);
}

.table tr.row-tone-warning {
    --row-accent: var(--color-warning);
    --row-tint: var(--color-warning-soft);
}

.table tr.row-tone-danger {
    --row-accent: var(--color-danger);
    --row-tint: var(--color-danger-soft);
}

.table tr.row-tone-info {
    --row-accent: var(--color-info);
    --row-tint: var(--color-info-soft);
}

.table tr.row-tone-accent {
    --row-accent: var(--color-accent);
    --row-tint: var(--color-accent-soft);
}

.table tr.row-tone-teal {
    --row-accent: var(--color-teal);
    --row-tint: var(--color-teal-soft);
}

.table tr.row-tone-muted,
.table tr.row-tone-neutral {
    --row-accent: var(--color-border-strong);
    --row-tint: var(--color-bg);
}

.table tr.row-tone td {
    background: var(--row-tint);
}

/*
 * In Oscuro the soft tones are deep and saturated: a table where every row shares one status (Mantenimiento "Abierto")
 * turned into one block of colour. There the tint is half the tone and half the surface; the bar keeps the full colour.
 */
:root[data-theme='dark'] .table tr.row-tone td {
    background: color-mix(in srgb, var(--row-tint) 55%, var(--color-surface));
}

.table tr.row-tone td:first-child {
    box-shadow: inset 4px 0 0 var(--row-accent);
}

/*
 * The row under the pointer or the keyboard focus; a tinted row deepens its own tone, so its status still reads. Only by
 * 3%: more and the grey second line of a cell drops under 4.5:1 in Claro (styles.test.ts checks every tone).
 */
.table tbody tr:hover td,
.table tbody tr:focus-within td {
    background: var(--color-surface-sunken);
}

.table tbody tr.row-tone:hover td,
.table tbody tr.row-tone:focus-within td {
    background: color-mix(in srgb, var(--row-tint), var(--row-accent) 3%);
}

/*
 * Tables have no status column, so the colour is the status: a tinted table always shows a legend, and every row
 * says its status in words to screen readers and as a tooltip (Row's `label`). Tone names match ui.jsx toneFor(), so a legend chip and its rows cannot drift apart.
 */
.row-legend-success::before {
    --legend-accent: var(--color-success);
    background: var(--color-success-soft);
    box-shadow: inset 4px 0 0 var(--color-success);
}

.row-legend-warning::before {
    --legend-accent: var(--color-warning);
    background: var(--color-warning-soft);
    box-shadow: inset 4px 0 0 var(--color-warning);
}

.row-legend-danger::before {
    --legend-accent: var(--color-danger);
    background: var(--color-danger-soft);
    box-shadow: inset 4px 0 0 var(--color-danger);
}

.row-legend-info::before {
    --legend-accent: var(--color-info);
    background: var(--color-info-soft);
    box-shadow: inset 4px 0 0 var(--color-info);
}

.row-legend-accent::before {
    --legend-accent: var(--color-accent);
    background: var(--color-accent-soft);
    box-shadow: inset 4px 0 0 var(--color-accent);
}

.row-legend-teal::before {
    --legend-accent: var(--color-teal);
    background: var(--color-teal-soft);
    box-shadow: inset 4px 0 0 var(--color-teal);
}

.row-legend-muted::before,
.row-legend-neutral::before {
    background: var(--color-bg);
    box-shadow: inset 4px 0 0 var(--color-border-strong);
}

/* Text for screen readers only (e.g. a status otherwise conveyed by color). */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* A status dropdown sitting among the row's buttons (Mantenimiento): as tall as them. */
.row-action-select {
    min-height: var(--control-sm);
    padding: 4px 8px;
    font-size: var(--text-sm);
}

.row-actions .btn + .btn {
    margin-left: 0;
}

/* Icon-only buttons with a tooltip that says what they do (data-tooltip, also the aria-label). */
.btn.btn-icon {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.btn-icon .icon {
    flex: none;
}

.btn-icon.is-busy {
    opacity: 0.6;
    cursor: progress;
}


.btn-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    /* Not rendered until shown: a hidden tooltip would still widen scrollable tables (e.g. on the last action). */
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    z-index: var(--z-tooltip);
    transform: translate(-50%, 2px);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--color-tooltip);
    color: var(--color-on-tooltip);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-icon[data-tooltip]:hover::after,
.btn-icon[data-tooltip]:focus-visible::after {
    display: block;
    opacity: 1;
    transform: translate(-50%, 0);
}

/* The last action sits at the table's right edge: align its tooltip to the right so it stays inside. */
.row-actions > .btn-icon[data-tooltip]:last-child::after {
    left: auto;
    right: 0;
    transform: none;
}

@media (hover: none) {
    /* On touch, a tap counts as hover; keep the tooltip out (the label is still the accessible name). */
    .btn-icon[data-tooltip]:hover::after {
        display: none;
    }
}

/*
 * Under 640 px a table row is a card (docs/prd/prd-ui-next.md, M): its first cell the title, every other cell a line
 * "Column: value" (DataTable puts the column's name in data-label), the actions underneath. The status tint and its
 * edge stay on the card, so the colour still reads as the status.
 */
@media (max-width: 640px) {
    /* The rows become cards on the page's background, so the card around them goes and its header stands alone. */
    .table-card {
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .table-card-header {
        padding: 0 0 var(--space-3);
    }

    .table-card-actions,
    .table-card-actions > * {
        width: 100%;
    }

    .table-card-actions > * {
        min-height: 44px;
        justify-content: center;
    }

    .table-card-phone {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        margin-bottom: var(--space-3);
    }

    .table-card-phone-bar {
        display: flex;
        gap: var(--space-2);
    }

    .table-card-phone-bar .search {
        flex: 1;
        min-width: 0;
        max-width: none;
        min-height: 44px;
    }

    .table-card-phone-bar .filters-button {
        min-height: 44px;
    }

    .table-card-foot {
        padding: var(--space-2) 0;
        border-top: 0;
    }

    .table-state td {
        padding: 0;
    }

    .table-wrap {
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody {
        display: block;
    }

    .table tbody tr {
        display: block;
        margin-bottom: var(--space-3);
        padding: var(--space-3) var(--space-4);
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    .table tbody tr.row-tone {
        background: var(--row-tint);
        box-shadow:
            inset 4px 0 0 var(--row-accent),
            var(--shadow);
    }

    .table tbody tr td,
    .table tbody tr.row-tone td {
        display: block;
        padding: var(--space-1) 0;
        border: 0;
        background: transparent;
        text-align: right;
    }

    .table tbody tr.row-tone td:first-child {
        box-shadow: none;
    }

    /* The card is the hover target on a phone, not each line in it. */
    .table tbody tr:hover td,
    .table tbody tr:focus-within td,
    .table tbody tr.row-tone:hover td,
    .table tbody tr.row-tone:focus-within td {
        background: transparent;
    }

    .table td[data-label]::before {
        content: attr(data-label);
        float: left;
        margin-right: var(--space-3);
        color: var(--color-muted);
        font-size: var(--text-sm);
    }

    .table tbody tr td:first-child {
        padding-bottom: var(--space-2);
        font-size: var(--text-md);
        text-align: left;
    }

    .table tbody tr td.actions {
        padding-top: var(--space-3);
        text-align: left;
    }

    .table tbody tr td.actions {
        width: auto;
        white-space: normal;
    }

    .table tbody tr td.actions .row-actions {
        display: flex;
        flex-wrap: wrap;
    }
}

.row-inactive td {
    color: var(--color-muted);
}


.tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--color-neutral-soft);
    border-radius: var(--radius);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
}

.tab-active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow);
}

/*
 * A page's own views (Servicios públicos: invoices / utilities): a tab bar across the page under its header,
 * with the filters of the chosen view below it. The active tab is marked by colour, weight and an underline that
 * sits on the bar's bottom border.
 */
.tabs-page {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0;
    margin: -4px 0 20px;
    background: none;
    border-radius: 0;
    border-bottom: 1px solid var(--color-border);
    /* On a narrow screen the bar scrolls sideways rather than wrapping into two rows. */
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-page .tab {
    position: relative;
    padding: 10px 16px 12px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-weight: 600;
    white-space: nowrap;
    color: var(--color-muted);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.tabs-page .tab .icon {
    opacity: 0.8;
}

.tabs-page .tab:hover:not(.tab-active) {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-border) 45%, transparent);
}

.tabs-page .tab::after {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: -1px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: transparent;
}

.tabs-page .tab-active {
    background: none;
    box-shadow: none;
    color: var(--color-primary);
}

.tabs-page .tab-active .icon {
    opacity: 1;
}

.tabs-page .tab-active::after {
    background: var(--color-primary);
}

.tabs-page .tab:focus-visible {
    outline-offset: -2px;
}

/* The attention counters (docs/pdr/prd-attention-counters.md): how many records wait in a menu option or a tab. */
.count-badge {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--space-1);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--color-count-text);
    background: var(--color-count-bg);
}

.count-badge.is-urgent {
    color: var(--color-count-urgent-text);
    background: var(--color-count-urgent-bg);
}

.nav-link .count-badge {
    margin-left: auto;
}

.tabs-page .tab .count-badge {
    margin-left: var(--space-half);
}

.menu-toggle {
    position: relative;
}

/* The phone's menu button: a dot while any section has something waiting, ringed with the bar's background. */
.menu-toggle-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-count-text);
    box-shadow: 0 0 0 2px var(--color-surface);
}

.menu-toggle-dot.is-urgent {
    background: var(--color-count-urgent-bg);
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    color: var(--color-muted);
}

/* States */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    color: var(--color-muted);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border-strong);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner,
    .btn-spinner {
        animation-duration: 2s;
    }
}

/* Placeholders for content on its way (Skeleton in ui.tsx): the shape of what comes, so nothing jumps when it lands. */
.skeleton {
    display: block;
    height: 1em;
    border-radius: var(--radius-sm);
    background: var(--color-placeholder);
    animation: shimmer 1.6s var(--ease) infinite;
}

.skeleton-cell {
    width: 50%;
    height: 1.5em;
}

.skeleton-row td:first-child .skeleton-cell {
    width: 75%;
}

.skeleton-row .skeleton-subline {
    width: 45%;
    height: 1.1em;
    margin-top: var(--space-1);
}

.skeleton-stat-value {
    width: 3ch;
    height: var(--text-2xl);
    margin-block: 4px;
}

.skeleton-stat-label {
    width: 60%;
}

.skeleton-title {
    width: 40%;
    height: var(--text-lg);
}

.bill-loading {
    display: grid;
    gap: var(--space-3);
}

@keyframes shimmer {
    50% {
        opacity: 0.45;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }
}

.full-page-center {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
}

.state {
    padding: var(--space-9) var(--space-5);
    text-align: center;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
}

.state p {
    margin: 0 0 12px;
}

.state p:last-child {
    margin-bottom: 0;
}

.state-icon {
    display: inline-flex;
    margin-bottom: 4px;
    color: var(--color-muted);
}

.state .state-title {
    margin: 0 0 4px;
    color: var(--color-text);
    font-size: var(--text-md);
    font-weight: 600;
}

.state-error {
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

/* Definition lists (tenant cards) */
.definitions {
    margin: 0;
    display: grid;
    gap: 8px;
}

.definitions > div {
    display: grid;
    grid-template-columns: minmax(90px, 35%) 1fr;
    gap: 12px;
}

.definitions dt {
    color: var(--color-muted);
}

.definitions dd {
    margin: 0;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Unit details shared with the renter (tenant portal) */
.unit-details {
    padding: 12px 14px;
    background: var(--color-primary-soft);
    border-radius: var(--radius-sm);
}

/* Short labels here, so give the value (code + Mostrar/Copiar) the room. */
.unit-details .definitions > div {
    grid-template-columns: minmax(0, auto) 1fr;
}

.unit-details-title {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.unit-detail-value {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

/* Tabs inside a form modal: panels keep their state while hidden. */
.form-tabs .tabs {
    flex-wrap: wrap;
}

.tab-panel[hidden] {
    display: none;
}

/* Unit form: listing features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.input-suffix {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-suffix input {
    flex: 1;
    min-width: 0;
}

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

.chip-selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.amenity-add {
    display: flex;
    gap: 8px;
}

.amenity-add input {
    flex: 1;
    min-width: 0;
}

@media (max-width: 640px) {
    .features-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

/* Unit form: details editor */
.details-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.details-empty {
    margin: 0;
    padding: 14px;
    text-align: center;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

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

.detail-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    align-items: end;
    gap: 8px 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.detail-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
}

.detail-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

@media (max-width: 640px) {
    .detail-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-row-actions {
        justify-content: space-between;
    }
}

/* Rich text: the editor and the rendered description */
.rich-editor {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    overflow: hidden;
}

.rich-editor:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.rich-editor-invalid {
    border-color: var(--color-danger);
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 6px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.rich-editor-group {
    display: flex;
    gap: 2px;
}

.rich-editor-tool {
    min-width: 32px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}

.rich-editor-tool:hover:not(:disabled) {
    background: var(--color-primary-soft);
}

.rich-editor-tool.is-active {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.rich-editor-tool:disabled {
    opacity: 0.4;
    cursor: default;
}

.rich-editor-link {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    border-bottom: 1px solid var(--color-border);
}

.rich-editor-link input {
    flex: 1 1 200px;
    min-width: 0;
}

/* On a phone every tool is a 44 px touch target (QA-0033); the toolbar wraps onto more rows instead. */
@media (max-width: 640px) {
    .rich-editor-toolbar {
        gap: var(--space-1) var(--space-2);
    }

    .rich-editor-tool {
        min-width: 44px;
        height: 44px;
    }

    .rich-editor-link input,
    .rich-editor-link .btn {
        min-height: 44px;
    }
}

.rich-editor-content {
    min-height: 180px;
    max-height: 420px;
    overflow-y: auto;
    padding: 10px 12px;
    outline: none;
}

.rich-text > :first-child {
    margin-top: 0;
}

.rich-text > :last-child {
    margin-bottom: 0;
}

.rich-text p {
    margin: 0 0 0.75em;
}

.rich-text h2 {
    font-size: var(--text-lg);
    margin: 1em 0 0.4em;
}

.rich-text h3 {
    font-size: var(--text-md);
    margin: 0.9em 0 0.35em;
}

.rich-text ul,
.rich-text ol {
    margin: 0 0 0.75em;
    padding-left: 1.4em;
}

.rich-text li > p {
    margin: 0;
}

.rich-text blockquote {
    margin: 0 0 0.75em;
    padding: 2px 0 2px 12px;
    border-left: 3px solid var(--color-primary);
    color: var(--color-muted);
}

.rich-text a {
    color: var(--color-primary);
    text-decoration: underline;
}

.rich-editor-content p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
    color: var(--color-muted);
}

/* Modal: every dialog opens centred, in one of four widths (sm 480, md 640, lg 800, wide 1000). */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5vh var(--gutter);
    background: var(--color-overlay);
    overflow-y: auto;
}

.modal {
    /* Auto margins centre it both ways while it fits, and fall back to the top (never cutting the title) when not. */
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    max-height: 90dvh;
    margin: auto;
    overflow: hidden;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: modal-in var(--dur) var(--ease);
}

.modal-sm {
    /* A confirmation: one question, not a form. */
    max-width: 480px;
}

.modal-lg {
    /* Long record forms (a contract, a property, a utility) and reviews with a summary in columns. */
    max-width: 800px;
}

.modal-wide {
    /* Tables and previews: the bill detail's utilities, a document, a lead. */
    max-width: 1000px;
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.modal-heading {
    min-width: 0;
}

.modal-subtitle {
    margin: var(--space-half) 0 0;
    color: var(--color-muted);
    font-size: var(--text-sm);
}

/* The body scrolls; the title above and the footer below stay in view. */
.modal-body {
    min-height: 0;
    padding: var(--space-5);
    overflow-y: auto;
}

.modal-body > form > .form-actions,
.modal-body > .form-actions {
    position: sticky;
    bottom: calc(-1 * var(--space-5));
    margin-inline: calc(-1 * var(--space-5));
    margin-bottom: calc(-1 * var(--space-5));
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

@keyframes modal-in {
    from {
        transform: translateY(var(--space-2)) scale(0.98);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal {
        animation: none;
    }
}

@media (max-width: 640px) {
    .modal-backdrop {
        padding: var(--space-4) var(--gutter);
    }
}

/* Maps (Leaflet) */
.map {
    position: relative;
    /* Keeps Leaflet's panes (z-index 400+) below modals and the header. */
    isolation: isolate;
    width: 100%;
    height: 320px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-placeholder);
}

/* Leaflet draws its zoom buttons and attribution white; in dark they take the surface like the rest. */
.leaflet-bar a,
.leaflet-control-attribution {
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

.leaflet-control-attribution a {
    color: var(--color-info) !important;
}

/* Behind the tiles while they load (Leaflet paints it light grey itself). */
.leaflet-container {
    background: var(--color-placeholder);
}

/* The tiles are OpenStreetMap's own, always light: in dark they are dimmed so the map does not glare, but keep their
   colours, so a street still looks like a street. */
:root[data-theme='dark'] .leaflet-tile-pane {
    filter: brightness(0.82) contrast(1.05);
}

/* The point on a map (Map.tsx): SVG, so CSS wins over Leaflet's stroke/fill attributes. */
.map-marker {
    stroke: var(--color-primary);
    fill: var(--color-marker-fill);
}

.map-picker {
    height: 260px;
    cursor: crosshair;
}

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

.location-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}

@media (max-width: 640px) {
    .map {
        height: 240px;
    }

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

/* A PDF shown inside a modal */
.document-frame {
    display: block;
    width: 100%;
    height: 72vh;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.document-name {
    margin-right: auto;
    overflow-wrap: anywhere;
}

.document-image {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

.previous-payment {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-sm);
    background: var(--color-warning-soft);
}

.previous-payment .form-grid {
    margin: 0;
}

.previous-payment p {
    margin: 4px 0 0;
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px var(--gutter);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card p {
    margin: 0;
}

.auth-card .alert {
    margin-bottom: 0;
}

.auth-brand .auth-slogan {
    margin: 4px 0 0;
}

/* The brand, and the sign-in screen's language (LoginPage's LanguageToggle) at the other end of the row */
.auth-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.auth-language {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

/* Renter sign-in: the emailed code, big enough to read back from a phone */
.otp-input {
    font-size: var(--text-xl);
    letter-spacing: 0.4em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.rental-choice {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rental-choice-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.rental-choice-option:hover:not(:disabled),
.rental-choice-option:focus-visible {
    border-color: var(--color-primary);
}

.rental-choice-option img {
    border-radius: var(--radius-sm);
    flex: none;
}

.rental-choice-option > span:first-of-type {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

/* Visit schedule editor (per property) */
.visit-week {
    display: grid;
    gap: 8px;
    margin: 14px 0 6px;
}

.visit-day {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
}

.visit-day.is-closed {
    background: transparent;
}

.visit-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.visit-day-actions {
    display: flex;
    gap: 4px;
}

.visit-window {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.visit-window input[type='time'] {
    width: auto;
    min-width: 7.5em;
}

.visit-window input[aria-invalid='true'] {
    border-color: var(--color-danger);
}

.visit-blackouts {
    display: grid;
    gap: 6px;
    margin: 14px 0;
}

.visit-blackout-add {
    display: flex;
    align-items: center;
    gap: 8px;
}

.visit-blackout-add input[type='date'] {
    width: auto;
}

.visit-blackout-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.visit-blackout-list li {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--text-sm);
}

/* Reviewing one application */
.applicant-summary {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
}

.applicant-summary dt {
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.applicant-summary dd {
    margin: 2px 0 0;
    font-weight: 600;
    /* A long email breaks inside its own column instead of running into the next one. */
    overflow-wrap: anywhere;
}

.application-docs {
    display: grid;
    gap: 8px;
    margin: 8px 0 18px;
    padding: 0;
    list-style: none;
}

.application-docs li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
}

.application-doc-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-muted);
}

.application-doc-body {
    display: grid;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

@media (min-width: 641px) {
    .applicant-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* A long email takes two of the three columns (QA-0009). */
    .applicant-summary .is-email {
        grid-column: span 2;
    }
}

/* Documentation ("Documentación"): the guides of each role */
.help-card {
    color: inherit;
    text-decoration: none;
    gap: 8px;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.help-card:hover,
.help-card:focus-visible {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
}

.help-card-title {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text);
}

.help-card-summary {
    color: var(--color-muted);
}

.help-card-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--text-sm);
}

.help-card-category {
    display: block;
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.help-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
}

.help-result:hover,
.help-result:focus-visible {
    border-color: var(--color-primary);
}

.help-result-title {
    font-weight: 600;
    font-size: var(--text-base);
}

.help-result-snippet {
    color: var(--color-muted);
}

.help-results mark {
    background: var(--color-warning-soft);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

.help-back {
    display: inline-block;
    margin-bottom: 12px;
    font-weight: 600;
}

.help-article {
    max-width: 860px;
}

.help-article .page-header {
    margin-top: 4px;
}

.help-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: var(--text-base);
    line-height: 1.6;
}

.help-body > p,
.help-body > h2 {
    margin: 0;
}

.help-body > h2 {
    margin-top: 12px;
    font-size: var(--text-md);
}

.help-list {
    margin: 0;
    padding-left: 22px;
}

.help-list li + li {
    margin-top: 6px;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.help-step-number {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 700;
    font-size: var(--text-base);
}

.help-step-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.help-step-body > p {
    margin: 0;
}

.help-callout {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    border-left: 4px solid;
    border-radius: var(--radius-sm);
}

.help-callout-tip {
    background: var(--color-success-soft);
    border-color: var(--color-success);
}

.help-callout-tip strong {
    color: var(--color-success);
}

.help-callout-warning {
    background: var(--color-warning-soft);
    border-color: var(--color-warning);
}

.help-callout-warning strong {
    color: var(--color-warning);
}

.help-figure {
    margin: 12px 0 0;
}

.help-figure-button {
    display: inline-block;
    max-width: 100%;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: zoom-in;
}

.help-figure-button:hover,
.help-figure-button:focus-visible {
    border-color: var(--color-primary);
}

/* A tall dialog would otherwise fill the screen; clicking opens it at full size. */
.help-figure img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
}

.help-figure figcaption {
    margin-top: 6px;
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.help-zoomed {
    display: block;
    width: 100%;
    height: auto;
}

.help-related {
    margin-top: 40px;
}

/* The utilities of one cobro: a row per utility, with the readings and the amount typed in place. */
.bill-utilities {
    margin-top: 24px;
}

.bill-utilities h3 {
    margin-bottom: 4px;
}

.bill-utilities .table td {
    vertical-align: middle;
}

/* Two readings, or a price and its unit, side by side inside one cell. */
.reading-pair {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bill-utilities input {
    width: 92px;
    min-width: 0;
    text-align: right;
}

/* The price per meter unit, with what the row works out to underneath it. */
.metered-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bill-utilities select {
    max-width: 200px;
}

.bill-utilities td {
    white-space: normal;
}

/* Comunicados: the composer, its previews, and a notice as it was sent */
.composer {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.composer-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.composer-section h2 {
    margin: 0;
    font-size: var(--text-md);
}

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

.audience-summary {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
}

.audience-summary p {
    margin: 0 0 4px;
}

.audience-summary ul {
    margin: 6px 0;
    padding-left: 18px;
}

.message-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-preview h3 {
    margin: 0;
    font-size: var(--text-base);
}

.message-bubble {
    max-width: 46ch;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px 14px 14px 4px;
    background: var(--color-surface);
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-bubble p {
    margin: 0 0 8px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble-whatsapp {
    background: var(--color-whatsapp-bubble);
    color: var(--color-on-whatsapp-bubble);
}

.notice-detail {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    /* Each card as tall as its own content: a short message is not stretched into an empty box (L4). */
    align-items: start;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 1024px) {
    .notice-detail {
        grid-template-columns: minmax(0, 1fr);
    }
}

.line-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Ventas › Contactos: one lead's detail (platform). */
.lead-detail {
    display: grid;
    gap: 1.25rem;
}

.lead-note {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.lead-timeline {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0 0 0 1rem;
    border-left: 2px solid var(--color-border);
    list-style: none;
}

.lead-timeline li {
    position: relative;
}

.lead-timeline li::before {
    content: '';
    position: absolute;
    left: calc(-1rem - 5px);
    top: 0.45rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
}

.lead-touch-value {
    overflow-wrap: anywhere;
}


/*
 * Printing (docs/prd/prd-ui-next.md, R): the content only, on the light theme (ThemeProvider switches to it while
 * printing), with a table's head repeated on each page and no row split across two.
 */
/* Toast notices (B5, item 0): saves and sends said at the bottom of the viewport, errors stay inline. */
.toasts {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 480px;
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-inline-start: 4px solid var(--color-success);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    pointer-events: auto;
    animation: toast-in var(--dur) var(--ease);
}

.toast > .icon {
    flex: none;
    color: var(--color-success);
}

.toast-message {
    flex: 1;
    min-width: 0;
}

.toast-close {
    flex: none;
    display: inline-flex;
    padding: var(--space-1);
    color: var(--color-muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition:
        color var(--dur-fast) var(--ease),
        background-color var(--dur-fast) var(--ease);
}

.toast-close:hover {
    color: var(--color-text);
    background: var(--color-surface-sunken);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* Row selection and the bulk bar (B1, item 0). */
.table th.col-select,
.table td.col-select {
    width: 1%;
    padding-inline-end: 0;
}

.table .col-select input {
    display: grid;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.table tbody tr:has(td.col-select input:checked) td {
    background: var(--color-selected-row);
}

.bulk-bar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--color-selected-row);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.bulk-bar-count {
    font-weight: 600;
}

.bulk-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-inline-end: auto;
}

/* What a batch could not do (B1, item billing): one line per row under the alert's title. */
.batch-failures {
    margin: var(--space-1) 0 0;
    padding-left: var(--space-5);
}

/* Sortable headers (B6, item 0): the header's words are the button; the arrow says the order. */
.th-sort {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease);
}

.th-sort:hover,
.th-sort.is-sorted {
    color: var(--color-text);
}

.th-sort-arrow {
    opacity: 0.5;
}

.th-sort.is-sorted .th-sort-arrow {
    opacity: 1;
}

/* Setup guide (B2, item dashboard-portal) */

.setup-guide {
    margin-bottom: var(--space-5);
}

.setup-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.setup-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.setup-step:last-child {
    border-bottom: 0;
}

.setup-step-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
}

.setup-step-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--color-border-strong);
    color: var(--color-on-primary);
}

.setup-step.is-done .setup-step-mark {
    background: var(--color-success);
    border-color: var(--color-success);
}

.setup-step.is-done .setup-step-title {
    color: var(--color-muted);
    font-weight: 500;
}

/* Activity list (B8, item dashboard-portal) */

.activity-list-card {
    margin-bottom: var(--space-5);
}

.activity-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

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

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-item.is-unread .activity-what {
    font-weight: 700;
}

.activity-new {
    margin-left: var(--space-2);
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: 700;
}

@media (max-width: 640px) {
    .activity-item,
    .setup-step {
        flex-wrap: wrap;
    }

    .activity-body {
        flex-basis: calc(100% - 36px - var(--space-3));
    }
}

/* Portal home: what you owe (B9, item dashboard-portal) */

.owe-card {
    margin-bottom: var(--space-5);
}

.owe-card.is-overdue {
    border-color: var(--color-danger-border);
}

.owe-card h2 {
    margin: 0;
    font-size: var(--text-md);
}

.owe-amount {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.owe-due {
    font-weight: 600;
}

.owe-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

@media (max-width: 640px) {
    .owe-actions .btn {
        flex: 1 1 100%;
    }
}

/* Photo hint on the public profile tab (A4, item public-unit) */
.photo-hint {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-left: 3px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.photo-hint-low {
    border-left-color: var(--color-info);
    color: var(--color-text);
}

/* A report's range and its export, side by side in the card header (B7, item lists). */
.card-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

@media (max-width: 640px) {
    /* On a phone everything a thumb presses is --control-lg tall: buttons, fields and dropdowns. */
    .btn,
    select,
    input:not([type='checkbox']):not([type='radio']):not([type='range']) {
        min-height: var(--control-lg);
    }

    /* A card's actions: the main one takes the width, every button is a thumb's height. */
    .table td.actions .row-actions {
        width: 100%;
    }

    .table td.actions .split {
        flex: 1;
    }

    .table td.actions .split > :first-child {
        flex: 1;
        justify-content: center;
    }

    .table td.actions .split.is-split > .split-toggle,
    .table td.actions .btn-icon {
        width: var(--control-lg);
    }

    /* Icon buttons (a card's edit, a modal's or an alert's close) and a row's status dropdown: a thumb's size too. */
    .btn.btn-icon,
    .icon-btn {
        width: var(--control-lg);
        height: var(--control-lg);
        min-width: var(--control-lg);
        min-height: var(--control-lg);
    }

    .row-action-select {
        min-height: var(--control-lg);
    }

    /* On a card the checkbox sits at its top left; the title stays right-aligned beside it. */
    .table tbody tr td.col-select {
        float: left;
        padding: var(--space-1) 0 0;
    }
}

/*
 * Row actions (docs/prd/prd-row-actions.md, RowActions): the row's main action joined to a chevron that opens the rest,
 * always filled in its colour (the row's tint says whose turn it is).
 */
.split {
    display: inline-flex;
}

.split.is-split > :first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.split.is-split > .split-toggle {
    margin-left: -1px;
    width: 30px;
    padding: 0;
    justify-content: center;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.split-toggle[aria-expanded='true'] {
    background: var(--action-soft);
    border-color: var(--action);
}

/* The one main action of a group (a row, a bar, a panel, a footer): filled in its action's colour (CLAUDE.md §2). */
.btn-action.is-main {
    background: var(--action);
    border-color: var(--action);
    color: var(--color-surface);
}

.btn-action.is-main:hover:not(:disabled),
.split-toggle.is-main[aria-expanded='true'] {
    background: color-mix(in srgb, var(--action) 85%, var(--color-text));
    border-color: color-mix(in srgb, var(--action) 85%, var(--color-text));
}

.split.is-split > .split-toggle.is-main {
    border-left-color: color-mix(in srgb, var(--color-surface) 40%, var(--action));
}

.split-more {
    gap: var(--space-1);
}

.row-menu {
    position: fixed;
    z-index: var(--z-popover);
    min-width: 260px;
    max-width: min(340px, calc(100vw - 16px));
    padding: var(--space-1);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: row-menu-in var(--dur-fast) var(--ease);
}

@keyframes row-menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.row-menu hr {
    margin: var(--space-1);
    border: 0;
    border-top: 1px solid var(--color-border);
}

.row-menu-heading {
    padding: var(--space-2) var(--space-3) var(--space-half);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.row-menu-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font: inherit;
    font-size: var(--text-sm);
    text-align: left;
    text-decoration: none;
    color: var(--color-text);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}

.row-menu-item:hover:not(:disabled),
.row-menu-item:focus-visible,
.row-menu-item[aria-expanded='true'] {
    background: var(--color-surface-sunken);
    outline: none;
}

.row-menu-item:disabled {
    opacity: 0.55;
    cursor: default;
}

.row-menu-item > .icon {
    flex: none;
    margin-top: var(--space-half);
}

.row-menu-text {
    display: grid;
    gap: var(--space-half);
}

.row-menu-label {
    font-weight: 600;
}

.row-menu-desc {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

/*
 * Each item sits on its own action's tint, its colour in the icon and the words, like the buttons outside the menu
 * (`.row-menu.is-tinted`); hovered or focused, the tint deepens and the words step towards the text colour. The line
 * under the label mixes the item's colour with the text (styles.test.ts checks every pair in both themes).
 */
.row-menu.is-tinted .row-menu-group {
    display: grid;
    gap: var(--space-1);
}

.row-menu.is-tinted .row-menu-item {
    background: var(--tone-soft);
    color: var(--tone);
}

.row-menu.is-tinted .row-menu-item:hover:not(:disabled),
.row-menu.is-tinted .row-menu-item:focus-visible,
.row-menu.is-tinted .row-menu-item[aria-expanded='true'] {
    background: color-mix(in srgb, var(--tone) 18%, var(--color-surface));
    /* A step towards the text colour keeps the words readable on the deeper tint (dark indigo needs it). */
    color: color-mix(in srgb, var(--tone) 80%, var(--color-text));
}

.row-menu.is-tinted .row-menu-item:focus-visible {
    outline: 2px solid var(--tone);
    outline-offset: -2px;
}

.row-menu.is-tinted .row-menu-desc {
    color: color-mix(in srgb, currentColor 75%, var(--color-text));
}

.row-menu .tone-confirm { --tone: var(--color-success); --tone-soft: var(--color-success-soft); }
.row-menu .tone-danger { --tone: var(--color-danger); --tone-soft: var(--color-danger-soft); }
.row-menu .tone-edit { --tone: var(--color-info); --tone-soft: var(--color-info-soft); }
.row-menu .tone-open { --tone: var(--color-accent); --tone-soft: var(--color-accent-soft); }
.row-menu .tone-file { --tone: var(--color-teal); --tone-soft: var(--color-teal-soft); }
.row-menu .tone-setup { --tone: var(--color-indigo); --tone-soft: var(--color-indigo-soft); }
.row-menu .tone-revert { --tone: var(--color-warning); --tone-soft: var(--color-warning-soft); }
.row-menu .tone-contact { --tone: var(--color-rose); --tone-soft: var(--color-rose-soft); }

/* A risky item asks inside the menu, under itself. */
.row-menu-ask {
    display: grid;
    gap: var(--space-2);
    margin: 0 var(--space-1) var(--space-1);
    padding: var(--space-2) var(--space-3) var(--space-3);
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
}

.row-menu-ask.tone-danger { background: var(--color-danger-soft); }
.row-menu-ask.tone-revert { background: var(--color-warning-soft); }
.row-menu-ask .btn-action { --action: var(--color-danger); }
.row-menu-ask.tone-revert .btn-action { --action: var(--color-warning); }
.row-menu-ask.tone-confirm .btn-action { --action: var(--color-success); }
.row-menu-ask.tone-setup .btn-action { --action: var(--color-indigo); }

.row-menu-ask-actions {
    display: flex;
    gap: var(--space-2);
}

/* On a phone the menu is a sheet from the bottom of the screen, its items a thumb's height. */
.row-menu-scrim {
    position: fixed;
    inset: 0;
    z-index: var(--z-popover);
    background: var(--color-overlay);
}

.row-menu.is-sheet {
    inset: auto 0 0;
    max-width: none;
    min-width: 0;
    padding: var(--space-3) var(--space-3) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius) var(--radius) 0 0;
    animation-name: row-sheet-in;
}

@keyframes row-sheet-in {
    from {
        transform: translateY(16px);
        opacity: 0;
    }
}

.row-menu-title {
    padding: 0 var(--space-3) var(--space-2);
    font-weight: 700;
}

.row-menu.is-sheet .row-menu-item {
    min-height: 48px;
    align-items: center;
    font-size: var(--text-base);
}

/* buttons-and-settings (docs/prd/prd-buttons-and-settings.md): each item writes its rules under its own heading. */

/* Mail account (item smtp) */

/* Proof list (item proofs) */
.proof-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Requirements text (item requirements) */
/* A unit's modal shows its property's text above its own, read-only, as the applicant would read it. */
.requirements-inherited {
    margin: var(--space-2) 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-sunken);
}

.requirements-inherited .section-title {
    margin-top: 0;
}

.requirements-text {
    margin: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

@media print {
    .sidebar,
    .sidebar-backdrop,
    .mobile-bar,
    .skip-link,
    .impersonation-banner,
    .toolbar,
    .tabs,
    .pager,
    .row-actions,
    .row-menu,
    .btn,
    .toasts,
    .bulk-bar,
    .col-select,
    th.col-actions,
    td.actions,
    .quick-open {
        display: none;
    }

    .shell {
        display: block;
    }

    .content {
        max-width: none;
        padding: 0;
    }

    .card,
    .stat,
    .table-wrap {
        box-shadow: none;
        break-inside: avoid;
    }

    .table thead {
        display: table-header-group;
    }

    .table tr {
        break-inside: avoid;
    }

    .table tr.row-tone td {
        print-color-adjust: exact;
    }
}

/*
 * The UI baseline (Plataforma › Componentes, pages/platform/StyleGuidePage.tsx, docs/prd/prd-ui-baseline.md): the page
 * that shows every shared component in every state, one section per screenshot of e2e/baseline/.
 */
.guide {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.guide-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.guide-title {
    margin: 0;
    font-size: var(--text-lg);
}

.guide-rule {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    background: var(--color-surface-sunken);
    border-radius: var(--radius-sm);
}

.guide-rule > div {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: var(--space-2);
}

.guide-rule dt {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.guide-rule dd {
    margin: 0;
}

.guide-rule-use dt {
    color: var(--color-success);
}

.guide-rule-avoid dt {
    color: var(--color-danger);
}

.guide-rule-code dt {
    color: var(--color-muted);
}

.guide-sub {
    margin: var(--space-2) 0 0;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

.guide-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.guide-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.guide-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    align-items: start;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
    align-items: start;
}

/* Room above the specimen for its tooltip, which the screenshot shows under the pointer. */
.guide-tooltip {
    padding-top: var(--space-8);
}

.guide-specimen {
    display: grid;
    justify-items: start;
    gap: var(--space-1);
}

.guide-caption {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.guide-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: var(--space-2);
}

.guide-swatch {
    display: grid;
    gap: var(--space-1);
    font-size: var(--text-xs);
}

.guide-swatch-colour {
    display: block;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.guide-steps,
.guide-heights {
    display: grid;
    gap: var(--space-2);
}

.guide-step,
.guide-height {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.guide-step code,
.guide-height code {
    width: 140px;
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.guide-height input,
.guide-height select {
    width: 160px;
}

.guide-control-sm {
    min-height: var(--control-sm);
    padding: 4px 6px;
}

.guide-control-lg {
    min-height: var(--control-lg);
}

/* The three breakpoints, to scale on a 1440 px line. */
.guide-ruler {
    display: grid;
    grid-template-columns: 640fr 384fr 256fr 160fr;
    gap: 2px;
    max-width: 720px;
    font-size: var(--text-xs);
    font-weight: 600;
}

.guide-zone {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.guide-zone-phone {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.guide-zone-tablet {
    background: var(--color-info-soft);
    color: var(--color-info);
}

.guide-zone-desktop {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.guide-zone-wide {
    background: var(--color-teal-soft);
    color: var(--color-teal);
}

.guide-ruler-ticks {
    display: grid;
    grid-template-columns: 640fr 384fr 256fr 160fr;
    max-width: 720px;
    font-size: var(--text-xs);
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.guide-ruler-ticks span {
    text-align: right;
}

.guide-kinds {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

.guide-kind {
    display: grid;
    justify-items: start;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.guide-kind code {
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.guide-prose {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 64ch;
}

.guide-prose > * {
    margin: 0;
}

.guide-prose ul,
.guide-prose ol {
    display: grid;
    gap: var(--space-1);
    padding-left: var(--space-5);
}

.guide-prose kbd,
.guide-prose code {
    padding: 1px 6px;
    font-family: inherit;
    font-size: var(--text-sm);
    background: var(--color-neutral-soft);
    border-radius: 4px;
}

.guide-prose kbd {
    border: 1px solid var(--color-border-strong);
}

.guide-prose hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--color-border);
}

.guide-prose details {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.guide-prose summary {
    font-weight: 600;
    cursor: pointer;
}

.guide-prose details p {
    margin: var(--space-2) 0 0;
    color: var(--color-muted);
}

.guide-switches {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.guide-skeletons {
    display: grid;
    gap: var(--space-2);
    max-width: 280px;
}

/* Room under the row for its menu, which the row menu section opens for its screenshot. */
.guide-menu-room {
    min-height: 460px;
}

@media (max-width: 1024px) {
    .guide-grid,
    .guide-kinds {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .guide-section {
        padding: var(--space-4);
    }

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

