/* James & Jamie Rentals: the component stylesheet.
   Plain CSS, no build step. Load after tokens.css. Put class "jj" on one wrapper element inside body.
   Phone first. One wide breakpoint at 900px, written as a container query on the root so a page responds to
   the width it is given. Every value comes from a token; type sizes mirror the text styles in tokens.json. */

/* ---------- Base ---------- */
.jj { container: jj / inline-size; font-family: var(--font-sans); font-size: 16px; line-height: 24px; font-weight: 400; color: var(--ink); background: var(--ground); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
.jj, .jj *, .jj *::before, .jj *::after { box-sizing: border-box; }
.jj :where(h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset) { margin: 0; }
.jj :where(ul, ol) { padding: 0; list-style: none; }
.jj :where(fieldset) { padding: 0; border: 0; min-width: 0; }
.jj :where(legend) { padding: 0; }
.jj :where(a) { color: inherit; text-decoration: none; }
.jj :where(button, input, select, textarea) { font: inherit; color: inherit; margin: 0; }
.jj :where(button) { background: none; border: 0; padding: 0; cursor: pointer; }
.jj :where(img, svg) { display: block; max-width: 100%; }
.jj :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.jj ::selection { background: var(--accent-soft); color: var(--ink); }
.jj-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Type ---------- */
.jj-welcome { font: 800 36px/42px var(--font-display); letter-spacing: -0.015em; text-wrap: balance; }
.jj-h1 { font: 700 28px/34px var(--font-display); letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; }
.jj-h2 { font: 700 20px/26px var(--font-display); letter-spacing: -0.005em; text-wrap: balance; }
.jj-h3 { font: 600 17px/24px var(--font-sans); }
.jj-lede { font-size: 17px; line-height: 26px; color: var(--ink-2); max-width: var(--read-max); text-wrap: pretty; }
.jj-prose { color: var(--ink-2); max-width: var(--read-max); text-wrap: pretty; }
.jj-muted { color: var(--ink-2); }
.jj-meta { font-size: 14px; line-height: 20px; color: var(--ink-3); }
.jj-link { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
/* A link that stands alone as an action (not inside a sentence) gets a full 44px target. */
.jj-link--tap, .jj-sectionhead > .jj-link, .jj-row__end > .jj-link, .jj-table td > .jj-link { display: inline-flex; align-items: center; min-height: var(--tap-min); }
.jj-money { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.jj-money--hero { font: 600 34px/40px var(--font-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.jj-money--bad { color: var(--bad); }
.jj-per { font-size: 14px; line-height: 20px; font-weight: 400; color: var(--ink-3); }

/* ---------- Layout helpers ---------- */
.jj-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.jj-stack--tight { gap: var(--space-2); }
.jj-stack--loose { gap: var(--space-6); }
.jj-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.jj-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.jj-split, .jj-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
.jj-divider { height: 1px; border: 0; background: var(--line); margin: 0; }

/* ---------- Shell: header, navigation, page ---------- */
.jj-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.jj-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-2); min-height: var(--header-h); padding: 0 var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.jj-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); margin-right: auto; font: 700 17px/24px var(--font-display); color: var(--ink); white-space: nowrap; }
.jj-mark { display: inline-grid; place-items: center; height: 28px; padding: 2px 7px 0; border-radius: var(--radius-sm); background: var(--plaque); color: var(--on-plaque); font: 800 14px/1 var(--font-display); }
.jj-brand__long { display: none; }
.jj-corner { display: flex; align-items: center; }
.jj-corner a { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 var(--space-2); border-radius: var(--radius-md); font-weight: 600; color: var(--ink); transition: background-color var(--dur-fast) var(--ease-out); }
.jj-corner a + a { margin-left: var(--space-1); }
.jj-who { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-2); border-radius: var(--radius-md); font-weight: 600; color: var(--ink); }
.jj-who svg { width: 20px; height: 20px; color: var(--ink-3); }
.jj-topnav, .jj-side { display: none; }
.jj-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jj-page { flex: 1; width: 100%; max-width: var(--content-max); margin-inline: auto; padding: var(--space-5) var(--space-4) var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }
.jj-page--narrow { max-width: calc(var(--form-max) + 2 * var(--space-4)); }
.jj-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); }
.jj-pagehead__main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.jj-back { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding-right: var(--space-2); font-weight: 600; color: var(--ink-2); }
.jj-back::before { content: ""; width: 9px; height: 9px; margin-left: 3px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.jj-section { display: flex; flex-direction: column; gap: var(--space-3); }
.jj-sectionhead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }

