/* ==========================================================================
   inbloc design system v2 — "Dutch modern warmth"
   Cream paper · cobalt ink · amber accent. Fraunces display + Inter UI.
   Light and dark are twin first-class themes driven by [data-theme] tokens.
   See docs/VISION.md for the rationale.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,550;0,9..144,650;1,9..144,450&family=Inter:wght@400;500;600;700&display=swap");

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* surfaces */
  --paper: #f5f1e8;
  --paper-2: #ece7da;
  --card: #fffdf8;
  --card-2: #f8f4ea;
  /* ink */
  --ink: #1d1e24;
  --ink-2: #5b5a64;
  --ink-3: #93919b;
  --line: #ddd6c6;
  --line-soft: #e8e2d4;
  /* brand */
  --accent: #a1512d;
  --accent-deep: #84401f;
  --accent-soft: #f4e2d4;
  --accent-ink: #96441f;
  --amber: #eda21a;
  --amber-soft: #faeecf;
  --amber-ink: #8a610b;
  --brick: #b5352b;
  --brick-soft: #f7dbd7;
  --brick-ink: #a02c23;
  --sage: #4e7d5b;
  --sage-soft: #e0ebdd;
  --on-accent: #fffdf8;
  /* effects */
  --shadow: 0 14px 40px rgba(52, 45, 26, 0.1);
  --shadow-lift: 0 22px 60px rgba(52, 45, 26, 0.16);
  --overlay: rgba(32, 26, 20, 0.55);
  /* type + shape */
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --r-s: 8px;
  --r: 12px;
  --r-l: 20px;
}

[data-theme="dark"] {
  --paper: #17130f;
  --paper-2: #201a14;
  --card: #26201a;
  --card-2: #2d2620;
  --ink: #efe8dc;
  --ink-2: #b5aa9c;
  --ink-3: #82786c;
  --line: #3a3229;
  --line-soft: #2e2721;
  --accent: #dd8a5b;
  --accent-deep: #e89f77;
  --accent-soft: #3a2617;
  --accent-ink: #e6a883;
  --amber: #f0b445;
  --amber-soft: #382c12;
  --amber-ink: #eccb8d;
  --brick: #e0705f;
  --brick-soft: #40201b;
  --brick-ink: #eb9d92;
  --sage: #82b18f;
  --sage-soft: #1f3226;
  --on-accent: #17130f;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 22px 60px rgba(0, 0, 0, 0.6);
  --overlay: rgba(10, 8, 6, 0.66);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* No transition here: animating a var()-backed background shorthand leaves
     Chromium with a stale paint when the theme attribute flips. Instant is fine. */
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.container,
.mw {
  width: min(1140px, 92vw);
  margin: 0 auto;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 550;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

p {
  color: var(--ink-2);
}

.muted {
  color: var(--ink-2);
}

.kicker,
.label {
  margin: 0 0 0.9rem;
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lead {
  max-width: 680px;
  color: var(--ink-2);
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.75;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease,
    border-color 160ms ease, box-shadow 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(161, 81, 45, 0.22);
}
[data-theme="dark"] .btn-primary {
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-deep);
}

.btn-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: transparent;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-soft {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.btn-danger {
  color: var(--brick-ink);
  border-color: var(--brick);
  background: transparent;
}
.btn-danger:hover:not(:disabled) {
  color: var(--on-accent);
  background: var(--brick);
}

.btn-white {
  color: var(--accent);
  background: #fffdf8;
}

.btn-ghost {
  color: var(--on-accent);
  border-color: color-mix(in srgb, var(--on-accent) 40%, transparent);
  background: transparent;
}

.btn-sm {
  min-height: 36px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
}

.btn-xs {
  min-height: 30px;
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
  border-radius: 8px;
}

.button-row,
.nav-links,
.card-actions,
.request-actions,
.hero-actions,
.cta-btns {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Forms — every control gets a visible label; compact where possible.
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  gap: 0.85rem;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.32rem;
}

.field label,
.field-label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.field-hint {
  font-size: 0.74rem;
  color: var(--ink-3);
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  padding: 0.72rem 0.85rem;
  color: var(--ink);
  background: var(--card);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="file"] {
  padding: 0;
  border: 1.5px dashed var(--line);
  background: var(--card-2);
  font-size: 0.82rem;
  color: var(--ink-2);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 0.8rem;
  padding: 0.55rem 0.9rem;
  border: none;
  border-right: 1.5px solid var(--line);
  border-radius: var(--r-s) 0 0 var(--r-s);
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.form-msg {
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  min-height: 1rem;
}

.notice {
  border: 1.5px solid color-mix(in srgb, var(--amber) 55%, transparent);
  border-radius: var(--r-s);
  padding: 0.8rem;
  color: var(--amber-ink);
  background: var(--amber-soft);
}

/* Compact labeled control group (filters, inline pickers). */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.filter-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  padding-left: 0.15rem;
}
.filter-group select {
  width: auto;
  min-width: 0;
  padding: 0.42rem 0.6rem;
  border-radius: var(--r-s);
  font-size: 0.82rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Shared primitives: panel, chips, door numbers, badges, avatars
   -------------------------------------------------------------------------- */
.panel,
.login-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-l);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.45rem;
}

.panel h1,
.panel h2,
.panel h3,
.login-card h1 {
  margin: 0 0 0.45rem;
}

.panel p {
  line-height: 1.65;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.24rem 0.66rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--paper-2);
  color: var(--ink-2);
}

/* "door number" — the bloc motif; used for steps, floors, pickup spots */
.doornum {
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--r-s);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 650;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.3rem 0.68rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge,
.badge[data-state="ok"] {
  background: var(--sage-soft);
  color: var(--sage);
}
.badge-soft {
  background: var(--paper-2);
  color: var(--ink-2);
}
.badge[data-state="pending"] {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

.price-tag,
.pill {
  width: fit-content;
  border-radius: 999px;
  padding: 0.3rem 0.64rem;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.price-tag.free,
.pill.free,
.price-tag {
  color: var(--sage);
  background: var(--sage-soft);
}
.price-tag.paid,
.pill.paid {
  color: var(--amber-ink);
  background: var(--amber-soft);
}
.pill.borrowed {
  color: var(--brick-ink);
  background: var(--brick-soft);
}

.count-badge {
  display: inline-block;
  min-width: 1.3rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  vertical-align: middle;
}

.owner-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Header + nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--on-accent);
  border-radius: var(--r-s);
  background: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.03em;
}

.nav-links {
  justify-content: flex-end;
  order: 1;
  margin-left: auto;
}

.nav-links a {
  text-decoration: none;
}

.nav-link {
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 500;
  transition: color 160ms ease;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-links .btn {
  padding: 0.46rem 0.85rem;
  font-size: 0.82rem;
}

.nav-primary {
  order: 2;
}

.auth-pending {
  visibility: hidden;
  pointer-events: none;
}
.auth-primary-slot {
  min-width: 8.2rem;
}
.auth-secondary-slot {
  min-width: 5.4rem;
}

#logoutBtn {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink-3);
  font-weight: 600;
}
#logoutBtn:hover:not(:disabled) {
  border-color: var(--brick);
  color: var(--brick-ink);
}

