:root {
  --bg: #0a1115;
  --bg-soft: #101a20;
  --panel: #111b21;
  --panel-soft: #0f171d;
  --text: #e9f4f1;
  --muted: #9ab2aa;
  --brand: #1fa57f;
  --brand-strong: #168768;
  --line: #22333b;
  --danger: #ff7a7a;
  --warn: #eeb957;
  --ok: #52d59a;
  --shadow: 0 18px 40px rgba(3, 8, 10, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #18343a 0%, transparent 35%),
    radial-gradient(circle at 90% 90%, #1b2d3a 0%, transparent 35%), var(--bg);
}

h1,
h2,
h3 {
  font-family: 'Sora', sans-serif;
  margin: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(31, 165, 127, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(31, 165, 127, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  z-index: -1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 17, 21, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 1.15rem;
}

h2 {
  font-size: 1rem;
}

h3 {
  font-size: 0.9rem;
}

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

.topbar-actions input {
  width: 190px;
}

.header-active-call {
  font-size: 0.76rem;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #122029;
  border-radius: 999px;
  padding: 7px 10px;
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn.active {
  background: var(--brand);
  color: #fff;
}

.layout {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 18px;
}

[data-page].page-hidden {
  display: none !important;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.collapsible-card {
  position: relative;
}

.collapse-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.collapse-toggle {
  position: relative;
  display: inline-flex;
}

.collapsible-card.collapsed > *:not(.collapse-toolbar) {
  display: none !important;
}

.collapsible-card.collapsed {
  min-height: 44px;
  padding-bottom: 8px;
}

.summary-card {
  grid-column: span 6;
}

.calls-card {
  grid-column: span 12;
}

.hot-card {
  grid-column: span 12;
}

.leads-card {
  grid-column: span 12;
}

.prompt-card {
  grid-column: span 4;
}

.agent-card {
  grid-column: span 8;
}

.endpoint-card {
  grid-column: span 12;
}

.status-card {
  grid-column: span 6;
  display: grid;
  gap: 10px;
}

.card-prime {
  border-color: #2f4a43;
  box-shadow: 0 18px 40px rgba(3, 8, 10, 0.52);
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 11px;
  background: var(--bg-soft);
  display: grid;
  gap: 4px;
}

.metric span {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 1.15rem;
  color: var(--brand-strong);
}

.runtime-list,
.call-recent {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.attempts-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel-soft);
}

.runtime-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel-soft);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

#now-call {
  border-style: solid;
  background: #0f1c23;
}

.runtime-item strong {
  display: block;
}

.runtime-item small {
  color: var(--muted);
}

.runtime-collapse {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #0f181d;
}

.runtime-collapse summary {
  cursor: pointer;
  font-weight: 700;
  color: #cfe8e0;
}

.runtime-collapse[open] summary {
  margin-bottom: 8px;
}

.call-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.recontact-select-line,
.recontact-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.recontact-select-line input {
  width: auto;
  accent-color: var(--brand);
}

.recontact-badges {
  justify-content: flex-end;
}

.call-item.call-item-long {
  border-color: #ffd272;
  box-shadow: inset 0 0 0 1px rgba(238, 185, 87, 0.25);
  background: linear-gradient(180deg, rgba(238, 185, 87, 0.08) 0%, rgba(17, 27, 33, 0.8) 100%);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.ok {
  background: rgba(17, 119, 71, 0.12);
  color: var(--ok);
}

.badge.off {
  background: rgba(191, 67, 67, 0.12);
  color: var(--danger);
}

.badge.warn {
  background: rgba(160, 101, 8, 0.14);
  color: var(--warn);
}

.badge.secondary {
  background: rgba(108, 142, 160, 0.14);
  color: #b8d0dc;
  text-transform: none;
  font-weight: 600;
}

.calls-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

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

.call-columns {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 12px;
}

.sub-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--panel-soft);
}

.sub-card h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.sub-card h3 + .call-list,
.sub-card h3 + .dialer-grid,
.sub-card h3 + .campaign-grid {
  margin-bottom: 14px;
}

.call-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

#call-recent,
#call-contacted,
#call-long,
#attempt-history {
  max-height: 320px;
  overflow: auto;
}

.call-history-tabs {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.call-history-tabs .mini.active {
  border-color: var(--brand);
  background: rgba(31, 165, 127, 0.14);
  color: #dff8ef;
}

.call-history-panel {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.call-mini {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #101920;
  font-size: 0.76rem;
}

.call-mini strong {
  display: block;
  margin-bottom: 3px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.dialer-grid .full,
.campaign-grid .full {
  grid-column: span 2;
}

.dispatch-card {
  margin-top: 8px;
  border: 1px solid #2e4a42;
  border-radius: 12px;
  padding: 10px;
  background: #0f181d;
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.dispatch-card h3 {
  margin: 0;
}

.dispatch-card .dialer-grid {
  grid-template-columns: 1fr;
}

.compact-grid {
  margin-top: 8px;
}

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

.hidden {
  display: none !important;
}

.channel-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.check-inline input {
  width: auto;
}

.inline-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.campaign-feedback {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.84rem;
  color: var(--muted);
  min-height: 44px;
}

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

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

.endpoint-item h3 {
  margin: 0;
  font-size: 0.9rem;
}

.endpoint-kv {
  font-size: 0.78rem;
  color: var(--muted);
}

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

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  font-size: 0.76rem;
}

.endpoint-row input,
.endpoint-row select {
  width: auto;
  min-width: 110px;
  max-width: 240px;
  margin: 0;
}

.endpoint-row .template-url {
  min-width: 260px;
  max-width: 560px;
}

.endpoint-row code {
  color: #d2ebe3;
  background: #122029;
  border: 1px solid #26413b;
  padding: 3px 6px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.campaign-collapse {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #0f181d;
}

.campaign-collapse summary {
  cursor: pointer;
  font-weight: 700;
  color: #cfe8e0;
  margin-bottom: 8px;
}

.campaign-collapse[open] summary {
  margin-bottom: 10px;
}

.pagination-bar {
  margin-top: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 33, 28, 0.42);
  display: grid;
  place-items: center;
  z-index: 60;
}

.modal-content {
  width: min(760px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.transcript-modal-content {
  width: min(980px, 94vw);
  background: linear-gradient(180deg, #111b21 0%, #0f181d 100%);
  display: grid;
  gap: 10px;
}

.audio-modal-content {
  width: min(640px, 94vw);
  display: grid;
  gap: 10px;
}

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

.transcript-head p {
  margin-top: 4px;
  font-size: 0.82rem;
}

.transcript-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.transcript-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: var(--muted);
  background: #0e171c;
}

.transcript-chip strong {
  color: var(--text);
}

.transcript-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d151a;
  max-height: 62vh;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.transcript-turn {
  border: 1px solid #27413b;
  border-radius: 10px;
  background: #0f191f;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.transcript-turn.turn-agent {
  border-color: #2f644f;
  background: #10211d;
}

.transcript-turn.turn-user {
  border-color: #3e4d73;
  background: #10182b;
}

.interaction-item {
  border: 1px solid #2a3d48;
  border-radius: 12px;
  background: #0f171d;
  padding: 10px;
  display: grid;
  gap: 6px;
}

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

.interaction-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.transcript-turn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.transcript-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  color: var(--brand);
}

.transcript-time {
  font-size: 0.72rem;
  color: var(--muted);
}

.transcript-message {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.84rem;
}

.transcript-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.audio-player-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f171d;
  padding: 12px;
}

.audio-player-wrap audio {
  width: 100%;
}

.timeline-modal-content {
  width: min(1240px, 96vw);
  background: linear-gradient(180deg, #111b21 0%, #0f181d 100%);
  display: grid;
  gap: 12px;
}

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

.timeline-summary-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d171c;
  padding: 9px 10px;
  min-width: 0;
}

.timeline-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.timeline-summary-item strong {
  display: block;
  color: var(--text);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-bottom: 4px;
}

.timeline-column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c151a;
  min-height: 360px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.timeline-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #132027;
  border-radius: 12px 12px 0 0;
}

.timeline-column-head h4 {
  margin: 0;
  font-size: 0.82rem;
}

.timeline-column-head span {
  min-width: 24px;
  text-align: center;
  border-radius: 999px;
  background: #22333b;
  color: #cfe8e0;
  font-size: 0.72rem;
  padding: 3px 7px;
  font-weight: 800;
}

.timeline-card-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 9px;
  max-height: 58vh;
  overflow: auto;
}

.timeline-card {
  border: 1px solid #294049;
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  background: #101a20;
  padding: 9px;
  display: grid;
  gap: 6px;
}

.timeline-type-qualificacao {
  border-left-color: var(--warn);
}

.timeline-type-contatos {
  border-left-color: #5da9ff;
}

.timeline-type-reuniao {
  border-left-color: var(--ok);
}

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

.timeline-pill {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(31, 165, 127, 0.14);
  color: #aee9d5;
  font-size: 0.68rem;
  font-weight: 800;
}

.timeline-card time {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.timeline-card strong {
  font-size: 0.82rem;
}

.timeline-card p {
  color: #c2d6d0;
  font-size: 0.76rem;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.lead-intel-modal-content {
  width: min(1180px, 96vw);
  background: linear-gradient(180deg, #111b21 0%, #0f181d 100%);
  display: grid;
  gap: 12px;
}

.lead-intel-board {
  display: grid;
  grid-template-columns: 1.25fr 0.72fr 1fr 0.78fr 0.88fr;
  gap: 10px;
  overflow: auto;
  padding-bottom: 4px;
}

.lead-intel-column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c151a;
  min-height: 320px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.lead-intel-card,
.lead-intel-score-card {
  margin: 9px;
  border: 1px solid #294049;
  border-radius: 10px;
  background: #101a20;
  padding: 10px;
  display: grid;
  gap: 9px;
  align-content: start;
}

.lead-intel-card p,
.lead-intel-score-card p {
  color: #c2d6d0;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead-intel-score-card {
  min-height: 180px;
  place-items: center;
  text-align: center;
  border-top: 3px solid var(--brand);
}

.lead-intel-score-card strong {
  font-size: 2.15rem;
  line-height: 1;
}

.lead-intel-score-card span {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(31, 165, 127, 0.14);
  color: #aee9d5;
  font-size: 0.72rem;
  font-weight: 800;
}

.lead-intel-score-ok .lead-intel-score-card {
  border-top-color: var(--ok);
}

.lead-intel-score-warn .lead-intel-score-card {
  border-top-color: var(--warn);
}

.lead-intel-score-danger .lead-intel-score-card {
  border-top-color: var(--danger);
}

.lead-intel-source {
  display: grid;
  gap: 6px;
}

.lead-intel-source > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.lead-intel-source strong {
  color: var(--text);
}

.lead-intel-bar {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #17242b;
  border: 1px solid #263b43;
}

.lead-intel-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.lead-intel-bar .source-calls {
  background: #5da9ff;
}

.lead-intel-bar .source-chatwoot {
  background: var(--warn);
}

.lead-intel-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.lead-intel-chat-list {
  display: grid;
  gap: 8px;
  padding: 9px;
  max-height: 52vh;
  overflow: auto;
}

.chatwoot-highlight {
  border: 1px solid #294049;
  border-left: 3px solid #5da9ff;
  border-radius: 10px;
  background: #101a20;
  padding: 9px;
  display: grid;
  gap: 6px;
}

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

.chatwoot-highlight span {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(93, 169, 255, 0.14);
  color: #bcdcff;
  font-size: 0.68rem;
  font-weight: 800;
}

.chatwoot-highlight time,
.chatwoot-highlight small {
  color: var(--muted);
  font-size: 0.68rem;
}

.chatwoot-highlight p {
  color: #d3e6e1;
  font-size: 0.76rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.chatwoot-highlight-sem_interesse,
.chatwoot-highlight-sem_dinheiro {
  border-left-color: var(--danger);
}

.chatwoot-highlight-sem_interesse span,
.chatwoot-highlight-sem_dinheiro span {
  background: rgba(255, 122, 122, 0.14);
  color: #ffc4c4;
}

.chatwoot-highlight-capital,
.chatwoot-highlight-horario {
  border-left-color: var(--warn);
}

.chatwoot-highlight-capital span,
.chatwoot-highlight-horario span {
  background: rgba(238, 185, 87, 0.14);
  color: #ffe1a3;
}

.chatwoot-highlight-interesse {
  border-left-color: var(--ok);
}

.chatwoot-highlight-interesse span {
  background: rgba(82, 213, 154, 0.14);
  color: #baf4d8;
}

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

.agent-grid .full {
  grid-column: span 2;
}

.agent-grid details {
  display: grid;
  gap: 8px;
}

.agent-grid details label {
  margin-top: 2px;
}

.agent-grid details textarea {
  min-height: 86px;
  margin-top: 0;
}

.toggle-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #0f181d;
  display: grid;
  gap: 8px;
}

.group-title {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pill-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pill-btn {
  background: #1a2830;
  color: #d4e7e2;
  border: 1px solid #2d4852;
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 700;
}

.pill-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.pill-btn:hover {
  background: #243741;
  color: #e8f6f2;
}

.pill-btn.active:hover {
  background: var(--brand-strong);
  color: #fff;
}

#setting-opening-message {
  min-height: 90px;
  resize: vertical;
}

#setting-prompt-template,
#setting-first-message-template {
  min-height: 88px;
  resize: vertical;
}

#eleven-dispatch-first-message,
#eleven-dispatch-prompt,
#tool-instructions,
#prompt-instructions {
  min-height: 80px;
  resize: vertical;
  margin-top: 0;
}

.call-state {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.73rem;
  text-transform: none;
  letter-spacing: 0.01em;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  background: #0f171d;
  color: var(--text);
}

textarea {
  min-height: 200px;
  resize: vertical;
  margin-top: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #1c2a31;
  color: #d8ebe6;
}

button.mini {
  font-size: 0.75rem;
  padding: 6px 8px;
}

.discreet-btn {
  opacity: 0.82;
}

.discreet-btn:hover {
  opacity: 1;
}

.inline-select {
  min-width: 92px;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 0.72rem;
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.leads-table-wrap {
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1300px;
}

.leads-table {
  table-layout: fixed;
  min-width: 1180px;
}

.leads-table th:nth-child(1),
.leads-table td:nth-child(1) {
  width: 52px;
}

.leads-table th:nth-child(2),
.leads-table td:nth-child(2) {
  width: 170px;
}

.leads-table th:nth-child(3),
.leads-table td:nth-child(3) {
  width: 210px;
}

.leads-table th:nth-child(5),
.leads-table td:nth-child(5) {
  width: 138px;
}

.leads-table th:nth-child(10),
.leads-table td:nth-child(10) {
  width: 220px;
}

.leads-table th:nth-child(13),
.leads-table td:nth-child(13) {
  width: 110px;
}

.leads-table th:nth-child(14),
.leads-table td:nth-child(14) {
  width: 180px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  vertical-align: top;
  font-size: 0.76rem;
}

thead tr:first-child th {
  position: sticky;
  top: 0;
  background: #1a2930;
  z-index: 2;
}

.filter-row th {
  background: #132027;
  position: sticky;
  top: 39px;
  z-index: 1;
}

.actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.leads-table .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.leads-table .actions .badge {
  grid-column: span 2;
  justify-content: center;
}

.leads-table .actions button {
  width: 100%;
  min-height: 30px;
  padding-left: 6px;
  padding-right: 6px;
}

.lead-name {
  display: block;
  margin-bottom: 3px;
}

.lead-name + small {
  display: none;
  color: var(--muted);
}

.lead-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.lead-badge-row .badge {
  font-size: 0.64rem;
  padding: 3px 6px;
  text-transform: none;
  line-height: 1.2;
}

.lead-info-cell {
  display: -webkit-box;
  max-height: 6.2em;
  overflow: hidden;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.form-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 210px;
}

.note-preview-trigger {
  position: relative;
}

.note-preview-trigger[data-note-preview]:hover::after,
.note-preview-trigger[data-note-preview]:focus-visible::after {
  content: attr(data-note-preview);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: max-content;
  max-width: 320px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  background: #0f1c22;
  color: #eef8f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(2, 10, 14, 0.34);
  padding: 10px 12px;
  pointer-events: none;
}

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

.prompt-actions small {
  margin-left: auto;
}

#summary-hint {
  color: var(--muted);
  font-size: 0.74rem;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.error {
  color: var(--danger);
}

.global-toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 120;
  background: #123f35;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(10, 28, 24, 0.28);
  max-width: min(420px, 92vw);
  font-size: 0.86rem;
}

.swal-note-view {
  max-height: 48vh;
  overflow: auto;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 1500px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

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

  .leads-table {
    min-width: 980px;
  }

  .leads-table th:nth-child(3),
  .leads-table td:nth-child(3),
  .leads-table th:nth-child(7),
  .leads-table td:nth-child(7),
  .leads-table th:nth-child(8),
  .leads-table td:nth-child(8),
  .leads-table th:nth-child(9),
  .leads-table td:nth-child(9),
  .leads-table th:nth-child(11),
  .leads-table td:nth-child(11) {
    display: none;
  }

  .lead-name + small {
    display: block;
  }

  .leads-table th:nth-child(10),
  .leads-table td:nth-child(10) {
    width: 260px;
  }
}

@media (max-width: 900px) {
  .leads-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .leads-table,
  .leads-table tbody,
  .leads-table tr,
  .leads-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .leads-table thead {
    display: none;
  }

  .leads-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f171d;
    margin-bottom: 10px;
    padding: 8px;
  }

  .leads-table td {
    border-bottom: 1px solid rgba(34, 51, 59, 0.65);
    padding: 8px 4px;
  }

  .leads-table td:last-child {
    border-bottom: 0;
  }

  .leads-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 3px;
  }

  .leads-table .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .leads-table .actions .badge {
    grid-column: span 3;
  }

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

  .timeline-board {
    grid-template-columns: minmax(240px, 1fr);
    overflow: visible;
  }

  .timeline-card-list {
    max-height: none;
  }

  .lead-intel-board {
    grid-template-columns: minmax(240px, 1fr);
    overflow: visible;
  }

  .lead-intel-column {
    min-height: auto;
  }

  .lead-intel-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .summary-card,
  .calls-card,
  .hot-card,
  .prompt-card,
  .agent-card,
  .status-card,
  .leads-card,
  .endpoint-card {
    grid-column: span 12;
  }

  .topbar {
    padding: 16px;
  }

  .call-columns,
  .dialer-grid,
  .campaign-grid,
  .period-grid,
  .agent-grid,
  .endpoint-grid {
    grid-template-columns: 1fr;
  }

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

  .pagination-bar {
    align-items: stretch;
  }

  .layout {
    padding: 12px;
  }

  .topbar-actions input {
    width: 100%;
  }

  .header-active-call {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