.jj-footer { padding: var(--space-6) var(--space-4); border-top: 1px solid var(--line); font-size: 14px; line-height: 20px; color: var(--ink-3); }

/* Bottom tab bar: phones only. Sticky, so it works inside any scrolling root. */
.jj-tabs { position: sticky; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line); }
.jj-tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar-h); font: 600 13px/18px var(--font-sans); color: var(--ink-3); }
.jj-tabs a[aria-current="page"] { color: var(--accent); }
.jj-tabs svg { width: 24px; height: 24px; }
.jj-tabs .jj-badge { position: absolute; top: 6px; left: calc(50% + 6px); }

/* ---------- Buttons ---------- */
.jj .jj-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-h); padding: 0 var(--control-px); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 600 16px/24px var(--font-sans); text-align: center; cursor: pointer; user-select: none; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.jj .jj-btn:active { transform: scale(0.98); }
.jj .jj-btn svg { width: 20px; height: 20px; flex: none; }
.jj .jj-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.jj .jj-btn--quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 0 var(--space-3); }
.jj .jj-btn--danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.jj .jj-btn--danger-quiet { border-color: transparent; background: transparent; color: var(--bad); padding: 0 var(--space-3); }
.jj .jj-btn--block { display: flex; width: 100%; }
.jj .jj-btn:disabled, .jj .jj-btn[aria-disabled="true"] { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; transform: none; }
.jj .jj-btn[aria-busy="true"] { pointer-events: none; }
.jj .jj-btn[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: var(--radius-full); animation: jj-spin 600ms linear infinite; }
@keyframes jj-spin { to { transform: rotate(360deg); } }
.jj-iconbtn { display: inline-grid; place-items: center; flex: none; width: var(--tap-min); height: var(--tap-min); border-radius: var(--radius-md); color: var(--ink-2); transition: background-color var(--dur-fast) var(--ease-out); }
.jj-iconbtn svg { width: 22px; height: 22px; }
.jj-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------- Pills, badges, chips ---------- */
/* A pill hugs its text. Never give it a width, a fixed height or overflow: hidden. */
.jj-pill { display: inline-flex; align-items: center; flex: none; gap: var(--space-1); min-height: var(--pill-h); padding: 3px var(--pill-px); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font: 600 13px/18px var(--font-sans); white-space: nowrap; vertical-align: middle; }
.jj-pill svg { width: 14px; height: 14px; flex: none; }
.jj-pill--good { background: var(--good-soft); color: var(--good); }
.jj-pill--warn { background: var(--warn-soft); color: var(--warn); }
.jj-pill--bad { background: var(--bad-soft); color: var(--bad); }
.jj-pill--info { background: var(--info-soft); color: var(--info); }
.jj-pill--wrap { white-space: normal; flex: 0 1 auto; }
.jj-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-full); background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.jj-badge--quiet { background: var(--surface-2); color: var(--ink-2); }
.jj-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.jj-chip { position: relative; display: inline-flex; }
.jj-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.jj-chip span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--chip-h); padding: 0 var(--chip-px); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); font-weight: 600; white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.jj-chip input:active + span { transform: scale(0.98); }
.jj-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.jj-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.jj-chip input:disabled + span { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); }
.jj-chips--fill { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.jj-chips--fill .jj-chip, .jj-chips--fill .jj-chip span { width: 100%; }

/* ---------- Forms ---------- */
.jj-form { display: flex; flex-direction: column; gap: var(--space-5); }
.jj-formsection { display: flex; flex-direction: column; gap: var(--space-5); }
.jj-formsection + .jj-formsection { padding-top: var(--space-6); border-top: 1px solid var(--line); }
.jj-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jj-label { font: 600 14px/20px var(--font-sans); color: var(--ink); }
.jj-optional { font-weight: 400; color: var(--ink-3); }
.jj-hint { font-size: 14px; line-height: 20px; color: var(--ink-3); }
.jj-error { font: 600 14px/20px var(--font-sans); color: var(--bad); }
.jj-input, .jj-select, .jj-textarea { display: block; width: 100%; min-height: var(--control-h); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 400 16px/24px var(--font-sans); caret-color: var(--accent); appearance: none; -webkit-appearance: none; transition: border-color var(--dur-fast) var(--ease-out); }
.jj-input::placeholder, .jj-textarea::placeholder { color: var(--ink-3); opacity: 1; }
.jj-input:focus-visible, .jj-select:focus-visible, .jj-textarea:focus-visible { border-color: var(--accent); outline-offset: 1px; }
.jj-input[aria-invalid="true"], .jj-select[aria-invalid="true"], .jj-textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.jj-input:disabled, .jj-select:disabled, .jj-textarea:disabled { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); }
.jj-textarea { min-height: 120px; resize: vertical; }
.jj-textarea--short { min-height: 72px; }
.jj-selectwrap { position: relative; }
.jj-selectwrap .jj-select { padding-right: 44px; }
.jj-selectwrap::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.jj-affix { position: relative; }
.jj-affix > span { position: absolute; top: 12px; left: 14px; color: var(--ink-3); pointer-events: none; }
.jj-affix > span + .jj-input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.jj-affix > .jj-affix__end { left: auto; right: 14px; font-size: 14px; }
.jj-affix > .jj-affix__btn { position: absolute; top: 2px; right: 2px; min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius-sm); font-weight: 600; color: var(--accent); }
.jj-affix .jj-input--action { padding-right: 76px; }
.jj-fieldrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.jj-fieldrow--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.jj-check { display: flex; align-items: flex-start; gap: var(--space-3); min-height: var(--tap-min); padding: 10px 0; cursor: pointer; }
.jj-check input { appearance: none; -webkit-appearance: none; flex: none; display: grid; place-content: center; width: 22px; height: 22px; margin-top: 1px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.jj-check input:checked { background: var(--accent); border-color: var(--accent); }
.jj-check input:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.jj-check input[type="radio"] { border-radius: var(--radius-full); }
.jj-check input[type="radio"]:checked::after { width: 10px; height: 10px; border: 0; border-radius: var(--radius-full); background: var(--on-accent); transform: none; }
.jj-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--control-h); cursor: pointer; }
.jj-switch__text { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.jj-switch__text small { font-size: 14px; line-height: 20px; font-weight: 400; color: var(--ink-3); }
.jj-switch input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 48px; height: 28px; border-radius: var(--radius-full); background: var(--line-strong); cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out); }
.jj-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--surface); transition: transform var(--dur-fast) var(--ease-in-out); }
.jj-switch input:checked { background: var(--accent); }
.jj-switch input:checked::after { transform: translateX(20px); }
.jj-segment { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--surface-2); }
.jj-segment label { position: relative; display: flex; }
.jj-segment input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.jj-segment span { flex: 1; display: flex; align-items: center; justify-content: center; min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: 8px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background-color var(--dur-fast) var(--ease-out); }
.jj-segment input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.jj-segment input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
/* More details: optional fields stay folded until someone wants them. Native details, so it works with no script. */
.jj-fold { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.jj-fold > summary { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; cursor: pointer; list-style: none; font-weight: 600; }
.jj-fold > summary::-webkit-details-marker { display: none; }
.jj-fold > summary > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jj-fold > summary small { font-size: 14px; line-height: 20px; font-weight: 400; color: var(--ink-3); }
.jj-fold > summary::after { content: ""; flex: none; width: 9px; height: 9px; margin: 0 6px 4px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform var(--dur-base) var(--ease-in-out); }
.jj-fold[open] > summary::after { transform: translateY(4px) rotate(225deg); }
.jj-fold__body { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-2) 0 var(--space-6); }
/* The one Save. Sticks to the bottom on phones, sits under the form from 900px. */
.jj-formbar { position: sticky; bottom: 0; z-index: 15; display: flex; gap: var(--space-3); margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-10)); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.jj-formbar .jj-btn { flex: 1; }

