/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --cream:        #faf8f4;
  --stone:        #f2ede4;
  --stone-2:      #e8e1d5;
  --border:       #ddd6c9;
  --border-2:     #c8bfb0;
  --text-1:       #1a1812;
  --text-2:       #4a4438;
  --text-3:       #8a7f72;
  --text-4:       #b8ae9f;
  --accent:       #b85c28;
  --accent-light: #f7ede5;
  --accent-mid:   #d4753a;
  --white:        #ffffff;
  --green:        #2d5a3d;
  --green-light:  #eaf2ed;
  --red:          #9b1c1c;
  --red-light:    #fdf0f0;
  --amber:        #92400e;
  --amber-light:  #fef5e7;
  --shadow-sm:    0 1px 3px rgba(26,24,18,0.06), 0 1px 2px rgba(26,24,18,0.04);
  --shadow-md:    0 4px 16px rgba(26,24,18,0.10), 0 2px 4px rgba(26,24,18,0.06);
  --shadow-lg:    0 16px 48px rgba(26,24,18,0.14), 0 4px 8px rgba(26,24,18,0.08);
  --serif:        'Cormorant Garamond', Georgia, serif;
  --sans:         'DM Sans', system-ui, sans-serif;
  --mono:         'Azeret Mono', 'Courier New', monospace;
  --radius:       4px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--cream); color: var(--text-1); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
select { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--stone); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ── Layout ─────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 60px;
  display: flex; align-items: center; gap: 24px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.tabbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; display: flex; align-items: center; flex-shrink: 0;
}
.main { padding: 24px 28px; flex: 1; }
.main.panel-open { /* panel overlays; no push needed */ }

/* ── Brand ──────────────────────────────────────────────────── */
.brand {
  display: flex; flex-direction: row; align-items: center; gap: 10px; flex-shrink: 0;
  border-right: 1px solid var(--border); padding-right: 24px; margin-right: 4px;
}
.brand-logo {
  height: 36px; width: 36px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 0; }
.brand-name {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.01em; line-height: 1.1;
}
.brand-sub {
  font-family: var(--sans); font-size: 10px; font-weight: 400;
  color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase;
  margin-top: 1px;
}

/* ── Stat chips ─────────────────────────────────────────────── */
.chips { display: flex; gap: 20px; align-items: center; }
.chip { display: flex; flex-direction: column; gap: 1px; }
.chip-label { font-size: 9px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.chip-value { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1; color: var(--text-1); }
.chip-value.warn  { color: var(--amber); }
.chip-value.alert { color: var(--red); }

/* ── Top bar right ───────────────────────────────────────────── */
.spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.refresh-time { font-size: 10px; color: var(--text-4); font-family: var(--mono); }
.btn-refresh {
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--text-2); border: 1px solid var(--border);
  padding: 5px 14px; border-radius: var(--radius);
  background: var(--white); transition: all 0.15s;
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tab-btn {
  font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
  color: var(--text-3); padding: 14px 18px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text-2); }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-select {
  font-size: 11px; font-weight: 500; background: var(--white);
  color: var(--text-2); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: var(--radius); cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:hover { border-color: var(--border-2); }
.btn-cold {
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-3); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: var(--radius);
  background: var(--white); transition: all 0.15s;
}
.btn-cold.active { color: var(--red); background: var(--red-light); border-color: #f0a0a0; }

/* ── Tags / Pills ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 500; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 2px;
  white-space: nowrap;
}
.tag-cold  { background: var(--red-light);   color: var(--red);   border: 1px solid #f5c6c6; }
.tag-active{ background: var(--green-light);  color: var(--green); border: 1px solid #b8d9c4; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner-wrap { display: flex; justify-content: center; padding: 64px; }
.spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section headings ───────────────────────────────────────── */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--serif); font-size: 20px; font-style: italic;
  font-weight: 400; color: var(--text-1);
}
.section-count { font-size: 11px; color: var(--text-3); }

/* ── Kanban ─────────────────────────────────────────────────── */
.kanban-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.btn-sm {
  font-size: 11px; font-weight: 500; color: var(--text-3);
  border: 1px solid var(--border); padding: 5px 12px;
  border-radius: var(--radius); background: var(--white);
  transition: all 0.15s;
}
.btn-sm:hover { color: var(--accent); border-color: var(--accent); }
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kanban-col { flex: 1 1 230px; min-width: 230px; }
.col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; margin-bottom: 8px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-left: 3px solid; background: var(--white);
  box-shadow: var(--shadow-sm);
}
.col-header-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.col-header-count { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--text-3); }
.col-empty {
  font-size: 11px; color: var(--text-4); text-align: center; padding: 24px 8px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--white);
}

