/* =========================================================================
   PropertyHub — Shared/Ui COMPONENT LIBRARY
   -------------------------------------------------------------------------
   The styles for Shared/Ui/*.razor and nothing else. Every value here is a
   token from tokens.css: if a colour, radius or spacing step is needed that
   no token expresses, the token is what gets added — not a literal here.

   Direction: written with LOGICAL properties throughout (inline-start/end,
   padding-inline, margin-block) rather than left/right. That is what makes
   ku/ar RTL correct by construction instead of by a mirrored stylesheet —
   there is no .rtl override section in this file on purpose.
   ========================================================================= */

/* ---- PageShell ---------------------------------------------------------- */
/* No padding of its own: .page-content (app.css) is the one gutter around every page.
   Both used to pad, which doubled the empty margin round the content. */
.ui-page {
    padding: 0;
    max-width: 1180px;          /* a reading width; dashboards opt out with Wide */
    margin-inline: auto;
    width: 100%;
}
.ui-page-wide { max-width: none; }

/* ---- PageHeader --------------------------------------------------------- */
.ui-page-header { margin-block-end: var(--space-5); }

.ui-page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.ui-page-header-text { min-width: 0; }

.ui-page-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: var(--lh-tight);
    color: var(--text-primary);
    margin: 0;
}
.ui-page-subtitle {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: var(--lh-body);
    margin: var(--space-1) 0 0;
}
.ui-page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* BackButton — quiet until hovered. It is on every page, so it must not compete
   with the page's own actions for attention. */
.ui-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: none;
    border: none;
    padding: var(--space-1) var(--space-2);
    margin-inline-start: calc(var(--space-2) * -1);
    margin-block-end: var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.ui-back:hover { background: var(--surface-3); color: var(--text-primary); }
.ui-back:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* One chevron asset, mirrored for RTL rather than duplicated as a second path. */
[dir="rtl"] .ui-back-icon { transform: scaleX(-1); }

.ui-crumbs {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-block-end: var(--space-2);
}
.ui-crumbs a { color: var(--text-secondary); text-decoration: none; }
.ui-crumbs a:hover { color: var(--accent); text-decoration: underline; }
.ui-crumb-sep { color: var(--text-muted); }
.ui-crumb-current { color: var(--text-primary); font-weight: 600; }

/* ---- SectionCard -------------------------------------------------------- */
.ui-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* GreenSchool's card (user call, 2026-10-11): white, a slate hairline and the faintest
       shadow — enough to lift it off the near-white canvas, never a drop shadow. */
    box-shadow: var(--shadow-sm);
    margin-block-end: var(--space-4);
    overflow: hidden;
}
.ui-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-block-end: 1px solid var(--border);
}
.ui-card-title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.ui-card-subtitle {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin: var(--space-1) 0 0;
}
.ui-card-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
.ui-card-body { padding: var(--space-5); }
.ui-card-flush .ui-card-body { padding: 0; }

/* ---- KeyValueGrid ------------------------------------------------------- */
.ui-kv {
    display: grid;
    gap: var(--space-4) var(--space-5);
    margin: 0;
}
.ui-kv-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-kv-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-kv-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ui-kv-item { min-width: 0; }
.ui-kv-wide { grid-column: 1 / -1; }

.ui-kv-label {
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-1);
}
.ui-kv-value {
    font-size: var(--text-md);
    color: var(--text-primary);
    margin: 0;
    overflow-wrap: anywhere;   /* a long reference must wrap, not widen the grid */
}
.ui-kv-empty { color: var(--text-muted); }

/* ---- StatusPill --------------------------------------------------------- */
.ui-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: .25rem .6rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}
.ui-pill-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    flex-shrink: 0;
    /* The dot carries the status too, so the pill is not colour-alone: it keeps a
       distinct shape cue next to the text for anyone who cannot separate the tints. */
    background: currentColor;
}

.ui-pill-available { background: var(--status-available-bg); color: var(--status-available-ink); }
.ui-pill-available .ui-pill-dot { background: var(--status-available-dot); }
.ui-pill-reserved  { background: var(--status-reserved-bg);  color: var(--status-reserved-ink); }
.ui-pill-reserved .ui-pill-dot  { background: var(--status-reserved-dot); }
.ui-pill-rented    { background: var(--status-rented-bg);    color: var(--status-rented-ink); }
.ui-pill-rented .ui-pill-dot    { background: var(--status-rented-dot); }
.ui-pill-sold      { background: var(--status-sold-bg);      color: var(--status-sold-ink); }
.ui-pill-sold .ui-pill-dot      { background: var(--status-sold-dot); }

.ui-pill-neutral   { background: var(--status-neutral-bg);   color: var(--status-neutral-ink); }
.ui-pill-neutral .ui-pill-dot   { background: var(--status-neutral-dot); }
.ui-pill-positive  { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }
.ui-pill-negative  { background: var(--danger-soft); color: var(--danger); }

/* ---- MoneyText ---------------------------------------------------------- */
.ui-money {
    font-family: var(--font-numeric);
    /* Tabular figures: in a column of installments, proportional digits stop the
       amounts lining up and the reader has to read every row to find the large one. */
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-weight: 600;
    white-space: nowrap;
}
.ui-money-lg { font-size: var(--text-lg); font-weight: 700; letter-spacing: -.01em; }
.ui-money-pos { color: var(--success); }
.ui-money-neg { color: var(--danger); }
/* On a gradient KPI tile the tile colour carries the verdict; the figures stay white. */
.ui-kpi .ui-money-pos, .ui-kpi .ui-money-neg { color: inherit; }

/* ---- StatCard ----------------------------------------------------------- */
.ui-stat {
    /* Each card sizes its own contents from its own width, not the viewport's. The same
       card sits in a five-across dashboard row and in a two-across panel, and a media
       query cannot tell those apart. */
    container-type: inline-size;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
    min-width: 0;
}
.ui-stat-body { min-width: 0; }