/* ---------- Cards, lists, rows ---------- */
.jj-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.jj-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.jj-list > * + * { border-top: 1px solid var(--line); }
.jj-row { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: var(--space-3) var(--space-4); transition: background-color var(--dur-fast) var(--ease-out); }
.jj-row__lead { flex: none; }
.jj-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jj-row__title { font-weight: 600; overflow-wrap: anywhere; }
.jj-row__meta { font-size: 14px; line-height: 20px; color: var(--ink-3); overflow-wrap: anywhere; }
.jj-row__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-3); margin-top: 2px; }
.jj-row__meta .jj-money { color: var(--ink); }
.jj-row__end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); text-align: right; }
a.jj-row:active, button.jj-row:active { background: var(--surface-2); }
.jj-row[aria-current="true"] { background: var(--accent-soft); }
.jj-row--link::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); transform: rotate(45deg); }
.jj-thumb { width: 76px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); }
.jj-avatar { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--ink-2); font: 700 15px/1 var(--font-sans); }
.jj-avatar--sm { width: 24px; height: 24px; font-size: 13px; }

/* ---------- Label and value pairs, stats ---------- */
.jj-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: var(--space-4); }
.jj-kv > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jj-kv dt, .jj-stat__label { font-size: 14px; line-height: 20px; color: var(--ink-3); }
.jj-kv dd { font-weight: 600; overflow-wrap: anywhere; }
.jj-kv--rows { display: block; }
.jj-kv--rows > div { flex-direction: row; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; }
.jj-kv--rows > div + div { border-top: 1px solid var(--line); }
.jj-kv--rows dd { text-align: right; }
.jj-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: var(--space-4); }
.jj-stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.jj-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jj-stat__value { font: 600 22px/28px var(--font-sans); font-variant-numeric: tabular-nums; }

