/* Lease Tracker — the TSG Hub design system.
   Primary #074A75 · Accent #F47D48 · Background #FFFFFF · Surface #F0FDFA · Text #134E4A
   DM Sans (display) / Inter (body) · glass panels over a pale mesh · floating sidebar.

   Contrast: text #134E4A on white 9.47:1; white on primary 9.35:1; ink #0E3B38 on
   orange 4.63:1. Orange is never the only signal: every state also has a text label. */

:root {
  /* palette */
  --primary: #074A75;
  --primary-700: #063A5C;
  --primary-100: #E4EEF5;
  --accent: #F47D48;
  --accent-50: #FFF4EE;
  --accent-ink: #0E3B38;            /* label colour on an orange fill */
  --accent-text: #A8481A;           /* orange dark enough to read as small text on white */
  --bg: #FFFFFF;
  --surface: #F0FDFA;
  --surface-2: #E4F2EF;
  --text: #134E4A;
  --text-soft: #2F5A56;
  --danger: #8F2F12;
  --danger-bg: #FBEDE8;
  --ok: #1F5F4B;
  --ok-bg: #E6F4EE;
  --gray: #bab3ad;

  /* glass */
  --glass-1: rgba(255, 255, 255, .66);
  --glass-2: rgba(255, 255, 255, .80);
  --glass-3: rgba(255, 255, 255, .92);
  --glass-line: rgba(7, 74, 117, .12);
  --line-strong: rgba(7, 74, 117, .22);
  --glass-hi: rgba(255, 255, 255, .55);
  --blur: saturate(150%) blur(16px);
  --blur-lg: saturate(160%) blur(26px);

  /* type: 1.25 scale on a 16px base */
  --display: "DM Sans", "Segoe UI", system-ui, Arial, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, Arial, sans-serif;
  --t-xs: .72rem;
  --t-sm: .8125rem;
  --t-0: 1rem;
  --t-1: 1.25rem;
  --t-2: 1.5625rem;
  --t-3: 1.953rem;

  /* space */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 48px;
  --sp-6: 64px;

  /* shape and depth */
  --r: 8px;
  --r-lg: 16px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(19, 78, 74, .06), 0 2px 8px rgba(7, 74, 117, .06);
  --sh-2: 0 4px 12px rgba(7, 74, 117, .08), 0 14px 32px rgba(7, 74, 117, .09);
  --sh-3: 0 20px 48px rgba(7, 74, 117, .18);
  --glow: 0 0 0 1px rgba(244, 125, 72, .40), 0 8px 26px rgba(244, 125, 72, .26);
  --focus-ring: 0 0 0 5px rgba(244, 125, 72, .30);

  /* motion */
  --dur: 250ms;
  --ease: ease-out;
  --rail-w: 236px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-family: var(--display); color: var(--primary); font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 4.5vw, 1.953rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus-ring); }
@media (forced-colors: active) { :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid CanvasText; } }
main:focus { outline: none; box-shadow: none; }