.ui-stat-label {
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .78;
    margin-block-end: var(--space-1);
}
.ui-stat-value {
    font-family: var(--font-numeric);
    font-variant-numeric: tabular-nums;
    font-size: clamp(1.05rem, .85rem + .7vw, 1.4rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.02em;
}
.ui-stat-foot {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
    font-size: var(--text-xs);
    /* Quiet by colour, not opacity — the toned captions are chips now, and dimming
       a chip's paired bg/ink would undo its checked contrast. */
    color: var(--text-muted);
}
.ui-stat-delta { font-weight: 700; }
.ui-stat-delta.up { color: var(--success); }
.ui-stat-delta.down { color: var(--danger); }

/* Narrow card: the headline figure steps down a size so a six-figure amount stops
   overflowing, and the padding tightens to match. */
@container (max-width: 210px) {
    .ui-stat { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
    .ui-stat-value { font-size: var(--text-xl); }
    .ui-stat-icon { width: 38px; height: 38px; }
}

.ui-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Tones. The four unit states take the ramp so a "sold" card and a "sold" donut slice
   are the same colour; each is dark enough to carry white text, which the pale end of
   the ramp on its own cannot do. */
/* ---- Tones -------------------------------------------------------------
   Every stat card is a white card (design/Image Sample: no solid colour blocks —
   user call, 2026-09-30). The tone rides two small things instead: a status dot
   beside the label, and the caption set as a soft chip. Both draw from the same
   status tokens as StatusPill and the donut, so a status is one colour everywhere,
   and both flip correctly in dark mode through those tokens. */

.ui-stat-total .ui-stat-label::before,
.ui-stat-available .ui-stat-label::before,
.ui-stat-reserved .ui-stat-label::before,
.ui-stat-rented .ui-stat-label::before,
.ui-stat-sold .ui-stat-label::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-inline-end: 6px;
    vertical-align: 1px;
}

.ui-stat-total .ui-stat-label::before     { background: var(--secondary); }
.ui-stat-available .ui-stat-label::before { background: var(--status-available-dot); }
.ui-stat-reserved .ui-stat-label::before  { background: var(--status-reserved-dot); }
.ui-stat-rented .ui-stat-label::before    { background: var(--status-rented-dot); }
.ui-stat-sold .ui-stat-label::before      { background: var(--status-sold-dot); }

/* The caption as a chip — the sample sidebar's soft count badges, carried over. */
.ui-stat-available .ui-stat-caption,
.ui-stat-reserved .ui-stat-caption,
.ui-stat-rented .ui-stat-caption,
.ui-stat-sold .ui-stat-caption,
.ui-stat-positive .ui-stat-caption,
.ui-stat-negative .ui-stat-caption {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ui-stat-available .ui-stat-caption { background: var(--status-available-bg); color: var(--status-available-ink); }
.ui-stat-reserved .ui-stat-caption  { background: var(--status-reserved-bg);  color: var(--status-reserved-ink); }
.ui-stat-rented .ui-stat-caption    { background: var(--status-rented-bg);    color: var(--status-rented-ink); }
.ui-stat-sold .ui-stat-caption      { background: var(--status-sold-bg);      color: var(--status-sold-ink); }
.ui-stat-positive .ui-stat-caption  { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.ui-stat-negative .ui-stat-caption  { background: var(--danger-soft); color: var(--danger); }

/* Money direction belongs on the figure itself, not on the whole card. */
.ui-stat-positive .ui-stat-value { color: var(--success); }
.ui-stat-negative .ui-stat-value { color: var(--danger); }

.ui-stat-link { cursor: pointer; transition: transform .15s ease, border-color .15s ease; }
.ui-stat-link:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.ui-stat-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* A row of stat cards. Auto-fit rather than a fixed column count, so three cards and
   five cards both look deliberate instead of one leaving a hole. */
.ui-stat-row {
    display: grid;
    /* 168px, not 220: a dashboard row is five cards (four unit statuses plus a total,
       or three money figures plus overdue and upcoming) and at a wider minimum the fifth
       wrapped onto a line of its own, which reads as a mistake rather than a layout.
       The cards shrink their own type to suit — see the container query below. */
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: var(--space-4);
    margin-block-end: var(--space-4);
}

/* ---- EntityHero --------------------------------------------------------- */
.ui-hero {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-block-end: var(--space-4);
}
/* No media column: the body takes the whole card. */
.ui-hero-nomedia { grid-template-columns: minmax(0, 1fr); }

.ui-hero-media { position: relative; background: var(--surface-3); min-height: 220px; }
.ui-hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ui-hero-compact .ui-hero-media { min-height: 150px; }

/* A missing photo is normal early in a project. A branded placeholder says "no image
   yet"; an empty grey box or a broken-image icon says "this page is broken". */
.ui-hero-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--secondary);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--surface-3)), var(--surface-3));
}
.ui-hero-overlay { position: absolute; inset-block-end: var(--space-3); inset-inline-end: var(--space-3); }

.ui-hero-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.ui-hero-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.ui-hero-eyebrow {
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-block-end: var(--space-1);
}
.ui-hero-title { font-size: var(--text-xl); font-weight: 800; letter-spacing: -.015em; margin: 0; color: var(--text-primary); }
.ui-hero-subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin: var(--space-1) 0 0; }

.ui-hero-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--space-3) var(--space-4);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--border);
}
.ui-hero-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ui-hero-fact-label {
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ui-hero-fact-value { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); }
.ui-hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-block-start: auto; }

/* ---- TabBar ------------------------------------------------------------- */
.ui-tabs {
    display: flex;
    gap: var(--space-1);
    border-block-end: 1px solid var(--border);
    margin-block-end: var(--space-4);
    overflow-x: auto;
    scrollbar-width: none;
}
.ui-tabs::-webkit-scrollbar { display: none; }

.ui-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border: none;
    border-block-end: 2px solid transparent;
    padding: var(--space-3) var(--space-4);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.ui-tab:hover { color: var(--text-primary); }
/* Coral is the app's selection colour — active nav, active tab. Nothing else. */
.ui-tab.is-active { color: var(--text-primary); border-block-end-color: var(--accent); }
.ui-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.ui-tab-badge {
    font-family: var(--font-numeric);
    font-size: var(--text-2xs);
    font-weight: 700;
    background: var(--surface-3);
    color: var(--text-secondary);
    padding: 1px .4rem;
    border-radius: var(--radius-pill);
}
.ui-tab.is-active .ui-tab-badge { background: var(--accent-soft); color: var(--accent); }

/* ---- Timeline ----------------------------------------------------------- */
.ui-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.ui-tl-item {
    position: relative;
    padding-inline-start: var(--space-6);
    padding-block-end: var(--space-5);
}
/* The rail. Drawn on the item rather than the list so the last stop can stop it. */
.ui-tl-item::before {
    content: "";
    position: absolute;
    inset-inline-start: 7px;
    inset-block: 6px 0;
    width: 2px;
    background: var(--border);
}
.ui-tl-item:last-child { padding-block-end: 0; }
.ui-tl-item:last-child::before { display: none; }

.ui-tl-marker {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--border-strong);
    z-index: 1;
}
.ui-tl-done .ui-tl-marker     { border-color: var(--success); background: var(--success); }
.ui-tl-due .ui-tl-marker      { border-color: var(--accent); }
.ui-tl-overdue .ui-tl-marker  { border-color: var(--danger); background: var(--danger); }
.ui-tl-upcoming .ui-tl-marker { border-color: var(--border-strong); }

.ui-tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.ui-tl-title { font-weight: 600; color: var(--text-primary); font-size: var(--text-md); }
.ui-tl-meta { font-family: var(--font-numeric); font-size: var(--text-xs); color: var(--text-muted); }
.ui-tl-text { font-size: var(--text-sm); color: var(--text-secondary); margin: var(--space-1) 0 0; }
.ui-tl-overdue .ui-tl-title { color: var(--danger); }

/* ---- EmptyState --------------------------------------------------------- */
.ui-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-7) var(--space-5);
    color: var(--text-secondary);
}
.ui-empty-mark {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--secondary);
    margin-block-end: var(--space-4);
}
.ui-empty-title { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); margin: 0; }
.ui-empty-text { font-size: var(--text-sm); margin: var(--space-2) 0 0; max-width: 42ch; }
.ui-empty-action { margin-block-start: var(--space-4); }

/* ---- LoadingSkeleton ---------------------------------------------------- */
.ui-skel-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.ui-skel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }

.ui-skel {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: ui-skel-shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
.ui-skel-line { height: 12px; }
.ui-skel-row  { height: 44px; }
.ui-skel-card { height: 104px; border-radius: var(--radius); }

@keyframes ui-skel-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---- DataGrid ----------------------------------------------------------- */
/* The scroll container the Telerik grid needs on small screens. app.css keeps
   .k-grid-aria-root at a 720px minimum so columns stay readable rather than crushing,
   and sets the grid's inner wrappers to overflow-x: visible. That combination has to
   scroll somewhere, and if it is not here it is the page: at 360px the body grew to the
   grid's width and every card on the page was clipped, not only the grid. */
.ui-grid-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }

/* Telerik will not accept an @if around a named child-content slot, so the toolbar
   template is always declared and hidden here when the page passed none. Without this
   every grid without a toolbar carries an empty strip along its top edge. */
.ui-grid-no-toolbar .k-grid-toolbar { display: none; }

/* ---- FormDialog --------------------------------------------------------- */
/* Width is capped rather than fixed, so a dialog opened on a 360px phone fits instead
   of running off the side — which is what a hardcoded pixel Width did on every page. */
.ui-dialog.k-window, .ui-dialog.k-dialog { width: min(560px, calc(100vw - 2rem)); max-width: calc(100vw - 2rem); }
.ui-dialog-narrow.k-window, .ui-dialog-narrow.k-dialog { width: min(420px, calc(100vw - 2rem)); }
.ui-dialog-wide.k-window,   .ui-dialog-wide.k-dialog   { width: min(860px, calc(100vw - 2rem)); }

.ui-dialog-desc { font-size: var(--text-sm); color: var(--text-secondary); margin: 0 0 var(--space-4); }
.ui-dialog-body { display: flex; flex-direction: column; gap: var(--space-4); }
.ui-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-block-start: var(--space-5);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border);
}
.ui-dialog-foot-end { display: flex; gap: var(--space-2); margin-inline-start: auto; }

