/* ========================================================================
   LFA by Coastal Ridge — enterprise UI
   Light cream sidebar + white content. Navy + teal from CR brand mark,
   warm gold accent used sparingly. Manrope (UI) + JetBrains Mono (numbers).
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* surfaces */
  --bg:           #FAFAF7;          /* page background (warm white) */
  --surface:      #FFFFFF;          /* card surface */
  --surface-2:    #F6F3EC;          /* sidebar / inset */
  --surface-3:    #EBE7DC;          /* deeper inset / banner */

  /* text */
  --text:         #0E2444;          /* primary text (deep navy from CR) */
  --text-strong:  #08172E;
  --text-muted:   #5B6677;
  --text-subtle:  #97A1AE;

  /* lines */
  --border:        #E4E0D4;
  --border-subtle: #EFECE3;
  --border-strong: #CFC9BA;

  /* brand */
  --navy:          #0E2444;
  --navy-hover:    #163764;
  --navy-deep:     #08172E;
  --teal:          #1F7DA0;         /* from logo waves */
  --teal-light:    #36AAD2;
  --accent-warm:   #B89B6C;         /* warm gold — used sparingly */
  --accent-warm-2: #8E7547;
  --accent-fg:     #FFFFFF;
  --link:          #1F7DA0;
  --ring:          rgba(14, 36, 68, 0.14);

  /* semantic */
  --success:       #2E7D5B;
  --success-bg:    #ECF6F1;
  --success-bd:    #BFE0D0;
  --warning:       #A55B0A;
  --warning-bg:    #FBF1DF;
  --warning-bd:    #F0DAA6;
  --danger:        #B5301F;
  --danger-bg:     #FBECE9;
  --danger-bd:     #F2C5BB;

  /* type */
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;

  /* legacy shadows (kept for back-compat) */
  --shadow-sm: 0 1px 2px rgba(14, 36, 68, 0.03);
  --shadow:    0 1px 2px rgba(14, 36, 68, 0.04), 0 4px 16px rgba(14, 36, 68, 0.05);

  /* 4-level elevation system */
  --elevation-0: none;
  --elevation-1: 0 1px 2px rgba(14,36,68,0.04);
  --elevation-2: 0 1px 3px rgba(14,36,68,0.04), 0 4px 12px rgba(14,36,68,0.06);
  --elevation-3: 0 2px 4px rgba(14,36,68,0.04), 0 8px 24px rgba(14,36,68,0.08);
  --elevation-4: 0 4px 8px rgba(14,36,68,0.06), 0 16px 48px rgba(14,36,68,0.12);

  /* spacing scale (8px base) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* typography scale */
  --text-xs:    11px;
  --text-sm:    12.5px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    18px;
  --text-xl:    22px;
  --text-2xl:   28px;
  --text-3xl:   36px;
  --lh-tight:   1.2;
  --lh-normal:  1.55;
  --lh-relaxed: 1.75;

  /* layout */
  --sidebar-w: 260px;
  --topbar-h:  56px;
  --page-max:  1320px;
  --page-px:   40px;
  --content-gap: 20px;

  /* motion */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:  120ms;
  --duration-base:  200ms;
  --duration-slow:  300ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.018em; color: var(--text-strong); }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
h3 { font-size: 13px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.02em; }
p  { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.85em; }

/* uppercase eyebrow label */
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

/* ---------- layout shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  color: var(--text);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  text-decoration: none;
}
.sidebar .brand-logo,
.sidebar img.brand-logo {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  min-width: 0;
  min-height: 0;
  background: #FFFFFF;
  border-radius: 50%;
  padding: 3px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border);
  display: block;
}
.sidebar .brand .wordmark {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.sidebar .brand .name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  text-transform: none;
  line-height: 1.1;
}
.sidebar .brand .org {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.sidebar .section {
  font-size: 10px; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: 0.16em;
  padding: 16px 10px 6px;
  font-weight: 700;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar .nav-item:hover { background: rgba(14, 36, 68, 0.04); color: var(--text-strong); }
.sidebar .nav-item.active {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  border-left-color: var(--accent-warm);
}
.sidebar .nav-item-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.sidebar .nav-item-disabled::after {
  content: 'soon';
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--text-subtle);
  margin-left: auto;
}
.sidebar .nav-sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 10px;
}
.sidebar .nav-item-apps {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-top: 6px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  border-left: 3px solid transparent;
}
.sidebar .nav-item-apps:hover {
  background: transparent;
  color: var(--navy);
}
.sidebar .nav-item svg { color: currentColor; opacity: 0.7; flex-shrink: 0; }
.sidebar .nav-item:hover svg { opacity: 1; }
.sidebar .nav-item.active svg { opacity: 1; }
.sidebar .spacer { flex: 1; }
.sidebar .footer {
  font-size: 10px; color: var(--text-subtle);
  padding: 14px 8px 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

/* ---------- topbar ---------- */
.content {
  min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center;
  padding: 0 var(--page-px);
  gap: 12px;
}
.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); min-width: 0; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-subtle); }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }

.page {
  padding: var(--space-8) var(--page-px);
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  animation: page-in var(--duration-slow) var(--ease-out);
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 32px; }
.page-header .meta { flex: 1; min-width: 0; }
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text-strong);
}
.page-header .sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; }
.page-header .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- card / section ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--elevation-1);
}
.card + .card { margin-top: var(--content-gap); }
.card-inset { background: var(--surface-2); border: none; box-shadow: none; }
.card-flush .card-body { padding: 0; }
.card-interactive { transition: box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast); }
.card-interactive:hover { box-shadow: var(--elevation-2); border-color: var(--border-strong); }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-header h2 {
  color: var(--text-strong);
  text-transform: none;
  letter-spacing: -0.005em;
  font-size: 15px;
  font-weight: 600;
}
.card-header .sub { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.card-body { padding: 22px; }
.card-body.compact { padding: 0; }

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-radius: var(--radius);
  padding: 20px 24px;
  position: relative;
  box-shadow: var(--elevation-1);
  transition: box-shadow var(--duration-fast) var(--ease-out);
}
.kpi:hover { box-shadow: var(--elevation-2); }
.kpi.featured {
  background: var(--navy);
  border-color: var(--navy);
  border-top-color: var(--accent-warm);
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(14, 36, 68, 0.10), 0 6px 20px rgba(14, 36, 68, 0.18);
}
.kpi.featured .label { color: rgba(255,255,255,0.65); }
.kpi.featured .value { color: #FFFFFF; }
.kpi.featured .delta { color: var(--accent-warm); }
.kpi .label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.kpi .value {
  font-size: 30px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 10px;
  font-feature-settings: 'tnum';
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text-strong);
}
.kpi.featured .value { font-size: 34px; }
.kpi .value.warn { color: var(--warning); }
.kpi .value.bad  { color: var(--danger); }
.kpi .value.good { color: var(--success); }
.kpi .delta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }
.kpi .accent-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent-warm);
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}

@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* ---------- compliance bar ---------- */
.compliance {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px;
}
.compliance-row { padding: 6px 0; }
.compliance-row .lr { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.compliance-row .lr .label { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; font-size: 10.5px; }
.compliance-row .lr .nums { color: var(--text); font-weight: 600; font-family: var(--font-mono); }
.bar {
  height: 10px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; display: flex;
}
.bar > span { display: block; height: 100%; }
.bar .good { background: var(--success); }
.bar .warn { background: var(--warning); }
.bar .bad  { background: var(--danger); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-weight: 500; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend .dot.good { background: var(--success); }
.legend .dot.warn { background: var(--warning); }
.legend .dot.bad  { background: var(--danger); }
.legend .dot.subtle { background: var(--text-subtle); }

@media (max-width: 900px) { .compliance { grid-template-columns: 1fr; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data thead th {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: sticky; top: 0;
  z-index: 2;
}
table.data tbody tr { transition: background var(--duration-fast) var(--ease-out); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:nth-child(even) { background: rgba(246,243,236,0.35); }
table.data tbody tr:nth-child(even):hover { background: var(--surface-2); }
/* sortable table headers */
.th-sortable {
  cursor: pointer; user-select: none; white-space: nowrap;
}
.th-sortable::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid var(--text-subtle);
  vertical-align: middle;
  opacity: 0.4;
  transition: transform var(--duration-fast) var(--ease-out), opacity var(--duration-fast);
}
.th-sortable:hover::after { opacity: 1; }
.th-sortable.sort-asc::after { transform: rotate(180deg); opacity: 1; border-top-color: var(--teal); }
.th-sortable.sort-desc::after { opacity: 1; border-top-color: var(--teal); }
table.data td.num { font-family: var(--font-mono); font-feature-settings: 'tnum'; }
.filename { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); word-break: break-all; max-width: 280px; display: inline-block; }

/* ---------- form ---------- */
form label {
  display: block;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
form label .hint { color: var(--text-muted); font-weight: 500; margin-left: 6px; font-size: 10.5px; text-transform: none; letter-spacing: 0.02em; }
input[type=text], input[type=file], select, textarea, form input:not([type]) {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--ring);
}
textarea { resize: vertical; min-height: 72px; font-family: var(--font-sans); }
input[type=file] { padding: 8px 10px; background: var(--surface-2); cursor: pointer; }

/* ---------- buttons ---------- */
.btn, button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--accent-fg);
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(14, 36, 68, 0.08);
}
.btn:hover, button:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn:active, button:active { transform: translateY(0.5px); }
.btn:focus-visible, button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-subtle); }
.btn-warm {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: var(--navy-deep);
}
.btn-warm:hover { background: var(--accent-warm-2); border-color: var(--accent-warm-2); color: #FFFFFF; }
.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-bd);
}
.btn-danger:hover { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
/* Green action button — used for DD Report HC to visually distinguish it from
   DD Report SAI (which uses the default brand blue). */
.btn-success {
  background: #1F7D4A;
  color: #FFFFFF;
  border-color: #1F7D4A;
}
.btn-success:hover { background: #176038; border-color: #176038; }

/* multi-audit badge on the unit row */
/* per-audit telemetry: elapsed time + $ cost */
.metric-line {
  margin-top: 4px;
  display: flex; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}
.metric-time::before { content: "\23F1\FE0F"; opacity: 0.55; margin-right: 3px; }
.metric-cost { color: var(--text); font-weight: 600; }
.metric-cost::before { content: "$ "; opacity: 0; margin: 0; }

.metric-block {
  display: inline-flex; flex-direction: column;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  line-height: 1.1;
}
.metric-block .metric-label {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--text-muted);
}
.metric-block .metric-value {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--text-strong);
  margin-top: 2px;
}

