
:root {
  --ink: #0D1117;
  --ink-soft: #171D26;
  --rail-bg: #1E3A8A;
  --paper: #F5F5F3;
  --surface: #FFFFFF;
  --border: #E4E3DD;
  --text: #14181D;
  --text-mute: #6B7280;
  --accent: #15803D;
  --accent-dark: #0F612E;
  --accent-bright: #4ADE80;
  --good: #15803D;
  --bad: #C23B3B;
  --rail-w: 232px;
  --shadow-sm: 0 1px 2px rgba(13, 17, 23, .04), 0 1px 1px rgba(13, 17, 23, .03);
  --shadow-md: 0 4px 16px rgba(13, 17, 23, .07), 0 1px 3px rgba(13, 17, 23, .05);
  --shadow-lg: 0 20px 50px rgba(13, 17, 23, .16), 0 2px 8px rgba(13, 17, 23, .06);
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-display);
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}

/* Numbers and data throughout the app use the mono face, per brand spec */
input[type="number"], .num, .value, .stat-value, table.grid td.num,
.totals .value, .rail-item-total, .doc-meta {
  font-family: var(--font-mono);
}

#app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- Rail ---------- */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--rail-bg);
  color: #C9CFD6;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: flex-basis .15s ease, width .15s ease;
}
.rail.collapsed {
  width: 44px;
  flex-basis: 44px;
}
.rail.collapsed .rail-nav,
.rail.collapsed .rail-footer,
.rail.collapsed .rail-credit,
.rail.collapsed .brand-mark,
.rail.collapsed .brand-text {
  display: none;
}
.rail-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #3A4658;
  background: #2A3444;
  color: #C9CFD6;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail-toggle:hover { background: #374252; color: #fff; }