/* ---- ComboSelect / form fields ------------------------------------------ */
.ui-combo { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ui-combo-full { width: 100%; }
.ui-combo-row { display: flex; gap: var(--space-2); align-items: stretch; }
.ui-combo-row > .k-combobox { flex: 1 1 auto; min-width: 0; }
.ui-combo-add { flex: 0 0 auto; font-weight: 700; }

.ui-field-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
}
.ui-req { color: var(--danger); margin-inline-start: 2px; }
.ui-field-hint { font-size: var(--text-2xs); color: var(--text-muted); margin: 0; }

/* ---- Gallery ------------------------------------------------------------ */
.ui-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}
.ui-gallery-cell {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    padding: 0;
    background: var(--surface-2);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.ui-gallery-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ui-gallery-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ui-gallery-cell:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-gallery-cover {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    background: var(--accent);
    color: var(--accent-on);
    font-size: var(--text-2xs);
    font-weight: 700;
    padding: 2px .4rem;
    border-radius: var(--radius-pill);
}

/* ---- Widget list -------------------------------------------------------
   The small lists on a dashboard — best-selling units, latest contracts. These
   were DataGrids at first, and in a half-width card the grid's fixed column
   widths squeezed the flexible column to nothing: the customer name rendered as
   "C...". A grid earns its keep when rows are sorted, paged and filtered; five
   read-only rows in a card are a list, and a list reflows. */
.ui-list { display: flex; flex-direction: column; }

.ui-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-block-end: 1px solid var(--border);
    min-width: 0;
}
.ui-list-row:last-child { border-block-end: none; }
.ui-list-row:hover { background: var(--surface-2); }

.ui-list-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ui-list-title { font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); }
.ui-list-title a { color: inherit; text-decoration: none; }
.ui-list-title a:hover { color: var(--accent); text-decoration: underline; }

/* The secondary line truncates rather than wrapping the row to two heights — a
   list of five rows should be five equal rows. */
.ui-list-sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-list-end {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* ---- Ledger -------------------------------------------------------------
   A running money total: base, adjustments, result. Unit detail, contract detail
   and the cash pages all show one, and each had its own copy of these rules in a
   page-level <style> block — which is how the same breakdown ended up with three
   different row heights and two different total colours. */
.ui-ledger {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.ui-ledger-end { max-width: 380px; margin-inline-start: auto; }

.ui-ledger-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-block-end: 1px solid var(--border);
}
.ui-ledger-row:last-child { border-block-end: none; }

/* Component lines sit under the figure they add up to, quieter than it. */
.ui-ledger-sub { color: var(--text-secondary); font-size: var(--text-xs); }

.ui-ledger-total {
    background: var(--surface-2);
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Form errors --------------------------------------------------------
   Every dialog in the app had its own inline copy of this block. */
.ui-form-errors {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    font-size: var(--text-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* ---- PlanViewer --------------------------------------------------------- */
.ui-plan { display: flex; flex-direction: column; gap: var(--space-3); }
.ui-plan-stage {
    overflow: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 70vh;
    display: grid;
    place-items: center;
}
.ui-plan-stage img { transform-origin: center center; transition: transform .2s ease; max-width: 100%; }
.ui-plan-stage.is-zoomed { cursor: grab; }
.ui-plan-stage.is-zoomed img { max-width: none; }
.ui-plan-controls { display: flex; align-items: center; gap: var(--space-2); }
.ui-plan-level { font-family: var(--font-numeric); font-size: var(--text-xs); color: var(--text-secondary); min-width: 4ch; }
.ui-plan-caption { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }

/* =========================================================================
   RESPONSIVE
   The library is verified at 360 / 768 / 1280 (DES-5, DES-7). These are the
   points where a layout stops working, not arbitrary device widths.
   ========================================================================= */
@media (max-width: 1024px) {
    .ui-kv-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .ui-page { padding: 0; }
    .ui-kv-cols-3, .ui-kv-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* The hero stacks: a 320px image column beside text is unreadable at tablet width,
       and the image is the thing worth keeping full-bleed. */
    .ui-hero { grid-template-columns: minmax(0, 1fr); }
    .ui-hero-media { min-height: 200px; }
}

@media (max-width: 480px) {
    .ui-page { padding: 0; }
    .ui-page-title { font-size: var(--text-xl); }
    .ui-kv, .ui-kv-cols-2, .ui-kv-cols-3, .ui-kv-cols-4 { grid-template-columns: minmax(0, 1fr); }
    .ui-card-head, .ui-card-body { padding: var(--space-4); }
    .ui-stat { padding: var(--space-4); }
    .ui-stat-value { font-size: var(--text-xl); }
    .ui-gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

    /* Page actions go full width rather than wrapping into a ragged stack of
       different-sized buttons. */
    .ui-page-actions { width: 100%; }
    .ui-page-actions > * { flex: 1 1 auto; }

    .ui-dialog-foot { flex-direction: column-reverse; align-items: stretch; }
    .ui-dialog-foot-end { margin-inline-start: 0; }
    .ui-dialog-foot-end > * { flex: 1 1 auto; }
}

/* The shimmer and the hover lifts are decoration. Anyone who has asked the system for
   less motion should not have to watch a page of skeletons pulse. */
@media (prefers-reduced-motion: reduce) {
    .ui-skel { animation: none; }
    .ui-stat-link, .ui-gallery-cell, .ui-plan-stage img { transition: none; }
    .ui-stat-link:hover, .ui-gallery-cell:hover { transform: none; }
}

/* =========================================================================
   /design-kit only. Scaffolding for the verification page — not part of the
   library, and nothing in the app should use a .dk- class.
   ========================================================================= */
.dk-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.dk-row-tight { margin-block-end: var(--space-4); }
.dk-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); }
.dk-note { font-size: var(--text-sm); color: var(--text-secondary); line-height: var(--lh-body); margin: var(--space-4) 0 0; max-width: 72ch; }
.dk-accent { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.dk-swatch {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    cursor: pointer;
    display: grid; place-items: center;
    padding: 0;
    transition: transform .15s ease;
}
.dk-swatch:hover { transform: translateY(-2px); }
.dk-swatch.is-on { border-color: var(--text-primary); }
.dk-swatch-check { color: var(--accent-on); font-weight: 800; }
.dk-swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Row action buttons inside a DataGrid cell (Shared/Ui/RowActions + RowAction).
   One line, always: nowrap on the group and on the cell that holds it, so a narrow column
   scrolls with the grid instead of stacking buttons on top of each other. */
.ui-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.k-grid td:has(> .ui-row-actions) { white-space: nowrap; overflow: visible; }
.ui-row-actions .k-button { white-space: nowrap; }

.ui-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.ui-act:not(.ui-act-labelled) { padding: 0; width: 32px; }
.ui-act .ph-icon { flex: 0 0 auto; }
.ui-act:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 8px color-mix(in srgb, var(--text-primary) 10%, transparent); }
.ui-act:active:not(:disabled) { transform: translateY(0); }
.ui-act:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-act:disabled { opacity: .45; cursor: not-allowed; }

.ui-act-neutral:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-2); }
.ui-act-edit { color: var(--primary); }
.ui-act-edit:hover:not(:disabled) { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.ui-act-danger { color: var(--danger); }
.ui-act-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
/* The leading action of a row: navy, filled — matches the primary button on a light surface. */
.ui-act-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.ui-act-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.ui-act-success { color: var(--success); background: color-mix(in srgb, var(--success) 10%, var(--surface)); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.ui-act-success:hover:not(:disabled) { background: color-mix(in srgb, var(--success) 18%, var(--surface)); }

/* Receipt heading — centred, because that is what a receipt looks like. */
.ui-receipt-head { text-align: center; }
.ui-receipt-head h3 { margin: 0 0 var(--space-1); font-size: var(--text-lg); font-weight: 700; }

/* ---- Filter bar ---------------------------------------------------------
   The row of search + ComboSelects above a ListPage grid. Each list had its own
   inline flex rules and its own idea of the gap, so no two filter bars lined up. */
.ui-filter-bar {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: flex-end;
    margin-block-end: var(--space-4);
}
.ui-filter-bar > * { min-width: 0; }
.ui-filter-field { flex: 0 1 240px; }
.ui-filter-grow { flex: 1 1 260px; }

@media (max-width: 480px) {
    /* Full-width fields rather than a ragged two-per-row stack. */
    .ui-filter-bar { gap: var(--space-2); }
    .ui-filter-bar > * { flex: 1 1 100%; }
}

/* ---- Tags ---------------------------------------------------------------
   Neutral labels inside a grid cell — memberships, keywords. Not a StatusPill:
   these are facts about a row, not a state it is in, and giving them a status
   colour makes a cell of them shout louder than the actual Status column. */
.ui-tag-list { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.ui-tag {
    background: var(--surface-3);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 1px .4rem;
    font-size: var(--text-2xs);
    white-space: nowrap;
}

/* A sub-heading inside a long form, separating one group of fields from the next. */
.ui-form-section {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-block-start: var(--space-2);
    border-block-start: 1px solid var(--border);
}

/* ---- Split layout -------------------------------------------------------
   A narrow rail beside the main content — a category list next to its items.
   Collapses to one column before the rail gets too narrow to read. */
.ui-split {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
}
@media (max-width: 900px) {
    .ui-split { grid-template-columns: minmax(0, 1fr); }
}

/* An inline notice inside a card — the result of an action the user just ran. */
.ui-notice {
    margin: 0;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--text-primary);
    font-size: var(--text-sm);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Secondary text inside a grid cell — a terms summary, a hint under a value. */
.ui-cell-muted { font-size: var(--text-xs); color: var(--text-secondary); }

/* ---- Checkbox grid ------------------------------------------------------
   A set of permission or option checkboxes, laid out in columns that reflow. */
.ui-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-2);
    margin-block-start: var(--space-1);
}
.ui-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 400;
}

