:root {
  --bg: #f0f5f3;
  --panel: #ffffff;
  --panel-soft: #f4faf7;
  --panel-glass: rgba(255, 255, 255, 0.72);
  --line: #d4e4dc;
  --line-soft: #e8f0ec;
  --text: #0d2b20;
  --muted: #5a7a6d;
  --accent: #0d9373;
  --accent-soft: #e6f7f1;
  --accent-strong: #087a5e;
  --accent-glow: rgba(13, 147, 115, 0.15);
  --danger: #c53030;
  --danger-soft: #fef2f2;
  --inbound: #f5f8ff;
  --outbound: #e8faf2;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}



* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: 'Inter', Manrope, "Segoe UI", sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  height: 100vh;
  overflow: hidden !important;
  padding: 0 !important;
  border: none !important;
  display: flex;
}



.left-pane {
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  width: var(--left-pane-width, 400px);
  min-width: 320px;
  max-width: 50vw;
  flex-shrink: 0;
}



.app-resizer {
  width: 3px;
  background: var(--line-soft);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  z-index: 10;
}
.app-resizer:hover, .app-resizer.is-resizing {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}



.brand-block h1 {
  margin: 0;
  font-family: 'Sora', Manrope, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.user-card {
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  transition: box-shadow var(--transition-fast);
}
.user-card:hover {
  box-shadow: var(--shadow-sm);
}



.user-meta {

  display: flex;

  flex-direction: column;

  min-width: 0;

}



.user-meta strong {

  font-size: 0.95rem;

}



.user-meta span {

  color: var(--muted);

  font-size: 0.82rem;

  overflow: hidden !important;

  padding: 0 !important;

  border: none !important;

  text-overflow: ellipsis;

}



.user-actions {

  display: flex;

  gap: 6px;

}



.admin-section {
  display: grid;
  gap: 12px;
}
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  gap: 8px;
  transition: box-shadow var(--transition-fast);
}
.admin-card:hover {
  box-shadow: var(--shadow-sm);
}



.admin-card h3,

.admin-card h4 {

  margin: 0;

}



.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}

.admin-users-filters {
  display: flex;
  justify-content: flex-start;
}



.checkbox-inline {

  display: inline-flex;

  align-items: center;

  gap: 6px;

  font-size: 0.84rem;

}



.users-table-wrapper {

  overflow-x: auto;

  border: 1px solid var(--line);

  border-radius: 10px;

}



.users-table {

  width: 100%;

  border-collapse: collapse;

  font-size: 0.76rem;

  min-width: 520px;

}



.users-table th,

.users-table td {

  border-bottom: 1px solid var(--line);

  padding: 7px 8px;

  text-align: left;

  vertical-align: top;

}



.users-table th {

  background: #f0f7f3;

  font-weight: 700;

}



.users-table td:last-child {
  white-space: nowrap;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── User cell ─────────────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9bc8b8, #059669);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.user-info-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.user-info-text .muted {
  font-size: 0.72rem;
}

/* ── Status badge ──────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-active {
  background: #d1fae5;
  color: #065f46;
}
.status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Dropdown menu ─────────────────────────────────── */
.user-actions-cell {
  display: flex;
  justify-content: center;
}
.user-actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}
.user-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: var(--muted);
  flex-shrink: 0;
}
.user-action-btn:hover {
  background: #ecfdf5;
  border-color: #9bc8b8;
  color: #059669;
}
.user-action-danger {
  color: var(--muted);
}
.user-action-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ── Admin main button + menu modal ──────────────────── */
.admin-section {
  display: grid;
  gap: 0;
}
.admin-main-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #059669;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.admin-main-btn:hover {
  box-shadow: 0 4px 16px rgba(5,150,105,0.35);
  transform: translateY(-1px);
}
.admin-main-btn svg {
  flex-shrink: 0;
  color: white;
}
.admin-menu-modal {
  max-width: 440px;
  width: 92vw;
  padding: 0;
  overflow: hidden;
}
.admin-menu-modal .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-menu-modal .modal-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.admin-menu-grid {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
}
.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  width: 100%;
  text-align: left;
}
.admin-menu-item:hover {
  background: var(--panel-soft);
}
.admin-menu-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-menu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-menu-text strong {
  font-size: 0.85rem;
  color: var(--text);
}
.admin-menu-text span {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Admin modals ──────────────────────────────────── */
.admin-modal-wide {
  max-width: 640px;
  width: 94vw;
}
.admin-modal-wide .users-table-wrapper {
  max-height: 35vh;
  overflow-y: auto;
}
.admin-modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-modal-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 6px 0;
}
.admin-modal-subtitle {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.admin-modal-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: -2px;
}
.admin-modal-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 16px 0;
  margin: 0;
}
.admin-templates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 40vh;
  overflow-y: auto;
}
.admin-templates-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-templates-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-template-chip {
  padding: 6px 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.admin-template-cat {
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--panel);
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
@media (max-width: 700px) {
  .form-row-3 { grid-template-columns: 1fr; }
}
.form-row-3 input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--panel);
  transition: border-color var(--transition-fast);
}
.form-row-3 input:focus {
  outline: none;
  border-color: #9bc8b8;
}

