/* selfmanaged — the hand-drawn look (Allan, 18 Nov 2026: "Yes build it all, like you have shown"). Loaded last, by
   app.html only, so the tenant's page, the trade's page and the Staff area keep the look they have.

   What it changes, and nothing else:
   - The page is white and what is set off on it is the quiet grey: the three-tab look's page and card, the other way
     round (tokens.css: --hand-page, --hand-panel, --hand-inset; every pair of them is one the contrast table already
     holds, a card's words on the page's grey and the page's words on a card's white).
   - One left edge. A screen's title, a group's name, a row's words and the words inside a panel all start at the same
     place (--gutter, 20px): a panel reaches 12px past it on each side and has 12px inside.
   - A group is an ink rule and its name, then its rows, each under a hairline. A property on Properties is a group.
   - What you tap to do something is a pill: one filled blue on a screen, the rest quiet.
   - An emergency is a red panel with white words (the app's own red ground, .is-alarm), wherever it is drawn.
   Sizes of words are the app's own (--fs-*), so Text Size and the phone's own setting still move everything.
   No colour is written here: tokens.css only. */

:root {
  --paper: var(--hand-page);
  --white: var(--hand-panel);
  --wash: var(--hand-inset);
  --bar: var(--hand-page);
  --late-wash: var(--hand-panel); --soon-wash: var(--hand-panel); --fine-wash: var(--hand-panel); --destructive-wash: var(--hand-panel);
  --gutter: 20px;
  --panel-out: 12px;                                   /* how far a panel reaches past the words' edge */
  --panel-l: calc(var(--pad-l) - var(--panel-out));
  --panel-r: calc(var(--pad-r) - var(--panel-out));
  --panel-radius: 20px;
}

/* ── a screen's title ─────────────────────────────────────────────────────────────────────────────────────────── */
.page-head { padding: 8px var(--pad-r) 20px var(--pad-l); align-items: flex-end; }
.page-head .page-date { padding-bottom: 0.2em; }
.page-head-stack .page-date { margin-top: 4px; padding-bottom: 0; text-wrap: balance; }
h1 { letter-spacing: -0.03em; }

/* ── a group: an ink rule, its name, its rows ─────────────────────────────────────────────────────────────────── */
.group { margin-top: 24px; }
.page > .group > .group-title, .page > div > .group > .group-title, .page > .group > .info-head > .group-title,
.glabel {
  margin: 0 var(--pad-r) 0 var(--pad-l); padding: 16px 0;
  border-top: 2px solid var(--ink);
  font-size: var(--fs-title2); line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance;
}
.glabel { margin-top: 24px; }
.glabel .n { float: right; font-size: var(--fs-body); line-height: calc(1.25 * var(--fs-title2)); letter-spacing: 0; }
.group-sub { padding: 0 var(--pad-r) 16px var(--pad-l); }

/* A group's name with its information button beside it: the rule runs over both. */
.page > .group > .info-head, .page > div > .group > .info-head { margin: 0 var(--pad-r) 0 var(--pad-l); border-top: 2px solid var(--ink); }
.page > .group > .info-head, .page > div > .group > .info-head { padding-top: 16px; }
.page > .group > .info-head > .group-title, .page > div > .group > .info-head > .group-title { flex: 1 1 auto; margin: 0; padding-top: 0; border-top: 0; }

