:root {
  --bg: #f5f4ef;
  --ink: #1d1f23;
  --muted: #6a6f76;
  --line: #ddd8cd;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #be123c;
  --success: #0f766e;
  --danger: #be123c;
  --warning: #d97706;
  --soft: #eef7f6;
  --warn: #fff4d8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.authenticated:not(.password-change-required) .login-panel,
body.unauthenticated .sidebar,
body.unauthenticated .shell {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
}

body.intake-body {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09), transparent 34%),
    var(--bg);
}

.login-panel {
  min-height: 100vh;
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  padding: 22px;
}

.login-box {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 18px;
}

.login-box button[type="submit"] {
  min-height: 42px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.google-login-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  border: 1px solid #dadce0;
  background: #ffffff;
  color: #3c4043;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
}

.google-login-button span {
  min-width: 0;
  text-align: center;
}

.google-login-button:hover {
  border-color: #c4c7c5;
  background: #f8fafd;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18);
}

.google-login-button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.google-login-mark {
  width: 18px;
  height: 18px;
  display: block;
}

.login-result {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--warn);
  padding: 9px 10px;
  color: var(--ink);
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfaf7;
  padding: 14px 10px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.views {
  display: grid;
  gap: 10px;
}

.view-group {
  display: grid;
  gap: 3px;
  padding: 0 4px 8px;
  border-bottom: 1px solid rgba(29, 31, 35, 0.06);
}

.view-group-title {
  padding: 6px 8px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.view-button:hover {
  background: rgba(255, 253, 250, 0.9);
}

.view-button.active {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.14);
  color: #0b5f59;
}

.view-button-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.view-button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.68;
}

.view-button-label {
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-button.active .view-button-icon {
  opacity: 1;
}

.count {
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(221, 216, 205, 0.7);
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.shell {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 18px;
  align-items: start;
  margin-bottom: 16px;
}

.topbar-main {
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.user-badge {
  min-height: 32px;
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
  color: var(--muted);
  font-size: 11px;
  padding: 0 10px;
}

.toolbar-button,
.mode-switch button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.toolbar-icon {
  width: 14px;
  height: 14px;
  position: relative;
  display: inline-block;
  flex: 0 0 14px;
}

.toolbar-icon::before,
.toolbar-icon::after {
  content: "";
  position: absolute;
}

#queue-mode-button .toolbar-icon::before {
  inset: 2px;
  border: 1.6px solid currentColor;
  border-radius: 4px;
}

#kanban-mode-button .toolbar-icon::before {
  inset: 1px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

#kanban-mode-button .toolbar-icon::after {
  left: 50%;
  top: 1px;
  bottom: 1px;
  width: 1.6px;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow: -4px 0 0 currentColor, 4px 0 0 currentColor;
}

#dashboard-mode-button .toolbar-icon::before {
  left: 1px;
  right: 1px;
  bottom: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  box-shadow: 0 -4px 0 currentColor, 0 -8px 0 currentColor;
}

#admin-mode-button .toolbar-icon::before {
  inset: 2px;
  border: 1.6px solid currentColor;
  border-radius: 999px;
}

#admin-mode-button .toolbar-icon::after {
  left: 50%;
  top: 4px;
  width: 1.6px;
  height: 6px;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow: -3px 2px 0 currentColor, 3px 2px 0 currentColor;
}

#theme-mode-button .toolbar-icon::before,
#performance-mode-button .toolbar-icon::before,
#run-maintenance .toolbar-icon::before,
#new-lead-button .toolbar-icon::before,
#logout-button .toolbar-icon::before {
  inset: 2px;
  border: 1.6px solid currentColor;
  border-radius: 999px;
}

#theme-mode-button .toolbar-icon::after {
  right: 1px;
  top: 1px;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 999px;
}

#performance-mode-button .toolbar-icon::after {
  left: 3px;
  right: 3px;
  top: 6px;
  height: 1.6px;
  background: currentColor;
  box-shadow: 0 3px 0 currentColor;
}

#run-maintenance .toolbar-icon::after {
  left: 6px;
  top: 1px;
  bottom: 1px;
  width: 1.6px;
  background: currentColor;
}

#new-lead-button .toolbar-icon::after {
  left: 6px;
  top: 1px;
  bottom: 1px;
  width: 1.6px;
  background: currentColor;
  box-shadow: 0 0 0 transparent;
}

#new-lead-button .toolbar-icon {
  transform: rotate(90deg);
}

#logout-button .toolbar-icon::after {
  right: -1px;
  top: 6px;
  width: 6px;
  height: 1.6px;
  background: currentColor;
}

#new-lead-button {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.toolbar-button-accent {
  padding-inline: 12px;
}

.mode-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.mode-switch button {
  width: auto;
  justify-self: stretch;
}

.toolbar-button,
.mode-switch button,
#kanban-pipeline-select,
#logout-button {
  border-color: rgba(29, 31, 35, 0.09);
  background: rgba(255, 253, 250, 0.92);
}

.mode-switch button.active {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.16);
  color: #0b5f59;
}

#kanban-pipeline-select {
  min-width: 190px;
  min-height: 32px;
  border-radius: 999px;
  padding-inline: 12px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.operational-filters {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.operational-filter-group {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.operational-filter-group.compact {
  padding: 10px 0 0;
  border: 0;
  background: transparent;
}

.operational-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.operational-filter-head strong {
  font-size: 13px;
}

.operational-filter-head span {
  color: var(--muted);
  font-size: 12px;
}

.operational-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operational-filter-chip {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.72);
  color: var(--muted);
  font-size: 12px;
}

.operational-filter-chip.active {
  background: var(--soft);
  border-color: var(--accent);
  color: #0b5f59;
}

.operational-filter-advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
}

.operational-filter-advanced summary {
  cursor: pointer;
  font-weight: 600;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.kanban-context {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(260px, 1.4fr);
  gap: 10px;
  margin: -2px 0 14px;
}

.kanban-context[hidden] {
  display: none;
}

.kanban-context-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.kanban-context-card span,
.kanban-context-card small {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
}

.kanban-context-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.kanban-context-card small {
  margin-top: 4px;
}

.dashboard-panel {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 190px);
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.dashboard-card {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 11px 12px;
}

.dashboard-card span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.dashboard-section {
  min-height: 220px;
  overflow: hidden;
}

.dashboard-section-wide {
  grid-column: 1 / -1;
}

.school-dashboard-toolbar {
  min-height: auto;
  padding: 14px;
}

.school-dashboard-toolbar .panel-head {
  margin-bottom: 12px;
}

.school-dashboard-toolbar .panel-head small,
.school-dashboard-toolbar .panel-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.school-period-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.school-period-controls button {
  min-height: 36px;
}

.school-period-controls button.active {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--text);
}

.school-period-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.school-period-controls input {
  min-height: 36px;
}

.dashboard-chart-section {
  padding: 14px;
}

.dashboard-bars,
.dashboard-stack-list {
  display: grid;
  gap: 10px;
}

.dashboard-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 1.5fr) auto auto;
  gap: 10px;
  align-items: center;
}

.dashboard-bar-label,
.dashboard-stack-row strong,
.dashboard-stack-legend small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-bar-label {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.dashboard-bar-track,
.dashboard-stack-track {
  min-width: 0;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 48%, transparent);
}

.dashboard-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 58%, #24a0ed));
}

.dashboard-bar-row strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.dashboard-bar-row small,
.dashboard-stack-row small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-stack-row {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 91%, var(--soft));
}

.dashboard-stack-track {
  display: flex;
  height: 14px;
}

.dashboard-stack-track span {
  min-width: 3px;
  height: 100%;
}

.dashboard-stack-track span:nth-child(1) {
  background: var(--accent);
}

.dashboard-stack-track span:nth-child(2) {
  background: #24a0ed;
}

.dashboard-stack-track span:nth-child(3) {
  background: #f59e0b;
}

.dashboard-stack-track span:nth-child(4) {
  background: #7c3aed;
}

.dashboard-stack-track span:nth-child(n+5) {
  background: #64748b;
}

.dashboard-stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.dashboard-trend-bars {
  min-height: 210px;
  display: flex;
  gap: 6px;
  align-items: end;
  overflow-x: auto;
  padding: 12px 2px 0;
}

.dashboard-trend-bar {
  flex: 0 0 26px;
  height: 190px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
}

.dashboard-trend-bar span {
  width: 100%;
  min-height: 3px;
  align-self: end;
  border-radius: 6px 6px 2px 2px;
  background: color-mix(in srgb, var(--accent) 72%, #24a0ed);
}

.dashboard-trend-bar small {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.dashboard-general-summary {
  min-height: auto;
}

.dashboard-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  contain: inline-size;
}

.dashboard-table table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: #fffdfa;
}

.dashboard-table th,
.dashboard-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.dashboard-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-table td:first-child {
  max-width: 260px;
  overflow-wrap: anywhere;
  line-height: 1.35;
  white-space: normal;
}

.funnel-health {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.funnel-health .dashboard-card {
  min-height: 68px;
  padding: 9px 10px;
}

.funnel-health .dashboard-card strong {
  font-size: 17px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  height: calc(100vh - 190px);
  min-height: 520px;
  overflow: hidden;
}

body.kanban-detail-open .workspace {
  position: fixed;
  top: 132px;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(680px, calc(100vw - 340px));
  min-width: 480px;
  height: auto;
  min-height: 0;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.34));
}

body.kanban-detail-open .lead-list-panel {
  display: none;
}

body.kanban-detail-open .detail-panel {
  height: 100%;
  max-height: 100%;
  overflow: auto;
}

body.kanban-detail-open .detail-back-button {
  display: inline-flex;
}

.lead-list-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 320px);
  gap: 12px;
  min-height: calc(100vh - 260px);
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-column {
  position: relative;
  min-height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.kanban-column-head {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.kanban-column-head strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.kanban-column-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kanban-cards {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: calc(100vh - 350px);
  min-height: 120px;
  overflow-y: auto;
  padding: 10px;
}

.kanban-cards.drag-over {
  background: var(--soft);
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.kanban-column.drag-over {
  border-color: var(--accent);
}

.kanban-column.drag-over .kanban-cards {
  background: var(--soft);
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.kanban-dragging .kanban-column::after {
  content: attr(data-drop-label);
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  overflow: hidden;
  border: 1px solid rgba(242, 234, 216, 0.12);
  border-radius: 7px;
  background: rgba(7, 8, 6, 0.86);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 6px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-dragging .kanban-column.drop-allowed::after {
  border-color: rgba(99, 212, 113, 0.38);
  color: #b1ff7d;
}

.kanban-dragging .kanban-column.drop-mapped::after {
  border-color: rgba(223, 184, 94, 0.38);
  color: var(--accent-2);
}

.kanban-dragging .kanban-column.drop-blocked {
  opacity: 0.48;
}

.kanban-dragging .kanban-column.drop-blocked::after {
  border-color: rgba(238, 107, 119, 0.42);
  color: #ff97a0;
}

.kanban-column.drag-over-blocked {
  border-color: rgba(238, 107, 119, 0.56);
}

.kanban-column.drag-over-blocked .kanban-cards {
  background: rgba(238, 107, 119, 0.08);
  outline-color: rgba(238, 107, 119, 0.55);
}

.kanban-column.drag-over-mapped .kanban-cards {
  background: rgba(223, 184, 94, 0.08);
  outline-color: rgba(223, 184, 94, 0.55);
}

.kanban-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 8px 9px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(29, 31, 35, 0.08);
}

.kanban-card.is-selected {
  border-color: rgba(99, 212, 113, 0.82);
  box-shadow:
    0 0 0 1px rgba(99, 212, 113, 0.28),
    0 12px 28px rgba(99, 212, 113, 0.12);
}

.kanban-card.is-drag-source {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 18px 40px rgba(29, 31, 35, 0.18);
}

.kanban-dragging {
  cursor: grabbing;
  user-select: none;
}

.kanban-task {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.kanban-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.kanban-loading {
  min-height: calc(100vh - 230px);
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.queue-loading {
  min-height: 220px;
}

.detail-loading {
  min-height: 100%;
}

.kanban-notice {
  position: fixed;
  z-index: 1300;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 28px));
  padding: 13px 14px;
  border: 1px solid rgba(223, 184, 94, 0.32);
  border-radius: 10px;
  background: rgba(13, 16, 13, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.kanban-notice.warn {
  border-color: rgba(223, 184, 94, 0.38);
  color: var(--accent-2);
}

.kanban-notice.ok {
  border-color: rgba(99, 212, 113, 0.42);
  color: var(--accent);
}

.kanban-notice.error {
  border-color: rgba(238, 107, 119, 0.36);
  color: #ff97a0;
}

.intake-shell {
  width: min(720px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 42px 0;
}

.intake-panel {
  padding: 18px;
}

.intake-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.intake-head h1 {
  font-size: 24px;
}

.intake-head p {
  color: var(--muted);
  margin-top: 2px;
}

.intake-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.student-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f7f2;
}

.student-fields[hidden] {
  display: none;
}

.student-fields .wide {
  grid-column: 1 / -1;
}

body:not(.light-theme) .student-fields {
  border-color: rgba(242, 234, 216, 0.12);
  background: rgba(242, 234, 216, 0.035);
}

.intake-form button {
  grid-column: 1 / -1;
  min-height: 44px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.intake-panel .result-box {
  margin-top: 12px;
}

.admin-panel {
  min-height: calc(100vh - 190px);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 14px;
  align-items: start;
}

.admin-section {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
}

.admin-section > :not(.panel-head) {
  margin-inline: 14px;
}

#admin-panel .panel-head {
  height: auto;
  min-height: 48px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding-block: 10px;
}

#admin-panel .panel-head > * {
  min-width: 0;
}

#admin-panel .preflight-panel,
#admin-panel .admin-section > :not(.panel-head) {
  min-width: 0;
  max-width: calc(100% - 28px);
  overflow-x: hidden;
}

#admin-panel .external-grid {
  grid-template-columns: minmax(0, 1fr);
}

#admin-panel .command-copy,
#admin-panel .command-copy code,
#admin-panel .external-resource {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#admin-panel code,
#admin-panel small,
#admin-panel span,
#admin-panel strong,
#admin-panel p {
  overflow-wrap: anywhere;
}

#admin-panel .command-copy code,
#admin-panel .preflight-item code,
#admin-panel .external-resource code {
  white-space: normal;
  word-break: break-word;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.admin-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-status-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffdfa;
}

.admin-status-card.ok {
  border-color: #a7d7c8;
  background: #f2fbf7;
}

.admin-status-card.warn {
  border-color: #f2cc8f;
  background: var(--warn);
}

.admin-status-card span,
.admin-status-card strong {
  display: block;
}

.admin-status-card span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.live-source-form {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 10px;
}

.panel-head.compact {
  min-height: auto;
  padding: 0;
  border-bottom: 0;
}

.live-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.live-source-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-source-grid input,
.live-source-grid select {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
}

.live-source-candidates {
  display: grid;
  gap: 7px;
}

.live-source-status {
  display: grid;
  gap: 7px;
}

.live-source-payload-tools {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.live-source-payload-tools label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-source-payload-tools textarea {
  min-height: 92px;
  max-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.live-source-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.live-source-status-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 8px;
}

.live-source-status-card.sent {
  border-left-color: var(--success);
}

.live-source-status-card.pending {
  border-left-color: var(--warning);
}

.live-source-status-card strong,
.live-source-status-card span,
.live-source-status-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-source-status-card span,
.live-source-status-card small {
  color: var(--muted);
  font-size: 11px;
}

.live-source-status-card strong {
  display: block;
  font-size: 12px;
}

.live-source-status-numbers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.live-source-status-numbers span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 2px 7px;
  color: var(--ink);
  font-size: 11px;
}

.live-source-candidates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.live-source-candidates-head strong {
  font-size: 12px;
}

.live-source-candidates-head small {
  color: var(--muted);
  font-size: 11px;
}

.live-source-candidate-list {
  display: grid;
  gap: 6px;
}

.live-source-candidate {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--success);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 8px;
  text-align: left;
}

.live-source-candidate strong,
.live-source-candidate span,
.live-source-candidate small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-source-candidate span,
.live-source-candidate small {
  color: var(--muted);
  font-size: 11px;
}

.daily-alerts {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 10px;
}

.alerts-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.alert-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.alert-card:hover,
.alert-card:focus-visible {
  border-color: #9aa78b;
  background: #f4f1e8;
  outline: none;
}

.alert-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.alert-card strong {
  font-size: 20px;
}

.alert-card.failed strong {
  color: var(--accent-2);
}

.alert-card.pending strong {
  color: #a16207;
}

.alerts-list {
  display: grid;
  gap: 8px;
}

.alert-bucket {
  display: grid;
  gap: 6px;
}

.alert-row {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #f8f7f2;
  border-radius: 6px;
  padding: 8px;
}

.alert-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.preflight-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 10px;
}

.preflight-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.preflight-list {
  display: grid;
  gap: 6px;
}

.acceptance-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.acceptance-summary-grid .alert-card {
  min-height: 76px;
}

