/* Ownlivo application shell, components and page layouts. Uses tokens from styles.css. */

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.app[data-layout="app"] { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.app[data-layout="app"].collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
.app[data-layout="public"] .sidebar, .app[data-layout="public"] .topbar, .app[data-layout="public"] .app-footer { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.view { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s6) var(--s8) var(--s12); outline: none; }
.app[data-layout="public"] .view { max-width: none; padding: 0; }
.app-footer { display: flex; gap: var(--s4); justify-content: center; padding: var(--s6) var(--s4) var(--s8); font-size: var(--fs-xs); color: var(--muted); }
.app-footer a { color: var(--muted); }
.boot-loading { height: 3px; width: 120px; margin: 40vh auto 0; border-radius: 3px; background: linear-gradient(90deg, var(--brand-100), var(--brand-600), var(--brand-100)); background-size: 200% 100%; animation: shimmer 1s linear infinite; }

/* Sidebar */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden; z-index: 40; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s4) var(--s4) var(--s2); min-height: var(--topbar); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 1.125rem; letter-spacing: var(--tracking-tighter); text-decoration: none; }
.wordmark:hover { text-decoration: none; color: var(--text); }
.brand-mark { flex: none; display: block; }
.workspace { margin: var(--s2) var(--s3) var(--s3); }
.workspace select { font-size: var(--fs-sm); font-weight: 500; min-height: 36px; background: var(--surface-2); border-color: var(--border); }
.workspace .ws-static { display: flex; align-items: center; gap: var(--s2); padding: 8px 10px; border-radius: var(--r); background: var(--surface-2); font-size: var(--fs-sm); font-weight: 500; }
.ws-static .ws-sub { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.nav { flex: 1; overflow-y: auto; padding: 0 var(--s3) var(--s4); }
.nav-group { margin-top: var(--s4); }
.nav-group-label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 var(--s2) var(--s1); }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 var(--s2); border-radius: var(--r); color: var(--text-2); font-weight: 500; font-size: var(--fs-base); text-decoration: none; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand); }
.nav a[aria-current="page"] .icon { color: var(--brand-600); }
.nav a .icon { color: var(--muted); }
.nav .nav-count { margin-left: auto; font-size: var(--fs-xs); font-weight: 600; color: var(--red); background: var(--red-bg); padding: 0 6px; border-radius: var(--r-full); }
.sidebar-foot { border-top: 1px solid var(--border); padding: var(--s3); }
.user-chip { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 44px; padding: 6px var(--s2); border: 0; border-radius: var(--r); background: transparent; color: var(--text); box-shadow: none; text-align: left; font-weight: 500; }
.user-chip:hover { background: var(--surface-2); color: var(--text); }
.user-chip .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-chip .who small { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-size: 0.6875rem; font-weight: 600; flex: none; letter-spacing: 0; }
.collapse-btn { color: var(--muted); }
.app.collapsed .sidebar .nav-label, .app.collapsed .sidebar .nav-group-label, .app.collapsed .sidebar .workspace, .app.collapsed .sidebar .wordmark span, .app.collapsed .user-chip .who, .app.collapsed .nav-count { display: none; }
.app.collapsed .sidebar-head { flex-direction: column; padding: var(--s3) var(--s2); }
.app.collapsed .nav a { justify-content: center; padding: 0; }
.app.collapsed .user-chip { justify-content: center; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s6); background: rgba(247, 246, 242, 0.88); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.topbar .spacer { flex: 1; }
.search-trigger { display: inline-flex; align-items: center; gap: var(--s2); min-width: 240px; min-height: 34px; padding: 0 var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--muted); font-weight: 400; box-shadow: none; }
.search-trigger:hover { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; font-family: var(--font); font-size: var(--fs-xs); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r); color: var(--text-2); border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot-count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); background: var(--red); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.menu-btn { display: none; }

/* Mobile shell */
@media (max-width: 899px) {
  .app[data-layout="app"], .app[data-layout="app"].collapsed { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform var(--mid) var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(25, 29, 27, 0.35); z-index: 35; }
  .app.collapsed .sidebar .nav-label, .app.collapsed .sidebar .nav-group-label, .app.collapsed .sidebar .workspace, .app.collapsed .sidebar .wordmark span, .app.collapsed .user-chip .who { display: revert; }
  .app.collapsed .nav a { justify-content: flex-start; padding: 0 var(--s2); }
  .collapse-btn { display: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 var(--s3); }
  .search-trigger { min-width: 0; width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger .search-text, .search-trigger kbd { display: none; }
  .view { padding: var(--s4) var(--s4) var(--s12); }
  .topbar .mobile-brand { display: inline-flex; }
}
@media (min-width: 900px) { .topbar .mobile-brand { display: none; } }

/* Tenant bottom tabs (phones) */
.mobile-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.mobile-tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; color: var(--muted); font-size: 0.6875rem; font-weight: 500; text-decoration: none; border-radius: var(--r); }
.mobile-tabs a[aria-current="page"] { color: var(--brand); }
.mobile-tabs a:hover { text-decoration: none; background: var(--surface-2); }
@media (min-width: 900px) { .mobile-tabs { display: none !important; } }
@media (max-width: 899px) { .has-tabs .view { padding-bottom: 96px; } }