/* A rail that scrolls independently — a structure tree beside its detail pane. Capped to
   the viewport so the tree scrolls rather than the page, which is what keeps the selected
   node's details in view while browsing a tall building. */
.ui-split-tall .ui-tree-card .ui-card-body {
    overflow: auto;
    max-height: calc(100vh - 220px);
}

/* ---- Meter --------------------------------------------------------------
   A proportion inside a grid cell — sold share per project on the comparison
   table. A bar plus its number: the bar answers "which is ahead" at a glance,
   the number answers "by how much", and neither alone does both. */
.ui-meter { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.ui-meter-bar {
    flex: 1 1 auto;
    height: 6px;
    min-width: 40px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.ui-meter-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
}
.ui-meter-label {
    font-family: var(--font-numeric);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* ---- Global search ------------------------------------------------------
   The header box (SRCH-1..4). It sits on the light top bar, so it is styled as
   a field rather than as chrome on the navy rail. */
.ui-search { position: relative; flex: 1 1 320px; max-width: 460px; min-width: 0; }

.ui-search-field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding-inline: var(--space-3);
    height: 38px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ui-search.is-open .ui-search-field,
.ui-search-field:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: var(--surface);
}
.ui-search-icon { color: var(--text-muted); flex-shrink: 0; }

.ui-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: none;
    outline: none;
    font: inherit;
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.ui-search-input::placeholder { color: var(--text-muted); }

/* The pill wrapper already draws the focus ring (:focus-within above); without this
   the global input:focus-visible rule drew a second ring on the inner box — two
   outlines around one search field. */
.ui-search-input:focus-visible { box-shadow: none; outline: none; }

/* The browser's own clear button duplicates Escape and sits badly in a pill. */
.ui-search-input::-webkit-search-cancel-button { display: none; }

.ui-search-spinner {
    width: 14px; height: 14px; flex-shrink: 0;
    border: 2px solid var(--border-strong);
    border-block-start-color: var(--accent);
    border-radius: 50%;
    animation: ui-spin .7s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

.ui-search-results {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    inset-inline: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 40;
    padding-block: var(--space-2);
}

.ui-search-group {
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-4) var(--space-1);
}

.ui-search-hit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    border: none;
    background: none;
    text-align: start;
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    font: inherit;
}
.ui-search-hit:hover,
.ui-search-hit.is-active { background: var(--accent-soft); }

.ui-search-hit-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.ui-search-hit-sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-search-empty {
    padding: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
}

/* SRCH-4 wants this usable on a phone. Below the tablet break the field takes the
   width it can get and the results drop to a full-width sheet, because a 320px
   dropdown inside a 360px screen is a scrollbar with text in it. */
@media (max-width: 768px) {
    .ui-search { flex: 1 1 auto; max-width: none; }
    .ui-search-results {
        position: fixed;
        inset-block-start: var(--topbar-height);
        inset-inline: 0;
        border-radius: 0;
        max-height: calc(100vh - var(--topbar-height));
    }
}

/* ---- Notification bell (NOTIF-1) ----------------------------------------
   Sits in the top bar beside the theme and language controls, so it reads as part of
   the same row of affordances rather than as a widget dropped on top of one. */
.bell { position: relative; }

.bell-button {
    display: inline-flex; align-items: center; justify-content: center;
    inline-size: 38px; block-size: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
}
.bell-button:hover { color: var(--text-primary); border-color: var(--border-strong); }
.bell-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Coral, not red. An unread count is a thing to look at, not a failure. */
.bell-count {
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
    min-inline-size: 18px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #2B2D42;
    font-size: var(--text-2xs);
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* Above the backdrop, and anchored to the bell's own edge so it mirrors in RTL. */
.bell-panel {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-end: 0;
    inline-size: min(360px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    overflow: hidden;
}

.bell-backdrop { position: fixed; inset: 0; z-index: 55; }

.bell-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-block-end: 1px solid var(--border);
    font-weight: 700;
    color: var(--text-primary);
}
.bell-link { background: none; border: none; cursor: pointer; color: var(--accent); font: inherit; font-size: var(--text-sm); }

.bell-empty { padding: var(--space-4); margin: 0; color: var(--text-secondary); font-size: var(--text-sm); }

.bell-list { list-style: none; margin: 0; padding: 0; max-block-size: 60vh; overflow-y: auto; }
.bell-item {
    display: flex; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-block-end: 1px solid var(--border);
    cursor: pointer;
}
.bell-item:last-child { border-block-end: none; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.is-unread { background: var(--primary-soft); }

.bell-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; margin-block-start: .35rem; flex: 0 0 auto; }
.bell-info { background: var(--secondary); }
.bell-reminder { background: var(--accent); }
.bell-alert { background: var(--danger); }

.bell-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bell-title { font-size: var(--text-sm); color: var(--text-primary); }
.bell-body { font-size: var(--text-xs); color: var(--text-secondary); overflow-wrap: anywhere; }
.bell-when { font-size: var(--text-2xs); color: var(--text-muted); }

.bell-all {
    display: block; text-align: center;
    padding: var(--space-3);
    border-block-start: 1px solid var(--border);
    color: var(--accent);
    font-size: var(--text-sm);
    text-decoration: none;
}
.bell-all:hover { background: var(--surface-2); }

/* ---- Delete confirmation (Components/DeleteConfirmDialog) ------------------------
   What goes, what stays. The warning strip is the only red block: it appears only when
   live contracts or received money are involved, so it means something when it shows. */
.ui-del-head { display: flex; align-items: center; gap: var(--space-3); margin-block-end: var(--space-4); }
.ui-del-icon {
    flex: 0 0 auto; display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--danger-soft); color: var(--danger);
}
.ui-del-name { display: block; font-size: var(--text-md); color: var(--text-primary); overflow-wrap: anywhere; }
.ui-del-sub { display: block; font-size: var(--text-xs); color: var(--text-muted); }
.ui-del-warn {
    display: flex; flex-direction: column; gap: 2px;
    padding: var(--space-3); margin-block-end: var(--space-4);
    border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
    background: var(--danger-soft); color: var(--danger); font-size: var(--text-sm);
}
.ui-del-label {
    display: block; margin-block: var(--space-3) var(--space-2);
    font-size: var(--text-2xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted);
}
.ui-del-list {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.ui-del-list li {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: .55rem .8rem; font-size: var(--text-sm); color: var(--text-primary);
    border-block-start: 1px solid var(--border);
}
.ui-del-list li:first-child { border-block-start: 0; }
.ui-del-list.is-kept { background: var(--surface-2); }
.ui-del-list.is-kept li { color: var(--text-secondary); }
.ui-del-count { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.ui-del-amount { font-size: var(--text-xs); color: var(--text-muted); }
.ui-del-note { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--text-secondary); }
.ui-del-restore { display: flex; align-items: center; gap: 6px; margin-block: var(--space-4) var(--space-2); color: var(--success); font-weight: 600; }

/* Pay / approve dialog: what is being paid, and how much, above the register picker. */
.ui-settle-summary {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-4); margin-block-end: var(--space-4);
    border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
    font-size: var(--text-sm); color: var(--text-secondary);
}
.ui-settle-summary b { font-size: var(--text-lg); color: var(--text-primary); }

