:root {
  --bg: #06101f;
  --surface: #101d34;
  --surface-2: #162742;
  --surface-3: #213657;
  --border: #29456d;
  --text: #f3f8ff;
  --muted: #89a3c8;
  --primary: #4f8fff;
  --primary-2: #2f6fe6;
  --primary-3: #79b1ff;
  --cyan-soft: #59c7ff;
  --primary-soft: rgba(79, 143, 255, 0.18);
  --success: #22c55e;
  --danger: #ff5b63;
  --warning: #f4b13e;
  --sidebar-width: 160px;
  --instances-sidebar-width: 220px;
  --instances-sidebar-collapsed-width: 34px;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(82, 136, 255, 0.2), transparent 20%),
    radial-gradient(circle at top right, rgba(42, 113, 226, 0.14), transparent 18%),
    linear-gradient(180deg, #071224 0%, #06101d 52%, #040913 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  min-width: 0;
  overflow-x: hidden;
}

body.auth-locked {
  overflow: hidden;
}

/* Quando o login estiver aberto, bloqueia qualquer interacao com o painel ao fundo
   (inclusive menu de instancias) e garante que apenas o overlay de auth seja clicavel. */
body.auth-locked .app-shell {
  pointer-events: none;
  user-select: none;
}

body.auth-locked #auth-overlay {
  pointer-events: auto;
}

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

button {
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  caret-color: transparent;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-3);
  color: var(--text);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  resize: vertical;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 34, 58, 0.98) 0%, rgba(14, 26, 46, 0.98) 100%);
  border-right: 1px solid rgba(121, 177, 255, 0.1);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(20, 34, 58, 0.98) 0%, rgba(17, 30, 51, 0.96) 100%);
  border-bottom: 1px solid rgba(121, 177, 255, 0.08);
  font-weight: 800;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--primary-3) 0%, var(--primary-2) 100%);
  color: white;
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(47, 111, 230, 0.24);
}

.brand-name {
  font-size: 13px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px 14px;
  align-items: stretch;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  border: 1px solid transparent;
  user-select: none;
}

.nav-item.is-active {
  background: linear-gradient(180deg, rgba(79, 143, 255, 0.2) 0%, rgba(54, 109, 214, 0.16) 100%);
  color: #a9caff;
  border-color: rgba(121, 177, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-icon {
  width: 14px;
  text-align: center;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cyan-soft) 0%, var(--primary) 100%);
  color: white;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(121, 177, 255, 0.08);
  color: var(--muted);
  font-size: 10px;
}

.sidebar-status-text {
  line-height: 1.5;
}

.sidebar-logout {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
}

.main-content {
  padding: 12px 14px 18px;
}

@media (min-width: 1200px) {
  .main-content {
    margin-right: var(--instances-sidebar-width);
  }

  body.instances-sidebar-collapsed .main-content {
    margin-right: 0;
  }

  .instances-drawer-overlay {
    display: none !important;
  }
}

.main-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 8px;
}

.instances-open-tab {
  display: none;
  white-space: nowrap;
}

body.instances-sidebar-collapsed .instances-open-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.main-toolbar-active {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  max-width: 720px;
}

.main-toolbar-active strong {
  font-size: 13px;
}

.main-toolbar-active span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instances-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(92vw, 360px);
  height: 100vh;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 34, 58, 0.98) 0%, rgba(14, 26, 46, 0.98) 100%);
  border-left: 1px solid rgba(121, 177, 255, 0.14);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.35);
  transform: translateX(0);
  transition: transform 180ms ease;
  z-index: 60;
}

@media (min-width: 1200px) {
  .instances-sidebar {
    width: var(--instances-sidebar-width);
  }
}

.instances-sidebar-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(19, 33, 56, 0.98) 0%, rgba(14, 26, 46, 0.98) 100%);
  color: #c8dbff;
  border: 1px solid rgba(121, 177, 255, 0.18);
  display: grid;
  place-items: center;
  z-index: 6;
  box-shadow: 0 8px 18px rgba(3, 9, 20, 0.22);
  transform: none;
}

.instances-sidebar-toggle-icon {
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.instance-toolbar {
  margin-bottom: 18px;
}

.instance-toolbar-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-bottom: 0;
  overflow: hidden;
  min-height: 0;
  position: relative;
  padding: 0;
}

.instance-toolbar-head {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  margin-bottom: 0;
  padding: 16px 14px 12px 48px;
  border-bottom: 1px solid rgba(121, 177, 255, 0.08);
  background: linear-gradient(180deg, rgba(20, 34, 58, 0.98) 0%, rgba(17, 30, 51, 0.96) 100%);
}

.instance-toolbar-head strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.instance-toolbar-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.instance-toolbar-active {
  display: grid;
  gap: 2px;
}

.instance-toolbar-active #active-instance-name {
  font-size: 13px;
  line-height: 1.2;
}

.instance-toolbar-active #active-instance-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-toolbar-actions {
  display: grid;
  gap: 6px;
}

.instance-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 12px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 177, 255, 0.55) rgba(10, 18, 38, 0.35);
}

.instance-list::-webkit-scrollbar {
  width: 10px;
}

.instance-list::-webkit-scrollbar-track {
  background: rgba(10, 18, 38, 0.35);
  border-radius: 12px;
}

.instance-list::-webkit-scrollbar-thumb {
  background: rgba(121, 177, 255, 0.45);
  border-radius: 12px;
  border: 2px solid rgba(10, 18, 38, 0.35);
}

.instance-list::-webkit-scrollbar-thumb:hover {
  background: rgba(121, 177, 255, 0.65);
}