/* ── rows, straight on the page: a hairline over each ─────────────────────────────────────────────────────────── */
.rows { --sep-inset: var(--pad-l); --sep-inset-r: var(--pad-r); margin: 0; background: none; border-radius: 0; overflow: visible; }
.rows > li::before { content: ''; position: absolute; top: 0; left: var(--sep-inset); right: var(--sep-inset-r); border-top: 1px solid var(--hair); pointer-events: none; }
.rows > li + li::before { right: var(--sep-inset-r); }
.rows .row { min-height: 56px; padding: 16px var(--pad-r) 16px var(--pad-l); }
.row .nm { font-size: var(--fs-body); line-height: 1.4; letter-spacing: 0; }
.row .s { line-height: 1.35; }
.row .nm + .s, .row .nm + .s + .s { margin-top: 4px; }
.chev { color: var(--ink); }
a.row:hover { background: none; }
a.row:active { background: var(--navy-tint); }
:is(.card, .state-card, .form, .subform, .step, .sheet-group, .row-stack, .lawbox, .law-body) .rows { --sep-inset: 0px; --sep-inset-r: 0px; }
:is(.card, .state-card, .form, .subform, .step, .sheet-group, .row-stack, .lawbox, .law-body) .rows .row { padding-left: 0; padding-right: 0; }
.page > :is(.rows, .cards, .home-cards, .all-tiles) + :is(.rows:not(.rows-top, .calls-keep), .cards, .home-cards, .all-tiles) { margin-top: 24px; }

/* ── what folds: a row with a down arrow, opening in place ────────────────────────────────────────────────────── */
details.area, details.fold { margin: 0; background: none; overflow: visible; }
details.area:not(details.area + details.area), details.area:not(:has(+ details.area)),
details.fold:not(details.fold + details.fold), details.fold:not(:has(+ details.fold)) { border-radius: 0; }
details.area:not(:has(+ details.area)) { margin-bottom: 0; }
details.area::before, details.fold::before,
details.area + details.area::before, details.fold + details.fold::before {
  content: ''; position: absolute; top: 0; left: var(--pad-l); right: var(--pad-r); z-index: 1; border-top: 1px solid var(--hair); pointer-events: none;
}
details.area > summary, details.fold > summary { min-height: 56px; padding: 16px var(--pad-r) 16px var(--pad-l); }
details.area > summary .nm { font-size: var(--fs-body); line-height: 1.4; letter-spacing: 0; }
details.area > summary .s, details.fold > summary .fold-line { margin-top: 4px; line-height: 1.35; }
details.area > summary .icon-down, details.fold > summary .icon-down { color: var(--ink); }
details.area > .area-body { border-top: 0; padding-bottom: 16px; }
details.fold > .fold-body { padding: 0 var(--pad-r) 16px var(--pad-l); }
details.area > .area-body > section.group > .group-title { padding-left: var(--pad-l); padding-right: var(--pad-r); }
:is(.card, .state-card, .form, .subform) details.fold > summary { padding-left: 0; padding-right: 0; }
:is(.card, .state-card, .form, .subform) details.fold > .fold-body { padding-left: 0; padding-right: 0; }
:is(.card, .state-card, .form, .subform) details.fold::before { left: 0; right: 0; }