/* ---------- Home card and house-number plaque ---------- */
.jj-homes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--space-5); }
.jj-homes > li { display: flex; }
.jj-homes > li > .jj-home { flex: 1; min-width: 0; }
.jj-home { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; transition: border-color var(--dur-fast) var(--ease-out); }
.jj-home__media { display: grid; place-items: center; aspect-ratio: 3 / 2; background: var(--surface-2); }
.jj-home__media img { width: 100%; height: 100%; object-fit: cover; }
.jj-home__body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.jj-home__title { font: 600 17px/24px var(--font-sans); overflow-wrap: anywhere; }
.jj-home__facts { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.jj-home__foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-2) var(--space-3); margin-top: var(--space-1); }
.jj-price { display: flex; flex-direction: column; }
.jj-price__label { font-size: 13px; line-height: 18px; color: var(--ink-3); }
.jj-price .jj-money { font-size: 20px; line-height: 28px; }
.jj-plaque { display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.jj-plaque__plate { display: inline-grid; place-items: center; min-width: 104px; padding: 12px 20px 6px; border-radius: var(--radius-md); background: var(--plaque); color: var(--on-plaque); font: 800 56px/56px var(--font-display); white-space: nowrap; }
.jj-plaque__street { font: 600 14px/20px var(--font-sans); color: var(--ink-2); }
.jj-plaque--sm .jj-plaque__plate { width: 76px; min-width: 0; height: 52px; padding: 4px 0 0; border-radius: var(--radius-sm); font-size: 20px; line-height: 24px; }
.jj-gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.jj-gallery__main { aspect-ratio: 3 / 2; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.jj-gallery__main--short { aspect-ratio: 5 / 2; }
.jj-gallery__main img, .jj-gallery__more img { width: 100%; height: 100%; object-fit: cover; }
.jj-gallery__more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.jj-gallery__more > * { aspect-ratio: 3 / 2; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); }
.jj-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.jj-photo { position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); }
.jj-photo img { width: 100%; height: 100%; object-fit: cover; }
.jj-photo .jj-pill { position: absolute; left: 6px; bottom: 6px; background: var(--surface); color: var(--ink); }
.jj-photo__remove { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: var(--tap-min); height: var(--tap-min); }
.jj-photo__remove::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface); }
.jj-photo__remove svg { position: relative; width: 16px; height: 16px; color: var(--ink); }
.jj-photo--add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); width: 100%; border: 1.5px dashed var(--line-strong); background: transparent; color: var(--accent); font: 600 14px/20px var(--font-sans); cursor: pointer; }
.jj-photo--add svg { width: 24px; height: 24px; }

