:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --surface: #f7f9fb;
  --surface-strong: #eef3f7;
  --ink: #15202b;
  --muted: #687385;
  --line: #cfd8e3;
  --line-soft: #e4eaf0;
  --teal: #0f8f83;
  --teal-soft: #dff4f1;
  --amber: #b36b00;
  --amber-soft: #fff0d7;
  --rose: #a23b5a;
  --rose-soft: #f8dfe7;
  --blue: #2764a8;
  --blue-soft: #e2eefb;
  --green: #1d7a46;
  --green-soft: #e1f2e8;
  --shadow: 0 12px 30px rgba(20, 31, 43, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef3f6;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 24px;
}

.login-brand {
  padding: 0;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
}

.login-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  border-radius: 6px;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

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

.nav {
  display: grid;
  gap: 6px;
}

.nav-button,
.primary-button,
.secondary-button,
.chip-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
}

.nav-button {
  text-align: left;
  padding: 10px 12px;
}

.nav-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #07564f;
  font-weight: 700;
}

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

.user-box {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 2px;
}

.user-box span,
.user-box small {
  color: var(--muted);
  font-size: 12px;
}

.user-box strong {
  font-size: 15px;
}

.logout-button {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  margin-top: 8px;
  padding: 8px 10px;
  text-align: center;
}

.logout-button:hover {
  border-color: var(--rose);
  color: var(--rose);
}

.metrics div {
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  padding: 10px;
}

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

.metrics strong {
  font-size: 24px;
}

.privacy-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

.support-mode-control {
  align-items: center;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #713f12;
  display: inline-flex;
  gap: 7px;
  padding: 4px 7px;
}

.support-mode-control span {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.support-mode-control select {
  background: white;
  border: 1px solid #fbbf24;
  border-radius: 5px;
  color: #1f2937;
  font: inherit;
  padding: 3px 7px;
}

.privacy-toggle {
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
}

.privacy-toggle:hover {
  border-color: var(--teal);
}

.privacy-toggle.protected {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #7a4b00;
}

.privacy-toggle span {
  color: inherit;
}

.privacy-blur {
  filter: blur(3px);
  opacity: .76;
  user-select: none;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
}

.account-banner {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 8px;
  padding: 7px 9px;
}

.account-banner span,
.account-banner small {
  color: var(--muted);
  font-size: 12px;
}

.account-banner strong {
  font-size: 13px;
}

.account-banner .privacy-toggle span,
.detail-header .privacy-toggle span {
  color: inherit;
}

.template-mode-pill {
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
}

.template-mode-pill.safe {
  background: var(--green-soft);
  border-color: #9bd3b2;
  color: var(--green);
}

.template-mode-pill.custom {
  background: var(--amber-soft);
  border-color: #e6bd76;
  color: var(--amber);
}

.template-mode-pill.standard {
  background: var(--blue-soft);
  border-color: #afcae6;
  color: var(--blue);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar input {
  width: 270px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.assignee-filter {
  width: 210px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  padding: 10px 13px;
}

.secondary-button {
  background: #f2f6fa;
  border-color: #ccd8e4;
  color: #1e3347;
  padding: 9px 11px;
}

.secondary-button:hover {
  background: #e8f0f7;
  border-color: #afbfce;
}

.view {
  display: none;
  min-height: 0;
  padding: 18px;
}

.view.active {
  display: block;
}

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

.kanban-column {
  background: #edf1f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-height: calc(100vh - 128px);
}

.kanban-column.drop-target {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px var(--teal-soft);
}

.column-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

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

.count-pill {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.card-stack {
  padding: 10px;
  display: grid;
  gap: 10px;
  overflow: auto;
}

.lead-card {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 3px 8px rgba(20, 31, 43, .05);
  cursor: pointer;
}

.lead-card.dragging {
  opacity: .55;
  cursor: grabbing;
}

.lead-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-soft);
}

.lead-card.delegated {
  background: #f3f4f6;
  border-color: #cbd5e1;
  box-shadow: none;
  opacity: .88;
}

.lead-card.delegated .temperature-bar i {
  filter: grayscale(1);
  opacity: .7;
}

.lead-card.delegated-tag,
.tag.delegated-tag {
  background: #e5e7eb;
  color: #374151;
  font-weight: 700;
}

.lead-card h3 {
  margin: 0;
  font-size: 15px;
}

.lead-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.drag-handle {
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.lead-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.card-phone-row {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-phone {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.eye-icon {
  position: relative;
  width: 15px;
  height: 9px;
  border: 1.7px solid currentColor;
  border-radius: 999px / 720px;
  color: #526173;
}

.eye-icon::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.privacy-toggle.protected .eye-icon::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-35deg);
}

.privacy-toggle.protected .eye-icon {
  color: #7a4b00;
}

.card-signal-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.card-next {
  border-left: 3px solid var(--amber);
  padding-left: 7px;
  font-size: 12px;
  color: #4f5d6e;
}

.temperature-row {
  margin-top: 9px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 8px;
}

.temperature-row span {
  color: var(--muted);
  font-size: 11px;
}

.temperature-row strong {
  color: var(--ink);
  font-size: 18px;
}

.temperature-bar {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf3;
}

.temperature-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--amber), var(--green));
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 12px;
  background: #eef1f4;
  color: #4f5d6e;
}