.instance-menu-item {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.instance-menu-item:hover {
  border-color: rgba(121, 177, 255, 0.22);
  background: rgba(79, 143, 255, 0.08);
}

.instance-menu-item.is-active {
  border-color: rgba(79, 143, 255, 0.42);
  background: linear-gradient(180deg, rgba(79, 143, 255, 0.16) 0%, rgba(54, 109, 214, 0.12) 100%);
}

.instance-menu-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.instance-menu-topline,
.instance-menu-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.instance-menu-topline strong {
  font-size: 11px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-menu-subline {
  color: var(--muted);
  font-size: 9px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-provider-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: rgba(231, 244, 255, 0.95);
  border: 1px solid rgba(121, 177, 255, 0.22);
  background: rgba(79, 143, 255, 0.12);
}

.instance-menu-meta {
  color: var(--muted);
  font-size: 8px;
}

.instance-menu-meta span {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-menu-meta span:first-child {
  flex: 0 0 auto;
}

.instance-menu-meta span:last-child {
  flex: 1 1 auto;
  margin-left: auto;
  text-align: right;
  max-width: 62%;
  font-size: 10px;
  font-weight: 700;
  color: #bfd4ff;
}

.instance-menu-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
}

.instance-status-pill {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  background: rgba(79, 143, 255, 0.16);
  color: #bfd4ff;
  flex: 0 0 auto;
}

.instance-status-pill.is-online {
  background: rgba(34, 197, 94, 0.18);
  color: #8df2b1;
}

.instance-status-pill.is-warning {
  background: rgba(244, 177, 62, 0.18);
  color: #ffd48d;
}

.instance-status-pill.is-error {
  background: rgba(255, 91, 99, 0.18);
  color: #ffb3b8;
}

.instance-delete-btn {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 91, 99, 0.28);
  background: rgba(255, 91, 99, 0.1);
  color: #ffb3b8;
  font-size: 8px;
  font-weight: 700;
}

.instance-copy-btn {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(79, 143, 255, 0.28);
  background: rgba(79, 143, 255, 0.12);
  color: #bfd4ff;
  font-size: 8px;
  font-weight: 700;
}

.instance-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(121, 177, 255, 0.45);
  flex: 0 0 auto;
}

.instance-status-dot.is-online {
  background: var(--success);
}

.instance-status-dot.is-warning {
  background: var(--warning);
}

.instance-status-dot.is-error {
  background: var(--danger);
}

.warmup-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

.warmup-grid .panel-heading.between {
  align-items: center;
}

.warmup-grid .panel {
  margin: 0;
}

.warmup-grid .panel:nth-child(3) {
  grid-column: 1 / -1;
}

.warmup-instance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 2px;
  max-height: 340px;
  overflow: auto;
}

.warmup-instance-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  user-select: none;
}

.warmup-instance-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.warmup-instance-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.warmup-instance-text strong {
  font-size: 14px;
  font-weight: 800;
  color: rgba(232, 243, 255, 0.95);
}

.warmup-instance-phone {
  font-size: 12px;
  color: rgba(190, 215, 255, 0.75);
}

#screen-esquentar .form-grid {
  gap: 10px;
}

#screen-esquentar .field input,
#screen-esquentar .field select {
  padding: 12px 14px;
}

#screen-esquentar .panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#screen-esquentar #warmup-start,
#screen-esquentar #warmup-stop {
  min-width: 180px;
}

.warmup-status-row {
  font-size: 12px;
  color: rgba(210, 230, 255, 0.85);
  margin-bottom: 10px;
}

.warmup-log {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

body.instances-sidebar-collapsed {
  /* Mantido por compatibilidade (legacy), mas o sidebar agora e um drawer. */
}

.instances-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  z-index: 55;
}

body.instances-sidebar-collapsed .instances-sidebar {
  transform: translateX(110%);
}

#dashboard-automation-toggle {
  display: none !important;
}

#dashboard-automation-status {
  display: none !important;
}

.dashboard-bot-panel .dashboard-toggle-card {
  display: none !important;
}

.dashboard-toggle-card {
  grid-template-columns: 1fr;
}

.is-hidden {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  /* Precisa ficar acima do drawer de instancias (z=60) */
  z-index: 120;
  display: none;
  place-items: center;
  background: rgba(3, 8, 18, 0.72);
  backdrop-filter: blur(8px);
}

