/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #1a3a5c;
  --navy-d:  #122840;
  --blue:    #4a90d9;
  --blue-l:  #e8f2fc;
  --green:   #27ae60;
  --amber:   #f39c12;
  --red:     #e74c3c;
  --purple:  #8e44ad;
  --teal:    #16a085;
  --orange:  #e67e22;
  --rose:    #c0392b;
  --gray-50: #f8fafc;
  --gray-100:#f0f4f8;
  --gray-200:#e2e8f0;
  --gray-400:#94a3b8;
  --gray-600:#475569;
  --gray-800:#1e293b;
  --text:    #1e293b;
  --sidebar-w: 240px;
  --shadow:  0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --radius:  10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--gray-100);
  display: flex;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.25rem 1rem 1rem;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { width: 22px; height: 22px; flex-shrink: 0; }

.sidebar-nav { padding: .75rem .75rem .25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
  transition: background .15s;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-deals {
  padding: .5rem .75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-deal-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  border-radius: 6px;
  font-size: .8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s;
}
.sidebar-deal-link:hover, .sidebar-deal-link.active {
  background: rgba(255,255,255,.08);
  color: #e2e8f0;
}
.deal-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1400px;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -.02em;
}
.page-sub {
  color: var(--gray-600);
  margin-top: .3rem;
  font-size: .875rem;
}
.breadcrumb {
  font-size: .8rem;
  color: var(--gray-400);
  margin-bottom: .4rem;
}
.breadcrumb a:hover { color: var(--blue); }

.header-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--green);
  background: #dcfce7;
  padding: .3rem .7rem;
  border-radius: 20px;
}

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.3); }
}

/* ── Status Colors ───────────────────────────────────────────────────────── */
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-done       { background: #dcfce7; color: #166534; }
.status-error      { background: #fee2e2; color: #991b1b; }

.deal-dot.status-pending    { background: var(--amber); }
.deal-dot.status-processing { background: var(--blue); }
.deal-dot.status-done       { background: var(--green); }
.deal-dot.status-error      { background: var(--red); }

/* ── Deal Grid ───────────────────────────────────────────────────────────── */
.deal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.deal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
/* Map/List toggle buttons */
.btn-view-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .75rem; border: 1px solid var(--gray-300);
  border-radius: 6px; background: #fff; color: var(--gray-600);
  font-size: .82rem; font-weight: 500; cursor: pointer; transition: all .15s;
}
.btn-view-toggle:hover { border-color: var(--navy); color: var(--navy); }
.btn-view-toggle.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.btn-view-toggle svg { width: 16px; height: 16px; }
.btn-view-toggle.active svg { stroke: #fff; }
/* Title area — full width at top, no competing elements */
.deal-card-title {
  position: relative;
}
.deal-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  /* Truncate at 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* Red flag indicator — top right corner */
.parse-flag {
  position: absolute;
  top: -.15rem;
  right: -.25rem;
  font-size: .9rem;
  cursor: help;
  z-index: 1;
}

.deal-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .75rem;
  margin-top: auto; /* push to bottom of flex column */
  color: var(--gray-400);
  padding-top: .5rem;
  border-top: 1px solid var(--gray-200);
}
.arrow-right { font-size: 1rem; color: var(--blue); }

.btn-reprocess {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: .25rem .65rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}
.btn-reprocess:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-l, rgba(74,144,217,.06));
}
.btn-reprocess:disabled {
  opacity: .7;
  cursor: default;
}

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.metric-chip {
  border-radius: 6px;
  padding: .4rem .6rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
.chip-label { display: block; font-size: .7rem; color: var(--gray-600); }
.chip-value { display: block; font-weight: 600; font-size: .875rem; }

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  flex: 1 1 160px;
  max-width: 220px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  border-top: 3px solid transparent;
}
.kpi-label { font-size: .75rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.4rem; font-weight: 700; margin-top: .25rem; color: var(--gray-800); }

/* Color accents */
.color-green  { border-color: var(--green);  } .color-green  .kpi-value { color: var(--green); }
.color-blue   { border-color: var(--blue);   } .color-blue   .kpi-value { color: var(--blue); }
.color-navy   { border-color: var(--navy);   } .color-navy   .kpi-value { color: var(--navy); }
.color-purple { border-color: var(--purple); } .color-purple .kpi-value { color: var(--purple); }
.color-teal   { border-color: var(--teal);   } .color-teal   .kpi-value { color: var(--teal); }
.color-amber  { border-color: var(--amber);  } .color-amber  .kpi-value { color: var(--amber); }
.color-orange { border-color: var(--orange); } .color-orange .kpi-value { color: var(--orange); }
.color-rose   { border-color: var(--rose);   } .color-rose   .kpi-value { color: var(--rose); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
}
.tab {
  padding: .6rem 1.1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .875rem;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section / Panel ─────────────────────────────────────────────────────── */
.section { margin-bottom: 1.5rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.panel-title {
  font-size: .9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-600);
  margin-bottom: 1rem;
}
.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.panel-title-row .panel-title { margin-bottom: 0; }

/* ── Data Table ──────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
}
.data-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--gray-100);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.data-table .subtotal td { font-weight: 600; background: var(--gray-50); }
.data-table .total td { font-weight: 700; background: var(--blue-l); color: var(--navy); }
.data-table .neg td { color: var(--red); }
.error-row td { background: #fef2f2; }
.error-msg { color: var(--red); font-size: .8rem; padding-left: 1.5rem !important; }

.table-scroll { overflow-x: auto; }

/* ── Metric Table Grid ───────────────────────────────────────────────────── */
.metric-table-grid { display: grid; gap: .5rem; }
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .75rem;
  background: var(--gray-50);
  border-radius: 6px;
  font-size: .875rem;
}
.metric-row span { color: var(--gray-600); }
.metric-row strong { font-weight: 600; }