/* Theme + language controls (header + You tab) */
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .theme-ic-moon {
  display: none;
}
[data-theme="dark"] .theme-toggle .theme-ic-sun {
  display: none;
}
[data-theme="dark"] .theme-toggle .theme-ic-moon {
  display: block;
}

.lang-switch {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  overflow: hidden;
}
.lang-switch button {
  border: none;
  background: var(--card);
  color: var(--ink-3);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.42rem 0.6rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lang-switch button.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

/* Hamburger (landing/simple pages, ≤700px) */
.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 40px;
  padding: 9px;
  margin-left: 0.5rem;
  cursor: pointer;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
}
.nav-burger span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 200ms ease, opacity 200ms ease;
}

/* Site banner (admin-configured strip under the nav) */
.site-banner {
  display: block;
  width: 100%;
  padding: 0.32rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  text-align: center;
  border-top: 1px solid var(--line-soft);
}
.site-banner.tone-dev {
  background: var(--amber);
  color: #232323;
}
.site-banner.tone-warn {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.site-banner.tone-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.site-banner.tone-danger {
  background: var(--brick-soft);
  color: var(--brick-ink);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 3.5rem;
  border-top: 1px solid var(--line-soft);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 0.85rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(3, 1fr);
  gap: 1.5rem;
  padding: 2.4rem 0 1.6rem;
}
.footer-brand {
  max-width: 22rem;
}
.footer-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-s);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 650;
  margin-bottom: 0.6rem;
}
.footer-brand p {
  margin: 0;
  line-height: 1.55;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-col h4 {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.footer-col a {
  color: var(--ink-2);
  text-decoration: none;
}
.footer-col a:hover {
  color: var(--ink);
}
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0 1.4rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.8rem;
  color: var(--ink-3);
}
.footer-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-mini a {
  color: var(--ink-3);
  text-decoration: none;
}
.footer-mini a:hover {
  color: var(--ink);
}
.site-footer-slim {
  margin-top: 2.5rem;
}
.site-footer-slim .footer-bottom {
  border-top: none;
}

/* --------------------------------------------------------------------------
   Landing
   -------------------------------------------------------------------------- */
.page-content {
  padding: 2.2rem 0 4rem;
}

.landing-section {
  padding: 92px 6vw;
}

.section-white {
  background: var(--card);
}

.section-muted {
  background: var(--paper-2);
}

.landing-section h2,
.section-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.08;
}

/* Hero */
.hero {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 6vw 56px;
  position: relative;
  overflow: hidden;
}

.hero-inner {
  width: min(1140px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.75fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.hero-title {
  max-width: 860px;
  margin: 0 0 1.3rem;
  font-size: clamp(3rem, 7vw, 5.6rem);
  line-height: 1.0;
}

.hero-title em {
  color: var(--accent-ink);
  font-style: italic;
  font-weight: 450;
}

.hero-sub {
  max-width: 520px;
  margin: 0 0 2rem;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-actions {
  margin-bottom: 2.6rem;
}

.hero-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
}

.hero-bar-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
}

.hero-bar-item svg {
  color: var(--accent-ink);
  flex-shrink: 0;
}

/* The living building — the brand visual. A grid of window "blocs", a few
   lit with items. Pure CSS + inline SVG; no images. */
.building {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r-l) var(--r-l) var(--r-s) var(--r-s);
  background: var(--card);
  box-shadow: var(--shadow-lift);
  padding: 1.1rem 1.1rem 0.8rem;
  transform: rotate(0.6deg);
}
.building-roof {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}
.building-roof strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}
.building-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}
.window {
  aspect-ratio: 1;
  border-radius: var(--r-s);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
}
.window.lit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 45%, transparent);
}
.window.lit svg {
  width: 26px;
  height: 26px;
  stroke: var(--amber-ink);
  fill: none;
  stroke-width: 1.7;
}
.window.lit .w-tag {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--amber-ink);
  letter-spacing: 0.02em;
}
.window.lit.cool {
  background: var(--sage-soft);
  border-color: color-mix(in srgb, var(--sage) 45%, transparent);
}
.window.lit.cool svg {
  stroke: var(--sage);
}
.window.lit.cool .w-tag {
  color: var(--sage);
}
.building-door {
  width: 25%;
  height: 2.4rem;
  margin: 0.55rem auto 0;
  border-radius: var(--r-s) var(--r-s) 0 0;
  background: var(--accent);
}
.building-caption {
  margin: 0.8rem 0 0.2rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* Stats strip */
.stats {
  padding: 30px 6vw;
  background: var(--accent);
}
[data-theme="dark"] .stats {
  background: var(--accent-soft);
}
.stats .mw {
  display: flex;
  flex-wrap: wrap;
}
.s-item {
  flex: 1;
  min-width: 170px;
  padding: 0 2.5rem;
  border-right: 1px solid color-mix(in srgb, var(--on-accent) 18%, transparent);
}
[data-theme="dark"] .s-item {
  border-right-color: color-mix(in srgb, var(--ink) 14%, transparent);
}
.s-item:first-child {
  padding-left: 0;
}
.s-item:last-child {
  border-right: 0;
}
.s-num {
  margin-bottom: 0.25rem;
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
}
[data-theme="dark"] .s-num {
  color: var(--ink);
}
.s-lbl {
  color: color-mix(in srgb, var(--on-accent) 62%, transparent);
  font-size: 0.78rem;
}
[data-theme="dark"] .s-lbl {
  color: var(--ink-2);
}

/* Two doors: browse / ask */
.doors-g {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}
.door-card {
  border: 1.5px solid var(--line);
  border-radius: var(--r-l);
  padding: 1.9rem;
  background: var(--card);
  transition: border-color 180ms ease, transform 180ms ease;
}
.door-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.door-card h3 {
  margin: 0.9rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}
.door-card p {
  margin: 0;
  line-height: 1.7;
}

/* Steps as floors */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 2.6rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--line);
}
.step {
  padding: 2rem 1.6rem;
  background: var(--card);
}
.step h3 {
  margin: 1rem 0 0.45rem;
}
.step p {
  margin: 0;
  line-height: 1.65;
}