.acceptance-summary-grid .alert-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.preflight-item {
  display: grid;
  gap: 2px;
  border-left: 3px solid var(--line);
  padding: 6px 8px;
  background: #fbfaf7;
}

.preflight-item.fail {
  border-color: var(--accent-2);
}

.preflight-item.warn {
  border-color: #d97706;
}

.preflight-item.info {
  border-color: #2563eb;
}

.preflight-item.pass {
  border-color: var(--accent);
}

.preflight-item strong {
  font-size: 12px;
}

.preflight-item strong small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.preflight-item span {
  color: var(--muted);
  font-size: 12px;
}

.preflight-item code {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
  color: #374151;
  padding: 7px 8px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
}

.command-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.command-copy code {
  min-width: 0;
}

.command-copy button {
  min-height: 32px;
  padding-inline: 9px;
  font-size: 12px;
}

.cutover-current {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f7f2;
  color: var(--muted);
  font-size: 13px;
}

.cutover-current strong {
  color: var(--ink);
}

.cutover-phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.cutover-phase {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 8px;
}

.cutover-phase.pass {
  border-left-color: var(--success);
}

.cutover-phase.warn {
  border-left-color: var(--warning);
}

.cutover-phase.fail {
  border-left-color: var(--danger);
}

.phase-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #efebe2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cutover-phase strong,
.cutover-phase span,
.cutover-phase small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cutover-phase strong {
  font-size: 12px;
  line-height: 1.2;
}

.cutover-phase span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.cutover-phase small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.cutover-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 2px 0 4px;
}

.cutover-fact {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 9px;
}

.cutover-fact span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cutover-fact strong {
  font-size: 18px;
}

.execution-trail {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 9px;
}

.external-unlock-plan {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 9px;
}

.external-unlock-list {
  display: grid;
  gap: 7px;
}

.external-unlock-step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border-left: 3px solid var(--line);
  padding: 7px 8px;
  background: #fbfaf7;
}

.external-unlock-step.pass {
  border-left-color: var(--success);
}

.external-unlock-step.warn {
  border-left-color: var(--warning);
}

.external-unlock-step.fail {
  border-left-color: var(--danger);
}

.external-unlock-step strong,
.external-unlock-step span,
.external-unlock-step small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.external-unlock-step strong {
  color: var(--ink);
  font-size: 12px;
}

.external-unlock-step span,
.external-unlock-step small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.execution-trail-list {
  display: grid;
  gap: 7px;
}

.execution-step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border-left: 3px solid var(--line);
  padding: 7px 8px;
  background: #fffdfa;
}

.execution-step.pass {
  border-left-color: var(--success);
}

.execution-step.warn {
  border-left-color: var(--warning);
}

.execution-step.fail {
  border-left-color: var(--danger);
}

.execution-step strong,
.execution-step span,
.execution-step small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.execution-step strong {
  font-size: 12px;
}

.execution-step span,
.execution-step small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.readiness-recommendation {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.external-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.external-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 9px;
}

.integration-health-live {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 9px;
}

.integration-health-live > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.integration-health-live > strong,
.integration-health-live strong {
  color: var(--ink);
  font-size: 13px;
}

.integration-health-live small,
.integration-health-live > span,
.integration-health-live p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.external-card.pass {
  border-left-color: var(--success);
}

.external-card.warn {
  border-left-color: var(--warning);
}

.external-card.fail {
  border-left-color: var(--danger);
}

.external-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.external-card strong,
.external-card p,
.external-card small,
.external-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-card strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.external-card p {
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.external-card small,
.external-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.external-checks {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
}

.external-resources {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 7px;
}

.external-resource {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.external-resource > div:first-child {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 2px;
  min-width: 0;
}

.external-resource strong,
.external-resource small {
  display: block;
  width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.external-resource strong {
  line-height: 1.15;
}

.external-resource small {
  line-height: 1.3;
}

.external-resource .command-copy.compact {
  margin: 0;
}

.external-resource .command-copy.compact code {
  font-size: 10px;
}

.external-checks li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  min-width: 0;
}

.external-checks li > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.external-checks li.pass > span {
  color: var(--success);
}

.external-checks li.warn > span {
  color: var(--warning);
}

.external-checks li.fail > span {
  color: var(--danger);
}

.external-checks p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.role-release {
  display: grid;
  gap: 9px;
}

.role-release-head {
  display: grid;
  gap: 3px;
}

.role-release-head strong {
  color: var(--ink);
  font-size: 13px;
}

.role-release-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.role-release-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.role-release-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 9px;
}

.role-release-card.production_ready {
  border-left-color: var(--success);
}

.role-release-card.pilot_ready {
  border-left-color: var(--warning);
}

.role-release-card.blocked {
  border-left-color: var(--danger);
}

.role-release-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.role-release-card strong {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.role-release-card small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.role-release-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pilot-package {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 10px;
}

.pilot-package.production_ready {
  border-left-color: var(--success);
}

.pilot-package.pilot_ready {
  border-left-color: var(--warning);
}

.pilot-package.blocked {
  border-left-color: var(--danger);
}

.pilot-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pilot-status-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pilot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pilot-grid section {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.pilot-grid section > strong {
  color: var(--ink);
  font-size: 12px;
}

.pilot-row {
  display: grid;
  gap: 2px;
  min-width: 0;
  border-left: 2px solid var(--line);
  padding-left: 7px;
}

.pilot-row.ready {
  border-left-color: var(--success);
}

.pilot-row.blocked {
  border-left-color: var(--danger);
}

.pilot-row span,
.pilot-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pilot-row span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.pilot-row small,
.pilot-grid p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pilot-grid p {
  margin: 0;
}

.pilot-score-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.pilot-focus-list {
  display: grid;
  gap: 6px;
}

.pilot-focus-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: #fffdfa;
  padding: 8px 10px;
  text-align: left;
}

.pilot-focus-row.fail {
  border-left-color: var(--danger);
}

.pilot-focus-row.warn {
  border-left-color: var(--warning);
}

.pilot-focus-row span,
.pilot-focus-row small {
  overflow-wrap: anywhere;
  white-space: normal;
}

.pilot-focus-row span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.pilot-focus-row small {
  color: var(--muted);
  font-size: 11px;
}

.pilot-check-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.meta-event-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.pilot-check-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 8px;
}

.pilot-check-card.pass {
  border-left-color: var(--success);
}

.pilot-check-card.warn {
  border-left-color: var(--warning);
}

.pilot-check-card.fail {
  border-left-color: var(--danger);
}

.pilot-check-card strong,
.pilot-check-card span,
.pilot-check-card small {
  overflow-wrap: anywhere;
}

.pilot-check-card strong,
.pilot-check-card span {
  white-space: normal;
}

.pilot-check-card strong {
  color: var(--ink);
  font-size: 12px;
}

.pilot-check-card span {
  font-size: 18px;
  font-weight: 800;
}

.pilot-check-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.admin-table {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  contain: inline-size;
  max-height: calc(100vh - 360px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fffdfa;
}

.admin-table th,
.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
}

.admin-table small {
  display: block;
  max-width: 240px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #efebe2;
  color: var(--muted);
  font-size: 12px;
}

.status-pill.sent {
  background: #e6f6ed;
  color: #166534;
}

.status-pill.failed {
  background: #ffe1e7;
  color: var(--accent-2);
}

.status-pill.pending {
  background: #eaf1ff;
  color: #1d4ed8;
}

.plan-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.plan-progress-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 10px;
}

.plan-progress-card span {
  color: var(--muted);
  font-size: 12px;
}

.plan-progress-card strong {
  font-size: 24px;
}

.plan-progress-track {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #efebe2;
}

.plan-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.result-box {
  overflow: auto;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  padding: 12px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.textarea-label {
  color: var(--muted);
  font-size: 13px;
}

.funnel-config-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px;
}

.funnel-config-form label {
  min-width: 0;
}

.funnel-config-form .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.funnel-config-form .checkbox-label input {
  width: 16px;
  height: 16px;
}

.funnel-config-form .wide {
  grid-column: 1 / -1;
}

.funnel-config-form textarea {
  min-height: 120px;
}

.student-import-defaults textarea {
  min-height: 72px;
}

textarea {
  min-height: 300px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  font: 12px/1.45 "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.funnel-config-form textarea {
  min-height: 120px;
}

.empty.compact {
  min-height: 140px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.lead-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: none;
  transition: opacity 160ms ease;
}

.lead-list.is-refreshing {
  opacity: 0.58;
  pointer-events: none;
}

.lead-row {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.lead-row:hover,
.lead-row.active {
  background: #fbfaf7;
}

.lead-list-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.lead-list-tools input {
  width: min(180px, 42vw);
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(7, 8, 6, 0.42);
  color: var(--ink);
  font: 12px/1 "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.lead-list-tools input::placeholder {
  color: var(--muted);
}

.lead-list-tools button {
  min-height: 32px;
  padding: 0 9px;
  font-family: var(--mono);
  font-size: 11px;
}

.lead-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.lead-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #efebe2;
  color: #4b5563;
  font-size: 12px;
  white-space: nowrap;
}

.badge.hot {
  background: #ffe1e7;
  color: var(--accent-2);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.lead-row .meta span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-row .meta .meta-separator {
  flex: 0 0 auto;
  color: var(--line);
  overflow: visible;
}

.lead-list-more {
  display: grid;
  gap: 10px;
  margin: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(7, 8, 6, 0.34);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}

.lead-list-more button {
  justify-self: start;
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.detail-panel {
  padding: 16px;
  overflow: auto;
  min-height: 0;
  max-height: none;
}

.empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detail {
  display: grid;
  gap: 16px;
}

.detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)),
    rgba(13, 16, 13, 0.62);
}

.detail-summary-main {
  min-width: 0;
}

.detail-summary h2 {
  margin: 0;
}

.detail-summary .meta {
  margin: 0;
}

.detail h2 {
  font-size: 22px;
}

.detail-tabs-shell {
  display: grid;
  gap: 12px;
  padding: 10px 0 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.detail-tabs-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.detail-context-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  padding: 0 12px;
  border: 1px solid rgba(109, 40, 217, 0.14);
  border-radius: 999px;
  background: rgba(109, 40, 217, 0.06);
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
}

.detail-context-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.detail-context-text small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.detail-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.detail-tab-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  border-bottom-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.detail-tab-button:hover {
  color: var(--text);
  background: rgba(255, 253, 250, 0.72);
}

.detail-tab-button.active {
  border-color: rgba(15, 23, 42, 0.1);
  border-bottom-color: #f7f3ec;
  background: #f7f3ec;
  color: #111827;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.8) inset;
}

.detail-section-panel {
  display: grid;
  gap: 12px;
}

.lead-answers-panel {
  display: grid;
  gap: 12px;
}

.lead-answer-list {
  display: grid;
  gap: 8px;
}

.lead-answer-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
}

.lead-answer-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(99, 212, 113, 0.12);
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}

.lead-answer-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.lead-answer-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.detail-back-button {
  display: none;
  width: fit-content;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(99, 212, 113, 0.28);
  border-radius: 8px;
  background: rgba(99, 212, 113, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.detail-back-button:hover {
  border-color: rgba(99, 212, 113, 0.46);
  background: rgba(99, 212, 113, 0.18);
  color: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.attribution-panel {
  display: grid;
  gap: 10px;
}

.attribution-grid .field strong {
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.25;
}

.detail-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.detail-form label,
.task-form label,
.task-form input,
.task-form select,
.detail-form input,
.detail-form select,
.detail-form textarea {
  min-width: 0;
  max-width: 100%;
}

.detail-form button {
  align-self: end;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.detail-form textarea {
  min-height: 76px;
  font-family: inherit;
}

.detail-form-wide {
  grid-column: 1 / -1;
}

.student-meta span {
  color: #5f4d21;
  font-weight: 700;
}

.message-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.template-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.template-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.template-empty {
  color: var(--muted);
  font-size: 12px;
}

.message-warning {
  display: grid;
  gap: 5px;
  justify-items: start;
  padding: 10px 12px;
  border: 1px solid rgba(238, 107, 119, 0.3);
  border-radius: 8px;
  background: rgba(238, 107, 119, 0.1);
  color: #ff97a0;
  font-size: 12px;
  font-weight: 700;
}

.message-warning strong {
  color: #ffd1d5;
}

.message-warning small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.inline-text-action {
  min-height: 30px;
  padding: 0 10px;
  border-color: rgba(238, 107, 119, 0.36);
  background: rgba(238, 107, 119, 0.08);
  color: #ffd1d5;
  font-size: 12px;
}

.inline-text-action:hover {
  border-color: rgba(238, 107, 119, 0.56);
  background: rgba(238, 107, 119, 0.13);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.form-actions button {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.form-result {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  min-width: min(220px, 100%);
}

.task-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.detail-notice {
  padding: 10px 12px;
  border: 1px solid rgba(99, 212, 113, 0.26);
  border-radius: 8px;
  background: rgba(99, 212, 113, 0.12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.detail-notice.warn {
  border-color: rgba(223, 184, 94, 0.28);
  background: rgba(223, 184, 94, 0.12);
  color: var(--accent-2);
}

.detail-notice.error {
  border-color: rgba(238, 107, 119, 0.32);
  background: rgba(238, 107, 119, 0.12);
  color: #ff97a0;
}

.detail-empty-state {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  background: #fbfaf7;
}

.app-toast {
  position: fixed;
  z-index: 1400;
  right: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(99, 212, 113, 0.28);
  border-radius: 10px;
  background: rgba(13, 16, 13, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.app-toast.error {
  border-color: rgba(238, 107, 119, 0.36);
  color: #ff97a0;
}

.requirements-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--success);
  border-radius: 8px;
  background: #fffdfa;
}

.requirements-panel.warn {
  border-left-color: var(--warning);
}

.requirements-panel.fail {
  border-left-color: var(--danger);
}

.requirements-list {
  display: grid;
  gap: 10px;
}

.requirement-group {
  display: grid;
  gap: 6px;
}

.requirement-group > strong {
  color: var(--muted);
  font-size: 12px;
}

.requirement-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f7f2;
}

.requirement-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--warning);
}

.requirement-item.fail .requirement-dot {
  background: var(--danger);
}

.requirement-item strong {
  display: block;
  font-size: 13px;
}

.requirement-item small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.requirement-item p,
.requirements-empty {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-head h3 {
  font-size: 15px;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 190px) 190px auto;
  gap: 8px;
}

.task-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.task-form .form-result,
.detail-form .form-actions {
  grid-column: 1 / -1;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f7f2;
  padding: 8px;
}

.task-item.done {
  opacity: 0.72;
}

.field {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffdfa;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-actions button:disabled,
.quick-actions button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.42;
  background: rgba(242, 234, 216, 0.04);
  color: var(--muted-2);
}

.quick-actions .danger-action {
  border-color: rgba(190, 18, 60, 0.36);
  color: var(--danger);
  background: rgba(190, 18, 60, 0.08);
}

.quick-actions .danger-action:hover {
  border-color: rgba(190, 18, 60, 0.56);
  background: rgba(190, 18, 60, 0.14);
}

.topbar-main {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#performance-mode-button,
#run-maintenance,
#logout-button,
#user-badge {
  display: none !important;
}

.quick-action-hint {
  margin-top: -8px;
  padding: 9px 10px;
  border: 1px solid rgba(223, 184, 94, 0.22);
  border-radius: 8px;
  background: rgba(223, 184, 94, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stage-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.82);
}

.stage-inline-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.stage-inline-form select {
  width: 100%;
}

.stage-inline-form .form-result {
  grid-column: 1 / -1;
}

.lead-owner-transfer-form {
  margin: 12px 0;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  background: #f8f7f2;
  border-radius: 0 6px 6px 0;
}

.capi-lead-list {
  display: grid;
  gap: 8px;
}

.capi-lead-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: #f8f7f2;
  padding: 9px 10px;
}

.capi-lead-item.sent {
  border-left-color: var(--success);
}

.capi-lead-item.failed {
  border-left-color: var(--danger);
}

.capi-lead-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 90px;
}

.capi-error {
  color: var(--danger);
  font-size: 12px;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  outline: none;
  overflow: hidden;
}

dialog:focus-visible {
  outline: 2px solid rgba(99, 212, 113, 0.52);
  outline-offset: 3px;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.25);
}

body:not(.light-theme) dialog {
  background: rgba(13, 16, 13, 0.98);
}

body:not(.light-theme) dialog header,
body:not(.light-theme) dialog footer {
  background: rgba(13, 16, 13, 0.98);
}

body:not(.light-theme) dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

dialog form {
  display: grid;
  gap: 10px;
  max-height: calc(100dvh - 64px);
  overflow: auto;
  padding-right: 2px;
}

dialog form:focus {
  outline: none;
}

dialog header,
dialog footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

dialog header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 8px;
  background: var(--panel);
}

.dialog-close-button {
  display: inline-grid;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

dialog footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: 8px;
  background: var(--panel);
}

dialog header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

dialog header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.stage-move-dialog {
  width: min(560px, calc(100vw - 28px));
}

#lead-dialog {
  width: min(760px, calc(100vw - 28px));
}