/* A total over several currencies (Shared/Ui/MoneyAmounts): one figure per line. */
.ui-money-stack { display: inline-flex; flex-direction: column; gap: 2px; }
.ui-money-sep { color: var(--text-muted); }

/* A small toggle chip (e.g. the currency of a chart). */
.ui-chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: var(--radius-pill); padding: .25rem .7rem; font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer; }
.ui-chip-btn.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }

/* ==== Ledger pages (Suppliers, Expenses) ==================================
   After GreenSchool's accounting pages: four summary cards with a soft tone blob, a
   search + filter toolbar, a quiet table with an identity tile per row, small bordered
   row actions, and dialogs split into boxed sections. Every colour is a token; a card's
   tone is one custom property (--tone) the rest is mixed from. */
.gs-sum-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-block-end: var(--space-4); }
@media (min-width: 1024px) { .gs-sum-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.gs-sum {
    --tone: var(--primary);
    position: relative; overflow: hidden; min-width: 0;
    padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-sm);
}
.gs-sum.is-ok { --tone: var(--success); }
.gs-sum.is-bad { --tone: var(--danger); }
.gs-sum.is-accent { --tone: var(--accent); }
.gs-sum-blob {
    position: absolute; inset-block-start: -20px; inset-inline-end: -20px; width: 72px; height: 72px;
    border-radius: 50%; background: var(--tone); opacity: .12; pointer-events: none;
}
.gs-sum-label {
    margin-block-end: var(--space-2); font-size: var(--text-2xs); font-weight: 700;
    letter-spacing: .07em; text-transform: uppercase; color: var(--tone);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gs-sum-value, .gs-sum-value .ui-money {
    font-family: var(--font-numeric); font-variant-numeric: tabular-nums;
    font-size: clamp(1rem, .8rem + .6vw, 1.25rem); font-weight: 800; line-height: 1.25; letter-spacing: -.01em; color: var(--text-primary);
}
/* Several currencies stack one per line, a touch smaller than the first. */
.gs-sum-value .ui-money + .ui-money, .gs-sum-value br + .ui-money { font-size: .85em; color: var(--text-secondary); }
.gs-sum-rule { margin-block-start: var(--space-3); height: 1px; background: color-mix(in srgb, var(--tone) 22%, transparent); }
.gs-sum-pill {
    display: inline-block; margin-block-start: var(--space-2); padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: var(--text-2xs); font-weight: 700;
    background: color-mix(in srgb, var(--tone) 10%, var(--surface)); color: color-mix(in srgb, var(--tone) 80%, var(--text-primary));
}

/* Toolbar: search, filters, and a clear button that only shows while something is set. */
.gs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block-end: var(--space-3); }
.gs-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.gs-search .ph-icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.gs-input, .gs-select {
    height: 40px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-primary); font: inherit; font-size: var(--text-sm);
    padding-inline: 12px; transition: border-color .15s, box-shadow .15s;
}
.gs-search .gs-input { padding-inline-start: 38px; }
.gs-select { width: auto; min-width: 150px; cursor: pointer; font-size: var(--text-xs); }
.gs-input:hover, .gs-select:hover { border-color: var(--border-strong); }
.gs-input:focus, .gs-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.gs-check-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); cursor: pointer;
}
.gs-clear {
    height: 40px; padding-inline: 14px; border-radius: var(--radius-sm); cursor: pointer; font: inherit;
    font-size: var(--text-xs); font-weight: 700;
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    background: var(--danger-soft); color: var(--danger);
}
@media (max-width: 560px) { .gs-search { max-width: none; flex-basis: 100%; } .gs-select { flex: 1 1 140px; } }

/* Header buttons: dark primary, outlined secondary, square icon button. */
.gs-btn, .gs-btn-ghost, .gs-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px;
    padding-inline: 16px; border-radius: var(--radius-sm); font: inherit; font-size: var(--text-xs);
    font-weight: 700; cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap;
}
.gs-btn { border: 0; background: var(--btn-dark); color: var(--btn-dark-text); }
.gs-btn:hover { background: var(--btn-dark-hover); transform: translateY(-1px); }
.gs-btn-ghost, .gs-icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); }
.gs-btn-ghost:hover, .gs-icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text-primary); }
.gs-icon-btn { width: 36px; padding: 0; }
.gs-btn:disabled, .gs-btn-ghost:disabled { opacity: .5; cursor: default; transform: none; }

/* Table cells. */
.gs-ident { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.gs-ident-tile {
    flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--accent);
}
.gs-ident-tile.is-off { background: var(--surface-3); color: var(--text-muted); }
.gs-ident-tile.is-file { background: var(--primary-soft); color: var(--primary); }
.gs-ident-text { min-width: 0; }
.gs-ident-name { font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-ident-name button { all: unset; cursor: pointer; }
.gs-ident-name button:hover { color: var(--accent); }
.gs-ident-sub { font-family: var(--font-numeric); font-size: var(--text-2xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill);
    font-size: var(--text-2xs); font-weight: 700; background: var(--surface-3); color: var(--text-secondary); white-space: nowrap;
}
.gs-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.gs-pill.is-plain::before { display: none; }
.gs-pill.is-ok { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); }
.gs-pill.is-ok::before { background: var(--success); }
.gs-pill.is-bad { background: var(--danger-soft); color: var(--danger); }
.gs-pill.is-bad::before { background: var(--danger); }
.gs-amt { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-primary); }
.gs-amt-ok, .gs-amt-ok .ui-money { color: var(--success); font-weight: 700; }
.gs-amt-bad, .gs-amt-bad .ui-money { color: var(--danger); font-weight: 800; }
.gs-sub { display: block; font-size: var(--text-2xs); color: var(--text-muted); }

/* Quiet grid header, as on GreenSchool: small uppercase muted labels — on every grid in
   the app (user call, 2026-10-11), with a faint row hover. */
.k-grid .k-grid-header .k-table-th, .k-grid .k-grid-header th {
    font-size: var(--text-2xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted);
}

/* Small bordered row-action buttons. */
.gs-acts { display: inline-flex; gap: 6px; }
.gs-act {
    display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    color: var(--text-secondary); cursor: pointer; font: inherit; font-size: var(--text-2xs); font-weight: 700; transition: all .15s;
}
.gs-act:hover { border-color: var(--border-strong); color: var(--text-primary); }
.gs-act.is-view:hover, .gs-act.is-edit:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.gs-act.is-del { color: var(--danger); }
.gs-act.is-del:hover { border-color: var(--danger); background: var(--danger-soft); }
.gs-act.is-pay { grid-auto-flow: column; gap: 4px; border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 10%, var(--surface)); color: var(--success); }

/* Dialog layout: a two-column grid that becomes one column on a phone, and boxed sections. */
.gs-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.gs-form-grid > .is-wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .gs-form-grid { grid-template-columns: 1fr; } }
.gs-section { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }
.gs-section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-xs); font-weight: 800; color: var(--text-secondary); }

