/*
 * DoorSuper components (#60, #61; direction D "Front office" since #90). Every value comes
 * from tokens.css. Every class starts with "ds-" and nothing here styles a bare element
 * outside .ds. The Owner Screen, the Staff screen, the apply page and the public pages are built from these
 * and nothing else; the gallery at /owner/ui/gallery.html shows each component in both themes.
 *
 * The look: an off-white page, white panels with a hairline edge and 12px corners, one harbor
 * blue for the main action, links and the current nav item, brick for owed, green with a check
 * for paid up, amber with a clock and a dashed edge for a Reported Payment. The only shadows
 * are on decisions (an approval, an urgent task) and sheets.
 */

/* ---------- base: only inside .ds */

.ds { font-family: var(--font-ui); font-size: var(--type-md); line-height: var(--type-md-lh); color: var(--color-ink); background-color: var(--color-bg); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
.ds *, .ds *::before, .ds *::after, .ds-sheet, .ds-sheet *, .ds-toast-region * { box-sizing: border-box; }
:where(.ds) p { margin: 0; } /* zero specificity, so a component's own margin wins */
.ds [hidden] { display: none !important; }
body.ds { margin: 0; }
.ds a { color: var(--color-link); text-underline-offset: 3px; }
.ds :focus-visible, .ds-sheet :focus-visible, .ds-toast-region :focus-visible { outline: var(--focus-width) solid var(--focus-ring, var(--color-focus)); outline-offset: var(--focus-offset); }

/* Figures are Figtree's own, tabular so columns of money line up. */
.ds-num { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.ds-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.ds-icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ds-skip { position: absolute; left: -999px; top: 0; z-index: var(--layer-dialog); padding: var(--space-2) var(--space-3); background: var(--color-surface); color: var(--color-ink); border-radius: var(--radius-control); box-shadow: var(--elevation-raised); }
.ds-skip:focus { left: var(--space-2); top: var(--space-2); }

/* Headings: the page heading at 600, section labels small, muted and in capitals. */
.ds-h1 { margin: 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-2xl); line-height: var(--type-2xl-lh); letter-spacing: var(--track-tight); }
.ds-h2 { margin: 0; font-family: var(--font-ui); font-weight: var(--weight-bold); font-size: var(--type-xs); line-height: var(--type-xs-lh); text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--color-muted); }
.ds-h3 { margin: 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-lg); line-height: var(--type-lg-lh); }
.ds-muted { color: var(--color-muted); }
.ds-small { font-size: var(--type-sm); line-height: var(--type-sm-lh); }

/* ---------- wordmark: the door glyph in harbor blue, then the name */

.ds-wordmark, .ds a.ds-wordmark { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--color-on-bar); text-decoration: none; }
.ds-wordmark-mark { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-head); font-weight: var(--weight-bold); font-size: var(--type-wordmark); line-height: 1; letter-spacing: -0.01em; color: var(--color-on-bar); }
.ds-wordmark-glyph { width: 22px; height: 22px; flex: none; color: var(--color-primary); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ds-wordmark-glyph .is-fill { fill: currentColor; stroke: none; }

/* ---------- top bar (a phone; above the content when there's no rail) */

.ds-bar {
  --focus-ring: var(--color-bar-focus);
  position: sticky; top: 0; z-index: var(--layer-bar);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: var(--bar-height); padding: 0 var(--gutter); padding-top: env(safe-area-inset-top);
  background: var(--color-bar); color: var(--color-on-bar); border-bottom: var(--rule-width) solid var(--color-rule);
}
/* The account button: the Account's name in a quiet outlined box. */
.ds-bar-action {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-3);
  border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-control); background: none;
  color: var(--color-on-bar); font: inherit; font-size: var(--type-sm); font-weight: var(--weight-semibold); cursor: pointer;
}
.ds-bar-action:hover { background: var(--color-hover); }
.ds-bar-action::after { content: ""; width: 6px; height: 6px; margin-top: -3px; border-right: 1.5px solid var(--color-on-bar-muted); border-bottom: 1.5px solid var(--color-on-bar-muted); transform: rotate(45deg); }
.ds-bar-end { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.ds-bar-end .ds-bar-action { min-width: 0; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tabs: a bottom bar on a phone, a left rail inside a wide .ds-app.
   Each tab is its label, or an icon over its label (.ds-icon first), with an optional .ds-count. */

.ds-tabs {
  --focus-ring: var(--color-bar-focus);
  position: sticky; bottom: 0; z-index: var(--layer-bar);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--color-bar); border-top: var(--rule-width) solid var(--color-rule); padding-bottom: env(safe-area-inset-bottom);
}
.ds-tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tab-height); padding: 0 var(--space-1);
  color: var(--color-on-bar-muted); text-decoration: none; text-align: center; font-size: var(--type-tab); font-weight: var(--weight-semibold); line-height: 1.15; letter-spacing: 0.01em;
}
.ds-tabs a:hover { color: var(--color-on-bar); }
.ds-tabs a[aria-current="page"] { color: var(--color-link); }
.ds-tabs a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--color-primary); }
.ds-tabs .ds-icon { width: 22px; height: 22px; }
.ds-tabs a:has(> .ds-icon) .ds-count { position: absolute; top: 5px; left: calc(50% + 6px); }

/* A count: unread texts, things waiting. Harbor blue, round. */
.ds-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-primary); color: var(--color-on-primary); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--type-count); font-weight: var(--weight-bold); line-height: 1; }

.ds-app { container-type: inline-size; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ds-frame { flex: 1; display: flex; flex-direction: column-reverse; }
.ds-main { flex: 1; min-width: 0; padding: var(--space-5) var(--gutter) var(--space-8); }
.ds-main:focus { outline: none; }
/* A page heading takes focus from script so screen readers hear the new page; it isn't a control, so no ring. */
.ds [tabindex="-1"]:focus { outline: none; }
@container (min-width: 880px) {
  .ds-bar { padding: 0 var(--space-6); }
  .ds-frame { flex-direction: row; align-items: flex-start; }
  .ds-frame > .ds-tabs {
    position: sticky; top: var(--bar-height); bottom: auto; grid-auto-flow: row; grid-auto-columns: auto; align-content: start; gap: 2px;
    width: var(--rail-width); flex: none; min-height: calc(100vh - var(--bar-height)); padding: var(--space-5) var(--space-3);
    border-top: 0; border-right: var(--rule-width) solid var(--color-rule);
  }
  .ds-main { padding: var(--space-8) var(--space-10) var(--space-12); max-width: 1240px; }
}
/* The rail's items, in the old frame and in .ds-rail alike. */
@container (min-width: 880px) {
  .ds-frame > .ds-tabs a, .ds-nav a {
    flex-direction: row; justify-content: flex-start; gap: var(--space-3); min-height: var(--tap-min); padding: 0 var(--space-3);
    border-radius: var(--radius-control); color: var(--color-on-bar); font-size: var(--type-btn); font-weight: var(--weight-medium); letter-spacing: 0;
  }
  .ds-frame > .ds-tabs a:hover, .ds-nav a:hover { background: var(--color-hover); }
  .ds-frame > .ds-tabs a[aria-current="page"], .ds-nav a[aria-current="page"] { background: var(--color-accent-soft); color: var(--color-link); font-weight: var(--weight-semibold); }
  .ds-frame > .ds-tabs a[aria-current="page"]::before { content: none; }
  .ds-frame > .ds-tabs .ds-icon, .ds-nav .ds-icon { width: 20px; height: 20px; color: var(--color-on-bar-muted); }
  .ds-frame > .ds-tabs a[aria-current="page"] .ds-icon, .ds-nav a[aria-current="page"] .ds-icon { color: var(--color-link); }
  .ds-frame > .ds-tabs .ds-count, .ds-frame > .ds-tabs a:has(> .ds-icon) .ds-count, .ds-nav .ds-count { position: static; margin-left: auto; }
}

/* ---------- the D shell (#89): a left rail at 880px and up, top and bottom bars on a phone.
   <div class="ds-app"><div class="ds-shell">
     <aside class="ds-rail">wordmark, .ds-acct, <nav class="ds-nav">, .ds-rail-foot</aside>
     <header class="ds-bar">...</header> <main class="ds-main">...</main> <nav class="ds-tabs">...</nav>
   </div></div> */

.ds-shell { flex: 1; display: flex; flex-direction: column; }
.ds-shell > .ds-main { flex: 1; }
.ds-rail { display: none; }
.ds-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ds-nav a { position: relative; display: flex; align-items: center; text-decoration: none; }
@container (min-width: 880px) {
  .ds-shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); align-items: start; }
  .ds-shell > .ds-bar, .ds-shell > .ds-tabs { display: none; }
  .ds-rail {
    --focus-ring: var(--color-bar-focus);
    position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--space-2); height: 100vh; height: 100dvh; overflow-y: auto;
    padding: var(--space-5) var(--space-3) var(--space-4); background: var(--color-bar); color: var(--color-on-bar); border-right: var(--rule-width) solid var(--color-rule);
  }
  .ds-rail > .ds-wordmark { padding: 0 var(--space-3) var(--space-2); }
}
/* The Account card: its name and texting number. A button that opens the account menu. */
.ds-acct {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: var(--tap-min); margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3);
  background: var(--color-sunk); color: var(--color-on-bar); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-control);
  font: inherit; text-align: left; cursor: pointer;
}
.ds-acct:hover { background: var(--color-hover); }
.ds-acct-name { font-weight: var(--weight-semibold); font-size: var(--type-btn); line-height: 1.3; }
.ds-acct-num { color: var(--color-on-bar-muted); font-size: var(--type-xs); line-height: var(--type-xs-lh); }
.ds-rail-foot { display: flex; flex-direction: column; margin-top: auto; padding: var(--space-3); border-top: var(--rule-width) solid var(--color-rule); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-rail-foot strong { font-weight: var(--weight-semibold); }
.ds-rail-foot .ds-muted { font-size: var(--type-xs); }

/* ---------- page head and summary */

.ds-page-head { margin-bottom: var(--space-5); }
.ds-page-head.has-action { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-3); }
@container (max-width: 879px) { .ds-page-head.has-action > .ds-btn { width: 100%; } }
.ds-summary { margin-top: var(--space-1); display: flex; flex-wrap: wrap; gap: 0 var(--space-2); align-items: baseline; color: var(--color-muted); font-size: var(--type-md); line-height: var(--type-md-lh); }
.ds-summary .ds-num { color: var(--color-ink); font-weight: var(--weight-semibold); font-size: var(--type-lg); }
.ds-summary .is-owed, .ds-summary .ds-num.is-owed { color: var(--color-owed); }
.ds-section { margin-top: var(--space-8); }
.ds-section > .ds-h2 { margin-bottom: var(--space-3); }
.ds-callout { display: flex; gap: var(--space-3); align-items: flex-start; margin-top: var(--space-5); padding: var(--space-3) var(--space-4); background: var(--color-sunk); border-radius: var(--radius-control); font-size: var(--type-btn); }
.ds-callout .ds-icon { margin-top: 2px; color: var(--color-reported); }
.ds-callout a { font-weight: var(--weight-semibold); }
.ds-callout-body { flex: 1; min-width: 0; }
.ds-callout-body > p { margin: 0; }
.ds-callout .ds-actions { margin-top: var(--space-2); }