/* ── Detail panel hero image ─────────────────────────────────── */
.panel-hero {
  margin: -20px -24px 20px;
  height: 260px;
  overflow: hidden;
  position: relative;
}
.panel-hero-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.panel-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(255,255,255,0.85) 100%);
}

/* ── Lead cards ─────────────────────────────────────────────── */
.lead-card {
  background: var(--white); border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.lead-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lead-card.cold { border-left-color: #f0a0a0; }
.lead-card:hover { border-left-color: var(--accent); }
.card-body { padding: 12px 14px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.card-name { font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.2; flex: 1; }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--stone);
}
.card-meta-item {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
}
.card-action {
  padding: 8px 14px; border-top: 1px solid var(--stone);
  background: var(--stone); font-size: 11px; color: var(--text-2);
  display: flex; flex-direction: column; gap: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.card-action.overdue { background: var(--red-light); color: var(--red); }
.card-action-text { line-height: 1.4; }
.card-action-date { font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.card-action.overdue .card-action-date { color: var(--red); opacity: 0.7; }

/* ── Priority badge ─────────────────────────────────────────── */
.pri-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 2px; flex-shrink: 0;
}
.pri-1 { background: var(--red-light);   color: var(--red);   }
.pri-2 { background: var(--amber-light); color: var(--amber); }
.pri-3 { background: var(--stone);       color: var(--text-3);}

/* ── Stage tag ──────────────────────────────────────────────── */
.stage-tag { font-size: 10px; font-weight: 500; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 2px; white-space: nowrap; }

/* ── Location/model tag ─────────────────────────────────────── */
.meta-tag { font-size: 10px; color: var(--text-3); background: var(--stone); padding: 2px 7px; border-radius: 2px; border: 1px solid var(--border); }

/* ── List view ──────────────────────────────────────────────── */
.list-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--border); background: var(--stone);
  position: sticky; top: 0; user-select: none; cursor: pointer;
  white-space: nowrap; transition: color 0.15s;
}
thead th:hover { color: var(--accent); }
thead th.sort-active { color: var(--accent); }
thead th.right { text-align: right; }
tbody tr { cursor: pointer; transition: background 0.1s; border-bottom: 1px solid var(--stone); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--accent-light); }
td { padding: 11px 16px; vertical-align: middle; }
.cell-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.cell-city { font-size: 10px; color: var(--text-3); margin-top: 2px; letter-spacing: 0.03em; }
.cell-num  { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text-1); }
.cell-mono { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.cell-right { text-align: right; }
.cell-overdue { color: var(--red) !important; }
.cell-doc-count { font-family: var(--mono); font-size: 12px; color: var(--text-4); }
.cell-doc-hit   { color: var(--green); font-weight: 500; }

/* ── Digest ─────────────────────────────────────────────────── */
.digest-wrap { max-width: 680px; margin: 0 auto; }
.digest-header {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.digest-eyebrow { font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.digest-date  { font-family: var(--serif); font-size: 26px; font-weight: 400; font-style: italic; color: var(--text-1); }
.digest-stats { display: flex; gap: 24px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--stone); }
.digest-stat  { display: flex; flex-direction: column; gap: 2px; }
.digest-stat-value { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--text-1); line-height: 1; }
.digest-stat-label { font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.digest-section { margin-bottom: 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.digest-section-head {
  padding: 10px 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.digest-section-body { padding: 4px 20px 12px; }
.digest-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--stone); }
.digest-row:last-child { border-bottom: none; }
.digest-row-left  { font-size: 13px; font-weight: 500; color: var(--text-1); }
.digest-row-sub   { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.digest-row-right { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.digest-healthy {
  font-family: var(--serif); font-size: 16px; font-style: italic;
  color: var(--green); text-align: center; padding: 24px;
  border: 1px solid #b8d9c4; background: var(--green-light);
  border-radius: var(--radius);
}

/* ── Detail panel ───────────────────────────────────────────── */
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: clamp(600px, 66vw, 960px);
  background: var(--white); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 1100;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.panel-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  background: var(--stone); flex-shrink: 0;
}
.panel-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.panel-name { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--text-1); flex: 1; margin-right: 12px; line-height: 1.2; }
.panel-legal { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.panel-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-close {
  background: var(--white); border: 1px solid var(--border); color: var(--text-3);
  width: 30px; height: 30px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; transition: all 0.15s;
}
.btn-close:hover { border-color: var(--border-2); color: var(--text-1); }
.panel-body {
  flex: 1; overflow-y: auto; padding: 0;
  display: grid; grid-template-columns: 3fr 2fr;
}
.panel-col {
  padding: 20px 24px;
  min-width: 0;
  align-self: start;
}
.panel-col + .panel-col {
  border-left: 1px solid var(--border);
  align-self: stretch;
}

/* ── Panel internals ────────────────────────────────────────── */
.p-section { margin-bottom: 22px; }
.p-section-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.p-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.p-grid4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px 16px; }
.kv-label { font-size: 10px; color: var(--text-3); margin-bottom: 2px; letter-spacing: 0.03em; }
.kv-value { font-family: var(--mono); font-size: 12px; color: var(--text-1); font-weight: 500; }
.kv-value.serif { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.p-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--accent); margin-top: 6px;
  transition: opacity 0.15s;
}
.p-link:hover { opacity: 0.75; }
.next-action-box {
  padding: 12px 14px; background: var(--accent-light);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.next-action-text { font-size: 13px; color: var(--text-1); line-height: 1.4; }
.next-action-due  { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-top: 5px; }
.contact-card { margin-bottom: 8px; padding: 10px 12px; background: var(--stone); border-radius: var(--radius); border-left: 2px solid var(--border); }
.contact-name   { font-size: 13px; font-weight: 600; color: var(--text-1); }
.contact-type   { font-size: 10px; color: var(--text-3); margin-bottom: 4px; letter-spacing: 0.03em; }
.contact-detail { font-size: 11px; color: var(--text-2); font-family: var(--mono); }
.doc-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--stone); }
.doc-row:last-child { border-bottom: none; }
.doc-name { font-size: 12px; font-weight: 500; color: var(--text-1); }
.doc-type { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.doc-link { font-size: 13px; color: var(--accent); transition: opacity 0.15s; }
.doc-link:hover { opacity: 0.7; }
.timeline-item { display: flex; gap: 12px; margin-bottom: 14px; position: relative; }
.timeline-line { position: absolute; left: 44px; top: 16px; bottom: -14px; width: 1px; background: var(--border); }
.timeline-date { font-family: var(--mono); font-size: 9px; color: var(--text-4); white-space: nowrap; padding-top: 2px; width: 44px; flex-shrink: 0; text-align: right; }
.timeline-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); margin-top: 5px; flex-shrink: 0; }
.timeline-title   { font-size: 12px; font-weight: 600; color: var(--text-1); margin-bottom: 2px; }
.timeline-details { font-size: 11px; color: var(--text-2); line-height: 1.4; margin-bottom: 4px; }
.timeline-tags { display: flex; gap: 4px; }
.timeline-tag { font-size: 9px; color: var(--text-3); background: var(--stone); padding: 1px 6px; border-radius: 2px; }
.notes-text { font-size: 13px; color: var(--text-2); line-height: 1.7; font-style: italic; }