#lead-form {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.lead-form-fields {
  display: grid;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#lead-form .form-result,
#lead-form .student-fields,
#lead-form .lead-form-fields > label:has(textarea) {
  grid-column: 1 / -1;
}

#lead-form footer {
  position: static;
  margin-top: 2px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.stage-move-fields {
  display: grid;
  gap: 10px;
}

.stage-move-fields textarea {
  min-height: 88px;
  resize: vertical;
}

.form-error {
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: var(--danger);
  padding: 8px 10px;
  font-size: 13px;
}

label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
}

.compact-input {
  width: min(220px, 100%);
  min-width: 150px;
  max-width: 220px;
  min-height: 36px;
}

#funnel-config-select,
#calendar-config-select {
  width: 180px;
  max-width: 100%;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .dialog-close-button,
  dialog footer button,
  dialog input,
  dialog select {
    min-height: 44px;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: min(34vh, 320px);
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .views {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .brand {
    margin-bottom: 10px;
  }

  .view-group {
    gap: 3px;
  }

  .view-group-title {
    padding: 5px 3px 2px;
    font-size: 10px;
  }

  .view-button {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .operational-filter-chip {
    min-height: 44px;
    padding: 9px 12px;
  }

  .lead-list-tools input,
  .lead-list-tools button {
    min-height: 44px;
  }

  .login-box input {
    min-height: 44px;
  }

  .stage-inline-form select,
  .task-form input,
  .task-form select,
  .task-form button,
  .detail-form input,
  .detail-form select,
  .detail-form button {
    min-height: 44px;
  }

  .workspace,
  .dashboard-summary,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .school-period-controls {
    align-items: stretch;
  }

  .school-period-controls label {
    flex: 1 1 150px;
  }

  .dashboard-bar-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .dashboard-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-trend-bar {
    flex-basis: 22px;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .kpi {
    min-height: 74px;
    padding: 9px 10px;
  }

  .kpi span {
    font-size: 10px;
  }

  .kpi strong {
    margin-top: 4px;
    font-size: 21px;
  }

  .mode-switch {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
  }

  .funnel-health {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cutover-phases,
  .cutover-facts,
  .acceptance-summary-grid,
  .external-grid,
  .role-release-grid,
  .pilot-grid,
  .pilot-score-facts,
  .pilot-check-grid {
    grid-template-columns: 1fr;
  }

  .meta-event-grid {
    grid-template-columns: 1fr;
  }

  .command-copy {
    grid-template-columns: 1fr;
  }

  .pilot-focus-row {
    grid-template-columns: 1fr;
  }

  .detail-form,
  .task-form,
  .detail-grid,
  .quick-actions,
  .intake-form,
  .funnel-config-form,
  .student-fields {
    grid-template-columns: 1fr;
  }

  .live-source-status-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .detail-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .detail-back-button {
    display: inline-flex;
    width: fit-content;
    min-height: 32px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid rgba(99, 212, 113, 0.28);
    border-radius: 8px;
    color: var(--accent);
    background: rgba(99, 212, 113, 0.1);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
  }
}

/* Rugido operational dark theme. Keep this layer at the end so the CRM logic
   can stay stable while the visual system follows rugido.com/jornada-v1. */
:root {
  --bg: #070806;
  --bg-2: #0d100d;
  --ink: #f2ead8;
  --muted: rgba(242, 234, 216, 0.68);
  --muted-2: rgba(242, 234, 216, 0.48);
  --line: rgba(242, 234, 216, 0.12);
  --line-strong: rgba(242, 234, 216, 0.2);
  --panel: rgba(20, 24, 18, 0.9);
  --panel-2: rgba(13, 16, 13, 0.92);
  --panel-3: rgba(31, 36, 28, 0.86);
  --accent: #63d471;
  --accent-2: #dfb85e;
  --success: #63d471;
  --danger: #ee6b77;
  --warning: #dfb85e;
  --soft: rgba(99, 212, 113, 0.12);
  --warn: rgba(223, 184, 94, 0.12);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --serif-emphasis: "Instrument Serif", Georgia, serif;
  --shadow-panel: 0 18px 48px rgba(0, 0, 0, 0.34);
  --shadow-green: 0 18px 46px rgba(99, 212, 113, 0.2), 0 0 0 1px rgba(99, 212, 113, 0.08), inset 0 -9px 0 rgba(22, 100, 33, 0.46);
}

html {
  color-scheme: dark;
  background: #070806;
}

body,
body.intake-body {
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -10%, rgba(99, 212, 113, 0.14), transparent 34rem),
    radial-gradient(circle at 88% 10%, rgba(223, 184, 94, 0.1), transparent 28rem),
    linear-gradient(90deg, rgba(242, 234, 216, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(rgba(242, 234, 216, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
    #070806;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 8, 6, 0.1), rgba(7, 8, 6, 0.82) 72%),
    radial-gradient(circle at 52% 105%, rgba(99, 212, 113, 0.08), transparent 30rem);
}

::selection {
  background: rgba(99, 212, 113, 0.28);
  color: var(--ink);
}

h1,
h2,
.panel-head strong,
.brand strong,
.detail h2,
.intake-head h1 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

h1 {
  font-size: clamp(25px, 2.2vw, 36px);
}

h2,
.detail h2 {
  font-size: clamp(21px, 1.6vw, 28px);
}

.detail-summary h2 {
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar p,
.brand small,
.empty,
.form-result,
.template-empty,
.meta,
.kanban-task,
.view-group-title,
.dashboard-card span,
.kpi span,
.dashboard-table th,
.lead-title + .meta,
.panel-head span,
small {
  color: var(--muted);
}

.brand-mark {
  border: 1px solid rgba(223, 184, 94, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(223, 184, 94, 0.18), rgba(223, 184, 94, 0.02)),
    rgba(18, 23, 17, 0.9);
  color: var(--accent-2);
  font-family: var(--serif-emphasis);
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  line-height: 0.78;
  transform: translateY(0.045em) scaleY(1.04);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(7, 8, 6, 0.72);
  backdrop-filter: blur(14px);
}

.shell {
  padding: 24px;
}

.topbar {
  padding: 0 0 4px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border-color: var(--line);
}

button {
  min-height: 38px;
  border-radius: 8px;
  background: rgba(20, 24, 18, 0.82);
  color: var(--ink);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: rgba(242, 234, 216, 0.24);
  background: rgba(31, 36, 28, 0.92);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(99, 212, 113, 0.72);
  outline-offset: 2px;
}

#new-lead-button,
.login-box button[type="submit"],
.intake-form button,
.detail-form button,
.form-actions button {
  min-height: clamp(54px, 6vw, 64px);
  padding: 16px 22px 19px;
  border: 1px solid rgba(99, 212, 113, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.2), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #67da6e 0%, #55cf61 72%, #3eaa45 100%);
  box-shadow: var(--shadow-green);
  color: #061007;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#new-lead-button:hover,
.login-box button[type="submit"]:hover,
.intake-form button:hover,
.detail-form button:hover,
.form-actions button:hover {
  border-color: rgba(177, 255, 125, 0.46);
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.28), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #75e878 0%, #5bd969 72%, #45b64d 100%);
}

.primary-dialog-action {
  min-width: 132px;
  min-height: 46px;
  padding: 12px 20px 14px;
  border: 1px solid rgba(99, 212, 113, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.18), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #67da6e 0%, #55cf61 72%, #3eaa45 100%);
  box-shadow: 0 12px 28px rgba(99, 212, 113, 0.14);
  color: #061007;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.primary-dialog-action:hover {
  border-color: rgba(177, 255, 125, 0.46);
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.26), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #75e878 0%, #5bd969 72%, #45b64d 100%);
}

input,
select,
textarea,
.user-badge,
.compact-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 8, 6, 0.58);
  color: var(--ink);
}

input,
select,
textarea {
  caret-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: rgba(242, 234, 216, 0.3);
  opacity: 1;
}

dialog input::placeholder,
dialog textarea::placeholder {
  color: rgba(242, 234, 216, 0.24);
}

label,
.view-group-title,
.badge,
.count,
.status-pill,
.command-copy,
.kpi span,
.dashboard-card span,
.dashboard-table th,
.live-source-status-numbers span {
  font-family: var(--mono);
}

.view-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.view-button:hover {
  border-color: rgba(242, 234, 216, 0.1);
  background: rgba(242, 234, 216, 0.045);
  color: var(--ink);
}

.view-button.active {
  border-color: rgba(99, 212, 113, 0.38);
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.18), rgba(99, 212, 113, 0.04)),
    rgba(20, 24, 18, 0.72);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

.count,
.badge,
.status-pill {
  border: 1px solid rgba(242, 234, 216, 0.1);
  border-radius: 8px;
  background: rgba(242, 234, 216, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.badge.hot,
.status-pill.failed {
  border-color: rgba(238, 107, 119, 0.28);
  background: rgba(238, 107, 119, 0.12);
  color: #ff97a0;
}

.status-pill.sent,
.status-pill.pass,
.status-pill.production_ready,
.status-pill.ready {
  border-color: rgba(99, 212, 113, 0.28);
  background: rgba(99, 212, 113, 0.13);
  color: var(--accent);
}

.status-pill.pending,
.status-pill.warn,
.status-pill.pilot_ready {
  border-color: rgba(223, 184, 94, 0.3);
  background: rgba(223, 184, 94, 0.13);
  color: var(--accent-2);
}

.panel,
.kpi,
.dashboard-card,
.kanban-column,
.kanban-card,
.detail-form,
.message-form,
.task-panel,
.preflight-item,
.live-source-status-card,
.live-source-candidate,
.pilot-check-card,
.pilot-package,
.role-release-card,
.final-go-live-card,
.cutover-phase,
.alert-card,
.login-box,
.intake-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-panel);
}

.panel-head,
.kanban-column-head {
  border-bottom: 1px solid var(--line);
  background: rgba(13, 16, 13, 0.66);
}

.panel-head strong::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 18px rgba(223, 184, 94, 0.42);
  vertical-align: 0.08em;
}

.mode-switch {
  border-color: var(--line);
  border-radius: 8px;
  background: rgba(7, 8, 6, 0.54);
}

.mode-switch button {
  color: var(--muted);
}

.mode-switch button.active {
  background: rgba(99, 212, 113, 0.16);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.kpi,
.dashboard-card {
  min-height: 82px;
  align-content: center;
}

.kpi strong,
.dashboard-card strong,
.cutover-fact strong,
.pilot-score-fact strong {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.dashboard-card strong,
.kpi strong {
  font-size: clamp(19px, 1.6vw, 25px);
}

.workspace {
  gap: 14px;
}

.lead-row {
  border-bottom-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.lead-row:hover {
  background: rgba(242, 234, 216, 0.045);
}

.lead-row.active {
  background: rgba(99, 212, 113, 0.13);
  box-shadow: inset 3px 0 0 var(--accent);
}

.lead-title strong,
.kanban-card strong,
.live-source-candidate strong,
.preflight-item strong {
  color: var(--ink);
  font-weight: 700;
}

.detail-panel,
.lead-list,
.kanban-cards,
.dashboard-table,
.preflight-panel,
.admin-section > :not(.panel-head) {
  scrollbar-color: rgba(223, 184, 94, 0.46) rgba(242, 234, 216, 0.06);
}

.kanban-board {
  padding-bottom: 16px;
}

.kanban-column {
  background: rgba(13, 16, 13, 0.82);
}

.kanban-card {
  background: rgba(20, 24, 18, 0.88);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.kanban-card:hover {
  border-color: rgba(223, 184, 94, 0.32);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

.kanban-card.is-selected {
  border-color: rgba(99, 212, 113, 0.82);
  box-shadow:
    0 0 0 1px rgba(99, 212, 113, 0.28),
    0 16px 34px rgba(0, 0, 0, 0.26);
}

.kanban-card.is-drag-source {
  border-color: rgba(99, 212, 113, 0.48);
}

.kanban-cards.drag-over,
.kanban-column.drag-over .kanban-cards {
  background: rgba(99, 212, 113, 0.08);
  outline: 2px dashed rgba(99, 212, 113, 0.54);
}

.kanban-empty {
  border-color: rgba(242, 234, 216, 0.14);
  background: rgba(242, 234, 216, 0.03);
  color: var(--muted-2);
}

.kanban-more {
  border: 1px dashed rgba(242, 234, 216, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(7, 8, 6, 0.42);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}

body:not(.light-theme) .dashboard-table table {
  background: rgba(13, 16, 13, 0.86);
}

body:not(.light-theme) .dashboard-table th {
  background: rgba(20, 24, 18, 0.96);
}

body:not(.light-theme) .dashboard-table th,
body:not(.light-theme) .dashboard-table td {
  border-bottom-color: var(--line);
}

.preflight-item,
.live-source-status-card,
.live-source-candidate,
.pilot-check-card,
.alert-card {
  box-shadow: none;
}

.preflight-item.pass,
.live-source-status-card.sent,
.pilot-check-card.pass,
.alert-card.pass {
  border-left-color: var(--success);
}

.preflight-item.warn,
.live-source-status-card.pending,
.pilot-check-card.warn,
.alert-card.warn {
  border-left-color: var(--warning);
}

.preflight-item.fail,
.live-source-status-card.failed,
.pilot-check-card.fail,
.alert-card.fail {
  border-left-color: var(--danger);
}

.result-box,
.command-block,
.command-copy,
code,
pre {
  border-color: rgba(242, 234, 216, 0.12);
  background: rgba(7, 8, 6, 0.68);
  color: rgba(242, 234, 216, 0.82);
  font-family: var(--mono);
}

.command-copy button,
.template-actions button,
.inline-actions button,
#run-maintenance,
#logout-button {
  min-height: 34px;
  padding: 0 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
}

.live-source-payload-tools textarea,
#ghl-import-input,
#student-import-rules-input {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.login-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 212, 113, 0.12), transparent 32rem),
    transparent;
}

.login-box {
  padding: 22px;
}

.intake-shell {
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.intake-panel {
  padding: 18px;
}

.intake-head {
  border-bottom-color: var(--line);
}

.intake-head p {
  color: var(--muted);
}

.student-meta span {
  color: var(--accent-2);
}

.modal {
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(12px);
}

.modal-box {
  border-color: var(--line);
  background: rgba(13, 16, 13, 0.98);
  color: var(--ink);
}

@media (max-width: 980px) {
  body {
    background:
      radial-gradient(circle at 10% -8%, rgba(99, 212, 113, 0.12), transparent 24rem),
      linear-gradient(90deg, rgba(242, 234, 216, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
      linear-gradient(rgba(242, 234, 216, 0.035) 1px, transparent 1px) 0 0 / 72px 72px,
      #070806;
  }

  .shell {
    padding: 16px;
  }

  .sidebar {
    max-height: min(25vh, 210px);
    background: rgba(7, 8, 6, 0.88);
  }

  .actions {
    width: 100%;
  }

  .mode-switch,
  #kanban-pipeline-select,
  #new-lead-button,
  #run-maintenance,
  #logout-button {
    width: 100%;
  }

  .views {
    grid-template-columns: 1fr;
  }

  .workspace {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body.kanban-detail-open .workspace {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    min-width: 0;
    max-width: none;
    z-index: 60;
    padding: 12px;
    background: var(--bg);
    overflow: hidden;
    isolation: isolate;
  }

  body.kanban-detail-open .detail-panel {
    height: 100%;
    max-height: none;
    background: var(--panel);
  }

  .lead-list-panel {
    height: min(52vh, 600px);
    min-height: 320px;
  }

  .lead-list {
    max-height: none;
  }

  .lead-row .lead-title strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.18;
  }

  .lead-row .meta span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .detail-panel {
    height: min(70vh, 760px);
    min-height: 320px;
    max-height: 760px;
    overflow: auto;
  }

  body:not(.mobile-detail-focused):not(.kanban-detail-open) .detail-panel {
    display: none;
  }

  body.mobile-detail-focused .lead-list-panel {
    display: none;
  }

  body.mobile-detail-focused .detail-panel {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .kanban-cards {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    gap: 10px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mode-switch {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }

  .mode-switch button {
    flex: 0 0 auto;
    min-width: 104px;
    min-height: 44px;
    padding-inline: 10px;
    scroll-snap-align: start;
  }

  .actions > button,
  .actions > select,
  .user-badge {
    flex: 1 1 126px;
    min-height: 44px;
  }

  .kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: -2px 0 12px;
    padding: 0;
    overflow: visible;
  }

  .kpi {
    min-height: 56px;
    padding: 8px;
  }

  .kpi span {
    font-size: 9px;
  }

  .kpi strong {
    margin-top: 2px;
    font-size: 17px;
  }

  .dashboard-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head {
    min-height: 48px;
    height: auto;
    gap: 10px;
    padding-block: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  #dashboard-panel .panel-head strong {
    line-height: 1.15;
  }

  .inline-actions {
    width: 100%;
  }

  .inline-actions button {
    flex: 1 1 140px;
  }
}

/* Operational polish pass: CRM actions should stay compact, while the tall
   Jornada-style CTA remains reserved for login/intake surfaces. */
#new-lead-button,
.detail-form button,
.form-actions button {
  min-height: 38px;
  padding: 0 14px;
  border-color: rgba(99, 212, 113, 0.32);
  background:
    linear-gradient(180deg, rgba(99, 212, 113, 0.16), rgba(99, 212, 113, 0.06)),
    rgba(20, 24, 18, 0.9);
  box-shadow: none;
  color: #b1ff7d;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

#new-lead-button:hover,
.detail-form button:hover,
.form-actions button:hover {
  border-color: rgba(99, 212, 113, 0.5);
  background:
    linear-gradient(180deg, rgba(99, 212, 113, 0.22), rgba(99, 212, 113, 0.08)),
    rgba(31, 36, 28, 0.94);
  color: var(--accent);
}

.topbar {
  align-items: center;
}

.actions {
  justify-content: flex-end;
}

.actions > button,
.actions > select,
.user-badge {
  flex: 0 0 auto;
}

/* Kanban columns should scroll as whole operational lanes; cards stay fully
   contained inside each lane instead of appearing half-cut at viewport edges. */
.kanban-board {
  display: flex;
  gap: 14px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 18px 18px 2px;
  scroll-padding-inline: 2px 18px;
  scroll-snap-type: x proximity;
}

.kanban-column {
  flex: 0 0 var(--kanban-column-width, clamp(286px, calc((100% - 28px) / 3), 360px));
  min-width: var(--kanban-column-width, 286px);
  max-width: var(--kanban-column-width, 360px);
  overflow: hidden;
  scroll-snap-align: start;
}

.kanban-cards {
  min-width: 0;
  overflow-x: hidden;
  padding: 12px;
}

.kanban-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.kanban-card .lead-title,
.kanban-card .meta {
  min-width: 0;
}

.kanban-card .lead-title {
  align-items: flex-start;
}

.kanban-card .lead-title strong {
  min-width: 0;
  overflow: visible;
  line-height: 1.16;
  text-overflow: clip;
  white-space: normal;
}

.kanban-card .badge {
  flex: 0 0 auto;
}

.kanban-card .badge.owner {
  background: rgba(99, 212, 113, 0.16);
  color: var(--accent);
}

.kanban-card .kanban-meta-badges {
  gap: 5px;
}

.kanban-card .kanban-meta-context {
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.kanban-card .kanban-meta-context span:not(:last-child)::after {
  content: '·';
  margin-left: 5px;
}

.kanban-card strong,
.kanban-card span,
.kanban-card small,
.kanban-task {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Dark-mode detail surfaces: remove legacy light cards from operational panels. */
.detail .task-panel,
.detail .requirements-panel,
.detail .field,
.detail .timeline-item,
.detail .capi-lead-item {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)),
    rgba(13, 16, 13, 0.82);
  color: var(--ink);
}

.detail .requirements-panel {
  border-left-color: var(--success);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

.detail .requirements-panel.warn {
  border-left-color: var(--warning);
}

.detail .requirements-panel.fail {
  border-left-color: var(--danger);
  background:
    linear-gradient(90deg, rgba(238, 107, 119, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)),
    rgba(13, 16, 13, 0.86);
}

.detail .requirement-item,
.detail .task-item {
  border-color: rgba(242, 234, 216, 0.11);
  background: rgba(7, 8, 6, 0.48);
  color: var(--ink);
}

.detail .requirement-item.fail {
  border-color: rgba(238, 107, 119, 0.26);
  background: rgba(238, 107, 119, 0.08);
}

.detail .requirement-group > strong,
.detail .requirement-item small,
.detail .requirement-item p,
.detail .requirements-empty,
.detail .task-item .meta,
.detail .field span,
.detail .timeline-item .meta {
  color: var(--muted);
}

.detail .requirement-item strong,
.detail .task-item strong,
.detail .field strong,
.detail .timeline-item strong,
.detail .capi-lead-item strong {
  color: var(--ink);
}

.detail .task-item.done {
  opacity: 0.66;
}

/* Admin dark-mode sweep: legacy light operational blocks. */
body:not(.light-theme) .admin-panel .admin-status-card,
body:not(.light-theme) .admin-panel .preflight-panel,
body:not(.light-theme) .admin-panel .daily-alerts,
body:not(.light-theme) .admin-panel .live-source-form,
body:not(.light-theme) .admin-panel .live-source-status-card,
body:not(.light-theme) .admin-panel .live-source-candidate,
body:not(.light-theme) .admin-panel .alert-card,
body:not(.light-theme) .admin-panel .alert-row,
body:not(.light-theme) .admin-panel .cutover-current,
body:not(.light-theme) .admin-panel .cutover-phase,
body:not(.light-theme) .admin-panel .cutover-fact,
body:not(.light-theme) .admin-panel .external-unlock-step,
body:not(.light-theme) .admin-panel .external-card,
body:not(.light-theme) .admin-panel .external-resource,
body:not(.light-theme) .admin-panel .pilot-focus-row,
body:not(.light-theme) .admin-panel .pilot-check-card,
body:not(.light-theme) .admin-panel .plan-progress-card,
body:not(.light-theme) .admin-panel .admin-table,
body:not(.light-theme) .admin-panel .funnel-config-form,
body:not(.light-theme) .admin-panel .result-box {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)),
    rgba(13, 16, 13, 0.82);
  color: var(--ink);
}

body:not(.light-theme) .admin-panel .admin-status-card.ok,
body:not(.light-theme) .admin-panel .live-source-status-card.sent,
body:not(.light-theme) .admin-panel .preflight-item.pass,
body:not(.light-theme) .admin-panel .cutover-phase.pass,
body:not(.light-theme) .admin-panel .external-unlock-step.pass,
body:not(.light-theme) .admin-panel .external-card.pass,
body:not(.light-theme) .admin-panel .pilot-check-card.pass {
  border-color: rgba(99, 212, 113, 0.22);
  border-left-color: var(--success);
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.1), transparent 34%),
    rgba(13, 16, 13, 0.84);
}

body:not(.light-theme) .admin-panel .admin-status-card.warn,
body:not(.light-theme) .admin-panel .live-source-status-card.pending,
body:not(.light-theme) .admin-panel .preflight-item.warn,
body:not(.light-theme) .admin-panel .cutover-phase.warn,
body:not(.light-theme) .admin-panel .external-unlock-step.warn,
body:not(.light-theme) .admin-panel .external-card.warn,
body:not(.light-theme) .admin-panel .pilot-check-card.warn,
body:not(.light-theme) .admin-panel .alert-card.pending,
body:not(.light-theme) .admin-panel .pilot-focus-row.warn {
  border-color: rgba(223, 184, 94, 0.28);
  border-left-color: var(--warning);
  background:
    linear-gradient(90deg, rgba(223, 184, 94, 0.1), transparent 34%),
    rgba(13, 16, 13, 0.84);
}

body:not(.light-theme) .admin-panel .preflight-item.fail,
body:not(.light-theme) .admin-panel .cutover-phase.fail,
body:not(.light-theme) .admin-panel .external-unlock-step.fail,
body:not(.light-theme) .admin-panel .external-card.fail,
body:not(.light-theme) .admin-panel .pilot-check-card.fail,
body:not(.light-theme) .admin-panel .alert-card.failed,
body:not(.light-theme) .admin-panel .pilot-focus-row.fail {
  border-color: rgba(238, 107, 119, 0.3);
  border-left-color: var(--danger);
  background:
    linear-gradient(90deg, rgba(238, 107, 119, 0.11), transparent 34%),
    rgba(13, 16, 13, 0.86);
}

body:not(.light-theme) .admin-panel .preflight-item,
body:not(.light-theme) .admin-panel .acceptance-summary-grid .alert-card,
body:not(.light-theme) .admin-panel .live-source-status-numbers span,
body:not(.light-theme) .admin-panel .phase-index,
body:not(.light-theme) .admin-panel .status-pill,
body:not(.light-theme) .admin-panel .plan-progress-track,
body:not(.light-theme) .admin-panel .preflight-item code {
  border-color: rgba(242, 234, 216, 0.11);
  background: rgba(7, 8, 6, 0.5);
  color: var(--muted);
}

.admin-panel .admin-table table,
.admin-panel .admin-table th {
  background: transparent;
}

.admin-panel .admin-table td,
.admin-panel .admin-table th {
  border-bottom-color: rgba(242, 234, 216, 0.08);
}

.admin-panel .status-pill.sent {
  background: rgba(99, 212, 113, 0.14);
  color: #b1ff7d;
}

.admin-panel .status-pill.failed {
  background: rgba(238, 107, 119, 0.14);
  color: #ff9ca6;
}

.admin-panel .status-pill.pending {
  background: rgba(223, 184, 94, 0.14);
  color: var(--accent-2);
}

.admin-panel .admin-status-card.loading {
  border-style: dashed;
  opacity: 0.62;
}

.admin-panel .admin-status-card.loading strong {
  color: var(--muted);
}

.admin-panel input,
.admin-panel select,
.admin-panel textarea,
.admin-panel .live-source-grid input,
.admin-panel .live-source-grid select,
.admin-panel .funnel-config-form textarea {
  border-color: var(--line);
  background: rgba(7, 8, 6, 0.6);
  color: var(--ink);
}

.admin-panel input::placeholder,
.admin-panel textarea::placeholder {
  color: rgba(242, 234, 216, 0.42);
}

.admin-panel .admin-status-card span,
.admin-panel .dashboard-card span,
.admin-panel .preflight-item span,
.admin-panel .preflight-item strong small,
.admin-panel .cutover-current,
.admin-panel .cutover-phase span,
.admin-panel .cutover-phase small,
.admin-panel .cutover-fact span,
.admin-panel .external-card p,
.admin-panel .external-card small,
.admin-panel .external-card span,
.admin-panel .external-checks p,
.admin-panel .external-unlock-step span,
.admin-panel .external-unlock-step small,
.admin-panel .pilot-focus-row small,
.admin-panel .pilot-check-card small,
.admin-panel .plan-progress-card span,
.admin-panel .admin-table small,
.admin-panel .live-source-status-card span,
.admin-panel .live-source-status-card small,
.admin-panel .live-source-candidate span,
.admin-panel .live-source-candidate small,
.admin-panel .alert-card span,
.admin-panel .alert-row small {
  color: var(--muted);
}

.admin-panel .admin-status-card strong,
.admin-panel .preflight-item strong,
.admin-panel .cutover-current strong,
.admin-panel .cutover-phase strong,
.admin-panel .cutover-fact strong,
.admin-panel .external-card strong,
.admin-panel .external-unlock-step strong,
.admin-panel .pilot-focus-row span,
.admin-panel .pilot-check-card strong,
.admin-panel .pilot-check-card span,
.admin-panel .plan-progress-card strong,
.admin-panel .admin-table td,
.admin-panel .live-source-status-card strong,
.admin-panel .live-source-candidate strong,
.admin-panel .alert-card strong,
.admin-panel .alert-row strong {
  color: var(--ink);
}

/* Admin hardening: some legacy widgets still carry old light-card tokens.
   Keep every operational Admin surface in the Rugido dark system. */
body:not(.light-theme) #admin-panel .admin-status-card,
body:not(.light-theme) #admin-panel .preflight-panel,
body:not(.light-theme) #admin-panel .preflight-panel > *,
body:not(.light-theme) #admin-panel .cutover-fact,
body:not(.light-theme) #admin-panel .cutover-facts > *,
body:not(.light-theme) #admin-panel .acceptance-summary-grid > *,
body:not(.light-theme) #admin-panel .meta-event-grid > *,
body:not(.light-theme) #admin-panel .pilot-grid > *,
body:not(.light-theme) #admin-panel .pilot-score-facts > *,
body:not(.light-theme) #admin-panel .plan-progress-grid > *,
body:not(.light-theme) #admin-panel .role-release,
body:not(.light-theme) #admin-panel .role-release-card,
body:not(.light-theme) #admin-panel .pilot-package,
body:not(.light-theme) #admin-panel .pilot-row,
body:not(.light-theme) #admin-panel .execution-trail,
body:not(.light-theme) #admin-panel .execution-step,
body:not(.light-theme) #admin-panel .external-unlock-plan,
body:not(.light-theme) #admin-panel .admin-table,
body:not(.light-theme) #admin-panel .admin-table *,
body:not(.light-theme) #admin-panel .result-box,
body:not(.light-theme) #admin-panel .daily-alerts,
body:not(.light-theme) #admin-panel .daily-alerts > *,
body:not(.light-theme) #admin-panel .live-source-form,
body:not(.light-theme) #admin-panel .live-source-form > *,
body:not(.light-theme) #admin-panel .external-card,
body:not(.light-theme) #admin-panel .external-resource,
body:not(.light-theme) #admin-panel .external-unlock-step,
body:not(.light-theme) #admin-panel .pilot-check-card,
body:not(.light-theme) #admin-panel .pilot-focus-row,
body:not(.light-theme) #admin-panel .plan-progress-card,
body:not(.light-theme) #admin-panel .funnel-config-form {
  background-color: rgba(13, 16, 13, 0.82) !important;
  color: var(--ink) !important;
}

body:not(.light-theme) #admin-panel .admin-status-card,
body:not(.light-theme) #admin-panel .preflight-panel,
body:not(.light-theme) #admin-panel .cutover-fact,
body:not(.light-theme) #admin-panel .cutover-facts > *,
body:not(.light-theme) #admin-panel .acceptance-summary-grid > *,
body:not(.light-theme) #admin-panel .meta-event-grid > *,
body:not(.light-theme) #admin-panel .pilot-grid > *,
body:not(.light-theme) #admin-panel .pilot-score-facts > *,
body:not(.light-theme) #admin-panel .plan-progress-grid > *,
body:not(.light-theme) #admin-panel .role-release,
body:not(.light-theme) #admin-panel .role-release-card,
body:not(.light-theme) #admin-panel .pilot-package,
body:not(.light-theme) #admin-panel .pilot-row,
body:not(.light-theme) #admin-panel .execution-trail,
body:not(.light-theme) #admin-panel .execution-step,
body:not(.light-theme) #admin-panel .external-unlock-plan,
body:not(.light-theme) #admin-panel .admin-table,
body:not(.light-theme) #admin-panel .result-box,
body:not(.light-theme) #admin-panel .daily-alerts > *,
body:not(.light-theme) #admin-panel .external-card,
body:not(.light-theme) #admin-panel .external-resource,
body:not(.light-theme) #admin-panel .external-unlock-step,
body:not(.light-theme) #admin-panel .pilot-check-card,
body:not(.light-theme) #admin-panel .pilot-focus-row,
body:not(.light-theme) #admin-panel .plan-progress-card,
body:not(.light-theme) #admin-panel .funnel-config-form {
  border-color: rgba(242, 234, 216, 0.12) !important;
  background-image:
    linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)) !important;
}

#admin-panel .admin-table {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

#admin-panel .admin-table table {
  min-width: 860px;
}

#admin-panel .admin-table th,
#admin-panel .admin-table td {
  background-color: transparent !important;
}

body:not(.light-theme) #admin-panel .admin-status-card.ok,
body:not(.light-theme) #admin-panel .preflight-item.pass,
body:not(.light-theme) #admin-panel .external-card.pass,
body:not(.light-theme) #admin-panel .external-unlock-step.pass,
body:not(.light-theme) #admin-panel .pilot-check-card.pass {
  background-color: rgba(13, 16, 13, 0.86) !important;
  background-image: linear-gradient(90deg, rgba(99, 212, 113, 0.1), transparent 34%) !important;
}

body:not(.light-theme) #admin-panel .admin-status-card.warn,
body:not(.light-theme) #admin-panel .preflight-item.warn,
body:not(.light-theme) #admin-panel .external-card.warn,
body:not(.light-theme) #admin-panel .external-unlock-step.warn,
body:not(.light-theme) #admin-panel .pilot-check-card.warn,
body:not(.light-theme) #admin-panel .alert-card.pending {
  background-color: rgba(13, 16, 13, 0.86) !important;
  background-image: linear-gradient(90deg, rgba(223, 184, 94, 0.1), transparent 34%) !important;
}