/* Trust grid */
.trust-g {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}
.trust-card {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--card);
  padding: 1.3rem 1.4rem;
}
.trust-card h3 {
  margin: 0 0 0.35rem;
}
.trust-card p {
  margin: 0;
  line-height: 1.65;
}

/* Community spotlight */
.spotlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2.2rem;
  border-radius: var(--r-l);
  padding: 2.1rem 2.6rem;
  background: var(--accent);
}
[data-theme="dark"] .spotlight {
  background: var(--accent-soft);
}
.spotlight h3 {
  margin: 0 0 0.25rem;
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
[data-theme="dark"] .spotlight h3 {
  color: var(--ink);
}
.spotlight p {
  margin: 0;
  max-width: 34rem;
  color: color-mix(in srgb, var(--on-accent) 70%, transparent);
  font-size: 0.9rem;
}
[data-theme="dark"] .spotlight p {
  color: var(--ink-2);
}

/* Final CTA */
.cta-section {
  padding: 100px 6vw;
  text-align: center;
}
.cta-section h2 {
  max-width: 620px;
  margin: 0 auto 0.7rem;
}
.cta-sub {
  max-width: 420px;
  margin: 0 auto 2rem;
  font-size: 0.95rem;
}
.cta-btns {
  justify-content: center;
}

/* Reveal on scroll */
.fu,
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.fu.is-revealed,
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .fu,
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-shell {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 2rem 0;
}
.login-card {
  width: min(520px, 92vw);
  padding: 2.2rem;
}
.login-card h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.04;
}

/* --------------------------------------------------------------------------
   Legal / prose pages
   -------------------------------------------------------------------------- */
.legal-page {
  max-width: 760px;
}
.legal-draft {
  margin-bottom: 1.6rem;
  padding: 0.7rem 1rem;
  border: 1.5px dashed var(--amber);
  border-radius: var(--r-s);
  background: var(--amber-soft);
  color: var(--amber-ink);
  font-size: 0.85rem;
}
.prose h1 {
  margin: 0 0 0.3rem;
}
.prose h2 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.05rem;
}
.prose p {
  margin: 0 0 0.6rem;
  line-height: 1.65;
}
.prose a {
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
  max-width: min(420px, 92vw);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-lift);
}
.toast[data-tone="success"] {
  border-color: var(--sage);
  background: var(--sage-soft);
  color: var(--sage);
}
.toast[data-tone="error"] {
  border-color: var(--brick);
  background: var(--brick-soft);
  color: var(--brick-ink);
}

/* --------------------------------------------------------------------------
   Responsive: landing + chrome
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-layout,
  .trust-g,
  .doors-g {
    grid-template-columns: 1fr;
  }
  .steps {
    grid-template-columns: 1fr 1fr;
  }
  .building {
    max-width: 420px;
  }
}

@media (max-width: 700px) {
  .container,
  .mw {
    width: min(1140px, 94vw);
  }

  .header-inner {
    position: relative;
    flex-wrap: nowrap;
  }
  .brand {
    flex-shrink: 0;
    gap: 0.5rem;
    font-size: 1.3rem;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
  .nav-burger {
    display: flex;
  }
  .nav-primary {
    order: 0;
    margin-left: auto;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: max-content;
    min-width: 200px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    margin: 0;
    padding: 0.55rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lift);
    z-index: 300;
  }
  .nav-toggle:checked ~ .nav-links {
    display: flex;
  }
  .nav-links .btn {
    width: 100%;
    justify-content: center;
  }
  .nav-links .nav-link {
    display: block;
    padding: 0.5rem 0.3rem;
    color: var(--ink);
    font-weight: 600;
  }
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .site-header .btn {
    min-height: 40px;
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .landing-section {
    padding: 64px 6vw;
  }
  .hero {
    min-height: auto;
    padding-top: 52px;
  }
  .hero-title {
    font-size: clamp(2.7rem, 14vw, 4rem);
  }
  .hero-bar {
    gap: 1rem;
  }
  .steps {
    grid-template-columns: 1fr;
  }
  .stats .mw {
    gap: 1rem;
  }
  .s-item {
    min-width: 100%;
    padding: 0 0 1rem;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--on-accent) 16%, transparent);
  }
  .s-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
  .spotlight {
    padding: 1.7rem;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }

  .btn {
    min-height: 44px;
  }
  input,
  select,
  textarea {
    font-size: 16px; /* prevents iOS zoom-on-focus */
  }
  .panel {
    padding: 1.1rem;
  }
}