.multi-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-warm);
  color: var(--navy-deep);
}

/* tenancy list on the unit overview page */
.tenancy-list { display: flex; flex-direction: column; }
.tenancy-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.tenancy-row:last-child { border-bottom: 0; }
.tenancy-row:hover { background: var(--surface-2); }
.tenancy-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tenancy-tag {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
}
.tenancy-row.is-primary .tenancy-tag { color: var(--success); }
.tenancy-name { font-size: 16px; color: var(--text-strong); }
.tenancy-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-muted); }
.tenancy-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn svg { flex-shrink: 0; }

/* ---------- chips, pills, badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 500;
}
.chip.bad   { background: var(--danger-bg);  border-color: var(--danger-bd); color: var(--danger); }
.chip.warn  { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.chip.good  { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.chip.info  { background: #ECF3FA; border-color: #BFD4E8; color: var(--link); }
.chip.gray  { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-muted); }
.chip a { color: inherit; text-decoration: none; }
.chip a:hover { text-decoration: underline; }
/* unit-coverage bubble: bigger, more deliberate spacing for the overview tab */
.unit-bubbles { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-bubble {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast);
  position: relative;
}
.unit-bubble:hover { transform: translateY(-1px); box-shadow: var(--elevation-2); }
.unit-bubble.bubble-complete  { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.unit-bubble.bubble-analyzing { background: #ECF3FA;           border-color: #BFD4E8;           color: var(--link); }
.unit-bubble.bubble-pending   { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.unit-bubble.bubble-no_lease  { background: var(--surface-2);  border-color: var(--border-strong); color: var(--text-muted); }
.unit-bubble.bubble-error     { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger); }
.unit-bubble.bubble-none      { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger); }
.unit-bubble.bubble-none      { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger); border-style: dashed; }
.bubble-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--text-muted); }
.bubble-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.bubble-legend .dot { width: 10px; height: 10px; border-radius: 2px; }
.bubble-legend .dot-complete  { background: var(--success); }
.bubble-legend .dot-analyzing { background: var(--link); }
.bubble-legend .dot-pending   { background: var(--warning); }
.bubble-legend .dot-no_lease  { background: var(--text-muted); }
.bubble-legend .dot-none      { background: var(--danger); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-subtle);
}
.status-ready_for_analyzer::before, .status-pending::before { background: var(--warning); }
.status-ready_for_analyzer, .status-pending { color: var(--warning); border-color: var(--warning-bd); background: var(--warning-bg); }
.status-analyzing::before { background: var(--link); }
.status-analyzing { color: var(--link); border-color: #BFD4E8; background: #ECF3FA; }
.status-complete::before { background: var(--success); }
.status-complete { color: var(--success); border-color: var(--success-bd); background: var(--success-bg); }
.status-error::before { background: var(--danger); }
.status-error { color: var(--danger); border-color: var(--danger-bd); background: var(--danger-bg); }
.status-no_lease::before { background: var(--text-subtle); }
.status-no_lease { color: var(--text-muted); border-color: var(--border-strong); background: var(--surface-2); }

.conf {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}
.conf::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--text-subtle); }
.conf-high { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.conf-high::before { background: var(--success); }
.conf-mid  { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
.conf-mid::before  { background: var(--warning); }
.conf-low  { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-bd); }
.conf-low::before  { background: var(--danger); }
.conf-none { color: var(--text-subtle); }
.conf-none::before { background: var(--text-subtle); }
.conf-na { color: var(--text-subtle); background: var(--surface-2); border-color: var(--border); }
.conf-na::before { background: var(--text-subtle); }

/* ---------- empty + notes ---------- */
.empty {
  padding: 56px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}
.empty .icon-wrap {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border);
  border-radius: 50%;
  margin-bottom: 16px;
  color: var(--text-subtle);
}
.empty .title { color: var(--text); font-weight: 700; margin-bottom: 8px; font-size: 16px; letter-spacing: -0.01em; }
.empty .action { margin-top: 20px; }
.empty svg { color: var(--text-subtle); margin-bottom: 12px; }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-warm);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; gap: 14px;
  font-size: 13.5px;
  color: var(--text);
}
.callout svg { color: var(--accent-warm-2); flex-shrink: 0; margin-top: 2px; }
.callout .title { font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.1em; font-size: 11.5px; }
.callout ol { margin: 6px 0 0; padding-left: 18px; line-height: 1.75; }
.callout code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--text);
}
.callout.running { border-left-color: var(--link); }
.callout.running .title { color: var(--link); }
.callout.error-callout {
  background: var(--danger-bg);
  border-color: var(--danger-bd);
  border-left-color: var(--danger);
}
.callout.error-callout svg { color: var(--danger); }
.callout.error-callout .title { color: var(--danger); }
.callout p { margin: 4px 0; line-height: 1.55; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  flex-shrink: 0; margin-top: 2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--link); border-right-color: var(--link); }
}