/* ── a property on Properties, a person on People: a group, not a card ────────────────────────────────────────── */
.home-cards { gap: 24px; }
.home-card { gap: 0; padding: 0; background: none; border-radius: 0; box-shadow: inset 0 2px 0 var(--ink); }
.home-card:active { background: none; opacity: 0.6; }
.home-top { min-height: 60px; gap: 12px; padding: 16px 0; }
.home-name { line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
.home-line { padding: 16px 0; line-height: 1.4; box-shadow: inset 0 1px 0 var(--hair); text-wrap: balance; }
.home-top:has(+ .home-where) { min-height: 0; padding-bottom: 0; }
.home-line.home-where { padding: 4px 0 16px; box-shadow: none; }
.home-line.home-where + .home-where { margin-top: -16px; }
.home-card .row-pill { margin: 0 0 16px; }

/* ── the two tiles ────────────────────────────────────────────────────────────────────────────────────────────── */
.all-tiles { gap: 8px; margin: 0 var(--panel-r) 24px var(--panel-l); }
.all-tile { position: relative; min-height: 80px; gap: 4px; padding: 12px 44px 12px var(--panel-out); border-radius: var(--panel-radius); }
.all-tile::after {
  content: ''; position: absolute; top: 50%; right: var(--panel-out); width: 1.1em; height: 1.1em; margin-top: -0.55em;
  background: currentColor;
  -webkit-mask: var(--hand-chevron) center / contain no-repeat; mask: var(--hand-chevron) center / contain no-repeat;
}
.all-tile-name { font-size: var(--fs-body); line-height: 1.4; }
.all-tile-line { line-height: 1.35; }
.all-tile-line:not(.is-urgent) { color: var(--muted); }

/* ── a panel: the one thing a screen is about, or a thing to look at ──────────────────────────────────────────── */
.card, .card.c, .state-card { margin: 0 var(--panel-r) 12px var(--panel-l); padding: 16px var(--panel-out); border-radius: var(--panel-radius); }
:is(.card, .state-card) .card { margin-left: 0; margin-right: 0; }
.cards { margin-top: 0; }
.q { text-wrap: balance; }

/* ── buttons ──────────────────────────────────────────────────────────────────────────────────────────────────── */
.btn { min-height: 52px; border-radius: 26px; font-size: var(--fs-body); }
.btn.ghost, .btn.quiet, .btn.destructive { min-height: 52px; background: var(--white); border-color: transparent; }
.btn.ghost:hover, .btn.quiet:hover, .btn.destructive:hover { background: var(--white); }
.btn.ghost:active, .btn.quiet:active, .btn.destructive:active { background: var(--navy-tint); border-color: transparent; }
:is(.card, .state-card, .sheet-group, .form-inset, .subform, .addr-find, .steps) :is(.btn.ghost, .btn.quiet, .btn.destructive) { background: var(--wash); }
.btn-sm { min-height: 44px; border-radius: 22px; }

/* A thing that isn't waiting on you (no tone): its words and its button straight on the page, under a hairline, so a
   screen of them isn't a pile of grey boxes; the ones that are waiting stay panels. */
.cards > .card.c:not(.is-late, .is-soon, .is-alarm) {
  margin: 0 var(--pad-r) 0 var(--pad-l); padding: 16px 0; background: none; border-radius: 0; box-shadow: inset 0 1px 0 var(--hair);
}
.cards > .card.c:not(.is-late, .is-soon, .is-alarm) :is(.btn.ghost, .btn.quiet, .btn.destructive) { background: var(--white); }
.cards > .card.c:not(.is-late, .is-soon, .is-alarm) .field :is(input, select, textarea) { background-color: var(--paper); }
.cards > .card.c:is(.is-late, .is-soon, .is-alarm) + .card.c:not(.is-late, .is-soon, .is-alarm) { margin-top: 16px; }
/* More, when it is all a thing has: in the thing's top corner, not on a row of its own, above the title (.q is 1), which
   otherwise takes the tap. */
.c > .row2 > .actions:not(:has(> .btn)) { position: absolute; top: 4px; right: 0; margin: 0; z-index: 2; }
/* A :has() inside a :has() is no selector at all, so this is two on the thing itself (24 Nov 2026: the title kept no room for it). */
.c:has(> .row2 > .actions):not(:has(> .row2 > .actions > .btn)) > .q { padding-right: 48px; }
.card.c:is(.is-late, .is-soon, .is-alarm) > .row2 > .actions:not(:has(> .btn)) { right: 4px; }
/* On a row that swipes too (a tenancy on Rent): the swipe's transform on .row2 would make that line, not the thing, what More
   is placed against, so it sat on the end of the state. There the swipe moves the line's parts instead (24 Nov 2026). */
.c.swipe-row > .row2:has(> .actions):not(:has(> .actions > .btn)) { transform: none; }
.c.swipe-row > .row2:has(> .actions):not(:has(> .actions > .btn)) > * { transform: translateX(var(--swipe-x, 0px)); transition: transform 0.2s ease; }
.c.swipe-row.is-dragging > .row2:has(> .actions):not(:has(> .actions > .btn)) > * { transition: none; }

/* ── a screen's first block sits straight under its title ─────────────────────────────────────────────────────── */
.page-head + :is(.glabel, .group), .page-head + div:empty + :is(.glabel, .group) { margin-top: 0; }
.pad.toolbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; padding-top: 0; }
.pad.toolbar > .btn { min-width: 0; }
/* No ragged right edge, anywhere (Allan, 18 Nov 2026, of four buttons each its own width: "it looks terrible"). A
   button alone is as wide as the words' column; buttons side by side share it between them. Measured over every
   screen the sample reaches, at 390 wide: no row of buttons ends short of its column. What stays its own size: More
   and The Law beside a button, a small button at the end of a row, and a form's Cancel and Save at its two ends. */