/* ==========================================================================
   App shell: tabs, building hero, and the borrowing vocabulary
   ========================================================================== */

/* --- Tab navigation: top row on desktop, bottom bar on mobile ------------ */
.app-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1.1rem;
  border-bottom: 1.5px solid var(--line-soft);
}
.app-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  margin-bottom: -1.5px;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
}
.app-tab svg {
  width: 17px;
  height: 17px;
}
.app-tab:hover {
  color: var(--ink);
}
.app-tab.is-active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}
.app-tab .count-badge {
  font-size: 0.62rem;
}

.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
}
.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.2rem;
  max-width: 480px;
  margin: 0 auto;
}
.tabbar .app-tab {
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.35rem 0.2rem;
  margin: 0;
  border-bottom: none;
  border-radius: var(--r-s);
}
.tabbar .app-tab svg {
  width: 21px;
  height: 21px;
}
.tabbar .app-tab.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* --- Building hero (Browse tab header) ----------------------------------- */
.bhero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-l);
  padding: 1.2rem 1.4rem;
  background: var(--card);
  box-shadow: var(--shadow);
}
.bhero h1 {
  margin: 0.1rem 0 0;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  line-height: 1.05;
}
.bhero-pulse {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.bhero-you {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* --- Filters + feed ------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.7rem;
  margin-bottom: 1.1rem;
}
.filter-search {
  flex: 1 1 200px;
  min-width: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.listing-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 0.9rem;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.listing-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}
.listing-clickable {
  cursor: pointer;
}
.listing-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--r-s);
  background: var(--paper-2);
}
.listing-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.listing-media.listing-clickable:hover img {
  filter: brightness(0.97);
}
.listing-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  background: var(--card);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
}
.listing-ribbon {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  background: var(--brick);
  color: var(--on-accent);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}
.photo-count {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  background: rgba(20, 21, 26, 0.72);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}
.listing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.listing-titlewrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.listing-cat {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.listing-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  font-weight: 600;
}
.listing-title.listing-clickable:hover {
  color: var(--accent-ink);
}
.listing-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-specs {
  display: grid;
  gap: 0.44rem;
  padding: 0.7rem 0.8rem;
  background: var(--paper-2);
  border-radius: var(--r-s);
}
.spec {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.spec-ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent-ink);
}
.spec-label {
  flex-shrink: 0;
  min-width: 4.6rem;
  color: var(--ink-3);
}
.spec-value {
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.listing-owner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line-soft);
}
.owner-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  margin-right: auto;
}
.owner-byline {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}
.owner-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}
.owner-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}
.owner-verified {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--sage);
  background: var(--sage-soft);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}
.listing-status-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--brick-ink);
}
.listing-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.55rem;
}
.listing-actions .btn-primary {
  flex: 1;
}
.btn-report {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 0.76rem;
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  border-radius: var(--r-s);
}
.btn-report:hover {
  color: var(--brick-ink);
  background: var(--paper-2);
}
.safety-note {
  border-left: 2.5px solid var(--amber);
  padding-left: 0.7rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.empty-state {
  display: grid;
  gap: 0.5rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  padding: 1.1rem;
  background: transparent;
  color: var(--ink-2);
}
.empty-state.cold-start {
  grid-column: 1 / -1;
  justify-items: start;
  gap: 0.7rem;
  padding: 1.6rem 1.3rem;
}
.cold-start-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.cold-start-lead {
  margin: 0;
  max-width: 46ch;
}
.cold-start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

/* --- Detail modal + slideshow + booked windows ---------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-dialog {
  position: relative;
  width: min(720px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-lift);
}
.dialog-card {
  position: relative;
  width: min(460px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-lift);
  padding: 1.5rem;
}
.dialog-card h2 {
  margin: 0 0 0.2rem;
}
#listingDialog .dialog-card {
  width: min(540px, 94vw);
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-s);
  border: none;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  background: var(--paper-2);
}
.modal-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  max-height: 360px;
  overflow: hidden;
  background: var(--paper-2);
  border-radius: var(--r-l) var(--r-l) 0 0;
}
.modal-media img {
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: cover;
}
.modal-media .listing-icon {
  width: 96px;
  height: 96px;
  font-size: 1.8rem;
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.3rem 1.5rem 1.5rem;
}
.modal-body h2.listing-title {
  font-size: 1.35rem;
  line-height: 1.2;
}
.modal-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}
.modal-actions {
  margin-top: 0.4rem;
}
.modal-actions .btn {
  width: 100%;
}
.media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-s);
  background: rgba(20, 21, 26, 0.55);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding-bottom: 0.15rem;
}
.media-nav:hover {
  background: rgba(20, 21, 26, 0.78);
}
.media-prev {
  left: 0.6rem;
}
.media-next {
  right: 0.6rem;
}
.media-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.6rem;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}
.media-dot {
  width: 0.55rem;
  height: 0.55rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 0;
}
.media-dot.is-active {
  background: #fff;
}

.booked-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.booked-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.booked-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.booked-chip {
  background: var(--amber-soft);
  color: var(--amber-ink);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.selected-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  padding: 0.8rem;
  background: var(--accent-soft);
}
.selected-item strong {
  display: block;
}
.request-panel {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* --- Asks ------------------------------------------------------------------ */
.ask-form {
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.ask-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.ask-card {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  padding: 0.9rem 1rem;
  background: var(--card);
}
.ask-card.is-note {
  border-left-color: var(--line);
}
.ask-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.ask-title {
  font-size: 0.95rem;
  font-weight: 600;
}
.ask-needed {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber-ink);
  background: var(--amber-soft);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
}
.ask-body {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-2);
}
.ask-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--ink-3);
}