/* Balance strip in the supplier detail: billed / paid / owed. */
.gs-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.gs-strip > div { --tone: var(--text-secondary); padding: var(--space-3); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--tone) 8%, var(--surface)); }
.gs-strip > .is-ok { --tone: var(--success); }
.gs-strip > .is-bad { --tone: var(--danger); }
.gs-strip span { display: block; font-size: var(--text-2xs); font-weight: 700; color: var(--tone); margin-block-end: 4px; }
.gs-strip b, .gs-strip b .ui-money { font-family: var(--font-numeric); font-size: var(--text-lg); font-weight: 800; color: var(--text-primary); }
.gs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); max-height: 46vh; overflow-y: auto; }
.gs-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.gs-list li.is-ok { border-color: color-mix(in srgb, var(--success) 25%, transparent); background: color-mix(in srgb, var(--success) 5%, var(--surface)); }

/* ==== Project card (ProjectCoverCard) =====================================
   After GreenSchool's campus cards. Four banner themes drawn from the brand tones; each
   sets --pc (its accent), --pc-soft (the logo tile) and --pc-on (text on the accent:
   navy on coral, never white — see the palette rules). */
.pcard {
    --pc: var(--primary); --pc-2: var(--secondary); --pc-on: var(--btn-dark-text);
    position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 28px;
    box-shadow: var(--shadow-sm); transition: transform .3s ease, box-shadow .3s ease;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pcard:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pcard-t1 { --pc: var(--accent); --pc-2: var(--ramp-rented); --pc-on: var(--primary); }
.pcard-t2 { --pc: var(--success); --pc-2: var(--primary); }
.pcard-t3 { --pc: var(--ramp-rented); --pc-2: var(--ramp-sold); }

.pcard-banner {
    position: relative; height: 110px; flex-shrink: 0; overflow: hidden;
    background: linear-gradient(135deg, var(--pc), var(--pc-2));
}
.pcard-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.pcard:hover .pcard-photo { transform: scale(1.04); }
.pcard-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(15,23,42,.35)); }
.pcard-blob { position: absolute; border-radius: 50%; pointer-events: none; }
.pcard-blob-a { width: 112px; height: 112px; inset-block-start: -32px; inset-inline-start: -32px; background: rgba(255,255,255,.12); }
.pcard-blob-b { width: 64px; height: 64px; inset-block-start: 16px; inset-inline-end: 16px; background: rgba(255,255,255,.12); }
.pcard-blob-c { width: 80px; height: 80px; inset-block-end: -24px; inset-inline-end: 40px; background: rgba(0,0,0,.1); }
.pcard-chip {
    position: absolute; inset-block-start: 12px; display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--radius-pill); background: rgba(255,255,255,.92);
    box-shadow: var(--shadow-sm); backdrop-filter: blur(4px);
    font-size: 10.5px; font-weight: 700; color: var(--primary); max-width: 60%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard-chip-start { inset-inline-start: 12px; }
.pcard-chip-end { inset-inline-end: 12px; }
.pcard-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pc); flex-shrink: 0; }

.pcard-logo-wrap { position: relative; padding-inline: 20px; }
.pcard-logo {
    margin-block-start: -28px; width: 56px; height: 56px; display: grid; place-items: center;
    border-radius: 18px; border: 3px solid var(--surface);
    background: color-mix(in srgb, var(--pc) 14%, var(--surface)); color: var(--pc);
    box-shadow: var(--shadow-md); font-size: 22px; font-weight: 800;
}

.pcard-body { display: flex; flex: 1; flex-direction: column; gap: 16px; padding: 10px 20px 20px; }
.pcard-name { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.35; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pcard-stats {
    display: flex; align-items: center; justify-content: space-between; padding: 10px 8px;
    border: 1px solid var(--surface-3); border-radius: 16px; background: var(--surface-2);
}
.pcard-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.pcard-stat-value { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 900; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pcard-stat-value .ph-icon { color: var(--pc); }
.pcard-stat-label { font-size: 9.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.pcard-stat-sep { width: 1px; height: 32px; background: var(--border); }

.pcard-foot { margin-block-start: auto; display: flex; align-items: center; gap: 8px; }
.pcard-open {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; border: 0; border-radius: 16px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
    background: var(--pc); color: var(--pc-on); box-shadow: var(--shadow-sm); transition: transform .15s, filter .15s;
}
.pcard-open:hover { transform: scale(1.02); filter: brightness(1.05); }
.pcard-open:active { transform: scale(.97); }
.pcard-icon-btn {
    flex-shrink: 0; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text-secondary);
    box-shadow: var(--shadow-sm); transition: all .15s;
}
.pcard-icon-btn:hover { transform: scale(1.05); border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.pcard-icon-btn.is-danger:hover { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.k-grid .k-table-tbody .k-table-row:hover, .k-grid tbody tr:hover { background: var(--surface-2); }

/* GreenSchool's buttons lift a pixel on hover and settle on press. */
.k-button-solid-primary, .k-button-solid-base { transition: transform .15s ease, background-color .15s ease, border-color .15s ease; }
.k-button-solid-primary:hover, .k-button-solid-base:hover { transform: translateY(-1px); }
.k-button-solid-primary:active, .k-button-solid-base:active { transform: translateY(0); }
.gs-section-title a { color: var(--accent); text-decoration: none; font-weight: 700; }
.gs-section-title a:hover { text-decoration: underline; }

/* ==== Invoice scanner crop stage (doc-scanner.js draws into it) ==== */
.scan-stage { display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; }
.scan-stage-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; pointer-events: none; }
.scan-stage-svg { position: absolute; pointer-events: none; overflow: visible; }
.scan-stage-svg polygon { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.scan-handle {
    position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
    background: var(--surface); border: 4px solid var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.45);
    touch-action: none; cursor: grab;
}
.scan-handle::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; } /* a bigger finger target */
.scan-handle.is-dragging { cursor: grabbing; transform: scale(1.25); }

/* SheetDialog body: the grid gap spaces the fields, so the old stacked-form margins go. */
.sheet-body .form-field { margin: 0; }
.sheet-body .form-field > label, .sheet-body .ui-field-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary); margin-block-end: 6px; }
.sheet-body .k-input, .sheet-body .k-picker { min-height: 42px; }

/* 3D viewer: time-of-day and effects chips over the model (M2). Frosted so the sky shows
   through; coral marks the preset in use, the same as an active tab. Labels hide on a phone
   and the icons carry it. */
.mv-sky { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-md); z-index: 2; }
.mv-sky-chip { appearance: none; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 0.7rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 999px; cursor: pointer; transition: background .15s ease; }
.mv-sky-chip:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mv-sky-chip.on { background: var(--accent); color: var(--accent-on); }
.mv-sky-sep { width: 1px; height: 16px; background: var(--border); margin: 0 2px; }
@media (max-width: 640px) { .mv-sky-text { display: none; } .mv-sky-chip { padding: 6px 8px; } }

/* 3D viewer: the real-sun slider (time, date) under the time-of-day chips. The thumb is the
   sun by day and the moon by night; the track is the day's sky from the real sunrise/sunset. */
.mv-sun { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 16px; z-index: 2;
    background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-md);
    max-width: calc(100% - 1rem); flex-wrap: wrap; }
.mv-sun-play { appearance: none; border: 1px solid var(--border); background: transparent; color: var(--text-primary); width: 30px; height: 30px;
    border-radius: 50%; font-size: 0.7rem; cursor: pointer; flex: none; }
.mv-sun-play.on { background: var(--accent); color: var(--accent-on); border-color: transparent; }
.mv-sun-main { display: grid; gap: 2px; width: 220px; min-width: 0; flex: 1 1 160px; }
.mv-sun-read { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.68rem; color: var(--text-secondary); white-space: nowrap; }
.mv-sun-read b { font-size: 0.82rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mv-sun-read span { overflow: hidden; text-overflow: ellipsis; }
.mv-sun-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; margin: 4px 0; border-radius: 999px; background: var(--sun-track); cursor: pointer; }
.mv-sun-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--sun-knob);
    border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border), 0 0 12px var(--sun-knob); }