.actions > .btn { flex: 1 1 auto; }
:is(.pad, .form, .fold-body, .area-body, .card, .state-card, .row-stack, .forgot, .notice, .addr-find) > .btn:not(.btn-sm) { display: flex; width: 100%; }
/* Buttons side by side are the same height, whichever has the most words or is the small kind; what isn't a button
   (More, The Law, a link) keeps its own size beside them. */
.actions { align-items: stretch; }
.actions > :not(.btn) { align-self: center; }
.actions > .btn-sm { border-radius: 26px; }
.address-row > .btn { flex: 1 1 100%; }

/* ── the boxes that kept an edge of their own: each now starts on the one edge ────────────────────────────────── */
/* Set up's steps, and a tenancy's start and end lists: the step's words and its buttons. */
details.sl-step > .sl-body { padding: 0 var(--pad-r) 16px var(--pad-l); }
details.sl-step .sl-own > section.group { margin-left: calc(-1 * var(--pad-l)); margin-right: calc(-1 * var(--pad-r)); }
details.sl-step .sl-own > :is(.agreement-slot, .agreement-check) .pad { padding-left: 0; padding-right: 0; }
/* The steps of serving a document: one panel, its marks on the edge. */
.steps { margin: 16px var(--panel-r) 0 var(--panel-l); border-radius: var(--panel-radius); }
.step-head { padding: 16px var(--panel-out); }
.step-body > .form { padding-left: var(--panel-out); padding-right: var(--panel-out); }
.help-body ol.steps { margin-left: calc(-1 * var(--panel-out)); margin-right: calc(-1 * var(--panel-out)); padding: 12px var(--panel-out); }
/* The address finder: a panel, not an outlined box. */
.form > .addr-find { margin-left: calc(-1 * var(--panel-out)); margin-right: calc(-1 * var(--panel-out)); padding: 12px var(--panel-out); border: 0; border-radius: var(--panel-radius); background: var(--white); }
:is(.card, .state-card, .subform, .form-inset) .addr-find { margin-left: 0; margin-right: 0; background: var(--wash); }

/* ── a property's own buttons: the two you use most as pills side by side, and the two that open something here as
   rows under them. They are drawn in that order; they are read and reached in the order they are written, Record
   Conversation first (units-pages.cases.js, 6.3). With one pill it has the whole width; with three, the third has. */
.prop-actions { gap: 0 8px; align-items: stretch; padding-top: 0; }
.prop-actions > .btn { order: 1; flex: 1 1 calc(50% - 4px); min-width: 0; margin-bottom: 8px; }
.prop-actions > :is([data-focus-key="record-conversation"], [data-focus-key="prop-ring-someone"]) {
  order: 2; flex: 1 1 100%; justify-content: space-between; margin-bottom: 0; min-height: 56px; padding: 16px 0;
  border: 0; border-radius: 0; background: none; color: var(--ink); font-weight: var(--w-regular); text-align: left;
  box-shadow: inset 0 1px 0 var(--hair);
}
.prop-actions > [data-focus-key="record-conversation"] { box-shadow: none; }
.prop-actions > :is([data-focus-key="record-conversation"], [data-focus-key="prop-ring-someone"])::after {
  content: ''; flex: none; width: 1.1em; height: 1.1em; background: currentColor; transform: rotate(90deg);
  -webkit-mask: var(--hand-chevron) center / contain no-repeat; mask: var(--hand-chevron) center / contain no-repeat;
}
.prop-actions > :is([data-focus-key="record-conversation"], [data-focus-key="prop-ring-someone"]):is(:hover, :active) { background: none; }
.prop-actions > :is([data-focus-key="record-conversation"], [data-focus-key="prop-ring-someone"]):active { opacity: 0.55; }
.sk-key.sk-top { margin: 0 var(--pad-r) 16px var(--pad-l); }