/* --- Loans: request items with a step indicator ---------------------------- */
.request-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 0.9rem 1rem;
  background: var(--card);
}
.request-main {
  display: grid;
  gap: 0.22rem;
}
.request-main span {
  color: var(--ink-2);
  font-size: 0.84rem;
}
.loan-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.35rem;
}
.loan-step {
  display: flex;
  align-items: center;
}
.loan-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  flex-shrink: 0;
}
.loan-step.is-done .loan-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.loan-step.is-current .loan-dot {
  border-color: var(--amber);
  background: var(--amber-soft);
}
.loan-step.is-dead .loan-dot {
  border-color: var(--brick);
  background: var(--brick-soft);
}
.loan-bar {
  width: 1.6rem;
  height: 2px;
  background: var(--line);
}
.loan-bar.is-done {
  background: var(--accent);
}
.loan-step-label {
  margin-left: 0.35rem;
  margin-right: 0.55rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.loan-step.is-done .loan-step-label,
.loan-step.is-current .loan-step-label {
  color: var(--ink-2);
}

.request-extra {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.msg-thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow-y: auto;
}
.msg-line {
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--r-s);
  background: var(--paper-2);
}
.msg-line.is-mine {
  background: var(--accent-soft);
}
.inline-form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.inline-form input,
.inline-form select {
  flex: 1 1 120px;
  padding: 0.42rem 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
}

/* Evidence (pickup/return condition records) */
.evidence-hint {
  margin: 0;
  font-size: 0.78rem;
}
.evidence-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.evidence-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.6rem 0.7rem;
  background: var(--paper-2);
  border-radius: var(--r-s);
}
.evidence-phase-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.evidence-empty {
  margin: 0;
  font-size: 0.76rem;
}
.evidence-entry {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}
.evidence-thumb {
  flex-shrink: 0;
  display: block;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.evidence-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.evidence-meta p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink);
}
.evidence-meta .muted {
  font-size: 0.7rem;
}
.evidence-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
}
.evidence-form .evidence-note {
  flex: 1 1 180px;
}
.evidence-form input[type="text"] {
  padding: 0.42rem 0.6rem;
  border-radius: var(--r-s);
  font-size: 0.82rem;
}
.evidence-form input[type="file"] {
  max-width: 15rem;
  font-size: 0.76rem;
}

/* --- You tab ---------------------------------------------------------------- */
.you-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: start;
}
.you-profile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.you-avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
}
.you-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}
.you-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}
.you-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line-soft);
}
.you-row:first-of-type {
  border-top: none;
}
.you-row-label {
  font-size: 0.86rem;
  font-weight: 600;
}
.you-row-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--ink-3);
  font-weight: 400;
}

/* Notifications dropdown (header bell) */
.notif-wrap {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
}
.notif-bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
}
.notif-bell:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.notif-bell svg {
  width: 18px;
  height: 18px;
}
.notif-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brick);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, 86vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lift);
  z-index: 400;
  overflow: hidden;
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
.notif-markread {
  border: none;
  background: none;
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.notif-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.notif-drop-item {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
.notif-drop-item.is-unread {
  background: var(--accent-soft);
}
.notif-drop-item strong {
  display: block;
  font-size: 0.84rem;
}
.notif-drop-item p {
  margin: 0.1rem 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.notif-drop-item .muted {
  font-size: 0.7rem;
}
.notif-empty {
  padding: 1rem 0.9rem;
  text-align: center;
  font-size: 0.82rem;
}
.notif-viewall {
  display: block;
  padding: 0.6rem 0.9rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration: none;
  border-top: 1px solid var(--line-soft);
}
.notif-viewall:hover {
  background: var(--paper-2);
}

/* Community cards (Browse tab, secondary) */
.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
  margin-top: 0.7rem;
}
.community-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--card);
}
.community-card strong {
  font-size: 0.92rem;
}
.community-card .muted {
  font-size: 0.76rem;
}
.community-card.is-member {
  border-left: 3px solid var(--sage);
}
.create-community {
  margin-top: 0.8rem;
}
.create-community > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1.5px dashed var(--accent);
  border-radius: var(--r-s);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.86rem;
}
.create-community > summary::-webkit-details-marker {
  display: none;
}
.create-community[open] > summary {
  margin-bottom: 0.8rem;
}

.auth-gate {
  text-align: center;
}
.auth-gate-actions {
  justify-content: center;
  margin-top: 1rem;
}

.list-heading {
  margin: 1.2rem 0 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

/* --- App responsive -------------------------------------------------------- */
@media (max-width: 700px) {
  .app-tabs {
    display: none;
  }
  .tabbar {
    display: block;
  }
  .page-content.app-page {
    padding-bottom: 5.2rem; /* room for the tab bar */
  }
  .you-grid,
  .evidence-groups {
    grid-template-columns: 1fr;
  }
  .listing-grid {
    grid-template-columns: 1fr;
  }
  .bhero {
    padding: 1rem 1.1rem;
  }
  .loan-step-label {
    display: none; /* dots only on small screens */
  }
  .loan-step.is-current .loan-step-label {
    display: inline; /* except the step you're on */
  }

  /* Modal + dialogs become bottom sheets. */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog,
  .dialog-card,
  #listingDialog .dialog-card {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-l) var(--r-l) 0 0;
  }
  .modal-media {
    min-height: 200px;
    max-height: 44vh;
    border-radius: var(--r-l) var(--r-l) 0 0;
  }
  .modal-close {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.6rem;
  }
  /* K2: a tall bottom-sheet form scrolls, so an absolutely-positioned close
     button gets pushed above the viewport. In these dialogs the × is the
     first child in flow — make it stick to the top of the scroll area. */
  .dialog-card > .modal-close {
    position: sticky;
    float: right;
    top: 0;
    margin: -0.6rem -0.4rem 0 0;
    background: var(--card);
    box-shadow: 0 0 0 6px var(--card);
  }
}

/* Onboarding wizard (#23) — dialog-card with step navigation. */
.ob-card {
  width: min(480px, 94vw);
  display: grid;
  gap: 0.8rem;
}
.ob-nav {
  margin-top: 0.4rem;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Account page (interim restyle; folds into the You tab in Phase 4)
   -------------------------------------------------------------------------- */
.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 0.9rem;
  align-items: start;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}