/* ---------- list rows: a white panel of divided rows */

.ds-list { list-style: none; margin: 0; padding: 0; background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); overflow: hidden; }
.ds-list > li + li { border-top: var(--rule-width) solid var(--color-rule); }
.ds-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title end" "sub end" "note note";
  column-gap: var(--space-3); align-items: baseline; min-height: var(--row-min); padding: var(--space-3) var(--space-4);
  color: inherit; text-decoration: none;
}
.ds a.ds-row { color: inherit; text-decoration: none; }
a.ds-row:hover { background: var(--color-hover); }
.ds-list .ds-row:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.ds-row-title { grid-area: title; font-weight: var(--weight-semibold); }
.ds-row-sub { grid-area: sub; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-row-note { grid-area: note; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: baseline; margin-top: 2px; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-row-end { grid-area: end; align-self: center; justify-self: end; text-align: right; }
/* A line of actions under a row, inside its list item: the Staff waitlist's sign-up link (#109). */
.ds-row-after { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; margin: calc(-1 * var(--space-2)) 0 0; padding: 0 var(--space-4) var(--space-3); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-row-after > p { margin: 0; flex-basis: 100%; overflow-wrap: anywhere; }
.ds-row-after > .ds-btn.is-quiet { padding-inline: 0; }
.ds-row.is-owed { box-shadow: inset 3px 0 0 var(--color-owed); }
.ds-row.is-compact { grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; grid-template-areas: "title sub end" "note note note"; align-items: center; }
/* A list inside a decision, a fold or a sheet is plain divided rows: no panel in a panel. */
.ds-list.is-plain, .ds-block .ds-list, .ds-urgent .ds-list, .ds-reported .ds-list, .ds-disclosure-body .ds-list, .ds-sheet .ds-list, .ds-property .ds-list { background: none; border: 0; border-radius: 0; overflow: visible; }
.ds-list.is-plain .ds-row, .ds-block .ds-row, .ds-urgent .ds-row, .ds-reported .ds-row, .ds-disclosure-body .ds-row, .ds-sheet .ds-row { padding-left: 0; padding-right: 0; }

/* An amount with its word: "$925.00 owed", "$25.00 credit", "Paid up". The word carries the meaning. */
.ds-amount { white-space: nowrap; font-size: var(--type-btn); }
.ds-amount .ds-num { font-weight: var(--weight-semibold); }
.ds-amount-word { font-family: var(--font-ui); font-weight: var(--weight-regular); }
.ds-amount.is-owed { color: var(--color-owed); }
.ds-amount.is-paid { display: inline-flex; gap: var(--space-1); align-items: center; color: var(--color-paid); font-weight: var(--weight-semibold); }
.ds-amount.is-paid .ds-icon { width: 16px; height: 16px; }
.ds-amount.is-quiet { color: var(--color-muted); }

/* ---------- Balance header */

.ds-balance-where { color: var(--color-muted); font-size: var(--type-btn); font-weight: var(--weight-medium); }
.ds-balance .ds-h1 { margin-top: 2px; }
.ds-balance-amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); margin-top: var(--space-3); font-size: var(--type-balance-word); line-height: var(--type-lg-lh); font-weight: var(--weight-semibold); }
.ds-balance-amount .ds-num { font-size: var(--type-display); line-height: var(--type-display-lh); font-weight: var(--weight-semibold); letter-spacing: -0.02em; }
.ds-balance-amount.is-owed { color: var(--color-owed); }
.ds-balance-amount.is-credit { color: var(--color-ink); }
.ds-balance-amount.is-paid { color: var(--color-paid); }
.ds-balance-amount.is-paid .ds-icon { width: 32px; height: 32px; align-self: center; }
.ds-balance-line { display: flex; gap: var(--space-2); align-items: baseline; margin-top: var(--space-2); font-size: var(--type-btn); line-height: var(--type-sm-lh); }
.ds-balance-line > .ds-icon { align-self: flex-start; margin-top: 2px; color: var(--color-reported); }
.ds-balance-line.is-muted { color: var(--color-muted); }
.ds-terms { display: grid; margin: var(--space-5) 0 0; border-top: var(--rule-width) solid var(--color-rule); font-size: var(--type-btn); line-height: var(--type-sm-lh); }
.ds-terms > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-2) 0; border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-terms dt { color: var(--color-muted); }
.ds-terms dd { margin: 0; }

/* ---------- Reported Payment waiting on the Landlord: amber, dashed, a clock, the word "Reported" */

.ds-reported { margin-top: var(--space-3); padding: var(--space-4); background: var(--color-reported-soft); border: 1.5px dashed var(--color-reported); border-radius: var(--radius-box); }
.ds-reported-head { display: flex; gap: var(--space-2); align-items: center; font-size: var(--type-lg); line-height: var(--type-lg-lh); }
.ds-reported-head .ds-icon { width: 20px; height: 20px; color: var(--color-reported); }
.ds-reported-word { font-weight: var(--weight-bold); color: var(--color-reported); }
.ds-reported-said { margin-top: var(--space-2); font-size: var(--type-btn); }
.ds-reported-said q { quotes: "\201C" "\201D"; }
.ds-reported-note { margin-top: var(--space-2); color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }

.ds-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-4); }
.ds-actions > .ds-btn { white-space: nowrap; }

/* ---------- Rent Ledger: newest first, a white panel per month, a running balance on every row */