#admin-panel span,
#admin-panel small,
#admin-panel p,
#admin-panel code {
  color: var(--muted) !important;
}

#admin-panel strong,
#admin-panel h3,
#admin-panel td,
#admin-panel th,
#admin-panel label {
  color: var(--ink) !important;
}

body:not(.light-theme) #admin-panel .preflight-panel [class],
body:not(.light-theme) #admin-panel .admin-section [class*="card"],
body:not(.light-theme) #admin-panel .admin-section [class*="fact"],
body:not(.light-theme) #admin-panel .admin-section [class*="row"],
body:not(.light-theme) #admin-panel .admin-section [class*="package"],
body:not(.light-theme) #admin-panel .admin-section [class*="release"],
body:not(.light-theme) #admin-panel .admin-section [class*="trail"],
body:not(.light-theme) #admin-panel .admin-section [class*="current"],
body:not(.light-theme) #admin-panel .admin-section [class*="recommendation"] {
  background-color: rgba(13, 16, 13, 0.78) !important;
}

body:not(.light-theme) #admin-panel .admin-section [class*="grid"] {
  background-color: transparent !important;
}

body:not(.light-theme) #admin-panel .status-pill,
body:not(.light-theme) #admin-panel button,
body:not(.light-theme) #admin-panel input,
body:not(.light-theme) #admin-panel select,
body:not(.light-theme) #admin-panel textarea,
body:not(.light-theme) #admin-panel .phase-index,
body:not(.light-theme) #admin-panel .plan-progress-track,
body:not(.light-theme) #admin-panel .command-copy {
  background-color: rgba(7, 8, 6, 0.58) !important;
}