/* ── an emergency: the red ground, as a panel ─────────────────────────────────────────────────────────────────── */
.home-line.is-alarm {
  margin: 0 calc(-1 * var(--panel-out)) 8px; padding: 16px var(--panel-out); border-radius: var(--panel-radius); box-shadow: none;
  font-weight: var(--w-medium);
}
.home-line.is-alarm + .home-line { box-shadow: none; }
.home-line.is-alarm .home-sep { display: none; }
.home-line.is-alarm .home-why { display: block; margin-top: 4px; font-weight: var(--w-regular); }
/* A card with an emergency (views/properties.js splitLines()): the emergency is a link of its own, to the emergency, with
   the arrow that says so; the card's own link reaches over the whole card beneath it, so a tap anywhere else still opens
   the property, or the person. */
.home-cards > li.home-split { position: relative; display: block; }
/* Every line that has somewhere to go is a link of its own, with the arrow that says so (lineHrefs()). */
.home-split a.home-line { position: relative; z-index: 1; display: block; padding-right: calc(1.1em + 12px); color: inherit; text-decoration: none; }
.home-split a.home-line::after {
  content: ''; position: absolute; top: 50%; right: 0; width: 1.1em; height: 1.1em; margin-top: -0.55em; background: currentColor;
  -webkit-mask: var(--hand-chevron) center / contain no-repeat; mask: var(--hand-chevron) center / contain no-repeat;
}
.home-split a.home-line:active { opacity: 0.6; }
.home-split a.home-line:focus-visible { outline-offset: 2px; }
.home-split > .home-card::after { content: ''; position: absolute; inset: 0; }
.home-split > a.home-line.is-alarm { position: relative; z-index: 1; display: block; padding-right: calc(var(--panel-out) + 1.1em + 12px); color: var(--on-alarm); text-decoration: none; }
.home-split > a.home-line.is-alarm::after {
  content: ''; position: absolute; top: 50%; right: var(--panel-out); width: 1.1em; height: 1.1em; margin-top: -0.55em; background: currentColor;
  -webkit-mask: var(--hand-chevron) center / contain no-repeat; mask: var(--hand-chevron) center / contain no-repeat;
}
.home-split > a.home-line.is-alarm:active { opacity: 0.7; }
.home-split > a.home-line.is-alarm:focus-visible { outline-offset: 2px; }
.home-split > .home-rest > .home-line:first-child { box-shadow: none; }
.home-split > :is(.btn, .ft-ring, div:not(.home-rest)) { position: relative; z-index: 1; }
.card.is-alarm { background: var(--alarm); color: var(--on-alarm); }
/* An open emergency's own page: its title, its drawing and its state are one red panel, as wide as any panel. */
.page-head.is-alarm { margin: 0 var(--panel-r) 0 var(--panel-l); padding: 16px var(--panel-out) 12px; border-radius: var(--panel-radius) var(--panel-radius) 0 0; }
.page-head.is-alarm ~ .sk-inset.is-alarm { margin: 0 var(--panel-r) 0 var(--panel-l); }
.page-head.is-alarm ~ .state-card.is-alarm { border-radius: 0 0 var(--panel-radius) var(--panel-radius); }
/* On the red ground a quiet button is an outline in the ground's own white, as the app draws it there. */
.is-alarm :is(.btn.ghost, .btn.quiet, .btn.destructive), .is-alarm :is(.btn.ghost, .btn.quiet, .btn.destructive):hover { background: transparent; border-color: var(--on-alarm-2); }

