/* Event Sales engine — /dept/sales?tab=eventsales
   Companion to templates/partials/event_sales_panel.html + static/js/event_sales.js.
   Leans on departments.css for .dept-section / .dept-table; everything
   panel-specific carries the es- prefix. */

/* ── Compact above-the-fold sections ──────────────────────────────────── */
#panel-eventsales.es-panel-ready .es-section-compact .dept-section-body,
#panel-eventsales .es-section-compact .dept-section-body {
  padding-top: 10px;
  padding-bottom: 10px;
}
.es-section-compact .dept-section-header { padding-bottom: 4px; }

/* ── Answer strip ─────────────────────────────────────────────────────── */
.es-headline {
  font-size: 13.5px; font-weight: 600; line-height: 1.4;
  color: var(--text-primary); margin-bottom: 8px;
}
.es-headline b { color: var(--accent, #3b82f6); }

/* Touch-ledger honesty banner. Amber, not red: the page is still usable and
   the DataOS half of the ledger is intact — one input is incomplete. */
.es-ledger-warn {
  display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
  margin: -2px 0 8px; padding: 8px 10px; border-radius: 8px;
  font-size: 12px; line-height: 1.5;
  color: var(--text-primary);
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent);
}
.es-ledger-warn-tag {
  flex: none; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
  color: #7c2d12; background: color-mix(in srgb, #f59e0b 45%, #fff);
}
.es-ledger-warn span:last-child { flex: 1 1 320px; min-width: 0; }

.es-quarter-toggle { display: inline-flex; gap: 6px; }
.es-quarter-toggle .nav-rep-chip-btn.active {
  background: var(--accent, #3b82f6); color: #fff; border-color: var(--accent, #3b82f6);
}

.es-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.es-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; background: var(--bg-card, #fff);
  cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.es-card:hover { border-color: var(--accent, #3b82f6); }
.es-card.active {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .18);
}
.es-card-label { font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); }
.es-card-value { font-size: 18px; font-weight: 800; color: var(--text-primary);
  font-variant-numeric: tabular-nums; }
/* Card notes live in the title tooltip so the strip stays one short row.
   .es-muted stays available for inline secondary text (event dates, etc.). */
.es-card-note { display: none; }
.es-muted { font-size: 11px; line-height: 1.35; color: var(--text-muted); }

/* ── Plan lanes ───────────────────────────────────────────────────────── */
.es-lanes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.es-lane {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--border, #e5e7eb);
  border-left-width: 4px; border-radius: 10px; background: var(--bg-card, #fff);
  cursor: pointer; transition: transform .1s ease, box-shadow .12s ease;
}
.es-lane:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.07); }
.es-lane.active { box-shadow: 0 0 0 2px rgba(59, 130, 246, .2); }
.es-lane-danger { border-left-color: #ef4444; }
.es-lane-warn   { border-left-color: #f59e0b; }
.es-lane-ok     { border-left-color: #10b981; }
.es-lane-muted  { border-left-color: #9ca3af; }
.es-lane-title { font-size: 11.5px; font-weight: 700; color: var(--text-primary);
  line-height: 1.25; }
.es-lane-stats { display: flex; align-items: baseline; gap: 6px; }
.es-lane-count { font-size: 17px; font-weight: 800; color: var(--text-primary);
  font-variant-numeric: tabular-nums; }
.es-lane-amount { font-size: 11px; font-weight: 600; color: var(--text-muted); }
/* Why/action copy is available via title tooltip — keep the fold short. */
.es-lane-why,
.es-lane-action { display: none; }

/* ── Toolbar / filters (mirrors the seats tab) ────────────────────────── */
.es-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-bottom: 10px;
}
.es-ctl { display: flex; flex-direction: column; gap: 4px; }
.es-ctl label { font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .03em; }
.es-ctl-actions { flex-direction: row; align-items: flex-end; gap: 6px; margin-left: auto; }

.es-filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding-top: 10px; border-top: 1px dashed var(--border, #e5e7eb);
}
.es-filter-label { font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .03em; }
.es-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.es-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
  background: rgba(59, 130, 246, .1); color: var(--text-primary);
  border: 1px solid rgba(59, 130, 246, .25);
}
.es-chip b { font-weight: 700; }
.es-chip-x {
  border: 0; background: none; cursor: pointer; font-size: 13px;
  line-height: 1; color: var(--text-muted); padding: 0 2px;
}
.es-chip-x:hover { color: #ef4444; }
.es-chip-empty { font-size: 12px; color: var(--text-muted); }

.es-break-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  min-height: 1.2em; margin: 10px 0 6px; font-size: 12px;
  color: var(--text-muted);
}
.es-drill-hint { font-size: 11.5px; color: var(--text-muted); }

/* ── Rollup grid ──────────────────────────────────────────────────────── */
/* Bounded with a pinned header so the list below stays on screen — a
   40-owner grid otherwise pushes the opps a full page down, which is the
   scroll this layout exists to remove. */
.es-grid-wrap { max-height: 46vh; overflow: auto; }
.es-grid-wrap #es-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-card, #fff);
  box-shadow: inset 0 -1px 0 var(--border, #e5e7eb);
}

/* ── Tables ───────────────────────────────────────────────────────────── */
#es-table tbody tr.es-pick { cursor: pointer; }
#es-table tbody tr.es-pick:hover td { background: rgba(59, 130, 246, .06); }
#es-table tbody tr.es-selected td {
  background: color-mix(in srgb, var(--accent, #3b82f6) 12%, transparent);
  font-weight: 600;
}
/* Only cells with opps behind them are live; a zero cell stays inert. */
#es-table tbody td.es-cell-pick:hover {
  outline: 1px solid var(--accent, #3b82f6); outline-offset: -1px;
}
#es-table tbody td.es-cell-selected,
#es-table tbody tr.es-selected td.es-cell-selected {
  background: var(--accent, #3b82f6); color: #fff; font-weight: 700;
}
.es-row-other td { color: var(--text-muted); font-style: italic; }
.es-zero { opacity: .35; }
.mono { font-variant-numeric: tabular-nums; }

#es-table thead th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#es-table thead th.sortable:hover { color: var(--text-primary); }

.es-risk-pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.es-risk-danger { background: rgba(239, 68, 68, .12); color: #dc2626; }
.es-risk-warn   { background: rgba(245, 158, 11, .14); color: #b45309; }
.es-risk-ok     { background: rgba(16, 185, 129, .12); color: #047857; }
.es-risk-muted  { background: rgba(156, 163, 175, .18); color: #6b7280; }

.es-touch-split { white-space: nowrap; font-variant-numeric: tabular-nums; }
.es-touch-split b { color: var(--text-primary); }
.es-touch-zero { color: #dc2626; font-weight: 700; }

.es-act { display: inline-flex; gap: 6px; }
.es-act a,
.es-act button {
  font-size: 11px; font-weight: 700; text-decoration: none;
  color: var(--accent, #3b82f6); border: 1px solid rgba(59, 130, 246, .3);
  border-radius: 6px; padding: 2px 7px; white-space: nowrap;
  background: transparent; cursor: pointer; font-family: inherit; line-height: inherit;
}
.es-act a:hover,
.es-act button:hover { background: rgba(59, 130, 246, .08); }

/* ── The list, in the same section as the grid that scopes it ─────────── */
.es-drill { margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--border, #e5e7eb); }
.es-drill-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  justify-content: space-between; margin-bottom: 8px;
}
.es-drill-scope {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.es-drill-scope b { color: var(--text-primary); font-weight: 700; }

.es-roster-controls { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.es-pager {
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  margin-top: 10px; font-size: 12px; color: var(--text-muted);
}

/* ── Enrollment engine ───────────────────────────────────────────────── */
.es-mode-toggle { display: inline-flex; gap: 6px; margin-left: auto; }
.es-mode-toggle .nav-rep-chip-btn.active {
  background: var(--accent, #3b82f6); color: #fff; border-color: transparent;
}
.es-engine { padding: 12px 16px 20px; }
.es-engine-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px;
  justify-content: space-between; margin-bottom: 12px;
}
.es-engine-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1; }
.es-engine-switch {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.es-engine-switch input { width: 16px; height: 16px; accent-color: var(--accent, #3b82f6); }
.es-engine-auto-note {
  font-size: 12px; line-height: 1.45; color: var(--text-muted); max-width: 640px;
}
.es-engine-auto-note.is-on { color: #9a3412; }
.es-engine-kpis {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.es-engine-kpi {
  min-width: 110px; padding: 8px 12px; border-radius: 8px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
}
.es-engine-kpi b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.es-engine-kpi span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.es-engine-block { margin-top: 16px; }
.es-engine-block-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  justify-content: space-between; margin-bottom: 8px;
}
.es-engine-block-title { font-size: 13.5px; font-weight: 700; }
.es-engine-buckets { display: inline-flex; gap: 6px; }
.es-engine-seq { min-width: 180px; max-width: 260px; }
.es-tree-team, .es-tree-owner, .es-tree-acct { margin: 0 0 4px; }
.es-tree-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.es-tree-row:hover { background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent); }
.es-tree-row.is-blocked { opacity: .55; }
.es-tree-toggle { font-size: 11px; color: var(--text-muted); width: 12px; }
.es-tree-name { font-weight: 600; font-size: 13px; }
.es-tree-meta { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.es-tree-children { margin-left: 18px; border-left: 1px solid var(--border, #e5e7eb); padding-left: 8px; }
.es-tree-opp { cursor: default; }
.es-tree-contacts { margin: 4px 0 10px 18px; }
.es-tree-contact {
  padding: 8px 10px; margin-bottom: 6px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc);
}
.es-tree-contact-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.es-tree-role {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
}
.es-tree-sched {
  margin: 6px 0 0; padding: 0; list-style: none; font-size: 12px;
  color: var(--text-secondary);
}
.es-tree-sched li { display: flex; gap: 10px; padding: 2px 0; }
.es-tree-sched .es-when { font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 140px; }
.es-block-btn {
  font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px;
  border: 1px solid rgba(185, 28, 28, .35); color: #b91c1c;
  background: transparent; cursor: pointer; font-family: inherit;
}
.es-block-btn.is-blocked {
  border-color: rgba(22, 163, 74, .4); color: #15803d;
}
.es-engine-seq-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.es-engine-cov { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.es-cal-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px; align-items: start;
}
.es-cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.es-cal-label { font-size: 16px; font-weight: 700; margin-left: 4px; }
.es-cal-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer; margin-left: 8px;
}
.es-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border, #e5e7eb); border-radius: 10px; overflow: hidden;
}
.es-cal-dow {
  padding: 6px 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-2, #f8fafc); border-bottom: 1px solid var(--border, #e5e7eb);
}
.es-cal-cell {
  min-height: 92px; padding: 6px; border-right: 1px solid var(--border, #e5e7eb);
  border-bottom: 1px solid var(--border, #e5e7eb); background: var(--bg-primary, #fff);
}
.es-cal-cell:nth-child(7n) { border-right: 0; }
.es-cal-cell.out { opacity: .42; }
.es-cal-cell.weekend { background: var(--surface-2, #f8fafc); }
.es-cal-cell.today {
  background: color-mix(in srgb, var(--accent, #3b82f6) 16%, var(--bg-primary, #fff));
  box-shadow: inset 0 0 0 2px var(--accent, #3b82f6);
}
.es-cal-cell.today .es-cal-date { color: var(--accent, #3b82f6); }
.es-cal-cell.send { box-shadow: inset 0 0 0 2px rgba(59, 130, 246, .35); }
.es-cal-cell.blackout { background: repeating-linear-gradient(
  -45deg, transparent, transparent 6px, rgba(185, 28, 28, .06) 6px, rgba(185, 28, 28, .06) 12px
); }
.es-cal-date { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.es-cal-chip {
  display: block; width: 100%; text-align: left; margin: 0 0 4px; padding: 3px 6px;
  border: 0; border-radius: 5px; cursor: pointer; font: inherit; font-size: 11px;
  font-weight: 600; color: #1e3a5f; background: #dbeafe; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.es-cal-chip.kind-mid { background: #fef3c7; color: #78350f; }
.es-cal-chip.kind-transactional { background: #fee2e2; color: #7f1d1d; }
.es-cal-chip.is-on { outline: 2px solid var(--accent, #3b82f6); }
.es-cal-chip.mkt { background: #ede9fe; color: #5b21b6; font-weight: 600; }
.es-cal-layout.is-focus .es-cal-chip:not(.is-on):not(.is-seq) { opacity: .22; }
.es-cal-layout.is-focus .es-cal-event:not(.is-on) { opacity: .35; }
.es-cal-layout.is-focus .es-cal-cell:not(.send):not(.has-on) { opacity: .55; }
.es-cal-layout.is-focus .es-cal-chip.is-on,
.es-cal-layout.is-focus .es-cal-chip.is-seq,
.es-cal-layout.is-focus .es-cal-event.is-on { opacity: 1; }
.es-cal-layout.is-focus .es-cal-chip.is-on,
.es-cal-layout.is-focus .es-cal-chip.is-seq {
  outline: 2px solid var(--accent, #3b82f6);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #3b82f6) 28%, transparent);
}
.es-cal-side {
  display: flex; flex-direction: column; min-height: 0;
  max-height: 620px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: 12px;
}
.es-cal-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; flex-shrink: 0;
}
.es-cal-side-actions { display: flex; align-items: center; gap: 8px; }
#es-cal-archive:disabled { opacity: .45; cursor: not-allowed; }
#es-prospects-tree { max-height: 360px; overflow-y: auto; }
#es-cal-events { overflow-y: auto; min-height: 0; flex: 1; max-height: 560px; }
.es-cal-event {
  display: flex; align-items: flex-start; gap: 8px;
  width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 8px 4px; border-bottom: 1px solid var(--border, #e5e7eb); font: inherit;
}
.es-cal-event:last-child { border-bottom: 0; }
.es-cal-event:hover, .es-cal-event.is-on { background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent); }
.es-cal-event b { display: block; font-size: 13px; }
.es-cal-event span { font-size: 11px; color: var(--text-muted); }
.es-cal-event input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.es-enrollees {
  margin-top: 16px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 12px 14px 16px;
}
#es-enrollees-tree { max-height: 420px; overflow-y: auto; }
.es-enr-event { margin-bottom: 10px; }
.es-enr-event > b { display: block; font-size: 13px; margin-bottom: 4px; }
.es-enr-acct { margin: 4px 0 4px 12px; }
.es-enr-acct > span { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.es-cov {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; border-radius: 999px; padding: 1px 6px; margin-left: 4px;
}
.es-cov.missing { background: #fee2e2; color: #991b1b; }
.es-cov.ready { background: #dcfce7; color: #166534; }
.es-cov.spam { background: #ffedd5; color: #9a3412; }
.es-drawer {
  margin-top: 18px; border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  padding: 14px 16px 18px; background: var(--bg-primary, #fff);
}
.es-drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 12px;
}
.es-drawer-title { font-size: 18px; font-weight: 700; }
.es-drawer-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.es-cadence {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 14px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc);
  font-size: 12px;
}
.es-cadence-node { font-weight: 700; }
.es-cadence-gap { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.es-funnel { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.es-funnel-step {
  flex: 1 1 140px; max-width: 180px; text-align: left; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc);
  padding: 8px 10px; cursor: pointer; font: inherit;
}
.es-funnel-step.is-on { border-color: var(--accent, #3b82f6); background: #eff6ff; }
.es-funnel-step.blackout { opacity: .55; cursor: default; }
.es-funnel-step b { display: block; font-size: 12px; }
.es-funnel-step span { font-size: 11px; color: var(--text-muted); }
.es-preview {
  margin: 0 0 16px; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc);
}
.es-preview-recip {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border, #e5e7eb);
}
.es-preview-recip h4 { margin: 0 0 4px; font-size: 13px; }
.es-preview-body {
  font-size: 13px; line-height: 1.45; max-height: 220px; overflow: auto;
  padding: 8px; background: #fff; border-radius: 6px;
}
.es-opp-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 4px; border-bottom: 1px solid var(--border, #e5e7eb);
}
.es-opp-row button[data-expand] { border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600; text-align: left; }
@media (max-width: 960px) {
  .es-cal-layout { grid-template-columns: 1fr; }
}