/* ---------- Page structure ---------- */
.page-header { margin-bottom: var(--s6); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--s2); padding: 0; font-size: var(--fs-sm); color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.page-title h1 { font-size: var(--fs-2xl); }
.page-title p { margin: var(--s1) 0 0; }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.section { margin-bottom: var(--s6); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.section-title h2 { font-size: var(--fs-md); }
.section-title a { font-size: var(--fs-sm); font-weight: 500; }

/* Metrics */
.metrics { display: grid; gap: var(--s3); grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--s6); }
@media (max-width: 1100px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); min-width: 0; }
a.metric:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.metric-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.metric-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); }
.metric-icon.red { background: var(--red-bg); color: var(--red); }
.metric-icon.amber { background: var(--amber-bg); color: var(--amber); }
.metric-icon.green { background: var(--green-bg); color: var(--green); }
.metric-icon.blue { background: var(--blue-bg); color: var(--blue); }
.metric-value { margin-top: var(--s2); font-size: var(--fs-3xl); font-weight: 600; letter-spacing: var(--tracking-tighter); line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-sub { margin-top: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.spark { display: block; margin-top: var(--s2); width: 100%; }

/* Panels (cards with header) */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); margin-bottom: var(--s4); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5) var(--s3); }
.panel-head h2 { font-size: var(--fs-md); display: flex; align-items: center; gap: var(--s2); }
.panel-head a { font-size: var(--fs-sm); font-weight: 500; }
.panel-body { padding: 0 var(--s5) var(--s5); }
.panel-body.flush { padding: 0 0 var(--s2); }

/* Attention list */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); color: inherit; text-decoration: none; border-top: 1px solid var(--border); transition: background var(--fast) var(--ease); }
.attn li:first-child a { border-top: 0; }
.attn li a:hover { background: var(--surface-2); text-decoration: none; }
.attn .lead { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r); }
.attn .lead.red { background: var(--red-bg); color: var(--red); }
.attn .lead.amber { background: var(--amber-bg); color: var(--amber); }
.attn .lead.blue { background: var(--blue-bg); color: var(--blue); }
.attn .lead.green { background: var(--green-bg); color: var(--green); }
.attn .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .m { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .r { text-align: right; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }

/* Stacked bar + legend */
.stackbar { display: flex; height: 10px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-2); gap: 2px; }
.stackbar span { display: block; height: 100%; }
.legend { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s2); }
.legend li { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-2); }
.legend li strong { margin-left: auto; font-weight: 600; color: var(--text); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Vertical paired bars */
.vbars { display: flex; align-items: flex-end; gap: var(--s2); height: 180px; padding-top: var(--s2); }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.vbar-pair { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.vbar { width: min(18px, 40%); border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height var(--mid) var(--ease); }
.vbar.a { background: var(--brand-600); }
.vbar.b { background: #d9b25c; }
.vbar-label { margin-top: 6px; font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }

/* Tabs + segmented control */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); box-shadow: none; padding: 0 var(--s3); min-height: 40px; font-weight: 500; margin-bottom: -1px; }
.tab:hover { background: transparent; color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.tab-count { margin-left: 6px; font-size: var(--fs-xs); background: var(--surface-2); color: var(--text-2); border-radius: var(--r-full); padding: 0 6px; }
.segmented { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.segmented button { background: transparent; border: 0; box-shadow: none; color: var(--muted); min-height: 30px; padding: 0 var(--s3); border-radius: 6px; font-size: var(--fs-sm); }
.segmented button:hover { background: transparent; color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); }
.filterbar .search { position: relative; flex: 1 1 240px; min-width: 0; }
.filterbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filterbar .search input { padding-left: 34px; min-height: 36px; }
.filterbar select { width: auto; min-height: 36px; font-size: var(--fs-sm); padding-right: 28px; }

/* Data table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
table.data th { text-align: left; font-weight: 500; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: var(--s2) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; transition: background var(--fast) var(--ease); }
table.data tr.clickable:hover { background: var(--surface-2); }
table.data .cell-title { font-weight: 600; }
table.data .cell-sub { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 720px) {
  table.data.stack thead { display: none; }
  table.data.stack tr { display: block; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
  table.data.stack td { display: block; padding: 2px 0; border: 0; }
}

/* Property cards */
.prop-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.prop-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); transition: box-shadow var(--mid) var(--ease), transform var(--mid) var(--ease), border-color var(--mid) var(--ease); }
.prop-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); text-decoration: none; color: inherit; }
.prop-art { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.prop-art svg { width: 100%; height: 100%; display: block; }
.prop-art .badge { position: absolute; top: var(--s3); left: var(--s3); box-shadow: var(--shadow-sm); }
.prop-body { padding: var(--s4); display: flex; flex-direction: column; gap: 2px; }
.prop-name { font-weight: 600; font-size: var(--fs-md); }
.prop-addr { color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center; gap: 4px; }
.prop-meta { display: flex; gap: var(--s4); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }
.prop-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-art { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); margin-bottom: var(--s5); }
.hero-art svg { width: 100%; height: 200px; display: block; }
@media (max-width: 640px) { .hero-art svg { height: 140px; } }

/* Kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3); }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s3); min-height: 120px; }
.board-col h3 { font-size: var(--fs-sm); display: flex; align-items: center; justify-content: space-between; margin: 0 var(--s1) var(--s3); color: var(--text-2); }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3); margin-bottom: var(--s2); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.board-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); text-decoration: none; color: inherit; }
.board-card .bc-title { font-weight: 600; font-size: var(--fs-base); line-height: 1.35; }
.board-card .bc-meta { display: flex; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.prio.emergency { color: var(--red); }
.prio.urgent { color: var(--amber); }
.prio.routine { color: var(--muted); font-weight: 500; }

/* Empty, dialog, slide-over */
.empty { text-align: center; padding: var(--s10) var(--s4); }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-lg); background: var(--surface-2); color: var(--muted); margin-bottom: var(--s3); }
.empty h3 { margin-bottom: var(--s1); }
.empty p { max-width: 40ch; margin: 0 auto var(--s4); }
dialog { color: var(--text); }
dialog::backdrop { background: rgba(25, 29, 27, 0.4); }
.dialog { border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s6); width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); animation: pop var(--mid) var(--ease); }
.dialog h2 { margin-bottom: var(--s2); }
.actions.end { justify-content: flex-end; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.slide-over { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border: 0; border-left: 1px solid var(--border); padding: 0; box-shadow: var(--shadow-lg); animation: slide-in var(--mid) var(--ease); }
.slide-over-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.slide-over-body { padding: var(--s5); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Command palette */
.palette { border: 1px solid var(--border); border-radius: var(--r-xl); padding: 0; width: min(560px, calc(100vw - 24px)); margin-top: 12vh; box-shadow: var(--shadow-lg); animation: pop var(--mid) var(--ease); }
.palette-input { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; box-shadow: none; min-height: 52px; padding: 0; font-size: var(--fs-md); }
.palette-input input:focus { box-shadow: none; }
.palette ul { list-style: none; margin: 0; padding: var(--s2); max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r); color: var(--text); text-decoration: none; }
.palette li a:hover, .palette li a.active { background: var(--surface-2); text-decoration: none; }
.palette .p-kind { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.palette .p-empty { padding: var(--s6); text-align: center; color: var(--muted); }

/* Skeletons */
.page-skeleton .title { height: 28px; width: 220px; margin-bottom: var(--s6); }
.page-skeleton .metric-sk { height: 104px; border-radius: var(--r-lg); }
.page-skeleton .panel { height: 280px; border-radius: var(--r-lg); border: 0; }
.skeleton.line { height: 12px; margin-top: var(--s2); }

/* Profile menu */
.menu { position: absolute; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: var(--s1); animation: pop var(--fast) var(--ease); }
.menu .menu-head { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); margin-bottom: var(--s1); }
.menu button, .menu a { display: flex; width: 100%; justify-content: flex-start; gap: var(--s2); background: transparent; border: 0; box-shadow: none; color: var(--text); min-height: 34px; padding: 0 var(--s3); border-radius: var(--r-sm); font-weight: 400; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* Timeline (activity) */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s3); padding-bottom: var(--s4); position: relative; }
.activity li::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.activity li:last-child::before { display: none; }
.activity .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.activity .dot.owner { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.activity .dot.tenant { background: var(--brand-50); color: var(--brand-600); border-color: transparent; }
.activity .what { font-size: var(--fs-base); }
.activity .when { font-size: var(--fs-xs); color: var(--muted); }

/* Tenant home */
.welcome { background: var(--brand); color: #fff; border-radius: var(--r-xl); padding: var(--s6); margin-bottom: var(--s5); position: relative; overflow: hidden; }
.welcome h1 { color: #fff; font-size: var(--fs-2xl); }
.welcome p { color: rgba(255, 255, 255, 0.82); margin: var(--s1) 0 var(--s5); }
.welcome .button { background: #fff; color: var(--brand); border-color: #fff; }
.welcome .button:hover { background: var(--brand-50); color: var(--brand-hover); }
.welcome .button.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.welcome .button.ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.welcome .roof { position: absolute; right: -10px; bottom: -14px; opacity: 0.14; width: 180px; height: 180px; }
.quick { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s5); }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.quick a { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); text-decoration: none; font-weight: 600; box-shadow: var(--shadow-xs); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.quick a:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text); }
.quick a span.muted { font-weight: 400; font-size: var(--fs-sm); }
.quick .qi { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--brand-50); color: var(--brand-600); }