.auth-overlay.is-visible {
  display: grid;
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(18, 31, 54, 0.98) 0%, rgba(14, 25, 43, 0.98) 100%);
  border: 1px solid rgba(121, 177, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
  margin: 0;
  font-size: 22px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-role {
  justify-self: start;
}

.screen {
  display: none;
}

.screen.is-visible {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.page-header-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.helper-text {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.panel,
.metric-card {
  background:
    linear-gradient(180deg, rgba(18, 31, 54, 0.96) 0%, rgba(15, 26, 45, 0.96) 100%);
  border: 1px solid rgba(92, 127, 182, 0.26);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.panel {
  padding: 14px;
}

.panel.flush {
  padding: 0;
}

.panel.compact {
  padding: 12px 14px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-heading-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.scope-chip-instance {
  color: #9cc3ff;
  background: rgba(79, 143, 255, 0.12);
  border-color: rgba(79, 143, 255, 0.24);
}

.scope-chip-global {
  color: #ffd58a;
  background: rgba(244, 177, 62, 0.12);
  border-color: rgba(244, 177, 62, 0.28);
}

.scope-chip-mixed {
  color: #cdb7ff;
  background: rgba(164, 123, 255, 0.12);
  border-color: rgba(164, 123, 255, 0.24);
}

.panel-heading.between {
  justify-content: space-between;
}

.panel h3 {
  margin: 0;
  font-size: 12px;
}

.micro-label {
  color: #536a94;
  font-size: 9px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(320px, 35%) minmax(0, 65%);
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.dashboard-stats-column,
.dashboard-main-column {
  min-width: 0;
}

.dashboard-hero .stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px 16px;
}

.metric-card strong,
.metric-inline strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.metric-card span,
.metric-inline span {
  color: var(--muted);
  font-size: 11px;
}

.panel-subtitle {
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.metric-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.metric-icon.blue {
  color: var(--primary-3);
}

.metric-icon.green {
  color: #4ade80;
}

.metric-icon.amber {
  color: #f8c55f;
}

.metric-icon.slate {
  color: #7082a8;
}

.dashboard-top {
  display: grid;
  /* Proporcao: Conexao ~30% / IA ~70% (mais espaço para os 3 boxes internos). */
  grid-template-columns: minmax(320px, 0.6fr) minmax(0, 1.4fr);
  gap: 12px;
  margin-bottom: 0;
  align-items: stretch;
}

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

.metric-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.connection-item,
.label-row,
.toggle-row,
.slider-row,
.quota-footer,
.shot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
}

.status-dot.green {
  background: var(--success);
}

.status-dot.danger {
  background: var(--danger);
}

.status-dot.muted {
  background: #7082a8;
}

.danger-text {
  color: var(--danger);
  font-size: 10px;
}

.muted-text {
  color: var(--muted);
  font-size: 10px;
}

.toggle {
  position: relative;
  width: 24px;
  height: 14px;
  border-radius: 999px;
  background: #7b2f38;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  transition: 0.18s ease;
}

.toggle.on {
  background: var(--primary);
}

.toggle.on::after {
  left: 12px;
}

.toggle:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(79, 143, 255, 0.10);
}

.toggle:active:not(:disabled) {
  transform: translateY(1px);
}

.toggle:focus-visible {
  outline: 2px solid rgba(125, 169, 255, 0.55);
  outline-offset: 2px;
}

.upload-dropzone.is-dragover {
  border-color: rgba(121, 177, 255, 0.5);
  background: rgba(79, 143, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(121, 177, 255, 0.18);
}

.toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.warning-chip,
.ghost-chip,
.segment,
.tab {
  border-radius: 10px;
  transition: 0.18s ease;
}

.primary-btn {
  padding: 10px 14px;
  background: linear-gradient(180deg, #4c8ffd 0%, #3c79e6 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.primary-btn.wide {
  width: 100%;
}

.ghost-btn,
.icon-btn {
  padding: 9px 12px;
  background: rgba(102, 153, 255, 0.08);
  color: #b4cbec;
  font-size: 11px;
  border: 1px solid rgba(121, 177, 255, 0.12);
}

.warning-chip {
  padding: 8px 12px;
  background: rgba(244, 177, 62, 0.12);
  color: #f8c55f;
  font-size: 11px;
  font-weight: 700;
}

.warning-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-chip {
  padding: 8px 12px;
  background: rgba(102, 153, 255, 0.08);
  color: #b4cbec;
  font-size: 11px;
  border: 1px solid rgba(121, 177, 255, 0.12);
}

.ghost-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-btn.danger-outline {
  background: rgba(207, 70, 95, 0.10);
  color: #ff8fa5;
  border-color: rgba(207, 70, 95, 0.28);
}

.quota-number {
  margin-top: 6px;
  color: var(--danger);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.quota-caption,
.preview-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.progress-bar {
  height: 6px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5a9bff 0%, #3f7ee8 100%);
}

.progress-bar.danger span {
  background: var(--danger);
}

.quota-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.quota-footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.chart-panel {
  margin-bottom: 12px;
}

.chart-mock {
  height: 72px;
}

.chart-line {
  height: 46px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(74, 141, 255, 0.08), rgba(74, 141, 255, 0.01)),
    linear-gradient(90deg, transparent 0%, rgba(74, 141, 255, 0.22) 14%, transparent 30%, rgba(74, 141, 255, 0.18) 46%, transparent 58%, rgba(74, 141, 255, 0.14) 72%, transparent 100%);
  border: 1px solid rgba(74, 141, 255, 0.08);
}

.chart-axis {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  margin-top: 6px;
  color: #5870a0;
  font-size: 8px;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: 1.05fr 1.05fr 0.9fr;
  gap: 8px;
  margin-bottom: 12px;
}

.dashboard-bottom .panel {
  min-height: 280px;
}

.dashboard-bottom.single {
  grid-template-columns: 1fr;
}

.status-stack {
  display: grid;
  gap: 10px;
}

.status-row,
.identity-line,
.composer-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.composer-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.composer-actions {
  flex-wrap: wrap;
}

#send-status {
  flex: 1 1 260px;
}

.composer-buttons .ghost-btn,
.composer-buttons .primary-btn {
  min-width: 150px;
}

.identity-card {
  display: grid;
  gap: 10px;
}

.identity-card.compact {
  gap: 8px;
}

.dashboard-voice-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-voice-panel.first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.dashboard-top .panel {
  min-height: 100%;
}

.dashboard-main-panel {
  min-height: 100%;
}

.dashboard-bot-panel .dashboard-voice-panel.merged-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-consumption-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 900px) {
  .dashboard-consumption-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.dashboard-consumption-grid .dashboard-voice-panel.merged-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.dashboard-ia-details > summary {
  display: none !important;
}

.dashboard-ia-details {
  margin-top: 8px;
}

/* Dashboard: make the IA card denser + better aligned */
.dashboard-bot-panel .panel-subtitle {
  margin: 12px 0 8px;
  font-size: 10px;
}

.dashboard-bot-panel .identity-card {
  gap: 8px;
}

.dashboard-bot-panel .identity-card.compact {
  gap: 6px;
}

.dashboard-bot-panel .identity-line {
  align-items: center;
  line-height: 1.2;
}

.dashboard-bot-panel .identity-line span {
  font-size: 11px;
  color: rgba(210, 230, 255, 0.80);
}

.dashboard-bot-panel .identity-line strong {
  margin-left: auto;
  text-align: right;
  font-size: 12px;
}

.dashboard-bot-panel .identity-inline {
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-bot-panel #dashboard-voice-name {
  max-width: 220px;
}

.dashboard-bot-panel .progress-bar {
  height: 5px;
  margin-top: 6px;
}

.dashboard-bot-panel p.helper-text {
  margin: 6px 0 0;
  font-size: 10px;
  line-height: 1.35;
}

.dashboard-bot-panel .dashboard-consumption-grid p.helper-text {
  margin-top: 5px;
}

/* Refactor: Bot IA card layout (voice on top + 3 provider boxes) */
.dashboard-bot-panel #dashboard-voice-status {
  display: none;
}

.dashboard-bot-voice-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 58%;
}

.dashboard-bot-voice-summary #dashboard-voice-name {
  min-width: 0;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-bot-voice-summary #dashboard-voice-model {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 4px 8px;
}

.dashboard-ai-provider-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .dashboard-ai-provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .dashboard-ai-provider-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-bot-voice-summary {
    max-width: 100%;
  }
}

.dashboard-ai-box {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(121, 177, 255, 0.10);
  background: rgba(255, 255, 255, 0.015);
  min-width: 0;
}

.dashboard-ai-box-title {
  color: rgba(210, 230, 255, 0.75);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.dashboard-ai-box .identity-card.compact {
  gap: 6px;
  /* Mantem os 3 boxes alinhados mesmo quando um provider nao tem "Reset" real. */
  min-height: 74px;
}

.ai-reset-row--anthropic,
.ai-reset-row--openai {
  display: none;
}

.dashboard-ai-box .identity-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  line-height: 1.15;
  min-width: 0;
}

.dashboard-ai-box .identity-line span {
  font-size: 11px;
  color: rgba(210, 230, 255, 0.78);
  min-width: 0;
}

.dashboard-ai-box .identity-line strong {
  text-align: right;
  font-size: 12px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.dashboard-ai-box .progress-bar {
  height: 5px;
  margin-top: 2px;
}

.dashboard-ai-box p.helper-text {
  margin: 3px 0 0;
  font-size: 10px;
  line-height: 1.3;
}

.identity-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

#dashboard-voice-name {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.dashboard-voice-eleven-panel {
  display: none;
}

.dashboard-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(121, 177, 255, 0.10);
}