/* api-key banner on dashboard */
.api-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-bd);
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13px;
}
.api-banner .lead { display: flex; align-items: center; gap: 10px; color: var(--warning); }
.api-banner code { background: rgba(255,255,255,0.6); border: 1px solid var(--warning-bd); border-radius: 3px; padding: 1px 6px; font-size: 12px; color: var(--text); }

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: 12px; }
.good { color: var(--success); }
.warn { color: var(--warning); }
.bad  { color: var(--danger); }
.warm { color: var(--accent-warm-2); }

hr.sep { border: 0; border-top: 1px solid var(--border-subtle); margin: 20px 0; }
hr.sep-strong { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

.flag-row td {
  background: #FCF7EC;
  font-size: 12px;
  color: var(--warning);
  border-bottom: 1px solid var(--border-subtle);
}
.flag-row td .label { font-weight: 700; margin-right: 8px; text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; }

.unit-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.unit-summary > div {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.unit-summary .label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; }
.unit-summary .body { margin-top: 8px; }

.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 80ms ease;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .lr-title { font-weight: 600; color: var(--text); font-size: 14px; }
.list-row .lr-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-row .lr-actions { display: flex; align-items: center; gap: 10px; }
.list-row .lr-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); margin-right: 14px; font-family: var(--font-mono); }
.list-row .lr-stats span strong { color: var(--text); font-weight: 700; }

.metric-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}
.metric-pill.bad { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.metric-pill.warn { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }

/* ---------- lease cards (audit detail) ---------- */
.lease-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface-2);
}
.lease-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  overflow: hidden;
}
.lease-card:hover {
  border-color: var(--accent-warm);
  box-shadow: var(--shadow);
}
.lease-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.lease-card-id { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.lease-unit { display: flex; align-items: center; gap: 10px; }
.unit-badge {
  display: inline-flex;
  padding: 5px 12px;
  background: var(--navy);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius-sm);
}
.unit-badge.warn { background: var(--warning); color: #FFFFFF; }
.unit-badge.muted { background: var(--surface-3); color: var(--text-muted); }
.lease-filename {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}
.lease-card-confidence {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.lease-card-confidence .conf { margin-left: 0; }
.lease-card-confidence .chevron { color: var(--text-subtle); display: inline-flex; }
.lease-card:hover .chevron { color: var(--accent-warm-2); }

.lease-card-flags {
  background: #FCF7EC;
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 20px;
}
.lease-card-flags .flag-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--warning);
  margin-bottom: 6px;
}
.lease-card-flags ul {
  margin: 0; padding-left: 22px;
  font-size: 13px; color: var(--text);
  line-height: 1.6;
}
.lease-card-flags li { margin: 2px 0; }