.mv-sun-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--sun-knob); border: 2px solid var(--surface); box-shadow: 0 0 12px var(--sun-knob); }
.mv-sun-range.night::-webkit-slider-thumb { background: var(--sun-moon); box-shadow: 0 0 0 1px var(--border), 0 0 10px var(--sun-moon); }
.mv-sun-range.night::-moz-range-thumb { background: var(--sun-moon); }
.mv-sun-dates { display: flex; gap: 2px; flex-wrap: wrap; }
.mv-sun-date { appearance: none; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 0.66rem; font-weight: 700;
    padding: 4px 7px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.mv-sun-date:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mv-sun-date.on { background: var(--accent); color: var(--accent-on); }
@media (max-width: 640px) { .mv-sun-main { flex-basis: 100%; order: 2; } .mv-sun-dates { flex: 1; } }

/* ==========================================================================
   3D viewer (M2): labels over the model, tooltip, side panel, amenity bar,
   edit tools. The stage is the model; everything on it is frosted and small
   so the building stays the picture. Colours from tokens only.
   ========================================================================== */
.mv-stage { background: var(--surface-2); isolation: isolate; }
.mv-labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* The renderer places each label with a translate in physical pixels from the top-left. In
   an RTL page an absolute element with no left starts from the RIGHT edge, which put every
   label a viewer-width off to the side - so the anchor is physical here, not logical. */
.mv-labels > * { pointer-events: auto; left: 0; top: 0; }
.mv-pill-text { unicode-bidi: plaintext; }

/* Tower pill: icon in a dark disc, name beside it (reference 05). */
.mv-pill { appearance: none; border: 0; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 11px 3px 3px; border-radius: var(--radius-pill); white-space: nowrap;
    background: color-mix(in srgb, var(--primary) 78%, transparent); color: #fff; backdrop-filter: blur(8px);
    box-shadow: 0 6px 18px rgba(0,0,0,.28); font-size: .72rem; font-weight: 700; transform: translateY(-50%);
    transition: opacity .2s ease, transform .2s ease; }
.mv-pill:hover { background: var(--primary); transform: translateY(-50%) scale(1.04); }
.mv-pill .mv-pill-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); font-size: .8rem; }
/* Amenity pin: the icon alone, the name on hover. */
.mv-pin { appearance: none; border: 2px solid #fff; font: inherit; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; padding: 0;
    display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 80%, transparent); color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.3); font-size: .85rem; transition: opacity .2s ease, transform .15s ease; }
.mv-pin .mv-pill-text { display: none; }
.mv-pin:hover { transform: scale(1.12); }
/* Behind the building from where the camera stands: still findable, no longer shouting. */
.mv-pill.occluded, .mv-pin.occluded { opacity: .28; }

/* Floor stack: numbered discs down the tower (reference 06). */
.mv-floor { appearance: none; border: 1.5px solid rgba(255,255,255,.85); font: inherit; cursor: pointer; min-width: 26px; height: 22px; padding: 0 6px;
    border-radius: var(--radius-pill); background: color-mix(in srgb, var(--primary) 82%, transparent); color: #fff;
    font-family: var(--font-numeric); font-size: .66rem; font-weight: 700; box-shadow: 0 3px 10px rgba(0,0,0,.28);
    transition: transform .12s ease, background .12s ease; }
.mv-floor:hover { transform: scale(1.12); }
.mv-floor.on { background: var(--accent); color: var(--accent-on); border-color: var(--accent); transform: scale(1.18); }

/* Hover tooltip. */
.mv-tip { position: absolute; z-index: 3; display: none; flex-direction: column; gap: 2px; pointer-events: none; max-width: 220px;
    padding: 7px 10px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 90%, transparent); color: #fff;
    box-shadow: 0 8px 22px rgba(0,0,0,.3); font-size: .72rem; line-height: 1.3; }
.mv-tip b { font-size: .86rem; font-family: var(--font-numeric); }
.mv-tip span { opacity: .85; }
.mv-tip-status { font-style: normal; align-self: flex-start; margin-top: 3px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: .64rem; font-weight: 800; }
.mv-tip-status.s-available { background: var(--status-available-bg); color: var(--status-available-ink); }
.mv-tip-status.s-reserved  { background: var(--status-reserved-bg);  color: var(--status-reserved-ink); }
.mv-tip-status.s-rented    { background: var(--status-rented-bg);    color: var(--status-rented-ink); }
.mv-tip-status.s-sold      { background: var(--status-sold-bg);      color: var(--status-sold-ink); }

/* Toolbar buttons above the stage. */
.mv-tool { appearance: none; font: inherit; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--text-primary);
    border-radius: var(--radius-pill); padding: 5px 12px; font-size: .74rem; font-weight: 600; transition: background .15s ease, border-color .15s ease; }
.mv-tool:hover { border-color: var(--accent); }
.mv-tool.on { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.mv-tool.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.mv-tool:disabled { opacity: .5; cursor: default; }
.mv-home { z-index: 2; appearance: none; border: 0; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; font-size: 1.05rem;
    background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-md); color: var(--text-primary); }
.mv-legend { z-index: 2; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); }

/* Amenity bar (reference 04): round thumbnails, names under them, frosted strip. */
.mv-amenities { position: absolute; z-index: 2; inset-inline: 10px; bottom: 10px; display: flex; gap: 6px; justify-content: center;
    padding: 8px 10px; border-radius: 18px; overflow-x: auto; scrollbar-width: none;
    background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(14px); box-shadow: var(--shadow-md); }
.mv-amenities::-webkit-scrollbar { display: none; }
.mv-amenity { appearance: none; border: 0; background: transparent; font: inherit; cursor: pointer; flex: 0 0 auto; width: 76px;
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px; border-radius: 12px; color: var(--text-primary); }
.mv-amenity-art { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 1.35rem;
    background: var(--surface); box-shadow: 0 2px 8px rgba(15,23,42,.14); border: 2px solid transparent; transition: border-color .15s ease, transform .15s ease; }
.mv-amenity-art img { width: 100%; height: 100%; object-fit: cover; }
.mv-amenity-text { font-size: .64rem; font-weight: 600; text-align: center; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-amenity:hover .mv-amenity-art { transform: translateY(-2px); }
.mv-amenity.on .mv-amenity-art { border-color: var(--accent); }

/* Side panel (references 02/03): slides in from the inline end; a bottom sheet on a phone. */
.mv-panel { position: absolute; z-index: 4; inset-block: 10px; inset-inline-end: 10px; width: min(340px, calc(100% - 20px));
    display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg);
    animation: mv-panel-in .28s cubic-bezier(.2,.8,.2,1); }
@keyframes mv-panel-in { from { transform: translateX(12%); opacity: 0; } to { transform: none; opacity: 1; } }
[dir="rtl"] .mv-panel { animation-name: mv-panel-in-rtl; }
@keyframes mv-panel-in-rtl { from { transform: translateX(-12%); opacity: 0; } to { transform: none; opacity: 1; } }
.mv-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.mv-panel-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }
.mv-panel-sub { margin: 2px 0 0; font-size: .74rem; color: var(--text-secondary); }
.mv-panel-x { appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: var(--surface-2); color: var(--text-primary); }
.mv-panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.mv-panel-hero { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.mv-panel-hero img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.mv-hero-nav { position: absolute; top: 50%; transform: translateY(-50%); appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 85%, transparent); box-shadow: var(--shadow-sm); font-size: 1.1rem; color: var(--text-primary); }
.mv-hero-nav.prev { inset-inline-start: 6px; }
.mv-hero-nav.next { inset-inline-end: 6px; }
.mv-hero-count { position: absolute; bottom: 6px; inset-inline-end: 8px; font-size: .64rem; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--primary) 70%, transparent); color: #fff; }
.mv-panel-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mv-panel-type { font-size: .76rem; font-weight: 600; color: var(--text-secondary); }
.mv-panel-price { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.mv-panel-price > span { font-size: .72rem; font-weight: 600; color: var(--text-secondary); }
.mv-panel-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.mv-panel-empty { margin: 0; font-size: .8rem; color: var(--text-secondary); text-align: center; padding: 18px 0; }
.mv-btn { appearance: none; flex: 1; font: inherit; cursor: pointer; border-radius: 11px; padding: 10px 12px; font-size: .8rem; font-weight: 700;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); }
/* Primary on a light surface is navy (see CLAUDE.md: coral text sits on navy, never white on coral). */
.mv-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Floor list. */
.mv-floor-counts { display: flex; flex-wrap: wrap; gap: 10px; font-size: .7rem; font-weight: 600; color: var(--text-secondary); }
.mv-floor-counts span { display: inline-flex; align-items: center; gap: 4px; }
.mv-floor-counts i, .mv-floor-list i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.mv-floor-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mv-floor-list button { appearance: none; width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; cursor: pointer; text-align: start;
    padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font-size: .8rem; }