@media (max-width: 980px) {
  .kanban-board {
    gap: 12px;
    padding-right: 16px;
    scroll-snap-type: x mandatory;
  }

  .kanban-column {
    flex-basis: min(360px, calc(100vw - 34px));
    min-width: min(360px, calc(100vw - 34px));
    max-width: min(360px, calc(100vw - 34px));
  }

  #admin-panel button {
    min-height: 44px;
    padding-block: 9px;
  }

  #admin-panel input,
  #admin-panel select,
  #admin-panel textarea {
    min-height: 44px;
  }
}

@media (max-width: 620px) {
  .panel-head strong {
    display: block;
    line-height: 1.15;
    padding-bottom: 1px;
  }

  #admin-panel .panel-head strong {
    line-height: inherit;
    padding-bottom: inherit;
  }

  #admin-panel .live-source-status-grid {
    grid-template-columns: 1fr;
  }

  #admin-panel .live-source-status-card {
    align-content: start;
  }

  #admin-panel .live-source-status-card > div:first-child {
    min-width: 0;
  }

  #admin-panel .external-resource > div:first-child {
    display: grid;
    justify-content: stretch;
    gap: 2px;
  }

  #admin-panel .external-resource strong,
  #admin-panel .external-resource small {
    display: block;
    width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  #admin-panel .external-resource strong {
    line-height: 1.15;
  }

  #admin-panel .external-resource small,
  #admin-panel .cutover-phase small {
    line-height: 1.3;
  }

  #admin-panel .cutover-phase strong,
  #admin-panel .cutover-phase span,
  #admin-panel .cutover-phase small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  #admin-panel .cutover-phase small {
    display: block;
    -webkit-line-clamp: unset;
  }

  .topbar {
    align-items: stretch;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .topbar p {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.25;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }

  .mode-switch {
    display: grid;
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mode-switch button {
    min-width: 0;
    padding-inline: 4px;
    font-size: 12px;
    text-align: center;
  }

  #lead-form {
    grid-template-columns: 1fr;
  }

  .kanban-context {
    grid-template-columns: 1fr;
  }

  .dashboard-table table {
    min-width: 0;
    table-layout: fixed;
  }

  .dashboard-table th,
  .dashboard-table td {
    padding: 8px 6px;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .dashboard-table th {
    font-size: 10px;
  }

  .dashboard-table td:first-child {
    max-width: none;
    white-space: normal;
  }

  #admin-panel .admin-table {
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    background-image: none !important;
  }

  #admin-panel .admin-table table,
  #admin-panel .admin-table thead,
  #admin-panel .admin-table tbody,
  #admin-panel .admin-table tr,
  #admin-panel .admin-table th,
  #admin-panel .admin-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  #admin-panel .admin-table table {
    border-collapse: separate;
    border-spacing: 0;
    background: transparent !important;
  }

  #admin-panel .admin-table thead {
    position: absolute;
    width: 1px !important;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  #admin-panel .admin-table thead,
  #admin-panel .admin-table thead * {
    display: none !important;
  }

  #admin-panel .admin-table tbody {
    display: grid;
    gap: 10px;
  }

  #admin-panel .admin-table tr {
    display: grid;
    gap: 7px;
    border: 1px solid rgba(242, 234, 216, 0.12);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(242, 234, 216, 0.035), rgba(242, 234, 216, 0.012)),
      rgba(13, 16, 13, 0.82) !important;
    padding: 10px;
  }

  #admin-panel .admin-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border: 0 !important;
    padding: 0 !important;
    overflow-wrap: anywhere;
    font-size: 12px;
  }

  #admin-panel .admin-table td:empty {
    display: none;
  }

  #admin-panel .admin-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  #admin-panel .admin-table small {
    max-width: none;
    white-space: normal;
  }

  .lead-list-panel .panel-head {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .lead-list-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    justify-content: stretch;
  }

  .lead-list-tools input {
    width: 100%;
  }

  .workspace {
    padding-bottom: min(70vh, 680px);
  }

  #lead-count {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .actions > button,
  .actions > select,
  .user-badge {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: normal;
    line-height: 1.15;
  }

  #run-maintenance {
    font-size: 11px;
  }

  #kanban-pipeline-select {
    grid-column: 1 / -1;
  }

  .user-badge {
    display: none;
  }

  #new-lead-button {
    min-height: 44px;
  }

  .kanban-column {
    flex-basis: calc(100vw - 58px);
    min-width: calc(100vw - 58px);
    max-width: calc(100vw - 58px);
  }

  .kanban-notice {
    right: 14px;
    bottom: 14px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-actions button {
    min-height: 44px;
    padding: 0 8px;
    white-space: normal;
    line-height: 1.15;
  }

  .detail-form button,
  .form-actions button,
  .task-form button,
  .task-item button,
  .template-actions button,
  .inline-text-action,
  .stage-inline-form button,
  #new-lead-button,
  .detail-back-button {
    min-height: 44px;
  }

  .admin-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-status-card strong {
    font-size: 15px;
    line-height: 1.15;
    overflow-wrap: normal;
    word-break: normal;
  }

  #admin-panel .live-source-status-card strong,
  #admin-panel .live-source-status-card span,
  #admin-panel .live-source-status-card small {
    display: block;
    width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }

  #admin-panel .live-source-status-card small {
    line-height: 1.3;
  }
}

/* Reversible operational performance mode.
   Keeps the Rugido dark identity, but removes expensive paint effects from dense CRM surfaces. */
body.performance-mode {
  background:
    linear-gradient(rgba(242, 234, 216, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 234, 216, 0.018) 1px, transparent 1px),
    #070806 !important;
  background-size: 96px 96px !important;
}

body.performance-mode *,
body.performance-mode *::before,
body.performance-mode *::after {
  transition-duration: 0ms !important;
  animation: none !important;
}

body.performance-mode .sidebar,
body.performance-mode .topbar,
body.performance-mode .panel,
body.performance-mode .lead-row,
body.performance-mode .lead-list-panel,
body.performance-mode .detail-panel,
body.performance-mode .dashboard-card,
body.performance-mode .dashboard-section,
body.performance-mode .admin-section,
body.performance-mode .preflight-panel,
body.performance-mode .kanban-column,
body.performance-mode .kanban-card,
body.performance-mode .task-panel,
body.performance-mode .requirements-panel {
  backdrop-filter: none !important;
  box-shadow: none !important;
  background-image: none !important;
}

body.performance-mode .kanban-board {
  gap: 10px !important;
}

body.performance-mode .kanban-column {
  background: rgba(10, 13, 10, 0.96) !important;
  border-color: rgba(242, 234, 216, 0.1) !important;
}

body.performance-mode .kanban-column-head {
  min-height: 64px;
  background: rgba(12, 15, 12, 0.98) !important;
}

body.performance-mode .kanban-card {
  padding: 12px 13px !important;
  background: rgba(14, 18, 14, 0.98) !important;
  border-color: rgba(242, 234, 216, 0.1) !important;
}

body.performance-mode .kanban-card:hover {
  border-color: rgba(99, 212, 113, 0.36) !important;
  box-shadow: none !important;
}

body.performance-mode .kanban-card.is-selected {
  border-color: rgba(99, 212, 113, 0.82) !important;
  box-shadow: 0 0 0 1px rgba(99, 212, 113, 0.3) !important;
}

body.performance-mode .kanban-card .meta,
body.performance-mode .kanban-task {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

body.performance-mode .kanban-card .kanban-meta-financial {
  display: none !important;
}

body.performance-mode .kanban-drag-ghost {
  box-shadow: none !important;
  opacity: 0.94;
  will-change: transform;
}

body.performance-mode .view-button,
body.performance-mode button,
body.performance-mode select,
body.performance-mode input,
body.performance-mode textarea,
body.performance-mode .user-badge,
body.performance-mode .count,
body.performance-mode .badge {
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* Explicit light theme. This lives after the dark/performance layers so the
   toggle can switch the whole CRM without touching the operational markup. */
body.light-theme {
  --bg: #f4f1e8;
  --bg-2: #fffdf7;
  --ink: #182018;
  --muted: rgba(24, 32, 24, 0.68);
  --muted-2: rgba(24, 32, 24, 0.48);
  --line: rgba(24, 32, 24, 0.14);
  --line-strong: rgba(24, 32, 24, 0.24);
  --panel: rgba(255, 253, 247, 0.92);
  --panel-2: rgba(246, 242, 232, 0.94);
  --panel-3: rgba(238, 233, 220, 0.9);
  --accent: #238a3b;
  --accent-2: #a77a21;
  --success: #238a3b;
  --danger: #c9384a;
  --warning: #a77a21;
  --soft: rgba(35, 138, 59, 0.12);
  --warn: rgba(167, 122, 33, 0.13);
  --shadow-panel: 0 16px 42px rgba(46, 39, 24, 0.1);
  --shadow-green: 0 14px 30px rgba(35, 138, 59, 0.14), 0 0 0 1px rgba(35, 138, 59, 0.08), inset 0 -7px 0 rgba(18, 100, 33, 0.28);
  color-scheme: light;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -10%, rgba(99, 212, 113, 0.16), transparent 34rem),
    radial-gradient(circle at 88% 10%, rgba(223, 184, 94, 0.13), transparent 28rem),
    linear-gradient(90deg, rgba(24, 32, 24, 0.045) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(rgba(24, 32, 24, 0.045) 1px, transparent 1px) 0 0 / 72px 72px,
    #f4f1e8 !important;
}

body.light-theme::before {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.12), rgba(244, 241, 232, 0.68) 76%),
    radial-gradient(circle at 52% 105%, rgba(99, 212, 113, 0.11), transparent 30rem) !important;
}

body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme .panel-head strong,
body.light-theme .brand strong,
body.light-theme .detail h2 {
  color: var(--ink);
}

body.light-theme .topbar p,
body.light-theme .brand small,
body.light-theme .empty,
body.light-theme .form-result,
body.light-theme .template-empty,
body.light-theme .meta,
body.light-theme .kanban-task,
body.light-theme .view-group-title,
body.light-theme .dashboard-card span,
body.light-theme .kpi span,
body.light-theme .dashboard-table th,
body.light-theme .panel-head span,
body.light-theme small {
  color: var(--muted);
}

body.light-theme .sidebar,
body.light-theme .panel,
body.light-theme .lead-list-panel,
body.light-theme .detail-panel,
body.light-theme .detail,
body.light-theme .detail-summary,
body.light-theme .dashboard-section,
body.light-theme .admin-section,
body.light-theme .preflight-panel,
body.light-theme .task-panel,
body.light-theme .requirements-panel,
body.light-theme .kanban-column,
body.light-theme .kanban-card,
body.light-theme .lead-row,
body.light-theme .timeline-item,
body.light-theme .field,
body.light-theme .task-item,
body.light-theme .capi-lead-item,
body.light-theme .dashboard-card,
body.light-theme dialog,
body.light-theme .login-box {
  border-color: var(--line) !important;
  background: var(--panel) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-panel);
}

body.light-theme .sidebar {
  background: rgba(255, 253, 247, 0.86) !important;
  backdrop-filter: blur(12px);
}

body.light-theme .topbar {
  background: transparent !important;
  box-shadow: none;
}

body.light-theme .brand-mark {
  border-color: rgba(167, 122, 33, 0.28);
  background:
    linear-gradient(180deg, rgba(223, 184, 94, 0.22), rgba(223, 184, 94, 0.04)),
    rgba(255, 253, 247, 0.94) !important;
  color: var(--accent-2);
}

body.light-theme button,
body.light-theme select,
body.light-theme input,
body.light-theme textarea,
body.light-theme .user-badge,
body.light-theme .compact-input {
  border-color: var(--line);
  background: rgba(255, 253, 247, 0.86);
  color: var(--ink);
}

body.light-theme button:hover {
  border-color: rgba(35, 138, 59, 0.3);
  background: rgba(246, 242, 232, 0.96);
}

body.light-theme input::placeholder,
body.light-theme textarea::placeholder {
  color: rgba(24, 32, 24, 0.38);
}

body.light-theme .view-button {
  border-color: rgba(24, 32, 24, 0.08);
  background: rgba(255, 253, 247, 0.46) !important;
  color: rgba(24, 32, 24, 0.72);
  box-shadow: none;
}

body.light-theme .view-button:hover {
  border-color: rgba(24, 32, 24, 0.12);
  background: rgba(24, 32, 24, 0.045) !important;
  color: var(--ink);
}

body.light-theme .view-button.active,
body.light-theme .mode-switch button.active,
body.light-theme #theme-mode-button.active,
body.light-theme #performance-mode-button.active {
  border-color: rgba(35, 138, 59, 0.32) !important;
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.22), rgba(99, 212, 113, 0.06)),
    rgba(255, 253, 247, 0.92) !important;
  color: #102012;
  box-shadow: inset 3px 0 0 var(--accent);
}

body.light-theme .mode-switch {
  border-color: var(--line);
  background: rgba(255, 253, 247, 0.7);
}

body.light-theme #new-lead-button,
body.light-theme .login-box button[type="submit"],
body.light-theme .intake-form button,
body.light-theme .detail-form button,
body.light-theme .form-actions button {
  border-color: rgba(35, 138, 59, 0.3);
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.28), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #67da6e 0%, #55cf61 72%, #3eaa45 100%) !important;
  color: #061007;
  box-shadow: var(--shadow-green);
}

body.light-theme .count,
body.light-theme .badge,
body.light-theme .status-pill {
  border-color: var(--line);
  background: rgba(24, 32, 24, 0.055);
  color: var(--muted);
}

body.light-theme .kpi,
body.light-theme .dashboard-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(246, 242, 232, 0.9)) !important;
}

body.light-theme .kanban-board {
  scrollbar-color: rgba(167, 122, 33, 0.45) rgba(24, 32, 24, 0.08);
}

body.light-theme .kanban-loading {
  border-color: var(--line);
  background: rgba(255, 253, 247, 0.72);
}

body.light-theme .kanban-notice {
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 18px 42px rgba(46, 39, 24, 0.16);
}

body.light-theme .kanban-column-head {
  border-color: var(--line);
  background: rgba(246, 242, 232, 0.82) !important;
}

body.light-theme .panel-head {
  border-color: var(--line);
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.12), rgba(223, 184, 94, 0.04)),
    rgba(246, 242, 232, 0.86) !important;
  color: var(--ink);
}

body.light-theme .detail-summary {
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.1), rgba(223, 184, 94, 0.04)),
    rgba(255, 253, 247, 0.92) !important;
}

body.light-theme .stage-inline-form {
  border-color: var(--line);
  background:
    linear-gradient(90deg, rgba(24, 32, 24, 0.05), rgba(99, 212, 113, 0.04)),
    rgba(246, 242, 232, 0.82) !important;
  color: var(--ink);
}

body.light-theme .kanban-dropzone {
  border-color: rgba(24, 32, 24, 0.1);
  background: rgba(24, 32, 24, 0.025);
}

body.light-theme .kanban-dropzone.drag-over {
  border-color: rgba(35, 138, 59, 0.42);
  background: rgba(99, 212, 113, 0.12);
}

body.light-theme .kanban-drag-ghost {
  background: #fffdf7 !important;
  color: var(--ink) !important;
  border-color: rgba(35, 138, 59, 0.38) !important;
  box-shadow: 0 18px 40px rgba(46, 39, 24, 0.16);
}

body.light-theme .requirement-item,
body.light-theme .preflight-item,
body.light-theme .admin-panel .preflight-item,
body.light-theme #admin-panel .preflight-item,
body.light-theme .requirements-empty {
  border-color: var(--line) !important;
  background: rgba(246, 242, 232, 0.78) !important;
  color: var(--ink) !important;
}

body.light-theme .requirement-item.fail,
body.light-theme .preflight-item.fail,
body.light-theme #admin-panel .preflight-item.fail {
  border-color: rgba(201, 56, 74, 0.32) !important;
  background:
    linear-gradient(90deg, rgba(201, 56, 74, 0.12), transparent 34%),
    rgba(255, 253, 247, 0.92) !important;
}

body.light-theme .requirement-item.warn,
body.light-theme .preflight-item.warn,
body.light-theme #admin-panel .preflight-item.warn {
  border-color: rgba(167, 122, 33, 0.32) !important;
  background:
    linear-gradient(90deg, rgba(223, 184, 94, 0.14), transparent 34%),
    rgba(255, 253, 247, 0.92) !important;
}