.ds-month { margin-top: var(--space-3); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); overflow: hidden; }
.ds-month-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--space-3); padding: var(--space-2) var(--space-4); background: var(--color-sunk); border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-month-label { margin: 0; color: var(--color-ink); font-family: var(--font-ui); font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-semibold); }
.ds-month-sum { margin: 0; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
/* #103: a long ledger's earlier months, behind a button, as a line per year. */
.ds-earlier-more { margin-top: var(--space-3); }
.ds-earlier { margin-top: var(--space-2); }
.ds-year-block + .ds-year-block { margin-top: var(--space-2); }
.ds-year {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--space-3); width: 100%; min-height: var(--row-min);
  padding: var(--space-3) var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box);
  color: var(--color-ink); font: inherit; text-align: left; cursor: pointer;
}
.ds-year:hover { background: var(--color-sunk); }
.ds-year-label { font-weight: var(--weight-semibold); }
.ds-year-label::before { content: "▸"; display: inline-block; width: 1.25em; color: var(--color-muted); }
.ds-year[aria-expanded="true"] .ds-year-label::before { content: "▾"; }
.ds-year-sum { color: var(--color-muted); font-size: var(--type-sm); }
.ds-year-months > .ds-month:first-child { margin-top: var(--space-2); }
.ds-entries { list-style: none; margin: 0; padding: 0; }
.ds-entries > li + li { border-top: var(--rule-width) solid var(--color-rule); }
.ds-entry {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "what amt" "meta run";
  column-gap: var(--space-3); row-gap: 2px; min-height: var(--row-min); padding: var(--space-3) var(--space-4);
}
/* A row that opens its details (where Waive and Void live) is a button the full width of the row. */
button.ds-entry { width: 100%; margin: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.ds-entry:hover { background: var(--color-hover); }
button.ds-entry:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.ds-entry-what { grid-area: what; font-weight: var(--weight-semibold); font-size: var(--type-btn); }
.ds-entry-what .ds-pill { margin-left: var(--space-2); }
.ds-entry-meta { grid-area: meta; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-entry-amt { grid-area: amt; text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); font-size: var(--type-btn); white-space: nowrap; }
.ds-entry-run { grid-area: run; text-align: right; color: var(--color-muted); font-size: var(--type-xs); line-height: var(--type-xs-lh); white-space: nowrap; }
/* Waived or voided: kept at its full amount, struck through, with the word in the row's text. */
.ds-entry.is-cancelled .ds-entry-amt { text-decoration: line-through; color: var(--color-muted); font-weight: var(--weight-regular); }
/* A note the ledger carries without an amount ("No late fee posted"). */
.ds-entry.is-note { grid-template-columns: minmax(0, 1fr); grid-template-areas: "what" "meta"; color: var(--color-muted); }
.ds-entry.is-note .ds-entry-what { font-weight: var(--weight-medium); font-style: italic; }
/* A Reported Payment shown in the ledger's place: not counted, so no running balance. */
.ds-entry.is-reported { background: var(--color-reported-soft); }
.ds-entry.is-reported .ds-entry-what { display: flex; gap: var(--space-2); align-items: center; }
.ds-entry.is-reported .ds-entry-what .ds-icon, .ds-entry.is-reported .ds-entry-run { color: var(--color-reported); }

/* ---------- status pills: statuses only, one word each */

.ds-pill {
  display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-2);
  border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-pill); background: var(--color-sunk);
  color: var(--color-muted); font-family: var(--font-ui); font-size: var(--type-pill); line-height: 20px; font-weight: var(--weight-semibold); white-space: nowrap; vertical-align: 1px;
}
.ds-pill.is-owed { color: var(--color-owed); background: var(--color-owed-soft); border-color: transparent; }
.ds-pill.is-paid { color: var(--color-paid); background: var(--color-surface); border-color: currentColor; }
.ds-pill.is-held { color: var(--color-held); background: var(--color-surface); border-color: currentColor; }
.ds-pill.is-reported { color: var(--color-reported); background: var(--color-reported-soft); border: var(--rule-width) dashed var(--color-reported); }
.ds-pill.is-urgent { color: var(--color-on-urgent); background: var(--color-urgent); border-color: var(--color-urgent); }

/* ---------- forms */

.ds-form { margin: 0; }
.ds-field { margin-top: var(--space-4); }
.ds-field:first-child { margin-top: 0; }
.ds-fields { margin-top: var(--space-4); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-3); }
.ds-fields > .is-wide { grid-column: 1 / -1; }
.ds-fields > .ds-field:nth-child(2) { margin-top: 0; }
.ds-fields > .is-wide:first-child + .ds-field { margin-top: var(--space-4); }
.ds-label { display: block; margin: 0 0 6px; font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-semibold); }
.ds-label-note { font-weight: var(--weight-regular); color: var(--color-muted); }
.ds-hint { margin: var(--space-1) 0 0; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-field-error { margin: var(--space-2) 0 0; color: var(--color-urgent); font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-semibold); }
.ds-field-error:empty { display: none; }

.ds-input {
  display: block; width: 100%; min-height: var(--control-height); margin: 0; padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui); font-size: var(--type-md); line-height: var(--type-md-lh); color: var(--color-ink);
  background: var(--color-input); border: var(--border-width) solid var(--color-control-edge); border-radius: var(--radius-control);
}
.ds-input:focus-visible { outline-offset: 0; border-color: var(--color-focus); }
.ds-input::placeholder { color: var(--color-muted); opacity: 1; }
.ds-input[aria-invalid="true"] { border-color: var(--color-urgent); box-shadow: inset 0 0 0 1px var(--color-urgent); }
.ds-input:disabled { background: var(--color-sunk); border-color: var(--color-rule-strong); color: var(--color-muted); }
textarea.ds-input { min-height: 96px; resize: vertical; }
.ds-input.is-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ds-select { position: relative; }
.ds-select .ds-input { appearance: none; padding-right: var(--space-10); }
.ds-select::after { content: ""; position: absolute; right: var(--space-4); top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 1.5px solid var(--color-muted); border-bottom: 1.5px solid var(--color-muted); transform: rotate(45deg); pointer-events: none; }
.ds-money { position: relative; }
.ds-money::before { content: "$"; position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.ds-money .ds-input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.ds-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.ds-chip {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-3);
  border: var(--rule-width) solid var(--color-rule-strong); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-link);
  font-family: var(--font-ui); font-size: var(--type-sm); font-weight: var(--weight-semibold); cursor: pointer;
}
.ds-chip:hover { background: var(--color-hover); }
.ds-check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); margin-top: var(--space-3); }
.ds-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--color-primary); }
.ds-check label { margin: 0; font-weight: var(--weight-regular); }

/* Find a door (#89): a search field with its magnifier, beside the segmented filter. */
.ds-finder { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-5); }
.ds-search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 0; }
.ds-search > .ds-icon { position: absolute; left: var(--space-3); color: var(--color-muted); pointer-events: none; }
.ds-search > .ds-input { padding-left: var(--space-10); }
.ds-search > .ds-input::-webkit-search-cancel-button { cursor: pointer; }
/* A segmented filter: buttons with aria-pressed, each with its count ("Owe rent 4"). */
.ds-seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--color-sunk); border: var(--rule-width) solid var(--color-rule); border-radius: 10px; }
.ds-seg > button {
  min-height: var(--tap-min); padding: 0 var(--space-3); border: 0; border-radius: 7px; background: none; color: var(--color-muted);
  font: inherit; font-size: var(--type-sm); font-weight: var(--weight-semibold); white-space: nowrap; cursor: pointer;
}
.ds-seg > button:hover { color: var(--color-ink); }
.ds-seg > button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-ink); box-shadow: var(--elevation-seg); }
.ds-seg-n { margin-left: 2px; color: var(--color-muted); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
@container (max-width: 879px) { .ds-finder > .ds-seg { width: 100%; } .ds-finder > .ds-seg > button { flex: 1; } }

/* ---------- buttons: 46px tall, never under 44. One primary (harbor blue) per screen. */

.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-height); min-width: var(--tap-min); margin: 0; padding: 0 var(--space-4);
  font-family: var(--font-ui); font-size: var(--type-btn); line-height: 1.2; font-weight: var(--weight-semibold); text-align: center; text-decoration: none;
  color: var(--color-ink); background: var(--color-surface); border: var(--border-width) solid var(--color-rule-strong); border-radius: var(--radius-control);
  cursor: pointer; opacity: 1;
}
.ds-btn .ds-icon { width: 18px; height: 18px; }
.ds a.ds-btn { color: var(--color-ink); text-decoration: none; }
.ds a.ds-btn.is-primary { color: var(--color-on-primary); }
.ds a.ds-btn.is-strong, .ds a.ds-btn.is-quiet { color: var(--color-link); }
.ds a.ds-btn.is-danger { color: var(--color-on-urgent); }
.ds-btn:hover { background: var(--color-hover); }
.ds-btn.is-primary { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary-edge); }
.ds-btn.is-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.ds-btn.is-secondary { background: var(--color-surface); }
.ds-btn.is-secondary:hover { background: var(--color-hover); }
.ds-btn.is-strong { color: var(--color-link); border-color: var(--color-primary-edge); }
.ds-btn.is-danger { background: var(--color-urgent); color: var(--color-on-urgent); border-color: var(--color-urgent); }
.ds-btn.is-danger:hover { background: var(--color-urgent); text-decoration: underline; text-underline-offset: 3px; }
.ds-btn.is-quiet { padding: 0 var(--space-3); border-color: transparent; background: none; color: var(--color-link); }
.ds-btn.is-quiet:hover { background: var(--color-hover); }
.ds-btn.is-compact { min-height: var(--tap-min); padding: 0 var(--space-3); font-size: var(--type-sm); }
.ds-btn.is-wide { width: 100%; }
.ds-btn:disabled, .ds-btn[aria-disabled="true"] { opacity: 1; cursor: default; background: var(--color-sunk); color: var(--color-muted); border-color: var(--color-rule); text-decoration: none; }
.ds-btn[aria-busy="true"] { cursor: progress; }
.ds-btn[aria-busy="true"]::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ds-spin 800ms linear infinite; }

/* ---------- dialog and sheet: from the bottom on a phone, a box in the middle on a tablet,
   a panel from the right at 880px and up */