.dashboard-profile-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #dbe9ff;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(180deg, rgba(76, 143, 253, 0.26), rgba(54, 92, 162, 0.36));
  overflow: hidden;
}

.dashboard-profile-avatar.has-image {
  background: transparent;
}

.dashboard-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-profile-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-profile-copy strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.dashboard-profile-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-connection-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-connection-badge.is-online {
  background: rgba(71, 187, 120, 0.14);
  color: #8fe0ae;
}

.dashboard-connection-badge.is-warning {
  background: rgba(96, 141, 255, 0.14);
  color: #8fb7ff;
}

.dashboard-connection-badge.is-error {
  background: rgba(255, 102, 132, 0.14);
  color: #ff9bb2;
}

.connection-status-body {
  min-height: 156px;
}

.connection-state-card {
  min-height: 156px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 16px 16px;
  border-radius: 20px;
  border: 1px dashed rgba(86, 140, 255, 0.22);
  background:
    radial-gradient(circle at top, rgba(86, 140, 255, 0.10), transparent 58%),
    rgba(10, 20, 38, 0.46);
  text-align: center;
}

.connection-state-card strong {
  color: var(--text);
  font-size: 15px;
}

.connection-state-card p {
  margin: 0;
  max-width: 280px;
  color: var(--text-soft);
  line-height: 1.45;
}

.connection-state-card.is-error {
  border-color: rgba(255, 102, 132, 0.28);
  background:
    radial-gradient(circle at top, rgba(255, 102, 132, 0.12), transparent 58%),
    rgba(10, 20, 38, 0.46);
}

.connection-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(121, 177, 255, 0.18);
  border-top-color: rgba(121, 177, 255, 0.95);
  animation: connection-spin 0.9s linear infinite;
}

@keyframes connection-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
}

.dashboard-toggle-card.compact {
  min-height: auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-toggle-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.dashboard-toggle {
  width: 64px;
  height: 36px;
  border-radius: 999px;
  padding: 0;
  background: #8a2e3b;
}

.dashboard-toggle::after {
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
}

.dashboard-toggle.on {
  background: linear-gradient(180deg, #5a9bff 0%, #3f7ee8 100%);
}

.dashboard-toggle.on::after {
  left: 32px;
}

.dashboard-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.dashboard-reset-button {
  width: 100%;
  margin-top: 10px;
  justify-content: center;
}

.qr-panel {
  min-height: 198px;
  display: grid;
  place-items: center;
  gap: 12px;
}

.pairing-connected-state {
  width: 100%;
  min-height: 176px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 20px 18px;
  border: 1px dashed rgba(86, 140, 255, 0.22);
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(86, 140, 255, 0.10), transparent 58%),
    rgba(10, 20, 38, 0.46);
  text-align: center;
}

.pairing-connected-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(71, 187, 120, 0.14);
  border: 1px solid rgba(71, 187, 120, 0.28);
  color: #9be0b6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pairing-connected-state strong {
  color: var(--text);
  font-size: 15px;
}

.pairing-connected-state p {
  margin: 0;
  max-width: 280px;
  color: var(--text-soft);
  line-height: 1.45;
}

.pairing-connected-state span {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pairing-health-warning {
  width: 100%;
  max-width: 300px;
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 188, 64, 0.28);
  background: rgba(255, 188, 64, 0.08);
  text-align: left;
}

.pairing-health-warning strong {
  display: block;
  margin-bottom: 4px;
  color: #ffd27d;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pairing-health-warning p {
  margin: 0;
  max-width: none;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.qr-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  padding: 10px;
  border-radius: 14px;
  background: white;
}

.list-block,
.live-feed,
.shot-list,
.conversation-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  gap: 8px;
  overflow: auto;
  min-height: 0;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 145, 228, 0.55) rgba(8, 18, 34, 0.28);
}

.conversation-sync-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 10px;
  padding: 9px 12px;
  min-height: 52px;
  max-height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(86, 140, 255, 0.16);
  background: rgba(34, 51, 84, 0.42);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  flex: 0 0 auto;
}

.conversation-sync-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: #7ea9ff;
  box-shadow: 0 0 0 0 rgba(126, 169, 255, 0.45);
}

.conversation-sync-indicator.is-loading .conversation-sync-dot {
  animation: conversation-sync-pulse 1.4s infinite;
}

.conversation-sync-indicator.is-warning {
  border-color: rgba(255, 188, 64, 0.24);
  background: rgba(255, 188, 64, 0.08);
  color: #f2d39d;
}