/* ---------- Status: notices and empty states ---------- */
.jj-notice { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink); }
.jj-notice svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--ink-2); }
.jj-notice > div { flex: 1; min-width: 0; }
.jj-notice strong { display: block; font-weight: 600; }
.jj-notice--good { background: var(--good-soft); } .jj-notice--good svg { color: var(--good); }
.jj-notice--warn { background: var(--warn-soft); } .jj-notice--warn svg { color: var(--warn); }
.jj-notice--bad { background: var(--bad-soft); } .jj-notice--bad svg { color: var(--bad); }
.jj-notice--info { background: var(--info-soft); } .jj-notice--info svg { color: var(--info); }
.jj-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-8) var(--space-5); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.jj-empty__title { font: 600 17px/24px var(--font-sans); }
.jj-empty p { color: var(--ink-2); max-width: 46ch; }
.jj-empty .jj-btn { margin-top: var(--space-2); }

/* ---------- Tables: stacked on phones, a real table from 720px ---------- */
.jj-tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.jj-table { display: block; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.jj-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.jj-table tbody, .jj-table tfoot { display: block; }
.jj-table tr { display: grid; grid-auto-flow: row dense; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); }
.jj-table tr + tr, .jj-table tfoot tr { border-top: 1px solid var(--line); }
.jj-table td { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 0; overflow-wrap: anywhere; }
.jj-table td::before { content: attr(data-label); font-size: 13px; line-height: 18px; color: var(--ink-3); }
.jj-table td.is-primary { font-weight: 600; }
.jj-table td.is-primary > a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.jj-table td.is-primary, .jj-table td.is-wide { grid-column: 1 / -1; }
.jj-table td.is-plain { justify-content: flex-end; }
.jj-table td:empty { display: none; }
.jj-table td.is-primary::before, .jj-table td.is-plain::before { content: none; }
.jj-table tfoot td { font-weight: 600; }

/* ---------- Sheets, dialogs, toasts ---------- */
/* Use a native dialog element opened with showModal(). It sits in the top layer, so it is always placed against
   the screen. The .jj-scrim wrapper is for static mockups and for browsers without dialog. */
.jj-sheet { display: flex; flex-direction: column; gap: var(--space-4); width: 100%; max-width: 520px; max-height: 90%; margin: auto auto 0; padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sheet); overflow: auto; overscroll-behavior: contain; }
.jj-sheet::backdrop { background: var(--scrim); }
.jj-sheet__title { font: 700 20px/26px var(--font-display); }
.jj-sheet__actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.jj-scrim { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.jj-scrim--static { position: absolute; }
/* The toast region is a popover="manual" element inside .jj (shown once with showPopover()), so it sits in the top layer and
   stays fixed to the screen in every engine, size container or not. The [popover] rule clears the browser's popover box. */
.jj-toasts[popover] { inset: auto 0 calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)) 0; width: auto; height: auto; margin: 0; border: 0; background: none; overflow: visible; color: inherit; }
.jj-toasts { font-family: var(--font-sans); position: fixed; z-index: 50; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: 0 var(--space-4); pointer-events: none; }
.jj-toast { display: flex; align-items: center; gap: var(--space-3); max-width: 480px; min-height: var(--control-h); padding: var(--space-2) var(--space-4); border-radius: var(--radius-lg); background: var(--ink); color: var(--ground); box-shadow: var(--shadow-pop); font-weight: 600; pointer-events: auto; }
.jj-toast svg { flex: none; width: 20px; height: 20px; }
.jj-toast button { min-height: var(--tap-min); padding: 0 var(--space-2); color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 0.18em; }
/* Enter and exit. Add .is-open after insert; remove it to leave. Exits are faster than entrances. */
.jj-toast { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-exit) var(--ease-out), transform var(--dur-exit) var(--ease-out); }
.jj-toast.is-open { opacity: 1; transform: none; transition-duration: var(--dur-base); }
dialog.jj-sheet { transform: translateY(100%); transition: transform var(--dur-exit) var(--ease-out); }
dialog.jj-sheet.is-open { transform: none; transition: transform var(--dur-sheet) var(--ease-sheet); }