.tag.hot {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag.warm {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.cold {
  background: var(--blue-soft);
  color: var(--blue);
}

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 22px;
  background: rgba(15, 23, 35, .52);
  overflow: auto;
}

.detail-panel.open {
  display: block;
}

.empty-detail {
  min-height: 260px;
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.empty-detail strong {
  color: var(--ink);
}

.detail-content {
  width: min(1180px, 100%);
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid #b9c6d3;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 7px;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -18px -18px 0;
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
  border-bottom: 1px solid #c5d0dc;
  border-radius: 8px 8px 0 0;
}

.detail-header h2 {
  margin: 0;
  font-size: 21px;
}

.detail-header span {
  color: var(--muted);
}

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

.detail-privacy {
  margin-left: 0;
}

.detail-close {
  min-width: 86px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: #536477;
  font-size: 12px;
  font-weight: 700;
}

.field select,
.field input,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
  background: white;
  color: var(--ink);
}

.section {
  border: 1px solid #c7d2dd;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

.section h3 {
  margin: -2px 0 12px;
  font-size: 14px;
  color: #16293b;
}

.template-guide {
  display: grid;
  gap: 12px;
}

.template-guide-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.template-guide-head h3,
.template-guide-head p {
  margin: 0;
}

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

.template-guide-grid > div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.template-guide-grid strong {
  display: block;
  margin-bottom: 7px;
}

.template-guide-grid ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.template-guide-grid li {
  color: #405164;
}

.template-pitchmatch-card {
  background: #fffdf6;
  border: 1px solid #ead8a8;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  padding: 10px;
}

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

.template-pitchmatch-grid > div {
  background: white;
  border: 1px solid #ead8a8;
  border-radius: 7px;
  padding: 8px;
}

.template-pitchmatch-grid span {
  color: var(--amber);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.template-pitchmatch-grid p {
  margin: 4px 0 0;
}

.template-phase-suggestions {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.template-phase-suggestions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.template-phase-suggestions p {
  margin: 0;
}

.template-phase-chip {
  background: white;
  padding: 7px 9px;
}

.template-phase-chip.mapped {
  background: var(--green-soft);
  border-color: #9bd3b2;
  color: var(--green);
}

.diagnostic-grid {
  display: grid;
  gap: 8px;
}

.pitchmatch-section {
  display: grid;
  gap: 12px;
  background: #f8fafc;
}

.pitchmatch-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.pitchmatch-head h3,
.pitchmatch-head p {
  margin: 0;
}

.pitchmatch-score {
  min-width: 72px;
  border: 1px solid #c7d2dd;
  border-radius: 6px;
  padding: 7px 9px;
  text-align: center;
  background: white;
}

.pitchmatch-head-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pitchmatch-score span,
.pitchmatch-profile span,
.pitchmatch-reading span,
.pitchmatch-script span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.pitchmatch-score strong {
  display: block;
  font-size: 18px;
}

.pitchmatch-profile {
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 10px 12px;
  background: linear-gradient(90deg, #d8f1ed 0%, #edf8f6 100%);
  border-top: 1px solid #b4ded6;
  border-right: 1px solid #b4ded6;
  border-bottom: 1px solid #b4ded6;
}

.pitchmatch-profile strong {
  display: block;
  font-size: 19px;
  color: #07564f;
}

.pitchmatch-profile small {
  color: #07564f;
}

.pitchmatch-reading,
.pitchmatch-script {
  border: 1px solid #c7d2dd;
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.pitchmatch-script {
  border-color: #e3b341;
  background: #fff7dc;
  box-shadow: inset 0 0 0 1px rgba(179, 107, 0, .18);
}

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

.pitchmatch-script-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pitch-action-button {
  min-width: 82px;
  padding: 7px 10px;
  font-size: 12px;
}

.copy-pitch-button {
  width: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
}

.copy-icon {
  position: relative;
  width: 14px;
  height: 16px;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-radius: 2px;
  background: white;
}

.copy-icon::before {
  left: 0;
  top: 0;
  opacity: .65;
}

.copy-icon::after {
  right: 0;
  bottom: 0;
}

.copy-pitch-button.copied {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.pitchmatch-script-title {
  color: #6f4300;
  font-size: 13px;
}

.pitchmatch-reading p,
.pitchmatch-script p {
  margin: 4px 0 0;
}

.pitchmatch-script p {
  margin-top: 9px;
  color: #2f2509;
}

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

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

.pitchmatch-block {
  border: 1px solid #c7d2dd;
  border-radius: 8px;
  padding: 11px 12px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

.pitchmatch-block.collected {
  background: #eef9f6;
  border-color: #a8dcd2;
}

.pitchmatch-block.action {
  background: #fff5dc;
  border-color: #e9c46f;
}

.pitchmatch-block-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

.pitchmatch-block-title strong {
  font-size: 14px;
  color: #16293b;
}

.pitchmatch-block-title span {
  color: var(--muted);
  font-size: 11px;
}

.pitchmatch-block.collected .diagnostic-item {
  border-left-color: var(--teal);
}

.pitchmatch-block.action .diagnostic-item {
  border-left-color: var(--amber);
}

.diagnostic-item {
  border-left: 3px solid var(--teal);
  padding: 8px 9px;
  background: rgba(255, 255, 255, .72);
  border-radius: 6px;
}

.diagnostic-item span {
  display: block;
  color: #607184;
  font-size: 12px;
  text-transform: uppercase;
}

.diagnostic-item strong {
  display: block;
  margin-top: 2px;
  color: #16293b;
}

.conversation {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.message {
  border-radius: 8px;
  padding: 9px 10px;
  max-width: 90%;
  border-left: 4px solid transparent;
}

.message.inbound {
  background: #f2f4f6;
  justify-self: start;
}

.message.outbound {
  background: var(--green-soft);
  justify-self: end;
}

.message.manual,
.live-bubble.manual {
  border-left-color: var(--blue);
}

.message.manual-followup,
.live-bubble.manual-followup {
  border-left-color: var(--amber);
}

.message.auto-followup,
.live-bubble.auto-followup {
  border-left-color: var(--rose);
}

.message.ai,
.live-bubble.ai {
  border-left-color: var(--green);
}

.message-origin {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 5px;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  background: #eef1f4;
  color: #4f5d6e;
}

.message-origin.manual {
  background: var(--blue-soft);
  color: var(--blue);
}

.message-origin.manual-followup {
  background: var(--amber-soft);
  color: var(--amber);
}

.message-origin.auto-followup {
  background: var(--rose-soft);
  color: var(--rose);
}

.message-origin.ai {
  background: var(--green-soft);
  color: var(--green);
}

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

.notes-form {
  display: grid;
  gap: 8px;
}

.notes-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.note {
  background: #fff9e8;
  border: 1px solid #f0dda8;
  border-radius: 6px;
  padding: 8px;
}

.recovery-layout,
.inbox-list {
  display: grid;
  gap: 14px;
}

.followup-settings,
.followup-lead-status {
  border: 1px solid #c7d2dd;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.followup-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.followup-settings strong,
.followup-settings p {
  display: block;
  margin: 0;
}

.followup-settings.enabled,
.followup-lead-status.enabled {
  border-left: 4px solid var(--green);
  background: #f3fbf6;
}

.followup-settings.disabled,
.followup-lead-status.disabled {
  border-left: 4px solid var(--rose);
  background: #fff5f7;
}

.followup-lead-status {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.followup-lead-status span {
  font-weight: 700;
}

.followup-lead-status small {
  color: var(--muted);
}

.audit-layout {
  display: grid;
  gap: 14px;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.audit-head h2,
.audit-head p {
  margin: 0;
}

.audit-head select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  min-width: 210px;
}

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

.audit-row {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}

.audit-row.outbound {
  border-left-color: var(--green);
}

.audit-row p {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.log-payload {
  margin: 10px 0 0;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.audit-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.audit-meta > span:not(.tag) {
  color: var(--muted);
}

.recovery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.recovery-card,
.inbox-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}

.inbox-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr auto;
  gap: 12px;
  align-items: center;
}

.live-shell {
  height: calc(100vh - 142px);
  display: grid;
  grid-template-columns: minmax(280px, 36%) minmax(0, 1fr);
  background: white;
  border-top: 1px solid var(--line);
}

.live-list-panel {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.live-list-head span,
.live-contact-top span {
  color: var(--muted);
  font-size: 12px;
}

.live-contact-list {
  overflow: auto;
  min-height: 0;
}

.live-contact {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: white;
}

.live-contact:hover,
.live-contact.active {
  background: #eef6f5;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: #07564f;
  font-weight: 700;
}

.live-contact-main {
  min-width: 0;
}

.live-contact-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.live-contact-top strong,
.live-contact p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-contact p {
  margin: 4px 0 6px;
  color: var(--muted);
}

.live-chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) auto auto;
  background: #f7f1e8;
}

.live-chat-header {
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-chat-header strong,
.live-chat-header span {
  display: block;
}

.live-chat-header span {
  color: var(--muted);
  font-size: 12px;
}

.live-messages {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-bubble {
  max-width: min(680px, 78%);
  border: 1px solid rgba(0, 0, 0, .05);
  border-left: 4px solid transparent;
  border-radius: 8px;
  padding: 9px 10px;
  box-shadow: 0 3px 12px rgba(20, 31, 43, .05);
}

.live-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.live-bubble small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.live-bubble.inbound {
  align-self: flex-start;
  background: white;
}

.live-bubble.outbound {
  align-self: flex-end;
  background: #dcf8c6;
}

.quick-replies {
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(251, 252, 253, .82);
  border-top: 1px solid rgba(223, 229, 235, .8);
}

.quick-replies:empty {
  display: none;
}

.live-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
  border-top: 1px solid var(--line);
}

.live-composer.disabled {
  opacity: .55;
  pointer-events: none;
}

.live-composer input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  background: white;
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.team-layout {
  display: grid;
  gap: 14px;
}

.user-form,
.channel-form,
.account-form {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1.2fr 150px 180px auto;
  gap: 8px;
}

.channel-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-form input[type="hidden"] {
  display: none;
}

.plan-summary {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 10px 12px;
}

.plan-summary strong {
  color: var(--text);
}

.plan-summary.compact {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.plan-summary span {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}

.form-field {
  display: grid;
  gap: 4px;
}

.form-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.form-field-account {
  min-width: 0;
}

.user-form input,
.user-form select,
.channel-form input,
.channel-form select,
.account-form input,
.account-form select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.form-field-channel-secret {
  display: grid;
  gap: 4px;
}

.form-field-channel-secret span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.channel-pairing-panel {
  display: grid;
}

.channel-pairing {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.channel-pairing-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.channel-pairing-head strong {
  display: block;
  font-size: 18px;
}

.channel-pairing-head p {
  margin: 4px 0 0;
}

.channel-pairing-body {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  align-items: center;
}

.channel-pairing-qr {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 280px;
  padding: 14px;
}

.channel-pairing-image {
  display: block;
  max-width: 260px;
  width: 100%;
  height: auto;
}

.channel-pairing-copy {
  display: grid;
  gap: 10px;
}

.channel-pairing .health-pill.warm {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.channel-pairing .health-pill.cold {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.channel-pairing .health-pill.hot {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.inline-check input {
  width: auto;
}

.channel-card .row-tags {
  justify-content: flex-end;
}

.channel-edit-panel {
  margin-top: 8px;
}

.channel-edit-panel summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.channel-edit-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0;
  max-width: 760px;
}

.channel-edit-grid label {
  display: grid;
  gap: 4px;
}

.channel-edit-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.channel-edit-grid input,
.channel-edit-grid select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

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

.connection-health-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.connection-health-head strong {
  display: block;
  font-size: 18px;
}

.connection-health-head p {
  margin: 4px 0 0;
}

.connection-health-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.connection-health-card {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid #0f766e;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.connection-health-card.warn {
  border-left-color: #d97706;
}

.connection-health-card.danger {
  border-left-color: #dc2626;
}

.health-pill {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  color: #065f46;
  font-size: 12px;
  font-weight: 800;
  justify-self: start;
  padding: 4px 8px;
}

.connection-health-card.warn .health-pill {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.connection-health-card.danger .health-pill {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.connection-health-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.connection-health-notes span {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
}

.connection-last-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #991b1b;
  font-size: 12px;
  margin: 0;
  padding: 8px;
}

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

.log-filters select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.accounts-list {
  display: grid;
  gap: 12px;
}

.account-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.account-card-head,
.account-card-foot {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.account-card-head strong {
  display: block;
  font-size: 17px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.account-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px;
}

.account-summary > div {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 9px 10px;
}

.account-summary-label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.account-template-line {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 9px 10px;
}

.account-template-line span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.templates-list {
  display: grid;
  gap: 18px;
}

.template-editor-list,
.template-assignment-list {
  display: grid;
  gap: 12px;
}

.template-editor-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.template-editor-card summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
  padding: 14px;
}

.template-editor-card summary::-webkit-details-marker {
  display: none;
}

.template-editor-card summary strong,
.template-editor-card summary span {
  display: block;
}

.template-editor-card summary strong {
  font-size: 17px;
}

.template-editor-card summary div > span {
  color: var(--muted);
  margin-top: 2px;
}

.template-editor-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.template-field {
  display: grid;
  gap: 5px;
}

.template-field.wide,
.template-editor-actions {
  grid-column: 1 / -1;
}

.template-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.template-field textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.template-field textarea[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.template-editor-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.template-editor-actions p {
  margin: 0;
}

.template-assignment-section {
  display: grid;
  gap: 10px;
}

.template-assignment-section h3,
.template-assignment-section p {
  margin: 0;
}

.template-import-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.template-import-panel summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.template-import-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.template-assistant-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 12px;
}

.template-assistant-box strong,
.template-assistant-box p {
  margin: 0;
}

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

.template-assistant-grid label {
  display: grid;
  gap: 4px;
}

.template-assistant-grid label.wide {
  grid-column: 1 / -1;
}

.template-assistant-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.template-assistant-grid input,
.template-assistant-grid textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
}

.template-field input,
.template-field select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
}

.template-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.template-card-head,
.template-select-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.template-card-head strong {
  font-size: 17px;
}

.template-select-row select {
  border: 1px solid var(--line);
  border-radius: 6px;
  flex: 1;
  padding: 10px 12px;
}

.template-kanban-mode {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px;
}

.template-kanban-mode strong,
.template-kanban-mode p {
  margin: 0;
}

.template-kanban-actions {
  display: flex;
  gap: 8px;
  min-width: min(360px, 100%);
}

.template-kanban-actions select {
  border: 1px solid var(--line);
  border-radius: 6px;
  flex: 1;
  padding: 9px 10px;
}

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

.usage-meter {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.usage-meter-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.usage-meter-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.usage-meter-head strong {
  font-size: 13px;
}

.usage-meter-bar {
  background: #e2e8f0;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.usage-meter-bar span {
  background: #0f766e;
  border-radius: inherit;
  display: block;
  height: 100%;
}

.usage-meter.warn .usage-meter-bar span {
  background: #d97706;
}

.usage-meter.danger .usage-meter-bar span {
  background: #dc2626;
}

.account-edit-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.account-edit-panel summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}

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

.account-grid label {
  display: grid;
  gap: 4px;
}

.account-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.account-grid input,
.account-grid select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

.secondary-button.danger {
  border-color: #fecaca;
  color: #991b1b;
}

.compact-button {
  min-height: 0;
  padding: 5px 8px;
}

.team-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.team-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-card strong,
.team-card p {
  display: block;
  margin: 0;
}

.muted,
.empty-state {
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, .55);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .toolbar,
  .action-row,
  .detail-header,
  .followup-settings,
  .pitchmatch-head,
  .pitchmatch-script-head,
  .pitchmatch-columns,
  .pitchmatch-grid,
  .template-guide-head,
  .template-guide-grid,
  .template-pitchmatch-grid,
  .inbox-row,
  .audit-head,
  .user-form,
  .channel-form,
  .account-form,
  .account-grid,
  .channel-edit-grid,
  .log-filters,
  .account-summary,
  .usage-grid,
  .account-card-head,
  .account-card-foot,
  .account-actions,
  .template-editor-body,
  .template-editor-actions,
  .template-editor-card summary,
  .template-import-grid,
  .template-assistant-grid,
  .template-kanban-mode,
  .template-kanban-actions,
  .template-card-head,
  .template-select-row,
  .channel-pairing-body {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .assignee-filter {
    width: 100%;
  }

  .channel-pairing-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .kanban-board {
    grid-auto-columns: minmax(250px, 86vw);
  }

  .detail-panel {
    padding: 10px;
  }

  .detail-content {
    min-height: calc(100vh - 20px);
  }

  .live-shell {
    height: auto;
    min-height: 70vh;
    grid-template-columns: 1fr;
  }

  .live-list-panel {
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .live-chat-panel {
    min-height: 560px;
  }

  .live-bubble {
    max-width: 92%;
  }
}