.conversation-sync-indicator.is-warning .conversation-sync-dot {
  background: #ffc45e;
  box-shadow: none;
}

.conversation-sync-indicator.is-ready .conversation-sync-dot {
  background: #5fd39a;
  box-shadow: none;
}

@keyframes conversation-sync-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 169, 255, 0.40);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(126, 169, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(126, 169, 255, 0);
  }
}

.dashboard-bottom .list-block,
.dashboard-bottom .shot-list {
  min-height: 210px;
  align-content: start;
}

.dashboard-activity-panel {
  min-height: 250px;
}

.dashboard-activity-caption {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-activity-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 170px;
}

.activity-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.activity-bar-track {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 8px 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(76, 143, 253, 0.07));
  border: 1px solid rgba(92, 127, 182, 0.18);
}

.activity-bar {
  width: 24px;
  min-height: 10px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #65a2ff 0%, #3f7ee8 100%);
  box-shadow: 0 8px 18px rgba(63, 126, 232, 0.22);
}

.activity-bar-wrap strong {
  color: var(--text);
  font-size: 11px;
}

.activity-bar-wrap span {
  color: #6f89b6;
  font-size: 10px;
}

.list-item,
.feed-item,
.conversation-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 10px;
  min-width: 0;
}

.list-item strong,
.shot-item strong,
.conversation-text strong {
  color: var(--text);
  font-size: 11px;
}

.list-item p,
.conversation-text p {
  margin: 3px 0 0;
}

.dashboard-chat-item {
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.list-item-copy {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.list-item-copy p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}

.list-item-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: 0 0 auto;
  text-align: right;
  min-width: 52px;
  max-width: 88px;
  overflow: hidden;
}

.dashboard-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.dashboard-pill.is-unread {
  background: rgba(76, 143, 253, 0.18);
  color: #9ec3ff;
}

.dashboard-saved-note {
  margin-top: 10px;
}

#dashboard-chat-preview,
#dashboard-handoff-preview,
#dashboard-shot-preview {
  min-width: 0;
  overflow: hidden;
}

#dashboard-chat-preview .list-item,
#dashboard-handoff-preview .list-item,
#dashboard-shot-preview .shot-item {
  min-width: 0;
  width: 100%;
}

#dashboard-chat-preview .list-item-copy strong,
#dashboard-handoff-preview .list-item strong,
#dashboard-shot-preview .shot-item strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboard-chat-preview .list-item-copy p,
#dashboard-handoff-preview .list-item p,
#dashboard-shot-preview .shot-item p {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 9px;
}

.feed-item {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.feed-item time {
  margin-left: auto;
}

.shot-list {
  gap: 14px;
}

.shot-item {
  font-size: 10px;
}

.shot-item p {
  margin: 3px 0 0;
  color: var(--muted);
}

.success-text {
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
}

.conversations-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 8px;
  height: calc(100vh - 40px);
  min-height: 0;
}

.conversation-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.conversation-search {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  padding: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
}

.tabs.large {
  padding: 0;
  margin-bottom: 12px;
}

.tab,
.segment {
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10px;
  user-select: none;
  cursor: pointer;
}

.tab.is-active,
.segment.is-active {
  background: var(--primary);
  color: white;
}