.profile-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 0.62rem 1rem;
}
.profile-list dt {
  font-weight: 700;
}
.profile-list dd {
  margin: 0;
  color: var(--ink-2);
}
.name-edit {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line-soft);
}
.name-edit .btn {
  width: fit-content;
}
.verify-block {
  padding: 1rem 0;
  border-top: 1px solid var(--line-soft);
}
.verify-block:first-of-type {
  border-top: none;
  padding-top: 0.4rem;
}
.verify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.verify-head h3 {
  margin: 0;
  font-size: 1rem;
}
.status-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
}
.proof-current {
  font-size: 0.78rem;
  margin: 0.2rem 0;
}
.notif-list,
.blocked-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  background: var(--card);
}
.notif-item.is-unread {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.notif-item strong {
  font-size: 0.88rem;
}
.notif-item p {
  margin: 0;
  font-size: 0.82rem;
}
.notif-item .muted {
  font-size: 0.72rem;
}
.blocked-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  background: var(--card);
}
.blocked-item.muted {
  border-style: dashed;
  background: none;
  justify-content: flex-start;
}
.blocked-name {
  font-size: 0.88rem;
  font-weight: 600;
}
@media (max-width: 980px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Admin dashboard (#9): sidebar layout + data-dense tables + roadmap board
   ========================================================================== */
.admin-main.container {
  width: min(1500px, 96vw);
}
.admin-tag {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-accent);
  background: var(--accent);
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  vertical-align: middle;
}

/* Sidebar + content grid */
.admin-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.admin-side {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.admin-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 0.5rem;
}
.admin-tabs .tab {
  border: none;
  background: none;
  color: var(--ink-2);
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-s);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}
.admin-tabs .tab:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.admin-tabs .tab.is-active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.3rem;
}
.auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  font-size: 0.82rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.auto-toggle input {
  width: auto;
}
.admin-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.admin-head h1 {
  margin: 0;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}
.admin-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.admin-card strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.1;
  color: var(--ink);
}
.admin-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.admin-card-sub {
  font-size: 0.74rem;
  color: var(--ink-2);
}

.admin-panel,
.admin-board {
  padding: 1rem 1.1rem;
}
.admin-hint {
  font-size: 0.8rem;
  margin: 0 0 0.8rem;
}
.admin-banner-editor .inline-form input[type="text"] {
  flex: 2 1 260px;
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.admin-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink);
  line-height: 1.45;
}
.admin-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--paper-2) 45%, transparent);
}
.admin-table tbody tr:hover td {
  background: var(--paper-2);
}

.admin-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.admin-pill.tone-good {
  background: var(--sage-soft);
  color: var(--sage);
}
.admin-pill.tone-warn {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.admin-pill.tone-bad {
  background: var(--brick-soft);
  color: var(--brick-ink);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.admin-empty {
  text-align: center;
  color: var(--ink-3);
  padding: 1.4rem 0;
  font-size: 0.86rem;
}

/* Inline state-aware row controls */
.admin-select,
.admin-num {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  padding: 0.26rem 0.4rem;
  max-width: 100%;
  cursor: pointer;
  width: auto;
}
.admin-select {
  min-width: 8em;
}
.admin-num {
  width: 4.2rem;
  cursor: text;
}
.admin-select:hover,
.admin-num:hover {
  border-color: var(--accent);
}
.admin-select:disabled,
.admin-num:disabled {
  opacity: 0.5;
  cursor: progress;
}
.admin-select[data-tone="good"] {
  border-color: var(--sage);
  color: var(--sage);
}
.admin-select[data-tone="warn"] {
  border-color: var(--amber);
  color: var(--amber-ink);
}
.admin-select[data-tone="bad"] {
  border-color: var(--brick);
  color: var(--brick-ink);
}
.admin-table-footer {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.8rem;
  min-height: 1.2rem;
}
.admin-footer-info {
  font-size: 0.78rem;
  color: var(--ink-3);
}
.admin-field {
  display: inline-flex;
  flex-direction: column;
  gap: 0.12rem;
}
.admin-field-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

/* Roadmap kanban board */
.board-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.board-controls .admin-hint {
  margin: 0;
}
.board-simple-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.board-simple-toggle input {
  width: auto;
  margin: 0;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.4rem;
}
.kanban-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem;
  background: var(--paper-2);
  border-radius: var(--r);
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-head h3 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
}
.kanban-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--card);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.kanban-head-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.kanban-toggle-all {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.13rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}
.kanban-toggle-all:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.col-done .kanban-col-head h3 {
  color: var(--sage);
}
.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  padding: 0.6rem 0.7rem;
}
.col-done .kanban-card {
  opacity: 0.82;
}
.kanban-head {
  display: flex;
  flex-direction: column;
}
.kanban-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink);
}
.kanban-card.has-desc .kanban-head {
  cursor: pointer;
}
.kanban-card.has-desc:hover {
  border-color: var(--accent);
}
.kanban-desc,
.kanban-simple {
  cursor: text;
  user-select: text;
}
.kanban-desc {
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ink-2);
  display: none;
}
.kanban-card.is-open .kanban-desc {
  display: block;
}
.kanban-simple {
  display: none;
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.show-simple .kanban-card.is-open .kanban-simple {
  display: block;
}
@media (hover: hover) {
  .kanban-card.has-desc:hover .kanban-desc {
    display: block;
  }
  .show-simple .kanban-card.has-desc:hover .kanban-simple {
    display: block;
  }
}
.kanban-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.kanban-tag {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
}
.tag-bug {
  background: var(--brick-soft);
  color: var(--brick-ink);
}
.tag-feature {
  background: var(--sage-soft);
  color: var(--sage);
}
.tag-epic {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.tag-security {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.tag-chore {
  background: var(--paper-2);
  color: var(--ink-2);
}
.tag-action {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.kanban-issue {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration: none;
}
.kanban-issue:hover {
  text-decoration: underline;
}
.kanban-empty {
  font-size: 0.78rem;
  text-align: center;
  padding: 0.5rem 0;
}

/* Admin responsive: sidebar becomes a horizontal strip */
@media (max-width: 900px) {
  .admin-layout {
    /* minmax(0,…): a bare 1fr means minmax(auto,1fr), which lets the users
       table's intrinsic width force the whole page wider than the phone
       (feedback I1). */
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-content > * {
    min-width: 0;
    max-width: 100%;
  }
  .admin-side {
    position: static;
    flex-direction: column-reverse;
  }
  .admin-tabs {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .admin-tabs .tab {
    white-space: nowrap;
  }
  .kanban {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Feedback round 1 fixes (docs/FEEDBACK-1.md)
   ========================================================================== */

/* F1: no page scroll behind any open overlay */
body.no-scroll {
  overflow: hidden;
}

/* B4: reclaim vertical space in the app */
.app-page {
  padding-top: 0.9rem;
}
.app-tabs {
  margin-bottom: 0.9rem;
}
.bhero {
  padding: 0.95rem 1.2rem;
  margin-bottom: 0.9rem;
}
.bhero h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

/* B1/B2: header account menu */
.menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 0.55rem;
}
.menu-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
  cursor: pointer;
  padding: 0;
}
.menu-btn:hover {
  border-color: var(--accent);
}
.menu-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 700;
}
.menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(280px, 86vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lift);
  z-index: 400;
  overflow: hidden;
  padding: 0.4rem;
}
.menu-head {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 0.3rem;
}
.menu-head .muted {
  font-size: 0.74rem;
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-s);
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover {
  background: var(--paper-2);
}
.menu-logout {
  color: var(--brick-ink);
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-s) var(--r-s);
  margin-top: 0.3rem;
}
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.84rem;
  color: var(--ink-2);
}
.menu-row .icon-btn {
  width: 34px;
  height: 34px;
}
.menu-row .lang-switch button {
  padding: 0.32rem 0.5rem;
}

/* E3: single trust mark with state + tooltip */
.trust-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.3rem 0.68rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--paper-2);
  color: var(--ink-2);
  cursor: help;
}
.trust-mark svg {
  width: 15px;
  height: 15px;
}
.trust-mark[data-state="ok"] {
  background: var(--sage-soft);
  color: var(--sage);
}
.trust-mark[data-state="partial"] {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

/* C2: ask filter chips */
.ask-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.ask-filters .chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
.ask-filters .chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* C3: threaded replies under an ask */
.ask-replies {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0 0 0 0.85rem;
  border-left: 2px solid var(--line-soft);
  display: grid;
  gap: 0.5rem;
}
.ask-reply p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink);
}
.ask-reply .muted {
  font-size: 0.72rem;
}