.ds-sheet {
  width: 100%; max-width: 100%; max-height: calc(100dvh - var(--space-8)); margin: auto 0 0; padding: 0; overflow: auto;
  font-family: var(--font-ui); font-size: var(--type-md); line-height: var(--type-md-lh); color: var(--color-ink);
  background: var(--color-surface); border: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--elevation-raised);
}
dialog.ds-sheet[open] { animation: ds-sheet-up var(--motion-base) ease-out; }
dialog.ds-sheet::backdrop { background: var(--scrim); }
.ds-sheet.is-static { display: block; position: static; margin: 0; max-height: none; border-top: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; }
.ds-sheet-body { padding: var(--space-5) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom)); }
.ds-sheet-title { margin: 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-xl); line-height: var(--type-xl-lh); }
.ds-sheet-entry { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; margin-top: var(--space-4); padding: var(--space-3) 0; border-top: var(--rule-width) solid var(--color-rule); border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-sheet-entry .ds-num { font-size: var(--type-lg); font-weight: var(--weight-semibold); }
.ds-sheet-effect { margin: var(--space-3) 0 0; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-sheet .ds-field { margin-top: var(--space-5); }
.ds-sheet-actions { display: grid; gap: var(--space-2); margin-top: var(--space-6); }
@media (min-width: 600px) {
  dialog.ds-sheet { width: min(480px, 100% - var(--space-8)); margin: auto; border-radius: var(--radius-box); }
  dialog.ds-sheet[open] { animation-name: ds-fade-in; }
  dialog.ds-sheet .ds-sheet-body { padding: var(--space-6); }
  dialog.ds-sheet .ds-sheet-actions { grid-template-columns: 1fr 1fr; }
  dialog.ds-sheet .ds-sheet-actions > :first-child { order: 2; }
  dialog.ds-sheet .ds-sheet-actions.is-stacked { grid-template-columns: 1fr; }
  dialog.ds-sheet .ds-sheet-actions.is-stacked > :first-child { order: 0; }
}
@media (min-width: 880px) {
  dialog.ds-sheet { width: 440px; height: 100vh; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-radius: 0; }
  dialog.ds-sheet[open] { animation-name: ds-sheet-in; }
  dialog.ds-sheet .ds-sheet-body { padding: var(--space-6) var(--space-8); }
}

/* ---------- page parts the Owner Screen's views share (#61) */

/* Back to the screen above: a chevron and its name, a full tap target. */
.ds-back { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--tap-min); margin: calc(-1 * var(--space-2)) 0 var(--space-1); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.ds a.ds-back { text-decoration: none; }
.ds a.ds-back:hover { text-decoration: underline; }
.ds-lede { margin-top: var(--space-1); color: var(--color-muted); font-size: var(--type-lg); line-height: var(--type-lg-lh); }
.ds-foot { margin-top: var(--space-4); color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-kicker { display: block; margin-bottom: 2px; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-medium); }
.ds-narrow { max-width: 640px; }
.ds-section > .ds-form, .ds-section > .ds-hint, .ds-block .ds-form > .ds-h2 + .ds-field { margin-top: var(--space-3); }

/* A group inside a section: a label over its rows. */
.ds-group { margin-top: var(--space-5); }
.ds-group-label { margin: 0 0 var(--space-2); font-family: var(--font-ui); font-size: var(--type-btn); line-height: var(--type-sm-lh); font-weight: var(--weight-semibold); }
.ds-group-label .ds-muted { font-weight: var(--weight-regular); }

/* The contained thing on a screen that needs a decision or input: a pending approval, the
   payment form. White, a stronger edge and the one soft shadow. */
.ds-block { margin-top: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule-strong); border-radius: var(--radius-box); box-shadow: var(--elevation-raised); }
.ds-block > .ds-h2:first-child, .ds-block > .ds-kicker:first-child { margin-bottom: var(--space-1); }
.ds-block-title { margin: var(--space-1) 0 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-lg); line-height: var(--type-lg-lh); }
.ds-block ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.ds-recorded { margin-top: var(--space-4); padding-top: var(--space-3); border-top: var(--rule-width) solid var(--color-rule); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-recorded ul { list-style: none; margin: var(--space-1) 0 0; padding: 0; }

/* Less common changes, folded: a panel of rows with a chevron. */
.ds-disclosures { margin-top: var(--space-3); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-disclosure + .ds-disclosure { border-top: var(--rule-width) solid var(--color-rule); }
.ds-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--row-min); padding: var(--space-2) var(--space-4);
  font-weight: var(--weight-semibold); cursor: pointer; list-style: none; border-radius: var(--radius-box);
}
.ds-disclosure > summary::-webkit-details-marker { display: none; }
.ds-disclosure > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: -4px var(--space-1) 0 0; border-right: 1.5px solid var(--color-muted); border-bottom: 1.5px solid var(--color-muted); transform: rotate(45deg); }
.ds-disclosure[open] > summary::after { margin-top: 4px; transform: rotate(225deg); }
.ds-disclosure > summary:hover { background: var(--color-hover); }
.ds-disclosure > summary:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.ds-disclosure-sub { display: block; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-regular); }
.ds-disclosure-body { padding: var(--space-1) var(--space-4) var(--space-5); }

/* A dense table of rows on a wide screen: one line per row, the amount at the end. */
@container (min-width: 720px) {
  .ds-list.is-table .ds-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr) 176px; grid-template-areas: "title sub note end"; align-items: center; }
  .ds-list.is-table .ds-row-note { margin-top: 0; }
}

/* The lease: Balance and its actions beside the ledger on a wide screen. */
@container (min-width: 960px) {
  .ds-lease { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: var(--space-10); align-items: start; }
  .ds-lease > .ds-section:first-child, .ds-lease-ledger { margin-top: 0; }
  /* #103: the Balance, Record a payment and the terms stay on screen beside a long ledger. */
  .ds-lease > div:first-child { position: sticky; top: var(--space-4); max-height: calc(100dvh - 2 * var(--space-4)); overflow-y: auto; overscroll-behavior: contain; }
}

/* doorsuper.com's public pages (#97): the homepage, the privacy policy, the SMS terms. Plain prose. */
.ds-doc { max-width: 640px; margin: 0 auto; padding-top: var(--space-6); }
.ds-doc .ds-h3 { margin-top: var(--space-6); }
.ds-doc p, .ds-doc ul { margin: var(--space-3) 0 0; }
.ds-doc ul { padding-left: var(--space-5); }
.ds-doc li + li { margin-top: var(--space-1); }

/* Sign-in and the emailed-link pages. */
.ds-auth { max-width: 420px; margin: 0 auto; padding-top: var(--space-6); }
.ds-auth .ds-form { margin-top: var(--space-6); }
.ds-auth .ds-actions { margin-top: var(--space-6); }
.ds-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.ds-label-row .ds-label { margin-bottom: 6px; }
.ds-label-row a { font-size: var(--type-sm); }
.ds-status { margin-top: var(--space-6); padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }

/* A list of messages: divided, the business's side (Crew Leader, a User) set off by a rule.
   Messages (#87) and letters an approval sends use it; .ds-msgs below is the bubble thread. */
.ds-thread { list-style: none; margin: 0; padding: 0; }
.ds-thread > li { padding: var(--space-3) 0; border-top: var(--rule-width) solid var(--color-rule); }
.ds-thread > li:first-child { border-top: 0; }
.ds-thread > li.is-crew, .ds-thread > li.is-user { padding-left: var(--space-4); border-left: 3px solid var(--color-rule-strong); }
.ds-thread > li.is-user .ds-msg-meta { color: var(--color-ink); font-weight: var(--weight-semibold); }
/* An unread conversation on Messages (#87): a harbor-blue dot after the name. */
.ds-row.is-unread .ds-row-title::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: var(--space-2); border-radius: 50%; background: var(--color-primary); vertical-align: middle; }
.ds-row.is-unread .ds-row-note { color: var(--color-ink); font-weight: var(--weight-medium); }
.ds-msg-meta { display: block; margin-bottom: var(--space-1); color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-transcript p { margin-top: var(--space-2); font-size: var(--type-sm); line-height: var(--type-sm-lh); }

/* ---------- empty, loading, error */

.ds-state { margin-top: var(--space-6); padding: var(--space-4) 0; }
.ds-state-title { margin: 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-lg); line-height: var(--type-lg-lh); }
.ds-state-text { margin-top: var(--space-1); color: var(--color-muted); }
.ds-state .ds-actions { margin-top: var(--space-4); }
.ds-state.is-error { padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-urgent); border-radius: var(--radius-box); }
.ds-state.is-error .ds-state-text { color: var(--color-ink); }