/* Report wizard */
.steps { display: flex; gap: var(--s2); margin-bottom: var(--s5); list-style: none; padding: 0; }
.steps li { flex: 1; height: 4px; border-radius: var(--r-full); background: var(--surface-3); }
.steps li.on { background: var(--brand-600); }
.cat-grid { display: grid; gap: var(--s2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cat { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: none; font-weight: 500; justify-content: flex-start; text-align: left; white-space: normal; line-height: 1.3; }
.cat:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.cat[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.urgency { display: grid; gap: var(--s2); }
.urgency label { display: flex; gap: var(--s3); align-items: flex-start; margin: 0; padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; color: var(--text); font-weight: 500; }
.urgency label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.urgency small { display: block; font-weight: 400; color: var(--muted); }
.review { background: var(--surface-2); border-radius: var(--r-lg); padding: var(--s4); }
.success-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--green-bg); color: var(--green); margin: 0 auto var(--s4); }
.success-mark .icon { width: 28px; height: 28px; }

/* Assistant / Ask */
.ask-shell { max-width: 760px; margin: 0 auto; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 var(--s5); }
.prompt-chips button { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); font-weight: 400; box-shadow: none; min-height: 32px; border-radius: var(--r-full); font-size: var(--fs-sm); }
.prompt-chips button:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.ask-box { display: flex; gap: var(--s2); align-items: flex-end; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: var(--s2); box-shadow: var(--shadow-sm); }
.ask-box textarea { border: 0; box-shadow: none; min-height: 44px; max-height: 160px; resize: none; padding: 10px; }
.ask-box textarea:focus { box-shadow: none; }
.answer { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: var(--s4); margin-top: var(--s4); }
.answer .src { display: flex; gap: var(--s2); align-items: baseline; font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s2); }
.answer blockquote { margin: var(--s2) 0 0; padding: var(--s3) var(--s4); border-left: 3px solid var(--brand-100); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; white-space: pre-wrap; }
.qa { margin-top: var(--s5); }
.qa .q { font-weight: 600; display: flex; gap: var(--s2); align-items: center; }

/* Auth / public cards */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s8) var(--s4); background: var(--bg); }
.auth-card { min-width: 0; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s8); box-shadow: var(--shadow); }
.auth-card .wordmark { margin-bottom: var(--s6); }
.auth-card h1 { font-size: var(--fs-xl); margin-bottom: var(--s1); }
.demo-list a { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); border-radius: var(--r); color: var(--text); text-decoration: none; }
.demo-list a:hover { background: var(--surface-2); text-decoration: none; }
.demo-list .who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.demo-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Development banner stays visible; the shell offsets around it. */
body.has-banner { --banner-h: 30px; }
.env-banner { position: sticky; top: 0; z-index: 45; height: var(--banner-h, auto); line-height: 18px; }
.sidebar { top: var(--banner-h, 0px); height: calc(100vh - var(--banner-h, 0px)); }
.topbar { top: var(--banner-h, 0px); }
@media (max-width: 899px) { .sidebar { top: 0; height: 100vh; z-index: 50; } }

/* Legacy stat tiles: the alert modifier only tints the number. */
.stat.alert { background: var(--surface); border-color: var(--border); color: var(--text); padding: var(--s4); margin: 0; }
.attn .lead + span { min-width: 0; }
.icon-btn .dot-count { top: -1px; right: -3px; min-width: 14px; height: 14px; line-height: 14px; font-size: 9.5px; padding: 0 3px; border-width: 1.5px; }