.lease-card-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.lease-section {
  padding: 16px 20px;
  border-right: 1px solid var(--border-subtle);
  min-width: 0;
}
.lease-section:last-child { border-right: 0; }
.lease-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.lease-section-body .big {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.lease-section-body .big.mono { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.lease-section-body .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.sig-row { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.sig-row .sig { color: var(--text); font-weight: 500; }

@media (max-width: 1024px) {
  .lease-card-body { grid-template-columns: repeat(2, 1fr); }
  .lease-section { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .lease-section:nth-last-child(-n+2) { border-bottom: 0; }
  .lease-section:nth-child(odd) { border-right: 1px solid var(--border-subtle); }
}
@media (max-width: 640px) {
  .lease-card-body { grid-template-columns: 1fr; }
  .lease-section { border-right: 0 !important; }
  .lease-section:last-child { border-bottom: 0; }
}

/* ---------- lease detail page ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.flags-card { background: #FCF7EC; border-color: var(--warning-bd); }
.flags-card .card-header { background: transparent; border-bottom-color: var(--warning-bd); }
.flag-list {
  margin: 0; padding-left: 20px;
  font-size: 14px; color: var(--text);
  line-height: 1.7;
}
.flag-list li { margin: 4px 0; }

dl.kv {
  margin: 0;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 18px;
  font-size: 13.5px;
}
dl.kv dt {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  align-self: center;
}
dl.kv dd {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}
dl.kv dd.mono { font-family: var(--font-mono); }
ul.inline-list { margin: 0; padding-left: 18px; }
ul.inline-list li { font-size: 13px; }

.doc-viewer {
  display: block;
  width: 100%;
  height: 850px;
  border: 0;
  background: var(--surface-2);
}

/* ---------- Rent Roll table (specialized presentation) ---------- */
.rr-table-wrapper {
  position: relative;
  border-top: 1px solid var(--border-subtle);
}
.rr-table-wrapper .table-wrap.scroll-section {
  border-radius: 0;
  background: var(--surface);
}
table.rr-table {
  width: max-content; min-width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 12.5px;
}
table.rr-table thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  border-top: 0;
  text-align: left;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 3;
}
table.rr-table thead th.rr-fixed-col {
  z-index: 4;
  left: 0;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border-subtle);
}
table.rr-table thead th.rr-fixed-col-2 {
  z-index: 4;
  left: 78px;
  background: var(--surface);
}
table.rr-table thead th.rr-divider {
  border-left: 1px solid var(--border-subtle);
  padding-left: 18px;
}
table.rr-table thead th.rr-charges-group {
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--accent-warm-2);
  background: var(--surface-2);
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
table.rr-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--surface);
}
table.rr-table tbody tr:nth-child(even) td { background: rgba(246,243,236,0.4); }
table.rr-table tbody tr:hover td { background: var(--surface-2); }
table.rr-table tbody td.rr-fixed-col {
  position: sticky; left: 0;
  font-weight: 700;
  color: var(--text-strong);
  box-shadow: 1px 0 0 var(--border-subtle);
  z-index: 2;
}
table.rr-table tbody td.rr-fixed-col-2 {
  position: sticky; left: 78px;
  z-index: 2;
}
table.rr-table tbody td.rr-divider {
  border-left: 1px solid var(--border-subtle);
  padding-left: 18px;
}
table.rr-table tbody td.rr-num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  text-align: right;
  color: var(--text);
}
table.rr-table tbody td.rr-num-empty { color: var(--text-subtle); text-align: right; }
table.rr-table tbody td.rr-resident {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text);
}
table.rr-table tbody td.rr-term {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
/* unit-status pill in the rent roll table */
.rr-status {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.rr-status-occupied { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.rr-status-vacant   { background: var(--surface-2);  color: var(--text-muted); border-color: var(--border-strong); }
.rr-status-notice   { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.rr-status-model    { background: #ECF3FA;           color: var(--link);    border-color: #BFD4E8; }
.rr-meta-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 18px;
  font-size: 12px; color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}
.rr-meta-bar .rr-meta-stats {
  display: flex; gap: 18px;
  font-family: var(--font-mono);
}
.rr-meta-bar .rr-meta-stats span strong { color: var(--text); font-weight: 700; }

/* rent-roll search bar */
.rr-search-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
}
.rr-search-input {
  flex: 1;
  margin: 0 !important;
  padding: 7px 11px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  background: var(--surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
}
.rr-search-input:focus {
  outline: none;
  border-color: var(--navy) !important;
  box-shadow: 0 0 0 3px var(--ring);
}
.rr-search-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}

/* scrolling section (rent roll, long lists) */
.scroll-section {
  max-height: var(--scroll-max, 320px);
  overflow: auto;
}
.scroll-section table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* collapsible <details> styled like a card */
details.files-card { padding: 0; }
details.files-card > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.files-card > summary::-webkit-details-marker { display: none; }
details.files-card > summary::after {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  margin-left: 10px;
  transition: transform 140ms ease;
}
details[open].files-card > summary::after { transform: rotate(45deg); }
details.files-card > summary:hover { background: var(--surface-2); }
details.files-card > summary { border-bottom: 1px solid transparent; }
details[open].files-card > summary { border-bottom-color: var(--border-subtle); }

/* preview-button active state */
.preview-btn.active {
  background: var(--accent-warm);
  color: var(--navy-deep);
  border-color: var(--accent-warm);
  font-weight: 700;
}

/* file list inside lease detail */
.file-list { display: flex; flex-direction: column; }
.file-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-2); }
.file-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.file-ext-badge {
  display: inline-block;
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 6px;
  border-radius: 3px;
  min-width: 36px;
  text-align: center;
}
.file-row .filename {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
  max-width: none;
}
.file-row .filename:hover { color: var(--link); }

/* category badges on file rows */
.cat-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  margin-left: 6px;
}
.cat-lease    { background: var(--navy);        color: #FFFFFF; }
.cat-addendum { background: var(--accent-warm); color: var(--navy-deep); }
.cat-income   { background: var(--success-bg);  color: var(--success); border: 1px solid var(--success-bd); }
.cat-id       { background: #ECF3FA;            color: var(--link);    border: 1px solid #BFD4E8; }
.cat-other    { background: var(--surface-3);   color: var(--text-muted); }

/* Screening / credit chips on the residents table */
.screen-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.screen-good { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.screen-mid  { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.screen-bad  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }
.screen-none { background: var(--surface-3);  color: var(--text-muted); }

/* Extraction-method badges — show which path each file took to the AI */
.ext-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: help;
}
.ext-md  { background: #ECF6F1; color: var(--success); border-color: var(--success-bd); }
.ext-pdf { background: #FBF1DF; color: var(--warning); border-color: var(--warning-bd); }
.ext-img { background: var(--surface-2); }
.file-row-other { opacity: 0.78; }
.file-row-other:hover { opacity: 1; }
.doc-image {
  max-width: 100%;
  max-height: 850px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------- Tabs (JS-driven) ---------- */
.tabs-container { position: relative; }
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-6);
}
.tab-btn {
  display: inline-flex; align-items: center;
  padding: 12px 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  user-select: none;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: none;
}
.tab-btn:hover { color: var(--text); background: transparent; }
.tab-btn.is-active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  background: transparent;
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- modal dialog ---------- */
.modal-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: var(--elevation-4);
  background: var(--surface);
  color: var(--text);
}
.modal-dialog::backdrop { background: rgba(8, 23, 46, 0.45); backdrop-filter: blur(2px); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-head h2 { font-size: var(--text-lg); font-weight: 700; }
.modal-body { padding: 22px; }
.modal-body label { margin-bottom: 16px; }
.modal-body label:last-child { margin-bottom: 0; }
.modal-body code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 6px; font-size: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-2);
}
.danger-zone { border-color: var(--danger-bd); }
.danger-zone .card-header { border-bottom-color: var(--danger-bd); }

/* ---------- sidebar signed-in user + sign-out button (SSO) ---------- */
.sidebar-user {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  margin: 0 -4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-email {
  font-size: 10.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-signout-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px;
  margin: 0 -4px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast),
              border-color var(--duration-fast);
}
.sidebar-signout-btn:hover {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}
.sidebar-signout-btn svg { transition: transform var(--duration-fast) var(--ease-out); }
.sidebar-signout-btn:hover svg { transform: translateX(-2px); }

/* ---------- Coastal Ridge Apps hub ---------- */
.apps-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(165deg, #0E2444 0%, #163764 60%, #1F7DA0 130%);
  color: var(--text);
  font-family: var(--font-sans);
  padding: 48px 24px 64px;
}
.apps-shell {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
  animation: page-in var(--duration-slow) var(--ease-out);
}
.apps-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.apps-brand { display: flex; align-items: center; gap: 14px; }
.apps-logo {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #FFFFFF; padding: 4px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18);
  flex-shrink: 0; object-fit: contain;
}
.apps-wordmark { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.apps-name {
  font-size: 19px; font-weight: 700;
  color: #FFFFFF; letter-spacing: -0.012em; line-height: 1.1;
}
.apps-tagline {
  font-size: 10.5px; font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.apps-user {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}
.apps-user-name {
  font-size: 12.5px; font-weight: 600;
  color: #FFFFFF;
  max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apps-user-signout {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase; letter-spacing: 0.06em;
  text-decoration: none;
  transition: color var(--duration-fast);
}
.apps-user-signout:hover { color: #FFFFFF; }

.apps-greeting { padding: 8px 4px 0; }
.apps-greeting h1 {
  font-size: 36px; font-weight: 700;
  color: #FFFFFF; letter-spacing: -0.022em; line-height: 1.1;
  margin-bottom: 8px;
}
.apps-greeting p {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.55;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.app-card {
  display: flex; flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--elevation-3);
  position: relative;
  overflow: hidden;
  min-height: 240px;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast);
}
.app-card-active {
  cursor: pointer;
}
.app-card-active::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent-warm-2));
}
.app-card-active:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-4);
  border-color: var(--accent-warm);
}
.app-card-soon {
  opacity: 0.65;
  background: var(--surface-2);
  cursor: not-allowed;
}
.app-card-soon .app-card-icon { color: var(--text-muted); }