/* ── Cleanup grid ──────────────────────────────────── */
.admin-cleanup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.admin-cleanup-grid .btn:first-child {
  grid-column: 1 / -1;
}
@media (max-width: 500px) {
  .admin-cleanup-grid { grid-template-columns: 1fr; }
}

/* ── Business hours form ───────────────────────────── */
.business-hours-form {
  display: grid;
  gap: 8px;
}
.business-days-checkboxes {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}
.business-days-checkboxes label {
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.business-days-checkboxes label:has(input:checked) {
  background: #d1fae5;
  border-color: #9bc8b8;
  color: #065f46;
}
.business-days-checkboxes input[type="checkbox"] {
  width: 12px;
  height: 12px;
}
.business-hours-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}
.business-hours-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.business-hours-row select {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  background: var(--panel);
}
.business-hours-row .btn {
  margin-left: auto;
}



.conversation-header {

  display: flex;

  justify-content: space-between;

  align-items: center;

}



.conversation-header h2 {

  margin: 0;

  font-size: 1.05rem;

}



.conversation-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.conversation-item {
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}
.conversation-item:hover {
  background: var(--panel-soft);
  border-color: var(--line-soft);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}
.conversation-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.conversation-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.conversation-phone {
  font-size: 0.78rem;
  color: var(--muted);
}



.main-pane {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}
.chat-header {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.chat-header h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}
.chat-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}



.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}



.admin-message-tools {

  border-bottom: 1px solid var(--line);

  padding: 10px 16px;

  display: flex;

  align-items: center;

  gap: 10px;

  flex-wrap: wrap;

  background: #f7fbf9;

}



.badge {
  border: 1px solid var(--line-soft);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
}



.messages {
  overflow-y: auto;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  background:
    radial-gradient(circle at 20% 80%, rgba(13,147,115,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(13,147,115,0.03) 0%, transparent 50%),
    var(--bg);
}



.messages-loading {

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;

  margin: 10px 0;

  gap: 10px;

}



.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--line-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}



.loading-spinner-inline {

  display: inline-block;

  width: 14px;

  height: 14px;

  border: 2px solid rgba(0, 0, 0, 0.1);

  border-top-color: currentColor;

  border-radius: 50%;

  animation: spin 1s linear infinite;

  vertical-align: middle;

  margin-right: 6px;

}



@keyframes spin {

  0% { transform: rotate(0deg); }

  100% { transform: rotate(360deg); }

}



.messages-loading span {

  color: var(--muted);

  font-size: 0.85rem;

}



.message-item {
  width: fit-content;
  max-width: 82%;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  margin: 2px 0;
  box-shadow: var(--shadow-xs);
  font-size: 0.88rem;
  line-height: 1.4;
  transition: all var(--transition-fast) ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}



.message-item.message-new {

  animation: slideInUp var(--transition-smooth) ease;

  opacity: 0;

  transform: translateY(20px);

}



.message-item.message-new {

  opacity: 1;

  transform: translateY(0);

}



@keyframes slideInUp {

  from {

    opacity: 0;

    transform: translateY(20px);

  }

  to {

    opacity: 1;

    transform: translateY(0);

  }

}