/* ── Error / empty states ───────────────────────────────────── */
.error-box { max-width: 500px; margin: 80px auto; padding: 32px; background: var(--white); border: 1px solid #f5c6c6; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.error-title { font-family: var(--serif); font-size: 20px; font-style: italic; color: var(--red); margin-bottom: 8px; }
.error-msg   { font-family: var(--mono); font-size: 11px; color: var(--text-2); margin-bottom: 14px; }
.error-help  { font-size: 12px; color: var(--text-2); line-height: 1.7; margin-bottom: 16px; }
.error-code  { font-family: var(--mono); background: var(--stone); padding: 1px 5px; border-radius: 2px; color: var(--accent); font-size: 11px; }
.btn-retry {
  font-size: 12px; font-weight: 500; color: var(--accent);
  border: 1px solid var(--accent); padding: 7px 18px; border-radius: var(--radius);
  background: var(--white); transition: all 0.15s;
}
.btn-retry:hover { background: var(--accent); color: var(--white); }
.empty-box { max-width: 540px; margin: 80px auto; text-align: center; padding: 48px 40px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.empty-title { font-family: var(--serif); font-size: 28px; font-style: italic; font-weight: 400; color: var(--text-1); margin-bottom: 16px; }
.empty-body  { font-size: 14px; color: var(--text-2); line-height: 1.7; max-width: 380px; margin: 0 auto; }
.empty-hint  { font-size: 12px; color: var(--text-3); margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--stone); line-height: 1.6; }
.empty-cmd   { font-family: var(--mono); background: var(--stone); padding: 1px 6px; border-radius: 2px; color: var(--text-2); }
.empty-icon  { font-size: 32px; margin-bottom: 16px; opacity: 0.4; }

/* ── Stage pipeline progress bar (above kanban) ─────────────── */
.pipeline-track { display: flex; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: var(--shadow-sm); }
.pipeline-step { flex: 1; padding: 8px 6px; text-align: center; font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); border-right: 1px solid var(--border); transition: all 0.15s; cursor: default; }
.pipeline-step:last-child { border-right: none; }
.pipeline-step.has-leads { color: var(--white); }
.pipeline-step .step-count { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1; margin-bottom: 2px; }