.skip { position: absolute; left: -9999px; top: 0; background: #fff; padding: 12px 16px; z-index: 100; border-radius: var(--r); }
.skip:focus { left: 8px; top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Mesh gradient: atmosphere only, kept pale and veiled so text stays AAA ── */
#mesh { position: fixed; inset: -25%; z-index: -2; pointer-events: none; filter: blur(70px); }
#mesh i { position: absolute; display: block; border-radius: 50%; opacity: .5; }
#mesh .m1 { width: 46vw; height: 46vw; left: -6%; top: -4%; background: rgba(7, 74, 117, .30); animation: drift1 42s var(--ease) infinite alternate; }
#mesh .m2 { width: 40vw; height: 40vw; right: -4%; top: 6%; background: rgba(244, 125, 72, .24); animation: drift2 52s var(--ease) infinite alternate; }
#mesh .m3 { width: 52vw; height: 52vw; left: 18%; bottom: -16%; background: rgba(255, 204, 182, .34); animation: drift3 46s var(--ease) infinite alternate; }
#mesh .m4 { width: 34vw; height: 34vw; right: 12%; bottom: -6%; background: rgba(7, 74, 117, .18); animation: drift4 58s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate3d(8vw, 6vh, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-7vw, 9vh, 0) scale(1.12); } }
@keyframes drift3 { to { transform: translate3d(6vw, -7vh, 0) scale(.9); } }
@keyframes drift4 { to { transform: translate3d(-9vw, -5vh, 0) scale(1.2); } }
#meshVeil { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, rgba(255, 255, 255, .66) 0%, rgba(255, 255, 255, .80) 55%, rgba(255, 255, 255, .88) 100%); }
@media (prefers-reduced-motion: reduce) { #mesh i { animation: none !important; } }

/* ── Sign-in intro: the TSG mark draws itself, once per sign-in (as on the TSG Hub) ──
   Eight bars rise from the baseline, centre out; six arms slice outward; the finished mark settles
   in over them and the name fades up. All of it is done inside about 1.3 seconds. */
#splash { position: fixed; inset: 0; z-index: 100; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 24px; background: linear-gradient(180deg, rgba(255, 255, 255, .97) 0%, #fff 100%); transition: opacity .5s ease; }
#splash.done { opacity: 0; pointer-events: none; }
#splash::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 60%, var(--accent) 60%, var(--accent) 100%); }
.splash-tag { position: absolute; top: 28px; right: 36px; font-family: var(--display); font-weight: 700; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.icon-stage { position: relative; width: min(240px, 56vw); aspect-ratio: 913 / 896; margin-bottom: 40px; }
.icon-stage svg { width: 100%; height: 100%; display: block; overflow: visible; }
.icon-stage .or { fill: #F47D48; }
.icon-stage .nv { fill: #074A75; }
.icon-png { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; animation: iconIn .30s ease 1.02s forwards; user-select: none; pointer-events: none; }
@keyframes iconIn { to { opacity: 1; } }
.fill-bar { transform-box: view-box; transform-origin: var(--ox) 889px; transform: scaleY(0); animation: riseBar .40s cubic-bezier(.85, 0, .15, 1) var(--bd) forwards; }
@keyframes riseBar { to { transform: scaleY(1); } }
.arm { transform-box: view-box; transform-origin: var(--ax) 50%; transform: scaleX(0); animation: armGrow .28s cubic-bezier(.85, 0, .15, 1) var(--ad) forwards; }
@keyframes armGrow { to { transform: scaleX(1); } }
#splash .b1 { --ox: 397px; --bd: 0.08s; }
#splash .b2 { --ox: 516px; --bd: 0.13s; }
#splash .b3 { --ox: 276px; --bd: 0.19s; }
#splash .b4 { --ox: 636px; --bd: 0.24s; }
#splash .b5 { --ox: 156px; --bd: 0.30s; }
#splash .b6 { --ox: 757px; --bd: 0.35s; }
#splash .b7 { --ox: 36px; --bd: 0.41s; }
#splash .b8 { --ox: 877px; --bd: 0.46s; }
#splash .a1 { --ax: 429px; --ad: 0.58s; }
#splash .a2 { --ax: 484px; --ad: 0.58s; }
#splash .a3 { --ax: 309px; --ad: 0.66s; }
#splash .a4 { --ax: 604px; --ad: 0.66s; }
#splash .a5 { --ax: 189px; --ad: 0.74s; }
#splash .a6 { --ax: 725px; --ad: 0.74s; }
.splash-title { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--primary); letter-spacing: .22em; text-transform: uppercase; display: flex; align-items: center; gap: 14px; opacity: 0; transform: translateY(8px); animation: fadeUp .35s ease .86s forwards; }
.splash-title::before { content: ""; width: 10px; height: 10px; background: var(--accent); }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .splash-tag { right: 20px; font-size: .72rem; } .splash-title { font-size: 1.05rem; letter-spacing: .18em; } }

/* ── Shell: floating sidebar and stage ── */
.rail {
  position: fixed; left: var(--sp-3); top: var(--sp-3); bottom: var(--sp-3); width: var(--rail-w); z-index: 30;
  display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) 14px var(--sp-2);
  border-radius: var(--r-lg); background: var(--glass-2); -webkit-backdrop-filter: var(--blur-lg); backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-line); box-shadow: var(--sh-2), inset 0 1px 0 var(--glass-hi);
  transition: width var(--dur) var(--ease); overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
/* TSG logo alone, top-left */
.rail-brand { display: flex; align-items: center; padding: 0 8px var(--sp-1); min-height: 64px; border-radius: var(--r); line-height: 0; }
.rail-brand .logo-full { height: 64px; width: auto; display: block; }
.rail-brand .logo-icon { height: 38px; width: auto; display: none; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.rail-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px;
  border: 1px solid transparent; background: none; border-radius: var(--r);
  padding: 10px 12px 10px 16px; font-size: .92rem; font-weight: 600; color: var(--text-soft);
  text-align: left; text-decoration: none; position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.rail-item svg { flex: none; }
.rail-item .ri-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.rail-item:hover { background: rgba(255, 255, 255, .72); color: var(--primary); box-shadow: var(--glow); }
.rail-item[aria-current="page"] { background: linear-gradient(90deg, rgba(7, 74, 117, .10), rgba(240, 253, 250, .6)); color: var(--primary); border-color: var(--glass-line); font-weight: 700; }
.rail-item[aria-current="page"]::before { content: ""; position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 3px; background: var(--accent); }
.rail-sep { height: 1px; background: var(--glass-line); margin: var(--sp-1) 4px; flex: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; font-size: var(--t-sm); color: var(--text-soft); }
.av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-family: var(--display); font-weight: 700; font-size: .72rem; letter-spacing: .02em; }
.rail-user .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rail-collapse { align-self: flex-start; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .6); border-radius: var(--r-pill); width: 32px; height: 32px; color: var(--primary); display: flex; align-items: center; justify-content: center; transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease); }
.rail-collapse:hover { background: #fff; box-shadow: var(--glow); }
.rail-collapse svg { transition: transform var(--dur) var(--ease); }

body.rail-mini { --rail-w: 78px; }
body.rail-mini .rail-brand { justify-content: center; padding-left: 0; padding-right: 0; }
body.rail-mini .rail-brand .logo-full { display: none; }
body.rail-mini .rail-brand .logo-icon { display: block; }
body.rail-mini .ri-l, body.rail-mini .rail-user .who, body.rail-mini .rail-cta .cta-l { display: none; }
body.rail-mini .rail-item { justify-content: center; padding: 10px 0; }
body.rail-mini .rail-user { justify-content: center; padding-left: 0; padding-right: 0; }
body.rail-mini .rail-collapse { align-self: center; }
body.rail-mini .rail-collapse svg { transform: rotate(180deg); }
body.rail-mini .btn.rail-cta { padding: 0; width: 100%; }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; margin-left: calc(var(--rail-w) + var(--sp-5)); padding-right: var(--sp-4); transition: margin-left var(--dur) var(--ease); }
body.signed-out .rail { display: none; }
body.signed-out .stage { margin-left: 0; padding: 0 var(--sp-4); }

/* Top bar. With the sidebar showing it carries only the tagline, top-right, opposite the logo. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; }
.topbar .brand { display: none; line-height: 0; border-radius: var(--r); }
.topbar .brand img { height: 56px; width: auto; display: block; }
body.signed-out .topbar { min-height: 96px; }
body.signed-out .topbar .brand { display: block; }
.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.tagline { font-family: var(--display); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); white-space: nowrap; }
.burger { display: none; width: 46px; height: 46px; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--glass-2); flex-direction: column; justify-content: center; align-items: center; gap: 5px; flex: none; }
.burger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--primary); transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Page ── */
main { flex: 1; width: 100%; max-width: 1360px; padding: 0 0 var(--sp-6); }
.boot { color: var(--text-soft); padding: 40px 0; text-align: center; }
main > * + * { margin-top: var(--sp-3); }
main > .hero + * { margin-top: var(--sp-4); }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--text-soft); }
.small { font-size: .875rem; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

/* ── Hero: the navy brand block that heads every page ── */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--primary); box-shadow: 0 18px 44px rgba(7, 74, 117, .20); animation: morphIn var(--dur) var(--ease) both; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(90deg, var(--primary-700) 0 58%, var(--accent) 58% 100%); }
.hero-in { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-2) var(--sp-4); padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + 6px); }
.hero-copy { min-width: 0; flex: 1 1 380px; }
.hero-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px; font-weight: 600; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.hero-eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--accent); flex: none; }
.hero-eyebrow a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .4); }
.hero-eyebrow a:hover { border-bottom-color: var(--accent); }
.hero-eyebrow .sep { opacity: .5; }
/* the title is brand orange on navy: 3.51:1, which clears the large-text bar at this size */
.hero h1 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); font-weight: 700; color: var(--accent); letter-spacing: -.03em; line-height: 1.08; overflow-wrap: anywhere; }
.hero-sub { margin-top: 12px; color: rgba(255, 255, 255, .86); max-width: 68ch; font-size: .98rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.hero .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.hero .btn:hover { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .5); color: #fff; }
.hero .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hero .btn.primary:hover { background: #F08C5E; color: var(--accent-ink); }
.hero .field > .label { color: rgba(255, 255, 255, .78); }
.hero .input { background: #fff; border-color: rgba(255, 255, 255, .24); }
@keyframes morphIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hero { animation: none; } }

/* ── Panels ── */
.card { border-radius: var(--r-lg); overflow: hidden; background: var(--glass-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-line); box-shadow: var(--sh-2), inset 0 1px 0 var(--glass-hi); transition: box-shadow var(--dur) var(--ease); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px var(--sp-3); border-bottom: 1px solid var(--glass-line); background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0)); }
.card-head h2 { font-size: .92rem; letter-spacing: .10em; text-transform: uppercase; }
.card.project .card-head h2 { font-size: 1.2rem; letter-spacing: -.015em; text-transform: none; }
.card-head .meta { color: var(--text-soft); font-size: .875rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.card-body { padding: var(--sp-3); }
.empty { padding: 28px var(--sp-3); color: var(--text-soft); text-align: center; }
.count { display: inline-block; min-width: 26px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--primary-100); font-family: var(--body); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0; color: var(--primary); text-align: center; vertical-align: 1px; }
.two-col { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .two-col { grid-template-columns: 3fr 2fr; } }
.two-col > .col { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }

/* ── Buttons: pill, 44px minimum touch target ── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
  border: 1px solid var(--glass-line); border-radius: var(--r-pill); background: var(--glass-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--primary); font-weight: 600; font-size: .94rem; line-height: 1; text-decoration: none; white-space: nowrap; box-shadow: var(--sh-1);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover { background: var(--glass-3); color: var(--primary-700); border-color: rgba(244, 125, 72, .45); box-shadow: var(--glow); }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.primary:hover { background: #F08C5E; border-color: #F08C5E; color: var(--accent-ink); box-shadow: var(--glow); }
.btn.navy { background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0)), var(--primary); border-color: var(--primary); color: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.navy:hover { background: var(--primary-700); color: #fff; box-shadow: 0 0 0 1px rgba(7, 74, 117, .28), 0 10px 26px rgba(7, 74, 117, .28); }
.btn.quiet { border-color: transparent; background: transparent; box-shadow: none; padding: 0 14px; font-weight: 600; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.quiet:hover { background: var(--accent-50); box-shadow: var(--glow); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: var(--t-sm); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; box-shadow: none; transform: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn .spin { animation: none; } .btn, .card, .ccard { transition: none; } }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Forms ── */
.field { display: block; }
.field + .field, .field + .field-group, .field-group + .field, .pick + .field, .field + .pick, .pick + .pick { margin-top: 16px; }
.field > .label, .field-group > legend { display: block; font-weight: 700; font-size: var(--t-sm); letter-spacing: .06em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; padding: 0; }
.req { color: var(--accent-text); margin-left: 2px; }
.field .hint { display: block; color: var(--text-soft); font-size: .875rem; margin-top: 6px; }
.field .err, .field-group .err { display: block; color: var(--danger); font-size: .875rem; margin-top: 6px; font-weight: 600; }
.input, select.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--glass-3);
  font-size: 1rem; color: var(--text); box-shadow: inset 0 1px 2px rgba(19, 78, 74, .05);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-soft); opacity: .7; }