.tab:hover,
.segment:hover {
  background: rgba(125, 169, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}

.tab:active,
.segment:active {
  transform: translateY(1px);
}

.tab:focus-visible,
.segment:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.icon-btn:focus-visible,
.warning-chip:focus-visible,
.ghost-chip:focus-visible {
  outline: 2px solid rgba(125, 169, 255, 0.55);
  outline-offset: 2px;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.ghost-btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.warning-chip:hover:not(:disabled),
.ghost-chip:hover:not(:disabled) {
  background: rgba(125, 169, 255, 0.14);
  border-color: rgba(121, 177, 255, 0.24);
}

.primary-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.warning-chip:active:not(:disabled),
.ghost-chip:active:not(:disabled) {
  transform: translateY(1px);
}

.settings-action-card {
  padding: 10px 12px;
  border: 1px solid rgba(92, 127, 182, 0.16);
  border-radius: 14px;
  background: rgba(20, 31, 49, 0.32);
}

.conversation-row {
  padding: 14px 16px;
  height: 82px;
  min-height: 82px;
  max-height: 82px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  width: 100%;
  border-radius: 0;
  background: transparent;
  user-select: none;
  overflow: hidden;
  align-items: center;
}

.conversation-row.is-selected {
  background: linear-gradient(180deg, rgba(79, 143, 255, 0.14) 0%, rgba(39, 90, 178, 0.12) 100%);
}

.conversation-row.has-unread .avatar {
  box-shadow:
    0 0 0 2px rgba(6, 16, 31, 0.96),
    0 0 0 4px rgba(79, 143, 255, 0.55),
    0 6px 18px rgba(79, 143, 255, 0.18);
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #29456d 0%, #21395c 100%);
  color: #d7e4ff;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar.small {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar.has-image {
  background: transparent;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.contact-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.contact-name-cell span {
  display: inline-block;
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-text {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  overflow: hidden;
  padding-right: 6px;
}

.conversation-head {
  display: flex;
  align-items: center;
  min-width: 0;
}

.conversation-text strong,
.conversation-text p {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-head strong {
  min-width: 0;
  flex: 1;
  padding-right: 6px;
}

.conversation-time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  opacity: 0.9;
  text-align: right;
}

.conversation-text p {
  margin-top: 4px;
}

.conversation-meta {
  width: 44px;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  align-self: stretch;
  flex-shrink: 0;
}

.conversation-unread {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #5b9cff 0%, #3f7fea 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 16px rgba(63, 127, 234, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.conversation-unread.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.conversation-sender {
  color: var(--primary, #5b9cff);
  font-weight: 600;
}

.msg-type-icon {
  font-size: 10px;
  margin-right: 1px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  min-height: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

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

.chat-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-identity p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.chat-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: rgba(3, 8, 18, 0.55);
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 145, 228, 0.55) rgba(8, 18, 34, 0.28);
}

.conversation-list::-webkit-scrollbar,
.chat-body::-webkit-scrollbar {
  width: 10px;
}

.conversation-list::-webkit-scrollbar-track,
.chat-body::-webkit-scrollbar-track {
  background: rgba(8, 18, 34, 0.4);
  border-radius: 999px;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(97, 145, 228, 0.72) 0%, rgba(63, 108, 184, 0.78) 100%);
  border-radius: 999px;
  border: 2px solid rgba(8, 18, 34, 0.4);
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.chat-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(120, 170, 255, 0.8) 0%, rgba(77, 128, 214, 0.85) 100%);
}

.bubble,
.message-bubble {
  max-width: 680px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #1a2437;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.message-bubble.from-contact {
  justify-self: start;
  background: #1a2437;
}

.message-bubble.from-me {
  justify-self: end;
  background: linear-gradient(180deg, #23406a 0%, #1c3456 100%);
}

.message-bubble.has-media {
  padding: 0;
  background: transparent;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.message-bubble.has-media.from-contact {
  justify-self: start;
  margin-right: auto;
  align-items: flex-start;
}

.message-bubble.has-media.from-me {
  justify-self: end;
  margin-left: auto;
  align-items: flex-end;
}

.message-bubble.has-media .message-type {
  margin: 0 0 6px 0;
}

.message-bubble.has-media time {
  margin-top: 6px;
}

.message-bubble.has-media .message-image,
.message-bubble.has-media .message-video,
.message-bubble.has-media .message-audio {
  margin: 0;
}

.message-type {
  margin-bottom: 6px;
  color: #7da9ff;
  font-size: 10px;
  font-weight: 800;
}

.message-bubble time {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-audio {
  width: min(420px, 100%);
  min-width: 280px;
  min-height: 54px;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
}

.message-media-loader {
  display: flex;
  align-items: center;
  min-height: 54px;
}

.media-load-button {
  min-width: 148px;
  padding: 10px 14px;
}

.message-image {
  display: block;
  max-width: min(320px, 100%);
  border-radius: 0;
  border: 0;
  outline: none;
  box-shadow: none;
}

.message-sticker {
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  border-radius: 0;
}

.message-video {
  display: block;
  width: min(420px, 100%);
  max-height: 320px;
  border-radius: 0;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
}

.media-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9998;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(560px, 96vw);
  border-radius: 16px;
  background: rgba(8, 18, 34, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #f3f6ff;
}

.modal-subtitle {
  margin: 0 0 14px 0;
  color: #a9bbda;
  font-size: 12px;
  line-height: 1.45;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-size: 20px;
  line-height: 34px;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.5);
}

.modal-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 14px;
}

.modal-choice-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 41, 75, 0.26);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.modal-choice-card:hover {
  border-color: rgba(77, 133, 255, 0.35);
  background: rgba(32, 61, 110, 0.28);
  transform: translateY(-1px);
}

.modal-choice-card input[type="radio"] {
  margin-top: 2px;
}

.modal-choice-card strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #f3f6ff;
  margin-bottom: 3px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.modal-error {
  display: block;
  margin-top: 10px;
  color: #ffb2b2;
}

@media (max-width: 540px) {
  .modal-choice-grid {
    grid-template-columns: 1fr;
  }
}

.media-lightbox-content {
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 14px;
  background: rgba(8, 18, 34, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.media-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  max-width: 96vw;
  max-height: 92vh;
}

.media-lightbox-image,
.media-lightbox-video {
  display: block;
  max-width: 92vw;
  max-height: 84vh;
}

.media-lightbox-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 20px;
  line-height: 32px;
  cursor: pointer;
}

.media-lightbox-close:hover {
  background: rgba(0, 0, 0, 0.55);
}

.message-placeholder {
  color: #d2ddf6;
}

.split {
  align-items: center;
}

.table-tools {
  margin-bottom: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--muted);
  font-size: 11px;
}

.data-table thead th {
  padding: 12px;
  color: #a9bbda;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.shots-layout {
  display: grid;
  grid-template-columns: 1fr 0.95fr;
  gap: 12px;
  margin-bottom: 12px;
}

.shots-layout.single-column {
  grid-template-columns: 1fr;
}

.shot-screen {
  display: none;
}

.shot-screen.is-visible {
  display: block;
}

.shots-tabs {
  margin-top: 18px;
  margin-bottom: 20px;
  gap: 10px;
  padding-bottom: 2px;
}

#screen-disparos .shots-tabs .tab {
  min-width: 120px;
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 12px;
}

#screen-disparos > .panel:first-of-type {
  margin-bottom: 22px;
}

#screen-disparos .shots-layout {
  margin-top: 4px;
}

#screen-disparos .panel-heading.compact-heading,
#screen-disparos .toggle-row + .panel-heading {
  margin-top: 10px;
}

.form-grid,
.settings-stack {
  display: grid;
  gap: 12px;
}

.batch-grid {
  margin-top: 10px;
}

.shot-batch-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
  align-items: start;
}

.shot-batch-left,
.shot-batch-right {
  min-width: 0;
}

.shot-batch-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.form-grid.batch-grid {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shot-batch-scope-row,
.shot-batch-mode-field,
#shot-batch-interval-instance-field {
  grid-column: 1 / -1;
}

.interval-field {
  display: grid;
  gap: 10px;
}

.interval-field span {
  color: #9ab0d5;
  font-size: 10px;
  font-weight: 600;
}

.interval-control {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 14px;
  align-items: center;
}