/* ── Status analysis indicators ─────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 2px;
}
.status-not_started { background: var(--stone);       color: var(--text-3); }
.status-in_progress { background: var(--amber-light); color: var(--amber);  }
.status-complete    { background: var(--green-light);  color: var(--green);  }
.status-draft       { background: var(--amber-light); color: var(--amber);  }
.status-final       { background: var(--green-light);  color: var(--green);  }

/* ── Map view ───────────────────────────────────────────────── */
.main.map-active { padding: 0; }
.map-view { display: flex; flex-direction: column; }
.map-filter-bar {
  padding: 10px 28px; background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; flex-shrink: 0;
}
.map-filter-stages { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.map-stage-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500;
  padding: 5px 11px; border-radius: var(--radius); border: 1px solid;
  background: transparent; cursor: pointer; transition: all 0.15s;
}
.map-stage-btn:disabled { opacity: 0.35; cursor: default; }
.map-stage-count {
  font-family: var(--serif); font-size: 14px; font-weight: 600; line-height: 1; flex-shrink: 0;
}
.map-filter-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-top: 1px; }
.map-locating-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 28px;
  background: var(--accent-light); border-bottom: 1px solid var(--accent);
  font-size: 12px; color: var(--accent); font-weight: 500;
  flex-shrink: 0;
}
.map-locating-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--accent); border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#map-container { height: calc(100vh - 156px); width: 100%; }

/* ── Site cards (detail panel) ──────────────────────────────── */
.site-card {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--stone); border-radius: var(--radius);
  border-left: 2px solid var(--border);
}
.site-info { flex: 1; }
.site-address-line { font-size: 12px; font-weight: 500; color: var(--text-1); }
.site-address-city { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.site-primary-badge {
  display: inline-block; margin-top: 4px;
  font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-light);
  padding: 1px 6px; border-radius: 2px;
}

/* ── CRUD: panel section label (flex to allow action buttons) ── */
.p-section-label {
  display: flex; align-items: center; justify-content: space-between;
}

/* ── CRUD: section add button & item edit button ──────────────── */
.btn-section-action {
  font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 2px 9px; border-radius: var(--radius);
  background: var(--white); transition: all 0.15s; flex-shrink: 0;
}
.btn-section-action:hover { background: var(--accent-light); }

.btn-item-edit {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  padding: 2px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white);
  transition: all 0.15s; flex-shrink: 0;
}
.btn-item-edit:hover { color: var(--accent); border-color: var(--accent); }

/* ── CRUD: edit lead button in panel header ───────────────────── */
.btn-edit-lead {
  font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-3); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: var(--radius);
  background: var(--white); transition: all 0.15s; flex-shrink: 0; align-self: flex-start;
}
.btn-edit-lead:hover { color: var(--accent); border-color: var(--accent); }

/* ── CRUD: new lead button in tabbar ─────────────────────────── */
.btn-new-lead {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--white); background: var(--accent);
  padding: 5px 14px; border-radius: var(--radius);
  transition: all 0.15s;
}
.btn-new-lead:hover { background: var(--accent-mid); }

/* ── CRUD: contact card flex layout ─────────────────────────── */
.contact-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

/* ── CRUD: empty section state ───────────────────────────────── */
.p-empty { font-size: 11px; color: var(--text-4); padding: 6px 0 2px; font-style: italic; }

/* ── CRUD: snackbar ──────────────────────────────────────────── */
.snackbar {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 1300; background: var(--text-1); color: var(--white);
  padding: 10px 18px 10px 14px; border-radius: 6px;
  font-size: 13px; letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap; max-width: calc(100vw - 48px);
}
.snackbar.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.snackbar.error { background: var(--red); }
.snack-icon { font-size: 12px; opacity: 0.8; }

/* ── CRUD: modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(26,24,18,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--white); border-radius: 6px;
  width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn {
  from { transform: scale(0.97) translateY(8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--serif); font-size: 20px; font-weight: 600; font-style: italic; color: var(--text-1); }
.modal-body  { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer {
  padding: 12px 24px; border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--stone); border-radius: 0 0 6px 6px;
}
.modal-confirm-text { font-size: 12px; color: var(--red); flex: 1; line-height: 1.4; }

/* ── CRUD: modal sections ────────────────────────────────────── */
.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--stone);
}

/* ── CRUD: form fields ───────────────────────────────────────── */
.form-grid2  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field  { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }
.form-label  { font-size: 10px; font-weight: 500; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.form-input,
.form-select,
.form-textarea {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 10px; font-family: var(--sans); font-size: 13px;
  color: var(--text-1); background: var(--white); outline: none;
  transition: border-color 0.15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-4); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-checkbox { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); flex-shrink: 0; }