.message-select-row {

  display: flex;

  justify-content: flex-end;

  margin-bottom: 6px;

}



.message-select-row label {

  display: inline-flex;

  align-items: center;

  gap: 6px;

  font-size: 0.76rem;

  color: #4f6e64;

}



.message-item.inbound {
  background: var(--inbound);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.message-item.inbound.message-unread {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-left: 4px solid #16a34a;
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.2);
  animation: unreadPulse 2s ease-in-out infinite;
}
.message-item.inbound.message-unread .message-meta::after {
  content: "NOVA";
  background: #16a34a;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1;
  margin-left: 6px;
  vertical-align: middle;
  animation: badgePop 0.3s ease-out;
}
@keyframes unreadPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25); }
  50% { box-shadow: 0 2px 16px rgba(22, 163, 74, 0.45); }
}
.conversation-unread-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  align-self: center;
  animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px var(--accent-glow);
}
@keyframes badgePop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.message-quote {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-left: 3px solid var(--accent);
  background: rgba(13, 147, 115, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
}
.message-quote-sender {
  font-weight: 600;
  color: #0a3b2b;
  margin-bottom: 2px;
}
.message-quote-text {
  color: #667781;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}
.message-item.outbound .message-quote {
  border-left-color: #53bdeb;
  background: rgba(255, 255, 255, 0.3);
}
.message-item.outbound {
  background: var(--outbound);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}



.message-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.msg-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
}
.msg-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85em;
  opacity: 0.4;
  transition: all var(--transition-fast);
  padding: 2px 4px;
  border-radius: 4px;
}
.msg-actions button:hover {
  opacity: 1;
  background: rgba(0,0,0,0.06);
}
  transition: opacity 0.2s;
  padding: 0 2px;
  line-height: 1;
}
.msg-actions button:hover {
  opacity: 1;
}
.revoke-msg-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.revoke-msg-btn:hover {
    opacity: 1;
}

/* Reply/Quote button */
.reply-msg-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.reply-msg-btn:hover {
  opacity: 1;
}

/* Reply preview in composer */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 0 4px 0;
  background: #e3f2fd;
  border-left: 3px solid #1976d2;
  border-radius: 4px;
  font-size: 0.85em;
  animation: slideDown 0.2s ease;
}
.reply-preview.hidden {
  display: none;
}
.reply-preview-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reply-preview-label {
  font-size: 0.8em;
  color: #1976d2;
  font-weight: 600;
}
.reply-preview-text {
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  color: #999;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.reply-preview-close:hover {
  color: #d32f2f;
}

/* Quote display in message bubble */
.message-quote {
  background: rgba(255, 255, 255, 0.6);
  border-left: 3px solid #1976d2;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 3px;
  font-size: 0.85em;
}
.message-quote-sender {
  display: block;
  font-weight: 600;
  color: #1976d2;
  font-size: 0.85em;
  margin-bottom: 2px;
}
.message-quote-text {
  display: block;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
}
.edit-msg-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.edit-msg-btn:hover {
    opacity: 1;
}
}



.message-media {
  margin-top: 6px;
  border-radius: var(--radius-sm);
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.message-body {
  min-width: 0;
  overflow-wrap: break-word;
  max-width: 100%;
}
.message-body img.message-media {
  max-width: 100%;
  height: auto;
  max-height: 300px;
}
.message-audio, .message-video {
  max-width: 100%;
}
.message-media:hover {
  transform: scale(1.01);
  opacity: 0.92;
}
.message-sticker {
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.message-sticker:hover {
  transform: scale(1.05);
  opacity: 0.9;
}
.media-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
  animation: overlayFadeIn 0.2s ease;
}
.media-modal-overlay img,
.media-modal-overlay video {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}
  cursor: default;
}
.media-zoom-container {
  position: relative;
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.media-zoom-img {
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  transition: transform 0.05s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}
.media-modal-close {
  position: absolute;
  top: 16px; right: 20px;
  color: #fff;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  line-height: 1;
}



.message-audio,

.message-video {

  margin-top: 8px;

  width: 100%;

}



.composer {
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}



.composer-row {

  display: grid;

  gap: 6px;

}



.media-actions {

  display: flex;

  gap: 8px;

  flex-wrap: wrap;

}



label {

  font-size: 0.84rem;

  color: #3f5c53;

}



input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
  transition: all var(--transition-fast);
  color: var(--text);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
#textContent {
  min-height: 120px;
  resize: both;
  overflow: auto;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}