/* ── Occupancy Pills ─────────────────────────────────────────────────────── */
.occupancy-pill {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.occ-occupied { background: #dcfce7; color: #166534; }
.occ-vacant   { background: #fee2e2; color: #991b1b; }
.vacant-row { opacity: .7; }

/* ── Status Badge ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* ── Type tag ────────────────────────────────────────────────────────────── */
.type-tag {
  display: inline-block;
  padding: .15rem .5rem;
  background: var(--blue-l);
  color: var(--blue);
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Processing Indicator ────────────────────────────────────────────────── */
.processing-indicator {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem;
  background: var(--gray-50);
  border-radius: 6px;
  color: var(--gray-600);
  font-size: .875rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-600);
}
.empty-state svg { width: 80px; height: 80px; margin: 0 auto 1.5rem; opacity: .3; display: block; }
.empty-state h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: .5rem; color: var(--gray-800); }
.empty-state p  { margin-bottom: 1rem; }
.empty-state code { background: var(--gray-100); padding: .4rem .8rem; border-radius: 6px; font-size: .8rem; }

/* ── Calculator ──────────────────────────────────────────────────────────── */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.calc-group label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: .35rem;
}
.calc-group input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.calc-group input:focus { border-color: var(--blue); }

.calc-results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}
.calc-results h4 {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  margin-bottom: .75rem;
}
.hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .6rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #3a80c9; }

.btn-secondary {
  background: #fff;
  color: var(--gray-800);
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  padding: .5rem 1rem;
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-input {
  padding: .4rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .85rem;
  outline: none;
  width: 200px;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--blue); }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.muted { color: var(--gray-400); font-size: .875rem; }
.no-data { text-align: center; padding: 1rem; color: var(--gray-400); font-size: .875rem; }
.label-note { font-size: .7rem; font-weight: 400; color: var(--gray-400); display:block; margin-top:.15rem; }

/* Negative value highlight */
.neg-val { color: var(--red); }
.neg-row strong { color: var(--red); }

/* Expense table footer */
.data-table tfoot tr.total td { font-weight: 700; background: var(--blue-l); color: var(--navy); border-top: 2px solid var(--gray-200); }

/* ── Rent Benchmark Cards ────────────────────────────────────────────────── */
.benchmark-grid {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.benchmark-card {
  flex: 1 1 240px;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid transparent;
}
.benchmark-card.color-teal   { border-left-color: var(--teal); }
.benchmark-card.color-purple { border-left-color: var(--purple); }
.bench-label { font-size: .75rem; font-weight: 600; text-transform: uppercase;
               letter-spacing: .05em; color: var(--gray-600); margin-bottom: .4rem; }
.bench-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-800); }
.bench-sub   { font-size: .8rem; color: var(--gray-400); margin-top: .2rem; }