/* Loading draws the screen's shape at once: the heading, then rows, never the word alone. */
.ds-skeleton { display: block; height: 16px; border-radius: 6px; background: var(--color-skeleton); animation: ds-pulse 1.4s ease-in-out infinite; }
.ds-skeleton.is-heading { width: 60%; height: 30px; }
.ds-skeleton.is-line { width: 40%; margin-top: var(--space-3); }
.ds-skeleton-rows { list-style: none; margin: var(--space-8) 0 0; padding: 0 var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-skeleton-rows > li { display: grid; grid-template-columns: 1fr 88px; gap: var(--space-2) var(--space-3); align-items: center; min-height: var(--row-min); padding: var(--space-3) 0; }
.ds-skeleton-rows > li + li { border-top: var(--rule-width) solid var(--color-rule); }
.ds-skeleton-rows > li > :first-child { width: 70%; }
.ds-skeleton-rows > li > :last-child { grid-row: span 2; }
.ds-skeleton-rows > li > .is-sub { width: 45%; height: 12px; }

/* ---------- toasts */

.ds-toast-region {
  position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(var(--tab-height) + var(--space-4) + env(safe-area-inset-bottom)); z-index: var(--layer-toast);
  display: flex; flex-direction: column; gap: var(--space-2); max-width: 480px; margin: 0 auto; pointer-events: none;
}
.ds-toast {
  --focus-ring: var(--color-bg);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-height); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--color-ink); color: var(--color-bg); border-radius: 10px; box-shadow: var(--elevation-raised);
  font-family: var(--font-ui); font-size: var(--type-btn); line-height: var(--type-sm-lh); font-weight: var(--weight-medium);
  pointer-events: auto; animation: ds-toast-in var(--motion-base) ease-out;
}
.ds-toast .ds-num { font-weight: var(--weight-semibold); }
.ds-toast.is-error { --focus-ring: var(--color-on-urgent); background: var(--color-urgent); color: var(--color-on-urgent); }
.ds-toast-action {
  flex: none; min-height: var(--tap-min); min-width: var(--tap-min); padding: 0 var(--space-3); margin: 0;
  border: var(--rule-width) solid currentColor; border-radius: var(--radius-control); background: none; color: inherit; font: inherit; font-weight: var(--weight-semibold); cursor: pointer;
}
.ds-toast.is-leaving { opacity: 0; transition: opacity var(--motion-base); }

@keyframes ds-sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ds-sheet-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ds-pulse { 50% { opacity: 0.55; } }
@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  dialog.ds-sheet[open], .ds-toast, .ds-skeleton, .ds-btn[aria-busy="true"]::before { animation: none; }
}

/* Notifications on this device (#64, Account page): the "on" line, and the kinds as checkboxes with a hint each. */
.ds-push-on { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 0; font-weight: var(--weight-semibold); }
.ds-push-on .ds-icon { flex: none; color: var(--color-paid); }
.ds-push-kinds { min-width: 0; margin: var(--space-4) 0 0; padding: 0; border: 0; }
.ds-push-kinds legend { padding: 0; }
.ds-check label .ds-hint { display: block; margin: 0; }

/* ---------- Home (#66): one screen with everything that needs the Landlord today */

/* A section's one-line summary, under its label: "4 of 18 owe $4,790.00", "2 open". */
.ds-section-line { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: baseline; margin-top: var(--space-3); font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-line); line-height: var(--type-lg-lh); }
.ds-section > .ds-h2 + .ds-section-line { margin-top: 0; }
.ds-section-line .is-owed { color: var(--color-owed); }
.ds-section-line .is-paid { display: inline-flex; gap: var(--space-1); align-items: center; color: var(--color-paid); }
.ds-section > .ds-state { margin-top: var(--space-3); padding: var(--space-1) 0 0; }
.ds-section > .ds-block, .ds-section > .ds-reported { margin-top: var(--space-3); }
.ds-section > .ds-group:first-of-type { margin-top: var(--space-4); }
.ds-section > .ds-list { margin-top: var(--space-3); }
.ds-section > .ds-h2 + .ds-list { margin-top: 0; }

/* An Urgent Task open right now: an urgent edge and the Urgent pill, above everything else. */
.ds-urgent { margin-top: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: 1.5px solid var(--color-urgent); border-radius: var(--radius-box); box-shadow: var(--elevation-raised); }
.ds-urgent-head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-urgent-who { margin-top: var(--space-1); color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-section:has(> .ds-urgent) { margin-top: var(--space-5); }
.ds-section:has(> .ds-urgent) + .ds-note { margin-top: var(--space-5); }

/* A date at a row's end with how far off it is: "Nov 14" over "in 18 days". */
.ds-when { display: grid; justify-items: end; font-weight: var(--weight-semibold); font-size: var(--type-btn); }
.ds-when-in { color: var(--color-muted); font-family: var(--font-ui); font-size: var(--type-xs); line-height: var(--type-xs-lh); font-weight: var(--weight-regular); }

/* The Rundown as it was texted: the Crew Leader's words in a white panel. */
.ds-rundown { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); font-size: var(--type-btn); }
.ds-rundown-lines { list-style: none; margin: 0; padding: 0; }
.ds-rundown-lines > li { padding: var(--space-2) 0; border-top: var(--rule-width) solid var(--color-rule); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-rundown-lines > li:first-child { border-top: 0; }

/* Collected of charged: a <progress> bar that carries its figure in words beside it. */
.ds-meter { display: block; width: 100%; height: 8px; margin-top: var(--space-2); appearance: none; border: var(--rule-width) solid var(--color-rule); border-radius: 4px; background: var(--color-sunk); overflow: hidden; color: var(--color-primary); }
.ds-meter::-webkit-progress-bar { background: var(--color-sunk); }
.ds-meter::-webkit-progress-value { background: var(--color-primary); }
.ds-meter::-moz-progress-bar { background: var(--color-primary); }

/* The Crew Leader's morning note (#89, borrowed from E): first on Home, in the Crew Leader's own voice. */
.ds-note { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-8); padding: var(--space-4) var(--space-4) var(--space-5); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-note-from { display: flex; align-items: center; gap: var(--space-2); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-note-from strong { font-weight: var(--weight-semibold); }
.ds-note-from .ds-wordmark-glyph { width: 20px; height: 20px; }
.ds-note-title { margin: 0; font-family: var(--font-head); font-weight: var(--weight-semibold); font-size: var(--type-xl); line-height: var(--type-xl-lh); letter-spacing: var(--track-tight); }
.ds-note-body { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--type-lg); line-height: 1.5; }
@container (min-width: 880px) {
  .ds-note { padding: var(--space-5) var(--space-6) var(--space-6); }
  .ds-note-body { display: block; columns: 2; column-gap: var(--space-8); }
  .ds-note-body > p { break-inside: avoid; margin-bottom: var(--space-2); }
  .ds-note-body:has(> p:only-child) { columns: auto; }
}

/* Phone: one column, in order of importance. Wide: waiting and money on the left, texts, repairs and coming up on the right. */
.ds-home-col > .ds-section:first-child { margin-top: var(--space-6); }
@container (min-width: 960px) {
  .ds-home { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-10); align-items: start; }
}

/* ---------- Doors and Properties (#89): a white panel per property, every door under it */