.composer-footer {

  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-top: 4px;

}



.composer-type-icons {

  display: flex;

  gap: 8px;

}



.btn-icon {
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--muted);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  font-size: 1.1rem;
}
.btn-icon:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}
.btn-icon.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}



.btn-icon:hover {

  background: var(--panel-soft);

  color: var(--accent-strong);

  border-color: var(--accent);

}



.btn-icon.active {

  background: var(--accent);

  color: white;

  border-color: var(--accent);

}



.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.file-preview-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  margin-right: 4px;
}
.file-preview-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #f0f7f4;
}
.file-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}
.file-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}



/* ===== Modal de Emojis ===== */
.emoji-modal {
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  display: flex !important;
  flex-direction: column;
  gap: 0 !important;
}

.emoji-modal .modal-body {
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.emoji-search {
  margin-bottom: 16px;
}

.emoji-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--panel);
  color: var(--text);
}

.emoji-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.emoji-category-btn {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.emoji-category-btn:hover {
  background: var(--panel-soft);
  border-color: #9bc8b8;
}

.emoji-category-btn.active {
  background: #9bc8b8;
  color: white;
  border-color: #9bc8b8;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  justify-items: center;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition-fast);
  background: var(--panel);
  border: 1px solid transparent;
}

.emoji-item:hover {
  background: var(--panel-soft);
  border-color: #9bc8b8;
  transform: scale(1.1);
}

.emoji-item:active {
  transform: scale(0.95);
}

/* Scrollbar personalizada para emoji grid */
.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: var(--panel-soft);
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: #9bc8b8;
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: #7fb8a8;
}



/* Audio Visualizer */

.audio-visualizer {

  margin: 16px 0;

  text-align: center;

}



#audioCanvas {

  width: 100%;

  max-width: 400px;

  height: 100px;

  border: 1px solid var(--line);

  border-radius: 8px;

  background: #0c1f19;

  display: block;

  margin: 0 auto 8px;

}



.recording-indicator {

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  color: var(--danger);

  font-weight: 600;

  font-size: 0.9rem;

}



.recording-dot {

  width: 12px;

  height: 12px;

  background: var(--danger);

  border-radius: 50%;

  animation: pulse 1.5s ease-in-out infinite;

}



@keyframes pulse {

  0%, 100% {

    opacity: 1;

    transform: scale(1);

  }

  50% {

    opacity: 0.5;

    transform: scale(1.2);

  }

}



.audio-preview {

  margin: 16px 0;

  text-align: center;

}



#audioPlayer {

  width: 100%;

  max-width: 400px;

  border-radius: 8px;

}



.btn {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  background: var(--accent-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}
.btn-outline:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 2px 12px rgba(197, 48, 48, 0.25);
}
.btn-small {
  padding: 6px 10px;
  font-size: 0.76rem;
  border-radius: 6px;
}



.inline-row {

  display: flex;

  gap: 8px;

  align-items: center;

}



.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
  animation: overlayFadeIn 0.2s ease;
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
#loginOverlay {
  background: rgba(10, 43, 36, 0.97);
  backdrop-filter: none;
}
#loginOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    url('/inbox/img/brasao.png'),
    url('/inbox/img/sti_logo.png');
  background-position:
    8% center,
    92% center;
  background-repeat: no-repeat;
  background-size: min(24vw, 360px);
  opacity: 0.08;
  z-index: -1;
  pointer-events: none;
}
.modal {
  width: 94vw;
  max-width: 480px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-xl);
  padding: 20px;
  display: grid;
  gap: 12px;
  animation: modalSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.modal p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal select {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  background: var(--panel);
  color: var(--text);
}
.modal .btn {
  font-size: 0.78rem;
  padding: 8px 14px;
}



.record-preview {

  width: 100%;

  max-height: 280px;

  border-radius: 10px;

  background: #0c1f19;

}