body.light-theme .preflight-item.pass,
body.light-theme #admin-panel .preflight-item.pass {
  border-color: rgba(35, 138, 59, 0.28) !important;
  background:
    linear-gradient(90deg, rgba(99, 212, 113, 0.14), transparent 34%),
    rgba(255, 253, 247, 0.92) !important;
}

body.light-theme #admin-panel .preflight-panel,
body.light-theme #admin-panel .preflight-panel > *,
body.light-theme #admin-panel .preflight-panel [class],
body.light-theme .admin-panel .preflight-panel {
  border-color: var(--line) !important;
  background-color: rgba(255, 253, 247, 0.9) !important;
  background-image: none !important;
  color: var(--ink) !important;
}

body.light-theme #admin-panel .preflight-panel [class]:not(button):not(input):not(select):not(textarea):not(.status-pill):not(.badge):not(.count),
body.light-theme .admin-panel .preflight-item span,
body.light-theme .admin-panel .preflight-item strong,
body.light-theme .admin-panel .preflight-item strong small {
  color: inherit !important;
}

body.light-theme #admin-panel .admin-status-card,
body.light-theme #admin-panel .cutover-fact,
body.light-theme #admin-panel .cutover-facts > *,
body.light-theme #admin-panel .acceptance-summary-grid > *,
body.light-theme #admin-panel .meta-event-grid > *,
body.light-theme #admin-panel .pilot-grid > *,
body.light-theme #admin-panel .pilot-score-facts > *,
body.light-theme #admin-panel .plan-progress-grid > *,
body.light-theme #admin-panel .role-release,
body.light-theme #admin-panel .role-release-card,
body.light-theme #admin-panel .pilot-package,
body.light-theme #admin-panel .pilot-row,
body.light-theme #admin-panel .execution-trail,
body.light-theme #admin-panel .execution-step,
body.light-theme #admin-panel .external-unlock-plan,
body.light-theme #admin-panel .admin-table,
body.light-theme #admin-panel .result-box,
body.light-theme #admin-panel .daily-alerts,
body.light-theme #admin-panel .daily-alerts > *,
body.light-theme #admin-panel .live-source-form,
body.light-theme #admin-panel .live-source-status-card,
body.light-theme #admin-panel .live-source-candidate,
body.light-theme #admin-panel .alert-card,
body.light-theme #admin-panel .alert-row,
body.light-theme #admin-panel .cutover-current,
body.light-theme #admin-panel .cutover-phase,
body.light-theme #admin-panel .external-card,
body.light-theme #admin-panel .external-resource,
body.light-theme #admin-panel .external-unlock-step,
body.light-theme #admin-panel .pilot-check-card,
body.light-theme #admin-panel .pilot-focus-row,
body.light-theme #admin-panel .plan-progress-card,
body.light-theme #admin-panel .funnel-config-form {
  border-color: var(--line) !important;
  background-color: rgba(255, 253, 247, 0.9) !important;
  background-image:
    linear-gradient(180deg, rgba(255, 253, 247, 0.72), rgba(246, 242, 232, 0.46)) !important;
  color: var(--ink) !important;
}

body.light-theme #admin-panel .admin-status-card.ok,
body.light-theme #admin-panel .live-source-status-card.sent,
body.light-theme #admin-panel .cutover-phase.pass,
body.light-theme #admin-panel .external-card.pass,
body.light-theme #admin-panel .external-unlock-step.pass,
body.light-theme #admin-panel .pilot-check-card.pass {
  border-color: rgba(35, 138, 59, 0.28) !important;
  border-left-color: var(--success) !important;
  background-image:
    linear-gradient(90deg, rgba(99, 212, 113, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.82), rgba(246, 242, 232, 0.48)) !important;
}

body.light-theme #admin-panel .admin-status-card.warn,
body.light-theme #admin-panel .live-source-status-card.pending,
body.light-theme #admin-panel .cutover-phase.warn,
body.light-theme #admin-panel .external-card.warn,
body.light-theme #admin-panel .external-unlock-step.warn,
body.light-theme #admin-panel .pilot-check-card.warn,
body.light-theme #admin-panel .alert-card.pending,
body.light-theme #admin-panel .pilot-focus-row.warn {
  border-color: rgba(167, 122, 33, 0.32) !important;
  border-left-color: var(--warning) !important;
  background-image:
    linear-gradient(90deg, rgba(223, 184, 94, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.82), rgba(246, 242, 232, 0.48)) !important;
}

body.light-theme #admin-panel .preflight-item.fail,
body.light-theme #admin-panel .cutover-phase.fail,
body.light-theme #admin-panel .external-card.fail,
body.light-theme #admin-panel .external-unlock-step.fail,
body.light-theme #admin-panel .pilot-check-card.fail,
body.light-theme #admin-panel .alert-card.failed,
body.light-theme #admin-panel .pilot-focus-row.fail {
  border-color: rgba(201, 56, 74, 0.3) !important;
  border-left-color: var(--danger) !important;
  background-image:
    linear-gradient(90deg, rgba(201, 56, 74, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.82), rgba(246, 242, 232, 0.48)) !important;
}

body.light-theme #admin-panel .admin-section [class*="grid"] {
  background-color: transparent !important;
  background-image: none !important;
}

body.light-theme #admin-panel .preflight-item,
body.light-theme #admin-panel .acceptance-summary-grid .alert-card,
body.light-theme #admin-panel .live-source-status-numbers span,
body.light-theme #admin-panel .status-pill,
body.light-theme #admin-panel .preflight-item code,
body.light-theme #admin-panel .admin-table tr {
  border-color: var(--line) !important;
  background-color: rgba(255, 253, 247, 0.86) !important;
  background-image: none !important;
  color: var(--ink) !important;
}

body.light-theme #admin-panel code {
  border-color: rgba(24, 32, 24, 0.12) !important;
  background: rgba(24, 32, 24, 0.055) !important;
  color: #263026 !important;
}

body.light-theme #admin-panel button,
body.light-theme #admin-panel input,
body.light-theme #admin-panel select,
body.light-theme #admin-panel textarea,
body.light-theme #admin-panel .phase-index,
body.light-theme #admin-panel .plan-progress-track,
body.light-theme #admin-panel .command-copy {
  border-color: var(--line) !important;
  background-color: rgba(255, 253, 247, 0.86) !important;
  background-image: none !important;
  color: var(--ink) !important;
}

body.light-theme #admin-panel button:hover {
  border-color: rgba(35, 138, 59, 0.3) !important;
  background-color: rgba(246, 242, 232, 0.96) !important;
}

body.light-theme table,
body.light-theme .dashboard-table {
  border-color: var(--line);
}

body.light-theme th,
body.light-theme td {
  border-color: rgba(24, 32, 24, 0.1);
}

body.light-theme .dashboard-table,
body.light-theme .dashboard-table table {
  background: rgba(255, 253, 247, 0.94) !important;
  color: var(--ink) !important;
}

body.light-theme .dashboard-table th {
  background: rgba(246, 242, 232, 0.98) !important;
  color: var(--muted) !important;
}

body.light-theme .dashboard-table td {
  background: rgba(255, 253, 247, 0.94) !important;
  color: var(--ink) !important;
}

body.light-theme code,
body.light-theme .command-copy {
  border-color: var(--line);
  background: rgba(24, 32, 24, 0.055);
  color: #263026;
}

body.light-theme .stage-move-dialog,
body.light-theme #lead-dialog {
  background: #fffdf7 !important;
}

body.light-theme dialog header,
body.light-theme dialog footer {
  background: #fffdf7 !important;
}

body.light-theme .primary-dialog-action {
  border-color: rgba(35, 138, 59, 0.26) !important;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.18), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #67da6e 0%, #55cf61 72%, #3eaa45 100%) !important;
  box-shadow: 0 12px 28px rgba(35, 138, 59, 0.14);
  color: #061007 !important;
}

body.light-theme .primary-dialog-action:hover {
  border-color: rgba(35, 138, 59, 0.4) !important;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.26), rgba(177, 255, 125, 0) 38%),
    linear-gradient(180deg, #75e878 0%, #5bd969 72%, #45b64d 100%) !important;
}

body.light-theme dialog::backdrop {
  background: rgba(24, 32, 24, 0.38);
  backdrop-filter: blur(4px);
}

body.light-theme.performance-mode {
  background:
    linear-gradient(90deg, rgba(24, 32, 24, 0.04) 1px, transparent 1px) 0 0 / 96px 96px,
    linear-gradient(rgba(24, 32, 24, 0.04) 1px, transparent 1px) 0 0 / 96px 96px,
    #f4f1e8 !important;
}

body.light-theme.performance-mode .kanban-column,
body.light-theme.performance-mode .kanban-column-head,
body.light-theme.performance-mode .kanban-card {
  background: rgba(255, 253, 247, 0.96) !important;
}

/* Raul redesign pass */
body {
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
}

.sidebar .brand {
  padding: 0 8px;
}

.views {
  flex: 1;
  align-content: space-between;
}

.view-group {
  border-bottom: 0;
  gap: 2px;
  padding: 0;
}

.view-group.nav-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(29, 31, 35, 0.08);
}

.view-button {
  min-height: 33px;
  padding: 6px 8px;
  border-color: transparent;
  background: transparent;
  color: #596069;
}

.view-button:hover {
  background: rgba(29, 31, 35, 0.045);
}

.view-button.active {
  background: rgba(15, 118, 110, 0.1);
  color: #0f5f59;
}

.view-button-icon {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  opacity: 0.72;
}

.view-button-icon .ui-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.view-button-label {
  font-size: 13px;
}

.lead-row.conversation-row .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lead-row.conversation-row .badge .ui-icon {
  width: 12px;
  height: 12px;
}

.topbar {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.topbar-main {
  display: none;
}

.actions {
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 0 2px;
}

.operational-lead-total {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(29, 31, 35, 0.08);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.8);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#kanban-pipeline-select {
  min-width: 210px;
  max-width: 260px;
}

.mode-switch button,
.toolbar-button {
  border-color: transparent;
  background: transparent;
  color: #596069;
  box-shadow: none;
}

.mode-switch button:hover,
.toolbar-button:hover {
  background: rgba(29, 31, 35, 0.055);
  border-color: transparent;
}

.mode-switch button.active {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.14);
}

#new-lead-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.operational-filters {
  margin-bottom: 12px;
}

.operational-filter-group {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.operational-filter-chips {
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.operational-filter-chip {
  min-height: 30px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: #596069;
  white-space: nowrap;
}

.operational-filter-chip:hover {
  background: rgba(29, 31, 35, 0.055);
}

.operational-filter-chip.active {
  border-color: rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.1);
  color: #0f5f59;
}

.operational-more-filter {
  position: relative;
}

.operational-more-filter summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 999px;
  color: #596069;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}

.operational-more-filter summary::-webkit-details-marker {
  display: none;
}

.operational-more-filter summary:hover {
  background: rgba(29, 31, 35, 0.055);
}

.operational-more-filter summary span {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(29, 31, 35, 0.08);
  text-align: center;
  font-size: 11px;
}

.operational-more-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 250px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 16px 32px rgba(29, 31, 35, 0.12);
}

.operational-search-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

#operational-lead-search {
  width: 220px;
  min-height: 32px;
  border: 1px solid rgba(29, 31, 35, 0.1);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.92);
  padding: 0 12px;
}

.lead-list-tools input,
.lead-list-tools button {
  display: none;
}

.kanban-board {
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: auto;
}

.kanban-column {
  flex: 0 0 268px;
  min-width: 268px;
  max-width: 268px;
}

.kanban-card {
  gap: 6px;
  padding: 10px;
}

.kanban-card .lead-title strong {
  font-size: 14px;
  line-height: 1.25;
}

.kanban-card-source,
.kanban-card-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-value {
  font-weight: 500;
}

.kanban-card .kanban-meta-context,
.kanban-card .kanban-task {
  display: none;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 4px;
}

.kanban-owner-avatar {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f5f59;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
}

.kanban-owner-avatar.has-photo {
  background: rgba(15, 23, 42, 0.08);
}

.kanban-owner-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.kanban-icon-button {
  width: 25px;
  height: 25px;
  min-height: 25px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #596069;
}

.kanban-icon-button:hover {
  background: rgba(29, 31, 35, 0.065);
  color: var(--accent);
}

.kanban-phone-icon,
.kanban-message-icon {
  width: 14px;
  height: 14px;
  position: relative;
  display: inline-block;
}

.kanban-phone-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.8px solid currentColor;
  border-left-width: 3px;
  border-radius: 5px 5px 5px 2px;
  transform: rotate(-28deg);
}

.kanban-message-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.7px solid currentColor;
  border-radius: 5px;
}

.kanban-message-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 1px;
  width: 5px;
  height: 5px;
  border-left: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: skew(-20deg);
}

.kanban-stage-age {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .operational-filter-group,
  .actions {
    grid-template-columns: 1fr;
  }

  .operational-search-tools,
  #operational-lead-search,
  .manage-fields-button {
    width: 100%;
  }
}

/* Icon polish */
.ui-icon {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: currentColor;
  opacity: 0.78;
}

.view-button.active .view-button-icon {
  background: transparent !important;
  color: var(--accent);
  opacity: 1;
}

.toolbar-icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.toolbar-icon::before,
.toolbar-icon::after,
.kanban-phone-icon::before,
.kanban-phone-icon::after,
.kanban-message-icon::before,
.kanban-message-icon::after {
  content: none;
}

.mode-switch button,
.toolbar-button,
.operational-filter-chip,
.manage-fields-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.operational-filter-chip .ui-icon {
  width: 14px;
  height: 14px;
  opacity: 0.78;
}

.operational-filter-chip.active .ui-icon {
  opacity: 1;
}

.operational-search-shell {
  width: 220px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(29, 31, 35, 0.1);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.92);
  color: var(--muted);
}

.operational-search-shell .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

#operational-lead-search {
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
}

#operational-lead-search:focus {
  outline: none;
}

.manage-fields-button .ui-icon,
.kanban-icon-button .ui-icon {
  width: 15px;
  height: 15px;
}

@media (max-width: 980px) {
  .operational-search-shell {
    width: 100%;
  }
}

/* Raul kanban fit pass: keep the CRM flush to the viewport and let each
   operational lane spend the remaining height on cards, not chrome. */
html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body:not(.intake-body) {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0;
}

body:not(.intake-body)::before {
  pointer-events: none;
}

body.authenticated:not(.intake-body) .sidebar {
  height: 100dvh;
  min-height: 0;
  align-self: stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 0;
}

body.authenticated:not(.intake-body) .shell {
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 14px 0;
  border-radius: 0;
}

.topbar,
.operational-filters,
.kpis,
.kanban-context {
  flex: 0 0 auto;
}

.topbar {
  margin: 0 0 8px;
}

.actions {
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

#performance-mode-button,
#run-maintenance,
#user-badge,
#logout-button {
  display: none !important;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(29, 31, 35, 0.08);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.64);
}

.mode-switch button,
.toolbar-button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #596069;
  font-size: 12px;
  font-weight: 700;
}

.mode-switch button:hover,
.toolbar-button:hover,
.view-button:hover,
.operational-filter-chip:hover,
.operational-more-filter summary:hover {
  border-color: transparent;
  background: rgba(29, 31, 35, 0.045);
  color: #253027;
}

.mode-switch button.active {
  border-color: transparent;
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--accent);
  color: #0f5f59;
}

#theme-mode-button {
  width: 32px;
  min-width: 32px;
  justify-content: center;
  padding: 0;
}

#theme-mode-button span:last-child {
  display: none;
}

#new-lead-button {
  min-height: 32px;
  border-radius: 999px;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
  color: #fff;
}

#new-lead-button:hover {
  border-color: #0d625d;
  background: #0d625d;
  color: #fff;
}

.view-button,
.operational-filter-chip {
  border-color: transparent;
}

.view-button:hover {
  box-shadow: none;
}

.view-button.active {
  border-color: rgba(15, 118, 110, 0.12);
  background: rgba(15, 118, 110, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
  color: #0f5f59;
}

.operational-filter-chip.active {
  border-color: rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.1);
  box-shadow: none;
  color: #0f5f59;
}

.lead-row:hover {
  background: rgba(29, 31, 35, 0.045);
  box-shadow: none;
}

.lead-row.active {
  background: rgba(15, 118, 110, 0.12);
  box-shadow: inset 3px 0 0 var(--accent);
}

.operational-filters {
  margin: 0 0 10px;
}

.operational-filter-group {
  position: relative;
  min-width: 0;
}

.operational-filter-chips {
  scrollbar-width: thin;
}

.operational-more-filter {
  position: relative;
  flex: 0 0 auto;
}

.operational-more-filter[open] summary {
  background: rgba(29, 31, 35, 0.065);
  color: #253027;
}

.operational-more-menu {
  z-index: 80;
  top: calc(100% + 8px);
  left: auto;
  right: 0;
  max-height: min(360px, calc(100dvh - 160px));
  overflow-y: auto;
}

.operational-more-menu .operational-filter-chip {
  width: 100%;
  justify-content: flex-start;
}