/* ── traffic lights (Allan, 18 Nov 2026: "we need to go to a good old fashioned traffic light system. Anything that's
   enough to notify the landlord in the app should be amber with emergencies in red") ───────────────────────────────
   Red is an emergency's alone, wherever it is drawn (the red ground, above). Amber is everything else that is waiting on
   you: what a badge counts on a property's or a person's card, a thing to look at that is late or soon, a tile with
   anything in it, and the badge itself. Nothing else is coloured: what isn't waiting stays plain. On amber everything is
   drawn in amber's own colours, as on the red ground (the names re-pointed here), so no red word sits on it. */
.home-amber, .all-tile.is-amber, .card.c:is(.is-late, .is-soon):not(.is-alarm), .state-card:is(.is-late, .is-soon):not(.is-alarm) {
  --paper: var(--amber); --white: var(--amber-inset); --wash: var(--amber-inset);
  --ink: var(--on-amber); --muted: var(--on-amber-2); --muted-2: var(--on-amber-2);
  --late: var(--on-amber); --soon: var(--on-amber); --fine: var(--on-amber); --destructive: var(--on-amber);
  --navy: var(--on-amber); --on-navy: var(--amber-inset); --navy-hover: var(--on-amber-2); --navy-press: var(--on-amber-2); --navy-tint: var(--amber-inset);
  --line: var(--amber-hair); --hair: var(--amber-hair); --rule: var(--on-amber-2); --field: var(--on-amber-2); --focus: var(--on-amber);
  background: var(--amber); color: var(--on-amber);
}
.home-amber { margin: 0 calc(-1 * var(--panel-out)) 8px; padding: 0 var(--panel-out); border-radius: var(--panel-radius); }
.home-amber > .home-line:first-child { box-shadow: none; }
.home-amber + .home-rest > .home-line:first-child, .home-split > a.home-line.is-alarm + .home-amber { box-shadow: none; }
.home-rest:empty { display: none; }
/* The badge: amber, and red only on a card or a row that holds an emergency. */
/* On the white page a pale disc needs an edge to be seen: the handle's own brass, drawn inside it. */
.badge { background: var(--amber); color: var(--on-amber); box-shadow: inset 0 0 0 1.5px var(--amber-hair); }
.home-split.has-alarm .badge, .rows > li.has-alarm .badge, .unfiled-rows .row:has(.nm.is-urgent) .badge { background: var(--alarm); color: var(--on-alarm); box-shadow: none; }
/* A late line that isn't an emergency is said in bold, not in red, where it isn't already on amber. */
.count-rows > li:not(.has-alarm) .s.is-urgent, details.area > summary .s.late, details.fold > summary .fold-line.late,
.eyebrow.late, .pill.late, .hint.over { color: var(--ink); }
.all-tile.is-alarm { background: var(--alarm); color: var(--on-alarm); }
.all-tile.is-alarm .all-tile-line, .all-tile.is-amber .all-tile-line { color: inherit; }

/* ── boxes you type in: white, with an edge ───────────────────────────────────────────────────────────────────── */
.field input, .field select, .field textarea { background-color: var(--paper); border-radius: 12px; }
:is(.card, .state-card, .form-inset, .subform, .addr-find, .steps) .field :is(input, select, textarea) { background-color: var(--wash); }

/* ── the bars ─────────────────────────────────────────────────────────────────────────────────────────────────── */
.tabbar::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 24px; margin-bottom: 1px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bar));
}
.demo-banner { background: var(--white); }

/* ── Sign in: the front door, then the form (Allan, 18 Nov 2026: "add the photo") ─────────────────────────────── */
.page.auth-in::before {
  content: ''; display: block; height: 160px; margin: 8px var(--panel-r) 0 var(--panel-l); border-radius: var(--panel-radius);
  background: var(--white) url("../img/signin-door.jpg") 50% 46% / cover no-repeat;
}
.auth .page-head { padding-top: 16px; padding-bottom: 0; }
.auth .lede-flush { padding-top: 8px; text-wrap: pretty; }
.auth .form { padding-top: 16px; }
