.side-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-bottom: 1rem;
}
.side-link {
  display: block;
  padding: .55rem .8rem;
  border-radius: 7px;
  font-size: .9rem;
  text-decoration: none;
  color: var(--text);
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--brand-primary-tint); }
.side-link.active {
  background: var(--brand-primary);
  color: white;
  font-weight: 500;
}

/* "Jamie Admin Dash" — outline button pinned to the bottom of the sidebar.
   Brand-primary outline, full-width, fills on hover. */
.admin-link {
  margin-top: auto;
  display: block;
  padding: .55rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
  text-align: center;
  border: 1.5px solid var(--brand-primary);
  border-radius: 7px;
  letter-spacing: .02em;
  transition: background .15s, color .15s;
}
.admin-link:hover {
  background: var(--brand-primary);
  color: white;
}
.admin-link.active {
  background: var(--brand-primary);
  color: white;
}

/* Footer note under the Check Zoho button explaining auto-AI behaviour */
.auto-note {
  margin: .55rem 0 0;
  font-size: .72rem;
  line-height: 1.4;
}

.stats-block {
  font-size: .82rem;
  color: var(--text-muted);
  background: #f6f6fa;
  padding: .65rem .8rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  line-height: 1.7;
  margin-bottom: .75rem;
}
.stats-block strong {
  color: var(--brand-primary);
  font-size: 1rem;
  display: inline-block;
  min-width: 2ch;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.batch-controls {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .55rem .65rem;
  background: #f6f6fa;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.batch-controls label { display: block; }
.batch-controls select {
  width: 100%;
  padding: .35rem .5rem;
  margin-top: .2rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
  font-size: .85rem;
  background: white;
}
.btn-primary {
  background: var(--brand-accent);
  color: white;
  border: none;
  padding: .6rem .9rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover { background: var(--brand-accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: white;
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  padding: .55rem .9rem;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--brand-primary-tint); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.page-header h1 {
  margin: 0 0 .25rem;
  font-size: 1.5rem;
}
.page-header { margin-bottom: 1.5rem; }

.comparisons-controls {
  display: flex;
  gap: .75rem;
  margin-bottom: .5rem;
}
.conf-legend {
  margin: 0 0 1rem;
  padding: .55rem .85rem;
  background: #f6f6fa;
  border-radius: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.conf-legend strong {
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .7rem;
}
.conf-legend .conf-tag { font-size: .7rem; }
.filter-input {
  flex: 1;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: .9rem;
}
.filter-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-tint);
}
.filter-select {
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: .9rem;
  background: white;
}

.comparisons-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
  font-size: .88rem;
}
.comparisons-table thead {
  background: var(--brand-primary-tint);
}
.comparisons-table th {
  text-align: left;
  padding: .65rem .75rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: var(--brand-primary);
  border-bottom: 1px solid var(--border);
}
.comparisons-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: middle;
}
.comparisons-table tbody tr:hover {
  background: #fafafe;
  cursor: pointer;
}
.comparisons-table tbody tr.selected {
  background: var(--brand-accent-tint);
}
.comparisons-table .empty-row {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-style: italic;
}

.john-pill {
  display: inline-block;
  padding: .2rem .6rem;
  background: var(--brand-primary-tint);
  color: var(--brand-primary);
  border-radius: 4px;
  font-size: .96rem;
  font-weight: 500;
  font-family: inherit;
}
.ai-num {
  display: inline-block;
  padding: .2rem .6rem;
  background: var(--brand-accent-tint);
  color: #4d6618;
  border-radius: 4px;
  font-size: .96rem;
  font-weight: 600;
  font-family: inherit;
}
/* Refurb Max — secondary AI pill. Outlined / lighter colour so the
   primary "Market Value" pill stays visually dominant. */
.ai-num-secondary {
  display: inline-block;
  padding: .18rem .55rem;
  background: white;
  color: #4d6618;
  border: 1.5px solid var(--brand-accent);
  border-radius: 4px;
  font-size: .92rem;
  font-weight: 600;
  font-family: inherit;
}
/* Column grouping: dashed separator between John (col 4) and AI (col 5).
   Market Value (col 5) + Refurb Max (col 6) sit as a tight pair. */
.comparisons-table th:nth-child(4),
.comparisons-table td:nth-child(4) {
  padding-right: .35rem;
  text-align: right;
}
.comparisons-table th:nth-child(5),
.comparisons-table td:nth-child(5) {
  padding-left: .35rem;
  padding-right: .35rem;
  border-left: 1px dashed var(--border);
}
.comparisons-table th:nth-child(6),
.comparisons-table td:nth-child(6) {
  padding-left: .35rem;
}
.diff-pos { color: #b45309; }
.diff-neg { color: #166534; }
.diff-zero { color: var(--text-muted); }

/* Stacked diff cell — shows pct + £ + math line */
.diff-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
  line-height: 1.2;
}
.diff-cell .diff-pct {
  font-weight: 700;
  font-size: .95rem;
}
.diff-cell .diff-amount {
  font-size: .8rem;
  opacity: .85;
}
.diff-cell .diff-math {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: .15rem;
  white-space: nowrap;
}
.conf-tag {
  display: inline-block;
  padding: .12rem .45rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 500;
  text-transform: capitalize;
  cursor: help;
}
.th-help {
  display: inline-block;
  margin-left: .25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  text-align: center;
  line-height: 14px;
  cursor: help;
}
.conf-high { background: var(--brand-accent-tint); color: #4d6618; }
.conf-medium { background: #fef3c7; color: #854d0e; }
.conf-low { background: #fee2e2; color: #991b1b; }
.conf-pending { background: #f4f4f5; color: var(--text-muted); }

/* ---------- View stack (simple show/hide between list and detail) ---------- */
.views-stack-inner { /* no flex layout — just a normal block */ }
.view-list { display: block; }
.view-detail { display: none; }
.views-stack.show-detail .view-list { display: none; }
.views-stack.show-detail .view-detail { display: block; }

.back-btn {
  background: white;
  color: var(--brand-primary);
  border: 1px solid var(--border);
  padding: .5rem .9rem .5rem .75rem;
  border-radius: 7px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  transition: background .15s, border-color .15s, transform .15s;
}
.back-btn:hover {
  background: var(--brand-primary-tint);
  border-color: var(--brand-primary);
  transform: translateX(-2px);
}
.back-arrow {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
}

.detail-section { margin-top: 2rem; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-panel {
  background: white;
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: .9rem;
  line-height: 1.55;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
}
.detail-panel h4 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--brand-primary);
  margin: 1rem 0 .35rem;
  font-weight: 600;
}
.detail-panel h4:first-child { margin-top: 0; }
.detail-panel .verdict-pill {
  display: inline-block;
  padding: .35rem .7rem;
  background: var(--brand-primary-tint);
  color: var(--brand-primary);
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
}
.detail-panel .ai-figs {
  display: flex;
  gap: 1rem;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-soft) 100%);
  color: white;
  padding: .85rem 1rem;
  border-radius: 8px;
  margin-bottom: .5rem;
}
.detail-panel .ai-figs .fig {
  flex: 1;
}
.detail-panel .ai-figs .fig-label {
  font-size: .65rem;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-panel .ai-figs .fig-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .75rem;
  font-size: .85rem;
}
.kv-list dt { color: var(--text-muted); }
.kv-list dd { margin: 0; color: var(--text); }

#detail-section h2 {
  font-size: 1.1rem;
  color: var(--brand-primary);
  margin: 1.5rem 0 0;
}

.note-block {
  background: #f8f8fc;
  border-left: 3px solid var(--brand-primary);
  padding: .65rem .85rem;
  border-radius: 0 6px 6px 0;
  font-size: .88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: .25rem;
}
.note-block.highlight {
  background: var(--brand-accent-tint);
  border-left-color: var(--brand-accent);
  font-weight: 500;
}

.jh-note {
  background: white;
  border: 1px solid var(--brand-primary-tint);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0 8px 8px 0;
  padding: .75rem 1rem;
  margin-bottom: .65rem;
}
.jh-note-meta {
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  padding-bottom: .35rem;
  border-bottom: 1px dashed #e5e5e5;
}
.jh-note-meta strong { color: var(--brand-primary); }
.jh-note-body {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.jh-note-body br { display: block; margin: .25rem 0; }
.jh-note-body p { margin: 0 0 .65rem; }

.col-heading h3 {
  margin: 0;
  font-size: .95rem;
  color: var(--brand-primary);
}

.btn-rerun {
  margin-left: auto;
  background: var(--brand-accent);
  color: white;
  border: none;
  padding: .35rem .8rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}
.btn-rerun:hover { background: var(--brand-accent-dark); }
.btn-rerun:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: #a1a1aa;
}
.btn-rerun.running {
  background: var(--brand-primary);
  cursor: wait;
}
.btn-rerun.is-rerun { background: white; color: var(--brand-primary); border: 1px solid var(--brand-primary); }
.btn-rerun.is-rerun:hover { background: var(--brand-primary-tint); }

/* ---------- Sources table inside AI panel ---------- */
.sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: .35rem;
}
.sources-table td {
  padding: .5rem .65rem;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: middle;
}
.sources-table tr:last-child td { border-bottom: none; }
.sources-table .src-dot { width: 28px; padding-right: 0; }
.sources-table .src-name {
  width: 175px;
  font-weight: 500;
  color: var(--text);
}
.sources-table .src-status {
  width: 95px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.sources-table .src-detail {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sources-table tr.src-active   { background: var(--brand-accent-tint); }
.sources-table tr.src-active   .src-status { color: #4d6618; }
.sources-table tr.src-empty    { background: #eff6ff; }
.sources-table tr.src-empty    .src-status { color: #1e40af; }
.sources-table tr.src-failed   { background: #fef2f2; }
.sources-table tr.src-failed   .src-status { color: #991b1b; }
.sources-table tr.src-skipped  { background: #fafafa; }
.sources-table tr.src-skipped  .src-status,
.sources-table tr.src-skipped  .src-name,
.sources-table tr.src-skipped  .src-detail { color: var(--text-muted); }
.sources-table tr.src-no_key   { background: #fafafa; opacity: .7; }
.sources-table tr.src-no_key   .src-status { color: var(--text-muted); }

/* ---------- Headline figure (AI offer / John's offer) ---------- */
.headline-fig {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: .5rem;
}
/* AI variant — Price Guide + Market Value sit side-by-side as equal twins,
   separated by a thin vertical rule, with Confidence as a smaller pill on right. */
.headline-fig.ai-headline-split {
  grid-template-columns: 1fr 1fr auto;
}
.headline-fig.ai-headline-split .hf-main-secondary {
  padding-left: 1.15rem;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.headline-fig .hf-meta {
  font-size: .68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .55;
  margin-top: .3rem;
}
.ai-headline {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-soft) 100%);
  color: white;
}
.john-headline {
  background: var(--brand-primary-tint);
  color: var(--brand-primary);
  border: 1px solid #c5c5e8;
}
.headline-fig .hf-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
  margin-bottom: .15rem;
}
.headline-fig .hf-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.05;
}
.headline-fig .hf-sub {
  font-size: .78rem;
  margin-top: .35rem;
  opacity: .7;
  font-weight: 500;
}
.headline-fig .hf-sub strong {
  font-weight: 600;
  opacity: 1;
}
.headline-fig .hf-conf {
  text-align: right;
  padding: .4rem .85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}
.john-headline .hf-conf {
  background: white;
  border: 1px solid #c5c5e8;
}
.headline-fig .hf-conf-value {
  font-size: 1rem;
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.1;
}
.headline-fig.conf-high   .hf-conf-value { color: #bef264; }
.headline-fig.conf-medium .hf-conf-value { color: #fbbf24; }
.headline-fig.conf-low    .hf-conf-value { color: #fca5a5; }
.john-headline .hf-conf-value { color: var(--brand-primary); font-size: .9rem; }

.hf-context {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.25rem;
  margin-top: .15rem;
}
.ctx-pill {
  display: inline-block;
  padding: .35rem .85rem;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  font-size: .98rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.ctx-pill strong {
  color: var(--text);
  font-weight: 600;
  margin-left: .2rem;
}
.ctx-pill.ctx-quote {
  background: #fafafa;
  font-style: italic;
  border-radius: 8px;
  white-space: pre-wrap;
}

.route-pill {
  font-weight: 600;
  font-size: 1rem;
  padding: .4rem .9rem;
}
.route-pill.route-bmh_auction { background: var(--brand-accent-tint); border-color: var(--brand-accent); color: #4d6618; }
.route-pill.route-pt_ukps     { background: var(--brand-primary-tint); border-color: #c5c5e8; color: var(--brand-primary); }
.route-pill.route-split_dual  { background: #fef3c7; border-color: #fde68a; color: #854d0e; }
.route-pill.route-walk_away   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.route-reason {
  margin: .5rem 0 1rem;
  padding: .65rem .85rem;
  background: #fafafa;
  border-radius: 6px;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text);
  border-left: 3px solid var(--brand-primary);
}
.route-reason strong {
  color: var(--brand-primary);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .06em;
  margin-right: .35rem;
}

.ai-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: .35rem;
}
@media (max-width: 800px) {
  .ai-images { grid-template-columns: 1fr; }
}
.ai-image {
  margin: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
}
.ai-image img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
/* ---------- AI output highlighting + section layout ---------- */
.primary-section {
  margin: 0 0 .35rem !important;
  font-size: .72rem !important;
  font-weight: 700 !important;
  color: var(--brand-primary) !important;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.bottom-line {
  font-size: .98rem;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(180deg, #fafafe 0%, white 100%);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  border: 1px solid #ebebf3;
  border-left: 3px solid var(--brand-accent);
  margin: 0 0 1.25rem;
  white-space: pre-wrap;
}

.ai-section {
  margin-top: 1rem;
}
.ai-section h4 {
  margin: 0 0 .35rem !important;
  font-size: .72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-primary) !important;
}
.ai-section > p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.ai-section-risk {
  background: #fef5f4;
  border: 1px solid #fed7d3;
  border-left: 3px solid #ef4444;
  padding: .85rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}
.ai-section-risk h4.risk-heading {
  color: #991b1b !important;
  font-size: .78rem !important;
  margin-bottom: .5rem !important;
}
.ai-section-risk > p {
  color: #4a1d1d;
  font-size: .9rem;
  line-height: 1.55;
}

/* ---------- Sales-team scan view: verdict + bullet lists ---------- */
.verdict-box {
  background: linear-gradient(180deg, #f7f8ff 0%, white 100%);
  border: 1px solid #d8dbf2;
  border-left: 4px solid var(--brand-primary);
  border-radius: 8px;
  padding: .85rem 1.05rem;
  margin: 0 0 1.15rem;
}
.verdict-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-primary);
  margin-bottom: .25rem;
}
.verdict-text {
  font-size: 1.02rem;
  line-height: 1.5;
  font-weight: 600;
  color: var(--text);
}

ul.scan-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
ul.scan-list li {
  position: relative;
  padding: .35rem 0 .35rem 1.15rem;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--text);
  border-bottom: 1px dashed #ececf4;
}
ul.scan-list li:last-child {
  border-bottom: none;
}
ul.scan-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: .35rem;
  color: var(--brand-accent);
  font-weight: 700;
  font-size: .9rem;
}
.ai-section-risk ul.scan-list li {
  border-bottom-color: #fcd9d4;
  color: #4a1d1d;
}
.ai-section-risk ul.scan-list li::before {
  content: "⚠";
  color: #ef4444;
  font-size: .8rem;
  top: .42rem;
}

/* "View full lead in Zoho CRM" link styled as quiet outline button */
.zoho-link-btn {
  display: inline-block;
  margin-top: .5rem;
  padding: .45rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--brand-primary);
  background: white;
  border: 1px solid var(--brand-primary);
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.zoho-link-btn:hover {
  background: var(--brand-primary);
  color: white;
}

/* "The call" — John's 2-3 sentence sign-off, sits right under verdict */
.john-call {
  margin: 0 0 1.25rem;
  padding: .9rem 1.05rem;
  background: linear-gradient(180deg, #fafafe 0%, white 100%);
  border: 1px solid #ebebf3;
  border-left: 3px solid var(--brand-accent);
  border-radius: 8px;
}
.john-call-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-accent-dark, #6c8a32);
  margin-bottom: .35rem;
}
.john-call-text {
  margin: 0;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--text);
}

.hl-money {
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--brand-primary-tint);
  padding: 0 .25rem;
  border-radius: 3px;
}
.hl-pct {
  font-weight: 600;
  color: #b45309;
}
.hl-risk {
  background: #fef3c7;
  color: #854d0e;
  font-weight: 500;
  padding: 0 .2rem;
  border-radius: 3px;
}
.hl-style {
  font-style: italic;
  color: var(--brand-primary-soft);
}

.ai-image {
  cursor: zoom-in;
}
.ai-image:hover img {
  filter: brightness(1.05);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}
.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.lightbox-inner img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform .2s ease;
  background: #000;
}
.lightbox-cap {
  color: white;
  font-size: .85rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.5);
  padding: .35rem .8rem;
  border-radius: 4px;
}
.lightbox-close {
  position: absolute;
  top: -42px;
  right: -2px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  font-family: inherit;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.ai-image figcaption {
  padding: .4rem .6rem;
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
  background: #fafafa;
  border-top: 1px solid var(--border);
}

/* ───────── AI loader (detail view + inline) ───────── */
.ai-loader {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, #f7f8ff 0%, white 100%);
  border: 1px solid #d8dbf2;
  border-left: 4px solid var(--brand-primary);
  border-radius: 8px;
  margin: .5rem 0 1rem;
}
.ai-loader-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #d8dbf2;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  flex: none;
  animation: ai-spin 1s linear infinite;
}
.ai-loader-body { flex: 1; min-width: 0; }
.ai-loader-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--brand-primary);
  margin-bottom: .25rem;
}
.ai-loader-stage {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-loader-elapsed {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* Inline spinner used in the table while one row is mid-run */
.ai-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--brand-primary);
  font-weight: 500;
}
.ai-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #d8dbf2;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: ai-spin 0.9s linear infinite;
  vertical-align: middle;
  margin-right: .15rem;
}
/* When the spinner sits inside a running (dark blue) button, flip the
   colours so it's visible against the brand-primary background. */
.btn-rerun.running .ai-spinner {
  border-color: rgba(255,255,255,.35);
  border-top-color: white;
}

/* ───────── Sales-team feedback box (in detail view) ───────── */
.team-feedback-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.team-feedback-section h4 {
  font-size: .85rem !important;
  margin-bottom: .65rem !important;
}
.feedback-list { margin-bottom: .85rem; }
.feedback-empty {
  padding: .6rem .8rem;
  background: #fafafa;
  border-radius: 6px;
  border: 1px dashed var(--border);
}
.feedback-item {
  background: #fffef5;
  border: 1px solid #f3eed4;
  border-left: 3px solid #d4af37;
  border-radius: 6px;
  padding: .55rem .8rem;
  margin-bottom: .5rem;
}
.feedback-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.feedback-meta strong { color: var(--text); font-weight: 600; }
.feedback-text {
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}
.feedback-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 .35rem;
  line-height: 1;
  border-radius: 4px;
}
.feedback-delete:hover { color: #dc2626; background: #fef2f2; }

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.feedback-author-input,
.feedback-text-input {
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .85rem;
  width: 100%;
  box-sizing: border-box;
  background: white;
}
.feedback-text-input { resize: vertical; min-height: 70px; }
.feedback-author-input:focus,
.feedback-text-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}
.feedback-submit {
  align-self: flex-start;
  padding: .5rem 1.1rem;
  font-size: .8rem;
}
.feedback-submit:disabled { opacity: .55; cursor: not-allowed; }

/* ───────── Admin "Check Zoho" button states ───────── */
#adminSyncBtn.running {
  background: var(--brand-primary);
  color: white;
  cursor: wait;
}
#adminSyncBtn.sync-success {
  background: var(--brand-accent);
  color: white;
}
#adminSyncBtn.sync-error {
  background: #dc2626;
  color: white;
}
#adminSyncMsg .sync-stage {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .76rem;
  color: var(--brand-primary);
}
#adminSyncMsg .sync-elapsed {
  font-size: .72rem;
  color: var(--text-muted);
}
#adminSyncMsg .sync-ok { color: #166534; font-weight: 500; }
#adminSyncMsg .sync-fail { color: #b91c1c; font-weight: 500; }