.app-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px;
}
.app-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--navy);
}
.app-card-active .app-card-icon {
  background: var(--navy);
  color: #FFFFFF;
}
.app-card-badge {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 4px 10px;
  background: var(--surface-3);
  color: var(--text-muted);
  border-radius: 999px;
  white-space: nowrap;
}
.app-card-badge-live {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-bd);
}

.app-card-body { flex: 1; }
.app-card-name {
  font-size: 24px; font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.app-card-tagline {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 6px; margin-bottom: 12px;
}
.app-card-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.app-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.app-card-active .app-card-foot { color: var(--navy); }
.app-card-active:hover .app-card-foot { color: var(--navy-hover); }
.app-card-active .app-card-foot svg { transition: transform var(--duration-fast) var(--ease-out); }
.app-card-active:hover .app-card-foot svg { transform: translateX(2px); }

.apps-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 10.5px; font-weight: 600;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .apps-body { padding: 24px 16px 40px; }
  .apps-greeting h1 { font-size: 28px; }
  .app-card { min-height: 200px; padding: 20px; }
}

/* ---------- login page (SSO landing) ---------- */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(165deg, #0E2444 0%, #163764 60%, #1F7DA0 130%);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-shell { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 440px; }
.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 36px 28px;
  box-shadow: var(--elevation-4);
  animation: page-in var(--duration-slow) var(--ease-out);
}
.login-brand {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 22px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.login-logo {
  width: 52px; height: 52px; border-radius: 50%;
  background: #FFFFFF; padding: 4px;
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0; object-fit: contain;
}
.login-wordmark { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.login-name { font-size: 18px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.01em; line-height: 1.1; }
.login-org { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.14em; }
.login-heading h1 { font-size: 24px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.018em; margin-bottom: 8px; }
.login-heading p { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 24px; }
.login-error {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 18px;
  background: var(--danger-bg); border: 1px solid var(--danger-bd);
  border-radius: var(--radius-sm);
  color: var(--danger); font-size: 12.5px; line-height: 1.5; word-break: break-word;
}
.login-error svg { flex-shrink: 0; margin-top: 1px; }
.login-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 12px; width: 100%;
  padding: 13px 18px;
  font-size: 14px; font-weight: 600;
  color: #FFFFFF; background: var(--navy);
  border: 1px solid var(--navy); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), transform 80ms ease;
  box-shadow: 0 1px 2px rgba(14, 36, 68, 0.18);
}
.login-btn:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.login-btn:active { transform: translateY(0.5px); }
.login-btn svg { flex-shrink: 0; }
.login-note {
  padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted); line-height: 1.55;
}
.login-link { display: inline-block; margin-top: 8px; color: var(--link); font-weight: 600; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-fineprint {
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px; color: var(--text-muted); line-height: 1.55; text-align: center;
}
.login-footer {
  font-size: 11px; color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600;
}

/* ---------- per-section "view source" link ---------- */
.src-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast), border-color var(--duration-fast);
  box-shadow: none;
}
.src-link:hover {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}
.src-link svg { opacity: 0.6; }
.src-link:hover svg { opacity: 1; }