/* D1: loan summary fact rows */
.loan-summary {
  display: grid;
  gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  background: var(--paper-2);
  border-radius: var(--r-s);
}
.loan-summary-row {
  display: flex;
  gap: 0.6rem;
  font-size: 0.82rem;
  align-items: baseline;
}
.loan-summary-label {
  flex-shrink: 0;
  min-width: 5.2rem;
  color: var(--ink-3);
}
.loan-summary-value {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* F5: the tilted building visual must never widen the page */
main.landing {
  overflow-x: clip;
}

/* G3: admin cells wrap instead of silently truncating. break-word (not
   `anywhere`) so words wrap at spaces and never letter-by-letter (I1). */
.admin-table td {
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 28rem;
}
.admin-table td .row-actions,
.admin-table td .admin-select,
.admin-table td .admin-num {
  white-space: nowrap;
}
/* The table keeps room to breathe and scrolls INSIDE its wrap on phones,
   instead of strangling columns into vertical letter-stacks. */
@media (max-width: 700px) {
  .admin-table {
    min-width: 760px;
  }
}

/* Mobile pass (feedback F2-F4, D2) */
@media (max-width: 700px) {
  /* F2: search owns the row; labeled filters share the next one */
  .filter-search {
    flex-basis: 100%;
  }
  .filter-bar .filter-group {
    flex: 1 1 44%;
  }
  .filter-bar .filter-group select {
    width: 100%;
  }

  /* D2: loans stack; actions drop below the text */
  .request-item {
    grid-template-columns: 1fr;
  }
  .request-actions {
    justify-content: flex-start;
  }

  /* F4: asks composer stacks cleanly */
  .ask-form .two-col {
    grid-template-columns: 1fr;
  }
  .ask-form .filter-group select,
  .ask-form .filter-group input {
    width: 100%;
  }

  /* F3: language switch stays tappable on small screens */
  .lang-switch button {
    padding: 0.5rem 0.7rem;
    font-size: 0.78rem;
  }
  .header-inner {
    gap: 0.45rem;
  }

  /* B4 on mobile too */
  .app-page {
    padding-top: 0.7rem;
  }
}

/* G2: inline text editing in admin tables */
.admin-text {
  width: 10rem;
  cursor: text;
}
.admin-text-wide {
  width: 100%;
  min-width: 16rem;
}

/* E1: You tab packs into two balanced columns */
.you-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

/* ==========================================================================
   Feedback round 2 (H1-H4): loans/browse integration, offers, mobile pass
   ========================================================================== */

/* H3: the item, inside a loan's details */
.loan-listing {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  padding: 0.55rem 0.7rem;
  background: var(--card-2);
  cursor: pointer;
  transition: border-color 140ms ease;
}
.loan-listing:hover {
  border-color: var(--accent);
}
.loan-listing-media {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--r-s);
  background: var(--paper-2);
}
.loan-listing-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.loan-listing-media .listing-icon {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}
.loan-listing-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  margin-right: auto;
}
.loan-listing-meta strong {
  font-size: 0.92rem;
  line-height: 1.3;
}
.loan-listing-meta .muted {
  font-size: 0.76rem;
}