.interval-value {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.field,
.form-grid label {
  display: grid;
  gap: 6px;
}

.field span,
.form-grid label span {
  color: #9ab0d5;
  font-size: 12px;
  font-weight: 600;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.preview-box {
  min-height: 154px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.shot-batch-right .preview-box {
  min-height: 120px;
  max-height: 210px;
  overflow: auto;
}

.shot-batch-right .batch-preview-card {
  margin-top: 0;
}

.batch-upload {
  margin-bottom: 10px;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 110px;
  padding: 16px;
  border: 1px dashed rgba(121, 177, 255, 0.28);
  border-radius: 14px;
  background: rgba(89, 130, 204, 0.06);
  text-align: center;
}

.upload-dropzone.has-file {
  border-style: solid;
  border-color: rgba(121, 177, 255, 0.42);
  background: rgba(79, 143, 255, 0.12);
}

.upload-dropzone strong {
  color: var(--text);
  font-size: 15px;
}

.upload-dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.upload-file-meta {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(79, 143, 255, 0.08);
  border: 1px solid rgba(121, 177, 255, 0.14);
}

.shot-batch-left .interval-value {
  height: 34px;
  font-size: 16px;
  border-radius: 10px;
}

.upload-file-meta.is-visible {
  display: flex;
}

.upload-file-meta strong {
  color: var(--text);
  font-size: 13px;
}

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

.preview-box p {
  margin: 0 0 8px;
}

.settings-stack {
  max-width: 460px;
}

.settings-stack-wide {
  max-width: 980px;
}

#screen-configuracoes #settings-form {
  max-width: 760px;
  margin: 0 auto;
  gap: 14px;
}

#screen-configuracoes .panel {
  padding: 12px;
}

#screen-configuracoes .panel-heading {
  margin-bottom: 10px;
}

#screen-configuracoes .field input,
#screen-configuracoes .field select,
#screen-configuracoes .field textarea {
  max-width: 100%;
}

#screen-configuracoes #settings-system-prompt {
  min-height: 240px;
  max-height: 320px;
}

#screen-configuracoes #settings-presentation-template {
  min-height: 120px;
}

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

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

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

.settings-scope-note {
  margin: 2px 0 12px;
}

.settings-subheading {
  margin-top: 14px;
  margin-bottom: 10px;
  color: #7da9ff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-ai-hint {
  margin: -4px 0 12px;
  font-size: 12px;
}

.settings-ai-limits-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.settings-ai-field {
  padding: 10px 12px;
  border: 1px solid rgba(92, 127, 182, 0.22);
  border-radius: 14px;
  background: rgba(20, 31, 49, 0.4);
}

.settings-ai-field .field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #a8c1ef;
  font-size: 12px;
  font-weight: 700;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(125, 169, 255, 0.18);
  background: rgba(125, 169, 255, 0.08);
  color: #8fb6ff;
}

.scope-chip-instance {
  border-color: rgba(100, 230, 170, 0.22);
  background: rgba(100, 230, 170, 0.08);
  color: rgba(140, 255, 208, 0.95);
}

.scope-chip-global {
  border-color: rgba(255, 198, 86, 0.22);
  background: rgba(255, 198, 86, 0.08);
  color: rgba(255, 214, 130, 0.95);
}

@media (max-width: 1100px) {
  .settings-ai-limits-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .settings-ai-limits-grid {
    grid-template-columns: 1fr;
  }
}

.settings-advanced {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 169, 255, 0.16);
  border-radius: 14px;
  background: rgba(20, 31, 49, 0.55);
}

.settings-advanced > summary {
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  list-style: none;
}

.settings-advanced > summary::-webkit-details-marker {
  display: none;
}

.settings-advanced > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: #7da9ff;
  transform: translateY(-1px);
}

.settings-advanced[open] > summary::before {
  content: "▾";
}

.settings-admin-key-help {
  margin-top: 10px;
}

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

.field-inline-actions input {
  flex: 1 1 auto;
  min-width: 0;
}

.field-inline-actions .ghost-chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .field-inline-actions {
    flex-wrap: wrap;
  }
}

.empty-state,
.empty-chat {
  width: 100%;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 140px;
  padding: 20px;
  border: 1px dashed rgba(121, 177, 255, 0.24);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong,
.empty-chat strong {
  color: var(--text);
  font-size: 13px;
}

.empty-state p,
.empty-chat p {
  margin: 0;
  max-width: 440px;
  line-height: 1.5;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.empty-state-actions .ghost-btn {
  min-width: 210px;
}

.conversation-sync-preview {
  width: min(560px, 100%);
  text-align: left;
  align-self: start;
}

.conversation-sync-preview-summary {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(125, 169, 255, 0.18);
  background: rgba(20, 31, 49, 0.88);
}

.conversation-sync-preview-label {
  display: block;
  margin-bottom: 4px;
  color: #7da9ff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.conversation-sync-preview-body {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.composer {
  display: grid;
  gap: 8px;
  min-height: 0;
}

#send-message-form {
  padding: 6px 10px 8px;
}

#send-message-form .field {
  gap: 6px;
}

#send-message-form .field span {
  font-size: 11px;
}

.composer-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.composer-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

#message-input {
  min-height: 52px;
  max-height: 78px;
  padding: 8px 12px;
}

#send-message-form .helper-text {
  font-size: 10px;
}

#send-message-form .composer-actions {
  margin-top: 0;
}

#send-message-form .composer-buttons .ghost-btn,
#send-message-form .composer-buttons .primary-btn {
  min-width: 124px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.settings-danger-zone {
  padding-top: 12px;
  border-top: 1px solid rgba(106, 133, 189, 0.18);
}

.danger-outline-btn {
  border-color: rgba(234, 88, 88, 0.45);
  color: #ffb4b4;
}

.danger-outline-btn:hover {
  border-color: rgba(234, 88, 88, 0.72);
  background: rgba(234, 88, 88, 0.12);
  color: #ffd4d4;
}

.slider-row {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.voice-card {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(33, 54, 87, 0.96) 0%, rgba(25, 42, 68, 0.96) 100%);
  border: 1px solid rgba(121, 177, 255, 0.14);
}

.voice-id-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  margin-bottom: 10px;
  color: #8fa9cf;
  font-size: 11px;
}

.voice-id-line strong {
  color: #8aaee4;
  font-weight: 600;
}

.compact-heading {
  margin-top: 14px;
  margin-bottom: 10px;
}

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