/* Static documents (privacy, terms) */
.doc-head { max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s4) 0; }
.doc { max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s16); }
.doc .card { padding: var(--s8); }
.doc h1 { font-size: var(--fs-3xl); margin-bottom: var(--s2); }
.doc h2 { margin: var(--s6) 0 var(--s2); }
.doc li { margin-bottom: var(--s2); color: var(--text-2); }
.doc p { color: var(--text-2); line-height: 1.6; }
@media (max-width: 640px) { .doc .card { padding: var(--s5); } }

/* Property summary (detail page) */
.prop-summary { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s5); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s3); margin-bottom: var(--s5); box-shadow: var(--shadow-xs); }
.ps-art { border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; }
.ps-art svg { width: 100%; height: 100%; display: block; }
.ps-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4) var(--s5); margin: 0; padding: var(--s2) var(--s3); }
.ps-facts dt { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.ps-facts dd { margin: 4px 0 0; font-weight: 500; }
@media (max-width: 900px) { .prop-summary { grid-template-columns: 1fr; } .ps-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Request detail */
.req-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s5); align-items: start; }
.req-side { position: sticky; top: calc(var(--topbar) + var(--banner-h, 0px) + var(--s4)); display: flex; flex-direction: column; }
.req-side > details.card, .req-side > .card { padding: var(--s3) var(--s4); margin-bottom: var(--s2); }
.req-side > details.card > summary { font-size: var(--fs-base); min-height: 32px; }
.req-main .card > .section-head h1 { font-size: var(--fs-xl); }
@media (max-width: 1100px) { .req-layout { grid-template-columns: 1fr; } .req-side { position: static; } }

/* Forms and tenant pieces */
.form-card { max-width: 680px; padding: var(--s6); }
.form-card.center, .center { text-align: center; }
.actions.center { justify-content: center; }
.form-card h2 { margin-bottom: var(--s1); }
fieldset.plain { border: 0; padding: 0; margin: var(--s4) 0 0; }
fieldset.plain legend { font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--s2); padding: 0; }
.kv.review { background: var(--surface-2); border-radius: var(--r-lg); padding: var(--s4); margin: var(--s3) 0; }
.emergency-panel { border-color: #f0c9c5; }
.emergency-panel .panel-head h2 { color: var(--red); }
.doc-item { border-top: 1px solid var(--border); padding: var(--s3) 0; }
.doc-item:first-child { border-top: 0; }
.doc-sec { padding: var(--s2) 0 var(--s2) var(--s5); border-left: 2px solid var(--brand-100); margin: var(--s2) 0; }
.doc-sec .src, .answer .src { font-size: var(--fs-xs); color: var(--muted); font-family: var(--mono); }
.ask-box button.icon-only { width: 40px; min-height: 40px; border-radius: var(--r-lg); }
.env-banner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-picker { display: inline-flex; align-items: center; gap: var(--s2); }
.month-picker strong { min-width: 84px; text-align: center; }
select.inline-select { width: auto; min-height: 36px; }
.notif.unread .row-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-600); margin-right: 8px; vertical-align: middle; }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key .key { margin-left: var(--s2); }
.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); }
.rank-bar { display: block; height: 6px; border-radius: var(--r-full); background: var(--brand-600); margin-top: 6px; opacity: 0.85; }
details.inline { margin-top: 4px; }
details.inline > summary { font-weight: 500; color: var(--brand-600); }
details.inline[open] { padding: var(--s2) 0; }

/* Long unbroken strings (URLs, IDs, emails) wrap instead of widening the page. */
.pre, .pre a, .row-sub, .muted { overflow-wrap: anywhere; }
.demo-list .row-sub, .demo-list span { min-width: 0; }

/* Ledger table */
.card .table-wrap.flush { margin: var(--s2) calc(-1 * var(--s5)) calc(-1 * var(--s5)); }
table.data .nowrap { white-space: nowrap; }
table.data td.credit { color: var(--green); }
.ledger .num { text-align: right; }
table.data tr.reversed td { color: var(--muted); }
@media (max-width: 720px) {
  table.data.stack td.num { text-align: left; }
  table.ledger td.num { text-align: left; }
}
.form-card { max-width: 760px; }

/* Muted text inside tinted alerts needs the darker secondary color to keep 4.5:1. */
.alert .muted, .alert .row-sub, .alert li { color: var(--text-2); }

/* Waitlist honeypot: off-screen, not display:none (some bots skip hidden fields). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