/* ── CRUD: modal buttons ─────────────────────────────────────── */
.btn-modal-save {
  padding: 7px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--white);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  transition: all 0.15s;
}
.btn-modal-save:hover:not(:disabled) { background: var(--accent-mid); }
.btn-modal-save:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-modal-cancel {
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--border-2); color: var(--text-2);
  font-size: 12px; font-weight: 500; background: var(--white);
  transition: all 0.15s;
}
.btn-modal-cancel:hover:not(:disabled) { border-color: var(--border-2); color: var(--text-1); }
.btn-modal-cancel:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-modal-delete {
  padding: 7px 14px; border-radius: var(--radius);
  color: var(--red); border: 1px solid #f5c6c6;
  font-size: 12px; font-weight: 500; background: var(--white);
  transition: all 0.15s;
}
.btn-modal-delete:hover { background: var(--red-light); border-color: #e07070; }

/* ── Contact search modal ────────────────────────────────────── */
.contact-search-wrap { display: flex; flex-direction: column; gap: 8px; }
.contact-search-status { font-size: 12px; color: var(--text-4); padding: 4px 2px; font-style: italic; }
.contact-search-results {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; max-height: 280px; overflow-y: auto;
}
.contact-result-row {
  width: 100%; text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--stone); background: var(--white);
  cursor: pointer; transition: background 0.1s; display: block;
}
.contact-result-row:last-child { border-bottom: none; }
.contact-result-row:hover { background: var(--accent-light); }
.contact-result-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.contact-result-meta { display: flex; gap: 10px; margin-top: 2px; }
.contact-result-meta span { font-size: 11px; color: var(--text-3); }
.contact-result-email { font-family: var(--mono); }
.btn-new-contact-inline {
  width: 100%; text-align: left; padding: 10px 12px;
  font-size: 12px; font-weight: 500; color: var(--accent);
  border: 1px dashed var(--accent); border-radius: var(--radius);
  background: var(--accent-light); cursor: pointer; transition: all 0.15s;
}
.btn-new-contact-inline:hover { background: var(--accent); color: var(--white); }