.ds-doors-layout { display: block; }
.ds-prop-index { display: none; }
@container (min-width: 880px) {
  .ds-doors-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-8); align-items: start; }
  .ds-prop-index { display: block; position: sticky; top: var(--space-4); }
  /* No properties yet, so no index: the page uses the whole width. */
  .ds-doors-layout > .ds-properties:only-child { grid-column: 1 / -1; }
}
.ds-prop-index ul { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; }
.ds-prop-index .ds-h2 { margin-left: var(--space-3); }
.ds-prop-index a { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-2); min-height: var(--tap-min); padding: var(--space-2) var(--space-3); border-radius: var(--radius-control); color: var(--color-ink); text-decoration: none; }
.ds-prop-index a:hover { background: var(--color-surface); }
.ds-prop-index-name { font-weight: var(--weight-semibold); font-size: var(--type-btn); }
.ds-prop-index-sub { grid-column: 1; color: var(--color-muted); font-size: var(--type-xs); }
.ds-prop-index-owed { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--color-owed); font-size: var(--type-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

.ds-properties { display: flex; flex-direction: column; gap: var(--space-4); }
.ds-property { background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); overflow: hidden; scroll-margin-top: var(--space-4); }
.ds-property-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-sunk); border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-property-head .ds-h3 { font-size: var(--type-lg); }
.ds-property-facts { flex: 1; min-width: 140px; color: var(--color-muted); font-size: var(--type-sm); }
.ds-property-owed { color: var(--color-owed); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.ds-property-head > .ds-btn { margin-left: auto; }
@container (max-width: 879px) { .ds-property-head > .ds-btn { display: none; } }
.ds-doors { list-style: none; margin: 0; padding: 0; }
.ds-doors > li + li { border-top: var(--rule-width) solid var(--color-rule); }
/* A door: its unit, the tenant (or "No tenant"), a short note, and the balance with its word. */
.ds-door { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "unit title end" "unit sub end"; column-gap: var(--space-3); align-items: baseline; min-height: var(--row-min); padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none; }
.ds a.ds-door { color: inherit; text-decoration: none; }
a.ds-door:hover { background: var(--color-hover); }
.ds-door:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.ds-door-unit { grid-area: unit; align-self: center; color: var(--color-muted); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.ds-door > .ds-row-title { grid-area: title; }
.ds-door > .ds-row-sub { grid-area: sub; }
.ds-door > .ds-row-end, .ds-door > .ds-amount { grid-area: end; align-self: center; justify-self: end; text-align: right; }
.ds-door.is-owed { box-shadow: inset 3px 0 0 var(--color-owed); }
.ds-door.is-vacant > .ds-row-title { color: var(--color-muted); font-weight: var(--weight-medium); font-style: italic; }
.ds-door.is-new { background: var(--color-accent-soft); }
@container (min-width: 880px) {
  .ds-door { grid-template-columns: 80px minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(8.5rem, max-content); grid-template-areas: "unit title sub end"; }
}
/* The empty slot at the end of every property (#89, borrowed from E): dashed, a plus, "Add a door". */
.ds-add-slot { padding: var(--space-2) var(--space-3) var(--space-3); }
.ds-doors > li.ds-add-slot { border-top: 0; }
.ds-add-slot > button, .ds-add-slot > a {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; min-height: var(--row-min); padding: 0 var(--space-4);
  border: 1.5px dashed var(--color-rule-strong); border-radius: var(--radius-control); background: none; color: var(--color-link);
  font: inherit; font-size: var(--type-btn); font-weight: var(--weight-semibold); text-decoration: none; cursor: pointer;
}
.ds-add-slot > button:hover, .ds-add-slot > a:hover { border-color: var(--color-primary); background: var(--color-accent-soft); }
/* Add a property: the same dashed slot, larger, after the last property. */
.ds-add-slot.is-property { padding: 0; }
.ds-add-slot.is-property > button, .ds-add-slot.is-property > a { justify-content: flex-start; min-height: 72px; padding: var(--space-4) var(--space-5); border-radius: var(--radius-box); border-width: 2px; text-align: left; }
.ds-add-slot .ds-icon { width: 20px; height: 20px; }
.ds-add-slot.is-property strong { display: block; font-size: var(--type-lg); }
.ds-add-slot.is-property .ds-hint { display: block; margin: 0; font-weight: var(--weight-regular); }

/* ---------- More (#89): every row says what it's set to now; one that needs you is in the owed color */

.ds-row.is-setting { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title end" "sub end"; min-height: 60px; }
.ds-row.is-setting::after { content: ""; grid-area: end; align-self: center; justify-self: end; width: 8px; height: 8px; margin-right: var(--space-1); border-right: 1.5px solid var(--color-muted); border-bottom: 1.5px solid var(--color-muted); transform: rotate(-45deg); }
.ds-row.is-setting.is-attn .ds-row-sub { color: var(--color-owed); }

/* ---------- a conversation as bubbles (#89): the Tenant's on the left, the business's on the right.
   <ol class="ds-msgs"><li class="ds-msg is-tenant|is-crew|is-user"><p class="ds-msg-meta">..</p><p class="ds-msg-text">..</p></li></ol> */

.ds-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.ds-msgs-day { align-self: center; padding-top: var(--space-2); color: var(--color-muted); font-size: var(--type-xs); font-weight: var(--weight-semibold); }
.ds-msg { display: flex; flex-direction: column; gap: 3px; max-width: 82%; }
.ds-msg > .ds-msg-meta { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); align-items: baseline; margin: 0; font-size: var(--type-xs); }
.ds-msg-who { color: var(--color-ink); font-weight: var(--weight-bold); }
.ds-msg-text { padding: 10px 14px; border-radius: 14px; font-size: var(--type-btn); line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.ds-msg.is-tenant > .ds-msg-text { background: var(--color-sunk); border: var(--rule-width) solid var(--color-rule); border-top-left-radius: 4px; }
.ds-msg.is-crew, .ds-msg.is-user { align-self: flex-end; align-items: flex-end; }
.ds-msg.is-crew > .ds-msg-text { background: var(--color-surface); border: var(--rule-width) solid var(--color-primary); border-top-right-radius: 4px; }
.ds-msg.is-user > .ds-msg-text { background: var(--color-primary); color: var(--color-on-primary); border-top-right-radius: 4px; }
/* The Crew Leader holding off because a User is in the conversation. */
.ds-hold { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-2) var(--space-3); background: var(--color-sunk); border-radius: var(--radius-control); color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-hold .ds-icon { margin-top: 1px; }
/* The reply box at the end of a thread. */
.ds-reply { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--color-surface); border-top: var(--rule-width) solid var(--color-rule); }
.ds-reply-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); }
.ds-reply-foot .ds-hint { margin: 0; font-size: var(--type-xs); }
/* Initials in a circle, for a conversation's row. */
.ds-avatar { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--color-sunk); border: var(--rule-width) solid var(--color-rule); color: var(--color-muted); font-size: var(--type-sm); font-weight: var(--weight-semibold); }

/* ---------- Vacancy ads (#73): a vacant Door's photos, the ad's text and its wording check */