/* ---------- Sign in ---------- */
.jj-signin { width: 100%; max-width: 432px; margin: 0 auto; padding: var(--space-8) var(--space-4) var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }

/* ---------- Messages ---------- */
.jj-thread { display: flex; flex-direction: column; gap: var(--space-3); }
.jj-msg { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); max-width: min(82%, 520px); }
.jj-msg__bubble { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-xs); background: var(--surface); overflow-wrap: anywhere; }
.jj-msg__meta { font-size: 13px; line-height: 18px; color: var(--ink-3); }
.jj-msg--mine { align-self: flex-end; align-items: flex-end; }
.jj-msg--mine .jj-msg__bubble { border-color: transparent; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg); background: var(--accent-soft); }
.jj-day { align-self: center; font-size: 13px; line-height: 18px; color: var(--ink-3); }
.jj-composer { display: flex; align-items: flex-end; gap: var(--space-2); }
.jj-composer .jj-textarea { min-height: var(--control-h); resize: none; }
.jj-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
.jj-panes__detail { display: none; }

/* ---------- Month stepper ---------- */
.jj-stepper { display: inline-flex; align-items: center; gap: var(--space-1); }
.jj-stepper__label { min-width: 148px; text-align: center; font: 600 17px/24px var(--font-sans); }
.jj-stepper .jj-iconbtn::before { content: ""; width: 9px; height: 9px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateX(2px) rotate(45deg); }
.jj-stepper .jj-iconbtn:last-child::before { transform: translateX(-2px) rotate(225deg); }

/* ---------- Pointer hover: only where hover is real ---------- */
@media (hover: hover) and (pointer: fine) {
  .jj .jj-btn:hover { background: var(--surface-2); }
  .jj .jj-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .jj .jj-btn--quiet:hover { background: var(--accent-soft); }
  .jj .jj-btn--danger:hover { background: var(--bad); }
  .jj .jj-btn--danger-quiet:hover { background: var(--bad-soft); }
  .jj .jj-btn:disabled:hover, .jj .jj-btn[aria-disabled="true"]:hover { background: var(--surface-2); }
  .jj-iconbtn:hover, .jj-who:hover, .jj-corner a:hover, .jj-topnav a:hover, .jj-side a:hover { background: var(--surface-2); }
  a.jj-row:hover, button.jj-row:hover { background: var(--surface-2); }
  a.jj-home:hover { border-color: var(--line-strong); }
  .jj-chip input:hover + span { border-color: var(--ink-2); }
  .jj-link:hover { text-decoration-thickness: 2px; }
}

/* ---------- Very narrow phones: the plate alone is the brand ---------- */
@container jj (max-width: 379px) {
  .jj-brand__short { display: none; }
}