.btn-modal-delete-confirm {
  padding: 7px 14px; border-radius: var(--radius);
  background: var(--red); color: var(--white);
  font-size: 12px; font-weight: 600; transition: all 0.15s;
}
.btn-modal-delete-confirm:hover:not(:disabled) { opacity: 0.85; }
.btn-modal-delete-confirm:disabled { opacity: 0.45; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════
   ENTITIES
═══════════════════════════════════════════════════════════════ */
.entity-card {
  background: var(--stone); border-radius: var(--radius);
  border-left: 2px solid var(--accent); margin-bottom: 8px;
  padding: 10px 12px;
}
.entity-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px;
}
.entity-name { font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.2; }
.entity-number { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-top: 2px; }
.entity-meta {
  display: flex; gap: 12px; margin-top: 4px; margin-bottom: 2px;
  font-size: 10px; color: var(--text-3); font-family: var(--mono);
}
.entity-meta span { display: flex; align-items: center; gap: 3px; }
.entity-actions {
  display: flex; gap: 4px; flex-shrink: 0; align-items: flex-start;
}
/* Entity financial strip */
.entity-fin-strip {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.entity-fin-rows {
  display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px;
}
.entity-fin-row {
  display: flex; align-items: baseline; gap: 0;
}
.entity-fin-label {
  font-size: 10px; color: var(--text-3); width: 74px; flex-shrink: 0;
}
.entity-fin-val {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  font-family: var(--mono); min-width: 46px;
}
.entity-fin-pct {
  font-size: 10px; color: var(--text-3); margin-left: 6px;
}
.entity-fin-period {
  font-size: 10px; color: var(--text-3); font-family: var(--mono);
}
.entity-fin-empty {
  margin-top: 6px; font-size: 11px; color: var(--text-4); font-style: italic;
}
.btn-entity-action {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  padding: 2px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white);
  transition: all 0.15s; flex-shrink: 0; white-space: nowrap;
}
.btn-entity-action:hover { color: var(--accent); border-color: var(--accent); }
.btn-entity-fin {
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--white); background: var(--accent);
  padding: 2px 8px; border-radius: var(--radius);
  border: 1px solid var(--accent); transition: all 0.15s; flex-shrink: 0;
}
.btn-entity-fin:hover { background: var(--accent-mid); }
.btn-entity-remove {
  font-size: 10px; font-weight: 500; color: var(--amber);
  padding: 2px 8px; border-radius: var(--radius);
  border: 1px solid #f5d9a0; background: var(--amber-light);
  transition: all 0.15s; flex-shrink: 0;
}
.btn-entity-remove:hover { background: #fde8a0; }
.btn-entity-delete {
  font-size: 10px; font-weight: 500; color: var(--red);
  padding: 2px 8px; border-radius: var(--radius);
  border: 1px solid #f5c6c6; background: var(--white);
  transition: all 0.15s; flex-shrink: 0;
}
.btn-entity-delete:hover { background: var(--red-light); }

/* Entity inline confirm */
.entity-confirm {
  margin-top: 8px; padding: 8px 10px;
  background: var(--red-light); border: 1px solid #f5c6c6;
  border-radius: var(--radius); font-size: 11px; color: var(--red);
}
.entity-confirm-amber {
  background: var(--amber-light); border-color: #f5d9a0; color: var(--amber);
}
.entity-confirm-text { line-height: 1.5; margin-bottom: 8px; }
.entity-confirm-actions { display: flex; gap: 6px; }

/* Site entity badge */
.site-entity-label {
  font-size: 10px; color: var(--text-3); margin-top: 3px;
  font-style: italic;
}
.site-entity-assign {
  margin-top: 5px; display: flex; align-items: center; gap: 6px;
}
.site-entity-select {
  font-size: 11px; font-family: var(--sans);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 3px 6px; background: var(--white); color: var(--text-1);
  max-width: 180px;
}
.site-entity-select:focus { border-color: var(--accent); outline: none; }

/* ═══════════════════════════════════════════════════════════════
   FINANCIAL ANALYSIS OVERLAY
═══════════════════════════════════════════════════════════════ */
.fin-overlay {
  position: fixed; inset: 0; z-index: 1150;
  background: var(--cream);
  display: flex; flex-direction: column;
  animation: slideIn 0.2s ease-out;
}
.fin-overlay-header {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 56px; flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
}
.fin-overlay-title {
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  font-style: italic; color: var(--text-1); flex: 1;
}
.fin-overlay-subtitle { font-size: 11px; color: var(--text-3); }
.fin-overlay-nav {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; display: flex; align-items: center; flex-shrink: 0; gap: 0;
}
.fin-nav-btn {
  font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-3); padding: 13px 18px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.fin-nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.fin-nav-btn:hover:not(.active) { color: var(--text-2); }
.fin-overlay-body { flex: 1; overflow-y: auto; padding: 28px; }
.fin-overlay-body > * { max-width: 900px; margin-left: auto; margin-right: auto; }

/* Document list view */
.fin-doc-empty {
  text-align: center; padding: 48px 24px;
  font-family: var(--serif); font-size: 18px; font-style: italic;
  color: var(--text-3);
}
.fin-doc-row {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.fin-doc-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fin-doc-period { font-size: 14px; font-weight: 600; color: var(--text-1); }
.fin-doc-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; font-family: var(--mono); }
.fin-doc-match {
  font-size: 10px; color: var(--text-3); margin-top: 4px;
  display: flex; gap: 8px;
}
.match-det { color: var(--green); font-weight: 500; }
.match-ai  { color: var(--amber); }
.fin-doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-fin-open {
  font-size: 11px; font-weight: 600; color: var(--white);
  background: var(--accent); padding: 5px 12px;
  border-radius: var(--radius); border: none; transition: all 0.15s;
}
.btn-fin-open:hover { background: var(--accent-mid); }
.btn-fin-dl {
  font-size: 11px; font-weight: 500; color: var(--text-2);
  background: var(--white); padding: 5px 10px;
  border-radius: var(--radius); border: 1px solid var(--border); transition: all 0.15s;
}
.btn-fin-dl:hover { border-color: var(--accent); color: var(--accent); }
.btn-fin-archive {
  font-size: 11px; font-weight: 500; color: var(--text-3);
  background: var(--white); padding: 5px 10px;
  border-radius: var(--radius); border: 1px solid var(--border); transition: all 0.15s;
}
.btn-fin-archive:hover { color: var(--amber); border-color: #f5d9a0; background: var(--amber-light); }

/* Upload view */
.upload-wrap { max-width: 640px; margin: 0 auto; }
.upload-steps {
  display: flex; gap: 0; margin-bottom: 28px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.upload-step {
  flex: 1; padding: 10px 8px; text-align: center;
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-4); border-right: 1px solid var(--border);
  transition: all 0.3s;
}
.upload-step:last-child { border-right: none; }
.upload-step.done    { background: var(--green-light); color: var(--green); }
.upload-step.active  { background: var(--accent-light); color: var(--accent); }
.upload-step-num { font-family: var(--serif); font-size: 18px; font-weight: 600; display: block; line-height: 1; margin-bottom: 2px; }
.upload-dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  background: var(--white); transition: all 0.15s;
}
.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent); background: var(--accent-light);
}
.upload-dropzone-icon { font-size: 32px; opacity: 0.3; margin-bottom: 12px; }
.upload-dropzone-text { font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.upload-dropzone-sub  { font-size: 11px; color: var(--text-3); }
.upload-file-chosen {
  background: var(--stone); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.upload-file-name { font-size: 13px; font-weight: 500; color: var(--text-1); flex: 1; }
.upload-file-size { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.upload-error {
  background: var(--red-light); border: 1px solid #f5c6c6;
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  font-size: 12px; color: var(--red); line-height: 1.5;
}
.upload-progress-label {
  font-size: 13px; color: var(--text-2); padding: 16px 0;
  display: flex; align-items: center; gap: 10px;
}
.upload-spinner {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.kpi-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.kpi-value { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; color: var(--text-1); }
.kpi-sub   { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 4px; }
.kpi-card.green .kpi-value { color: var(--green); }
.kpi-card.amber .kpi-value { color: var(--amber); }
.kpi-card.red   .kpi-value { color: var(--red);   }

/* P&L table */
.pl-table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.pl-table { width: 100%; border-collapse: collapse; }
.pl-table th {
  font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); padding: 9px 14px; text-align: left;
  background: var(--stone); border-bottom: 1px solid var(--border);
}
.pl-table th.right { text-align: right; }
.pl-table td { padding: 9px 14px; border-bottom: 1px solid var(--stone); vertical-align: middle; font-size: 12px; }
.pl-table tr:last-child td { border-bottom: none; }
.pl-table tr.pl-revenue td { background: var(--stone); font-weight: 600; }
.pl-table tr.pl-total td { background: var(--stone); font-weight: 600; border-top: 2px solid var(--border); }
.pl-table tr.pl-ebitda td { background: var(--accent-light); font-weight: 700; border-top: 2px solid var(--accent); }
.pl-table tr.pl-subtotal td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 2px solid var(--border); }
.pl-table tr.pl-section-header td { padding: 10px 14px 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); border-bottom: none; background: transparent; }
.pl-table tr.pl-below-line td { color: var(--text-3); }
.pl-row-name { color: var(--text-1); }
.pl-row-amt  { font-family: var(--mono); font-size: 12px; color: var(--text-1); text-align: right; }
.pl-row-pct  { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: right; }
.pl-row-bench { font-size: 10px; color: var(--text-4); text-align: right; white-space: nowrap; }

/* Benchmark status badges */
.bench-badge {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 2px; white-space: nowrap;
}
.bench-in-range { background: var(--green-light);  color: var(--green); }
.bench-high     { background: var(--amber-light); color: var(--amber); }
.bench-over     { background: var(--red-light);   color: var(--red);   }
.bench-low      { background: #e8f0ff; color: #3b52a5; }
.bench-under    { background: #e8f0ff; color: #3b52a5; }
.bench-na       { background: var(--stone); color: var(--text-4); }
.bench-addback  { background: var(--accent-light); color: var(--accent); }

/* EBITDA bridge */
.bridge-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.bridge-title {
  font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 16px; background: var(--stone);
  border-bottom: 1px solid var(--border);
}
.bridge-table { width: 100%; border-collapse: collapse; }
.bridge-table td { padding: 9px 16px; border-bottom: 1px solid var(--stone); font-size: 13px; vertical-align: middle; }
.bridge-table tr:last-child td { border-bottom: none; }
.bridge-label { color: var(--text-2); flex: 1; }
.bridge-amt   { font-family: var(--mono); font-size: 13px; font-weight: 500; text-align: right; }
.bridge-pct   { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: right; padding-left: 12px; white-space: nowrap; }
.bridge-add   { color: var(--green); font-weight: 600; }
.bridge-sub   { color: var(--red);   font-weight: 600; }
.bridge-result { background: var(--stone); font-weight: 700; border-top: 2px solid var(--border); }
.bridge-result td { padding-top: 11px; padding-bottom: 11px; }

/* EBITDA controls */
.ebitda-controls {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px;
  display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.ebitda-control { display: flex; flex-direction: column; gap: 4px; }
.ebitda-control-label { font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.ebitda-control-input {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; font-family: var(--mono); font-size: 14px;
  color: var(--text-1); background: var(--white); width: 120px; outline: none;
  transition: border-color 0.15s;
}
.ebitda-control-input:focus { border-color: var(--accent); }

/* Investment targets */
.inv-targets {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.inv-target {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 180px;
  box-shadow: var(--shadow-sm);
}
.inv-target-label { font-size: 11px; color: var(--text-2); flex: 1; }
.inv-target-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: 2px;
}
.inv-pass { background: var(--green-light); color: var(--green); }
.inv-fail { background: var(--red-light);   color: var(--red);   }
.inv-na   { background: var(--stone);       color: var(--text-4);}

/* Benchmark config panel */
.bench-config {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.bench-config-title {
  font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 14px;
}
.bench-config-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px 12px;
  align-items: center;
}
.bench-config-header {
  font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-4); padding-bottom: 4px; border-bottom: 1px solid var(--stone);
}
.bench-config-label { font-size: 12px; color: var(--text-1); }
.bench-config-input {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 8px; font-family: var(--mono); font-size: 12px;
  color: var(--text-1); background: var(--white); width: 100%;
  outline: none; transition: border-color 0.15s;
}
.bench-config-input:focus { border-color: var(--accent); }

/* Upload new doc button */
.btn-upload-new {
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--white); background: var(--accent);
  padding: 8px 18px; border-radius: var(--radius);
  border: none; transition: all 0.15s;
}
.btn-upload-new:hover { background: var(--accent-mid); }

/* Analysis tabs */
.analysis-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
}
.analysis-tab {
  font-size: 12px; font-weight: 500; padding: 7px 18px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--white); color: var(--text-3); transition: all 0.15s;
}
.analysis-tab.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
.analysis-tab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* Section headers in fin overlay */
.fin-section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.fin-section-title { font-family: var(--serif); font-size: 18px; font-style: italic; font-weight: 400; color: var(--text-1); }

/* Period selector in analysis */
.fin-doc-selector {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.fin-doc-selector-label { font-size: 11px; color: var(--text-3); font-weight: 500; }
.fin-doc-selector select {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; font-family: var(--sans); font-size: 13px;
  color: var(--text-1); background: var(--white); outline: none;
  transition: border-color 0.15s;
}
.fin-doc-selector select:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   AUTH OVERLAY & LOGIN
═══════════════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
}

.login-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; padding: 40px 44px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; gap: 0;
}