.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 1000;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.toast-error {
  background: var(--danger);
}
.toast-success {
  background: #16a34a;
}
.toast-info {
  background: var(--accent);
}
.toast.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}



.error {

  color: var(--danger);

  min-height: 18px;

}



.hidden {

  display: none !important;

}



.modal-large {
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}



.catalog-list {

  list-style: none;

  overflow-y: auto;

  padding: 0;

  margin: 0;

  flex: 1;

}



.catalog-item {

  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 12px;

  background: white;

  border-radius: 8px;

  margin-bottom: 8px;

  box-shadow: 0 1px 3px rgba(0,0,0,0.05);

  border: 1px solid var(--line);

}



.catalog-info {

  display: flex;

  flex-direction: column;

  gap: 4px;

}



.catalog-name {

  font-weight: 600;

  color: var(--text-base);

  font-size: 1rem;

}



.catalog-phone {

  font-size: 0.85rem;

  color: var(--muted);

}



.conversation-header {

  display: flex;

  justify-content: space-between;

  align-items: center;

  gap: 8px;

}



.conversation-header h2 {

  font-size: 0.85rem;

  font-weight: 700;

  margin: 0;

  color: var(--text-base);

}



.header-actions {

  display: flex;

  gap: 6px;

}



.btn-header {

  background: transparent;

  border: 1px solid var(--line);

  color: var(--muted);

  border-radius: 6px;

  padding: 4px 8px;

  font-size: 0.75rem;

  font-weight: 600;

  cursor: pointer;

  transition: all 0.2s ease;

}



.btn-header:hover {

  background: rgba(0, 0, 0, 0.04);

  color: var(--text-base);

}



@media (max-width: 1080px) {

  .app-shell {

    grid-template-columns: 1fr;

    grid-template-rows: 55vh 45vh;

  }



  .left-pane {

    border-right: 0;

    border-bottom: 1px solid var(--line);

  }



  .message-item {

    width: 94%;

  }

}





.conversation-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform var(--transition-fast);
}
.conversation-item:hover .conversation-avatar {
  transform: scale(1.05);
}

.conversation-info {

  flex-grow: 1;

  overflow: hidden;

}

.conversation-info > div {

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;

}







.conversation-avatar img {

  width: 100%;

  height: 100%;

  object-fit: cover;

  border-radius: 50%;

}








/* ===== Avatar Image Fixes ===== */
.conversation-avatar,
.catalog-item-avatar {
  flex-shrink: 0 !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: none !important;
  background-color: transparent;
}

.conversation-avatar img,
.catalog-item-avatar img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
}