.rail.collapsed .rail-toggle { right: 11px; top: 12px; }
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px 16px 16px;
  overflow: hidden;
  border-bottom: 1px solid #2E3948;
}
.brand-mark {
  width: 52px; height: 52px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { min-width: 0; }
.brand-title { font-weight: 600; font-size: 13px; color: #fff; }
.brand-version { font-weight: 400; font-size: 13px; color: rgba(255,255,255,.4); font-family: var(--font-mono); }
.brand-sub {
  font-size: 13px; color: #8992A0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.rail-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.rail-section-label {
  font-size: 13px;
  letter-spacing: .04em;
  color: #ffffff;
  padding: 14px 10px 6px;
}
/* Light left-menu variant (applied automatically when Admin picks a light color) */
.rail.rail-light { color: #000000; }
.rail.rail-light .rail-brand, .rail.rail-light .rail-footer { border-color: rgba(0,0,0,.14); }
.rail.rail-light .brand-title { color: #000000; }
.rail.rail-light .brand-version { color: rgba(0,0,0,.45); }
.rail.rail-light .brand-sub { color: #000000; }
.rail.rail-light .rail-section-label,
.rail.rail-light .rail-section-toggle { color: #000000; }
.rail.rail-light .rail-section-toggle:hover { color: var(--accent-dark); }
.rail.rail-light .rail-item { color: #000000; }
.rail.rail-light .rail-item:hover { background: rgba(0,0,0,.08); color: #000; }
.rail.rail-light .rail-item.active { background: var(--accent); color: #fff; }
.rail.rail-light .rail-item .rail-item-total { color: #000000; }
.rail.rail-light .rail-item.active .rail-item-total { color: #C9F5D9; }
.rail.rail-light .rail-add { border-color: rgba(0,0,0,.28); color: #000000; }
.rail.rail-light .rail-add:hover { color: #000; border-color: rgba(0,0,0,.5); }
.rail.rail-light .rail-credit { color: #000000; }
.rail.rail-light .rail-toggle { background: #fff; border-color: rgba(0,0,0,.25); color: #000000; }
.rail.rail-light .rail-toggle:hover { background: #F3F4F6; color: #000; }
.rail.rail-light .rail-item-askjoe { border: 1px solid rgba(0,0,0,.18); }

/* Collapsible section header (System Categories / Recurring Revenue) */
.rail-section-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 13px; letter-spacing: .04em;
  color: #ffffff;
  padding: 14px 10px 6px;
}
.rail-section-toggle:hover { color: var(--accent-bright); }
.rail-caret { display: inline-block; width: 10px; font-size: 13px; }
.rail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #C9CFD6;
  font-size: 13.2px;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background .12s ease, color .12s ease;
}
.rail-item:hover { background: #2A3444; color: #fff; }
.rail-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.rail-item .rail-item-total {
  font-size: 13px;
  color: #8992A0;
}
.rail-item.active .rail-item-total { color: #C9F5D9; }

/* Ask Joe: reversed (light bubble, dark text) so it stands out from the
   plain nav items around it, with a bang badge and an AI-coach caption
   so it's clear at a glance this isn't just another data page. */
.rail-item-askjoe {
  background: #F5F5F3;
  color: #000000;
  padding: 8px 12px;
  justify-content: flex-start;
  gap: 10px;
}
.rail-item-askjoe:hover { background: #FFFFFF; color: #000000; }
.rail-item-askjoe.active { background: var(--accent-bright); color: #0F2A1B; }
.askjoe-bang {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 800;
}
.askjoe-labels { display: flex; flex-direction: column; line-height: 1.25; }
.askjoe-title { font-weight: 700; font-size: 13.2px; }
.askjoe-caption { font-size: 13px; color: #000000; font-weight: 500; letter-spacing: .01em; }
.rail-item-askjoe.active .askjoe-caption { color: #0F2A1B; opacity: .75; }

.rail-add {
  width: 100%;
  padding: 7px 10px;
  margin-top: 4px;
  background: transparent;
  border: 1px dashed #3A4351;
  color: #8992A0;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
}
.rail-add:hover { color: #fff; border-color: #8992A0; }

.rail-footer {
  padding: 10px;
  border-top: 1px solid #2E3948;
  display: flex;
  gap: 6px;
  position: relative;
}
.rail-credit {
  text-align: center;
  font-size: 13px;
  color: #000000;
  padding: 8px 0 12px;
}
.rail-about { display:block; width:100%; background:none; border:0; cursor:pointer; text-align:center; font-size: 13px; color:#9AA4B2; padding:0 0 12px; text-decoration:underline; }
.rail-about:hover { color:#fff; }
.rail.rail-light .rail-about { color: #000000; }
.rail.rail-light .rail-about:hover { color: #000000; }
.rail.collapsed .rail-about { display:none; }
.rail-btn {
  padding: 9px 6px;
  background: #2A3444;
  border: 1px solid #3A4658;
  color: #C9CFD6;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.rail-btn:hover { background: #374252; color: #fff; }
.rail-btn-save { background: var(--accent); border-color: var(--accent); color: #fff; }
.rail-btn-save:hover { background: var(--accent-dark); }
.file-option-row {
  background: transparent;
  border: none;
  color: #000000;
  text-align: left;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease;
}
.file-option-row:hover { background: #F1EEE9; }

/* ---------- Content ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  height: 100%;
  background: linear-gradient(180deg, #FAFAF8 0%, var(--paper) 320px);
}
.view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 40px 80px;
}
.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.view-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.view-title input {
  font-size: 21px;
  font-weight: 700;
  border: none;
  background: transparent;
  border-bottom: 1px dashed transparent;
  padding: 0;
  font-family: inherit;
  color: var(--text);
}
.view-title input:hover, .view-title input:focus { border-bottom-color: var(--border); outline: none; }
.view-sub { color: var(--text-mute); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.card-head h3.expandable-row { user-select: none; }
.card-expand-icon {
  color: var(--text-mute);
  font-size: 15px;
}
.card-body { padding: 16px 18px; }
/* Every popup window in the app -- the right pane's click-to-open cards,
   Add Customer, Select Customer, Browse Catalog, Add Part, and the Super
   Admin screens -- reads as pure black, not the app's usual muted gray,
   since a small popup has less surrounding context to make a lighter
   gray easy to read. All seven modal-opening functions share this one
   .modal-overlay class specifically so this rule reaches every one of
   them, not just the right pane's. */
.modal-overlay,
.modal-overlay * {
  color: #000 !important;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.grid th {
  text-align: left;
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.grid td {
  padding: 6px 10px;
  border-bottom: 1px solid #F0EFEC;
  vertical-align: middle;
}
table.grid tr:last-child td { border-bottom: none; }
table.grid.table-noborder th, table.grid.table-noborder td { border-bottom: none; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid input, table.grid select {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
table.grid input:hover, table.grid select:hover { border-color: var(--border); }
table.grid input:focus, table.grid select:focus { border-color: var(--accent); outline: none; background: #fff; }
table.grid input.num { text-align: right; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 15px;
  padding: 3px 7px;
  border-radius: 4px;
  line-height: 1;
}
.icon-btn:hover { background: #F1EEE9; color: var(--bad); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.btn:hover { border-color: #C9C6BF; background: #FBFAF8; box-shadow: var(--shadow-md); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-ghost { border-color: transparent; box-shadow: none; border-radius: 8px; }
.btn-ghost:hover { box-shadow: none; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 4px;
  font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
  background: #fff;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21,128,61,.14); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.pct-input { display: flex; align-items: center; gap: 6px; }
.pct-input input { flex: 1; }
.pct-input span { color: var(--text-mute); font-size: 13px; }
.pct-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pct-cell input { width: 56px; }

.totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 24px;
  font-size: 13.5px;
  max-width: 340px;
  margin-left: auto;
}
.totals .label { color: var(--text-mute); }
.totals .value { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 16px; color: var(--accent-dark); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.totals .grand .label { color: var(--text); }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.summary-strip-5 {
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.summary-strip-5 .stat { padding: 12px 12px; }
.summary-strip-5 .stat-label { font-size: 13px; }
.summary-strip-5 .stat-value { font-size: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .stat-label { font-size: 13px; color: var(--text-mute); margin-bottom: 5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stat .stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat.accent .stat-value { color: var(--accent-dark); }
.stat.good .stat-value { color: var(--good); }

.pill {
  display: inline-block;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #F1EEE9;
  color: var(--text-mute);
  font-weight: 600;
}
/* Soft-tinted context badge for a card header -- e.g. the active date
   filter on a summary card -- background is a light tint of the accent
   color rather than a solid fill, text in the accent color itself. */
.pill-accent {
  display: inline-block;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  background: #E6F4ED;
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
/* Reusable pill-track progress bar: a label, a rounded track with a
   colored fill sized to a 0-1 ratio (set inline as --pct), and the
   percentage text -- for showing any real percentage the app already
   computes (never a fabricated trend). */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-track {
  flex: 1;
  height: 8px;
  background: #ECEBE6;
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--accent);
  width: calc(var(--pct, 0) * 1%);
}
.progress-pct { font-family: var(--font-mono); font-size: 13px; font-weight: 600; min-width: 42px; text-align: right; }
.pill.on { background: #E6F4ED; color: var(--good); }

.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox-row input { width: auto; }

.help {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 6px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 999;
}

/* proposal preview */
.proposal-doc {
  background: #fff;
  border: 1px solid var(--border);
  padding: 48px 56px;
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 820px;
  margin: 0 auto;
}
.proposal-doc h1 { font-size: 19px; letter-spacing: .01em; margin-bottom: 4px; line-height: 1.2; }
.proposal-doc .doc-meta { color: var(--text-mute); font-size: 13px; margin-bottom: 2px; line-height: 1.3; }
.proposal-doc table.grid { margin-bottom: 14px; }
.proposal-doc .doc-section-title {
  font-weight: 700; font-size: 13px; letter-spacing: .03em;
  border-bottom: 2px solid var(--ink); padding-bottom: 4px; margin: 24px 0 10px;
}

/* Colored section banners, checklists, and page breaks for the new
   multi-page proposal format. Banner color is dynamic (company's own
   accent color), set via inline style where rendered. */
.doc-banner {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  text-align: center;
  padding: 5px 10px;
  margin: 22px 0 12px;
  border-radius: 3px;
  line-height: 1.2;
}
.doc-page-break { page-break-before: always; break-before: page; }
.doc-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Cover page (proposal heading + prepared for/by) */
.doc-cover-body { text-align: center; padding: 70px 20px 40px; }
.doc-cover-heading { font-size: 30px; font-weight: 700; letter-spacing: .02em; margin-bottom: 46px; line-height: 1.25; }
.doc-cover-sub { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 4px; }
.doc-cover-name { font-size: 20px; font-weight: 700; color: var(--ink); }
.doc-cover-project { font-size: 14px; color: var(--text-mute); margin-top: 2px; }
.doc-cover-spacer { height: 44px; }
.doc-cover-photo { display: block; margin: 0 auto 30px; border-radius: 6px; object-fit: cover; }
.doc-cover-photo.size-small { max-width: 220px; max-height: 150px; }
.doc-cover-photo.size-medium { max-width: 380px; max-height: 240px; }
.doc-cover-photo.size-large { max-width: 560px; max-height: 340px; }
.doc-cover-meta { font-size: 13px; color: var(--text-mute); margin-top: 30px; }
.doc-check-list { list-style: none; padding: 0; margin: 0; }
.doc-check-list li { display: flex; gap: 8px; padding: 3px 0; align-items: flex-start; }
.doc-check-list .mark { flex: none; width: 16px; text-align: center; font-weight: 700; }
.mark.yes { color: var(--good); }
.mark.no { color: var(--bad); }
.doc-info-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; line-height: 1.3; }
.doc-info-grid .k { color: var(--text-mute); font-weight: 600; }
.doc-scope-content { font-size: 13.5px; line-height: 1.6; }
.doc-scope-content ul, .doc-scope-content ol { margin: 6px 0 6px 20px; padding: 0; }
.doc-team-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc-team-table td { vertical-align: top; padding: 6px 10px; text-align: center; font-size: 13px; border-top: 2px solid var(--ink); }
.doc-team-table .role { font-style: italic; color: var(--text-mute); border-top: none; padding-bottom: 2px; }

/* Pricing table -- exact format requested: no grid lines, underlined
   column headers, colored check/boxed-X marks (accent color, matching
   the banner), double rule above the total row. */
.pricing-table { width: 100%; margin-bottom: 14px; }
.pricing-row {
  display: grid; grid-template-columns: 30px 1fr 180px 180px;
  align-items: center; padding: 5px 0;
}
.pricing-row.pricing-header .pc-name, .pricing-row.pricing-header .pc-num {
  font-weight: 700; text-decoration: underline; font-size: 13px; text-align: center;
}
.pc-mark { text-align: center; font-weight: 700; font-size: 13px; }
.pc-box-x {
  display: inline-block; width: 15px; height: 15px; line-height: 13px;
  border: 1.5px solid; text-align: center; font-size: 13px; font-weight: 700;
}
.pc-name { font-weight: 600; }
.pricing-row.pricing-header .pc-name { text-align: left; padding-left: 4px; }
.pc-num { text-align: center; }
.pricing-row.pricing-total {
  border-top: 3px double var(--ink); margin-top: 4px; padding-top: 8px; font-weight: 700;
}

/* Sales Pipeline Kanban board */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kanban-col { flex: none; width: 240px; background: #F1EFEA; border-radius: 8px; padding: 10px; }
.kanban-col-head { padding: 2px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.kanban-col-title { font-weight: 700; font-size: 13px; }
.kanban-col-meta { font-size: 13px; color: var(--text-mute); margin-top: 2px; font-family: var(--font-mono); }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 8px; }
.kanban-card-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.kanban-card-cust { color: var(--text-mute); font-size: 13px; margin-bottom: 6px; }
.kanban-card-nums { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.kanban-card-stage { width: 100%; font-size: 13px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; }
.kanban-empty { color: var(--text-mute); font-size: 13px; font-style: italic; padding: 10px 4px; }

/* WYSIWYG editor (Scope of Work) */
.wysiwyg-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.wysiwyg-toolbar button {
  border: 1px solid var(--border); background: #fff; border-radius: 4px;
  width: 30px; height: 28px; font-size: 13px; cursor: pointer; color: var(--text);
}
.wysiwyg-toolbar button:hover { background: #F1EEE9; }
.wysiwyg-editor {
  border: 1px solid var(--border); border-radius: 5px; padding: 10px 12px;
  min-height: 140px; font-size: 13.5px; line-height: 1.55; background: #fff;
}
.wysiwyg-editor:focus { outline: none; border-color: var(--accent); }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 4px 0 4px 20px; padding: 0; }

@media print {
  /* The screen layout pins #app to the window height and scrolls .content
     inside it. Undo all of that for print, or only page 1 is output. */
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  #app { display: block !important; height: auto !important; overflow: visible !important; }
  .rail, .view-header .btn, #toast { display: none !important; }
  .content { display: block !important; overflow: visible !important; height: auto !important; background: #fff !important; }
  .view { max-width: none; padding: 0; overflow: visible !important; height: auto !important; }
  .proposal-doc { border: none; padding: 0; }
  tr, .card { page-break-inside: avoid; break-inside: avoid; }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
  font-size: 13px;
}

.editable-name {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  border-bottom: 1px dashed transparent;
}
.editable-name:hover, .editable-name:focus { border-bottom-color: var(--border); outline: none; }

.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13.5px;
}

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* Customer's own uploaded company logo -- shown top-left of every view
   and on the Proposal document, distinct from MyBusinessPartner.io's own app branding
   in the sidebar. */
.company-logo-strip {
  display: flex;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 40px 0;
}
.company-logo-strip img {
  max-height: 44px;
  max-width: 220px;
  object-fit: contain;
}
.logo-upload-preview {
  width: 100%;
  max-width: 280px;
  min-height: 70px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}
.logo-upload-preview img { max-height: 60px; max-width: 100%; object-fit: contain; }
.logo-upload-preview.empty { color: var(--text-mute); font-size: 13px; }

/* ---- Grant Finder ---- */
.grant-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.grant-item:last-child { border-bottom: 0; }
.grant-item > input[type=checkbox] { width: auto; margin-top: 3px; flex: none; }
.grant-main { flex: 1; min-width: 0; }
.grant-name { font-weight: 600; font-size: 13.5px; }
.grant-meta { font-size: 13px; color: var(--text-mute); margin-top: 2px; }
.grant-line { font-size: 13px; margin-top: 4px; line-height: 1.45; }
.grant-note { color: var(--text-mute); font-style: italic; }
.grant-detail { margin-top: 8px; padding: 8px 10px; background: var(--bg, #F6F7F9); border-radius: 8px; }
.grant-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }


/* =====================================================================
   v5.154 -- TOP MENU layout, search palette, light/dark theme
   ===================================================================== */
body.nav-top #rail { display: none; }
body.nav-side .topbar { display: none; }
body.nav-top #app { flex-direction: column; }
.app-body { flex: 1; display: flex; min-height: 0; min-width: 0; }
body.nav-top .app-body { flex-direction: column; }
.app-body > .content { height: auto; min-height: 0; flex: 1; }
body.nav-side #app { flex-direction: row; }
body.nav-side .app-body { flex: 1; }
/* classic layout: the rail sits beside .app-body, which is just a wrapper */
body.nav-side #app > .rail { order: -1; }

.topbar { background: var(--rail-bg); color: #fff; position: relative; z-index: 60; flex: 0 0 auto; box-shadow: 0 2px 10px rgba(13,17,23,.18); }
.tb-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; flex-wrap: wrap; }
.tb-brand { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.tb-brand img { width: 28px; height: 28px; }
.tb-name { font-weight: 800; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.topbar .brand-version { color: rgba(255,255,255,.6); font-size: 13px; }
.tb-nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; min-width: 0; }
.tb-item { position: relative; }
.tb-btn { background: none; border: 0; color: rgba(255,255,255,.88); font: inherit; font-size: 13.5px; font-weight: 500; padding: 9px 12px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tb-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.tb-btn.on { background: rgba(255,255,255,.2); color: #fff; font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent-bright); }
.tb-caret { font-size: 9px; opacity: .8; }
.tb-badge { background: var(--accent-bright); color: #052E16; border-radius: 999px; padding: 0 7px; font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.tb-tot { font-family: var(--font-mono); font-size: 13px; opacity: .8; }
.tb-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tb-search { display: flex; align-items: center; gap: 8px; min-width: 190px; background: rgba(255,255,255,.14); border: 0; color: rgba(255,255,255,.9); border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.tb-search:hover { background: rgba(255,255,255,.22); }
.tb-search kbd { margin-left: auto; font-family: inherit; font-size: 13px; border: 1px solid rgba(255,255,255,.4); border-radius: 5px; padding: 0 5px; }
.tb-icon, .tb-about { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 9px; height: 34px; min-width: 34px; padding: 0 10px; cursor: pointer; font: inherit; font-size: 15px; }
.tb-about { font-size: 13px; }
.tb-icon:hover, .tb-about:hover { background: rgba(255,255,255,.24); }
.tb-file { background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 9px; height: 34px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tb-file:hover { background: var(--accent-dark); }
.tb-sub { display: flex; justify-content: space-between; gap: 12px; padding: 0 18px 7px; font-size: 13px; color: rgba(255,255,255,.7); }
#tb-project { font-weight: 600; color: rgba(255,255,255,.92); }
.topbar.rail-light { color: #000000; }
.topbar.rail-light .tb-btn { color: #000000; }
.topbar.rail-light .tb-btn:hover { background: rgba(0,0,0,.08); }
.topbar.rail-light .tb-btn.on { background: rgba(0,0,0,.1); color: #000; }
.topbar.rail-light .tb-sub, .topbar.rail-light #tb-project, .topbar.rail-light .topbar .brand-version { color: #000000; }
.topbar.rail-light .tb-search, .topbar.rail-light .tb-icon, .topbar.rail-light .tb-about { background: rgba(0,0,0,.07); color: #000000; }
.topbar.rail-light .tb-search kbd { border-color: rgba(0,0,0,.3); }

/* dropdown + mega menus */
.tb-menu { position: absolute; left: 0; top: calc(100% + 6px); min-width: 260px; max-height: 70vh; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 200; }
.tb-menu.mega { position: fixed; left: 16px; right: 16px; top: auto; margin-top: 6px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 18px; max-height: 78vh; }
.tb-menu.right { left: auto; right: 0; }
.tb-mi { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13.5px; color: inherit; cursor: pointer; }
.tb-mi:hover { background: rgba(21,128,61,.1); }
.tb-mi.on { background: rgba(21,128,61,.14); font-weight: 700; }
.tb-mi small { font-family: var(--font-mono); color: var(--text-mute); font-size: 13px; }
.tb-mi.add { color: var(--accent); font-weight: 600; }
.tb-mh { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 800; padding: 4px 10px 6px; }
.tb-mnote { grid-column: 1 / -1; font-size: 13px; color: var(--text-mute); padding: 0 10px 4px; }
.tb-mi .lock { font-size: 13px; }

/* command palette (Ctrl+K) */
.pal-ov { position: fixed; inset: 0; background: rgba(13,17,23,.5); z-index: 400; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.pal { width: min(620px, 94vw); background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
.pal input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 16px 18px; font: inherit; font-size: 16px; background: transparent; color: inherit; outline: none; }
.pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.pal-row.sel { background: rgba(21,128,61,.14); }
.pal-row small { color: var(--text-mute); font-size: 13px; white-space: nowrap; }
.pal-empty { padding: 18px; color: var(--text-mute); font-size: 13px; }

/* ---------- Dark theme ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0B1325; --surface: #111C33; --border: #263759;
  --text: #E5EAF8; --text-mute: #9FB0CC; --ink: #E5EAF8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 16px rgba(0,0,0,.45); --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
}
html[data-theme="dark"] body { background: var(--paper); }
html[data-theme="dark"] .content { background: var(--paper); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0B1325; color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .btn:not(.btn-primary) { background: #1B2B4D; color: var(--text); border-color: #2F4373; }
html[data-theme="dark"] .btn:not(.btn-primary):hover { border-color: var(--accent-bright); }
html[data-theme="dark"] table th { background: #16233F; color: var(--text-mute); }
html[data-theme="dark"] table td { border-color: var(--border); }
html[data-theme="dark"] tr:hover td { background: rgba(255,255,255,.03); }
html[data-theme="dark"] .file-option-row:hover { background: #1B2B4D; }
html[data-theme="dark"] [style*="background:#fff"], html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#FFF"], html[data-theme="dark"] [style*="background:white"] { background: var(--surface) !important; color: var(--text); }
html[data-theme="dark"] [style*="background:#F"], html[data-theme="dark"] [style*="background: #F"] { background: #16233F !important; }
html[data-theme="dark"] .tb-menu, html[data-theme="dark"] .pal { background: #111C33; }
html[data-theme="dark"] a { color: var(--accent-bright); }
html[data-theme="dark"] .company-logo-strip img, html[data-theme="dark"] .logo-upload-preview img { background: #fff; border-radius: 6px; padding: 4px; }

@media print { .topbar { display: none !important; } .app-body { display: block !important; } }
@media (max-width: 1100px) { .tb-menu.mega { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tb-search-t { display: none; } .tb-search { min-width: 0; } }
html[data-theme="dark"] .proposal-doc { background: #fff; color: #000000; --text: #14181D; --text-mute: #6B7280; --surface: #fff; --border: #E4E3DD; }
html[data-theme="dark"] .proposal-doc input, html[data-theme="dark"] .proposal-doc textarea, html[data-theme="dark"] .proposal-doc select { background: #fff; color: #000000; }
.flash-card { animation: flashcard 1.5s ease; }
@keyframes flashcard { 0%,40% { box-shadow: 0 0 0 3px var(--accent-bright); } 100% { box-shadow: var(--shadow-sm); } }
/* compact sizing so the whole menu fits one row on laptop screens */
.tb-row { gap: 8px; padding: 7px 14px; }
.tb-btn { padding: 8px 9px; font-size: 13px; gap: 5px; }
.tb-nav { flex-wrap: nowrap; flex: 0 1 auto; }
.tb-right { flex: 1 1 auto; justify-content: flex-end; }
.tb-search { min-width: 150px; padding: 7px 10px; }
.tb-file { padding: 0 11px; }
.topbar .brand-version { display: none; }
.tb-tot { display: none; }
@media (min-width: 1560px) { .tb-btn { padding: 9px 12px; font-size: 13.5px; } .tb-tot { display: inline; } .tb-search { min-width: 210px; } }
@media (max-width: 1380px) { .tb-search-t, .tb-search kbd { display: none; } .tb-search { min-width: 0; } .tb-name { display: none; } .tb-about { display: none; } }
@media (max-width: 1180px) { .tb-nav { flex-wrap: wrap; } .tb-row { flex-wrap: wrap; } }

/* =====================================================================
   v5.154 guided workflow: stepper, system chips, add-from-catalog, total bar
   ===================================================================== */
.flowhead[hidden], .flowbar[hidden] { display: none !important; }
.tb-project { font-size: 13px; color: rgba(255,255,255,.85); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.rail-light .tb-project { color: #000000; }
.tb-credit { font-size: 13px; color: rgba(255,255,255,.75); margin-left: 4px; white-space: nowrap; }
.topbar.rail-light .tb-credit { color: #000000; }
.flowhead { flex: 0 0 auto; background: var(--surface); border-bottom: 1px solid var(--border); }
.stepper { display: flex; gap: 0; }
.st { flex: 1 1 0; display: flex; align-items: center; gap: 11px; padding: 11px 16px; background: none; border: 0; border-bottom: 3px solid transparent; font: inherit; color: var(--text); cursor: pointer; text-align: left; min-width: 0; }
.st:hover { background: rgba(21,128,61,.06); }
.st.on { background: rgba(21,128,61,.1); border-bottom-color: var(--accent); }
.st-n { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--text-mute); color: var(--text-mute); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.st.on .st-n { border-color: var(--accent); color: var(--accent); }
.st.done .st-n { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-t { display: flex; flex-direction: column; min-width: 0; }
.st-t b { font-size: 13.5px; font-weight: 700; }
.st-t small { font-size: 13px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chiprow { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; background: var(--paper); }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.chip b { font-size: 13px; letter-spacing: .02em; text-transform: uppercase; }
.chip small { font-size: 13px; color: var(--text-mute); font-family: var(--font-mono); }
.chip:hover { border-color: var(--accent); }
.chip.on { background: #14295E; border-color: #14295E; color: #fff; }
.chip.on small { color: rgba(255,255,255,.8); }
.chip.add { border-style: dashed; color: var(--accent); font-weight: 600; font-size: 13px; justify-content: center; }
.flowbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 22px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -3px 12px rgba(13,17,23,.06); }
.fl-tot { display: flex; gap: 26px; font-size: 13px; color: var(--text-mute); }
.fl-tot b { font-family: var(--font-mono); color: var(--text); font-size: 16px; margin-left: 4px; }
.fl-btns { display: flex; gap: 10px; }
.fl-btns .btn[disabled] { opacity: .45; cursor: default; }

.cat-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 16px; flex-wrap: wrap; }
.cat-tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 500; color: var(--text-mute); cursor: pointer; margin-bottom: -1px; }
.cat-tabs button:hover { color: var(--text); }
.cat-tabs button.on { color: var(--text); font-weight: 700; border-bottom-color: #14295E; }
html[data-theme="dark"] .cat-tabs button.on { border-bottom-color: var(--accent-bright); }
.cat-n { background: var(--border); border-radius: 999px; font-size: 13px; padding: 0 7px; margin-left: 3px; color: var(--text); }
.cat-split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cat-split { grid-template-columns: 1fr; } }
.qa-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.qa-t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.qa-t b { font-size: 13px; }
.qa-t span { color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-p { font-family: var(--font-mono); font-size: 13px; color: var(--text-mute); }
.two-col.lens-customer { grid-template-columns: minmax(0, 860px); }
.two-col.lens-customer > .proposal-doc { display: none; }
.two-col.lens-customer > div { grid-column: 1; }
@media (max-width: 1050px) { .st-t small { display: none; } .st { padding: 10px 8px; } }
@media print { .flowhead, .flowbar { display: none !important; } }

/* ===== v5.158: mode switch, sub-bar, CRM ===== */
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; }
body.nav-side .subbar { display: none; }
.tb-brand b { font-size: 15px; white-space: nowrap; }
.mode-switch { display: flex; background: rgba(0,0,0,.28); border-radius: 11px; padding: 3px; flex: 0 0 auto; }
.mode-switch button { background: none; border: 0; color: rgba(255,255,255,.8); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.mode-switch button.on { background: #fff; color: #000000; }
.tb-ico { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 9px; height: 32px; padding: 0 11px; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.tb-ico:hover { background: rgba(255,255,255,.24); }
.tb-project { font-size: 13px; opacity: .75; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-bottom: 1px solid var(--border, #E5E7EB); padding: 6px 16px; flex: 0 0 auto; overflow-x: auto; }
.subbar[hidden] { display: none; }
.sb-left { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.sb-btn { background: none; border: 0; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: #000000; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.sb-btn:hover { background: #F3F4F6; }
.sb-btn.on { background: #E8F5EE; color: #0B5D3B; font-weight: 700; }
.sb-btn small { font-family: var(--font-mono, monospace); font-size: 13px; opacity: .7; }
.sb-add { color: var(--accent, #16A34A); }
.sb-right { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #000000; white-space: nowrap; }
.sb-tot b { font-family: var(--font-mono, monospace); color: #000000; }
.sb-as select { margin-left: 6px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.stat { flex: 1 1 150px; background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 12px; padding: 12px 14px; }
.stat-l { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #000000; }
.stat-v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.stat-s { font-size: 13px; color: #000000; margin-top: 2px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .two-up { grid-template-columns: 1fr; } }
.quick-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.quick-form .field { flex: 1 1 150px; min-width: 130px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { min-width: 240px; }
.stage-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: #fff; border: 1px solid var(--border, #E5E7EB); border-radius: 10px; padding: 7px 12px; cursor: pointer; font: inherit; text-align: left; display: flex; flex-direction: column; }
.chip.on { border-color: var(--accent, #16A34A); background: #E8F5EE; }
.chip small { color: #000000; }
.crm-grid th, .crm-grid td { white-space: nowrap; padding: 5px 7px; }
.crm-grid input, .crm-grid select { padding: 5px 7px; border: 1px solid var(--border, #E5E7EB); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.crm-grid td.num input { text-align: right; }
.crm-grid td.calc { font-family: var(--font-mono, monospace); font-size: 13px; }
.rowbtns { display: inline-flex; gap: 4px; margin-right: 4px; }
.pbar { height: 10px; background: #E5E7EB; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; }
.pbar div { height: 100%; background: var(--accent, #16A34A); }
.link-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border, #E5E7EB); }
.link-row .lk-name small { display: block; color: #000000; font-size: 13px; }
.link-row .lk-status { grid-column: 2 / 4; margin: 0; }
.lk-btns { display: flex; gap: 4px; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.list-grid textarea { width: 100%; }
.report-head { margin-bottom: 12px; }
.report-co { font-weight: 800; font-size: 18px; }
.report-title { font-size: 15px; }
.report-meta { color: #000000; font-size: 13px; }
.report-tbl tr.total-row td { font-weight: 800; border-top: 2px solid #111827; }
@media print {
  .topbar, .subbar, .rail, .no-print, .toast { display: none !important; }
  body, #app, .app-body, .content { display: block !important; overflow: visible !important; height: auto !important; }
  .card { break-inside: avoid; box-shadow: none !important; }
  .crm-grid input, .crm-grid select { border: 0; }
  @page { size: landscape; margin: 12mm; }
}

.view.wide { max-width: none; }
.filters select, .filters input, .quick-form select, .quick-form input, .view-header select, .sb-as select, .link-row input { padding: 7px 9px; border: 1px solid var(--border, #D1D5DB); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; }
.link-row .lk-url { width: 100%; }

.tb-brand img { width: 34px; height: 34px; border-radius: 8px; }
.tb-left { display: flex; gap: 6px; align-items: center; margin-left: 6px; }
.tb-nav { justify-content: center; gap: 22px; margin: 0 24px; }
.tb-nav .tb-btn { padding: 9px 16px; }
.mode-switch { background: #fff; border: 2px solid #fff; padding: 0; overflow: hidden; border-radius: 11px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.mode-switch button { background: #fff; color: #000000; padding: 7px 14px; border-radius: 0; }
.mode-switch button.on { background: var(--accent); color: #fff; }
.topbar.rail-light .mode-switch { border-color: #14181D; }

.topbar { gap: 8px; }
.tb-brand, .tb-left, .tb-right { flex: 0 0 auto; }
.tb-nav { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; gap: clamp(2px, 1.6vw, 22px); margin: 0 clamp(4px, 1.2vw, 24px); }
.tb-nav .tb-btn { padding: 9px clamp(6px, .9vw, 16px); font-size: clamp(12px, .95vw, 13.5px); }
.sb-proj { font-weight: 700; color: #000000; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1250px) { #tb-layout { display: none; } }
.tb-nav { gap: clamp(0px, .6vw, 14px); margin: 0 clamp(2px, .6vw, 16px); justify-content: space-evenly; }
.tb-nav .tb-btn { padding: 9px clamp(5px, .7vw, 14px); }
.tb-left .tb-ico { padding: 0 clamp(8px, .8vw, 11px); }

.demo-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #FEF3C7; border: 1px solid #F59E0B; color: #78350F; padding: 9px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }

/* ===== v5.158 usability pass: plain fonts, true black text, bold theme headings, fewer notes ===== */
:root { --text: #000000; --text-mute: #000000; --heading: #1E3A8A; --font-mono: 'Segoe UI', 'Inter', Arial, sans-serif; --font-display: 'Segoe UI', 'Inter', Arial, sans-serif; }
body { font-size: 15px; letter-spacing: 0; color: #000; font-family: var(--font-display); }
input[type="number"], .num, .value, .stat-value, table.grid td.num, .totals .value, .rail-item-total, .doc-meta, .calc, .sb-tot b, .tb-tot { font-family: var(--font-display) !important; letter-spacing: 0; }
#view-root, #view-root label, #view-root td, #view-root th, #view-root p, #view-root span, #view-root div, #view-root small, #view-root li,
#view-root input, #view-root select, #view-root textarea, #view-root .help, #view-root .stat-s, #view-root .stat-l, #view-root .view-sub { color: #000; }
#view-root .btn-primary, #view-root .btn-primary * , #view-root .pill, #view-root .tb-badge { color: #fff; }
#view-root .btn-primary { background: var(--accent); }
input::placeholder, textarea::placeholder { color: #444; }
/* headings: bold, in the theme color */
.view-title { font-size: 27px; font-weight: 800; color: var(--heading) !important; letter-spacing: 0; }
.card-head h3, .report-co, .report-title { font-size: 17px; font-weight: 800; color: var(--heading) !important; letter-spacing: 0; }
table.grid th, .crm-grid th, .stat-label, .stat-l { color: var(--heading) !important; font-weight: 800; text-transform: none !important; letter-spacing: 0 !important; font-size: 13.5px !important; }
.field label, label { font-weight: 700; font-size: 14px; }
.stat-v, .stat .stat-value { font-size: 24px; font-weight: 800; }
.stat-s { font-size: 13.5px; }
/* nothing smaller than 13px */
.help, .view-sub, .sb-btn small, .rail-item-total, .pill, .tb-badge, small, .stat-s, .lk-name small, .chip small { font-size: 13.5px; }
.crm-grid input, .crm-grid select, .crm-grid td { font-size: 14px; }
.sb-btn { font-size: 14.5px; font-weight: 600; color: #000; }
.sb-btn.on { color: var(--heading); font-weight: 800; }
.tb-btn { font-size: 14.5px; font-weight: 600; }
.tb-ico { font-size: 14px; }
.mode-switch button { font-size: 14px; font-weight: 700; }
.sb-right, .sb-proj, .sb-tot b { color: #000; }
.sb-as { font-size: 14px; }
.more-bar { padding: 10px 14px 0; text-align: right; }
/* notes: hidden unless Tips is on */
body:not(.show-tips) .view-sub,
body:not(.show-tips) .card-body > .help:first-child:not(.keep),
body:not(.show-tips) .report-meta + .help { display: none; }
body.show-tips .help, body.show-tips .view-sub { display: block; }
.demo-banner { color: #000; font-size: 14.5px; }

.insp-view { max-width: none; }
.insp-top { display: grid; grid-template-columns: 1fr 1.4fr 1.6fr 140px 1fr; gap: 14px; margin-bottom: 14px; }
.insp-top .field { margin: 0; }
.insp-top select, .insp-top input { width: 100%; }
.insp-grid { width: 100%; }
.insp-grid td, .insp-grid th { padding: 7px 12px; }
.insp-grid input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 14.5px; }
.insp-grid td.num input { width: 100px; text-align: right; }
.insp-grid .c-name { width: 70%; min-width: 220px; }
.insp-total td { font-weight: 800; border-top: 2px solid #000; font-size: 15.5px; }
.insp-sub td { border-top: 1px solid var(--border); }
.insp-price { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.insp-price input { width: 130px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.insp-out { display: flex; flex-direction: column; }
.insp-out span { font-weight: 700; font-size: 13.5px; }
.insp-out b { font-size: 20px; font-weight: 800; color: var(--heading); }
@media (max-width: 1200px) { .insp-top { grid-template-columns: 1fr 1fr; } }

.insp-group td { background: #EEF2FA; color: var(--heading); font-weight: 800; padding: 6px 12px !important; }
.insp-extras { margin: 14px 0; } .insp-extras h4 { margin: 0 0 6px; color: var(--heading); }
.insp-extra { display: flex; gap: 12px; align-items: center; justify-content: space-between; max-width: 560px; padding: 4px 0; }
.insp-extra input { width: 90px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.insp-calc { display: grid; grid-template-columns: 200px 200px 1fr; gap: 14px; margin: 16px 0; }
.insp-calc input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.insp-sum { width: 100%; max-width: 820px; border-collapse: collapse; }
.insp-sum td { padding: 6px 12px; border-bottom: 1px solid var(--border); }
.insp-sum td.num { text-align: right; font-weight: 700; }
.insp-sum .i-rate { width: 120px; text-align: right; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-weight: 700; }
.insp-top { grid-template-columns: 1.4fr 120px 1.2fr 1.2fr; }

.insp-grid input.fl, .insp-grid input.q { width: 64px; text-align: right; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.insp-grid input.q[readonly] { border-color: transparent; background: transparent; font-weight: 700; }
.insp-floors td { background: #F4F6FB; font-weight: 700; }

.coll-head { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 10px; }
.coll-head .chev { color: var(--heading); font-size: 18px; width: 18px; }
.coll-head h3 { flex: 1; }
.card.collapsed > .card-body { display: none; }
.card.collapsed > .card-head { border-bottom: none; }
.admin-collbar { margin: 0 0 12px; display: flex; gap: 8px; }

.crm-link { color: var(--heading); font-weight: 700; text-decoration: none; border-bottom: 1px dotted var(--heading); }
.crm-link:hover { text-decoration: underline; }

.find-box { width: 100%; font-size: 17px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; font-family: inherit; color: #000; }
.find-box:focus { outline: none; border-color: var(--accent); }

.cov-pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; background: #E5E7EB; color: #000; }
.cov-good { background: #BBF7D0; } .cov-warn { background: #FDE68A; } .cov-bad { background: #FECACA; }

.cov-great { background: #BFDBFE; }

/* ===== v5.175 Projects ===== */
.pm-badge { display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:700; background:#E5E7EB; color:#111; margin-right:4px; white-space:nowrap; }
.pm-badge.ok { background:#DCFCE7; color:#14532D; }
.pm-badge.bad { background:#FEE2E2; color:#7F1D1D; }
.pm-tabs { display:flex; gap:6px; margin:4px 0 10px; }
.pm-tabs button { border:1px solid var(--border); background:#fff; border-radius:999px; padding:6px 14px; font-weight:700; cursor:pointer; color:#111; }
.pm-tabs button.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.pm-meter { height:10px; background:#E5E7EB; border-radius:6px; overflow:hidden; }
.pm-meter span { display:block; height:100%; background:var(--accent); }
.pm-table-wrap { overflow-x:auto; }
table.pm-grid td { vertical-align:middle; }
table.pm-grid input:not([type=checkbox]), table.pm-grid select, table.pm-grid textarea { width:100%; }
.pm-gantt { font-size:13px; }
.pm-g-axis { position:relative; height:20px; margin-left:200px; border-bottom:1px solid var(--border); margin-bottom:6px; }
.pm-g-axis span { position:absolute; font-size:11px; color:#111; transform:translateX(-2px); }
.pm-g-row { display:flex; align-items:center; height:26px; }
.pm-g-label { width:200px; flex:none; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; padding-right:8px; color:#111; }
.pm-g-track { position:relative; flex:1; height:16px; background:repeating-linear-gradient(90deg,#F3F4F6 0 1px,transparent 1px 40px); }
.pm-g-bar { position:absolute; top:0; height:16px; border-radius:4px; }
#mode-switch[hidden], #mode-switch button[hidden] { display:none !important; }

/* v5.176: CRM -> Proposal -> Projects as separate buttons; the active one turns green */
.mode-switch, .topbar.rail-light .mode-switch { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; gap: 8px; overflow: visible; border-radius: 0; }
.mode-switch button { background: #fff !important; color: #000 !important; border: 2px solid #fff !important; border-radius: 10px !important; padding: 7px 18px !important; font-size: 14px; font-weight: 700; transition: background .15s, color .15s; }
.mode-switch button:hover:not(.on) { background: #E8EEF9 !important; }
.mode-switch button.on { background: var(--accent) !important; color: #fff !important; border-color: #fff !important; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }

/* v5.177 top bar: Home + File left, CRM / Proposals / Projects centered, Admin + Help small at right; section menus centered beneath */
#topbar { display: grid !important; grid-template-columns: 1fr auto 1fr; grid-template-areas: "left center right" "nav nav nav"; align-items: center; column-gap: 12px; row-gap: 4px; padding: 8px 16px 4px; }
@media (min-width: 761px) { #topbar .tb-brand, #topbar .m-burger { display: none !important; } }
#topbar .tb-left { grid-area: left; justify-self: start; margin-left: 0; }
#topbar .tb-center { grid-area: center; justify-self: center; display: flex; }
#topbar .tb-right { grid-area: right; justify-self: end; margin-left: 0; gap: 6px; }
#topbar .tb-nav { grid-area: nav; justify-content: center; flex-wrap: wrap; gap: 4px; border-top: 1px solid rgba(255,255,255,.14); padding-top: 4px; }
#topbar .tb-nav:empty { display: none; }
#topbar .tb-sm { height: 28px; padding: 0 10px; font-size: 12.5px; opacity: .92; }
#topbar .tb-sm.on { background: rgba(255,255,255,.3); opacity: 1; font-weight: 700; }
#topbar .tb-sm[hidden], #topbar .mode-switch button[hidden] { display: none; }
.mode-switch button { font-size: 15px; padding: 8px 22px !important; }
.tb-dd { position: relative; }
.tb-file-menu { min-width: 230px; left: 0; max-height: none; overflow: visible; }
.tb-file-menu[hidden] { display: none; }
.tb-file-menu .tb-mi { color: #000; }
.tb-msep { border-top: 1px solid var(--border, #E5E7EB); margin: 6px 4px; }
.tb-who { font-size: 12.5px; color: #333; padding: 2px 10px 6px; line-height: 1.4; }
.tb-who[hidden] { display: none; }
.tb-logout { color: var(--bad, #B91C1C) !important; font-weight: 700; }
.topbar.rail-light #topbar .tb-nav, .topbar.rail-light .tb-nav { border-top-color: rgba(0,0,0,.12); }
@media (max-width: 760px) { #topbar { display: flex !important; } #topbar .tb-center { margin-left: auto; } #topbar .tb-right, #topbar .tb-nav { display: none !important; } }

/* v5.178: whole app shown 20% smaller on computer screens (phones keep their own layout) */
@media screen and (min-width: 761px) {
  html { zoom: 0.8; }
  #app { height: calc(100vh / 0.8); }
}

/* ===================== CRM v5.180 ===================== */
.c2-hright { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.c2-flush { padding: 0 !important; overflow-x: auto; }
.c2-mute { color: #4B5563; font-size: 13px; }
.c2-dim td { opacity: .62; }
.c2-badtext { color: var(--bad); font-weight: 700; }
#view-root .pill, .c2-modal .pill { background: #E5E7EB; color: #111827; }
#view-root .pill.on { background: #E6F4ED; color: var(--good); }
#view-root .pill.c2-bad, .c2-modal .pill.c2-bad { background: #FEE2E2; color: #991B1B; }
#view-root .pill.c2-warn, .c2-modal .pill.c2-warn { background: #FEF3C7; color: #92400E; }
#view-root .pill.c2-good, .c2-modal .pill.c2-good { background: #DCFCE7; color: #14532D; }
#view-root .pill.c2-new, .c2-modal .pill.c2-new { background: #DBEAFE; color: #1E3A8A; }
#view-root .pill.ro-pill, .c2-modal .pill.ro-pill { background: #F3F4F6; color: #374151; }
.c2-findrow { margin-bottom: 12px; }
.c2-findrow .find-box { width: 100%; }
.c2-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #F59E0B; }
.c2-dot.k3 { background: var(--bad); } .c2-dot.k1 { background: #3B82F6; }
.c2-ov { position: fixed; inset: 0; background: rgba(13,17,23,.45); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.c2-modal { background: #fff; border-radius: 14px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.c2-mh { padding: 14px 20px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 16px; color: var(--rail-bg); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.c2-mb { padding: 16px 20px; overflow-y: auto; }
.c2-mf { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.c2-mb .field { margin-bottom: 10px; }
.c2-sub { margin: 12px 0 8px; display: flex; gap: 8px; align-items: center; color: var(--rail-bg); }
.c2-lead { margin: 0 0 12px; color: #000; line-height: 1.5; }
.c2-check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 8px 0; cursor: pointer; }
.c2-radio { display: flex; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; flex-wrap: wrap; }
.c2-chiprow { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.c2-banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.c2-banner.good { background: #ECFDF3; border: 1px solid #A7F3D0; }
.c2-banner.warn { background: #FFFBEB; border: 1px solid #FCD34D; }
.btn.btn-danger { color: #991B1B; border-color: #FCA5A5; background: #fff; }
.btn.btn-danger:hover { background: #FEF2F2; }
.c2-code { width: 100%; font-family: var(--font-mono); font-size: 12px; line-height: 1.4; background: #F9FAFB; }
.c2-preview iframe { width: 100%; height: 380px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.c2-fields td, .c2-fields th { padding: 5px 10px; }
.c2-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.c2-seg button { border: 0; background: #fff; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; color: #000; }
.c2-seg button.on { background: var(--rail-bg); color: #fff; }
.c2-addlink { font-size: 13px; color: var(--accent); font-weight: 600; text-decoration: none; }
.c2-addlink:hover { text-decoration: underline; }
tr.ro-row input:disabled, tr.ro-row select:disabled { background: transparent; border-color: transparent; color: #000; opacity: 1; }
/* record pages */
.c2-rec-head { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; margin-bottom: 14px; }
.c2-crumb { font-size: 13px; margin-bottom: 4px; }
.c2-crumb a { color: var(--rail-bg); font-weight: 600; }
.c2-rec-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.c2-rec-title .view-title { margin: 0; }
.c2-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.c2-highlights span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #374151; }
.c2-highlights b { font-size: 16px; }
.c2-highlights small { margin-left: 6px; color: #92400E; font-weight: 600; }
.c2-rec-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.c2-col-main, .c2-col-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.c2-col-main .card, .c2-col-side .card { margin: 0; }
.c2-details { display: grid; grid-template-columns: 1fr; gap: 2px 12px; padding: 12px 16px; }
.c2-details.two { grid-template-columns: 1fr 1fr; }
.c2-details .field.wide { grid-column: 1 / -1; }
.c2-details .field { margin-bottom: 6px; }
.c2-timeline { padding: 6px 16px 12px; }
.c2-tl { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid #F0EFEA; font-size: 14px; }
.c2-tl:last-child { border-bottom: 0; }
.c2-tl-d { color: #374151; font-size: 13px; font-family: var(--font-mono); }
.c2-tl.up { background: #F0F7FF; margin: 0 -16px; padding: 9px 16px; }
.c2-timeline.small .c2-tl { grid-template-columns: 96px 1fr; font-size: 13px; }
.c2-addrole { display: flex; gap: 6px; padding: 10px 16px; flex-wrap: wrap; }
/* stage path (v5.203): progress tracker - numbered circles on a line */
.c2-pathcard { padding: 18px 16px 14px; margin-bottom: 14px; }
.c2-path { display: flex; align-items: flex-start; overflow-x: auto; counter-reset: c2st; padding-bottom: 2px; }
.c2-step { position: relative; flex: 1 1 0; min-width: 92px; border: 0; background: none; color: #000; padding: 40px 6px 2px; font: inherit; font-size: 14px; font-weight: 700; line-height: 1.25; text-align: center; cursor: pointer; counter-increment: c2st; }
.c2-step::before { content: counter(c2st); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; box-sizing: border-box; border: 2px solid #CBD5E1; background: #fff; color: #475569; font-size: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; z-index: 2; transition: transform .15s ease; }
.c2-step::after { content: ""; position: absolute; top: 14px; left: calc(50% + 15px); width: calc(100% - 30px); height: 3px; background: #E2E8F0; z-index: 1; }
.c2-step:last-child::after { display: none; }
.c2-step small { display: block; font-weight: 600; color: #475569; margin-top: 2px; }
.c2-step.done::before { content: "\2713"; background: #15803D; border-color: #15803D; color: #fff; }
.c2-step.done::after { background: #15803D; }
.c2-step.cur::before { background: var(--rail-bg); border-color: var(--rail-bg); color: #fff; box-shadow: 0 0 0 5px rgba(30, 58, 138, .18); }
.c2-step.cur { color: var(--rail-bg); }
.c2-step.pick::before { background: #fff; border: 2px dashed var(--accent); color: var(--accent); transform: translateX(-50%) scale(1.12); }
.c2-step.pick { color: var(--accent); }
.c2-step.close::before { content: "\2691"; }
.c2-step.close.cur.won::before { content: "\2713"; background: var(--accent); border-color: var(--accent); }
.c2-step.close.cur.lost::before { content: "\2715"; background: #6B7280; border-color: #6B7280; box-shadow: none; }
.c2-step.close.cur.lost { color: #4B5563; }
.c2-step:disabled { cursor: default; }
.c2-step:not(:disabled):hover::before { transform: translateX(-50%) scale(1.12); }
.c2-path-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.c2-tip { color: #000; font-size: 14px; }
/* pipeline board */
.c2-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.c2-col { background: #ECEBE6; border-radius: 12px; padding: 8px; min-height: 240px; border: 2px solid transparent; }
.c2-col.over { border-color: var(--accent); background: #E6F4ED; }
.c2-col.won { background: #E6F4ED; }
.c2-colh { display: flex; flex-direction: column; padding: 4px 6px 8px; }
.c2-colh b { color: var(--rail-bg); }
.c2-colh span { font-size: 13px; font-family: var(--font-mono); }
.c2-cards { display: flex; flex-direction: column; gap: 8px; }
.c2-kcard { background: #fff; border-radius: 10px; padding: 10px 11px; border: 1px solid var(--border); cursor: pointer; box-shadow: var(--shadow-sm); font-size: 14px; }
.c2-kcard:hover { border-color: var(--rail-bg); }
.c2-kcard.drag { opacity: .45; }
.c2-kcard.locked { cursor: pointer; }
.c2-kc-cust { font-weight: 700; color: var(--rail-bg); }
.c2-kc-job { margin: 2px 0 6px; }
.c2-kc-row { display: flex; justify-content: space-between; gap: 8px; }
.c2-kc-next { margin-top: 6px; font-size: 13px; color: #14532D; }
.c2-kc-next.none { color: #92400E; }
@media (max-width: 1000px) { .c2-rec-grid { grid-template-columns: 1fr; } .c2-details.two { grid-template-columns: 1fr; } }
.stage-chips .chip.on, .stage-chips .chip.on small { color: #000; }
.stage-chips .chip.on b { color: #14532D; }
.c2-step small { color: inherit !important; }

/* ---------- v5.181 Email Campaigns ---------- */
.em-grid { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(380px, 7fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .em-grid { grid-template-columns: 1fr; } }
.em-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.em-tag { background: #E6F4ED; color: #14532D; border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.em-tag button { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: #14532D; padding: 0 2px; }
.em-count { background: #F4F5F7; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 4px 0 6px; line-height: 1.5; }
.em-big { font-size: 18px; color: var(--accent); }
.em-list { max-height: 440px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.em-list .grid th { position: sticky; top: 0; background: #fff; z-index: 1; }
.em-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: #F4F5F7; }
.em-toolbar button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 14px; }
.em-toolbar button:hover { border-color: var(--accent); }
.em-toolbar select { width: auto; padding: 4px 8px; font-size: 14px; }
.em-editor { min-height: 300px; max-height: 560px; overflow: auto; border: 1px solid var(--border); border-radius: 0 0 10px 10px; padding: 14px 16px; background: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.6; color: #14181D; outline: none; }
.em-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21,128,61,.14); }
.em-editor h2, .em-preview h2 { font-size: 20px; margin: 10px 0 6px; }
.em-preview { border: 1px solid var(--border); border-radius: 10px; padding: 18px 22px; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.6; color: #14181D; background: #fff; max-height: 460px; overflow: auto; }
.em-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: #6B7280; }
.em-steps { margin: 0 0 14px 18px; line-height: 1.7; }

/* ---------- v5.182 Back Office ---------- */
.pill.bo-warn { background: #FEF3C7; color: #92400E; } .pill.bo-bad { background: #FEE2E2; color: #991B1B; }
.pill.bo-info { background: #DBEAFE; color: #1E3A8A; } .pill.bo-good { background: #DCFCE7; color: #166534; }
.bo-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; background: #F4F5F7; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.bo-sum span { display: block; font-size: 12px; color: #4B5563; } .bo-sum b { font-size: 15px; }
.bo-hist { border-left: 3px solid var(--border); padding-left: 12px; display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.bo-docs { display: grid; gap: 8px; } .bo-docs .grid td { padding: 5px 8px; }
.bo-docs .bo-upload { justify-self: start; cursor: pointer; } .bo-docs .bo-kind { width: auto; max-width: 220px; }
.bo-docs:has(.bo-upload) { grid-template-columns: 1fr; }
.bo-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 800px) { .bo-two { grid-template-columns: 1fr; } }
.bo-letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bo-letters > div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
/* ---------- v5.184 Service ---------- */
.svc-lines input { padding: 5px 8px; }
.dp-wrap { display: grid; grid-template-columns: 230px 1fr; gap: 12px; align-items: start; }
@media (max-width: 900px) { .dp-wrap { grid-template-columns: 1fr; } }
.dp-side { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; position: sticky; top: 8px; }
.dp-grid { display: grid; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
.dp-h { font-weight: 800; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--border); background: #F4F5F7; }
.dp-tech { font-weight: 700; padding: 8px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); background: #FAFAF9; }
.dp-cell { min-height: 84px; padding: 4px; border-bottom: 1px solid var(--border); border-right: 1px solid #EEE; position: relative; }
.dp-pool { min-height: 120px; display: grid; gap: 6px; align-content: start; }
.dp-today { background: #F0FDF4; }
.dp-drop.over { outline: 2px dashed var(--accent); outline-offset: -3px; background: #ECFDF3; }
.dp-chip { background: #EFF6FF; border: 1px solid #BFDBFE; border-left: 4px solid #3B82F6; border-radius: 8px; padding: 4px 6px; margin-bottom: 4px; cursor: grab; font-size: 12px; line-height: 1.3; }
.dp-chip b { display: block; } .dp-chip span { color: #4B5563; }
.dp-chip.dp-high { border-left-color: #F59E0B; } .dp-chip.dp-emergency { border-left-color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.dp-chip.drag { opacity: .5; }
.dp-hrs { font-size: 11px; color: #4B5563; text-align: right; } .dp-hrs.over { color: var(--bad); font-weight: 800; }
.mw { max-width: 640px; margin: 0 auto; } .mw h3 { margin: 18px 0 8px; font-size: 16px; }
.mw-card { display: grid; gap: 3px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; font: inherit; cursor: pointer; }
.mw-card > div:first-child { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 16px; }
.mw-actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; } .mw-actions .btn { flex: 1; text-align: center; text-decoration: none; padding: 12px; }
.mw-big { width: 100%; padding: 14px; font-size: 16px; margin: 10px 0; }
.mw-sig { width: 100%; height: 150px; border: 2px dashed var(--border); border-radius: 10px; background: #fff; touch-action: none; }
/* ---------- v5.185 CRM extras ---------- */
.x-hist { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.x-h { border-left: 3px solid var(--border); padding-left: 10px; }
.x-team input, .x-team select, .x-ateam input, .x-ateam select { padding: 5px 8px; }
.sq-more { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.sq-more summary { cursor: pointer; font-weight: 700; }
/* ---------- v5.187 In-app inspections ---------- */
.ins { max-width: 980px; margin: 0 auto; }
.ins-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.ins-prog { font-size: 15px; }
.ins-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; position: sticky; top: 0; background: var(--bg, #F4F5F7); padding: 6px 0; z-index: 2; }
.ins-tabs button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 9px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.ins-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ins-body { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.ins-add { display: grid; grid-template-columns: 180px 130px 1fr auto; gap: 8px; margin-bottom: 10px; }
@media (max-width: 700px) { .ins-add { grid-template-columns: 1fr 1fr; } .ins-add input:last-of-type { grid-column: 1 / -1; } }
.ins-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.ins-filter button { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.ins-filter button.on { border-color: var(--accent); background: #ECFDF3; font-weight: 700; }
.ins-devs { display: grid; gap: 6px; margin: 8px 0 14px; }
.ins-dev { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--border); border-left: 5px solid #D1D5DB; border-radius: 10px; padding: 8px 10px; }
.ins-dev.pass { border-left-color: #16A34A; } .ins-dev.fail { border-left-color: #DC2626; background: #FEF2F2; }
.ins-dl { flex: 1; min-width: 0; } .ins-note { margin-top: 6px; }
.ins-btns { display: flex; gap: 6px; align-items: center; }
.ins-res { min-width: 58px; padding: 11px 10px; border-radius: 9px; border: 2px solid var(--border); background: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.ins-res.r-P.on { background: #16A34A; border-color: #16A34A; color: #fff; } .ins-res.r-F.on { background: #DC2626; border-color: #DC2626; color: #fff; }
.ins-res.r-NT.on, .ins-res.r-NA.on { background: #6B7280; border-color: #6B7280; color: #fff; }
.ins-two { display: flex; gap: 6px; margin-top: 6px; } .ins-two > * { flex: 1; }
.ins-def { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px 10px; }
.ins-next { margin-top: 12px; width: 100%; padding: 12px; }
.ins-cursive { height: 64px; display: block; margin: 4px 0 8px; }
/* ---------- v5.188 inspection lists ---------- */
.il-edit { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }
.il-items input { padding: 5px 8px; }
#insp-lists .em-tag { margin: 2px 2px 2px 0; }

/* ===================== ERP v5.190 ===================== */
.erp-lines .grid input { width: 100%; padding: 5px 7px; font: inherit; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; }
.erp-lines-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.erp-lines-add .erp-find { flex: 1; min-width: 240px; }
.erp-grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 14px; }
.erp-grid3 { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 4px 14px; }
.erp-filters label { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.erp-report td, .erp-report th { white-space: nowrap; }
#bl-lines input, #bl-lines select { width: 100%; }

/* v5.193 timesheets */
.ts-clock { padding: 12px 14px; margin: 10px 0 14px; }
.ts-clock .ts-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ts-clock select { min-width: 140px; }
.ts-days td, .ts-days th { text-align: right; }

/* v5.197 top section buttons: shorter, text centered */
#mode-switch { align-items: center; }
#mode-switch button { height: 30px; min-height: 0; padding: 0 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }

/* v5.205 inspection report extras */
.ins-cl { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted, #4B5563); cursor: pointer; }
.ins-cl input { width: 18px; height: 18px; }
details.ins-more { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
details.ins-more summary { cursor: pointer; white-space: nowrap; }
.ins-dev .pill { white-space: nowrap; }