/* Photos as a tight grid of thumbnails, each with its own Remove under it. Images come from /owner/ only (CSP img-src 'self'). */
.ds-photos { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; }
.ds-photo { display: grid; margin: 0; background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-control); overflow: hidden; }
.ds-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--color-skeleton); }
.ds-photo .ds-btn { width: 100%; border-width: 0; border-top: var(--rule-width) solid var(--color-rule); border-radius: 0; }
/* A button that opens the phone's photo picker: the file input sits inside it, out of sight, and the button shows its focus. */
.ds-file { position: relative; }
.ds-file > input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ds-file:has(> input:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.ds-file:has(> input:disabled) { background: var(--color-sunk); color: var(--color-muted); }
/* The wording check: each phrase it found and why, in the callout; or one quiet line that it found none. */
.ds-flags { list-style: none; margin: var(--space-2) 0 0; padding: 0; font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-flags > li + li { margin-top: var(--space-2); }
.ds-flag-phrase { font-weight: var(--weight-bold); }
.ds-check-line { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 0; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-check-line .ds-icon { flex: none; color: var(--color-paid); }
.ds-form > .ds-h3 { margin-top: var(--space-6); }
/* An approved ad as it reads, in a white panel. */
.ds-ad { margin-top: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-ad > p { margin-top: var(--space-2); white-space: pre-line; }
.ds-ad > ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.ds-url { font-size: var(--type-sm); line-height: var(--type-sm-lh); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- #92 Doors and Properties as one page */

/* Edit stays in a property's header on a phone, where "Add a door" gives way to the slot. */
.ds-property-head > .ds-btn + .ds-btn { margin-left: 0; }
@container (max-width: 879px) {
  .ds-property-head > .ds-btn.is-edit { display: inline-flex; }
  /* On a phone Edit sits beside the name, and the facts and what's owed stack under it, so every header has the same shape. */
  .ds-property-head:has(> .is-edit) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .ds-property-head:has(> .is-edit) > :not(.ds-btn) { grid-column: 1; }
  .ds-property-head > .ds-btn.is-edit { grid-column: 2; grid-row: 1 / span 3; margin-right: calc(-1 * var(--space-2)); }
}
/* A row that opens a sheet rather than a page (a property's doors in its Edit sheet). */
button.ds-row { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.ds-row:hover { background: var(--color-hover); }
.ds-properties > .ds-section, .ds-properties > .ds-actions { margin-top: var(--space-4); }
.ds-prop-index > .ds-btn { margin-top: var(--space-2); }

/* ---------- #93: Messages, the lease and the Tenant page in D ---------- */

/* A line icon (24 grid, round ends), as D's mocks draw them. */
.ds-icon.is-line { width: 20px; height: 20px; }
.ds-btn > .ds-icon.is-line { width: 18px; height: 18px; }
.ds-btn:has(> .ds-icon.is-line) { display: inline-flex; align-items: center; gap: var(--space-2); }

/* Messages: the list of conversations, and the open one beside it on a wide screen. */
.ds-convos-head { margin-bottom: var(--space-4); }
.ds-convos-head > .ds-hint { margin-top: var(--space-1); font-size: var(--type-sm); }
.ds-convos-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.ds-convos > .ds-search { margin-bottom: var(--space-3); }
.ds-new-text { margin-bottom: var(--space-4); padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-new-text .ds-actions { margin-top: var(--space-3); }
.ds-convo-list { list-style: none; margin: 0; padding: 0; background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); overflow: hidden; }
.ds-convo-list > li + li { border-top: var(--rule-width) solid var(--color-rule); }
.ds-convo {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av name when" "av where where" "av last new";
  column-gap: var(--space-3); row-gap: 1px; align-items: baseline; padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none;
}
.ds a.ds-convo { color: inherit; text-decoration: none; }
.ds-convo:hover { background: var(--color-hover); }
.ds-convo[aria-current="true"] { background: var(--color-accent-soft); }
.ds-convo:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.ds-convo > .ds-avatar { grid-area: av; align-self: start; }
.ds-convo-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-semibold); }
.ds-convo-when { grid-area: when; justify-self: end; color: var(--color-muted); font-size: var(--type-xs); white-space: nowrap; }
.ds-convo-where { grid-area: where; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-muted); font-size: var(--type-xs); line-height: var(--type-xs-lh); }
.ds-convo-last { grid-area: last; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-convo-new { grid-area: new; align-self: center; justify-self: end; margin-left: var(--space-2); padding: 1px 7px; border-radius: var(--radius-pill); background: var(--color-primary); color: var(--color-on-primary); font-size: var(--type-pill); font-weight: var(--weight-bold); line-height: 1.4; }
.ds-convo.is-unread .ds-convo-when { color: var(--color-link); font-weight: var(--weight-bold); }
.ds-convo.is-unread .ds-convo-last { color: var(--color-ink); font-weight: var(--weight-medium); }

/* The open conversation: who, the hold note, the bubbles, the reply box. On a phone it is the page. */
.ds-convo-thread { display: flex; flex-direction: column; margin: calc(-1 * var(--space-5)) calc(-1 * var(--gutter)) calc(-1 * var(--space-8)); min-height: calc(100dvh - var(--bar-height) - var(--tab-height)); background: var(--color-surface); }
.ds-thread-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 var(--space-3); padding: var(--space-4) var(--gutter) var(--space-3); border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-thread-head > .ds-back { flex-basis: 100%; }
.ds-thread-who { flex: 1; min-width: 0; }
.ds-thread-name { margin: 0; font-family: var(--font-head); font-size: var(--type-xl); line-height: var(--type-xl-lh); font-weight: var(--weight-semibold); letter-spacing: var(--track-tight); }
.ds-thread-sub { margin-top: 2px; color: var(--color-muted); font-size: var(--type-sm); line-height: var(--type-sm-lh); }
.ds-thread-sub a { color: inherit; }
.ds-thread-sub .is-owed { color: var(--color-owed); font-weight: var(--weight-semibold); }
.ds-thread-hold:not(:empty) { padding: var(--space-3) var(--gutter) 0; }
.ds-thread-body { flex: 1; padding: var(--space-3) var(--gutter) var(--space-5); }
.ds-thread-body > .ds-state { margin-top: 0; }
.ds-convo-thread > .ds-reply { bottom: calc(var(--tab-height) + env(safe-area-inset-bottom)); }
.ds-reply > textarea { resize: vertical; min-height: 64px; }
.ds-reply > .ds-field-error:empty { display: none; }
.ds-reply.is-note { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.ds-reply.is-note .ds-hint { margin: 0; }
.ds-reply-foot .ds-btn { flex: none; }
/* In a User's texts with the Crew Leader, the Crew Leader is the other side: its bubbles on the left. */
.ds-msg.is-crew.is-other { align-self: flex-start; align-items: flex-start; }
.ds-msg.is-crew.is-other > .ds-msg-text { border-top-right-radius: 14px; border-top-left-radius: 4px; }
.ds-msg.is-failed > .ds-msg-text { border-style: dashed; }
.ds-msg-meta time { color: var(--color-muted); }
.ds-msgs-panel { padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-inbox-pick { display: none; }

/* On a phone the open conversation is the page, so the list beside it goes. */
@container (max-width: 1039px) {
  .ds-inbox.is-thread > .ds-convos { display: none; }
}
@container (min-width: 880px) {
  .ds-convo-thread { margin: calc(-1 * var(--space-8)) calc(-1 * var(--space-10)) calc(-1 * var(--space-12)); min-height: 100dvh; }
  .ds-convo-thread > .ds-reply { bottom: 0; }
}
/* Wide: the list and the open conversation side by side, as in D's mock. */
@container (min-width: 1040px) {
  .ds-inbox { display: grid; grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); gap: 0; margin: calc(-1 * var(--space-8)) calc(-1 * var(--space-10)) calc(-1 * var(--space-12)); min-height: 100dvh; }
  .ds-inbox > .ds-convos { padding: var(--space-8) var(--space-6) var(--space-8); }
  .ds-inbox > .ds-convo-thread, .ds-inbox > .ds-inbox-pick { position: sticky; top: 0; height: 100dvh; margin: 0; min-height: 0; border-left: var(--rule-width) solid var(--color-rule); }
  .ds-inbox > .ds-convo-thread .ds-thread-body { overflow-y: auto; }
  .ds-inbox > .ds-convo-thread .ds-thread-head > .ds-back { display: none; }
  .ds-inbox > .ds-convo-thread .ds-thread-head { padding-top: var(--space-5); }
  .ds-inbox-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); background: var(--color-surface); color: var(--color-muted); }
  .ds-inbox-pick .ds-icon { width: 32px; height: 32px; }
  .ds-convo-thread .ds-msg { max-width: min(82%, 560px); }
}

/* The lease: where it is, and the date beside each ledger entry on a wide screen. */
.ds-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-size: var(--type-sm); }
.ds-crumbs > .ds-back { margin: 0; }
.ds-crumbs > a:not(.ds-back) { font-weight: var(--weight-semibold); text-decoration: none; }
.ds-crumbs-sep { color: var(--color-muted); }
.ds-lease-actions { margin-top: var(--space-5); }
.ds-lease-actions + .ds-actions { margin-top: var(--space-2); }
.ds-entry-date { display: none; }
@container (min-width: 960px) {
  .ds-lease-ledger .ds-entry { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "date what amt" "date meta run"; }
  .ds-lease-ledger .ds-entry-date { display: block; grid-area: date; color: var(--color-muted); font-size: var(--type-sm); line-height: 1.5; white-space: nowrap; }
  .ds-lease-ledger .ds-entry-meta-date { display: none; }
}
.ds-reply-foot { flex-wrap: nowrap; }
.ds-reply-foot .ds-hint { flex: 1 1 auto; min-width: 0; }
.ds-entry-amt.is-credit { color: var(--color-paid); }

/* ---------- #91: navigation, Home and More in D */

/* Signed out there is no rail: the page sits under the top bar at every width. */
@container (min-width: 880px) {
  .ds-shell:has(> .ds-rail[hidden]) { display: flex; flex-direction: column; align-items: stretch; }
  .ds-shell:has(> .ds-rail[hidden]) > .ds-bar { display: flex; }
}
/* The morning note opens Home: the columns start right under it. */
.ds-note ~ .ds-home > .ds-home-col:first-child > .ds-section:first-child, .ds-note ~ .ds-home > .ds-home-col > .ds-section:first-child { margin-top: 0; }
@container (max-width: 959px) { .ds-note ~ .ds-home > .ds-home-col + .ds-home-col > .ds-section:first-child { margin-top: var(--space-8); } }
/* The morning note's "See it in full" sits inside the note, as plain folded rows. */
.ds-note > .ds-disclosures { margin-top: 0; }
/* More: the two groups side by side on a wide screen, the sign-out buttons under them. */
.ds-more > .ds-section:first-child { margin-top: var(--space-5); }
@container (min-width: 960px) {
  .ds-more { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: start; }
  .ds-more > .ds-section { margin-top: var(--space-5); }
}
.ds-more-out { margin-top: var(--space-8); }
/* Home's New texts use the Messages list (#93). */
.ds-section > .ds-convo-list { margin-top: var(--space-3); }

/* ---------- #94: every other page in D (Approvals, Work orders, Applications, Vacancy ads, Rent reminders,
   Collections, Vendors, Account, sign-in and the emailed links, the Staff screen, the apply page) */

/* A white panel for anything that isn't a list of rows: a form, a setting, a few lines. No shadow: only decisions and sheets have one. */
.ds-panel { margin-top: var(--space-3); padding: var(--space-4); background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
/* Loading a setup workbook (#112): under the Doors page's empty state. */
.ds-setup-sheet { margin-top: var(--space-4); max-width: 720px; }
.ds-setup-sheet > p { max-width: 60ch; margin: var(--space-2) 0 0; }
.ds-setup-sheet > .ds-label { margin-top: var(--space-4); }
.ds-setup-sheet input[type="file"] { display: block; max-width: 100%; font: inherit; }
.ds-problems { margin: var(--space-3) 0 0; padding-left: 1.2em; display: grid; gap: var(--space-2); }
.ds-panel > :first-child { margin-top: 0; }
.ds-panel > .ds-form:first-child > .ds-fields:first-child, .ds-panel > .ds-form:first-child > div:first-child > .ds-field:first-child { margin-top: 0; }
.ds-panel > .ds-terms:first-child { border-top: 0; }
.ds-panel > .ds-terms > div:last-child { border-bottom: 0; }
.ds-panel > .ds-disclosures { margin-top: var(--space-3); }
.ds-panel .ds-thread { margin-top: var(--space-2); }
.ds-section > .ds-h2 + .ds-panel { margin-top: 0; }
@container (min-width: 600px) { .ds-panel { padding: var(--space-5); } }
/* Panels of rows under a grey header, one after another (applications by door). */
.ds-properties.is-groups { margin-top: var(--space-4); }
/* A group's count always sits under its name, so a long name doesn't give one header a different shape. */
.ds-properties.is-groups .ds-property-head { flex-direction: column; align-items: flex-start; }
/* The page head's summary can carry a status pill beside its words. */
.ds-page-head .ds-summary .ds-pill { align-self: center; }
/* The page head's own back link sits above it, as on the D mocks' crumbs. */
.ds-page-head + .ds-narrow > .ds-section:first-child, .ds-page-head + .ds-section { margin-top: var(--space-5); }
/* A row of sign-out buttons at the foot of the Account page, as on More. */
.ds-signout { margin-top: var(--space-8); }
/* The sign-in page and the emailed links: the form in a white panel under the heading. */
.ds-auth > .ds-panel { margin-top: var(--space-5); }
.ds-auth > .ds-panel > .ds-form { margin-top: 0; }
.ds-auth > .ds-panel .ds-actions { margin-top: var(--space-5); }
.ds-auth > .ds-panel > .ds-status { margin: 0; }
/* Messages a page would send (rent reminders, a collections handoff), as divided rows in a panel: no rule on the left inside it. */
.ds-thread.ds-panel { padding-block: 0; }
.ds-thread.ds-panel > li.is-crew, .ds-thread.ds-panel > li.is-user { padding-left: 0; border-left: 0; }
.ds-panel > .ds-h3 + .ds-form { margin-top: var(--space-3); }
/* A list beside its detail on a wide screen (desktop is where most Landlords work): Applications with the one
   open beside them, Approvals beside what was decided, open Work orders beside recent ones. On a phone the
   columns stack, and a detail page (.is-detail) shows only its detail. */
.ds-split { display: grid; gap: var(--space-6); }
.ds-split > * { min-width: 0; }
.ds-split > * > .ds-section:first-child { margin-top: 0; }
@container (max-width: 959px) { .ds-split.is-detail > .ds-split-list { display: none; } }
@container (min-width: 960px) {
  .ds-split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .ds-split.is-main-first { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .ds-split-side { position: sticky; top: var(--space-4); }
  .ds-split > .ds-split-list > .ds-properties.is-groups:first-child { margin-top: 0; }
}
/* The row whose detail is open beside the list. */
.ds-split-list .ds-row[aria-current="page"] { background: var(--color-accent-soft); box-shadow: inset 3px 0 0 var(--color-link); }
.ds-split-list .ds-row[aria-current="page"] .ds-row-title { color: var(--color-link); }
/* The bar's account button never runs past the screen (the Staff screen's email at 390px): the wordmark keeps its
   size, the button takes what's left and ends in an ellipsis. Block, not flex, so the ellipsis applies to its text. */
.ds-bar > .ds-wordmark { flex: none; }
.ds-bar > .ds-bar-end { flex: 1 1 auto; justify-content: flex-end; }
.ds-bar-end .ds-bar-action { position: relative; display: block; max-width: 100%; padding-right: calc(var(--space-3) + 14px); line-height: calc(var(--tap-min) - 2 * var(--rule-width)); }
.ds-bar-end .ds-bar-action::after { position: absolute; right: var(--space-3); top: 50%; margin-top: -5px; }
/* #96: an applicant's documents. On the application page, a group per kind (photo ID, proof of income, anything
   else), each a list of what's been added with a thumbnail and Remove, then its add button (a .ds-file label).
   On the Owner Screen's Application page the same rows, each opening its file. */
.ds-docs { margin: var(--space-5) 0 0; padding: 0; border: 0; min-width: 0; }
.ds-docs > legend { padding: 0; font-size: var(--type-base); }
.ds-doc-group { margin-top: var(--space-4); padding-top: var(--space-4); border-top: var(--rule-width) solid var(--color-rule); }
.ds-doc-label { margin: 0; font-size: var(--type-sm); line-height: var(--type-sm-lh); font-weight: var(--weight-semibold); }
.ds-doc-group > .ds-btn { margin-top: var(--space-3); }
.ds-doc-list { list-style: none; margin: 0; padding: 0; }
.ds-doc-list:not(:empty) { margin-top: var(--space-3); }
.ds-doc { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: var(--space-2) 0; }
.ds-doc + .ds-doc { border-top: var(--rule-width) solid var(--color-rule); }
.ds-doc-thumb { flex: none; display: grid; place-items: center; width: 56px; height: 42px; object-fit: cover; border-radius: var(--radius-control); border: var(--rule-width) solid var(--color-rule); background: var(--color-sunk); color: var(--color-muted); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.ds-doc-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ds-doc-size { display: block; color: var(--color-muted); font-size: var(--type-sm); }
.ds-doc-privacy { margin-top: var(--space-4); }

/* ---------- #104: a printable Rent Ledger statement */
.ds-ledger-out { margin-top: var(--space-2); }
.ds-statement { max-width: 880px; }
.ds-statement-from { margin: 0; color: var(--color-muted); font-size: var(--type-sm); font-weight: var(--weight-semibold); }
.ds-statement-terms { margin-top: var(--space-4); }
.ds-statement .ds-actions { margin-top: var(--space-5); }
.ds-statement-range { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); margin-top: var(--space-4); }
.ds-statement-range .ds-field { margin: 0; }
.ds-statement-table { width: 100%; margin-top: var(--space-5); border-collapse: collapse; background: var(--color-surface); font-size: var(--type-sm); }
.ds-statement-table th, .ds-statement-table td { padding: var(--space-2) var(--space-3); border-bottom: var(--rule-width) solid var(--color-rule); text-align: left; vertical-align: top; }
.ds-statement-table th { background: var(--color-sunk); color: var(--color-ink); font-weight: var(--weight-semibold); }
.ds-statement-table .is-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-statement-table td:first-child { white-space: nowrap; color: var(--color-muted); }
.ds-statement-table .is-total td { font-weight: var(--weight-semibold); color: var(--color-ink); }
.ds-statement-table .is-cancelled td:not(:first-child) { color: var(--color-muted); }
.ds-statement-note { display: block; color: var(--color-muted); }
/* The setup checklist on Home (#113). */
.ds-checklist-steps { list-style: none; margin: var(--space-3) 0 0; padding: 0; border-top: var(--rule-width) solid var(--color-rule); }
.ds-checklist-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: var(--rule-width) solid var(--color-rule); }
.ds-checklist-mark { display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--color-rule-strong, var(--color-rule)); border-radius: 50%; }
.ds-checklist-step.is-done .ds-checklist-mark { border-color: var(--color-paid); color: var(--color-paid); }
.ds-checklist-step.is-next .ds-checklist-mark { border-color: var(--color-primary); }
.ds-checklist-title { margin: 0; font-weight: var(--weight-semibold); }
.ds-checklist-step.is-done .ds-checklist-title { font-weight: var(--weight-regular); color: var(--color-muted); }
.ds-checklist-body .ds-hint { margin: 2px 0 0; }
@container (max-width: 560px) {
  .ds-checklist-step { grid-template-columns: 28px minmax(0, 1fr); }
  .ds-checklist-step > .ds-btn { grid-column: 2; justify-self: start; }
}
/* Telling Tenants the number (#113): the text, and a notice per door that prints one to a page. */
.ds-quote { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); max-width: 60ch; background: var(--color-surface); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-box); }
.ds-notices { display: none; }

