:root {
  --wa-green: #128c7e;
  --wa-light: #25d366;
  --wa-blue: #4da6ff;
  --wa-dark: #111b21;
  --panel: #202c33;
  --panel-light: #2a3942;
  --text-main: #e9edef;
  --text-muted: #8696a0;
  --border: rgba(134, 150, 160, 0.4);
  --outgoing: #005c4b;
  --incoming: #202c33;
  --danger: #f87171;
  --body-background: linear-gradient(180deg, #0b141a 0%, #202c33 25%, #101a20 100%);
  --chat-panel-bg: #0b141a;
  --message-form-bg: rgba(11, 20, 26, 0.7);
  --meta-sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  --card-bg: #111b21;
  --card-border: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.35);
  --glass-border: rgba(255, 255, 255, 0.08);
  font-family: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="light"] {
  --wa-dark: #ffffff;
  --panel: #ffffff;
  --panel-light: #eef3f7;
  --text-main: #14202b;
  --text-muted: #4d5a64;
  --border: rgba(17, 27, 33, 0.15);
  --outgoing: #dff6dd;
  --incoming: #ffffff;
  --body-background: linear-gradient(180deg, #e7eef4 0%, #f8fbff 100%);
  --chat-panel-bg: #f4f6f8;
  --message-form-bg: rgba(255, 255, 255, 0.95);
  --meta-sidebar-bg: linear-gradient(180deg, rgba(17, 27, 33, 0.04), rgba(17, 27, 33, 0.02));
  --card-bg: #ffffff;
  --card-border: rgba(17, 27, 33, 0.12);
  --shadow-soft: 0 20px 50px rgba(15, 23, 42, 0.15);
  --glass-border: rgba(17, 27, 33, 0.08);
}

* {
  box-sizing: border-box;
  scrollbar-color: rgba(134, 150, 160, 0.5) transparent;
}

body,
button,
input,
textarea,
select {
  font-family: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease;
}

::selection {
  background: rgba(37, 211, 102, 0.25);
  color: var(--wa-dark);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(17, 27, 33, 0.2);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--body-background);
  color: var(--text-main);
  font-family: inherit;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding: 1.2rem;
  gap: 1.2rem;
  background: radial-gradient(circle at top, rgba(37, 211, 102, 0.08), transparent 40%);
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:root[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.92);
}

.sidebar {
  width: 320px;
  background: rgba(10, 20, 28, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.2rem;
  gap: 1.2rem;
  height: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.sidebar-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
}

.search-box select,
.search-box .filter-row {
  width: 100%;
}

.search-box select {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.filter-row input[type="checkbox"] {
  width: auto;
}

.conversation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 0.4rem;
  padding-top: 0.3rem;
}

.conversation-item {
  padding: 0.35rem;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, border 0.2s ease, transform 0.2s ease;
}

.conversation-item.unread {
  background: rgba(77, 166, 255, 0.12);
  border-color: rgba(77, 166, 255, 0.6);
}

.conversation-item:hover,
.conversation-item.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.conversation-item.active {
  background: rgba(37, 211, 102, 0.08);
  border-color: var(--wa-light);
}

.conversation-item .unread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wa-blue);
  display: inline-block;
  margin-right: 0.4rem;
}

.conversation-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--wa-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.25rem;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    "Segoe UI", sans-serif;
  line-height: 1;
}

:root[data-theme="light"] .conversation-avatar {
  background: rgba(17, 27, 33, 0.05);
  color: #111b21;
  border-color: rgba(17, 27, 33, 0.08);
}

