/* Base elements and shared primitives for the renter site: type, buttons, forms, grouped lists, chips, states. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + var(--bar-gap) * 2 + 8px); }
body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font: 400 var(--text-body)/1.5 var(--sans);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
/* Atmosphere: a fixed tint behind the whole app so the glass bar has something to refract. */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 0% 0%, var(--glow-a), transparent 70%), radial-gradient(circle at 100% 100%, var(--glow-b), transparent 70%), var(--bg); }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }
strong { font-weight: 650; }
small { font-size: var(--text-meta); }

h1 { font-size: var(--text-h1); font-weight: 700; line-height: 1.12; letter-spacing: -.022em; }
h2 { font-size: var(--text-title); font-weight: 650; line-height: 1.25; letter-spacing: -.012em; }
h3 { font-size: var(--text-lead); font-weight: 650; line-height: 1.3; }
.lede { font-size: var(--text-lead); color: var(--ink-2); line-height: 1.45; }
.meta { font-size: var(--text-meta); color: var(--ink-3); }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 20px; height: 20px; flex: none; }
.link { color: var(--accent-ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); }
p .link { min-height: 0; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ico { width: 18px; height: 18px; }

/* Glass: the navigation plane only (top bar and drawer). Safari needs the prefixed property with literal values. */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-glass);
}
@supports not ((backdrop-filter: none) or (-webkit-backdrop-filter: none)) {
  .glass { background: color-mix(in srgb, var(--surface) 94%, transparent); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: color-mix(in srgb, var(--surface) 94%, transparent); }
}
@media (prefers-contrast: more) {
  .glass { background: var(--surface); border-color: var(--line-2); }
}
/* Small solid labels that sit on photos. Not glass: photos are content. */
.glass-dark { background: var(--chip-on-photo); color: #fff; border: 1px solid rgba(255, 255, 255, .16); }

/* Buttons: capsules with a tactile press. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2);
  font-size: 16px; font-weight: 650; line-height: 1.1; white-space: nowrap;
  box-shadow: var(--shadow-sheet);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); box-shadow: var(--shadow-sheet); }
.btn-primary:hover { background: var(--accent-fill-press); border-color: var(--accent-fill-press); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-dark:hover { background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { min-height: var(--tap); padding: 0 16px; font-size: var(--text-small); }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill); color: var(--ink); transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.icon-btn:hover { background: var(--tint); }
.icon-btn:active { transform: scale(.94); }

/* Forms: 16px inputs on phones so iOS never zooms. */
.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label, .field > .field-label { font-size: var(--text-small); font-weight: 600; color: var(--ink); }
.field > small, .field-help { font-size: var(--text-meta); color: var(--ink-3); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid transparent; background: var(--surface-2); font-size: 16px; line-height: 1.35;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.field textarea { resize: vertical; min-height: 104px; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f646c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-2); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; background-color: var(--surface); border-color: var(--focus); box-shadow: var(--ring); }
.field input:disabled, .field input[readonly], .field textarea[readonly] { color: var(--ink-2); background-color: var(--surface-3); }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-4); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > .field { align-content: start; } /* a neighbour's help text never stretches this input */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form-actions .spacer { flex: 1; }
.form-error { color: var(--red); background: var(--red-soft); border-radius: var(--r-ctl); padding: 12px 14px; font-size: var(--text-small); font-weight: 500; }
.form-success { color: var(--green); background: var(--green-soft); border-radius: var(--r-ctl); padding: 12px 14px; font-size: var(--text-small); font-weight: 500; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--text-small); color: var(--ink-2); line-height: 1.45; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent-fill); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 76px; }
.password-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); min-height: var(--tap); padding: 0 14px; border-radius: var(--r-pill); font-size: var(--text-small); font-weight: 650; color: var(--ink-2); }
.password-toggle:hover { background: var(--surface-3); color: var(--ink); }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Segmented control and choice chips (radio based). */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-3); }
.seg a, .seg label { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: var(--r-pill); font-size: var(--text-small); font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg a:hover, .seg label:hover { color: var(--ink); }
.seg a[aria-current="page"], .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-ctl); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg label:has(input:disabled) { cursor: default; }
.seg-block { display: flex; width: 100%; }
.seg-block a, .seg-block label { flex: 1; }

/* Chips and status pills. */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); font-size: var(--text-meta); font-weight: 600; white-space: nowrap; }
.chip .ico { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 11px; border-radius: var(--r-pill); font-size: var(--text-pill); font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--accent-soft); color: var(--accent-ink); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-plain::before { display: none; }