/* H3: loan status strip on Browse cards + the detail modal */
.card-loan {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-s);
  background: var(--accent-soft);
  cursor: pointer;
}
.card-loan:hover {
  outline: 1.5px solid var(--accent);
}
.card-loan-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-ink);
}
.loan-steps-mini {
  margin-top: 0;
}
.loan-steps-mini .loan-dot {
  width: 0.55rem;
  height: 0.55rem;
}
.loan-steps-mini .loan-bar {
  width: 1rem;
}
.loan-steps-mini .loan-step-label {
  display: none;
}
.loan-steps-mini .loan-step.is-current .loan-step-label {
  display: inline;
  font-size: 0.62rem;
}

/* H4: offers on an ask */
.offer-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.3rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--r-s);
  background: var(--paper-2);
  font-size: 0.82rem;
}
.offer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
  background: var(--card);
}
.offer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.offer-meta strong {
  font-size: 0.86rem;
}
.offer-meta .muted {
  font-size: 0.74rem;
}
.offer-note {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-2);
  font-style: italic;
}

/* H2: language switch lives in the burger menu on small screens */
.nav-links .lang-switch {
  display: none;
}

@media (max-width: 700px) {
  /* Header: brand + actions must never push past the viewport */
  .header-inner {
    min-width: 0;
  }
  .header-inner > .lang-switch {
    display: none; /* moved into the burger panel */
  }
  .nav-links .lang-switch {
    display: inline-flex;
    align-self: center;
  }
  .brand {
    min-width: 0;
    overflow: hidden;
  }
  .site-header .btn.nav-primary {
    padding: 0.5rem 0.7rem;
    font-size: 0.78rem;
  }

  /* Landing rhythm: consistent side padding, nothing pinned to the edge */
  .landing-section,
  .hero,
  .stats {
    padding-left: 5vw;
    padding-right: 5vw;
  }
  .building {
    transform: none; /* the tilt reads as misalignment at phone width */
    margin: 0 auto;
  }
  .doors-g,
  .trust-g {
    gap: 0.7rem;
  }
  .door-card {
    padding: 1.3rem;
  }
  .spotlight {
    padding: 1.4rem 1.2rem;
  }
  .cta-section {
    padding: 64px 5vw;
  }

  /* Offers on mobile */
  .offer-row {
    flex-direction: column;
    align-items: stretch;
  }
  .offer-row .btn {
    width: 100%;
  }

  /* Admin on phones: everything full-width and stacked */
  .admin-main.container {
    width: 100%;
    padding: 0 4vw;
  }
  .admin-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .admin-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .admin-card {
    padding: 0.7rem 0.8rem;
  }
  .admin-card strong {
    font-size: 1.25rem;
  }
  .admin-banner-editor .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-banner-editor .inline-form input[type="text"],
  .admin-banner-editor .inline-form select {
    width: 100%;
    flex: none;
  }
  .admin-banner-editor .inline-form .btn {
    width: 100%;
  }
  .admin-panel,
  .admin-board {
    padding: 0.8rem;
  }
  .admin-table td {
    max-width: none;
  }
  .admin-text,
  .admin-text-wide {
    min-width: 8rem;
    width: 100%;
  }
  .admin-toolbar {
    justify-content: space-between;
  }
}

/* ==========================================================================
   Feedback round 4 (J1-J4): ask cards v2, search, notif click-through, photos
   ========================================================================== */
.ask-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.ask-toolbar .filter-search {
  flex: 1 1 220px;
}
.ask-toolbar .ask-filters {
  margin-bottom: 0;
}

.ask-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}
.ask-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-s);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.ask-card.is-note .ask-icon {
  background: var(--paper-2);
  color: var(--ink-3);
}
.ask-icon svg {
  width: 22px;
  height: 22px;
}
.ask-main {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}
.ask-title {
  font-size: 1rem;
}
.ask-title::first-letter {
  text-transform: uppercase;
}
.ask-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--ink-3);
}
.ask-who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ask-avatar {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 0.66rem;
  font-weight: 700;
}
.ask-card .offer-list {
  grid-column: 1 / -1;
}

/* J3: notifications are doors, not labels */
.notif-drop-item.is-clickable {
  cursor: pointer;
}
.notif-drop-item.is-clickable:hover,
.notif-drop-item.is-clickable:focus-visible {
  background: var(--paper-2);
  outline: none;
}
.notif-drop-item.is-unread.is-clickable:hover {
  background: var(--accent-soft);
}

/* J4: photo strip with previews, order, cover marker */
.photo-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.photo-cell {
  position: relative;
  width: 86px;
  cursor: grab;
}
.photo-cell.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.photo-cell.is-drop-target img {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.photo-cell img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  display: block;
}
.photo-cover-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
}
.photo-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
}
.photo-ctl {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 6px;
  width: 24px;
  height: 22px;
  line-height: 1;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}
.photo-ctl:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.photo-ctl:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 700px) {
  .ask-toolbar .filter-search {
    flex-basis: 100%;
  }
}

/* G4: admin row drill-in drawer (slide-over desktop / bottom sheet mobile) */
.admin-row {
  cursor: pointer;
}
.admin-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.admin-drawer {
  width: min(440px, 94vw);
  max-height: 100vh;
  overflow-y: auto;
  background: var(--card);
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  animation: drawer-in 180ms ease;
}
@keyframes drawer-in {
  from { transform: translateX(20px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.admin-drawer-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line-soft);
}
.admin-drawer-head h2 {
  margin: 0;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}
.admin-drawer-head .modal-close {
  position: static;
  flex-shrink: 0;
}
.admin-drawer-body {
  padding: 0.6rem 1.1rem 1.2rem;
}
.admin-drawer-field {
  display: grid;
  gap: 0.15rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.admin-drawer-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}
.admin-drawer-value {
  font-size: 0.9rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.admin-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
@media (max-width: 700px) {
  .admin-drawer-overlay {
    align-items: flex-end;
  }
  .admin-drawer {
    width: 100%;
    max-height: 88vh;
    border-radius: var(--r-l) var(--r-l) 0 0;
  }
}