.conversation-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.chat-presence {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.presence-watchers {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.presence-chip {
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: var(--text-main);
}

:root[data-theme="light"] .presence-chip {
  background: rgba(17, 27, 33, 0.05);
  border-color: rgba(17, 27, 33, 0.08);
}

.conversation-item h3 {
  font-size: 1rem;
  margin-bottom: 0;
  margin-top: 0;
}

.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.conversation-header-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.conversation-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.conversation-snippet-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  row-gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.conversation-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.conversation-snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-chip {
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.assigned-chip {
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: rgba(37, 211, 102, 0.1);
  color: var(--wa-light);
  font-size: 0.75rem;
  border: 1px solid rgba(37, 211, 102, 0.2);
  flex-shrink: 0;
}

.tag-chip {
  border-radius: 8px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  flex-shrink: 0;
}

:root[data-theme="light"] .tag-chip {
  border-color: rgba(17, 27, 33, 0.12);
  background: rgba(17, 27, 33, 0.04);
  color: #1f2a32;
}

.notifications-panel {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  z-index: 60;
  width: min(360px, 90vw);
  max-height: 70vh;
  box-shadow: var(--shadow-strong);
}

.notifications-panel.hidden {
  display: none;
}

.notifications-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.notifications-list {
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notification-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.notification-item.unread {
  border-color: var(--wa-light);
}

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

.badge-alert {
  background: var(--danger);
  color: #fff;
}

.status-chip {
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.status-chip.status-pending {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

.status-chip.status-progress {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

.status-chip.status-closed {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.conversation-flags {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.task-indicator {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-panel {
  flex: 1;
  background: var(--chat-panel-bg);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.5rem 1.5rem;
  gap: 1.2rem;
  overflow: hidden;
  min-height: 0;
  border-radius: 32px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.chat-body {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
  overflow: visible;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  gap: 1rem;
}

.session-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] .session-timer {
  background: rgba(17, 27, 33, 0.04);
}

.session-timer.active {
  color: var(--text-main);
}

.session-timer.warning {
  background: rgba(255, 193, 7, 0.18);
  color: #ffda6a;
}

:root[data-theme="light"] .session-timer.warning {
  color: #b57700;
}

.session-timer.expired {
  background: rgba(235, 87, 87, 0.15);
  color: #ff9c9c;
}

:root[data-theme="light"] .session-timer.expired {
  color: #d64545;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-switch {
  display: flex;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem;
  border-radius: 999px;
}

.filter-button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.filter-button.active {
  background: var(--wa-green);
  color: white;
}

.badge {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.badge-idle {
  background: rgba(134, 150, 160, 0.15);
  color: var(--text-muted);
}

.badge-loading {
  background: rgba(37, 211, 102, 0.25);
  color: var(--text-main);
}

.badge-filter {
  background: rgba(18, 140, 126, 0.2);
  color: var(--wa-light);
  border: 1px solid rgba(18, 140, 126, 0.4);
}

.insights-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.insights-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.insights-compact .insight-card {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--glass-border);
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.02)
    ),
    rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 150px;
  flex: 1 1 0;
}

.insight-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.insight-card strong {
  font-size: 1.2rem;
  font-weight: 600;
}

.insight-card small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.insights-collapsed {
  display: none !important;
}

.pill-button.tiny {
  padding: 4px 8px;
  font-size: 0.78rem;
}

.message-thread {
  flex: 1;
  min-height: 0;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.02),
      rgba(255, 255, 255, 0.08)
    ),
    url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23111b21' fill-opacity='0.25'%3E%3Cpath d='M0 0h32v32H0z'/%3E%3C/g%3E%3C/svg%3E");
  border-radius: 24px;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.message-thread.empty-state {
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
}

.bubble {
  max-width: 70%;
  padding: 0.8rem;
  border-radius: 12px;
  position: relative;
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.bubble-in {
  align-self: flex-start;
  background: var(--incoming);
}

.bubble-out {
  align-self: flex-end;
  background: var(--outgoing);
}

.bubble small {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  align-items: center;
}

.bubble .sender-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

:root[data-theme="light"] .bubble .sender-tag {
  background: rgba(17, 27, 33, 0.05);
  border-color: rgba(17, 27, 33, 0.12);
  color: var(--text-muted);
}

.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.bubble-text strong {
  font-weight: 600;
}

.bubble-text em {
  font-style: italic;
}

.bubble-text s {
  text-decoration: line-through;
}

.bubble-text code {
  font-family: "Fira Mono", "SFMono-Regular", Consolas, monospace;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 0 0.25rem;
  font-size: 0.85rem;
}

.attachments {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachments img {
  max-width: 240px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.attachments audio {
  width: 240px;
}

.special-block {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.special-block h4 {
  margin: 0 0 0.3rem 0;
  font-size: 0.9rem;
}

.special-block a {
  color: var(--wa-light);
}

.special-block + .special-block {
  margin-top: 0.35rem;
}

.reactions {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.35rem;
}

.reaction-pill {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
}

.status-icon {
  margin-left: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-icon.double {
  letter-spacing: -0.15rem;
}

.status-icon.read {
  color: #4fc3f7;
}

.attachments-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-button {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

.attachments-bar select,
.attachments-bar input[type="text"] {
  max-width: 200px;
}

#contact-inputs {
  display: flex;
  gap: 0.5rem;
}

#contact-inputs.hidden {
  display: none;
}

.meta-sidebar {
  width: 320px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: var(--meta-sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  height: 100%;
  overflow: hidden;
  transition: max-width 0.2s ease, padding 0.2s ease, width 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.meta-sidebar h3 {
  margin-top: 0;
}

.meta-sidebar label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auto-reply-toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.auto-reply-toggle input {
  width: auto;
}

.auto-message-settings {
  gap: 0.4rem;
}

.auto-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.auto-message-header .toggle-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.auto-message-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.25rem 0;
}

.auto-message-settings .toggle-row input[type="checkbox"] {
  width: auto;
}

.auto-message-settings textarea {
  min-height: 110px;
  resize: vertical;
}

.auto-message-settings input[type="text"] {
  width: 100%;
}

.auto-message-settings button {
  align-self: flex-start;
}

.meta-sidebar input,
.meta-sidebar select,
.meta-sidebar textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
}

.meta-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta-section.tasks-section {
  gap: 0.65rem;
}

.meta-section h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pill-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-main);
  padding: 0.2rem 0.9rem;
  font-size: 0.8rem;
}

.pill-button.primary {
  background: var(--wa-light);
  border-color: var(--wa-light);
  color: #0b141a;
  font-weight: 600;
}

.pill-button.subtle {
  opacity: 0.75;
}

.tasks-list {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0.5rem;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.notes-section,
.audit-section {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notes-list,
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.note-entry,
.audit-entry {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-size: 0.8rem;
}

:root[data-theme="light"] .note-entry,
:root[data-theme="light"] .audit-entry {
  border-color: rgba(17, 27, 33, 0.12);
}

.note-entry header,
.audit-entry header {
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.note-form textarea {
  min-height: 60px;
}

.note-form select {
  min-height: 60px;
}

.task-item {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.task-item.overdue {
  border-color: var(--danger);
}

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

.task-item-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.task-item-header input {
  flex: 1;
}

.task-item-controls {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.task-item textarea {
  min-height: 50px;
  resize: vertical;
}

.task-remove {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.task-remove:hover {
  color: var(--wa-light);
}

.task-form {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
}

.task-form.hidden {
  display: none;
}

.task-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.form-row.compact label {
  flex: 1;
  min-width: 0;
}

.icon-button--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.meta-actions {
  display: flex;
  gap: 0.5rem;
}

.meta-actions button {
  padding: 0.4rem 1.2rem;
  border-radius: 999px;
  background: var(--wa-light);
  color: #0b141a;
  border: none;
  cursor: pointer;
}

.meta-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-main);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.meta-content {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.meta-sidebar.collapsed {
  max-width: 72px;
  width: 72px;
  padding: 0.75rem;
}

.meta-sidebar.collapsed .meta-content {
  display: none;
}

.meta-handle {
  width: 6px;
  cursor: col-resize;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease;
}

.meta-handle:hover,
.meta-handle.dragging {
  background: var(--wa-light);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  .app-shell {
    height: auto;
    flex-direction: column;
  }
  .chat-body {
    flex-direction: column;
  }
  .meta-handle {
    display: none;
  }
  .meta-sidebar {
    width: 100%;
    max-width: none;
  }
}

.message-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--message-form-bg);
  overflow: visible;
  flex: none;
  box-shadow: var(--shadow-soft);
  position: relative;
}

.composer-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] .composer-input-row {
  background: rgba(17, 27, 33, 0.04);
}

.composer-input-row textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.95rem;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  padding: 0.4rem 0;
  overflow-y: auto;
}

.composer-input-row textarea:focus {
  outline: none;
}

.composer-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

:root[data-theme="light"] .composer-icon {
  border-color: rgba(17, 27, 33, 0.1);
  background: rgba(17, 27, 33, 0.05);
}

.composer-icon.active {
  border-color: var(--wa-light);
  color: var(--wa-light);
  background: rgba(37, 211, 102, 0.12);
}

.composer-icon input[type="file"] {
  display: none;
}

.composer-trailing {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.emoji-popover {
  position: absolute;
  right: 72px;
  bottom: 150px;
  width: 320px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.35rem;
  box-shadow: var(--shadow-soft);
  z-index: 900;
  max-height: calc(100vh - 200px);
  overflow: hidden;
}

:root[data-theme="light"] .emoji-popover {
  background: #ffffff;
}

.emoji-popover emoji-picker {
  width: 100%;
  border-radius: 12px;
  --font: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px dashed rgba(248, 113, 113, 0.8);
  background: rgba(248, 113, 113, 0.08);
}

:root[data-theme="light"] .recording-indicator {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(248, 113, 113, 0.15);
}

.recording-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #f87171;
  animation: recordingPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.8);
}

.recording-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

@keyframes recordingPulse {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.7;
  }
}

.circle-button {
  font-size: 1.2rem;
}

.send-button {
  background: var(--wa-light);
  border-color: var(--wa-light);
  color: #0b141a;
  font-weight: 600;
}

.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.composer-toggles {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill-button.active {
  background: var(--wa-light);
  border-color: var(--wa-light);
  color: #0b141a;
  font-weight: 600;
}

.quick-replies {
  position: absolute;
  right: 72px;
  bottom: calc(100% + 10px);
  width: 360px;
  max-height: 420px;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.85rem;
  box-shadow: var(--shadow-soft);
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

:root[data-theme="light"] .quick-replies {
  background: #ffffff;
}

.quick-replies-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.quick-replies-list {
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

:root[data-theme="light"] .quick-replies-list {
  border-color: rgba(17, 27, 33, 0.15);
}

.quick-reply-item {
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

:root[data-theme="light"] .quick-reply-item {
  background: rgba(17, 27, 33, 0.04);
}

.quick-reply-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

.quick-replies-list button {
  font-size: 0.85rem;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
}

:root[data-theme="light"] .quick-replies-list button {
  background: rgba(17, 27, 33, 0.08);
  border-color: rgba(17, 27, 33, 0.18);
  color: #0b141a;
}

.quick-reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.quick-reply-form input,
.quick-reply-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
}

:root[data-theme="light"] .quick-reply-form input,
:root[data-theme="light"] .quick-reply-form textarea {
  background: #ffffff;
}

.reply-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(18, 140, 126, 0.4);
  border-radius: 8px;
  font-size: 0.85rem;
  background: rgba(18, 140, 126, 0.12);
  max-height: 90px;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.reply-preview.hidden {
  display: none;
}

.reply-preview .icon-button {
  min-width: 24px;
  height: 24px;
  font-size: 0.9rem;
  color: var(--text-main);
}

:root[data-theme="light"] .reply-preview {
  border-color: rgba(18, 140, 126, 0.25);
  background: rgba(18, 140, 126, 0.15);
}

:root[data-theme="light"] .reply-preview .icon-button {
  color: #000000;
}

.reply-preview.expanded {
  max-height: 280px;
}

.message-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.message-form input,
.message-form textarea,
.message-form select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
  font-size: 0.95rem;
}

.message-form textarea {
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row label {
  flex: 1;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.muted.small {
  font-size: 0.75rem;
}

button {
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message-form button {
  background: var(--wa-green);
  color: white;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.message-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-button:hover {
  border-color: var(--wa-light);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  background: var(--wa-green);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.error {
  background: #b91c1c;
  border: 1px solid rgba(254, 226, 226, 0.6);
  color: #ffffff;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

:root[data-theme="light"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.35);
}

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

.modal-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  width: min(520px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.modal-hint {
  margin: 0;
}

.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-card header h3 {
  margin: 0;
}

.modal-card .toggle-row input[type="checkbox"] {
  width: auto;
}

.modal-close {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

:root[data-theme="light"] .modal-close {
  border-color: rgba(17, 27, 33, 0.1);
  background: rgba(17, 27, 33, 0.05);
}

.user-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.25rem;
}

.user-row {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

:root[data-theme="light"] .user-row {
  border-color: rgba(17, 27, 33, 0.08);
  background: rgba(17, 27, 33, 0.02);
}

.user-row-main {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--panel-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--wa-light);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

:root[data-theme="light"] .user-avatar {
  background: rgba(17, 27, 33, 0.08);
  border-color: rgba(17, 27, 33, 0.12);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.user-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.user-badge {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid transparent;
}

.badge-admin {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.3);
}

.badge-agent {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.12);
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-inactive {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.user-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.user-role-select {
  min-width: 160px;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
}

.toggle-on {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.toggle-off {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.user-row.inactive {
  opacity: 0.6;
}

.user-row span {
  display: block;
  font-size: 0.85rem;
}

.user-role {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.templates-modal {
  width: min(940px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.template-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  max-height: 260px;
  min-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.template-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}

:root[data-theme="light"] .template-item {
  border-color: rgba(17, 27, 33, 0.15);
}

.template-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.template-actions {
  display: flex;
  gap: 0.35rem;
}

.template-actions button {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  padding: 0.3rem 0.55rem;
}

:root[data-theme="light"] .template-actions button {
  background: rgba(17, 27, 33, 0.06);
}

.template-form,
.template-send {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.template-catalog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.template-catalog-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.template-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

:root[data-theme="light"] .template-badge {
  border-color: rgba(59, 130, 246, 0.3);
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.22);
}

.template-variables {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.template-variables label {
  flex: 1 1 140px;
}

.template-override {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.template-override label {
  flex: 1 1 180px;
}

.template-meta-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.template-results {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.template-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.template-result-item:last-child {
  border-bottom: none;
}

.template-result-item.success {
  color: var(--wa-light);
}

.template-result-item.error {
  color: #f87171;
}

.template-targets-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.template-target-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .template-target-row {
  border-color: rgba(17, 27, 33, 0.08);
}

.template-target-row:last-child {
  border-bottom: none;
}

.template-target-row strong {
  min-width: 120px;
}

.template-target-row.error {
  color: #f87171;
}

.template-target-head {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}

.template-target-status {
  font-size: 0.75rem;
  opacity: 0.8;
}

.template-target-row.error .template-target-status {
  color: #f87171;
  opacity: 1;
}

.template-target-row.success .template-target-status {
  color: var(--wa-light);
}

.template-target-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
}

.template-target-inputs label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  gap: 0.15rem;
  flex: 1 1 140px;
}

.template-target-inputs input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
}

:root[data-theme="light"] .template-target-inputs input {
  background: rgba(17, 27, 33, 0.04);
  border-color: rgba(17, 27, 33, 0.15);
}

.contacts-modal {
  width: min(780px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}

.contacts-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.contacts-toolbar input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
}

:root[data-theme="light"] .contacts-toolbar input {
  background: rgba(17, 27, 33, 0.04);
  border-color: rgba(17, 27, 33, 0.15);
}

.contacts-directory {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 60vh;
  overflow-y: auto;
}

.contact-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

:root[data-theme="light"] .contact-card {
  border-color: rgba(17, 27, 33, 0.12);
}

.contact-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.contact-card-header strong {
  font-size: 1.05rem;
}

.contact-card-actions {
  display: flex;
  gap: 0.35rem;
}

.contact-card-actions button {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.35rem 0.95rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

:root[data-theme="light"] .contact-card-actions button {
  background: rgba(17, 27, 33, 0.05);
}

.contact-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.contact-details dt {
  font-weight: 600;
  margin: 0;
}

.contact-details dd {
  margin: 0;
  color: var(--text-muted);
}

.contact-card-notes {
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
}

:root[data-theme="light"] .contact-card-notes {
  border-top-color: rgba(17, 27, 33, 0.08);
}

.campaign-history {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.history-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.history-filters label {
  flex: 1 1 150px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.campaign-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
}

.campaign-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

:root[data-theme="light"] .campaign-card {
  border-color: rgba(17, 27, 33, 0.15);
}

.campaign-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.campaign-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.campaign-actions button {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

:root[data-theme="light"] .campaign-actions button {
  background: rgba(17, 27, 33, 0.06);
}

.campaign-results {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.35rem;
  display: none;
  font-size: 0.85rem;
}

.campaign-card.expanded .campaign-results {
  display: block;
}

.campaign-result-row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.2rem 0;
}

.campaign-result-row.success {
  color: var(--wa-light);
}

.campaign-result-row.error {
  color: #f87171;
}
.template-target-row.success {
  color: var(--wa-light);
}

.login-body {
  min-height: 100vh;
  background: var(--body-background);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.login-card {
  width: min(420px, 90vw);
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.login-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.login-card h1 {
  font-size: 1.5rem;
}

.login-card p {
  color: var(--text-muted);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login-card input {
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-main);
}

.login-card button {
  margin-top: 0.4rem;
  border-radius: 999px;
  padding: 0.8rem;
  border: none;
  background: var(--wa-green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

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

@media (max-width: 1024px) {
  body {
    overflow: auto;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-radius: 20px;
  }

  .chat-panel {
    padding: 1rem;
    min-height: auto;
  }

  .chat-body {
    flex-direction: column;
    min-height: auto;
  }

  .message-thread {
    min-height: 40vh;
  }

  .meta-handle,
  .composer-handle {
    display: none;
  }

  .meta-sidebar {
    width: 100%;
    max-width: none;
    height: auto;
  }

  .form-row {
    flex-direction: column;
  }
}
.reply-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.reply-btn:hover {
  color: var(--wa-light);
}

:root[data-theme="light"] .reply-btn {
  color: rgba(17, 27, 33, 0.7);
}

:root[data-theme="light"] .reply-btn:hover {
  color: #111b21;
}

.quoted-message {
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.composer-handle {
  height: 6px;
  border-radius: 999px;
  margin: 0.5rem 0;
  background: rgba(255, 255, 255, 0.08);
  cursor: row-resize;
  transition: background 0.2s ease;
}

.composer-handle:hover,
.composer-handle.dragging {
  background: var(--wa-light);
}