/* Grouped lists: one rounded container, rows separated by hairlines. Replaces a card per item. */
.group { display: grid; gap: 10px; min-width: 0; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.group-head h2 { font-size: var(--text-lead); }
.group-head a { font-size: var(--text-small); font-weight: 600; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 2px 0 8px; margin-right: -2px; border-radius: var(--r-pill); }
.group-head a:hover { background: var(--accent-soft); }
.group-head a .ico { width: 16px; height: 16px; }
.group-body, .panel { background: var(--surface); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); }
.panel { padding: 22px; }
.group-list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 18px; }
a.row, button.row { width: 100%; text-align: left; transition: background-color var(--dur-fast) var(--ease-out); }
a.row:hover, button.row:hover { background: var(--surface-2); }
a.row:active, button.row:active { background: var(--surface-3); }
.group-list > li:first-child > .row { border-top-left-radius: var(--r-sheet); border-top-right-radius: var(--r-sheet); }
.group-list > li:last-child > .row { border-bottom-left-radius: var(--r-sheet); border-bottom-right-radius: var(--r-sheet); }
.row-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--surface-3); color: var(--ink-2); flex: none; }
.row-icon .ico { width: 20px; height: 20px; }
.row-icon-accent { background: var(--accent-soft); color: var(--accent-ink); }
.row-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.row-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.row-meta { font-size: var(--text-meta); color: var(--ink-3); overflow-wrap: anywhere; }
.row-copy { font-size: var(--text-small); color: var(--ink-2); overflow-wrap: anywhere; }
.row-end { display: flex; align-items: center; gap: 10px; flex: none; text-align: right; }
.row-end .chev { width: 18px; height: 18px; color: var(--ink-4); }
.row-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.row-stack { flex-wrap: wrap; }
.kv-list > li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 13px 18px; }
.kv-list > li + li { border-top: 1px solid var(--line); }
.kv-list span { color: var(--ink-3); font-size: var(--text-small); }
.kv-list strong { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

/* Notices, empty, error, loading. */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--surface-3); color: var(--ink-2); font-size: var(--text-small); line-height: 1.45; }
.notice .ico { width: 18px; height: 18px; margin-top: 1px; color: var(--ink-3); }
.notice strong { color: var(--ink); }
.notice-green { background: var(--green-soft); }
.notice-green .ico { color: var(--green); }
.notice-amber { background: var(--accent-soft); }
.notice-amber .ico { color: var(--accent-ink); }
.notice-red { background: var(--red-soft); color: var(--ink); }
.notice-red .ico { color: var(--red); }
.notice-blue { background: var(--blue-soft); }
.notice-blue .ico { color: var(--blue); }
.error-card { align-items: flex-start; }
.error-card > div { display: grid; gap: 8px; justify-items: start; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 20px; }
.empty-art { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 6px; }
.empty-art .ico { width: 26px; height: 26px; }
.empty h3 { font-size: var(--text-lead); }
.empty p { color: var(--ink-3); max-width: 42ch; font-size: var(--text-small); }
.empty .btn-row { justify-content: center; margin-top: 8px; }
.loading-block { display: grid; gap: 14px; padding: 8px 0; }
.skeleton { display: block; border-radius: var(--r-ctl); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-photo { aspect-ratio: 4 / 3; border-radius: var(--r-photo); }
.skeleton-line { height: 16px; width: 60%; }
.skeleton-line.short { width: 36%; }
.skeleton-title { height: 30px; width: 46%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.photo-pending { display: grid; place-items: center; align-content: center; gap: 8px; width: 100%; height: 100%; min-height: 160px; color: var(--ink-3); background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, var(--surface-3) 14px 28px); }
.photo-pending .ico { width: 28px; height: 28px; }
.photo-pending strong { font-size: var(--text-small); }

/* Status tracker: received, review, decision. */
.track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.track li { display: grid; gap: 6px; font-size: var(--text-meta); font-weight: 600; color: var(--ink-3); }
.track li::before { content: ''; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); }
.track li.done { color: var(--ink-2); }
.track li.done::before { background: var(--accent); }
.track li.now { color: var(--ink); }
.track li.now::before { background: var(--accent); }
.track.is-red li.now::before { background: var(--red); }
.track.is-green li.now::before, .track.is-green li.done::before { background: var(--green); }

/* Toast: a glass capsule under the top bar, never a bottom bar. */
.toast { pointer-events: none; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-pop); position: fixed; z-index: 80; left: 50%; top: calc(max(var(--bar-gap), env(safe-area-inset-top)) + var(--bar-h) + 12px); transform: translateX(-50%); max-width: min(92vw, 520px); padding: 12px 20px; border-radius: var(--r-pill); font-size: var(--text-small); font-weight: 600; text-align: center; animation: toast-in var(--dur) var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.toast-bar { top: calc(max(var(--bar-gap), env(safe-area-inset-top)) + (var(--bar-h) - 40px) / 2); height: 40px; padding: 0 18px; line-height: 40px; max-width: min(calc(100vw - 2 * var(--gutter) - 176px), 360px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow-float); }
.toast.toast-bar.toast-fit { transform: none; max-width: none; animation: fade-in var(--dur) var(--ease-out); }

/* Confirm dialog: a centered sheet over a dimmed page. */
.sheet-dialog { width: min(92vw, 420px); padding: 0; border: 0; border-radius: var(--r-photo); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.sheet-dialog::backdrop { background: var(--overlay); }
.sheet-dialog[open] { animation: sheet-in var(--dur) var(--ease-out); }
.sheet-body { display: grid; gap: 10px; padding: 26px 24px 22px; }
.sheet-body h2 { font-size: var(--text-title); }
.sheet-body p { color: var(--ink-2); font-size: var(--text-small); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@keyframes sheet-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  /* Press and hover feedback stays as color only: nothing scales, nudges or zooms. */
  .btn:active, .icon-btn:active, .back-pill:active, .account-chip:active, .filter-toggle:active, .send-btn:active, .day-chip:active, .time-chip:active,
  .auth-alt:active, .add-room:active, .photo-add:active, .tile-photo:active, .feature-photo:active, .tile-photo:hover img, .feature-photo:hover img, .home-hero:hover img,
  .home-tile:hover .tile-photo img { transform: none !important; }
}