.workspace,
.dashboard-panel,
.admin-panel,
.my-whatsapp-panel,
.lead-sources-panel {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.workspace {
  display: grid;
}

body.kanban-detail-open .workspace {
  display: block;
}

.dashboard-panel,
.admin-panel,
.my-whatsapp-panel,
.lead-sources-panel {
  overflow-y: auto;
}

.kanban-board {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 14px 10px 0;
  scroll-padding-inline: 0 14px;
}

.kanban-column {
  height: 100%;
  min-height: 0;
  display: flex;
  flex: 0 0 var(--kanban-column-width, 268px);
  min-width: var(--kanban-column-width, 268px);
  max-width: var(--kanban-column-width, 268px);
  flex-direction: column;
}

.kanban-column-head {
  flex: 0 0 auto;
}

.kanban-cards {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.kanban-card:hover {
  border-color: rgba(29, 31, 35, 0.22);
  box-shadow: 0 8px 20px rgba(29, 31, 35, 0.08);
  transform: translateY(-1px);
}

.kanban-card.is-selected,
.kanban-card.is-selected:hover {
  border-color: rgba(15, 118, 110, 0.72);
  box-shadow:
    0 0 0 1px rgba(15, 118, 110, 0.18),
    0 12px 26px rgba(15, 118, 110, 0.12);
}

body.light-theme .mode-switch,
body.light-theme .operational-lead-total,
body.light-theme .operational-search-shell {
  background: rgba(255, 253, 247, 0.86);
}

body.light-theme .view-button:hover,
body.light-theme .mode-switch button:hover,
body.light-theme .toolbar-button:hover,
body.light-theme .operational-filter-chip:hover,
body.light-theme .operational-more-filter summary:hover {
  background: rgba(29, 31, 35, 0.045);
  color: #253027;
}

body.light-theme .mode-switch button.active,
body.light-theme .view-button.active,
body.light-theme .operational-filter-chip.active {
  border-color: rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.1);
  color: #0f5f59;
}

body.light-theme .mode-switch button.active {
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* Final UI integration: operational priority hints from the queue must stay
   compact enough to coexist with Raul's tighter Kanban layout. */
.priority-pill,
.kanban-stage-label,
.next-action-strip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.priority-pill {
  flex: 0 0 auto;
  max-width: min(100%, 220px);
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(242, 234, 216, 0.14);
  background: rgba(242, 234, 216, 0.055);
  color: var(--muted);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.priority-pill .ui-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}

.priority-pill.danger {
  border-color: rgba(238, 107, 119, 0.28);
  background: rgba(238, 107, 119, 0.1);
  color: #ff97a0;
}

.priority-pill.warn {
  border-color: rgba(223, 184, 94, 0.3);
  background: rgba(223, 184, 94, 0.1);
  color: var(--accent-2);
}

.priority-pill.info,
.priority-pill.watch {
  border-color: rgba(99, 212, 113, 0.22);
  background: rgba(99, 212, 113, 0.08);
  color: var(--accent);
}

.priority-pill.ok {
  border-color: rgba(99, 212, 113, 0.18);
  background: rgba(99, 212, 113, 0.07);
  color: #9eea79;
}

.kanban-card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
}

.kanban-stage-label {
  flex: 1 1 auto;
  display: block;
  overflow: visible;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.next-action-strip {
  width: 100%;
  min-height: 28px;
  align-items: flex-start;
  padding: 6px 8px;
  border: 1px solid rgba(242, 234, 216, 0.1);
  background: rgba(7, 8, 6, 0.28);
  color: var(--muted);
  overflow: visible;
  white-space: normal;
}

.next-action-strip .ui-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--accent);
}

.next-action-strip span {
  flex: 0 0 auto;
  color: var(--muted);
}

.next-action-strip strong {
  min-width: 0;
  overflow: visible;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.detail-summary-side {
  display: flex;
  justify-content: flex-end;
}

.quick-actions {
  grid-template-columns: 1fr;
}

.quick-action-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(242, 234, 216, 0.1);
  border-radius: 8px;
  background: rgba(7, 8, 6, 0.2);
}

.quick-action-group > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.quick-action-group button {
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding-inline: 9px;
  font-size: 11px;
}

.quick-action-group button .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.quick-action-group.muted {
  background: rgba(242, 234, 216, 0.025);
}

body.light-theme .priority-pill {
  border-color: rgba(29, 31, 35, 0.1);
  background: rgba(29, 31, 35, 0.04);
  color: #596069;
}

body.light-theme .priority-pill.danger {
  border-color: rgba(190, 18, 60, 0.2);
  background: rgba(190, 18, 60, 0.08);
  color: var(--danger);
}

body.light-theme .priority-pill.warn {
  border-color: rgba(217, 119, 6, 0.22);
  background: rgba(217, 119, 6, 0.08);
  color: #9a5a05;
}

body.light-theme .priority-pill.info,
body.light-theme .priority-pill.watch,
body.light-theme .priority-pill.ok {
  border-color: rgba(15, 118, 110, 0.16);
  background: rgba(15, 118, 110, 0.08);
  color: #0f5f59;
}

body.light-theme .next-action-strip,
body.light-theme .quick-action-group {
  border-color: rgba(29, 31, 35, 0.08);
  background: rgba(29, 31, 35, 0.025);
}

@media (max-width: 980px) {
  body:not(.intake-body) {
    height: auto;
    min-height: 100dvh;
    display: block;
    overflow: auto;
  }

  body.authenticated:not(.intake-body) .sidebar {
    height: auto;
    max-height: min(25vh, 210px);
  }

  body.authenticated:not(.intake-body) .shell {
    height: auto;
    min-height: calc(100dvh - min(25vh, 210px));
    overflow: visible;
    padding: 12px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .mode-switch,
  #kanban-pipeline-select,
  #new-lead-button,
  .operational-lead-total,
  .operational-search-shell,
  .manage-fields-button {
    width: 100%;
  }

  #theme-mode-button {
    width: 100%;
    min-width: 0;
  }

  #theme-mode-button span:last-child {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .operational-filter-group {
    grid-template-columns: 1fr;
  }

  .operational-search-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .operational-more-menu {
    left: 0;
    right: auto;
    width: min(280px, calc(100vw - 28px));
  }

  .workspace,
  .dashboard-panel,
  .admin-panel,
  .my-whatsapp-panel,
  .lead-sources-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .kanban-board {
    height: clamp(360px, calc(100dvh - 220px), 680px);
    min-height: 360px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .kanban-column {
    height: 100%;
    flex-basis: min(360px, calc(100vw - 34px));
    min-width: min(360px, calc(100vw - 34px));
    max-width: min(360px, calc(100vw - 34px));
  }
}

/* Final visual QA pass: keep operational controls readable in the dark CRM
   shell while preserving the light-theme overrides for later polish. */
h1,
h2,
h3,
.panel-head strong,
.brand strong,
.detail h2,
.intake-head h1,
.dashboard-section h3,
.kanban-card h3 {
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
}

h2,
.detail h2 {
  font-size: 24px;
}

.dashboard-section h3,
.kanban-card h3 {
  font-size: 19px;
}

body:not(.light-theme) .mode-switch,
body:not(.light-theme) .operational-lead-total,
body:not(.light-theme) .operational-search-shell,
body:not(.light-theme) #kanban-pipeline-select,
body:not(.light-theme) .manage-fields-button {
  border-color: rgba(242, 234, 216, 0.14);
  background:
    linear-gradient(180deg, rgba(242, 234, 216, 0.085), rgba(242, 234, 216, 0.025)),
    rgba(13, 16, 13, 0.86);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(242, 234, 216, 0.06);
}

body:not(.light-theme) #kanban-pipeline-select,
body:not(.light-theme) #operational-lead-search {
  min-height: 36px;
  color: var(--ink);
  caret-color: var(--accent);
}

body:not(.light-theme) #kanban-pipeline-select {
  padding-inline: 13px 34px;
  color-scheme: dark;
  accent-color: var(--accent);
}

body:not(.light-theme) #kanban-pipeline-select option {
  background: #0d100d;
  color: var(--ink);
}

body:not(.light-theme) #operational-lead-search,
body:not(.light-theme) #operational-lead-search:focus {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

body:not(.light-theme) #operational-lead-search::placeholder {
  color: var(--muted-2);
}

body:not(.light-theme) .operational-search-shell:focus-within,
body:not(.light-theme) #kanban-pipeline-select:focus-visible,
body:not(.light-theme) .manage-fields-button:focus-visible,
body:not(.light-theme) .mode-switch button:focus-visible,
body:not(.light-theme) .toolbar-button:focus-visible {
  outline: 2px solid rgba(99, 212, 113, 0.45);
  outline-offset: 2px;
}

body:not(.light-theme) .mode-switch button,
body:not(.light-theme) .toolbar-button {
  min-height: 36px;
  color: var(--muted);
}

body.light-theme .mode-switch button,
body.light-theme .toolbar-button,
body.light-theme .operational-search-shell,
body.light-theme .manage-fields-button {
  min-height: 36px;
}

body:not(.light-theme) .view-button,
body:not(.light-theme) .operational-filter-chip,
body:not(.light-theme) .operational-more-filter summary,
body.light-theme .view-button,
body.light-theme .operational-filter-chip,
body.light-theme .operational-more-filter summary {
  min-height: 36px;
}

body:not(.light-theme) #new-lead-button,
body.light-theme #new-lead-button {
  min-height: 36px;
}

body:not(.light-theme) #theme-mode-button,
body.light-theme #theme-mode-button {
  width: 36px;
  min-width: 36px;
}

body:not(.light-theme) .mode-switch button:hover,
body:not(.light-theme) .toolbar-button:hover,
body:not(.light-theme) .operational-filter-chip:hover,
body:not(.light-theme) .operational-more-filter summary:hover {
  background: rgba(242, 234, 216, 0.075);
  color: var(--ink);
}

body:not(.light-theme) .mode-switch button.active,
body:not(.light-theme) .operational-filter-chip.active {
  border-color: rgba(99, 212, 113, 0.28);
  background: rgba(99, 212, 113, 0.12);
  color: #b1ff7d;
  box-shadow: inset 0 -2px 0 var(--accent);
}

body.kanban-detail-open .detail-panel {
  isolation: isolate;
  border: 1px solid rgba(242, 234, 216, 0.14);
  border-radius: 8px;
  background: #070806 !important;
}

@media (max-width: 980px) {
  body.kanban-detail-open .detail-summary {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  }
}

body.light-theme.kanban-detail-open .detail-panel {
  border-color: rgba(29, 31, 35, 0.1);
  background: #fffdfa !important;
}

body:not(.light-theme) .operational-more-filter summary {
  color: var(--muted);
}

body:not(.light-theme) .operational-more-filter[open] summary {
  background: rgba(242, 234, 216, 0.075);
  color: var(--ink);
}

body:not(.light-theme) .operational-more-filter summary span {
  background: rgba(242, 234, 216, 0.09);
  color: var(--ink);
}

body:not(.light-theme) .operational-more-menu {
  border-color: rgba(242, 234, 216, 0.14);
  background: rgba(13, 16, 13, 0.98);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.38);
}

body:not(.light-theme) .operational-more-menu .operational-filter-chip {
  color: rgba(242, 234, 216, 0.78);
}

body:not(.light-theme) .operational-more-menu .operational-filter-chip:hover {
  background: rgba(242, 234, 216, 0.075);
  color: var(--ink);
}

body:not(.light-theme) .operational-more-menu .operational-filter-chip.active {
  color: #b1ff7d;
}

body.light-theme #kanban-pipeline-select,
body.light-theme .operational-search-shell,
body.light-theme .operational-lead-total,
body.light-theme .manage-fields-button {
  border-color: rgba(24, 32, 24, 0.14);
  background: rgba(255, 253, 247, 0.9);
  color: var(--ink);
}

body.light-theme #operational-lead-search {
  color: var(--ink);
}

body:not(.light-theme) #new-lead-button {
  border-color: rgba(99, 212, 113, 0.72) !important;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.2), rgba(177, 255, 125, 0) 42%),
    linear-gradient(180deg, #67da6e 0%, #55cf61 72%, #3eaa45 100%) !important;
  color: #061007 !important;
  text-shadow: none;
}

body:not(.light-theme) #new-lead-button:hover {
  border-color: rgba(177, 255, 125, 0.82) !important;
  background:
    linear-gradient(180deg, rgba(177, 255, 125, 0.28), rgba(177, 255, 125, 0.02) 42%),
    linear-gradient(180deg, #74e87b 0%, #5fd96a 72%, #45b84d 100%) !important;
  color: #061007 !important;
}

body:not(.light-theme) .view-button.active,
body:not(.light-theme) .view-button.active .view-button-main,
body:not(.light-theme) .view-button.active .view-button-label {
  color: #b1ff7d !important;
}

body:not(.light-theme) .view-button.active {
  border-color: rgba(99, 212, 113, 0.26) !important;
  background: rgba(99, 212, 113, 0.12) !important;
}

body:not(.light-theme) .kanban-owner-avatar {
  background: rgba(99, 212, 113, 0.14);
  color: #b1ff7d;
}

body:not(.light-theme) .kanban-owner-avatar.has-photo {
  background: rgba(255, 255, 255, 0.1);
}

.kanban-icon-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
}

body:not(.light-theme) .kanban-icon-button {
  color: rgba(242, 234, 216, 0.72);
}

body:not(.light-theme) .kanban-icon-button:hover {
  background: rgba(99, 212, 113, 0.12);
  color: #b1ff7d;
}

body:not(.light-theme) .detail-context-pill {
  border-color: rgba(99, 212, 113, 0.24);
  background: rgba(99, 212, 113, 0.12);
  color: #b1ff7d;
}

body:not(.light-theme) .lead-answer-card {
  border-color: rgba(220, 208, 168, 0.14);
  background: rgba(13, 20, 13, 0.82);
}

body:not(.light-theme) .lead-answer-code {
  background: rgba(99, 212, 113, 0.14);
  color: #b1ff7d;
}

body:not(.light-theme) .lead-answer-card p {
  color: rgba(242, 234, 216, 0.78);
}

.quick-action-group button,
.inline-actions button,
.command-copy button,
.template-actions button,
.detail-tab-button,
#admin-panel button {
  min-height: 36px;
}

body:not(.light-theme) .detail-tab-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

body:not(.light-theme) .detail-tab-button:hover {
  border-color: rgba(242, 234, 216, 0.12);
  background: rgba(242, 234, 216, 0.055);
  color: var(--ink);
}

body:not(.light-theme) .detail-tab-button.active {
  border-color: rgba(99, 212, 113, 0.26);
  border-bottom-color: rgba(99, 212, 113, 0.26);
  background: rgba(99, 212, 113, 0.12);
  color: #b1ff7d;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.stage-move-fields .checkbox-label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(242, 234, 216, 0.035);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.stage-move-fields .checkbox-label input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  padding: 0;
  accent-color: var(--accent);
}

body.light-theme .stage-move-fields .checkbox-label {
  background: rgba(24, 32, 24, 0.025);
  color: var(--ink);
}

@media (max-width: 620px) {
  h1 {
    font-size: 24px;
  }

  h2,
  .detail h2 {
    font-size: 21px;
  }

  body:not(.light-theme) .mode-switch button,
  body:not(.light-theme) .toolbar-button,
  body:not(.light-theme) .view-button,
  body:not(.light-theme) .operational-filter-chip,
  body:not(.light-theme) .operational-more-filter summary,
  body:not(.light-theme) #kanban-pipeline-select,
  body:not(.light-theme) .operational-search-shell,
  body.light-theme .mode-switch button,
  body.light-theme .toolbar-button,
  body.light-theme .view-button,
  body.light-theme .operational-filter-chip,
  body.light-theme .operational-more-filter summary,
  body.light-theme #kanban-pipeline-select,
  body.light-theme .operational-search-shell {
    min-height: 44px;
  }

  body:not(.light-theme) #new-lead-button,
  body.light-theme #new-lead-button {
    min-height: 44px;
  }

  body:not(.light-theme) #operational-lead-search,
  body.light-theme #operational-lead-search {
    min-height: 44px;
    height: 44px;
  }

  body:not(.light-theme) #theme-mode-button,
  body.light-theme #theme-mode-button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    gap: 8px;
    padding-inline: 14px;
  }

  body:not(.light-theme) #theme-mode-button {
    border-color: rgba(242, 234, 216, 0.14);
    background:
      linear-gradient(180deg, rgba(242, 234, 216, 0.085), rgba(242, 234, 216, 0.025)),
      rgba(13, 16, 13, 0.86);
    color: var(--ink);
  }

  body.light-theme #theme-mode-button {
    border-color: rgba(29, 31, 35, 0.08);
    background: rgba(255, 253, 250, 0.72);
    color: var(--ink);
  }

  body:not(.light-theme) #theme-mode-button span:last-child,
  body.light-theme #theme-mode-button span:last-child {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .quick-action-group button,
  .inline-actions button,
  .command-copy button,
  .template-actions button,
  .detail-tab-button,
  #admin-panel button,
  #operational-lead-search {
    min-height: 44px;
  }

  .detail-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding-bottom: 0;
  }

  .detail-tab-button {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
    border-bottom-color: transparent;
    white-space: normal;
    line-height: 1.18;
  }
}