/* ===== Mensagens Prontas (Templates) ===== */
.templates-modal {
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.templates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.template-item:hover {
  border-color: #9bc8b8;
  background: var(--panel-soft);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.template-title {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  margin: 0;
}

.template-category {
  background: #9bc8b8;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-content {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 0;
}

.template-item:hover .template-content {
  color: var(--text);
}

/* Animação de entrada para templates */
@keyframes slideInTemplate {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.template-item {
  animation: slideInTemplate var(--transition-smooth) ease;
}

/* Indicador visual de template selecionado */
.template-item.selected {
  border-color: #9bc8b8;
  background: rgba(155, 200, 184, 0.1);
}

.template-item.selected::before {
  content: "!";
  position: absolute;
  top: 12px;
  right: 12px;
  background: #9bc8b8;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ===== Administração de Templates ===== */
.template-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-system-badge {
  background: #ff9800;
  color: white;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-small:hover {
  background: var(--panel-soft);
  border-color: #9bc8b8;
}

.btn-small.btn-danger {
  border-color: #f44336;
  color: #f44336;
}

.btn-small.btn-danger:hover {
  background: #f44336;
  color: white;
}

.btn-small.btn-outline {
  border-color: #9bc8b8;
  color: #9bc8b8;
}

.btn-small.btn-outline:hover {
  background: #9bc8b8;
  color: white;
}

.add-template-btn {
  width: 100%;
  margin-bottom: 16px;
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  background: #9bc8b8;
  color: white;
  border: none;
  font-weight: 500;
}

.add-template-btn:hover {
  background: #7fb8a8;
}

/* ===== Modal de Edição de Templates ===== */
.template-editor-modal {
  max-width: 700px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.template-editor-modal .form-group {
  margin-bottom: 20px;
}

.template-editor-modal label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}

.template-editor-modal input,
.template-editor-modal textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.template-editor-modal input:focus,
.template-editor-modal textarea:focus {
  outline: none;
  border-color: #9bc8b8;
  box-shadow: 0 0 0 3px rgba(155, 200, 184, 0.1);
}

.template-editor-modal textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.warning-message {
  background: rgba(255, 152, 0, 0.1);
  border: 1px solid #ff9800;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  color: #ff9800;
  font-size: 0.85rem;
}

.warning-message strong {
  display: block;
  margin-bottom: 4px;
}

/* ===== Botões ===== */
.btn-primary {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  border: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  box-shadow: var(--shadow-sm);
}
.btn-outline-danger {
  border: 1px solid var(--line);
  background: var(--panel);
  color: #dc2626;
}
.btn-outline-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--panel-soft);
  border-color: #9bc8b8;
  color: var(--text);
}

.btn-danger {
  background: #f44336;
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #d32f2f;
}

/* ===== Estados de Templates ===== */
.template-empty-state,
.template-error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.template-empty-state p,
.template-error-state p {
  margin: 10px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.template-empty-state p:first-child,
.template-error-state p:first-child {
  font-weight: 500;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 15px;
}

.template-error-state {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid #f44336;
  border-radius: 8px;
  color: #f44336;
}

.template-error-state p:first-child {
  color: #f44336;
  font-weight: 600;
}

/* Status and Revoke Styling */
.msg-status {
    font-size: 0.85em;
    margin-left: 5px;
    font-weight: bold;
}
.status-read {
    color: #34b7f1; /* WhatsApp blue ticks */
}
.status-delivered, .status-sent {
    color: #999;
}
.msg-edited {
    font-size: 0.75em;
    font-style: italic;
    color: #888;
    margin-left: 4px;
}
.edit-message-area {
    padding: 6px 0;
}
.edit-message-input {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #d2dfd9;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    background: #fff;
    color: #102b24;
    box-sizing: border-box;
}
.edit-message-input:focus {
    outline: none;
    border-color: #0a6e4a;
}
.edit-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.edit-save-btn, .edit-cancel-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
}
.edit-save-btn {
    background: #0a6e4a;
    color: #fff;
}
.edit-save-btn:hover {
    background: #085a3c;
}
.edit-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.edit-cancel-btn {
    background: #e0e0e0;
    color: #333;
}
.edit-cancel-btn:hover {
    background: #d0d0d0;
}

.btn-header.ai-btn {
  background: linear-gradient(135deg, #9bc8b8 0%, #7fb8a8 100%);
  color: white;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 6px rgba(155, 200, 184, 0.3);
  transition: all 0.2s ease;
}

.btn-header.ai-btn:hover {
  background: linear-gradient(135deg, #8ab8a8 0%, #6fa898 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(155, 200, 184, 0.4);
}

/* ── AI Consultation Modal ────────────────────────────────────── */
.ai-consult-modal {
  width: min(650px, 92vw) !important;
  max-width: none !important;
  height: min(700px, 88vh);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  gap: 0;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Header */
.ai-consult-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #7fb8a8;
  background: linear-gradient(135deg, #9bc8b8 0%, #7fb8a8 100%);
  flex-shrink: 0;
}

.ai-consult-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 2px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-consult-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  font-weight: 500;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

/* Chat History Area */
.ai-consult-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: #94a3b8;
  text-align: center;
}

.ai-history-empty p {
  font-size: 0.9rem;
  margin: 0;
}

/* Chat messages */
.ai-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #9bc8b8 0%, #7fb8a8 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-message.assistant {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ai-message-time {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.ai-message.user .ai-message-time {
  color: rgba(255, 255, 255, 0.8);
}

.ai-message-content {
  word-break: break-word;
  white-space: pre-wrap;
}

/* Typing indicator (pensando) */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.ai-typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9bc8b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.ai-typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input Area */
.ai-consult-input {
  padding: 16px 20px 20px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.ai-input-textarea {
  resize: none;
  font-size: 0.95rem;
  font-family: 'Manrope', sans-serif;
  line-height: 1.5;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.2s ease;
  min-height: 80px;
  max-height: 150px;
}

.ai-input-textarea:focus {
  outline: none;
  border-color: #9bc8b8;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(155, 200, 184, 0.2);
}

.ai-input-textarea::placeholder {
  color: #94a3b8;
}

/* Input Actions */
.ai-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 4px;
}

/* Small modern action buttons */
.btn-ai-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
}

.btn-ai-secondary {
  background: #fff;
  color: #4a5568;
  border-color: #cbd5e0;
}

.btn-ai-secondary:hover {
  background: rgba(155, 200, 184, 0.1);
  border-color: #9bc8b8;
  color: #5a8a7a;
}

.btn-ai-primary {
  background: linear-gradient(135deg, #9bc8b8 0%, #7fb8a8 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(155, 200, 184, 0.35);
}

.btn-ai-primary:hover {
  background: linear-gradient(135deg, #8ab8a8 0%, #6fa898 100%);
  box-shadow: 0 4px 12px rgba(155, 200, 184, 0.45);
  transform: translateY(-1px);
}

.btn-ai-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


/* ── AI Modal responsive layout ──────────────────────────────── */
@media (max-width: 640px) {
  .ai-consult-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh;
    border-radius: 0;
  }

  .ai-consult-header {
    padding: 14px 16px;
  }

  .ai-consult-history {
    padding: 16px;
  }

  .ai-consult-input {
    padding: 12px 16px 16px;
  }

  .ai-input-textarea {
    min-height: 70px;
  }

  .ai-message {
    max-width: 90%;
    padding: 10px 14px;
  }
}

/* Responsividade para dispositivos móveis (Mobile WhatsApp-like) */
@media (max-width: 768px) {
  .app-shell {
    position: relative;
    width: 100%;
    height: 100vh;
    display: block; /* Remove o display: flex para usar absolute positioning nas filhas */
  }
  
  .left-pane {
    width: 100% !important;
    max-width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    transition: transform 0.3s ease;
  }

  .main-pane {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    visibility: hidden;
  }

  .app-shell.mobile-chat-active .left-pane {
    transform: translateX(-100%);
  }

  .app-shell.mobile-chat-active .main-pane {
    z-index: 20;
    visibility: visible;
  }
    transform: scale(1);
    opacity: 1;
  }
}

/* Input Area */
.ai-consult-input {
  padding: 16px 20px 20px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.ai-input-textarea {
  resize: none;
  font-size: 0.95rem;
  font-family: 'Manrope', sans-serif;
  line-height: 1.5;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.2s ease;
  min-height: 80px;
  max-height: 150px;
}

.ai-input-textarea:focus {
  outline: none;
  border-color: #9bc8b8;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(155, 200, 184, 0.2);
}

.ai-input-textarea::placeholder {
  color: #94a3b8;
}

/* Input Actions */
.ai-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 4px;
}

/* Small modern action buttons */
.btn-ai-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
}

.btn-ai-secondary {
  background: #fff;
  color: #4a5568;
  border-color: #cbd5e0;
}

.btn-ai-secondary:hover {
  background: rgba(155, 200, 184, 0.1);
  border-color: #9bc8b8;
  color: #5a8a7a;
}

.btn-ai-primary {
  background: linear-gradient(135deg, #9bc8b8 0%, #7fb8a8 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(155, 200, 184, 0.35);
}

.btn-ai-primary:hover {
  background: linear-gradient(135deg, #8ab8a8 0%, #6fa898 100%);
  box-shadow: 0 4px 12px rgba(155, 200, 184, 0.45);
  transform: translateY(-1px);
}

.btn-ai-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


/* ── AI Modal responsive layout ──────────────────────────────── */
@media (max-width: 640px) {
  .ai-consult-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh;
    border-radius: 0;
  }

  .ai-consult-header {
    padding: 14px 16px;
  }

  .ai-consult-history {
    padding: 16px;
  }

  .ai-consult-input {
    padding: 12px 16px 16px;
  }

  .ai-input-textarea {
    min-height: 70px;
  }

  .ai-message {
    max-width: 90%;
    padding: 10px 14px;
  }
}

/* Responsividade para dispositivos móveis (Mobile WhatsApp-like) */
@media (max-width: 768px) {
  .app-shell {
    position: relative;
    width: 100%;
    height: 100vh;
    display: block; /* Remove o display: flex para usar absolute positioning nas filhas */
  }
  
  .left-pane {
    width: 100% !important;
    max-width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    transition: transform 0.3s ease;
  }

  .main-pane {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    visibility: hidden;
  }

  .app-shell.mobile-chat-active .left-pane {
    transform: translateX(-100%);
  }

  .app-shell.mobile-chat-active .main-pane {
    z-index: 20;
    visibility: visible;
  }

  .app-resizer {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  #exportCurrentDayBtn {
    font-size: 0.65rem !important;
    padding: 4px 8px !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
  }

  #messageCountBadge {
    display: none !important;
  }

  #mobileBackBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  #mobileBackBtn svg {
    width: 18px !important;
    height: 18px !important;
  }

  #aiConsultOverlay {
    padding: 0 !important;
  }

  .ai-consult-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  #chatSubtitle,
  .conversation-phone {
    font-size: 0.72rem !important;
  }
}