@media print {
  .ds-rail, .ds-bar, .ds-tabs, .ds-skip, .ds-no-print, .ds-toast-region { display: none !important; }
  :root, .ds { color-scheme: light !important; }
  .ds, .ds-main, .ds-statement-table { background: var(--color-surface) !important; color: var(--color-ink) !important; }
  .ds-main { padding: 0 !important; margin: 0 !important; }
  .ds-shell, .ds-app { display: block !important; }
  .ds-statement { max-width: none; }
  .ds-statement-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ds-statement-table tr { break-inside: avoid; }
  .ds-statement-table thead { display: table-header-group; }
  .ds-notices { display: block; }
  .ds-notice { break-after: page; min-height: 90vh; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 0; }
  .ds-notice:last-child { break-after: auto; }
  .ds-notice-to { font-size: 16pt; margin: 0 0 24pt; }
  .ds-notice-head { font-size: 24pt; font-weight: var(--weight-semibold); margin: 0; }
  .ds-notice-number { font-size: 56pt; font-weight: var(--weight-bold, 700); letter-spacing: -0.01em; margin: 12pt 0; font-variant-numeric: tabular-nums; }
  .ds-notice-text { font-size: 16pt; margin: 0 auto; max-width: 30em; }
  .ds-notice-from { font-size: 16pt; margin: 36pt 0 0; font-weight: var(--weight-semibold); }
}


/* ---------- plan and billing on the Account page (#109): the price large, the status under it */

.ds-plan > * + * { margin-top: var(--space-2); }
.ds-plan > p { margin-bottom: 0; }
.ds-plan-price { margin: 0; font-size: var(--type-lg); line-height: var(--type-lg-lh); font-weight: var(--weight-semibold); }
.ds-plan-status { font-weight: var(--weight-medium); }
.ds-plan-status.is-owed { color: var(--color-owed); }
.ds-plan .ds-actions { margin-top: var(--space-3); }