.input:hover { background: #fff; }
.input:focus { outline: none; border-color: rgba(244, 125, 72, .65); background: #fff; box-shadow: var(--focus-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(143, 47, 18, .16); }
.input:disabled { opacity: .5; cursor: not-allowed; }
.input.code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.input.slim { width: auto; max-width: 160px; padding: 6px 10px; font-size: .875rem; }
textarea.input { min-height: 72px; resize: vertical; line-height: 1.45; }
.field-group { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.checks { border: 1px solid var(--glass-line); border-radius: var(--r); max-height: 260px; overflow: auto; background: var(--glass-2); }
.checks .group { padding: 8px 12px 4px; font-size: var(--t-xs); font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; background: var(--primary-100); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 12px; cursor: pointer; }
.check + .check { border-top: 1px solid var(--glass-line); }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.check.slim { padding: 0; font-size: .875rem; color: var(--text-soft); }
.alert { border: 1px solid rgba(143, 47, 18, .25); border-left: 4px solid var(--danger); background: var(--danger-bg); border-radius: var(--r); padding: 12px 14px; color: #5C1C0A; }
.alert.info { border-color: var(--glass-line); border-left-color: var(--primary); background: var(--primary-100); color: #0B3550; }
.alert.ok { border-color: rgba(31, 95, 75, .25); border-left-color: var(--ok); background: var(--ok-bg); color: #12432B; }
.alert .ref { display: block; font-size: var(--t-sm); margin-top: 4px; opacity: .85; }
/* anti-bot field: off-screen, never display:none (bots skip those) */
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.cols { display: grid; gap: 0 16px; grid-template-columns: 1fr; margin-top: 16px; }
.cols > .field + .field { margin-top: 16px; }
.cols + .field, .cols + .field-group { margin-top: 16px; }
@media (min-width: 520px) { .cols { grid-template-columns: 1fr 1fr; } .cols.three { grid-template-columns: 2fr 1fr 1fr; } .cols > .field + .field { margin-top: 0; } }
.status-field { min-width: 240px; }
.label.small { font-size: var(--t-sm); font-weight: 600; color: var(--text-soft); }
.sub-field { margin-top: 10px; }
p.err { color: var(--danger); font-weight: 600; }

/* a select with a "new" choice that opens a text box beneath it */
.pick .pick-new { margin-top: 8px; }
fieldset.section { border: 0; border-top: 1px solid var(--glass-line); padding: 16px 0 0; margin: 20px 0 0; min-width: 0; }
fieldset.section > legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--primary); }
fieldset.section > legend + * { clear: both; }

/* ── Toolbar: search, filter, sort ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.toolbar .field { flex: 0 1 220px; margin-top: 0; }
.toolbar .field.grow { flex: 1 1 260px; }
.toolbar .tally { margin-left: auto; color: var(--text-soft); font-size: .875rem; padding-bottom: 12px; }
.card > .toolbar { padding: 16px var(--sp-3); border-bottom: 1px solid var(--glass-line); }
.card > .toolbar .field { flex: 1 1 150px; }
.card > .toolbar .field.grow { flex: 2 1 220px; }
@media (max-width: 640px) { .toolbar .field { flex: 1 1 140px; } .toolbar .field.grow, .card > .toolbar .field.grow { flex: 1 1 100%; } .toolbar .tally { margin-left: 0; padding-bottom: 0; flex: 1 1 100%; } }

/* ── Pills: every state has a text label; color is never the only signal ── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: 600; border: 1px solid var(--line-strong); background: var(--glass-2); color: var(--text-soft); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.pill.active { color: var(--ok); border-color: rgba(31, 95, 75, .3); background: var(--ok-bg); }
.pill.active::before { background: var(--ok); }
.pill.invited { color: var(--accent-text); border-color: rgba(244, 125, 72, .45); background: var(--accent-50); }
.pill.invited::before { background: transparent; border: 2px solid var(--accent); }
.pill.disabled { color: var(--danger); border-color: rgba(143, 47, 18, .3); background: var(--danger-bg); }
.pill.disabled::before { background: var(--danger); border-radius: 1px; }
.pill.plain::before { display: none; }
.pill.brandtag { background: var(--primary-100); border-color: rgba(7, 74, 117, .2); color: var(--primary); }
/* Brand labels: eight colors, one per brand, each dark text on its own pale tint (all AA or better). */
.pill.bc0 { background: #E4EEF5; border-color: #B7CEDD; color: #074A75; }
.pill.bc1 { background: #FFEDE3; border-color: #F6C3A6; color: #8F3A10; }
.pill.bc2 { background: #DDF3EE; border-color: #A6D5CA; color: #0F5C4D; }
.pill.bc3 { background: #F0E6F6; border-color: #CDB6DD; color: #5B2A7A; }
.pill.bc4 { background: #FBF0CF; border-color: #E2CC82; color: #6B4E00; }
.pill.bc5 { background: #FBE4EA; border-color: #EDB6C4; color: #8A1F40; }
.pill.bc6 { background: #E3F2DA; border-color: #B7D6A3; color: #2F5E14; }
.pill.bc7 { background: #E8EAEE; border-color: #C0C6D0; color: #2F3B4C; }
/* a name that opens something: reads as a link, behaves as a button */
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary); text-decoration: underline; text-decoration-color: rgba(7, 74, 117, .35); text-underline-offset: 3px; cursor: pointer; border-radius: 4px; }
.linklike:hover { text-decoration-color: var(--accent); }
.kv.contact { font-size: 1rem; gap: 10px 20px; }
button.rail-user { width: 100%; border: 1px solid transparent; background: none; border-radius: var(--r); text-align: left; min-height: 44px; padding: 6px; transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
button.rail-user:hover { background: rgba(255, 255, 255, .72); box-shadow: var(--glow); }
/* removed records, folded away until asked for */
details.removed > summary { padding: 16px var(--sp-3); cursor: pointer; font-family: var(--display); font-weight: 700; font-size: .92rem; letter-spacing: .10em; text-transform: uppercase; color: var(--primary); min-height: 48px; }
details.removed[open] > summary { border-bottom: 1px solid var(--glass-line); }
details.removed > .toolbar { padding: 16px var(--sp-3); border-bottom: 1px solid var(--glass-line); }
details.removed > .toolbar .field { flex: 1 1 150px; }
details.removed > .toolbar .field.grow { flex: 2 1 220px; }
.alert .ref .btn { margin-top: 8px; }
p.alert { margin: 0 0 16px; }
.card-head .meta + .meta { margin-top: 6px; }
.meta.brands, .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ── Tables: scroll sideways on small screens, first column stays put ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--glass-line); border-radius: var(--r-lg); background: var(--glass-3); box-shadow: var(--sh-1); }
table.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--glass-line); vertical-align: top; }
.table th { font-size: var(--t-xs); font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; background: #EFF5F9; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; min-width: 190px; }
.table .sticky { position: sticky; left: 0; background: #FCFEFE; z-index: 1; }
.table th.sticky { background: #EFF5F9; }
.table .strong { color: var(--text); }
.table .sub { display: block; color: var(--text-soft); font-size: .875rem; overflow-wrap: anywhere; }
.table td.who { min-width: 210px; }
.table td.sees { min-width: 170px; }
.table td.actions .btn-row { justify-content: flex-end; gap: 0 4px; }
.card > .table-wrap, .more-terms .table-wrap { border: 0; border-top: 1px solid var(--glass-line); border-radius: 0; box-shadow: none; }
.card > .card-head + .table-wrap { border-top: 0; }

/* phones: a table becomes a list of cards */
@media (max-width: 760px) {
  .table.cards thead { position: absolute; left: -9999px; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { padding: 14px 16px; border-bottom: 1px solid var(--glass-line); }
  .table.cards tr:last-child { border-bottom: 0; }
  .table.cards td { border: 0; padding: 3px 0; }
  .table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--text-soft); font-size: .875rem; }
  .table.cards td.actions { text-align: left; padding-top: 10px; min-width: 0; }
  .table.cards td.actions .btn-row { justify-content: flex-start; margin-left: -14px; }
  .table.cards td.who, .table.cards td.sees { min-width: 0; }
  .table.cards .sticky { position: static; background: none; }
}

/* ── Client cards ── */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-3); }
.ccard { display: flex; flex-direction: column; text-decoration: none; color: inherit; border: 1px solid var(--glass-line); border-radius: var(--r-lg); overflow: hidden; background: var(--glass-2); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--sh-1), inset 0 1px 0 var(--glass-hi); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease); }
.ccard:hover { transform: translateY(-4px); background: var(--glass-3); box-shadow: var(--sh-2), 0 0 0 1px rgba(244, 125, 72, .42), 0 14px 34px rgba(244, 125, 72, .20); }
.logo-box { display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-box .fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; color: #fff; letter-spacing: .02em; background: linear-gradient(135deg, var(--primary) 0%, #0C6096 55%, #3E7EA6 100%); }
.ccard .logo-box { height: 150px; border-bottom: 1px solid var(--glass-line); }
.ccard .logo-box img { padding: 20px; }
.ccard .logo-box .fallback { font-size: 2.6rem; }
.ccard .body { padding: var(--sp-2) var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: 7px; flex: 1; }
.kicker { font-size: .7rem; font-weight: 700; letter-spacing: .10em; text-transform: uppercase; color: var(--accent-text); overflow-wrap: anywhere; }
.ccard h2 { font-size: var(--t-1); letter-spacing: -.015em; overflow-wrap: anywhere; }
.ccard p { font-size: .9rem; color: var(--text-soft); line-height: 1.45; }
.ccard .open { margin-top: auto; padding-top: 6px; font-size: .9rem; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.ccard .open::after { content: "→"; color: var(--accent); transition: transform var(--dur) var(--ease); }
.ccard:hover .open::after { transform: translateX(4px); }

/* the client's own page */
.identity { display: flex; align-items: center; gap: var(--sp-2); }
.identity .logo-box { width: 112px; height: 84px; flex: none; border: 1px solid var(--glass-line); border-radius: var(--r); }
.identity .logo-box img { padding: 8px; }
.identity .logo-box .fallback { font-size: 1.6rem; }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px var(--sp-3); border-top: 1px solid var(--glass-line); }
.people li:first-child { border-top: 0; }
.people .who { flex: 1 1 200px; min-width: 0; }
.people .who .sub { display: block; color: var(--text-soft); font-size: .875rem; overflow-wrap: anywhere; }
.note { padding: 12px var(--sp-3); font-size: .875rem; color: var(--text-soft); border-top: 1px solid var(--glass-line); background: rgba(240, 253, 250, .6); }

/* small logo tile beside a brand, a market or a project */
.logo-box.mini { width: 48px; height: 40px; flex: none; border: 1px solid var(--glass-line); border-radius: var(--r); }
.logo-box.mini img { padding: 4px; }
.logo-box.mini .fallback { font-size: .8rem; }
/* market first and bold, franchisee after it in regular weight */
a.market, span.market { text-decoration: none; color: inherit; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
span.market .strong { color: var(--primary); }
span.market .fr { font-weight: 400; color: var(--text-soft); }
a.market:hover .strong { text-decoration: underline; }
a.market .strong { color: var(--primary); }
a.market .fr { font-weight: 400; color: var(--text-soft); }
.row-link > .logo-box.mini { align-self: center; }
.card.open .row-main { flex: 1 1 150px; }
.card.open .row-side { gap: 8px 4px; }
.card.open .row-side .btn.quiet { padding: 0 10px; }
.card.open .row-side .pill { margin-right: 6px; }
.card.open .row-side { flex-wrap: nowrap; }
@media (max-width: 640px) { .card.open .row-side { flex-wrap: wrap; } }
/* three side cards in a row under a client's projects */
.trio { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .trio { grid-template-columns: repeat(3, 1fr); } }
/* a card whose dropdown may reach past its edge */
.card.open { overflow: visible; position: relative; z-index: 5; }
.card.open > :first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card.open > :last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ── Multi-select dropdown ── */
.toolbar { position: relative; z-index: 5; }
.multi { position: relative; }
.multi > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; user-select: none; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: translateY(-2px) rotate(45deg); flex: none; }
.multi[open] > summary { border-color: rgba(244, 125, 72, .65); background: #fff; }
.multi[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.multi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-panel { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 100%; width: max-content; max-width: min(320px, calc(100vw - 48px)); max-height: 300px; overflow: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--sh-3); }
.multi-panel .check + .check { border-top: 1px solid var(--glass-line); }
.multi-clear { width: 100%; justify-content: flex-start; border-top: 1px solid var(--glass-line); border-radius: 0; padding: 0 12px; }

/* ── Lists ── */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--glass-line); }
.row-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 12px var(--sp-3); min-height: 56px; text-decoration: none; color: inherit; transition: background var(--dur) var(--ease); }
a.row-link:hover { background: rgba(255, 255, 255, .7); }
.row-main { flex: 1 1 260px; min-width: 0; }
.row-main .sub, .row-side.sub { display: block; color: var(--text-soft); font-size: .875rem; }
.row-main a.strong { text-decoration: none; }
.row-main a.strong:hover { text-decoration: underline; }
.row-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .875rem; }
.row-side.wide { flex: 2 1 320px; font-size: .94rem; }
.rollup { font-size: 1rem; }

/* ── Sign-in ── */
.signin { max-width: 460px; margin: clamp(8px, 6vw, 56px) auto 0; }
.signin .card { background: var(--glass-3); box-shadow: var(--sh-3), inset 0 1px 0 var(--glass-hi); }
.signin .card-body { padding: clamp(22px, 6vw, 36px); }
.signin h1 { margin-bottom: 8px; }
.signin .lede { color: var(--text-soft); margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: .875rem; margin: 26px 0 18px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--glass-line); }

/* ── Property cards (external users) ── */
.grid { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.pcard { padding: var(--sp-3); }
.pcard .over { font-size: .7rem; text-transform: uppercase; letter-spacing: .10em; color: var(--accent-text); font-weight: 700; margin-bottom: 6px; }
.pcard p { color: var(--text-soft); margin-top: 10px; }

/* ── System check ── */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 14px; padding: 14px var(--sp-3); border-top: 1px solid var(--glass-line); align-items: flex-start; }
.checklist li:first-child { border-top: 0; }
.checklist .state { flex: none; width: 96px; }
.checklist .what { font-weight: 600; }
.checklist .why { color: var(--text-soft); font-size: .875rem; margin-top: 2px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 20px; font-size: .875rem; margin: 0; }
.kv dt { color: var(--text-soft); word-break: break-word; }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }

/* ── Audit ── */
.change { font-size: .875rem; }
.change del { color: var(--danger); text-decoration: line-through; }
.change ins { color: var(--ok); text-decoration: none; font-weight: 500; }
.change .arrow { color: var(--text-soft); margin: 0 6px; }

/* ── Dialog ── */
dialog.dlg { border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--glass-3); -webkit-backdrop-filter: var(--blur-lg); backdrop-filter: var(--blur-lg); box-shadow: var(--sh-3), inset 0 1px 0 var(--glass-hi); color: var(--text); }
dialog.dlg[open] { animation: morphUp var(--dur) var(--ease) both; }
dialog.dlg::backdrop { background: rgba(19, 78, 74, .34); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
@keyframes morphUp { from { opacity: 0; transform: scale(.96) translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.dlg[open] { animation: none; } }
.dlg form { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.dlg-head { padding: 20px var(--sp-3); border-bottom: 1px solid var(--glass-line); display: flex; align-items: center; gap: 12px; }
.dlg-head h2 { flex: 1; font-size: 1.35rem; letter-spacing: -.02em; }
.dlg-body { padding: var(--sp-3); overflow: auto; }
.dlg-foot { padding: 14px var(--sp-3); border-top: 1px solid var(--glass-line); display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 10px; }
@media (max-width: 520px) { .dlg-foot .btn { flex: 1 1 100%; } }
.dlg.wide { width: min(760px, calc(100vw - 24px)); }

/* ── Toast ── */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--primary); color: #fff; padding: 12px 20px; border-radius: var(--r-pill); box-shadow: var(--sh-3); max-width: calc(100vw - 32px); z-index: 60; font-weight: 600; font-size: .94rem; }
.toast.bad { background: var(--danger); border-radius: var(--r); }

/* ══ Tracking ══ */
/* rounds */
.round { border-top: 1px solid var(--glass-line); padding: 16px var(--sp-3); }
.round-n { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .10em; color: var(--accent-text); margin-bottom: 10px; }
.round-sides { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .round-sides { grid-template-columns: 1fr 1fr; } }
.position { border: 1px solid var(--glass-line); border-left: 4px solid var(--primary); border-radius: var(--r); padding: 14px 16px; background: var(--glass-2); }
.position.landlord { border-left-color: var(--gray); }
.position + .position { margin-top: 12px; }
.position-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.plabel { font-family: var(--display); font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.position .btn-row { margin: 10px 0 0 -14px; gap: 0 2px; }
.position .btn-row .btn:not(.quiet) { margin-left: 14px; }
.waiting { padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.docs { list-style: none; margin: 0; padding: 0; }
.docrow { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--glass-line); }
.docrow:first-child { border-top: 0; }
.doc-open { flex: 1 1 220px; min-height: 44px; text-align: left; background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.docrow .sub { flex: 1 1 220px; color: var(--text-soft); font-size: var(--t-sm); }
.unassigned { border-top: 1px solid var(--glass-line); background: var(--accent-50); }
.unassigned h3 { margin-bottom: 6px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 20px; text-align: center; color: var(--text-soft); cursor: pointer; min-height: 64px; background: var(--glass-2); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-50); }
.chips { list-style: none; margin: 12px 0 4px; padding: 0; }
.chip { display: flex; align-items: center; gap: 10px; padding: 2px 0 2px 12px; border: 1px solid var(--glass-line); border-radius: var(--r); margin-top: 6px; background: var(--glass-2); }
.chip > span:first-child { flex: 1; overflow-wrap: anywhere; }
.chip .sub { color: var(--text-soft); font-size: var(--t-sm); white-space: nowrap; }

/* terms */
.table.terms th[scope="row"] { font-size: .94rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); background: #FCFEFE; min-width: 170px; max-width: 220px; white-space: normal; border-right: 1px solid var(--glass-line); }
.table.terms td { min-width: 190px; max-width: 360px; }
.table.terms thead th:not(.sticky) { font-family: var(--display); font-size: .94rem; letter-spacing: 0; text-transform: none; }
.term-value { font-weight: 500; }
.term .sub, td .sub { display: block; color: var(--text-soft); font-size: var(--t-sm); margin-top: 2px; white-space: normal; }
.term details summary { cursor: pointer; }
.term-full { margin-top: 6px; white-space: pre-wrap; }
.more-terms { border-top: 1px solid var(--glass-line); }
.more-terms > summary { padding: 14px var(--sp-3); cursor: pointer; font-weight: 600; color: var(--primary); min-height: 48px; }
.dlg .more-terms > summary { padding: 14px 0; }
.term-edit { border: 0; border-top: 1px solid var(--glass-line); padding: 16px 0; margin: 0; min-width: 0; }
.term-edit:first-of-type { border-top: 0; }
.term-edit legend { font-weight: 600; padding: 0; float: left; width: 100%; margin-bottom: 6px; }
.term-edit legend + * { clear: both; }
.term-edit .unit { font-weight: 400; color: var(--text-soft); }
.term-edit .hint { color: var(--text-soft); font-size: .875rem; margin-bottom: 8px; }
.activity .row-link.static { cursor: default; }

/* document viewer */
dialog.dlg.docdlg { width: min(1000px, calc(100vw - 16px)); height: calc(100dvh - 16px); max-height: none; background: #fff; }
dialog.dlg.docdlg[open] { display: flex; flex-direction: column; }
.docdlg .dlg-head h2 { overflow-wrap: anywhere; font-size: 1.05rem; letter-spacing: 0; }
/* a generated PDF, often a wide sheet on its side: given the room to be read before it is saved */
dialog.dlg.docdlg.sheet { width: min(1400px, calc(100vw - 16px)); }
.doc-body { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.doc-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.doc-image { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.doc-word { max-width: 800px; margin: 0 auto; background: #fff; color: #16191c; padding: clamp(16px, 4vw, 40px); min-height: 100%; }
.doc-legend { font-size: .875rem; color: var(--text-soft); padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--glass-line); }
.doc-p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.doc-word h3.doc-p { margin-top: 20px; }
.doc-word ins { color: var(--ok); text-decoration: underline; text-decoration-thickness: 2px; background: var(--ok-bg); }
.doc-word del { color: var(--danger); text-decoration: line-through; background: var(--danger-bg); }
.doc-table { margin: 0 0 16px; border: 1px solid var(--glass-line); }
.doc-table td { min-width: 120px; }
.doc-table td .doc-p:last-child { margin-bottom: 0; }
.cref { font-size: var(--t-sm); font-weight: 600; vertical-align: super; margin-left: 2px; }
.doc-comments { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--glass-line); }
.doc-comments ol { padding-left: 22px; }
.doc-comments li { margin-top: 8px; }

/* ── Phone menu ── */
.menu-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(19, 78, 74, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.mobile-menu { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(84vw, 330px); background: var(--surface); border-left: 1px solid var(--glass-line); box-shadow: var(--sh-3); display: flex; flex-direction: column; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; animation: slideIn var(--dur) var(--ease) both; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .mobile-menu { animation: none; } .burger span { transition: none; } }
.mm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mm-title { font-family: var(--display); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); padding-left: 8px; }
.mm-close { width: 44px; height: 44px; border: none; background: none; border-radius: var(--r); font-size: 1.5rem; line-height: 1; color: var(--text-soft); }
.mm-close:hover { background: var(--glass-2); color: var(--primary); }
.mm-item { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 52px; padding: 12px 10px; border: none; background: none; border-radius: var(--r); font-size: 1rem; font-weight: 600; color: var(--text); text-align: left; text-decoration: none; }
.mm-item:hover, .mm-item:focus-visible { background: var(--glass-2); }
.mm-item[aria-current="page"] { background: rgba(7, 74, 117, .10); color: var(--primary); }
.mm-item svg { flex: none; color: var(--primary); }
.mm-sep { height: 1px; background: var(--glass-line); margin: 10px 4px; flex: none; }
.mm-foot { margin-top: auto; padding: 14px 10px 0; font-size: .8rem; color: var(--text-soft); border-top: 1px solid var(--glass-line); line-height: 1.5; overflow-wrap: anywhere; }
.mobile-menu .btn { margin: 6px 4px; }

/* where backdrop-filter is unavailable, panels go near-solid */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .rail, .card, .ccard, .btn, dialog.dlg, .topbar { background-color: #FBFEFD; }
  .btn.primary { background-color: var(--accent); }
  .btn.navy { background-color: var(--primary); }
  .btn.quiet { background-color: transparent; }
}

/* ══ Tablet and phone: the sidebar gives way to a top bar and a slide-in menu ══ */
@media (max-width: 900px) {
  :root { --sp-5: 32px; --sp-6: 44px; }
  .rail { display: none; }
  .stage, body.signed-out .stage { margin-left: 0; padding: 0; }
  .topbar, body.signed-out .topbar { position: sticky; top: 0; z-index: 28; min-height: 64px; padding: 8px var(--sp-2); background: var(--glass-3); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--glass-line); }
  .topbar .brand { display: block; }
  .topbar .brand img { height: 46px; }
  .burger { display: flex; }
  body.signed-out .burger { display: none; }
  .tagline { font-size: .68rem; letter-spacing: .1em; }
  main { padding: 0 var(--sp-2) var(--sp-6); }
  main > .hero { margin-left: calc(-1 * var(--sp-2)); margin-right: calc(-1 * var(--sp-2)); border-radius: 0; }
  .hero-in { padding: var(--sp-3) var(--sp-2) calc(var(--sp-3) + 6px); }
  .hero-eyebrow { font-size: .72rem; letter-spacing: .16em; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero .status-field { min-width: 0; width: 100%; }
  main > .boot, main > .signin { margin-top: var(--sp-3); }
  .card-head, .card-body, .row-link, .round, .people li, .note, .checklist li, .more-terms > summary, .card > .toolbar, .empty { padding-left: var(--sp-2); padding-right: var(--sp-2); }
  .cgrid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-2); }
}
@media (max-width: 380px) {
  .tagline { font-size: .6rem; letter-spacing: .06em; }
  .topbar .brand img { height: 40px; }
}

/* ─── Phase 3: the client and franchisee portal, approval, comments ───────── */
.broker-line { font-size: .94rem; color: var(--text-soft); }
.hero-status .pill { background: var(--glass-3); }
.card.attention { border-color: rgba(244, 125, 72, .55); box-shadow: 0 0 0 3px rgba(244, 125, 72, .14), var(--sh-2); }
.note.first { border-top: 0; border-bottom: 1px solid var(--glass-line); margin: 0; }

/* property cards on "My properties" */
.pgrid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
.pcard-link { display: flex; flex-direction: column; gap: 8px; padding: 16px; min-height: 44px; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--glass-2); color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard-link:hover { border-color: var(--line-strong); box-shadow: 0 6px 18px rgba(7, 74, 117, .10); transform: translateY(-1px); }
.pcard-link.attention { border-color: rgba(244, 125, 72, .6); border-left: 4px solid var(--accent); }
.pcard-link .strong { font-family: var(--display); font-size: 1.06rem; color: var(--primary); }
.pcard-link .sub { font-size: .875rem; color: var(--text-soft); }
.pcard-link .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-link .kv { grid-template-columns: minmax(96px, max-content) 1fr; gap: 2px 14px; }
.pcard-link .open { margin-top: auto; padding-top: 4px; font-weight: 600; font-size: .875rem; color: var(--primary); }
.pcard-link .open::after { content: " \2192"; }
@media (prefers-reduced-motion: reduce) { .pcard-link { transition: none; } .pcard-link:hover { transform: none; } }

/* the proposed counter, term by term */
.proposal-terms { list-style: none; margin: 0; padding: 0; }
.proposal-terms > li { padding: 16px var(--sp-3); border-top: 1px solid var(--glass-line); }
.proposal-terms > li:first-child { border-top: 0; }
.proposal-terms h3 { margin: 0 0 8px; font-size: 1rem; font-family: var(--display); color: var(--primary); }
.kv.compare { grid-template-columns: minmax(150px, max-content) 1fr; }
.kv.compare dd.strong { font-size: 1rem; }
.answer { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.answer.given { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.answer.given p, .answer-list p, .asked p { margin: 0; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.choices { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choice { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--glass-3); font-weight: 600; cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-100); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice.block { align-items: flex-start; font-weight: 400; }
.choice.block .strong, .choice.block .sub { display: block; }
.choice.block .sub { font-size: .875rem; color: var(--text-soft); }
.choice.block + .choice.block { margin-top: 8px; }
.choices-block { border: 0; padding: 0; margin: 0 0 var(--sp-3); min-width: 0; }
.answer-more { display: grid; gap: 8px; margin-top: 10px; }
.answer .err { display: block; margin-top: 6px; }

/* what the tenant answered, on the broker's side */
details.answers { margin: 10px 0; border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--glass-3); }
details.answers > summary { padding: 10px 12px; min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: .875rem; }
.answer-list { list-style: none; margin: 0; padding: 0 12px 10px; }
.answer-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--glass-line); font-size: .875rem; }
.answer-list li p { flex: 1 1 100%; }
.asked { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0 0 8px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--accent-50); border-radius: 0 var(--r) var(--r) 0; }
.position.past { opacity: .88; border-left-style: dashed; }
.position .override { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--danger); background: var(--danger-bg); border-radius: 0 var(--r) var(--r) 0; overflow-wrap: anywhere; }
.override-ask .field { margin-top: 10px; }
.override-ask p { margin: 0; }
.checks { border: 1px solid var(--glass-line); border-radius: var(--r); background: var(--glass-3); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; }

/* comments */
.comments { list-style: none; margin: 0; padding: 0; }
.comments.top > li { padding: 14px var(--sp-3); border-top: 1px solid var(--glass-line); }
.comments.top > li:first-child { border-top: 0; }
.comment.internal { background: rgba(186, 179, 173, .16); }
.comment.reply { margin: 10px 0 0 14px; padding: 8px 0 0 12px; border-left: 3px solid var(--glass-line); }
.comment.reply.internal { padding: 8px 8px 8px 12px; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.comment-body { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 10px; border-top: 1px solid var(--glass-line); }
.comment .linklike.small { font-size: .875rem; min-height: 44px; min-width: 44px; text-align: left; }

/* documents in the portal's history list */
.docs-inline { flex-direction: column; align-items: flex-start; }
.docs-inline .doc-open { flex: 0 0 auto; min-height: 44px; text-align: left; }

@media (max-width: 640px) {
  .card.project > .card-head .btn.right, .card.proposal > .card-head .btn.right { margin-left: 0; flex: 1 1 100%; }
  .kv.compare { grid-template-columns: 1fr; gap: 0; }
  .kv.compare dd { margin-bottom: 8px; }
}
/* on a phone, two positions fit beside the term names without scrolling; more scroll sideways under a fixed first column */
@media (max-width: 640px) {
  .table.terms th[scope="row"] { min-width: 112px; max-width: 132px; }
  .table.terms td { min-width: 118px; }
  .table.terms th, .table.terms td { padding-left: 10px; padding-right: 10px; }
}

/* ─── Phase 2: review, changes, figures, comparison ──────────────────────── */
.err-text { color: var(--danger); }
.sub.wide { flex: 1 1 100%; }
.plain-list { margin: 0; padding-left: 18px; color: var(--text-soft); }
.plain-list li + li { margin-top: 4px; }
details.how > summary { cursor: pointer; font-weight: 600; font-size: .875rem; min-height: 44px; display: flex; align-items: center; color: var(--primary); }
details.how p { margin: 0 0 8px; color: var(--text-soft); }

/* a term cell with what changed, or with a value still to review */
.term-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.term-wrap.waiting > .term, .term-wrap.waiting > .pill.plain { opacity: .72; }
.term-wrap .to-review { font-size: .75rem; }
.chg { font-size: .8125rem; font-weight: 600; color: var(--text-soft); overflow-wrap: anywhere; }
.chg.better { color: var(--ok); }
.chg.worse { color: var(--danger); }
.chg-from { font-weight: 400; color: var(--text-soft); }
.figure-row { display: grid; gap: 8px 12px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 520px) { .figure-row { grid-template-columns: 1fr 1fr; } .figure-row .hint { grid-column: 1 / -1; } }
.figure-row .field { margin: 0; }

/* the review screen: the document beside its terms */
.review { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .review:not(.no-doc) { grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); } }
.review-side { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.review-doc { display: flex; flex-direction: column; min-width: 0; height: 70dvh; border: 1px solid var(--glass-line); border-radius: var(--r-lg); background: #fff; overflow: hidden; box-shadow: var(--sh-1); }
@media (min-width: 1000px) { .review-doc { position: sticky; top: 12px; height: calc(100dvh - 24px); } }
.review-doc-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--glass-line); background: var(--surface); min-height: 44px; overflow-wrap: anywhere; }
.review-doc-head .input { max-width: 100%; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-stage { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.pane-stage .doc-word { min-height: 0; }
.pane-stage .doc-p.hit, .pane-lines mark { background: #FFE9A8; color: #16191c; box-shadow: 0 0 0 3px #FFE9A8; border-radius: 2px; }
.pane-source { flex: 0 0 auto; max-height: 38%; display: flex; flex-direction: column; border-top: 2px solid var(--accent); background: #fff; }
.pane-source-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 12px; border-bottom: 1px solid var(--glass-line); font-size: .875rem; }
.pane-lines { overflow: auto; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.5; color: #16191c; }
.review-docrow { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px var(--sp-3); align-items: flex-start; }
.review-docrow .row-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.review-docrow .linklike { text-align: left; overflow-wrap: anywhere; min-height: 44px; }
.warns { margin: 4px 0 0; padding-left: 18px; font-size: .875rem; color: var(--accent-text); }

.rterms { list-style: none; margin: 0; padding: 0; }
.rterm { padding: 14px var(--sp-3); border-top: 1px solid var(--glass-line); display: flex; flex-direction: column; gap: 6px; }
.rterm:first-child { border-top: 0; }
.rterm.waiting { border-left: 4px solid var(--accent); padding-left: calc(var(--sp-3) - 4px); }
.rterm.editing { background: var(--glass-3); }
.rterm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rterm-head h3 { margin: 0; font-size: 1rem; font-family: var(--display); color: var(--primary); }
.rterm-value { margin: 0; font-size: 1.02rem; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.rterm-value.muted { font-weight: 400; }
.rterm p { margin: 0; }
.rterm-quote { font-size: .875rem; overflow-wrap: anywhere; }
.rterm-quote q { font-style: italic; }
.rterm-note { padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--accent-50); border-radius: 0 var(--r) var(--r) 0; }
.rterm .btn-row { margin-top: 4px; }
.rterm .term-edit { border: 0; padding: 0; margin: 0; }
.alert.small { font-size: .875rem; padding: 8px 12px; }
.alert.small .btn { margin: 6px 0 0; display: block; }

/* the market comparison: the landlord's column and ours for each property */
.table.compare th.group { text-align: left; border-left: 2px solid var(--line-strong); font-family: var(--display); }
.table.compare th.group .sub { display: block; font-weight: 400; font-size: .8125rem; color: var(--text-soft); }
.table.compare th.landlord, .table.compare td.landlord { border-left: 2px solid var(--line-strong); }
.table.compare td.ours, .table.compare th.ours { background: rgba(228, 238, 245, .45); }
.table.compare thead th .sub { display: block; font-weight: 400; font-size: .8125rem; }
.table.compare tr.band th, .table.compare tr.band td { background: var(--primary-100); color: var(--primary); font-weight: 600; font-size: .875rem; }
.docrow .pill { flex: none; }
.rterm-value.long { font-size: .94rem; font-weight: 400; }
details.rterm-long > summary { cursor: pointer; font-size: .94rem; overflow-wrap: anywhere; }
details.rterm-long[open] > summary { color: var(--text-soft); font-size: .8125rem; }

/* ─── Property photos, the import's two levels, a client's term list ─────── */
.photo-box { background: var(--surface-2); overflow: hidden; border-radius: var(--r); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-box.wide { width: 100%; aspect-ratio: 16 / 9; max-height: 360px; border-radius: 0; }
.photo-box.thumb { width: 56px; height: 42px; flex: none; }
.photo-box.card-photo { margin: -16px -16px 4px; aspect-ratio: 16 / 9; border-radius: var(--r) var(--r) 0 0; }
.pcard-link.attention .photo-box.card-photo { margin-left: -16px; border-top-left-radius: 0; }
.photo-box.col-photo { width: 100%; max-width: 240px; aspect-ratio: 16 / 9; margin-bottom: 8px; }
.photo-box.empty { background: transparent; }
.photo-card { overflow: hidden; }
.with-thumb { display: flex; align-items: center; gap: 10px; min-width: 0; }
.level { border-top: 1px solid var(--glass-line); }
.level-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; padding: 12px var(--sp-3); font-size: .94rem; font-family: var(--body); font-weight: 600; color: var(--text); }
.checks.two { max-height: none; display: grid; grid-template-columns: 1fr; }
@media (min-width: 640px) { .checks.two { grid-template-columns: 1fr 1fr; } .checks.two .check { border-top: 0; border-bottom: 1px solid var(--glass-line); } }
.card-head .check.slim { min-height: 44px; }
/* on a phone two properties fit beside the term names; more scroll sideways */
@media (max-width: 640px) {
  .table.compare th.group { white-space: normal; min-width: 124px; max-width: 150px; vertical-align: top; }
  .table.compare th.group a { overflow-wrap: anywhere; }
  .photo-box.col-photo { max-width: 130px; }
}