/* Ocultar botão mobile por padrão em desktop */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* Modern Toggle Switch */
.modern-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-soft);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 14px;
  margin-bottom: 14px;
}
.modern-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 16px;
}
.modern-toggle-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.modern-toggle-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}
.modern-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.modern-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.modern-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e0;
  transition: .3s;
  border-radius: 24px;
}
.modern-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.modern-switch input:checked + .modern-slider {
  background-color: var(--accent);
}
.modern-switch input:focus + .modern-slider {
  box-shadow: 0 0 0 2px rgba(15, 140, 119, 0.2);
}
.modern-switch input:checked + .modern-slider:before {
  transform: translateX(20px);
}

/* ─── Reports Dashboard ─────────────────────────────────────────────────────── */

.reports-modal {
  width: 95vw;
  max-width: 1200px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.reports-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 10px;
}

.reports-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.report-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: linear-gradient(135deg, var(--accent-soft), white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.report-card-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  font-family: Sora, Manrope, sans-serif;
}

.report-card-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reports-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.report-chart-container {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.report-chart-container h4 {
  margin: 0 0 12px 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.report-chart-container canvas {
  width: 100% !important;
  max-height: 250px;
}

@media (max-width: 768px) {
  .reports-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .reports-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-bottom: 10px;
  }
  .reports-header h2 {
    font-size: 1rem;
    text-align: center;
  }
  .reports-header > div {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .reports-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  .reports-page-btn {
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
  }
  #printReportsBtn {
    margin-left: 0 !important;
    margin-top: 4px;
    width: 100%;
    text-align: center;
  }
  .reports-charts {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .reports-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .report-card {
    padding: 10px 6px;
  }
  .report-card-value {
    font-size: 1.2rem;
  }
  .report-card-label {
    font-size: 0.65rem;
  }
  .report-chart-container {
    padding: 10px;
    min-width: 0;
  }
  .report-chart-container h4 {
    font-size: 0.75rem;
  }
  .report-chart-container canvas {
    max-height: 200px;
  }
  .report-chart-container table {
    font-size: 0.7rem;
  }
  .report-chart-container th,
  .report-chart-container td {
    padding: 4px;
  }
}

/* ─── Reports Close X Button ─────────────────────────────────────────────────── */

.reports-close-x {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
}

.reports-close-x:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 768px) {
  .reports-close-x {
    display: block;
  }
  #closeReportsBtn {
    display: none;
  }
}

/* ─── Reports Pagination ─────────────────────────────────────────────────────── */

.reports-page.hidden {
  display: none;
}

.reports-page-btn.active {
  background: #059669 !important;
  color: white !important;
  border-color: #059669 !important;
}


/* ─── Print Styles ───────────────────────────────────────────────────────────── */

@media print {
  body * {
    visibility: hidden;
  }
  .reports-modal,
  .reports-modal * {
    visibility: visible;
  }
  .reports-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border-radius: 0;
  }
  .reports-header button,
  .reports-pagination,
  #printReportsBtn {
    display: none !important;
  }
  .reports-page.hidden {
    display: block !important;
  }
}