/* ── Quick cap rate calc ─────────────────────────────────────────────────── */
.quick-calc-row {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.quick-result {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .75rem 1.25rem;
  background: var(--blue-l);
  border-radius: 8px;
  min-width: 200px;
}
.quick-result-label { font-size: .7rem; font-weight: 600; text-transform: uppercase;
                      letter-spacing: .05em; color: var(--blue); }
.quick-result-value { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.quick-result-sub   { font-size: .8rem; color: var(--gray-600); }

/* ── Sensitivity Table ───────────────────────────────────────────────────── */
.sensitivity-wrap { overflow-x: auto; }
.sensitivity-table { max-width: 560px; }
.sensitivity-table th { background: var(--gray-50); }
.sens-row:hover { background: var(--blue-l); }
.sens-highlight { background: #fffbeb; font-weight: 600; }
.sens-highlight td { color: var(--navy); }

/* ── Deal Grade Tab ───────────────────────────────────────────────────────── */
.btn-sm {
  padding: .25rem .65rem;
  font-size: .8rem;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
}

.treasury-source {
  font-size: .7rem;
  color: var(--green);
  font-weight: 600;
  margin-left: .25rem;
}

.grade-inputs-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.grade-banner {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

.grade-score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.grade-score-ring svg { width: 100%; height: 100%; }

.ring-bg {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 10;
}
.ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 0 314.159;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  transition: stroke-dasharray .6s ease, stroke .4s ease;
}
.ring-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  line-height: 1.1;
}
.ring-score { font-size: 1.85rem; font-weight: 800; color: var(--navy); }
.ring-max   { font-size: .7rem; color: var(--gray-400); }

.grade-summary { flex: 1; }
.grade-letter {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: .25rem;
}
.grade-letter.grade-green  { color: #38A169; }
.grade-letter.grade-yellow { color: #ECC94B; }
.grade-letter.grade-red    { color: #E53E3E; }
.grade-tagline { font-size: 1rem; color: var(--gray-600); }

/* Score component cards */
.grade-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.grade-card {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid var(--gray-400);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.grade-card.gc-green  { border-left-color: var(--green); }
.grade-card.gc-yellow { border-left-color: var(--amber); }
.grade-card.gc-red    { border-left-color: var(--red); }
.grade-card.gc-gray   { border-left-color: var(--gray-400); opacity: .75; }

.gc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .5rem;
}
.gc-label  { font-size: .75rem; font-weight: 600; text-transform: uppercase;
             letter-spacing: .05em; color: var(--gray-600); }
.gc-points { font-size: 1rem; font-weight: 700; color: var(--navy); white-space: nowrap; }
.gc-green  .gc-points { color: var(--green); }
.gc-yellow .gc-points { color: var(--amber); }
.gc-red    .gc-points { color: var(--red); }

.gc-value  { font-size: 1.15rem; font-weight: 700; color: var(--gray-800); margin-bottom: .3rem; }
.gc-reason { font-size: .8rem; color: var(--gray-600); margin-bottom: .75rem; }

.gc-bar { height: 5px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.gc-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gray-400);
  transition: width .4s ease;
}
.gc-green  .gc-bar-fill { background: var(--green); }
.gc-yellow .gc-bar-fill { background: var(--amber); }
.gc-red    .gc-bar-fill { background: var(--red); }

/* Geographic placeholder */
.grade-placeholder { margin-top: 1.5rem; }
.placeholder-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.placeholder-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--blue-l);
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 20px;
  padding: .15rem .6rem;
  white-space: nowrap;
}
.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.ph-chip {
  font-size: .8rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: .25rem .75rem;
  color: var(--gray-600);
}

/* ── Multi-property deal cards (dashboard) ─────────────────────────────────── */
.deal-card-multi {
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.deal-card-multi:hover { box-shadow: none; transform: none; }

.sub-properties {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .75rem 0;
}

.sub-property-card {
  display: block;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: .75rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.sub-property-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(74,144,217,.15);
}
.sub-prop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.sub-prop-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--navy);
}
.metric-grid-sm { gap: .4rem; }
.metric-grid-sm .metric-chip { padding: .3rem .6rem; }
.metric-grid-sm .chip-label { font-size: .65rem; }
.metric-grid-sm .chip-value { font-size: .85rem; }

/* ── Property switcher tabs (deal detail header) ───────────────────────────── */
.prop-switcher {
  display: flex;
  gap: .25rem;
  background: var(--gray-100);
  border-radius: 8px;
  padding: .25rem;
}
.prop-tab {
  padding: .3rem .85rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.prop-tab:hover  { background: var(--white); color: var(--navy); }
.prop-tab.active { background: var(--white); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ── Deal classification badges ────────────────────────────────────────────── */
.classification-badge {
  font-size: .7rem; font-weight: 700; padding: .2rem .6rem; border-radius: 20px; white-space: nowrap;
}
.cl-stabilized { background: #dcfce7; color: #166534; }
.cl-valueadd   { background: #fef9c3; color: #854d0e; }
.cl-distressed { background: #fee2e2; color: #991b1b; }

/* ── Confidence badges ─────────────────────────────────────────────────────── */
.conf-badge {
  font-size: .6rem; font-weight: 600; padding: .1rem .45rem; border-radius: 12px;
  margin-left: .5rem; vertical-align: middle; letter-spacing: .02em;
}
.conf-high { background: #dcfce7; color: #166534; }
.conf-med  { background: #fef9c3; color: #854d0e; }
.conf-low  { background: #fef3cd; color: #856404; }

/* ── No T12 banner ─────────────────────────────────────────────────────────── */
.no-t12-banner {
  display: flex; align-items: flex-start; gap: .75rem; padding: 1rem;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
}
.no-t12-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--amber); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.no-t12-banner p { font-size: .85rem; color: var(--gray-600); margin-top: .25rem; }
.no-t12-badge {
  font-size: .65rem; font-weight: 700; background: #fef3cd; color: #856404;
  padding: .15rem .5rem; border-radius: 12px; white-space: nowrap;
}

/* ── Property profile (OM data) ────────────────────────────────────────────── */
.source-tag {
  font-size: .65rem; font-weight: 600; background: var(--blue-l, #eff6ff);
  color: var(--blue); padding: .15rem .5rem; border-radius: 12px;
  margin-left: .5rem; vertical-align: middle;
}
.profile-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .5rem .75rem;
}
.profile-item { display: flex; flex-direction: column; gap: .1rem; padding: .4rem 0; }
.profile-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gray-500);
}
.profile-item > span:last-child { font-size: .9rem; color: var(--gray-800); }

/* ── User overrides (inline editing) ───────────────────────────────────────── */
.edit-pencil {
  background: none; border: none; cursor: pointer; opacity: 0;
  font-size: .8rem; padding: 0 .15rem; margin-left: .25rem;
  transition: opacity .15s; vertical-align: middle;
}
.editable-metric:hover .edit-pencil { opacity: .5; }
.editable-metric[data-overridden="true"] { background: #eff6ff; }
.editable-metric[data-overridden="true"] .metric-val::before { content: "\270E "; font-size: .75em; opacity: .5; }
.reset-btn {
  background: none; border: none; cursor: pointer; font-size: .8rem;
  color: var(--gray-400); padding: 0 .15rem; margin-left: .15rem; vertical-align: middle;
}
.reset-btn:hover { color: var(--red); }
.override-input {
  width: 120px; font-size: .9rem; padding: .15rem .4rem;
  border: 1.5px solid var(--blue); border-radius: 4px; outline: none;
}

/* ── Loss-to-lease positive value highlight ────────────────────────────────── */
.pos-val { color: var(--green); }

/* ── Smart deal naming ─────────────────────────────────────────────────────── */
.deal-folder-sub {
  font-size: .72rem; color: var(--gray-400); margin-top: .15rem;
  font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-badges { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }

/* ── Stoplight border scoring ──────────────────────────────────────────────── */
.border-green  { border-left: 3px solid #38A169; }
.border-yellow { border-left: 3px solid #ECC94B; }
.border-orange { border-left: 3px solid #ED8936; }
.border-red    { border-left: 3px solid #E53E3E; }
.score-prompt {
  font-size: .7rem; color: var(--gray-400); padding: .4rem .75rem;
  background: var(--gray-50); border-top: 1px solid var(--gray-200);
  text-align: center;
}

/* ── Hide / deal-hidden ────────────────────────────────────────────────────── */
.deal-hidden { opacity: .5; }
.btn-hide {
  background: none; border: none; cursor: pointer; font-size: .85rem;
  color: var(--gray-400); padding: .1rem .35rem; border-radius: 4px;
  transition: color .15s, background .15s;
}
.btn-hide:hover { color: var(--red); background: rgba(231,76,60,.08); }
.footer-actions { display: flex; gap: .35rem; align-items: center; }

/* ── Filter toggle button ──────────────────────────────────────────────────── */
.btn-filter-toggle {
  background: var(--white); border: 1px solid var(--gray-300); border-radius: 8px;
  padding: .4rem .55rem; cursor: pointer; display: flex; align-items: center;
  color: var(--gray-600); transition: border-color .15s, color .15s;
}
.btn-filter-toggle:hover { border-color: var(--blue); color: var(--blue); }

/* ── Slide-out filter panel ────────────────────────────────────────────────── */
.filter-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.filter-overlay.open { opacity: 1; pointer-events: auto; }
.filter-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 210;
  background: #ffffff; box-shadow: -6px 0 24px rgba(0,0,0,.15);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 1.25rem;
  overflow-y: auto;
  /* Solid white, no transparency or blur */
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.filter-panel.open { transform: translateX(0); }
.fp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.fp-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.fp-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400); }
.fp-close:hover { color: var(--navy); }
.fp-section { margin-bottom: 1.25rem; }
.fp-label { display: block; font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gray-500); margin-bottom: .35rem; }
.fp-section select, .fp-input {
  width: 100%; font-size: .85rem; padding: .4rem .5rem;
  border: 1px solid var(--gray-300); border-radius: 6px; background: var(--white);
}

/* ── Active filter pills ───────────────────────────────────────────────────── */
.filter-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.fpill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; background: var(--blue-l, #eff6ff);
  color: var(--blue); padding: .2rem .6rem; border-radius: 16px;
}
.fpill button { background: none; border: none; cursor: pointer; font-size: .8rem; color: var(--blue); padding: 0; }

/* ── Red flags & parsing report ────────────────────────────────────────────── */
.red-flag-row {
  display: flex; align-items: flex-start; gap: .65rem; padding: .65rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.red-flag-row:last-child { border-bottom: none; }
.rf-icon { color: var(--red); font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.red-flag-row strong { font-size: .85rem; color: var(--gray-800); }
.red-flag-row p { font-size: .8rem; color: var(--gray-600); margin-top: .15rem; }
.green-flag-row {
  display: flex; align-items: center; gap: .5rem; padding: .65rem 0;
  color: var(--green); font-weight: 600; font-size: .9rem;
}
.gf-icon { font-size: 1.1rem; }
.low-conf-row { background: #fffde7; }
.review-note { font-size: .7rem; color: #b45309; margin-left: .35rem; font-style: italic; }

/* ── Override inline edit improvements ─────────────────────────────────────── */
.override-edit-wrap { display: inline-flex; align-items: center; gap: .3rem; }
.override-save {
  background: var(--green); color: #fff; border: none; border-radius: 4px;
  padding: .2rem .5rem; font-size: .72rem; font-weight: 600; cursor: pointer;
}
.override-cancel {
  background: none; color: var(--gray-500); border: 1px solid var(--gray-300);
  border-radius: 4px; padding: .2rem .5rem; font-size: .72rem; cursor: pointer;
}
.deal-name-block { min-width: 0; flex: 1; }

/* ── Buy Box page ──────────────────────────────────────────────────────────── */
.buybox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.25rem;
}
.form-group { margin-bottom: .85rem; }
.form-group label { display: block; font-size: .78rem; font-weight: 600; color: var(--gray-700); margin-bottom: .25rem; }
.form-input {
  width: 100%; padding: .45rem .6rem; font-size: .9rem;
  border: 1.5px solid var(--gray-300); border-radius: 6px;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--blue); outline: none; }
.form-row { display: flex; gap: .75rem; }
.form-row .form-group { flex: 1; }
/* ── Shared field component (Underwriting Defaults + Buy Box) ───────────────
   White bordered box, rounded, full width of its cell, with a unit affix ("%"
   right) or prefix ("$" left) inside the box. Defined once here so both pages
   reuse the exact same component. */
.uwd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.4rem; }
.uwd-field label { display: block; font-size: .76rem; color: var(--gray-600); margin-bottom: .2rem; font-weight: 600; }
.uwd-field .uwd-input-wrap { position: relative; display: flex; align-items: center; }
.uwd-field input { width: 100%; padding: .4rem .55rem; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .88rem; }
.uwd-field .uwd-affix { position: absolute; right: .55rem; color: var(--gray-400); font-size: .8rem; pointer-events: none; }
.uwd-field input.uwd-pre { padding-left: 1.1rem; }
.uwd-field .uwd-prefix { position: absolute; left: .5rem; color: var(--gray-400); font-size: .8rem; pointer-events: none; }
.uwd-section { margin-bottom: 1.1rem; }
.uwd-section h3 { font-size: .95rem; margin: 0 0 .7rem; }

/* Buy Box reuses the component above. Hide the number spinners (keyboard
   up/down still works, and they won't overlap the in-box unit), and lay cramped
   rows out as a responsive grid instead of squeezing fields to ~1/6 width. */
.buybox-grid .uwd-field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.buybox-grid .uwd-field input[type="number"]::-webkit-outer-spin-button,
.buybox-grid .uwd-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.buybox-grid .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem .8rem; }
.buybox-grid .form-row .uwd-field { min-width: 0; }
.checkbox-group { display: flex; flex-direction: column; gap: .5rem; }
.checkbox-label {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .85rem; cursor: pointer;
}
.checkbox-label input[type="checkbox"] { margin-top: .2rem; }
.btn-primary {
  background: var(--blue); color: #fff; border: none; padding: .5rem 1.25rem;
  border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #3a7bd5; }
.save-status {
  position: fixed; bottom: 1.5rem; right: 1.5rem; padding: .6rem 1.25rem;
  border-radius: 8px; font-size: .85rem; font-weight: 600; z-index: 100;
}
.save-ok  { background: #dcfce7; color: #166534; }
.save-err { background: #fee2e2; color: #991b1b; }

/* ── File tagging ──────────────────────────────────────────────────────────── */
.tag-select {
  font-size: .72rem; padding: .15rem .3rem; border: 1px solid var(--gray-300);
  border-radius: 4px; background: var(--white); cursor: pointer;
}
.manual-tag-badge {
  display: inline-block; font-size: .6rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 10px; margin-right: .35rem;
  text-transform: uppercase; letter-spacing: .03em;
}
.tag-rent_roll       { background: #dbeafe; color: #1e40af; }
.tag-financial_excel { background: #dcfce7; color: #166534; }
.tag-financial       { background: #fef3cd; color: #854d0e; }
.tag-supporting      { background: #e5e7eb; color: #4b5563; }
.tag-unknown         { background: var(--gray-100); color: var(--gray-600); }

/* ── Deal name editing ─────────────────────────────────────────────────────── */
.lock-icon { font-size: .6em; vertical-align: middle; opacity: .5; margin-left: .3rem; }
.name-edit-btn { opacity: 0; font-size: .7em; vertical-align: middle; }
.page-title:hover .name-edit-btn { opacity: .5; }

/* ── Portfolio badge ───────────────────────────────────────────────────────── */
.portfolio-badge {
  font-size: .65rem; font-weight: 700; background: #ede9fe; color: #6d28d9;
  padding: .15rem .5rem; border-radius: 12px; white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════════
   UNDERWRITING TAB (Phase 2B)
   ════════════════════════════════════════════════════════════════════════ */
.uw-bar{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;margin-bottom:1rem;}
.uw-bar-left{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;}
.uw-bar-right{display:flex;align-items:center;gap:.75rem;}
.uw-bar-lbl{font-size:.78rem;font-weight:600;color:var(--gray-600);}
#uw-scn-select{padding:.35rem .5rem;border:1px solid var(--gray-200);border-radius:6px;font-size:.88rem;min-width:170px;}
.btn-sm{padding:.3rem .6rem;font-size:.78rem;}
.uw-recalc{display:inline-flex;align-items:center;gap:.4rem;font-size:.8rem;color:var(--blue);font-weight:600;}
.uw-spinner{width:12px;height:12px;border:2px solid var(--blue-l);border-top-color:var(--blue);border-radius:50%;display:inline-block;animation:uwspin .7s linear infinite;}
@keyframes uwspin{to{transform:rotate(360deg);}}

.uw-strip{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:.6rem;margin-bottom:1rem;}
@media(max-width:1100px){.uw-strip{grid-template-columns:repeat(4,1fr);}}
.uw-kpi{background:var(--navy);color:#fff;border-radius:8px;padding:.6rem .7rem;text-align:center;}
.uw-kpi-label{font-size:.66rem;letter-spacing:.03em;text-transform:uppercase;opacity:.75;}
.uw-kpi-val{font-size:1.15rem;font-weight:700;margin-top:.15rem;}

.uw-layout{display:grid;grid-template-columns:380px 1fr;gap:1rem;align-items:start;}
@media(max-width:1000px){.uw-layout{grid-template-columns:1fr;}}
.uw-assumptions{max-height:760px;overflow:auto;padding:.4rem;}
.uw-grp{border-bottom:1px solid var(--gray-100);}
.uw-grp-hd{display:flex;align-items:center;gap:.4rem;padding:.5rem .55rem;font-weight:700;font-size:.85rem;cursor:pointer;color:var(--navy);}
.uw-grp-hd:hover{background:var(--gray-50);}
.uw-caret{width:1rem;display:inline-block;color:var(--gray-400);}
.uw-grp-count{margin-left:auto;font-size:.7rem;color:var(--gray-400);font-weight:600;}
.uw-grp-body{padding:.2rem .3rem .5rem;}
.uw-row{display:flex;align-items:center;gap:.5rem;padding:.25rem .4rem;border-radius:5px;}
.uw-row:hover{background:var(--gray-50);}
.uw-row-lbl{flex:1;font-size:.8rem;color:var(--gray-800);min-width:0;}
.uw-row-ctl{display:flex;align-items:center;gap:.35rem;position:relative;}
.uw-inp{width:108px;padding:.25rem .4rem;border:1px solid var(--gray-200);border-radius:5px;font-size:.8rem;text-align:right;}
.uw-inp:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 2px var(--blue-l);}
.uw-affix{position:absolute;right:140px;color:var(--gray-400);font-size:.72rem;pointer-events:none;}
.uw-ro{width:108px;text-align:right;font-size:.8rem;color:var(--gray-600);}
.uw-chip{font-size:.62rem;font-weight:700;padding:.08rem .35rem;border-radius:10px;text-transform:uppercase;letter-spacing:.02em;width:52px;text-align:center;}
.chip-T12{background:#e8f6ef;color:#1b7a46;}
.chip-RR{background:#e8f2fc;color:#2a6cb0;}
.chip-OM{background:#f3e8fb;color:#7a3ca0;}
.chip-Deal{background:#fff3e0;color:#b5720a;}
.chip-Default{background:var(--gray-100);color:var(--gray-600);}
.chip-Manual{background:#fde8e8;color:#c0392b;}
.uw-reset{border:none;background:none;cursor:pointer;color:var(--gray-400);font-size:.95rem;line-height:1;padding:0 .15rem;}
.uw-reset:hover{color:var(--rose);}
.uw-reset-sp{width:1.1rem;display:inline-block;}

.uw-workbook{min-width:0;}
.uw-subtabs{display:flex;flex-wrap:wrap;gap:.3rem;margin-bottom:.6rem;}
.uw-subtab{padding:.3rem .6rem;font-size:.76rem;border:1px solid var(--gray-200);background:#fff;border-radius:6px;cursor:pointer;color:var(--gray-600);}
.uw-subtab:hover{border-color:var(--blue);}
.uw-subtab.active{background:var(--navy);color:#fff;border-color:var(--navy);}
.uw-lazy{opacity:.6;font-size:.68rem;}
.uw-sheet-host{border:1px solid var(--gray-200);border-radius:8px;overflow:auto;max-height:760px;background:#fff;}
.uw-sheet-wrap{position:relative;}
.uw-img-layer{position:absolute;top:0;left:0;width:0;height:0;}
.uw-sheet{border-collapse:collapse;font-size:.74rem;table-layout:fixed;}
.uw-sheet td{border:1px solid #eef1f5;padding:1px 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:19px;vertical-align:middle;}
.uw-sheet-empty{padding:1rem;color:var(--gray-600);}

/* Batch 1 additions: vacancy grid, not-in-T12 chip, date input */
.chip-NotinT12{background:#fdecea;color:#b23b2e;}
.uw-vac-row{flex-direction:column;align-items:stretch !important;}
.uw-vac-note{display:block;font-weight:400;font-size:.68rem;color:var(--gray-400);margin-top:.1rem;}
.uw-vac-grid{display:grid;grid-template-columns:repeat(11,1fr);gap:.2rem;margin-top:.35rem;}
.uw-vac-cell{text-align:center;}
.uw-vac-yr{font-size:.6rem;color:var(--gray-400);font-weight:600;}
.uw-vac-inp{width:100%;padding:.2rem .1rem;border:1px solid var(--gray-200);border-radius:4px;font-size:.68rem;text-align:center;}
.uw-vac-inp:focus{outline:none;border-color:var(--blue);}
.uw-vac-inp.chip-RR{background:#eef6fc;}
.uw-inp[type=date]{width:140px;}

/* ════════════════════════════════════════════════════════════════════════
   UNDERWRITING TAB — Batch 2 UI cleanup (overrides earlier rules)
   ════════════════════════════════════════════════════════════════════════ */
/* Sticky outputs strip stays visible while scrolling */
.uw-strip{position:sticky;top:0;z-index:20;background:var(--gray-100);padding:.35rem 0;}
/* Assumptions panel and workbook scroll independently */
.uw-layout{align-items:start;}
.uw-assumptions{max-height:72vh;overflow-y:auto;}
.uw-workbook{min-width:0;}
.uw-sheet-host{max-height:72vh;overflow:auto;}            /* vertical + horizontal scroll inside the box */
.uw-sheet{table-layout:auto;min-width:max-content;}        /* let wide workbooks scroll horizontally */

/* Assumption rows: label | control | chip | reset in a consistent grid */
.uw-row{display:grid;grid-template-columns:1fr auto 56px 1.2rem;align-items:center;gap:.5rem;}
.uw-row-lbl{white-space:normal;overflow-wrap:anywhere;line-height:1.2;}
.uw-row-ctl{display:contents;}                             /* children land in the grid columns */
.uw-chip{justify-self:center;}

/* Input group: $ prefix / % suffix OUTSIDE the box, number right-aligned */
.uw-ig{display:inline-flex;align-items:center;gap:2px;justify-self:end;}
.uw-ig .uw-inp{width:112px;text-align:right;}
.uw-pre,.uw-suf{color:var(--gray-400);font-size:.78rem;flex:none;}
.uw-inp{font-variant-numeric:tabular-nums;}
select.uw-inp{width:72px;text-align:left;justify-self:end;}

/* Vacancy Year 0–10: compact readable grid spanning the row */
.uw-vac-row{display:block;}
.uw-vac-grid{grid-template-columns:repeat(11,minmax(0,1fr));gap:3px;}
.uw-vac-inp{padding:.18rem 2px;font-variant-numeric:tabular-nums;}

/* Small logo in the Underwriting header (replaces the in-render logo) */
.uw-hdr-logo{height:26px;vertical-align:middle;margin-left:.5rem;opacity:.9;}

/* Mapping ("How was this mapped?") list */
.uw-map{margin:.5rem 0;border:1px solid var(--gray-200);border-radius:6px;}
.uw-map summary{cursor:pointer;padding:.45rem .7rem;font-size:.82rem;font-weight:600;color:var(--navy);}
.uw-map table{width:100%;border-collapse:collapse;font-size:.76rem;}
.uw-map td{padding:.2rem .5rem;border-top:1px solid var(--gray-100);}
.uw-map td:last-child{text-align:right;font-variant-numeric:tabular-nums;}
.uw-map .uw-map-unmapped{color:#b23b2e;}
.uw-addcat{margin:.4rem 0;display:flex;gap:.4rem;align-items:center;flex-wrap:wrap;}

/* ─────────────────────────────────────────────────────────────────────────
   In-app uploads — New deal modal + Add files (navy/blue card style)
   NOTE: overlays use :not([hidden]) so the `hidden` attribute actually hides
   them (a plain `display:flex` would override the UA [hidden] rule).
   ───────────────────────────────────────────────────────────────────────── */
.nd-btn{white-space:nowrap}
.nd-btn.nd-dragover{outline:2px dashed var(--blue);outline-offset:2px}

/* full-page drag overlay (dashboard) */
.nd-page-overlay{position:fixed;inset:0;z-index:300;background:rgba(26,58,92,.55);
  display:none;align-items:center;justify-content:center;padding:24px}
.nd-page-overlay:not([hidden]){display:flex}
.nd-po-box{border:3px dashed #fff;border-radius:16px;padding:2.5rem 3.5rem;text-align:center;color:#fff}
.nd-po-icon{font-size:2.4rem;line-height:1}
.nd-po-text{font-size:1.2rem;font-weight:600;margin-top:.5rem}

/* modal shell */
.nd-modal-overlay{position:fixed;inset:0;background:rgba(18,40,64,.5);z-index:200;
  display:none;align-items:center;justify-content:center;padding:16px}
.nd-modal-overlay:not([hidden]){display:flex}
.nd-modal{background:#fff;border-radius:12px;max-width:560px;width:100%;max-height:88vh;overflow:auto;
  padding:1.25rem 1.4rem;box-shadow:0 18px 50px rgba(18,40,64,.3)}
.nd-modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:.9rem}
.nd-modal-head h3{margin:0;color:var(--navy);font-size:1.15rem}
.nd-x{background:none;border:none;font-size:1.5rem;line-height:1;cursor:pointer;color:var(--gray-500);padding:0 .25rem}
.nd-x:hover{color:var(--navy)}

/* drop zone (shared: .nd-dropzone / .af-dropzone) */
.nd-dropzone,.af-dropzone{border:2px dashed var(--gray-300);border-radius:10px;background:var(--gray-50);
  padding:1.6rem 1rem;text-align:center;transition:border-color .15s,background .15s}
.nd-dropzone.nd-dragover,.af-dropzone.nd-dragover{border-color:var(--blue);background:var(--blue-l)}
.nd-dz-icon{font-size:1.6rem;color:var(--blue)}
.nd-dz-text{font-size:.9rem;color:var(--gray-800);margin:.3rem 0 .7rem}
.nd-dz-btns{display:flex;gap:.5rem;justify-content:center;flex-wrap:wrap}

/* file list (shared) */
.nd-files,.af-files{margin:.85rem 0}
.nd-files-head{font-size:.75rem;color:var(--gray-500);text-transform:uppercase;letter-spacing:.03em;margin-bottom:.35rem}
.nd-files-list{max-height:190px;overflow:auto;border:1px solid var(--gray-200);border-radius:8px}
.nd-file{display:flex;align-items:center;gap:.6rem;padding:.4rem .6rem;border-bottom:1px solid var(--gray-100);font-size:.8rem}
.nd-file:last-child{border-bottom:none}
.nd-file-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gray-800)}
.nd-file-zip{color:var(--blue);font-size:.72rem;font-weight:600;white-space:nowrap}
.nd-file-size{color:var(--gray-500);font-variant-numeric:tabular-nums;white-space:nowrap}
.nd-file-x{background:none;border:none;color:var(--gray-400);cursor:pointer;font-size:1.05rem;line-height:1;padding:0 .2rem}
.nd-file-x:hover{color:#b91c1c}

/* name row */
.nd-row label{display:block;font-size:.72rem;color:var(--gray-500);margin-bottom:.25rem;text-transform:uppercase;letter-spacing:.03em}
.nd-hint{font-size:.72rem;color:var(--gray-500);margin:.35rem 0 0}

/* progress (shared) */
.nd-progress-wrap,.af-progress-wrap{margin:.85rem 0}
.nd-progress{height:8px;background:var(--gray-200);border-radius:999px;overflow:hidden;margin:.4rem 0 .3rem}
.nd-progress-bar{height:100%;width:0;background:var(--blue);transition:width .15s}
.nd-progress-text{font-size:.78rem;color:var(--gray-800)}

/* duplicate + conflict + error (shared) */
.nd-dup,.af-dup{margin:.85rem 0;padding:.75rem .85rem;border:1px solid #f3d19b;background:#fff8ec;border-radius:8px;font-size:.82rem;color:var(--gray-800)}
.nd-dup b,.af-dup b{color:#9a6700}
.nd-dup ul,.af-dup ul{margin:.4rem 0;padding-left:1.1rem}
.nd-dup-btns,.af-dup-btns{display:flex;gap:.45rem;flex-wrap:wrap;margin-top:.6rem}
.nd-dup-btns button,.af-dup-btns button{font-size:.78rem;padding:.4rem .7rem;border-radius:7px;cursor:pointer;border:1px solid var(--gray-300);background:#fff;color:var(--gray-800)}
.nd-dup-btns .nd-primary,.af-dup-btns .nd-primary{background:var(--blue);color:#fff;border-color:transparent}
.nd-error,.af-error{margin:.6rem 0;padding:.6rem .8rem;border:1px solid #f3b4b4;background:#fdecec;border-radius:8px;font-size:.82rem;color:#b91c1c}

/* footer actions (shared) */
.nd-actions,.af-actions{display:flex;gap:.5rem;justify-content:flex-end;flex-wrap:wrap;margin-top:1.1rem}
.nd-actions button,.af-actions button{font-size:.83rem;padding:.5rem 1rem;border-radius:8px;cursor:pointer;border:1px solid transparent}
.nd-primary,.af-primary{background:var(--blue);color:#fff}
.nd-primary:disabled,.af-primary:disabled{background:var(--gray-300);cursor:not-allowed}
.nd-secondary{background:#fff;border-color:var(--gray-300);color:var(--gray-800)}
.nd-ghost{background:none;color:var(--gray-600)}
.af-zone{margin:0 0 1rem}

/* ── Auth: sidebar user panel, login & forms ────────────────────────────── */
.sidebar-user { margin-top: auto; padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.su-info { min-width: 0; }
.su-name { font-size: .85rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-role { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: #9fb3c8; }
.su-role-admin { color: #ffd27a; }
.su-role-guest { color: #9ad0b0; }
.su-logout { background: none; border: 1px solid rgba(255,255,255,.25); color: #cfe0f0;
  font-size: .74rem; padding: .3rem .55rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.su-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy, #12283f); padding: 24px; }
.auth-card { background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%; max-width: 380px; padding: 2rem 2rem 1.6rem; }
.auth-brand { display: flex; align-items: center; gap: .55rem; justify-content: center; margin-bottom: 1.2rem; color: var(--navy, #12283f); }
.auth-brand svg { width: 26px; height: 26px; }
.auth-brand span { font-size: 1.15rem; font-weight: 700; }
.auth-card h1 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--navy, #12283f); text-align: center; }
.auth-field { margin-bottom: .85rem; }
.auth-field label { display: block; font-size: .78rem; font-weight: 600; color: var(--gray-600); margin-bottom: .25rem; }
.auth-field input[type="email"], .auth-field input[type="password"], .auth-field input[type="text"] {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--gray-200); border-radius: 8px; font-size: .92rem; }
.auth-check { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--gray-700); margin: .3rem 0 1rem; }
.auth-btn { width: 100%; background: var(--blue, #1B4F8A); color: #fff; border: none; padding: .65rem;
  border-radius: 8px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.auth-btn:hover { filter: brightness(1.05); }
.auth-error { background: #fdecec; border: 1px solid #f3b4b4; color: #b91c1c; font-size: .82rem;
  padding: .55rem .7rem; border-radius: 8px; margin-bottom: .9rem; }
.auth-note { background: #fff8ec; border: 1px solid #f3d19b; color: #9a6700; font-size: .82rem;
  padding: .55rem .7rem; border-radius: 8px; margin-bottom: .9rem; }

/* Users admin table */
.users-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.users-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--gray-500); border-bottom: 1px solid var(--gray-200); padding: .5rem .6rem; }
.users-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.role-pill { font-size: .7rem; font-weight: 600; text-transform: uppercase; padding: .12rem .4rem; border-radius: 999px; }
.role-admin { background: #fff3d6; color: #9a6700; }
.role-user  { background: #e2e8f0; color: #334155; }
.role-guest { background: #d6f0e0; color: #166534; }
.badge-off { background: #fde2e2; color: #b91c1c; font-size: .7rem; padding: .1rem .4rem; border-radius: 999px; }
.badge-lock { background: #fef3c7; color: #92400e; font-size: .7rem; padding: .1rem .4rem; border-radius: 999px; }

/* ── Multi-user: owner filter + added-by ───────────────────────────────── */
.owner-toggle { display: inline-flex; border: 1px solid var(--gray-300, #cbd5e1); border-radius: 8px; overflow: hidden; }
.owner-toggle .ot-btn { background: #fff; border: none; padding: .4rem .7rem; font-size: .82rem; cursor: pointer; color: var(--gray-700, #334155); }
.owner-toggle .ot-btn + .ot-btn { border-left: 1px solid var(--gray-300, #cbd5e1); }
.owner-toggle .ot-btn.active { background: var(--blue, #1B4F8A); color: #fff; }
.deal-added-by { font-size: .72rem; color: var(--gray-500, #64748b); margin-top: .15rem; }
.deal-header-addedby { font-size: .78rem; color: var(--gray-500, #64748b); margin-top: .2rem; }
.scn-owner { font-size: .72rem; color: var(--gray-500, #64748b); font-weight: 400; }
.scn-readonly-note { font-size: .78rem; color: #9a6700; background: #fff8ec; border: 1px solid #f3d19b;
  border-radius: 6px; padding: .3rem .55rem; display: inline-flex; align-items: center; gap: .5rem; }

/* ── Edit-conflict banner (shared) ─────────────────────────────────────── */
.conflict-banner {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #fff8ec; border: 1px solid #f3d19b; color: #8a5a00;
  border-radius: 8px; padding: .55rem .8rem; margin-bottom: 1rem; font-size: .85rem;
}
.conflict-banner .cb-msg { flex: 1 1 220px; }

/* ── Change log (History panel + Activity log page) ────────────────────── */
.history-panel { margin-top: 1.5rem; }
.history-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  cursor: pointer; user-select: none;
}
.history-head .panel-title { margin-bottom: 0; }
.history-toggle { font-size: .8rem; color: var(--blue); background: none; border: none; cursor: pointer; }
.history-body { margin-top: .75rem; }
.history-filter { margin-bottom: .6rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.history-list { display: flex; flex-direction: column; gap: .1rem; }
.log-row {
  display: grid; grid-template-columns: 150px 1fr; gap: .5rem;
  padding: .5rem 0; border-bottom: 1px solid var(--gray-200); font-size: .82rem;
}
.log-row:last-child { border-bottom: none; }
.log-when { color: var(--gray-500); font-variant-numeric: tabular-nums; }
.log-who { font-weight: 600; color: var(--navy); }
.log-action {
  display: inline-block; font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; background: var(--gray-100, #f1f5f9); color: var(--gray-700, #334155);
  padding: .08rem .4rem; border-radius: 4px; margin-left: .4rem;
}
.log-field { color: var(--gray-700, #334155); }
.log-change { color: var(--gray-500); margin-top: .15rem; word-break: break-word; }
.log-change .lc-old { color: var(--red); text-decoration: line-through; opacity: .8; }
.log-change .lc-new { color: var(--green); }
.log-deal a { color: var(--blue); text-decoration: none; }
.log-deal a:hover { text-decoration: underline; }
.activity-filters {
  display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.activity-filters .af-field { display: flex; flex-direction: column; gap: .2rem; }
.activity-filters label { font-size: .72rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; }
.activity-filters select, .activity-filters input { padding: .35rem .5rem; }

/* ── Sync & backups ────────────────────────────────────────────────────── */
.sync-alert-banner {
  background: #fde2e2; color: #991b1b; border: 1px solid #f3b4b4;
  border-radius: 6px; padding: .55rem .9rem; margin-bottom: 1rem;
  font-size: .85rem; font-weight: 600; display: flex; gap: .75rem; align-items: center;
}
.sync-alert-banner a { color: #991b1b; text-decoration: underline; }
.sync-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.sync-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: .9rem 1rem; }
.sync-card h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500); margin: 0 0 .35rem; }
.sync-card .sc-val { font-size: .95rem; font-weight: 600; color: var(--navy); }
.sync-card .sc-sub { font-size: .76rem; color: var(--gray-500); margin-top: .2rem; }
.sync-ok  { color: #166534; }
.sync-bad { color: #991b1b; }
.sync-pill { display:inline-block; font-size:.7rem; font-weight:600; padding:.1rem .45rem; border-radius:999px; background:var(--gray-100,#f1f5f9); color:var(--gray-700,#334155); }
.sync-pill.op-push { background:#e8f2fc; color:#1b4f8a; }
.sync-pill.op-move { background:#fff3d6; color:#9a6700; }
.sync-pill.st-failed { background:#fde2e2; color:#991b1b; }
#sync-dryrun-out { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: .74rem;
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; padding: .6rem; margin-top: .5rem; max-height: 320px; overflow: auto; }