@media (max-width: 980px) {
  body.authenticated:not(.intake-body) .view-button,
  body.authenticated:not(.intake-body) .mode-switch button,
  body.authenticated:not(.intake-body) .toolbar-button,
  body.authenticated:not(.intake-body) #new-lead-button,
  body.authenticated:not(.intake-body) #kanban-pipeline-select,
  body.authenticated:not(.intake-body) #operational-lead-search,
  body.authenticated:not(.intake-body) .manage-fields-button,
  body.authenticated:not(.intake-body) .operational-filter-chip,
  body.authenticated:not(.intake-body) .operational-more-filter summary,
  body.authenticated:not(.intake-body) .detail-back-button,
  body.authenticated:not(.intake-body) .quick-action-group button,
  body.authenticated:not(.intake-body) .inline-actions button,
  body.authenticated:not(.intake-body) .detail-tab-button,
  body.authenticated:not(.intake-body) .detail-form button,
  body.authenticated:not(.intake-body) .stage-inline-form button,
  body.authenticated:not(.intake-body) .stage-move-fields button,
  body.authenticated:not(.intake-body) .form-actions button,
  body.authenticated:not(.intake-body) #admin-panel button {
    min-height: 44px;
  }

  body.authenticated:not(.intake-body) #operational-lead-search {
    height: 44px;
  }

  body.authenticated:not(.intake-body) #theme-mode-button {
    width: 100%;
    min-width: 0;
  }

  body.authenticated:not(.intake-body) .kanban-icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  body.authenticated:not(.intake-body) #admin-panel .external-resource > div:first-child {
    display: grid;
    justify-content: stretch;
    gap: 2px;
  }

  body.authenticated:not(.intake-body) #admin-panel .external-resource strong,
  body.authenticated:not(.intake-body) #admin-panel .external-resource small,
  body.authenticated:not(.intake-body) #admin-panel .external-checks p {
    display: block;
    width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.authenticated:not(.intake-body) #admin-panel .external-checks p {
    -webkit-box-orient: initial;
    -webkit-line-clamp: initial;
    line-height: 1.3;
  }
}

@media (max-width: 980px) {
  body.authenticated:not(.intake-body) .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  body.authenticated:not(.intake-body) #kanban-pipeline-select {
    width: auto;
    min-width: min(100%, 220px);
    flex: 1 1 220px;
  }

  body.authenticated:not(.intake-body) .operational-lead-total {
    width: auto;
    flex: 0 0 auto;
  }

  body.authenticated:not(.intake-body) .mode-switch {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
  }

  body.authenticated:not(.intake-body) #theme-mode-button {
    width: 44px;
    min-width: 44px;
    flex: 0 0 44px;
    justify-content: center;
    padding-inline: 0;
  }

  body.authenticated:not(.intake-body) #theme-mode-button span:last-child {
    display: none;
  }

  body.authenticated:not(.intake-body) #new-lead-button {
    width: auto;
    min-width: 124px;
    flex: 0 0 auto;
  }
}

@media (max-width: 980px) {
  body.authenticated:not(.intake-body) .operational-filter-chips {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
  }

  body.authenticated:not(.intake-body) .operational-more-filter {
    flex: 0 0 auto;
  }

  body.authenticated:not(.intake-body) .operational-more-filter summary {
    border: 1px solid rgba(242, 234, 216, 0.12);
    background: rgba(242, 234, 216, 0.055);
    color: var(--ink);
  }

  body.light-theme.authenticated:not(.intake-body) .operational-more-filter summary {
    border-color: rgba(29, 31, 35, 0.08);
    background: rgba(255, 253, 250, 0.74);
    color: var(--ink);
  }

  body.authenticated:not(.intake-body) .operational-more-menu {
    left: 0;
    max-height: min(280px, 34dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    right: auto;
    width: min(300px, calc(100vw - 28px));
  }
}

@media (min-width: 640px) and (max-width: 980px) {
  body.authenticated:not(.intake-body) .operational-more-menu {
    left: auto;
    right: 0;
  }
}

@media (max-width: 620px) {
  body.authenticated:not(.intake-body) .operational-more-menu {
    bottom: calc(100% + 8px);
    top: auto;
  }
}

@media (max-width: 980px) {
  body.authenticated:not(.intake-body) .sidebar {
    height: auto;
    max-height: none;
    display: grid;
    gap: 8px;
    padding: 8px 10px 10px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 8, 6, 0.94);
  }

  body.authenticated:not(.intake-body) .sidebar .brand {
    min-width: 0;
    margin: 0;
    padding: 0;
    gap: 8px;
  }

  body.authenticated:not(.intake-body) .sidebar .brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
  }

  body.authenticated:not(.intake-body) .sidebar .brand strong {
    display: block;
    font-size: 15px;
    line-height: 1.1;
  }

  body.authenticated:not(.intake-body) .sidebar .brand small {
    display: block;
    max-width: 100%;
    margin-top: 1px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.authenticated:not(.intake-body) .views {
    display: flex;
    gap: 6px;
    align-content: initial;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body.authenticated:not(.intake-body) .views::-webkit-scrollbar {
    display: none;
  }

  body.authenticated:not(.intake-body) .view-group {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    padding: 0;
    border: 0;
  }

  body.authenticated:not(.intake-body) .view-group.nav-footer {
    margin-top: 0;
    padding-top: 0;
    padding-left: 6px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  body.authenticated:not(.intake-body) .view-button {
    width: auto;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(242, 234, 216, 0.045);
  }

  body.authenticated:not(.intake-body) .view-button.active {
    border-color: rgba(99, 212, 113, 0.32);
    background: rgba(99, 212, 113, 0.14);
  }

  body.authenticated:not(.intake-body) .view-button-main {
    gap: 7px;
  }

  body.authenticated:not(.intake-body) .view-button-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  body.authenticated:not(.intake-body) .view-button-label {
    max-width: 132px;
    font-size: 12px;
  }

  body.authenticated:not(.intake-body) .shell {
    min-height: 0;
    padding-top: 10px;
  }

  body.light-theme.authenticated:not(.intake-body) .sidebar {
    background: rgba(255, 253, 247, 0.96);
  }

  body.light-theme.authenticated:not(.intake-body) .view-button {
    background: rgba(29, 31, 35, 0.035);
  }

  body.light-theme.authenticated:not(.intake-body) .view-button.active {
    border-color: rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.09);
  }
}

@media (max-width: 980px) {
  body.authenticated:not(.intake-body) #lead-dialog {
    padding: 14px;
  }

  body.authenticated:not(.intake-body) #lead-form {
    max-height: calc(100dvh - 60px);
    grid-template-columns: 1fr;
  }

  body.authenticated:not(.intake-body) #lead-form .lead-form-fields {
    grid-template-columns: 1fr;
    max-height: max(360px, calc(100dvh - 250px));
    padding: 0 2px 2px 0;
  }

  body.authenticated:not(.intake-body) #lead-form footer {
    position: static;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 -2px -2px;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 -14px 24px rgba(7, 8, 6, 0.76);
  }

  body.authenticated:not(.intake-body) #lead-form footer button {
    width: 100%;
    min-height: 46px;
  }

  body:not(.light-theme).authenticated:not(.intake-body) #lead-form footer {
    background: rgba(13, 16, 13, 0.98);
  }

  body.light-theme.authenticated:not(.intake-body) #lead-form footer {
    background: var(--panel);
    box-shadow: 0 -14px 24px rgba(244, 241, 232, 0.88);
  }
}

#theme-mode-button[hidden] {
  display: none !important;
}

/* Kanban QA: cards must not hide rendered content. Keep dense text bounded
   inside the card itself, but let the card height match its visible controls. */
.kanban-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  overflow: visible;
}

.kanban-card .lead-title,
.kanban-card .kanban-card-value,
.kanban-card .kanban-card-footer {
  grid-column: 1 / -1;
}

.kanban-card-source {
  grid-column: 1;
}

.kanban-card-value {
  justify-self: start;
  text-align: left;
}

.kanban-card .lead-title strong,
.kanban-stage-label,
.next-action-strip strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.kanban-card .lead-title strong {
  -webkit-line-clamp: 2;
}

.kanban-stage-label {
  -webkit-line-clamp: 2;
}

.next-action-strip strong {
  -webkit-line-clamp: 2;
}

.workday-panel {
  padding: 0 18px 12px;
}

.workday-panel[hidden] {
  display: none !important;
}

.workday-shell {
  display: grid;
  grid-template-columns: repeat(5, minmax(104px, 1fr)) minmax(240px, 1.35fr);
  gap: 10px;
  align-items: stretch;
}

.workday-card,
.workday-next {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 91%, var(--soft));
  box-shadow: 0 10px 24px rgba(7, 8, 6, 0.12);
}

.workday-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  min-height: 82px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
}

.workday-card span:first-child {
  grid-row: 1 / span 2;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: var(--soft);
}

.workday-card strong {
  min-width: 0;
  font-size: 20px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.workday-card small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.workday-card.attention {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
}

.workday-card.attention span:first-child {
  color: var(--warning);
}

.workday-card.ok span:first-child {
  color: var(--success);
}

.workday-card.neutral span:first-child {
  color: var(--accent);
}

.workday-next {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 11px;
}

.workday-next > strong {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.workday-next button {
  display: grid;
  min-width: 0;
  gap: 2px;
  justify-items: start;
  border: 1px solid rgba(242, 234, 216, 0.11);
  border-radius: 7px;
  background: rgba(242, 234, 216, 0.045);
  padding: 7px 8px;
  text-align: left;
}

.workday-next button span,
.workday-next button small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workday-loading {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 92%, var(--soft));
}

.sdr-operations-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sdr-operations-table td:first-child strong,
.sdr-operations-table td:first-child small,
.sdr-operations-table td:nth-child(2) small {
  display: block;
  overflow-wrap: anywhere;
}

.sdr-operations-table td:first-child small,
.sdr-operations-table td:nth-child(2) small {
  color: var(--muted);
  margin-top: 2px;
}

.sdr-blockers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sdr-blocker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.lead-sources-panel {
  padding: 18px;
}

.lead-sources-shell {
  display: grid;
  gap: 14px;
  max-width: 1320px;
}

.lead-sources-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.lead-source-summary-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--soft));
}

.lead-source-summary-card > span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: var(--soft);
}

.lead-source-summary-card strong,
.lead-source-summary-card small,
.lead-source-summary-card em {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-source-summary-card strong {
  font-size: 22px;
  line-height: 1;
}

.lead-source-summary-card small,
.lead-source-summary-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.lead-source-summary-card em {
  grid-column: 1 / -1;
}

.lead-sources-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  align-items: start;
}

.lead-source-groups {
  display: grid;
  gap: 12px;
}

.lead-source-group {
  display: grid;
  gap: 8px;
}

.lead-source-group-head,
.lead-source-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.lead-source-card-list {
  display: grid;
  gap: 8px;
}

.lead-source-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 91%, var(--soft));
  color: var(--text);
  text-align: left;
}

.lead-source-card:hover,
.lead-source-card.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.lead-source-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: var(--soft);
}

.lead-source-card.failed .lead-source-icon {
  color: var(--danger);
}

.lead-source-card.pending .lead-source-icon {
  color: var(--warning);
}

.lead-source-main,
.lead-source-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lead-source-main strong,
.lead-source-main small,
.lead-source-meta small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-source-main small,
.lead-source-meta small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.lead-source-detail-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--panel) 93%, var(--soft));
}

.lead-source-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.lead-source-flow > div:not(.lead-source-flow-arrow) {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.lead-source-flow span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  grid-row: 1 / span 2;
}

.lead-source-flow strong,
.lead-source-flow small {
  min-width: 0;
  overflow-wrap: anywhere;
  grid-column: 2;
}

.lead-source-flow small {
  color: var(--muted);
}

.lead-source-flow-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.lead-source-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lead-source-signals article {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.lead-source-signals article > span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  grid-row: 1 / span 2;
}

.lead-source-signals article.failed > span {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.lead-source-signals strong,
.lead-source-signals small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-source-signals strong {
  font-size: 13px;
}

.lead-source-signals small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.lead-source-integration {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 86%, var(--soft));
}

.lead-source-integration .command-copy {
  min-width: 0;
}

.lead-source-integration .command-copy code {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead-source-endpoint-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 10px;
}

.lead-source-endpoint-grid > div {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.lead-source-endpoint-grid small {
  color: var(--muted);
  font-size: 12px;
}

.lead-source-endpoint-grid pre {
  min-width: 0;
  max-height: 132px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.lead-source-endpoint-grid code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.lead-source-config-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lead-source-config-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.lead-source-config-form input,
.lead-source-config-form select,
.lead-source-config-form textarea {
  width: 100%;
  min-width: 0;
}

.lead-source-config-form .detail-form-wide {
  grid-column: 1 / -1;
}

.lead-source-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-source-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.lead-source-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 12px;
}

.lead-source-events,
.lead-source-leads {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.lead-source-event,
.lead-source-lead {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--soft);
}

.lead-source-event {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.lead-source-event > span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

.lead-source-event.failed > span {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.lead-source-event.pending > span {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.lead-source-event strong,
.lead-source-event small,
.lead-source-event time,
.lead-source-lead strong,
.lead-source-lead small,
.lead-source-lead span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-source-event small,
.lead-source-event time,
.lead-source-lead small,
.lead-source-lead span {
  color: var(--muted);
  font-size: 12px;
}

.lead-source-lead {
  display: grid;
  gap: 3px;
  width: 100%;
  color: var(--text);
  text-align: left;
}

.lead-source-lead:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.my-whatsapp-panel {
  padding: 18px;
}

.my-whatsapp-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
  max-width: 1120px;
}

.whatsapp-setup-panel,
.whatsapp-qr-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.whatsapp-setup-panel .panel-head,
.whatsapp-qr-panel .panel-head {
  align-items: flex-start;
}

.whatsapp-setup-panel .panel-head small,
.whatsapp-qr-panel .panel-head small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.whatsapp-setup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.whatsapp-status-card {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--soft));
  padding: 12px;
}

.whatsapp-status-card > span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--accent);
  background: var(--soft);
  flex: 0 0 auto;
}

.whatsapp-status-card strong,
.whatsapp-status-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.whatsapp-status-card small {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.whatsapp-status-card.ok > span {
  color: var(--success);
}

.whatsapp-status-card.warn > span {
  color: var(--warning);
}

.whatsapp-status-card.fail > span {
  color: var(--danger);
}

.whatsapp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.whatsapp-actions button,
.lead-whatsapp-connection button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.whatsapp-qr-box,
.whatsapp-qr-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: color-mix(in srgb, var(--panel) 88%, var(--soft));
}

.whatsapp-qr-box img {
  width: min(280px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.whatsapp-qr-box code {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-align: left;
}

.whatsapp-qr-box small,
.whatsapp-qr-empty span {
  color: var(--muted);
}

.lead-whatsapp-connection {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--soft);
}

.lead-whatsapp-connection.blocked {
  background: var(--warn);
}

.lead-whatsapp-connection strong,
.lead-whatsapp-connection span {
  display: block;
}

.lead-whatsapp-connection span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.lead-whatsapp-chat {
  display: grid;
  gap: 9px;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--panel) 88%, var(--soft));
}

.lead-whatsapp-chat.empty-chat {
  min-height: 160px;
  place-items: center;
  text-align: center;
}

.whatsapp-chat-empty {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.whatsapp-chat-empty strong {
  color: var(--ink);
}

.whatsapp-bubble {
  width: min(78%, 560px);
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--panel);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.whatsapp-bubble.outbound {
  justify-self: end;
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.whatsapp-bubble.inbound {
  justify-self: start;
}

.whatsapp-bubble small {
  color: var(--muted);
  font-size: 11px;
}

.whatsapp-admin-table td:first-child strong,
.whatsapp-admin-table td:first-child small {
  display: block;
  overflow-wrap: anywhere;
}

.whatsapp-admin-table td:first-child small {
  color: var(--muted);
  margin-top: 2px;
}

@media (max-width: 980px) {
  .workday-panel {
    padding: 0 0 12px;
  }

  .workday-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workday-next {
    grid-column: 1 / -1;
  }

  .sdr-operations-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-sources-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-source-card {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .lead-source-meta {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .lead-source-flow {
    grid-template-columns: 1fr;
  }

  .lead-source-flow-arrow {
    display: none;
  }

  .lead-source-config-form {
    grid-template-columns: 1fr;
  }

  .lead-source-signals,
  .lead-source-endpoint-grid {
    grid-template-columns: 1fr;
  }

  .my-whatsapp-panel,
  .lead-sources-panel {
    padding: 12px 0 0;
  }

  .my-whatsapp-shell,
  .whatsapp-setup-grid,
  .lead-sources-layout,
  .lead-source-detail-grid {
    grid-template-columns: 1fr;
  }

  .lead-whatsapp-connection {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-whatsapp-connection button {
    justify-content: center;
  }

  .whatsapp-bubble {
    width: min(92%, 560px);
  }
}