.mv-floor-list button:hover { border-color: var(--accent); }
.mv-floor-list b { font-family: var(--font-numeric); }
.mv-floor-list span { color: var(--text-secondary); font-size: .72rem; }

/* Edit mode. */
.mv-edit-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.mv-edit-tabs button { appearance: none; border: 0; background: transparent; font: inherit; cursor: pointer; padding: 8px 12px; font-size: .78rem; font-weight: 600;
    color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.mv-edit-tabs button.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.mv-input { display: block; width: 100%; margin-top: 3px; font: inherit; font-size: .8rem; padding: 6px 9px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); }

@media (max-width: 640px) {
    .mv-panel { inset-block: auto 0; inset-inline: 0; width: auto; max-height: 72%; border-radius: 16px 16px 0 0; animation-name: mv-sheet-in; }
    [dir="rtl"] .mv-panel { animation-name: mv-sheet-in; }
    @keyframes mv-sheet-in { from { transform: translateY(14%); opacity: 0; } to { transform: none; opacity: 1; } }
    .mv-amenities { justify-content: flex-start; inset-inline: 6px; bottom: 6px; }
    .mv-amenity { width: 64px; }
    .mv-amenity-art { width: 40px; height: 40px; font-size: 1.15rem; }
    .mv-pill { font-size: .66rem; }
}

/* ---- FeatureGate (P1) ---------------------------------------------------
   A feature the plan does not include. Shown, not hidden: the locked tile is
   what makes somebody ask for the upgrade. Coral is the selection colour, so
   the mark is muted and only the link carries the accent. */
.ui-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-7) var(--space-5);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
}
.ui-locked-mark {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--secondary);
    margin-block-end: var(--space-4);
}
.ui-locked-title { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); margin: 0; }
.ui-locked-text { font-size: var(--text-sm); margin: var(--space-2) 0 0; max-width: 46ch; }
.ui-locked-action {
    margin-block-start: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.ui-locked-action:hover { text-decoration: underline; }

.ui-locked-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.ui-locked-chip:hover { color: var(--text-primary); border-color: var(--secondary); }
.ui-locked-plan {
    padding: 0 0.4rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-primary);
}

/* Usage bars on Plan & usage. */
.ui-usage { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ui-usage-row { display: flex; flex-direction: column; gap: var(--space-2); }
.ui-usage-head { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.ui-usage-head strong { color: var(--text-primary); }
.ui-usage-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.ui-usage-fill { height: 100%; border-radius: inherit; background: var(--primary); }
.ui-usage-fill.near { background: var(--accent); }
.ui-usage-fill.full { background: var(--danger); }

.ui-feature-list { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ui-feature-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: var(--text-sm); color: var(--text-primary);
}
.ui-feature-item.off { color: var(--text-secondary); border-style: dashed; }
.ui-feature-item .ui-feature-state { margin-inline-start: auto; font-size: var(--text-xs); }
.ui-feature-item .on-mark { color: var(--success); }


/* ---- 3D pipeline (M3) ---------------------------------------------------- */
.mv-upload { position: relative; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.mv-upload input[type=file], label.mv-tool input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
label.mv-tool { position: relative; display: inline-flex; align-items: center; }
.mv-tool.danger { color: var(--danger); }
.mv-tool.danger:hover { border-color: var(--danger); }
.mv-worker {
    display: inline-flex; align-items: center; gap: 0.35rem; margin-top: var(--space-1);
    font-size: var(--text-xs); color: var(--text-secondary);
}
.mv-worker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); }
.mv-worker.on::before { background: var(--success); }
.mv-version {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3);
    align-items: center; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface);
}
.mv-version.published { border-color: var(--accent); }
.mv-version-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mv-version-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-version-state { display: flex; align-items: center; gap: var(--space-2); }
.mv-version-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mv-version-error { grid-column: 1 / -1; margin: 0; font-size: var(--text-xs); color: var(--danger); }
.mv-score {
    min-width: 2.2rem; text-align: center; padding: 0.1rem 0.45rem; border-radius: var(--radius-pill);
    font-size: var(--text-xs); font-weight: 700; background: var(--surface-2); color: var(--text-primary);
}
.mv-score.good { background: var(--success); color: var(--surface); }
.mv-score.poor { background: var(--danger); color: var(--surface); }
.mv-report-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin: var(--space-3) 0; }
.mv-report-table th, .mv-report-table td { text-align: start; padding: var(--space-2); border-bottom: 1px solid var(--border); }
.mv-report-table th { color: var(--text-secondary); font-weight: 600; }
.mv-report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: var(--text-sm); }
.mv-report-list li { display: flex; gap: var(--space-2); align-items: baseline; color: var(--text-primary); }
.mv-report-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); transform: translateY(-1px); }
.mv-report-list li.error .mv-report-dot { background: var(--danger); }
.mv-report-list li.warning .mv-report-dot { background: var(--accent); }
.mv-report-list li.done .mv-report-dot { background: var(--success); }
@media (max-width: 640px) {
    .mv-version { grid-template-columns: 1fr; }
}

/* ---- export progress window (Shared/Ui/ExportProgressWindow) ----
   Above every dialog. The spinner and the busy stripe animate transform only, which the
   browser draws on its own thread: they keep moving while the page is busy writing a file. */
.xp-backdrop {
    position: fixed; inset: 0; z-index: 30000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: color-mix(in srgb, var(--primary) 45%, transparent);
    backdrop-filter: blur(2px);
    animation: ph-fade .15s ease-out;
}
.xp-card {
    width: min(420px, 100%);
    background: var(--surface); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 20px;
}
.xp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.xp-title { font-weight: 800; font-size: var(--text-md); }
.xp-sub { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }
.xp-spinner {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
    border: 3px solid var(--surface-3); border-block-start-color: var(--accent);
    animation: ui-spin .8s linear infinite; will-change: transform;
}
.xp-bar {
    position: relative; height: 8px; overflow: hidden;
    border-radius: var(--radius-pill); background: var(--surface-3);
}
.xp-bar > span {
    display: block; height: 100%; border-radius: inherit; background: var(--accent);
    transition: width .25s ease;
}
/* Creating the file is one step with no count inside it: a stripe runs along the bar instead. */
.xp-bar.is-busy::after {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 35%;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
    animation: xp-stripe 1.1s linear infinite; will-change: transform;
}
@keyframes xp-stripe { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
[dir="rtl"] .xp-bar.is-busy::after { animation-name: xp-stripe-rtl; }
@keyframes xp-stripe-rtl { from { transform: translateX(100%); } to { transform: translateX(-300%); } }
.xp-steps { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.xp-steps li { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--text-muted); }
.xp-steps li.is-now { color: var(--text-primary); font-weight: 700; }
.xp-steps li.is-done { color: var(--text-secondary); }
.xp-dot {
    width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900;
    border: 2px solid var(--border-strong); background: var(--surface);
}
.xp-steps li.is-now .xp-dot { border-color: var(--accent); background: var(--accent-soft); }
.xp-steps li.is-done .xp-dot { border-color: var(--success); background: var(--success); color: var(--surface); }
.xp-percent { margin-inline-start: auto; font-weight: 800; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-numeric, inherit); }
.xp-done-mark {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--success); color: var(--surface); font-size: 18px; font-weight: 900;
    animation: ph-fade .2s ease-out;
}
.xp-card.is-done .xp-title { color: var(--success); }
.xp-bar.is-done > span { background: var(--success); }
.xp-count { font-family: var(--font-numeric, inherit); font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; }