.login-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 32px;
}
.login-logo {
  height: 56px; width: 56px; border-radius: 10px; object-fit: cover;
}
.login-brand-name {
  font-family: var(--serif); font-size: 24px; font-weight: 600;
  color: var(--text-1); letter-spacing: 0.01em;
}
.login-brand-sub {
  font-size: 10px; font-weight: 400; color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.login-form {
  width: 100%; display: flex; flex-direction: column; gap: 10px;
}
.login-form .form-input {
  width: 100%;
}
.login-error {
  font-size: 12px; color: var(--red);
  background: var(--red-light); border: 1px solid #f5c6c6;
  border-radius: var(--radius); padding: 8px 12px; line-height: 1.4;
}
.btn-login {
  width: 100%; margin-top: 4px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--white); background: var(--accent);
  padding: 11px 0; border-radius: var(--radius);
  border: none; transition: all 0.15s;
}
.btn-login:hover:not(:disabled) { background: var(--accent-mid); }
.btn-login:disabled { opacity: 0.55; cursor: not-allowed; }

/* User email + sign-out in topbar */
.user-email {
  font-size: 11px; color: var(--text-3);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-signout {
  font-size: 11px; font-weight: 500; color: var(--text-3);
  padding: 5px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white);
  transition: all 0.15s;
}
.btn-signout:hover { color: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   DEAL CARDS (Deals tab)
═══════════════════════════════════════════════════════════════ */
.deal-list {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 0;
}
.deal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.deal-card:hover {
  border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.deal-card-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.deal-card-name {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  margin-right: 4px;
}
.deal-card-entities {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.deal-entity-row {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light, #f1f1f1);
  font-size: 12px;
}
.deal-entity-row:last-child { border-bottom: none; }
.deal-entity-name {
  font-weight: 600; color: var(--text-1); min-width: 140px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-entity-fig {
  font-family: var(--mono); font-size: 12px; color: var(--text-1);
  font-weight: 600; min-width: 50px;
}
.deal-entity-kpi {
  font-size: 11px; color: var(--text-2);
  white-space: nowrap;
}
.deal-entity-kpi strong { color: var(--text-1); font-family: var(--mono); }
.deal-entity-pct { color: var(--text-3); font-size: 10px; }
.deal-entity-period {
  font-size: 10px; color: var(--text-3); font-family: var(--mono);
  margin-left: auto; white-space: nowrap;
}
.deal-entity-empty {
  font-size: 11px; color: var(--text-4); font-style: italic; padding: 4px 0;
}
.deal-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-2);
}
.deal-footer-action {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-right: 12px;
}
.deal-footer-due {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  white-space: nowrap; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   ADJUSTMENT NOTES
═══════════════════════════════════════════════════════════════ */
.adj-notes-wrap {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.adj-notes-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--sans); font-size: 12px; color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 10px; background: var(--white); resize: vertical;
  line-height: 1.5; min-height: 52px;
}
.adj-notes-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light, rgba(99,102,241,0.12));
}