.shot-variable-row {
  display: grid;
  grid-template-columns: 220px 1fr 120px;
  gap: 8px;
}

.batch-preview-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(121, 177, 255, 0.1);
}

.batch-preview-picker {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.shot-variable-empty {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}

.preview-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.shot-batch-right .preview-meta {
  margin-top: 8px;
  font-size: 11px;
}

@media (max-width: 1200px) {
  .shot-batch-layout {
    grid-template-columns: 1fr;
  }

  .shot-batch-right .preview-box {
    max-height: 260px;
  }
}

#shot-available-keys,
#shot-preview-keys {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-word;
}

#shot-template-text {
  min-height: 170px;
}

#shot-screen-disparos .panel h3,
#screen-disparos .panel h3 {
  font-size: 14px;
}

#screen-disparos .helper-text {
  font-size: 12px;
}

.shot-template-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -2px 0 12px;
  flex-wrap: wrap;
}

.shot-template-actions .helper-text {
  margin: 0;
}

.shot-cloud-helper {
  margin-bottom: 10px;
}

.shot-cloud-source-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 165, 255, 0.2);
  border-radius: 10px;
  background: rgba(42, 94, 176, 0.14);
  color: #c4d7ff;
  font-size: 12px;
}

.shot-cloud-source-tip .ghost-btn {
  padding: 7px 12px;
  min-height: 32px;
}

.shot-cloud-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.shot-cloud-left,
.shot-cloud-right {
  min-width: 0;
}

.shot-cloud-active-card {
  margin-bottom: 8px;
  min-height: 110px;
}

.shot-cloud-form-grid {
  margin-bottom: 12px;
}

.shot-cloud-form-grid input,
.shot-cloud-form-grid select {
  min-height: 40px;
}

.shot-cloud-left .shot-template-actions {
  gap: 10px;
}

.shot-cloud-left .shot-template-actions .primary-btn,
.shot-cloud-left .shot-template-actions .ghost-btn {
  min-height: 38px;
  padding: 8px 14px;
}

.shot-cloud-status-row {
  margin-top: 0;
  margin-bottom: 8px;
}

.shot-cloud-template-list {
  border: 1px solid rgba(120, 165, 255, 0.18);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(10, 18, 34, 0.34);
  max-height: 300px;
  overflow: auto;
}

.shot-cloud-template-list .template-list-row:last-child {
  border-bottom: 0 !important;
}

.shot-cloud-template-list .template-list-row {
  gap: 10px !important;
}

.shot-cloud-template-list .ghost-btn {
  min-width: 72px;
}

@media (max-width: 1180px) {
  .shot-cloud-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

#screen-disparos .primary-btn,
#screen-disparos .ghost-btn,
#screen-disparos .segment,
#screen-disparos .tab {
  font-size: 12px;
}

#screen-disparos input,
#screen-disparos textarea,
#screen-disparos select {
  font-size: 14px;
}

.voice-card-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.voice-card-tag {
  color: var(--muted);
  font-size: 10px;
}

.audio-player {
  width: 100%;
  margin-top: 12px;
}

input[type="range"] {
  padding: 0;
  background: transparent;
  accent-color: var(--primary);
}

.table-empty {
  color: var(--muted);
  text-align: center;
}

.shot-history-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
}

.shot-history-message span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot-history-message.is-expanded span {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  word-break: break-word;
}

.shot-history-expand-btn {
  padding: 4px 8px;
  min-width: auto;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.shot-history-actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

#screen-configuracoes textarea {
  line-height: 1.5;
}

@media (max-width: 1500px) {
  body {
    min-width: 0;
  }

  .dashboard-bottom,
  .dashboard-hero .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Mantem a proporcao entre Conexao e IA ate telas bem menores. */
  .dashboard-top {
    grid-template-columns: minmax(300px, 0.6fr) minmax(0, 1.4fr);
  }
}

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

  .instances-sidebar {
    width: min(420px, 92vw);
  }

  .instance-toolbar-side {
    height: auto;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-hero .stats-grid {
    grid-auto-flow: row;
  }

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

}

@media (max-width: 900px) {
  .dashboard-hero .stats-grid,
  .dashboard-top,
  .dashboard-bottom {
    grid-template-columns: 1fr;
  }
}

.page-header {
  padding: 8px 0 10px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0;
}

.page-header p {
  margin: 4px 0 0;
  font-size: 12px;
}

.panel {
  padding: 14px 14px;
}

.panel-heading h3 {
  font-size: 14px;
}

.dashboard-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-stats-column {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-auto-flow: column;
  /* Forca largura uniforme (evita 1o/2o cards maiores por label longa). */
  grid-auto-columns: 190px;
  gap: 10px;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  min-height: 54px;
}

.metric-card strong {
  font-size: 18px;
  line-height: 1.1;
}

.metric-card span {
  font-size: 11px;
}

.metric-icon {
  width: 30px;
  height: 30px;
}

.dashboard-top {
  display: grid;
  /* Proporcao: Status ~30% / IA ~70% */
  grid-template-columns: minmax(320px, 0.6fr) minmax(0, 1.4fr);
  gap: 12px;
  align-items: stretch;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin-top: 12px;
}

.dashboard-side-stack {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 360px;
}

.dashboard-bottom .list-block,
.dashboard-bottom .shot-list {
  max-height: 320px;
  overflow: auto;
}

.dashboard-activity-details {
  margin-top: 12px;
}

.dashboard-activity-details > summary {
  cursor: pointer;
  list-style: none;
}

.dashboard-activity-details > summary::-webkit-details-marker {
  display: none;
}

.dashboard-ia-details {
  margin-top: 8px;
  border-top: 1px solid rgba(121, 177, 255, 0.1);
  padding-top: 10px;
}

.dashboard-ia-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  list-style: none;
}

/* Responsividade: empilha os cards principais em telas menores */
@media (max-width: 900px) {
  .dashboard-top {
    grid-template-columns: 1fr;
  }
}

.dashboard-ia-details > summary::-webkit-details-marker {
  display: none;
}

.dashboard-ia-details-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}