/* ---------- audit totals (property overview) ---------- */
.totals-row { display: flex; gap: var(--content-gap); flex-wrap: wrap; }
.total-block {
  flex: 1; min-width: 180px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}
.total-block .total-label {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
}
.total-block .total-value {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin-top: 8px;
  line-height: 1.1;
}
.total-block .total-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }

/* ---------- multi-lease (Notice Rented) rows ---------- */
.multi-lease-rows { display: flex; flex-direction: column; gap: 6px; }
.multi-lease-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.multi-lease-row.is-matched {
  border-color: var(--link);
  background: #ECF3FA;
}
.multi-lease-row .badge-count { background: var(--surface-2); }
.multi-lease-row.is-matched .badge-count { background: var(--link); color: #FFF; border-color: var(--link); }

/* ---------- comparison table (Excel-like, matches rent-roll tab) ---------- */
table.cmp-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
table.cmp-table thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.cmp-table thead th.cmp-th-num { text-align: right; }
table.cmp-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  background: var(--surface);
}
table.cmp-table tbody tr:last-child td { border-bottom: 0; }
table.cmp-table tbody tr:nth-child(even) td { background: rgba(246,243,236,0.4); }
table.cmp-table tbody tr:hover td { background: var(--surface-2); }
table.cmp-table td.cmp-num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  text-align: right;
  white-space: nowrap;
}
table.cmp-table td.cmp-item strong { color: var(--text-strong); }
table.cmp-table .cmp-grouped-codes { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
table.cmp-table td.cmp-reason { color: var(--text-muted); font-size: 12px; max-width: 340px; line-height: 1.4; }
/* left accent bar via inset shadow (works with border-collapse:separate) */
table.cmp-table tr.cmp-match td:first-child { box-shadow: inset 3px 0 0 var(--success); }
table.cmp-table tr.cmp-variance td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
/* section divider row (lease-only header) */
table.cmp-table tr.cmp-divider td {
  background: var(--surface-2);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-top: 10px; padding-bottom: 10px;
}

/* ---------- file tab strip (horizontal scrollable) ---------- */
.file-tabs {
  display: flex; gap: 0; overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
  padding: 0 16px;
}
.file-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  background: none; border-top: 0; border-left: 0; border-right: 0;
}
.file-tab:hover { color: var(--text); }
.file-tab.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------- property cards grid (dashboard) ---------- */
.property-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--content-gap);
}
.property-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--elevation-1);
  cursor: pointer;
  transition: box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast);
  text-decoration: none; color: inherit;
}
.property-card:hover { box-shadow: var(--elevation-2); border-color: var(--border-strong); }
.property-card .pc-name { font-size: var(--text-md); font-weight: 700; color: var(--text-strong); margin-bottom: 4px; }
.property-card .pc-meta { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-4); }
.property-card .pc-stats {
  display: flex; gap: var(--space-4);
  font-size: var(--text-xs); font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: auto; padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.property-card .pc-stats strong { color: var(--text); }

/* ---------- search highlight ---------- */
mark { background: rgba(31, 125, 160, 0.15); color: inherit; padding: 1px 2px; border-radius: 2px; }

/* ---------- badge count ---------- */
.badge-count {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; align-items: center; padding: 12px 16px;
    overflow-x: auto;
  }
  .sidebar .section, .sidebar .spacer, .sidebar .footer { display: none; }
  .sidebar .brand { padding: 0 12px 0 0; border-bottom: 0; margin-bottom: 0; }
  .sidebar .nav-item { padding: 6px 10px; }
  .sidebar .nav-item.active { padding-left: 8px; }
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Manual override controls ---------- */
.editable {
  position: relative;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
  padding: 0 2px;
  border-radius: 3px;
}
.editable:hover {
  background-color: rgba(31, 125, 160, 0.08);
  border-bottom-color: rgba(31, 125, 160, 0.45);
}
.editable[data-overridden="1"] {
  background-color: rgba(184, 155, 108, 0.12);
  border-bottom-color: rgba(184, 155, 108, 0.55);
}
.editable[data-overridden="1"]:hover {
  background-color: rgba(184, 155, 108, 0.22);
}
.editable-value { display: inline; }
.editable-input {
  font: inherit;
  border: 1.5px solid var(--accent, #B89B6C);
  border-radius: 4px;
  padding: 2px 6px;
  background: #fff;
  color: inherit;
  outline: none;
  min-width: 90px;
  width: 100%;
  max-width: 220px;
  box-shadow: 0 0 0 3px rgba(184, 155, 108, 0.18);
}
.override-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #B89B6C);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  position: relative;
}
.override-flag::before { content: "✎"; font-size: 8px; }
.override-flag .override-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0E2444;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  z-index: 100;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  text-align: left;
  min-width: 220px;
  max-width: 280px;
  white-space: normal;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.override-flag .override-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #0E2444;
}
.override-flag:hover .override-tooltip {
  visibility: visible;
  opacity: 1;
}
.override-tooltip-line { display: block; }
.override-tooltip-ai { opacity: 0.85; margin-top: 4px; font-style: italic; }

.editable-popover {
  background: #fff;
  border: 1px solid rgba(14, 36, 68, 0.18);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
}
.editable-popover-btn {
  background: none;
  border: 0;
  text-align: left;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: #0E2444;
  border-radius: 5px;
  cursor: pointer;
}
.editable-popover-btn:hover {
  background: rgba(31, 125, 160, 0.1);
}
.editable-popover-clear {
  color: #b03a2e;
}
.editable-popover-clear:hover {
  background: rgba(176, 58, 46, 0.08);
}