/* ---------- From 600px: sheets become centered dialogs ---------- */
@container jj (min-width: 600px) {
  .jj-sheet { margin: auto; padding: var(--space-6); border-radius: var(--radius-xl); }
  .jj-sheet__actions { flex-direction: row-reverse; justify-content: flex-start; }
  .jj-scrim { align-items: center; padding: var(--space-6); }
  dialog.jj-sheet { transform: scale(0.97); opacity: 0; transition: transform var(--dur-exit) var(--ease-out), opacity var(--dur-exit) var(--ease-out); }
  dialog.jj-sheet.is-open { opacity: 1; transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
  .jj-toasts, .jj-toasts[popover] { bottom: var(--space-6); }
}

/* ---------- From 720px: tables are tables ---------- */
@container jj (min-width: 720px) {
  .jj-table { display: table; }
  .jj-table thead { position: static; display: table-header-group; width: auto; height: auto; clip-path: none; }
  .jj-table tbody { display: table-row-group; }
  .jj-table tfoot { display: table-footer-group; }
  .jj-table tr { display: table-row; }
  .jj-table th { padding: 10px var(--space-4); background: var(--surface-2); font: 600 13px/18px var(--font-sans); color: var(--ink-3); text-align: left; white-space: nowrap; }
  .jj-table td, .jj-table td:empty { display: table-cell; padding: 14px var(--space-4); border-top: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: normal; }
  .jj-table td::before { content: none; }
  .jj-table .is-num { text-align: right; }
}

/* ---------- From 900px: desktop navigation and wider pages ---------- */
@container jj (min-width: 900px) {
  .jj-welcome { font-size: 48px; line-height: 54px; }
  .jj-h1 { font-size: 32px; line-height: 38px; }
  .jj-header { padding: 0 var(--space-8); }
  .jj-footer { padding: var(--space-6) var(--space-8); }
  .jj-brand__short { display: none; }
  .jj-brand__long { display: inline; }
  .jj-corner a { padding: 0 var(--space-3); }
  .jj-tabs { display: none; }
  .jj-topnav { display: flex; align-items: center; gap: var(--space-1); margin-right: var(--space-2); }
  .jj-topnav a, .jj-side a { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius-md); font-weight: 600; color: var(--ink-2); transition: background-color var(--dur-fast) var(--ease-out); }
  .jj-topnav a[aria-current="page"], .jj-side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .jj-shell--side { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .jj-shell--side > .jj-header { grid-column: 1 / -1; }
  .jj-side { display: block; border-right: 1px solid var(--line); background: var(--surface); }
  .jj-side nav { position: sticky; top: var(--header-h); display: flex; flex-direction: column; gap: 2px; padding: var(--space-4) var(--space-3); }
  .jj-side .jj-badge { margin-left: auto; }
  .jj-side hr { width: 100%; height: 1px; margin: var(--space-2) 0; border: 0; background: var(--line); }
  .jj-page { padding: var(--space-10) var(--space-8) var(--space-16); gap: var(--space-8); }
  .jj-page--narrow { max-width: calc(var(--form-max) + 2 * var(--space-8)); }
  .jj-page--center { justify-content: center; }
  .jj-row__foot { justify-content: flex-start; gap: var(--space-4); }
  .jj-section > .jj-btn { align-self: flex-start; }
  .jj-card { padding: var(--space-6); }
  .jj-split { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-8); align-items: start; }
  .jj-split--aside-first > :first-child { order: 2; }
  .jj-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); align-items: start; }
  .jj-gallery { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .jj-gallery__more { grid-template-columns: minmax(0, 1fr); }
  .jj-formbar { position: static; margin: 0; padding: var(--space-2) 0 0; border: 0; background: none; }
  .jj-formbar .jj-btn { flex: none; min-width: 168px; }
  .jj-signin { padding-top: var(--space-16); }
  .jj-panes { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .jj-panes__detail { display: flex; flex-direction: column; gap: var(--space-4); }
  .jj-panes__detail .jj-back { display: none; }
}

/* ---------- Preferences ---------- */
/* Reduced motion: movement goes, color and opacity changes stay (they explain state without moving anything). */
@media (prefers-reduced-motion: reduce) {
  .jj .jj-btn:active, .jj-chip input:active + span { transform: none; }
  dialog.jj-sheet, dialog.jj-sheet.is-open, .jj-toast, .jj-toast.is-open { transform: none; }
  dialog.jj-sheet { opacity: 0; transition: opacity var(--dur-exit) var(--ease-out); }
  dialog.jj-sheet.is-open { opacity: 1; transition: opacity var(--dur-base) var(--ease-out); }
  .jj-fold > summary::after, .jj-switch input::after { transition: none; }
  .jj .jj-btn[aria-busy="true"]::before { animation-duration: 1200ms; }
}
@media (prefers-contrast: more) {
  .jj-card, .jj-list, .jj-home, .jj-tablewrap, .jj-header, .jj-tabs { border-color: var(--line-strong); }
}
