@font-face {
  font-family: "Usuzi";
  src: url("../../fonts/usuzi.ttf") format("truetype");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --blue-light: #e8f0fe;
  --red: #ea4335;
  --red-light: #fce8e6;
  --green: #34a853;
  --green-light: #e6f4ea;
  --yellow: #fbbc04;
  --yellow-light: #fef7e0;
  --surface: #ffffff;
  --bg: #f8f9fa;
  --bg-soft: #f1f3f4;
  --border: #e0e0e0;
  --text: #202124;
  --text-2: #3c4043;
  --text-3: #5f6368;
  --scrollbar-thumb: #b6bfcb;
  --scrollbar-thumb-hover: #98a3b2;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.16), 0 1px 3px rgba(60, 64, 67, 0.12);
  --radius: 8px;
  --button-height: 40px;
  --button-width: 112px;
  --button-padding-x: 14px;
  --button-gap: 8px;
  --desktop-app-scale: 1;
  --desktop-app-topbar-height: 64px;
  --desktop-app-viewport-width: calc(100vw / var(--desktop-app-scale));
  --desktop-app-viewport-height: calc(100vh / var(--desktop-app-scale));
  --desktop-app-safe-height: calc(100svh / var(--desktop-app-scale));
}

html[data-dark] {
  --surface: #1e2025;
  --bg: #131519;
  --bg-soft: #2d3139;
  --border: #3c4043;
  --text: #e8eaed;
  --text-2: #bdc1c6;
  --text-3: #9aa0a6;
  --scrollbar-thumb: #5f6876;
  --scrollbar-thumb-hover: #727b89;
  --blue-light: rgba(26, 115, 232, 0.2);
  --red-light: rgba(234, 67, 53, 0.2);
  --green-light: rgba(52, 168, 83, 0.2);
  --yellow-light: rgba(251, 188, 4, 0.2);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", Arial, sans-serif;
}

.page-content-fade {
  opacity: 0;
  transition: opacity 0.28s ease;
}

body.page-ready .page-content-fade {
  opacity: 1;
}

.page-preloader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 249, 250, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.page-preloader.visible {
  opacity: 1;
  pointer-events: auto;
}

html[data-dark] .page-preloader {
  background: rgba(19, 21, 25, 0.8);
}

.page-preloader-spinner {
  width: 52px;
  height: 52px;
  position: relative;
  animation: preloader-rotate 1.15s linear infinite;
}

.page-preloader-spinner span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0.22;
  animation: preloader-dot 0.92s ease-in-out infinite;
}

.page-preloader-spinner span:nth-child(1) { transform: rotate(0deg) translateY(-20px); animation-delay: 0s; }
.page-preloader-spinner span:nth-child(2) { transform: rotate(45deg) translateY(-20px); animation-delay: 0.08s; }
.page-preloader-spinner span:nth-child(3) { transform: rotate(90deg) translateY(-20px); animation-delay: 0.16s; }
.page-preloader-spinner span:nth-child(4) { transform: rotate(135deg) translateY(-20px); animation-delay: 0.24s; }
.page-preloader-spinner span:nth-child(5) { transform: rotate(180deg) translateY(-20px); animation-delay: 0.32s; }
.page-preloader-spinner span:nth-child(6) { transform: rotate(225deg) translateY(-20px); animation-delay: 0.4s; }
.page-preloader-spinner span:nth-child(7) { transform: rotate(270deg) translateY(-20px); animation-delay: 0.48s; }
.page-preloader-spinner span:nth-child(8) { transform: rotate(315deg) translateY(-20px); animation-delay: 0.56s; }

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

@keyframes preloader-dot {
  0%, 100% { opacity: 0.18; }
  45% { opacity: 1; }
}

body.public-chat-open {
  height: 100svh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

/* Remove marca interna do autofill nos campos */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-3);
  caret-color: var(--text-3);
  box-shadow: 0 0 0 1000px var(--bg-soft) inset;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-soft) inset;
  transition: background-color 99999s ease-in-out 0s;
}

input,
select,
textarea {
  color: var(--text-3);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
  opacity: 1;
}

button {
  border: 0;
}

.hidden {
  display: none !important;
}

.action-button,
.link-button {
  min-height: var(--button-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--button-gap);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.action-button {
  width: auto;
  min-width: 0;
  padding: 0 var(--button-padding-x);
}

.link-button {
  min-width: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--blue);
}

.action-button i,
.action-button span,
.link-button i,
.link-button span {
  color: inherit;
  line-height: 1;
}

.action-button i,
.link-button i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.action-button:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.desktop-shell {
  min-height: var(--desktop-app-viewport-height);
  padding-top: var(--desktop-app-topbar-height);
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 120;
  height: var(--desktop-app-topbar-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-menu {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  font-size: 20px;
  cursor: pointer;
}

.top-menu:hover,
.top-menu:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.top-menu.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.top-menu.is-disabled:hover,
.top-menu.is-disabled:focus-visible {
  background: transparent;
}

.top-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  margin-right: 4px;
}

.top-logo-text,
.brand span {
  color: var(--text-2);
  font-family: "Usuzi", "Roboto", sans-serif;
  font-size: 20px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.top-logo-it,
.brand strong {
  color: var(--blue);
  font-weight: 400;
}

.top-search,
.conversation-search,
.composer-input {
  display: flex;
  align-items: center;
  color: var(--text-3);
}

.top-search {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
}

.search-inner {
  height: 46px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--text-3);
  transition: all 0.2s ease;
}

.search-inner:hover {
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.search-inner:focus-within {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-inner i {
  color: var(--text-3);
  font-size: 16px;
}

.top-search input,
.search-inner input,
.conversation-search input,
.composer-input input,
.composer-input textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-3);
}

.composer-input textarea {
  resize: none;
  overflow-y: hidden;
  line-height: 1.5;
  padding: 0;
  height: 24px;
  max-height: 110px;
  display: block;
  font-family: inherit;
  font-size: inherit;
}

.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  position: relative;
}

.top-icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  position: relative;
}

.top-icon-btn:hover,
.top-icon-btn:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.top-notifications {
  position: relative;
}

.top-notification-badge {
  position: absolute;
  top: 5px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.top-notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 260;
  width: min(360px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(60, 64, 67, 0.22);
}

.top-notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.top-notification-head strong {
  color: var(--text);
  font-size: 14px;
}

.top-notification-head span {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.top-notification-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.top-notification-list::-webkit-scrollbar {
  width: 6px;
}

.top-notification-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.top-notification-item,
.top-notification-empty {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
}

.top-notification-item:hover,
.top-notification-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.top-notification-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}

.top-notification-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-notification-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-notification-main strong,
.top-notification-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-notification-main strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.top-notification-main small {
  color: var(--text-3);
  font-size: 12px;
}

.top-notification-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.top-notification-meta time {
  color: var(--text-3);
  font-size: 11px;
  white-space: nowrap;
}

.top-notification-count {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.top-notification-empty {
  display: flex;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.has-badge::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}

.top-icon-btn.has-badge::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}

.avatar,
.person-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.avatar {
  width: 34px;
  height: 34px;
  background: var(--blue);
}

.top-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

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

.top-avatar-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-user-menu {
  position: relative;
  margin-left: 4px;
}

.top-user-menu .top-icon-btn {
  margin-left: 0;
}

.top-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 240;
  min-width: 176px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(60, 64, 67, 0.2);
}

.top-user-dropdown form {
  margin: 0;
}

.top-user-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.top-user-item i {
  width: 16px;
  color: var(--text-3);
  text-align: center;
}

.top-user-item:hover,
.top-user-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.top-user-item-danger {
  color: #c5221f;
}

.top-user-item-danger i {
  color: #c5221f;
}

.top-user-menu.open .top-icon-btn {
  box-shadow: 0 0 0 3px var(--blue-light);
}

.top-zoom-menu {
  position: relative;
  margin-left: 4px;
}

.top-zoom-menu .top-icon-btn {
  margin-left: 0;
}

.top-zoom-menu.open .top-icon-btn {
  box-shadow: 0 0 0 3px var(--blue-light);
}

.top-zoom-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 250;
  width: min(260px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(60, 64, 67, 0.2);
}

.top-zoom-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.top-zoom-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-zoom-copy {
  margin: 0;
  padding: 8px 4px 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
}

.top-zoom-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s;
}

.top-zoom-option:hover {
  background: var(--bg-soft);
}

.top-zoom-option.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.person-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.blue {
  background: var(--blue);
}

.red {
  background: var(--red);
}

.green {
  background: var(--green);
}

.yellow-avatar {
  background: #f9ab00;
}

body.login-page {
  display: block;
  height: auto;
  min-height: 100vh;
  overflow: auto;
  padding-top: 0;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-right: 1px solid var(--border);
  background: linear-gradient(145deg, #eef3fd 0%, var(--bg) 100%);
}

html[data-dark] .login-left {
  background: linear-gradient(145deg, #1d2430 0%, var(--bg) 100%);
}

.login-left-greeting {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 32px;
  font-weight: 300;
  text-align: center;
}

.login-left-sub {
  margin-bottom: 48px;
  color: var(--text-3);
  font-size: 16px;
  text-align: center;
}

.login-left-img {
  width: 100%;
  max-width: 600px;
  opacity: 0.9;
}

.login-visual {
  width: 100%;
  max-width: 600px;
  opacity: 0.95;
}

.visual-window {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(60, 64, 67, 0.18);
}

.visual-topbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.visual-topbar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.visual-content {
  min-height: 300px;
  display: grid;
  grid-template-columns: 72px 1fr;
}

.visual-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-top: 28px;
  border-right: 1px solid var(--border);
  color: var(--text-3);
}

.visual-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
}

.visual-line {
  height: 18px;
  border-radius: 999px;
  background: var(--bg-soft);
}

.visual-line.wide {
  width: 64%;
}

.visual-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.visual-cards span {
  height: 82px;
  border-radius: var(--radius);
  background: var(--blue-light);
}

.visual-chart {
  height: 120px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 12px;
}

.visual-chart span {
  border-radius: var(--radius) var(--radius) 4px 4px;
  background: var(--blue);
}

.visual-chart span:nth-child(1) {
  height: 45%;
}

.visual-chart span:nth-child(2) {
  height: 68%;
}

.visual-chart span:nth-child(3) {
  height: 38%;
}

.visual-chart span:nth-child(4) {
  height: 88%;
}

.login-right {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--surface);
}

.login-logo {
  display: flex;
  align-items: baseline;
  margin-bottom: 8px;
}

.login-logo-text {
  color: var(--text-2);
  font-family: "Usuzi", "Roboto", sans-serif;
  font-size: 30px;
  letter-spacing: 0.3px;
}

.login-logo-it {
  color: var(--blue);
}

.login-tagline {
  margin-bottom: 40px;
  color: var(--text-3);
  font-size: 13px;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-title {
  margin: 0 0 24px;
  color: var(--text);
  font-size: 24px;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-field {
  position: relative;
  display: block;
  margin-bottom: 4px;
}

.login-field i {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
  transform: translateY(-50%);
}

.login-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: none;
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}

.login-field input:focus {
  border-color: var(--blue);
  background: var(--blue-light);
}

.login-field input.error {
  border-color: var(--red);
}

.login-help {
  min-height: 16px;
  display: block;
  margin: 0 0 8px;
  color: #c5221f;
  font-size: 12px;
}

.btn-login {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.btn-login > i {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
}

.btn-login:hover:not(.disabled) {
  background: var(--blue-dark);
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.4);
}

.btn-login.disabled,
.btn-login:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.btn-login .spinner {
  width: 18px;
  height: 18px;
  display: none;
  flex: 0 0 18px;
  order: -1;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-login .btn-text {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 0;
  background: transparent !important;
  box-shadow: none;
  color: #ffffff !important;
  line-height: 1;
  text-decoration: none;
}

.btn-login.loading .spinner {
  display: block;
}

.btn-login.loading > i {
  display: none;
}

.login-footer {
  margin-top: 40px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.login-footer a {
  color: var(--text-3);
}

.login-footer a:hover {
  color: var(--blue);
}

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

.login-modal-box {
  width: min(90%, 380px);
  padding: 28px 32px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-modal-box h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.login-modal-box h2 i {
  color: var(--red);
}

.login-modal-box p {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.desktop-form,
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-field > span:first-child {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.form-field small {
  min-height: 14px;
  color: #c5221f;
  font-size: 12px;
}

.input-control,
.board-search,
.dropdown-search {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-3);
}

.input-control:focus-within,
.board-search:focus-within,
.dropdown-search:focus-within {
  border-color: var(--blue);
  background: var(--surface);
}

.input-control select,
.input-control input,
.board-search input,
.dropdown-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-button {
  width: 100%;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
}

.form-alert.error {
  background: var(--red-light);
  color: #c5221f;
}

.form-alert.warning {
  background: var(--yellow-light);
  color: #8a5a00;
}

.form-alert.success {
  background: var(--green-light);
  color: #188038;
}

.workspace {
  height: calc(var(--desktop-app-viewport-height) - var(--desktop-app-topbar-height));
  min-height: 0;
  display: grid;
  grid-template-columns: 68px 360px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.desktop-shell.sidebar-expanded .workspace {
  grid-template-columns: 256px 360px minmax(0, 1fr);
}

.dashboard-workspace {
  grid-template-columns: 68px minmax(0, 1fr);
}

.desktop-shell.sidebar-expanded .dashboard-workspace {
  grid-template-columns: 256px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: calc(var(--desktop-app-viewport-height) - var(--desktop-app-topbar-height));
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.main-nav {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

.main-nav.standard {
  padding: 10px 8px;
  gap: 0;
  overflow: hidden;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 2px auto;
  padding: 0;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  width: 44px;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.nav-item.active {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.nav-item i {
  width: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 18px;
}

.nav-item.active i {
  color: var(--blue);
}

.nav-item span,
.nav-item strong,
.nav-section {
  display: none;
}

.nav-item strong {
  margin-left: auto;
  min-width: 24px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
}

.desktop-shell.sidebar-expanded .nav-item {
  width: auto;
  justify-content: flex-start;
  margin: 2px 16px 2px 0;
  padding: 0 20px 0 24px;
  border-radius: 0 999px 999px 0;
}

.desktop-shell.sidebar-expanded .nav-item span,
.desktop-shell.sidebar-expanded .nav-section {
  display: inline;
}

.desktop-shell.sidebar-expanded .nav-item strong {
  display: inline-flex;
}

.desktop-shell.sidebar-expanded .nav-section {
  padding: 14px 24px 4px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-spacer {
  margin-top: auto;
}

.nav-divider {
  height: 1px;
  margin: 10px 8px;
  background: var(--border);
}

.nav-caret {
  margin-left: auto;
  color: var(--text-3);
  font-size: 14px;
}

.nav-submenu {
  display: none;
}

.desktop-shell.sidebar-expanded .nav-submenu.open {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}

.desktop-shell.sidebar-expanded .nav-item[data-nav-toggle] {
  cursor: pointer;
}

.desktop-shell.sidebar-expanded .nav-item[data-nav-toggle] .nav-caret {
  transition: transform 0.18s ease;
}

.desktop-shell.sidebar-expanded .nav-item[data-nav-toggle][aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.nav-subitem {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 0 56px;
  border-radius: 0 999px 999px 0;
  color: var(--text-3);
  font-size: 13.5px;
  margin-right: 16px;
}

.nav-subitem:hover,
.nav-subitem:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.nav-subitem.active {
  color: var(--blue-dark);
  font-weight: 600;
  background: var(--blue-light);
}

.nav-subitem strong {
  margin-left: auto;
  min-width: 22px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.nav-subitem small {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}

.desktop-shell.sidebar-expanded .main-nav.standard .nav-item {
  width: auto;
  justify-content: flex-start;
  margin: 2px 0;
  margin-right: 16px;
  padding: 0 24px;
  border-radius: 0 999px 999px 0;
}

.desktop-shell.sidebar-expanded .main-nav.standard .nav-section {
  display: block;
  padding: 10px 28px 4px;
  letter-spacing: 0.8px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-4);
}

.nav-theme-row {
  display: none;
}

.desktop-shell.sidebar-expanded .nav-theme-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  margin-right: 16px;
  padding: 0 24px;
  border-radius: 0 999px 999px 0;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.desktop-shell.sidebar-expanded .nav-theme-row i {
  width: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 18px;
}

.nav-profile-card {
  display: none;
}

.desktop-shell.sidebar-expanded .nav-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 12px 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.main-nav.standard .nav-spacer {
  margin-top: auto;
}

.desktop-shell.sidebar-expanded .nav-profile-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.desktop-shell.sidebar-expanded .nav-profile-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
}

.desktop-shell.sidebar-expanded .nav-profile-meta span {
  color: var(--text-3);
  font-size: 12px;
}

.conversation-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.dashboard-panel {
  min-width: 0;
  min-height: 0;
  height: calc(var(--desktop-app-viewport-height) - var(--desktop-app-topbar-height));
  overflow-y: auto;
}

.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 24px 40px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  font-weight: 400;
}

.page-heading span {
  display: inline-block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-button.primary {
  background: var(--blue);
  color: #ffffff;
}

.action-button.primary i,
.action-button.primary span {
  color: #ffffff;
}

.action-button.secondary {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.action-button.secondary i,
.action-button.secondary span {
  color: var(--blue-dark);
}

.action-button.primary:hover,
.action-button.primary:focus-visible {
  background: var(--blue-dark);
  color: #ffffff;
}

.action-button.secondary:hover,
.action-button.secondary:focus-visible {
  background: #dbe8fd;
  color: var(--blue-dark);
}

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

.dashboard-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.conversation-board {
  overflow: visible;
}

.conversation-board-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 6;
  overflow: visible;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--blue-light);
  background: var(--blue-light);
  color: var(--blue-dark);
}

.filter-chip-icon {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 15px;
}

.filter-badge {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e53935;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.conversation-table {
  display: flex;
  flex-direction: column;
}

.conversation-table-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 64px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  position: relative;
}

.conversation-table-row:first-child {
  border-top: 0;
}

.conversation-table-row.high-priority::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 48px;
  border-radius: 999px;
  background: var(--red);
}

.conversation-table-row > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conversation-table-row strong,
.conversation-table-row small,
.conversation-table-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-table-row strong {
  color: var(--text);
  font-size: 14px;
}

.conversation-table-row small,
.conversation-table-row em,
.conversation-table-row time {
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}

.conversation-table-row em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.loading-state,
.empty-state {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px;
  color: var(--text-3);
  text-align: center;
}

.empty-state i {
  color: var(--blue);
  font-size: 28px;
}

.empty-state strong {
  color: var(--text);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.metric-summary {
  min-height: 130px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
}

.summary-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 28px;
}

.summary-icon i {
  font-size: 28px !important;
  line-height: 1;
}

.metric-blue .summary-icon {
  background: var(--blue-light);
  color: var(--blue);
}

.summary-icon.metric-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.metric-red .summary-icon {
  background: var(--red-light);
  color: var(--red);
}

.summary-icon.metric-red {
  background: var(--red-light);
  color: var(--red);
}

.metric-green .summary-icon {
  background: var(--green-light);
  color: var(--green);
}

.summary-icon.metric-green {
  background: var(--green-light);
  color: var(--green);
}

.metric-yellow .summary-icon {
  background: var(--yellow-light);
  color: #b06000;
}

.summary-icon.metric-yellow {
  background: var(--yellow-light);
  color: #b06000;
}

.metric-summary div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metric-summary span,
.metric-summary small {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.metric-summary strong {
  color: var(--text);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.dashboard-main,
.dashboard-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
}

.card-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.segmented-control button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow);
}

.desktop-chart {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 14px;
  padding: 12px 22px 0;
}

.chart-bar {
  min-height: 32px;
  border-radius: var(--radius) var(--radius) 3px 3px;
  background: var(--blue);
}

.bar-30 {
  height: 30%;
}

.bar-45 {
  height: 45%;
}

.bar-25 {
  height: 25%;
}

.bar-60 {
  height: 60%;
}

.bar-85 {
  height: 85%;
}

.bar-70 {
  height: 70%;
}

.bar-100 {
  height: 100%;
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
  padding: 8px 22px 18px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.desktop-table-wrap {
  overflow-x: auto;
}

.desktop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.desktop-table th {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.desktop-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

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

.desktop-table a {
  color: var(--blue);
  font-weight: 700;
}

/* ── BADGE BASE — padrão único para todos os badges do sistema ── */
.status-pill,
.small-badge,
.badge,
.wa-line-badge,
.row-tag,
.op-status-badge,
.op-role-badge,
.pill,
.integration-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 72px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
  gap: 5px;
}

.status-pill.blue {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.status-pill.red {
  background: var(--red-light);
  color: #c5221f;
}

.status-pill.green {
  background: var(--green-light);
  color: #188038;
}

.status-pill.yellow {
  background: var(--yellow-light);
  color: #b06000;
}

.small-badge {
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
}

.queue-item {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  position: relative;
}

.queue-item.high-priority::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 44px;
  border-radius: 999px;
  background: var(--red);
}

.queue-item span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item strong,
.queue-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item strong {
  color: var(--text);
  font-size: 14px;
}

.queue-item small,
.queue-item time,
.notice-item small {
  color: var(--text-3);
  font-size: 12px;
}

.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.notice-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.notice-icon.blue {
  background: var(--blue-light);
  color: var(--blue);
}

.notice-icon.green {
  background: var(--green-light);
  color: var(--green);
}

.notice-item div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notice-item strong {
  color: var(--text);
  font-size: 14px;
}

.muted-icon {
  color: var(--text-3);
}

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

.panel-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
}

.panel-header p,
.chat-person small,
.conversation-copy small,
.conversation-meta time {
  color: var(--text-3);
  font-size: 12px;
}

.panel-header p {
  margin: 2px 0 0;
}

.conversation-search {
  height: 42px;
  margin: 14px;
  padding: 0 13px;
  border-radius: var(--radius);
}

.conversation-item {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.conversation-item.active {
  background: var(--blue-light);
}

.conversation-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conversation-copy strong,
.conversation-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-copy strong,
.chat-person strong {
  color: var(--text);
  font-size: 14px;
}

.conversation-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.count-badge {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

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

.desktop-modal {
  width: min(100%, 520px);
  max-height: calc(var(--desktop-app-safe-height) - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}

.desktop-modal.company-settings-modal {
  width: min(100%, 980px);
}

.company-settings-body {
  padding-top: 16px;
}

.company-settings-form {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  gap: 14px;
}

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

.modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
}

.modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.desktop-modal .dropdown-menu {
  position: static;
  margin-top: 6px;
  box-shadow: none;
}

.desktop-modal .dropdown-results {
  max-height: min(190px, 28svh);
}

.form-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: 0;
  padding: 12px;
  background: var(--bg-soft);
  color: var(--text-3);
}

.form-field textarea:focus {
  border-color: var(--blue);
  background: var(--surface);
}

.dropdown-select {
  position: relative;
  display: block;
}

[data-search-select] {
  position: relative;
}

.dropdown-select.open,
[data-search-select].open {
  z-index: 4300;
}

.dropdown-trigger {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-3);
  text-align: left;
  cursor: pointer;
}
.dropdown-leading-icon {
  width: 14px;
  color: var(--text-3);
  text-align: center;
  flex-shrink: 0;
}
.dropdown-trigger-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-trigger:focus-visible,
.dropdown-select.open .dropdown-trigger {
  border-color: var(--blue);
  background: var(--surface);
  outline: none;
}

.dropdown-trigger:disabled,
fieldset:disabled .dropdown-trigger {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.dropdown-trigger .dropdown-caret {
  color: var(--text-3);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.dropdown-select.open .dropdown-trigger .dropdown-caret {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 4310;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(60, 64, 67, 0.18);
}

[data-dropdown-menu] {
  z-index: 4310;
}

.dropdown-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  padding-top: 4px;
}

.dropdown-results::-webkit-scrollbar {
  width: 8px;
}

.dropdown-results::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--border);
}

.dropdown-option {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-3);
  text-align: left;
  cursor: pointer;
}

.dropdown-option:hover,
.dropdown-option:focus-visible,
.dropdown-option.active {
  background: var(--blue-light);
  color: var(--blue-dark);
  outline: none;
}

.dropdown-empty {
  padding: 10px 11px;
  color: var(--text-3);
  font-size: 13px;
}

.module-board {
  overflow: visible;
}

.module-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 6;
  overflow: visible;
}

.module-search {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-3);
}

.module-search:focus-within {
  border-color: var(--blue);
  background: var(--surface);
}

.module-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.module-list {
  display: flex;
  flex-direction: column;
}

.module-row {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.module-row:first-child {
  border-top: 0;
}

.module-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-row-main strong,
.module-row-main small,
.module-row-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-row-main strong {
  color: var(--text);
  font-size: 14px;
}

.module-row-main small,
.module-row-main em {
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}

.module-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

.module-tile {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.module-tile .person-avatar {
  margin-bottom: 10px;
}

.module-tile h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.module-tile p {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.45;
}

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

.settings-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-panel h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}

.settings-panel .form-field + .form-field {
  margin-top: 12px;
}

.settings-panel .action-button {
  margin-top: 12px;
}

.settings-ai-page {
  width: 100%;
  max-width: none;
}

.settings-ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
}

.settings-ai-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-ai-card {
  min-height: min(560px, calc(var(--desktop-app-safe-height) - 140px));
}

.settings-ai-form .form-field {
  flex: 1;
  min-height: 0;
}

.settings-ai-form textarea {
  flex: 1;
  height: 100%;
  min-height: min(520px, calc(var(--desktop-app-safe-height) - 300px));
  line-height: 1.5;
}

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

.settings-ai-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
}

.settings-ai-rules p {
  margin: 0 0 4px;
  color: var(--text-3);
  line-height: 1.4;
}

.settings-ai-rules span {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.settings-ai-rules i {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  font-size: 10px;
}

.settings-ai-rules strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.settings-ai-rules small {
  grid-column: 2;
  margin-top: -6px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
}

.integration-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px 32px;
}

.integration-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.integration-topbar h1 {
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.2;
}

.integration-topbar small {
  display: block;
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.35;
}

.integration-help {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.integration-help i {
  color: var(--blue);
  font-size: 18px;
}

.integration-help strong {
  color: var(--text);
  font-size: 14px;
}

.integration-help p {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

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

.form-list-grid {
  align-items: stretch;
}

.form-list-grid #op-form-card,
.form-list-grid #team-form-card,
.form-list-grid #template-form-card,
.form-list-grid #company-form-card,
.form-list-grid #customer-company-form-card {
  height: auto;
  align-self: start;
}

.integration-list-card {
  min-height: 0;
  height: 100%;
  overflow: visible;
}

.integration-list-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.integration-list-body::-webkit-scrollbar {
  width: 6px;
}

.integration-list-body::-webkit-scrollbar-track {
  background: transparent;
}

.integration-list-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

.integration-list-body::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.integration-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.integration-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 6;
  overflow: visible;
}

.integration-card-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.integration-card-head p {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.integration-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
}

.integration-icon.green {
  background: var(--green-light);
  color: var(--green);
}

.integration-icon.blue {
  background: var(--blue-light);
  color: var(--blue);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.input-control {
  min-height: 46px;
}

.form-field textarea {
  min-height: 132px;
}

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

.integration-actions .action-button {
  width: auto;
  min-width: 0;
}

.company-logo-form {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.company-logo-preview {
  width: 128px;
  height: 76px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

.company-logo-preview input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  cursor: pointer;
}

.company-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.company-logo-placeholder {
  color: var(--text-3);
  font-size: 20px;
}

.company-logo-camera {
  width: 30px;
  height: 30px;
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.28);
}

.company-logo-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-2);
  font-size: 13px;
}

.company-logo-copy > span {
  color: var(--text);
  font-weight: 700;
}

.company-logo-copy > small {
  color: var(--text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-avatar {
  overflow: hidden;
}

.company-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  background: #fff;
}

.company-logo-form .action-button {
  align-self: center;
  min-width: 88px;
}

.profile-page {
  width: 100%;
  max-width: none;
}

.profile-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.profile-card {
  height: 100%;
  max-width: none;
}

.profile-form,
.profile-agenda-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-avatar-block {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-picker {
  width: 112px;
  height: 112px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
}

.profile-avatar-picker input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  cursor: pointer;
}

.profile-avatar-picker img,
.profile-avatar-placeholder {
  width: 100%;
  height: 100%;
}

.profile-avatar-picker img {
  object-fit: cover;
}

.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

.profile-avatar-camera {
  width: 34px;
  height: 34px;
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 2px 7px rgba(26, 115, 232, 0.28);
}

.profile-avatar-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.profile-avatar-copy strong {
  max-width: 100%;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar-copy small {
  color: var(--text-3);
  font-size: 13px;
}

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

.profile-security-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.profile-security-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-security-head > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-security-head strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
}

.profile-security-head small {
  color: var(--text-3);
  font-size: 13px;
}

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

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

.profile-agenda-card {
  height: 100%;
  min-height: 0;
}

.profile-agenda-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.profile-agenda-tab {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.profile-agenda-tab.active {
  border-color: var(--blue-light);
  background: var(--blue-light);
  color: var(--blue-dark);
}

.profile-agenda-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-agenda-form {
  min-height: 0;
}

.profile-agenda-time-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 12px;
}

.profile-agenda-reminder-dropdown .dropdown-trigger {
  min-height: 46px;
}

.profile-agenda-user-dropdown .dropdown-trigger {
  min-height: 46px;
}

.profile-agenda-reminder-dropdown .dropdown-menu {
  max-height: 216px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.profile-agenda-user-dropdown .dropdown-menu {
  max-height: 216px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.profile-agenda-reminder-dropdown .dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.profile-agenda-user-dropdown .dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.profile-agenda-reminder-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.profile-agenda-user-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.profile-agenda-form .action-button {
  align-self: flex-start;
}

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

.profile-agenda-search {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text-3);
}

.profile-agenda-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.profile-agenda-list {
  flex: 1;
  min-height: 0;
  max-height: min(430px, calc(var(--desktop-app-safe-height) - 390px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.profile-agenda-list::-webkit-scrollbar {
  width: 6px;
}

.profile-agenda-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.profile-agenda-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 82px;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.profile-agenda-item:last-child {
  border-bottom: 0;
}

.profile-agenda-date {
  width: 54px;
  height: 54px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
}

.profile-agenda-date strong {
  font-size: 14px;
  line-height: 1.1;
}

.profile-agenda-date span {
  margin-top: 4px;
  font-size: 12px;
}

.profile-agenda-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-agenda-info strong,
.profile-agenda-info small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-agenda-info strong {
  color: var(--text);
  font-size: 14px;
}

.profile-agenda-info small {
  color: var(--text-3);
  font-size: 12px;
}

.profile-agenda-status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}

.profile-agenda-status.sent {
  background: var(--green-light);
  color: var(--green);
}

.profile-agenda-status.sending {
  background: var(--blue-light);
  color: var(--blue);
}

.profile-agenda-status.failed {
  background: var(--red-light);
  color: var(--red);
}

.profile-agenda-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.profile-agenda-row-actions form {
  display: inline-flex;
  margin: 0;
}

.profile-agenda-row-actions .wa-line-set-btn,
.profile-agenda-row-actions .wa-session-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
}

.profile-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(32, 33, 36, 0.48);
}

.profile-crop-dialog {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.28);
}

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

.profile-crop-head span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-crop-head strong {
  color: var(--text);
  font-size: 17px;
}

.profile-crop-head small {
  color: var(--text-3);
  font-size: 12px;
}

.profile-crop-stage {
  width: min(100%, 300px);
  aspect-ratio: 1;
  position: relative;
  align-self: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg-soft);
  cursor: grab;
  touch-action: none;
  box-shadow: inset 0 0 0 2px var(--blue);
}

.profile-crop-stage:active {
  cursor: grabbing;
}

.profile-crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.profile-crop-zoom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
}

.profile-crop-zoom input {
  width: 100%;
  accent-color: var(--blue);
}

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

@media (max-width: 760px) {
  .company-logo-form {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .company-logo-form .action-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .profile-page {
    max-width: none;
  }

  .profile-card {
    height: auto;
    max-width: none;
  }

  .profile-agenda-card {
    height: auto;
  }

  .profile-layout,
  .profile-avatar-block,
  .profile-fields-grid,
  .profile-security-grid,
  .profile-agenda-time-grid {
    grid-template-columns: 1fr;
  }

  .profile-avatar-block {
    justify-items: center;
    text-align: center;
  }

  .profile-avatar-copy {
    align-items: center;
  }

  .profile-actions .action-button {
    flex: 1 1 140px;
  }

  .profile-agenda-tabs {
    width: 100%;
  }

  .profile-agenda-tab {
    flex: 1 1 0;
  }

  .profile-agenda-actions .action-button {
    flex: 1 1 140px;
  }

  .profile-agenda-item {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .profile-agenda-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .profile-crop-actions .action-button {
    flex: 1 1 120px;
  }
}

.integration-pill.connected { background: var(--green-light); color: #188038; }
.integration-pill i { font-size: 8px; }

.integration-connection {
  margin-top: 12px;
  padding: 20px;
  border: 1px solid #d8e9df;
  border-radius: 10px;
  background: #eef6f1;
  text-align: center;
}

.integration-connection h3 {
  margin: 10px 0 8px;
  color: #1f5133;
  font-size: 18px;
}

.integration-connection i {
  font-size: 34px;
  color: #1f9d5f;
}

.integration-connection p {
  max-width: 360px;
  margin: 0 auto;
  color: #2f5f42;
  font-size: 14px;
  line-height: 1.45;
}

.integration-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #d8e3f8;
  border-radius: var(--radius);
  background: #edf3ff;
  color: #365478;
  font-size: 13px;
  line-height: 1.45;
}

.integration-tip i {
  margin-top: 1px;
  color: var(--blue);
}

.integration-footer-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #d8e3f8;
  border-radius: 10px;
  background: #edf3ff;
}

.integration-footer-note strong {
  color: #1d4ed8;
  font-size: 14px;
}

.integration-footer-note p {
  margin: 3px 0 0;
  color: #5f78a4;
  font-size: 13px;
}

.integration-footer-note i {
  color: var(--blue);
}

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

.integration-line-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.integration-line-row span {
  color: var(--text-2);
  font-size: 13px;
}

[data-wa-connection-state="open"] {
  color: #188038;
}

[data-wa-connection-state="qr_ready"] {
  color: var(--blue);
}

[data-wa-connection-state="disconnected"] {
  color: #c5221f;
}

.integration-alert {
  margin: 0;
  padding: 11px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.integration-alert.error {
  background: var(--red-light);
  color: #c5221f;
}

.integration-alert.success {
  background: var(--green-light);
  color: #188038;
}

.integration-alert.warning {
  background: #fff7df;
  color: #8a5a00;
  border: 1px solid #f6d78a;
}

.integration-mini-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.integration-mini-button.primary {
  background: var(--blue-light);
  border-color: var(--blue-light);
  color: var(--blue-dark);
}

.integration-qr-panel {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(32, 33, 36, 0.48);
}

.integration-qr-dialog {
  width: min(100%, 390px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.integration-qr-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.integration-qr-head span:last-of-type {
  min-width: 0;
}

.integration-qr-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.integration-qr-head p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-qr-content {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 24px 26px 28px;
  background: var(--bg-soft);
}
.wa-qr-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: color .15s, border-color .15s;
}
.wa-qr-close:hover { color: var(--red); border-color: var(--red); }

.integration-qr-image {
  width: min(100%, 260px);
  display: none;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 4px 18px rgba(60, 64, 67, 0.14);
}

.integration-qr-image.visible {
  display: block;
}

.integration-qr-placeholder {
  max-width: 280px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.45;
}

.integration-qr-placeholder strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.integration-code {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.public-chat-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  background: var(--bg);
}

.public-chat-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 56px;
}

.public-chat-hero h1 {
  max-width: 620px;
  margin: 0;
  color: var(--text);
  font-size: 38px;
  font-weight: 300;
}

.public-chat-hero p {
  max-width: 560px;
  margin: 0;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1.55;
}

.public-chat-card {
  align-self: center;
  width: min(100%, 420px);
  margin-right: 48px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.public-chat-card h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 400;
}

.public-chat-card p {
  margin: 0 0 18px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
}

.public-chat-card .message-area {
  max-height: 260px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.public-chat-card .composer {
  padding: 0;
  border-top: 0;
  background: transparent;
}

.public-webchat-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(260px, 0.52fr) auto minmax(40px, 0.2fr);
  justify-items: center;
  background: var(--bg-soft);
}

.public-webchat-brand {
  align-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px 36px;
  text-align: center;
}

.public-webchat-brand .login-logo {
  margin-bottom: 0;
}

.public-webchat-brand p {
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
}

.public-webchat-card {
  width: min(100% - 48px, 560px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 26px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.public-webchat-card h1 {
  margin: 6px 0 8px;
  color: var(--text);
  font-size: 26px;
  font-weight: 400;
}

.public-webchat-card > p:not(.eyebrow) {
  margin: 0 0 18px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
}

.public-webchat-card .login-form {
  gap: 0;
}

.public-webchat-card .message-area {
  height: min(42vh, 360px);
  min-height: 260px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
}

.public-webchat-card .composer {
  padding: 12px 0 0;
  border-top: 0;
  background: transparent;
}

.public-webchat-card .message.outgoing {
  margin-right: 4px;
}

.public-webchat .login-card {
  max-width: 390px;
}

.public-webchat.is-chatting {
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

.public-webchat.is-chatting .login-logo,
.public-webchat.is-chatting .login-tagline,
.public-webchat.is-chatting .login-footer {
  display: none;
}

.public-webchat.is-chatting .login-right {
  width: 480px;
  height: 100svh;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: var(--surface);
}

.public-webchat.is-chatting .public-chat-session {
  width: 100%;
  max-width: none;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.public-chat-copy {
  margin: -12px 0 22px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
}

.public-chat-session-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.public-chat-session-head .login-title {
  margin-bottom: 4px;
}

.public-chat-session-head p {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
}

.public-webchat-session-header {
  min-height: 72px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  justify-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.public-webchat-session-header .brand {
  grid-column: 2;
}

.public-webchat-session-header .icon-button {
  grid-column: 3;
}

.public-webchat-session-header .brand span {
  font-size: 24px;
  white-space: nowrap;
}

.public-webchat-chat-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
}

.public-chat-session .message-area {
  max-height: none;
  min-height: 0;
  height: auto;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
}

.public-chat-session .composer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.attachment-picker {
  position: relative;
  flex: 0 0 auto;
}

.emoji-picker {
  position: relative;
  flex: 0 0 auto;
}

.composer .emoji-panel,
.public-chat-session .emoji-panel {
  left: 0;
  bottom: calc(100% + 8px);
  width: 392px;
  max-width: min(92vw, 392px);
  border-radius: 8px;
}

.composer .emoji-grid,
.public-chat-session .emoji-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.emoji-picker .icon-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.attachment-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.attachment-menu button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.attachment-menu button:hover,
.attachment-menu button:focus-visible {
  background: var(--blue-light);
  color: var(--blue-dark);
  outline: none;
}

.saved-sticker-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 24;
  width: 304px;
  max-width: min(88vw, 304px);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.saved-sticker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
}

.saved-sticker-head button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-3);
}

.saved-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 2px;
}

.saved-sticker-item {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
}

.saved-sticker-item:hover,
.saved-sticker-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.saved-sticker-item img {
  max-width: 82%;
  max-height: 82%;
  object-fit: contain;
}

.saved-sticker-empty {
  grid-column: 1 / -1;
  padding: 12px 4px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.attachment-message {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.chat-person,
.chat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-person div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.message-area {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 24px;
}

.day-divider {
  align-self: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 12px;
}

.conversation-history-block {
  width: min(100%, 720px);
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.conversation-history-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

.conversation-history-toggle small {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}

.conversation-history-toggle:hover,
.conversation-history-toggle:focus-visible {
  border-color: var(--blue);
  background: var(--blue-light);
  outline: none;
}

.conversation-history-caret {
  font-size: 11px;
  transition: transform 0.18s ease;
}

.conversation-history-toggle[aria-expanded="true"] .conversation-history-caret {
  transform: rotate(180deg);
}

.conversation-history-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.7);
}

.message {
  position: relative;
  max-width: min(72%, 640px);
  padding: 10px 12px 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.message time,
.message span {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 11px;
}

.message.incoming {
  align-self: flex-start;
  background: var(--surface);
}

.message.outgoing {
  align-self: flex-end;
  background: #dcf8c6;
  color: #1f2c34;
}

html[data-dark] .message.outgoing {
  background: #005c4b;
  color: #e9edef;
}

html[data-dark] .message.outgoing span {
  color: rgba(233, 237, 239, 0.72);
}

.message-reply-button,
.msg-transcribe-btn {
  position: absolute;
  top: 50%;
  right: -36px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.18s ease, color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  z-index: 2;
}

.msg-transcribe-btn {
  right: -72px;
}

.message.outgoing .message-reply-button {
  right: auto;
  left: -36px;
}

.message.outgoing .msg-transcribe-btn {
  right: auto;
  left: -72px;
}

.message:hover .message-reply-button,
.message:hover .msg-transcribe-btn,
.message:focus-within .message-reply-button,
.message:focus-within .msg-transcribe-btn,
.message-reply-button:focus-visible,
.msg-transcribe-btn:focus-visible {
  opacity: 1;
}

.message-reply-button:hover,
.message-reply-button:focus-visible,
.msg-transcribe-btn:hover,
.msg-transcribe-btn:focus-visible {
  border-color: rgba(26, 115, 232, 0.32);
  background: var(--blue-light);
  color: var(--blue);
  outline: none;
}

.msg-reply-quote {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: rgba(26, 115, 232, 0.08);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.msg-reply-quote strong {
  max-width: 100%;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-reply-quote span {
  max-width: 100%;
  display: block;
  margin: 0;
  color: inherit;
  font-size: 12px;
  line-height: 1.3;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.outgoing .msg-reply-quote {
  background: rgba(255, 255, 255, 0.42);
  border-left-color: #1a7f5a;
}

html[data-dark] .message.outgoing .msg-reply-quote {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: #7dd3a7;
}

.message-highlight {
  animation: messageReplyHighlight 1.1s ease;
}

.composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.composer-reply-preview {
  --reply-preview-side-space: 56px;
  box-sizing: border-box;
  flex: 0 0 calc(100% - (var(--reply-preview-side-space) * 2));
  width: calc(100% - (var(--reply-preview-side-space) * 2));
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 var(--reply-preview-side-space);
  padding: 8px 12px;
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: var(--blue-light);
  color: var(--text);
}

.composer-reply-preview.hidden {
  display: none !important;
}

.composer-reply-preview > i {
  color: var(--blue);
}

.composer-reply-preview span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-reply-preview strong {
  color: var(--blue-dark);
  font-size: 12px;
  line-height: 1.25;
}

.composer-reply-preview em {
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-reply-preview button {
  justify-self: end;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.composer-reply-preview button:hover,
.composer-reply-preview button:focus-visible {
  border-color: rgba(26, 115, 232, 0.22);
  background: #ffffff;
  color: var(--blue-dark);
  outline: none;
}

.composer-reply-preview button i {
  display: block;
  font-size: 13px;
  line-height: 1;
}

.public-chat-session .composer-reply-preview,
.public-webchat-chat-form .composer-reply-preview {
  --reply-preview-side-space: 0px;
  flex-basis: 100%;
  width: 100%;
  margin: 0;
}

.composer-input {
  flex: 1;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  align-self: flex-end;
}

.composer-submit {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
}

.composer-submit:hover,
.composer-submit:focus-visible {
  background: var(--blue-dark);
  outline: none;
}

.composer-submit.is-recording {
  background: #e53935;
  animation: recPulse 1s ease-in-out infinite;
}

.message p a {
  color: inherit;
  text-decoration: underline;
  word-break: break-all;
}
.message.outgoing p a { opacity: 0.9; }

.msg-wa-error {
  display: inline-flex;
  align-items: center;
  color: #f59e0b;
  font-size: 0.75rem;
  margin-right: 4px;
  cursor: default;
}

@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); }
}

@keyframes messageReplyHighlight {
  0%, 100% { box-shadow: var(--shadow); }
  35% { box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.24), var(--shadow); }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 68px 320px minmax(0, 1fr);
  }

  .desktop-shell.sidebar-expanded .workspace {
    grid-template-columns: 220px 320px minmax(0, 1fr);
  }

  .dashboard-workspace {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .desktop-shell.sidebar-expanded .dashboard-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

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

  .desktop-auth {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    display: none;
  }

  .conversation-board-toolbar {
    grid-template-columns: 1fr;
  }

  .module-toolbar,
  .settings-grid,
  .settings-ai-layout,
  .public-chat-page {
    grid-template-columns: 1fr;
  }

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

  .form-list-grid .integration-card {
    min-height: auto;
  }

  .integration-list-card {
    height: auto;
    overflow: visible;
  }

  .integration-list-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .integration-topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .public-chat-card {
    margin: 0 24px 40px;
  }
}

/* ── WHATSAPP LINES BLOCK ── */
.wa-lines-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 196px;
  overflow-y: auto;
}

.wa-lines-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.wa-line-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .15s;
}

.wa-line-item.is-primary {
  border-color: var(--green);
  background: var(--green-light);
}

/* ── Service bar ── */
.wa-service-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.wa-service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
}
.wa-service-dot.running {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
.wa-service-dot.stopped {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}
.wa-service-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
}
.wa-service-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--button-gap);
  min-height: var(--button-height);
  min-width: 126px;
  padding: 0 var(--button-padding-x);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.wa-service-btn:disabled { opacity: .5; cursor: not-allowed; }
.wa-service-btn.start { background: #22c55e; color: #fff; }
.wa-service-btn.stop  { background: #ef4444; color: #fff; }
.wa-service-btn.hidden { display: none; }
.wa-service-btn i,
.wa-service-btn span { color: inherit; line-height: 1; }
.wa-service-btn:hover { opacity: .9; }
html[data-dark] .wa-service-bar { background: var(--bg-2); border-color: var(--border); }

.wa-form-submit {
  width: auto;
  justify-self: start;
  align-self: start;
}

.wa-line-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
  transition: background .3s;
}

.wa-line-dot.connected {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,168,83,.15);
}

.wa-line-dot.connecting {
  background: var(--blue);
  animation: wa-pulse 1.2s ease-in-out infinite;
}
@keyframes wa-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}
.wa-line-dot.qr {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}

/* ── MULTI-SESSION CARD ── */
.wa-session-list {
  --wa-line-card-height: 56px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-height: calc((var(--wa-line-card-height) * 2) + 10px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.wa-session-list::-webkit-scrollbar {
  width: 6px;
}

.wa-session-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.wa-session-list .wa-line-empty {
  padding: 2px 0 0;
}

.wa-session-card {
  min-height: var(--wa-line-card-height);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.wa-session-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.wa-session-actions form,
.wa-session-actions [data-line-action] {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.wa-session-actions .wa-line-badge,
.wa-session-actions .wa-line-set-btn,
.wa-session-actions .wa-session-btn:not(.delete) {
  height: 30px;
  min-width: 116px;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.wa-session-actions .wa-line-set-btn {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}

.wa-session-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 0 12px;
  height: 28px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}

.wa-session-btn:hover { opacity: .8; }
.wa-session-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.wa-session-btn.connect {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.wa-session-btn.disconnect {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.wa-session-btn.delete {
  background: transparent;
  color: var(--text-3);
  border-color: var(--border);
  padding: 0 9px;
}
.wa-session-btn.delete:hover {
  color: var(--red);
  border-color: var(--red);
}

html[data-dark] .wa-session-card {
  background: var(--surface);
}

.wa-line-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.wa-line-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-line-phone {
  font-size: 12px;
  color: var(--text-3);
}

.wa-line-badge {
  color: var(--green);
  background: var(--green-light);
  border: 1px solid var(--green);
}

.wa-line-set-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0 12px;
  height: 28px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
  display: inline-flex;
  align-items: center;
}

.wa-line-set-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.wa-line-empty {
  font-size: 13px;
  color: var(--text-3);
  padding: 6px 0;
}

html[data-dark] .wa-lines-block {
  background: var(--bg);
}

html[data-dark] .wa-line-item {
  background: var(--surface);
}

html[data-dark] .wa-line-item.is-primary {
  background: rgba(52,168,83,.08);
}

/* ════════════════════════════════════════
   LAYOUT PROTÓTIPO — sidebar fixa + body-wrap
   ════════════════════════════════════════ */

body[data-desktop-app="1"] {
  display: flex;
  flex-direction: column;
  width: var(--desktop-app-viewport-width);
  min-height: var(--desktop-app-viewport-height);
  height: var(--desktop-app-viewport-height);
  overflow: hidden;
  padding-top: var(--desktop-app-topbar-height);
  transform: scale(var(--desktop-app-scale));
  transform-origin: top left;
}

/* ── BODY WRAP ── */
.body-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: var(--desktop-app-topbar-height);
  left: 0;
  width: 68px;
  height: calc(var(--desktop-app-viewport-height) - var(--desktop-app-topbar-height));
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  transition: width 0.2s ease;
  z-index: 50;
  border-right: 1px solid var(--border);
}

.sidebar.expanded {
  width: 256px;
}

.sidebar-spacer {
  width: 68px;
  flex-shrink: 0;
  transition: width 0.2s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* ── NAV ITEMS (scoped to .sidebar) ── */
.sidebar .nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 40px;
  padding: 0;
  margin: 2px auto;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
}

.sidebar .nav-item:hover { background: var(--bg-soft); }

.sidebar .nav-item.active {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-weight: 700;
}

.sidebar .nav-item.active i { color: var(--blue); }

.sidebar .nav-item i {
  font-size: 18px;
  color: var(--text-3);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Collapsed: textos ocultos */
.sidebar .nav-item-label,
.sidebar .nav-group-arrow,
.sidebar .nav-badge { display: none; }

.sidebar .nav-section-label,
.sidebar .nav-divider { display: none; }

.sidebar .nav-sub { display: none; }

/* Expanded: textos visíveis + layout de lista */
.sidebar.expanded .nav-item {
  padding: 0 24px;
  margin: 2px 0;
  margin-right: 16px;
  border-radius: 0 999px 999px 0;
  width: auto;
  height: 40px;
  justify-content: flex-start;
}

.sidebar.expanded .nav-item-label,
.sidebar.expanded .nav-group-arrow,
.sidebar.expanded .nav-badge { display: inline; }

.sidebar.expanded .nav-section-label { display: block; }
.sidebar.expanded .nav-divider { display: block; }
.sidebar.expanded .nav-sub { display: block; }

/* Seta do grupo */
.sidebar .nav-group-arrow {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  transition: transform 0.2s;
}

.sidebar .nav-item.open .nav-group-arrow { transform: rotate(180deg); }

/* Sub-menu */
.sidebar .nav-sub {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.sidebar .nav-sub.open { max-height: 300px; }

.sidebar .nav-sub-item {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 24px 0 56px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 0 999px 999px 0;
  margin-right: 16px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.sidebar .nav-sub-item:hover { background: var(--bg-soft); color: var(--text); }

.sidebar .nav-sub-item.active {
  color: var(--blue-dark);
  font-weight: 600;
  background: var(--blue-light);
}

.nav-collapsed-dropdown {
  position: fixed;
  z-index: 260;
  min-width: 220px;
  max-width: 280px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(60, 64, 67, 0.22);
}

.nav-collapsed-dropdown-title {
  padding: 6px 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.nav-collapsed-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-collapsed-dropdown-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav-collapsed-dropdown-item:hover,
.nav-collapsed-dropdown-item:focus-visible {
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
}

.nav-collapsed-dropdown-item.active {
  color: var(--blue-dark);
  background: var(--blue-light);
  font-weight: 600;
}

.nav-collapsed-dropdown-item i {
  width: 16px;
  text-align: center;
}

.nav-collapsed-dropdown-item strong {
  font-weight: 500;
}

.nav-collapsed-dropdown-item > span {
  margin-left: auto;
}

/* Divider e section label */
.sidebar .nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.sidebar .nav-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 28px 4px;
}

/* Perfil no rodapé */
.sidebar-user {
  margin-top: auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-radius: var(--radius);
  margin: 8px;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar.expanded .sidebar-user { justify-content: flex-start; }
.sidebar-user:hover { background: var(--bg-soft); }
.sidebar-user:focus-visible {
  background: var(--bg-soft);
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-light);
}

.user-av {
  width: 36px;
  height: 36px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
}

.user-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-av-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-name,
.user-role { display: none; }

.sidebar.expanded .user-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.sidebar.expanded .user-role {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

/* ── CONTENT ── */
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.2px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── BUTTONS (protótipo) ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 36px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  letter-spacing: 0.25px;
}

.btn-filled { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btn-filled:hover { background: var(--blue-dark); }
.btn-outlined { background: transparent; color: var(--blue); border: 1px solid var(--border); }
.btn-outlined:hover { background: var(--blue-light); }
.btn-text { background: transparent; color: var(--blue); padding: 0 12px; }
.btn-text:hover { background: var(--blue-light); }

/* ── CHIPS ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  transition: background 0.15s;
}

.chip:hover { background: var(--bg-soft); }
.chip.active { background: var(--blue-light); color: var(--blue-dark); border-color: var(--blue-light); }
.chips-row { display: flex; gap: 8px; padding: 0 20px 12px; flex-wrap: wrap; }

/* ── STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(60,64,67,.1), 0 1px 3px rgba(60,64,67,.1);
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: 0.3px; }
.stat-value { font-size: 28px; font-weight: 400; color: var(--text); line-height: 1.1; margin: 4px 0; }
.stat-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }

/* ── GRID MAIN ── */
.grid-main { display: grid; grid-template-columns: 1fr minmax(0, 300px); gap: 20px; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ── CARD ── */
.card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(60,64,67,.1), 0 1px 3px rgba(60,64,67,.1);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}

.card-title { font-size: 16px; font-weight: 500; color: var(--text); }

.card-footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  text-align: center;
}

.card-footer a {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-footer a:hover { text-decoration: underline; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrap th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.table-wrap td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: var(--bg-soft); }

.td-link { color: var(--blue); font-weight: 500; cursor: pointer; }
.td-link:hover { text-decoration: underline; }

/* ── PILLS ── */
.pill { /* base já herdado */ }

.pill-blue   { background: var(--blue-light);   color: #1557B0; }
.pill-green  { background: var(--green-light);  color: #188038; }
.pill-red    { background: var(--red-light);    color: #C5221F; }
.pill-yellow { background: var(--yellow-light); color: #B06000; }

/* ── ACTIONS GRID ── */
.actions-grid { display: flex; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }

/* ── BADGE ── */
.badge {
  background: var(--blue);
  color: #fff;
}

/* ── CHAT ITEMS (cards do dashboard) ── */
.chat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.chat-item:hover { background: var(--bg-soft); }
.chat-item + .chat-item { border-top: 1px solid var(--border); }

.chat-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 14px; font-weight: 500; color: var(--text); }
.chat-preview { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chat-time { font-size: 12px; color: var(--text-3); }
.chat-dot { width: 8px; height: 8px; background: var(--blue); border-radius: 50%; }

/* ── NOTICE ITEMS (protótipo) ── */
.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
}

.notice-item:hover { background: var(--bg-soft); }
.notice-item + .notice-item { border-top: 1px solid var(--border); }

.notice-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.notice-info { flex: 1; min-width: 0; }
.notice-title { font-size: 14px; font-weight: 500; color: var(--text); }
.notice-body  { font-size: 13px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.notice-time  { font-size: 12px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }

/* ════════════════════════════════════════
   DARK MODE — novas classes
   ════════════════════════════════════════ */
html[data-dark] .sidebar { background: var(--surface); border-right-color: var(--border); }
html[data-dark] .sidebar .nav-item { color: var(--text-2); }
html[data-dark] .sidebar .nav-item i { color: var(--text-3); }
html[data-dark] .sidebar .nav-item:hover { background: var(--bg-soft); }
html[data-dark] .sidebar .nav-item.active { background: rgba(26,115,232,.2); color: #8AB4F8; }
html[data-dark] .sidebar .nav-item.active i { color: #8AB4F8; }
html[data-dark] .sidebar .nav-sub-item { color: var(--text-3); }
html[data-dark] .sidebar .nav-sub-item:hover { background: var(--bg-soft); color: var(--text); }
html[data-dark] .sidebar .nav-sub-item.active { color: #8AB4F8; background: rgba(26,115,232,.15); }
html[data-dark] .nav-collapsed-dropdown { background: var(--surface); border-color: var(--border); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
html[data-dark] .nav-collapsed-dropdown-title { color: var(--text-3); }
html[data-dark] .nav-collapsed-dropdown-item { color: var(--text-2); }
html[data-dark] .nav-collapsed-dropdown-item:hover { background: var(--bg-soft); color: var(--text); }
html[data-dark] .nav-collapsed-dropdown-item.active { color: #8AB4F8; background: rgba(26,115,232,.2); }
html[data-dark] .sidebar .nav-section-label { color: var(--text-4, #6B7280); }
html[data-dark] .sidebar .nav-divider { background: var(--border); }
html[data-dark] .sidebar-user:hover { background: var(--bg-soft); }
html[data-dark] .sidebar.expanded .user-name { color: var(--text); }
html[data-dark] .sidebar.expanded .user-role { color: var(--text-3); }
html[data-dark] .sidebar-overlay { background: rgba(0,0,0,.6); }

html[data-dark] .card,
html[data-dark] .stat-card { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
html[data-dark] .card-title { color: var(--text); }
html[data-dark] .card-footer { border-top-color: var(--border); }
html[data-dark] .page-title { color: var(--text); }
html[data-dark] .page-sub { color: var(--text-3); }
html[data-dark] .stat-label { color: var(--text-3); }
html[data-dark] .stat-value { color: var(--text); }

html[data-dark] .btn-filled { background: var(--blue); }
html[data-dark] .btn-outlined { color: #8AB4F8; border-color: var(--border); }
html[data-dark] .btn-outlined:hover { background: rgba(26,115,232,.15); }
html[data-dark] .btn-text { color: #8AB4F8; }
html[data-dark] .btn-text:hover { background: rgba(26,115,232,.15); }

html[data-dark] .chip { background: var(--bg-soft); border-color: var(--border); color: var(--text-2); }
html[data-dark] .chip:hover { background: #363B45; }
html[data-dark] .chip.active { background: rgba(26,115,232,.2); color: #8AB4F8; border-color: rgba(26,115,232,.3); }

html[data-dark] .table-wrap table { color: var(--text-2); }
html[data-dark] .table-wrap th { color: var(--text-3); border-bottom-color: var(--border); }
html[data-dark] .table-wrap td { border-bottom-color: var(--border); }
html[data-dark] .table-wrap tbody tr:hover td { background: var(--bg-soft); }
html[data-dark] .td-link { color: #8AB4F8; }

html[data-dark] .pill-blue   { background: rgba(26,115,232,.2);  color: #8AB4F8; }
html[data-dark] .pill-green  { background: rgba(52,168,83,.2);   color: #81C995; }
html[data-dark] .pill-red    { background: rgba(234,67,53,.2);   color: #F28B82; }
html[data-dark] .pill-yellow { background: rgba(251,188,4,.2);   color: #FDD663; }

html[data-dark] .chat-item:hover { background: var(--bg-soft); }
html[data-dark] .chat-item + .chat-item { border-top-color: var(--border); }
html[data-dark] .chat-name { color: var(--text); }
html[data-dark] .chat-preview,
html[data-dark] .chat-time { color: var(--text-3); }

html[data-dark] .notice-item:hover { background: var(--bg-soft); }
html[data-dark] .notice-item + .notice-item { border-top-color: var(--border); }
html[data-dark] .notice-title { color: var(--text); }
html[data-dark] .notice-body,
html[data-dark] .notice-time { color: var(--text-3); }

/* ════════════════════════════════════════
   MOBILE (≤ 768px) — protótipo
   ════════════════════════════════════════ */
@media (max-width: 768px) {
  .top-search { display: none; }
  .top-logo { flex: 1; }

  .sidebar {
    top: 0 !important;
    height: 100vh !important;
    width: 80% !important;
    max-width: 300px !important;
    border-right: none !important;
    transform: translateX(-100%);
    transition: transform 0.28s ease !important;
    z-index: 9999 !important;
  }

  .sidebar.expanded {
    transform: translateX(0) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3) !important;
  }

  .sidebar-spacer { display: none !important; }

  .sidebar-overlay {
    position: fixed;
    z-index: 9000 !important;
  }

  .sidebar-overlay.active { display: block; }

  /* No mobile, forçar estilos expandidos dentro do drawer */
  .sidebar .nav-item {
    padding: 0 24px !important;
    margin: 2px 0 !important;
    margin-right: 16px !important;
    border-radius: 0 999px 999px 0 !important;
    width: auto !important;
    height: 40px !important;
    justify-content: flex-start !important;
  }

  .sidebar .nav-item-label,
  .sidebar .nav-group-arrow,
  .sidebar .nav-badge { display: inline !important; }

  .sidebar .nav-section-label { display: block !important; }
  .sidebar .nav-divider { display: block !important; }
  .sidebar .nav-sub { display: block !important; }
  .sidebar-user { justify-content: flex-start !important; padding: 12px 16px !important; }
  .sidebar .user-name,
  .sidebar .user-role { display: block !important; }

  .body-wrap { width: 100%; }
  .content { width: 100%; padding: 16px; box-sizing: border-box; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-main { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  .table-wrap th:nth-child(5),
  .table-wrap td:nth-child(5),
  .table-wrap th:nth-child(6),
  .table-wrap td:nth-child(6) { display: none; }

  .table-wrap table { font-size: 13px; }
  .table-wrap th,
  .table-wrap td { padding: 10px; }

  .pill { white-space: nowrap; }
  .chips-row { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 420px) {
  .page-title { font-size: 18px; }
}

/* Desktop chat page (prototype + mobile list pattern) */
.content.chat-page {
  padding: 0 !important;
  gap: 0 !important;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.desktop-chat-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  background: var(--bg);
}

.desktop-chat-conversations {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.desktop-chat-search-wrap {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Desktop: Nova Conversa footer ──────────────────────────────── */
.chat-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-start-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-start-form .chat-country-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--border-1);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 0 28px 0 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.chat-start-form .chat-country-field select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.chat-country-label {
  font-size: 13px;
  color: var(--text-1);
  white-space: nowrap;
  pointer-events: none;
}

.chat-start-form .chat-country-field i {
  position: absolute;
  right: 8px;
  font-size: 10px;
  color: var(--text-3);
  pointer-events: none;
}

.chat-start-form .chat-phone-field {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border-1);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 0 12px;
  display: flex;
  align-items: center;
}

.chat-start-form .chat-phone-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text-1);
}

.chat-start-form .chat-phone-field input::placeholder {
  color: var(--text-3);
}

.chat-start-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.chat-start-button:hover { background: var(--blue-dark); }

.desktop-chat-search {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-3);
}

.desktop-chat-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.desktop-chat-filters {
  padding: 14px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.desktop-chat-filters .filter-chip {
  min-height: 34px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.desktop-chat-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 8px;
  padding-bottom: 8px;
}

.desktop-chat-row.conversation-table-row {
  min-height: 84px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 8px;
  border-top: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.desktop-chat-row.conversation-table-row:first-child {
  border-top: 0;
}

.desktop-chat-row:hover,
.desktop-chat-row:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.desktop-chat-row.active,
.desktop-chat-row.is-highlight {
  background: var(--blue-light);
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.desktop-chat-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  font-size: 16px;
}

.desktop-chat-avatar-neutral {
  color: var(--text-3);
}

.desktop-chat-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.desktop-chat-row-main strong,
.desktop-chat-row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-chat-row-main strong {
  color: var(--text);
  font-size: 15px;
}

.desktop-chat-row-main small {
  color: var(--text-3);
  font-size: 14px;
}

.conversation-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.conversation-preview i {
  color: var(--text-3);
  font-size: 13px;
}

.conversation-preview i.fa-check-double {
  color: var(--blue);
}

.desktop-chat-row-meta {
  min-width: 98px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.row-tag {
  background: #eef2ff;
  color: #3c44d8;
}

.row-meta-bottom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.row-meta-bottom time {
  color: var(--text-3);
  font-size: 13px;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}

.row-unread-badge {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.desktop-chat-main {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
  overflow: hidden;
}

.desktop-chat-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.desktop-chat-main-header .chat-person {
  flex: 1;
  min-width: 0;
}

.chat-avatar-button {
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.chat-avatar-button:hover,
.chat-avatar-button:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 3px;
}

.desktop-chat-main-header .chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.desktop-chat-main-header .chat-actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.chat-header-action {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.chat-header-action:hover,
.chat-header-action:focus-visible {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #ffffff;
}

.chat-header-action.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.chat-header-action.primary:hover,
.chat-header-action.primary:focus-visible {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #ffffff;
}

.chat-header-action.reopen {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.chat-header-action:disabled,
.chat-header-action[aria-disabled="true"] {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text-3);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 1;
}

.chat-transfer-form {
  display: inline-flex;
  align-items: center;
  position: relative;
  gap: 0;
}

.chat-transfer-select {
  min-width: 0;
}

.chat-transfer-icon-select .dropdown-trigger {
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-color: var(--blue);
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--shadow);
  text-align: center;
}

.chat-transfer-icon-select.open .dropdown-trigger {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #ffffff;
}

.chat-transfer-icon-select .dropdown-trigger:disabled {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text-3);
  cursor: not-allowed;
  box-shadow: none;
}

.chat-transfer-icon-select .dropdown-menu {
  right: 0;
  left: auto;
  min-width: 230px;
  max-width: min(280px, 70vw);
  z-index: 180;
}

.chat-transfer-form .chat-transfer-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.desktop-chat-main .message-area {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01)), var(--bg);
}

.desktop-chat-main.chat-main-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01)), var(--bg);
}

.chat-empty-panel {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--text-3);
  text-align: center;
}

.chat-empty-icon {
  width: 68px;
  height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 28px;
}

.chat-empty-panel strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.chat-empty-panel span:not(.chat-empty-icon) {
  max-width: 320px;
  font-size: 14px;
  line-height: 1.45;
}

/* Contact drawer */
.contact-drawer {
  pointer-events: none;
}

.contact-drawer.open {
  pointer-events: auto;
}

.contact-drawer-desktop {
  position: absolute;
  inset: 0;
  z-index: 95;
}

.contact-drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.contact-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(486px, 46vw);
  min-width: 420px;
  display: grid;
  grid-template-rows: 66px 54px minmax(0, 1fr);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 34px rgba(32, 33, 36, 0.12);
  transform: translateX(102%);
  transition: transform 0.22s ease;
}

.contact-drawer.open .contact-drawer-panel {
  transform: translateX(0);
}

.contact-drawer-header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.contact-drawer-header strong {
  min-width: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-drawer-close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.contact-drawer-close:hover,
.contact-drawer-close:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.contact-drawer-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.contact-drawer-tab {
  position: relative;
  min-width: 0;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #6b7a90;
  font-size: 20px;
  cursor: pointer;
}

.contact-drawer-tab::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 4px;
  border-radius: 999px 999px 0 0;
  background: transparent;
}

.contact-drawer-tab.active {
  color: var(--blue);
  background: var(--blue-light);
}

.contact-drawer-tab.active::after {
  background: var(--blue);
}

.contact-drawer-body {
  min-height: 0;
  overflow: hidden;
}

.contact-drawer-pane {
  height: 100%;
  min-height: 0;
  display: none;
  overflow-y: auto;
  padding: 24px 18px 34px;
}

.contact-drawer-pane.active {
  display: block;
}

.contact-drawer-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.contact-drawer-avatar,
.contact-drawer-small-avatar {
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-drawer-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
  font-size: 21px;
}

.contact-drawer-avatar img,
.contact-drawer-small-avatar img,
.contact-drawer-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-drawer-profile strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.contact-drawer-profile span:not(.contact-drawer-avatar) {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13px;
}

.contact-drawer-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.contact-drawer-field {
  position: relative;
  min-width: 0;
  padding-right: 44px;
}

.contact-drawer-field span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 15px;
  font-weight: 600;
}

.contact-drawer-field strong {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-drawer-field-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 0;
}

.contact-drawer-field-row > div {
  min-width: 0;
}

.contact-drawer-muted-icon {
  flex: 0 0 auto;
  margin-top: 7px;
  color: #6b7a90;
  font-size: 18px;
}

.contact-drawer-round-link {
  position: absolute;
  top: 3px;
  right: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: #25d366;
}

.contact-drawer-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-drawer-mini-tags em {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.contact-drawer-notes {
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.contact-drawer-notes header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}

.contact-drawer-notes header strong {
  color: #64748b;
  font-size: 16px;
}

.contact-drawer-notes header span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.contact-drawer-notes-list {
  margin: 0 18px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.contact-drawer-notes-list p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.contact-drawer-notes-list article + article {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.contact-drawer-notes-list small {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12px;
}

.contact-drawer-link,
.contact-drawer-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  background: transparent;
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.contact-drawer-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 15px;
  text-align: center;
}

.contact-drawer-card-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.contact-drawer-card-row i {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
}

.contact-drawer-card-row span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-drawer-card-row strong,
.contact-drawer-card-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-drawer-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.contact-drawer-search {
  height: 46px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #94a3b8;
  box-shadow: var(--shadow);
}

.contact-drawer-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.contact-drawer-filter {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: #6b7a90;
  font-size: 20px;
  cursor: pointer;
}

.contact-drawer-filter:hover,
.contact-drawer-filter:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.contact-drawer-file-group + .contact-drawer-file-group {
  margin-top: 14px;
}

.contact-drawer-file-group h3 {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
}

.contact-drawer-file {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 7px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: inherit;
}

.contact-drawer-file + .contact-drawer-file {
  margin-top: 8px;
}

.contact-drawer-file:hover,
.contact-drawer-file:focus-visible {
  outline: 2px solid var(--blue-light);
}

.contact-drawer-file-thumb {
  width: 48px;
  height: 48px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface);
  color: #6b7a90;
}

.contact-drawer-file strong,
.contact-drawer-file small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-drawer-file strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.contact-drawer-file small {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.contact-drawer-conversation {
  min-height: 74px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  color: inherit;
}

.contact-drawer-conversation.active {
  background: var(--blue-light);
  border-radius: 10px;
  padding-right: 10px;
  padding-left: 10px;
  border-bottom-color: transparent;
}

.contact-drawer-small-avatar {
  width: 46px;
  height: 46px;
  font-size: 14px;
}

.contact-drawer-conversation span:not(.contact-drawer-small-avatar) {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contact-drawer-conversation strong,
.contact-drawer-conversation em,
.contact-drawer-conversation small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-drawer-conversation strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.contact-drawer-conversation em {
  align-self: flex-start;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.contact-drawer-conversation small {
  color: #64748b;
  font-size: 14px;
}

html[data-dark] .contact-drawer-panel,
html[data-dark] .contact-drawer-notes,
html[data-dark] .contact-drawer-search,
html[data-dark] .contact-drawer-file,
html[data-dark] .contact-drawer-round-link {
  border-color: var(--border);
}

html[data-dark] .contact-drawer-tab {
  color: var(--text-3);
}

html[data-dark] .contact-drawer-tab.active,
html[data-dark] .contact-drawer-conversation.active {
  background: var(--blue-light);
}

.desktop-note-message {
  align-self: center;
  max-width: min(86%, 700px);
  background: var(--yellow-light);
  color: #7a5600;
}

html[data-dark] .desktop-note-message {
  background: rgba(251, 188, 4, 0.2);
  color: #fdd663;
}

@media (max-width: 1400px) {
  .desktop-chat-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }
}

/* Thin scrollbars (desktop) */
body,
.sidebar,
.content,
.desktop-chat-list,
.desktop-chat-main .message-area,
.message-area {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar,
.desktop-chat-list::-webkit-scrollbar,
.desktop-chat-main .message-area::-webkit-scrollbar,
.message-area::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track,
.desktop-chat-list::-webkit-scrollbar-track,
.desktop-chat-main .message-area::-webkit-scrollbar-track,
.message-area::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.desktop-chat-list::-webkit-scrollbar-thumb,
.desktop-chat-main .message-area::-webkit-scrollbar-thumb,
.message-area::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover,
.desktop-chat-list::-webkit-scrollbar-thumb:hover,
.desktop-chat-main .message-area::-webkit-scrollbar-thumb:hover,
.message-area::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ── Operators ────────────────────────────────────────────── */
.input-control-select {
  cursor: pointer;
  position: relative;
}
.input-control-select select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-1);
  cursor: pointer;
  padding: 0;
  min-width: 0;
}
.op-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.op-card:last-of-type { border-bottom: none; }
.op-card.op-inactive { opacity: .55; }
.op-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.op-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.op-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 6px;
  min-width: 0;
}
.op-name-text {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.op-email {
  display: block;
  max-width: 100%;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.op-dept {
  font-size: 11px;
  color: var(--text-3);
}
.op-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.op-role-badge          { background: var(--bg-2); color: var(--text-3); }
.op-role-badge.admin    { background: var(--blue-light, #e8f0fe); color: var(--blue); }
.op-role-badge.owner    { background: #f3e8ff; color: #7c3aed; }
.op-role-badge.operator { background: var(--bg-2); color: var(--text-3); }
.op-status-badge        { /* cores via modificadores abaixo */ }
.op-status-badge.active {
  background: var(--green-light, #e6f4ea);
  color: var(--green);
}
.op-status-badge.inactive {
  background: var(--bg-2);
  color: var(--text-3);
}
.op-status-badge.blue   { background: #e8f0fe; color: #1a73e8; }
.op-status-badge.green  { background: #e6f4ea; color: #2d7d46; }
.op-status-badge.yellow { background: #fef9e7; color: #b45309; }
.op-status-badge.red    { background: #fce8e6; color: #c5221f; }
html[data-dark] .op-status-badge.blue   { background: #1a3a6b; color: #8ab4f8; }
html[data-dark] .op-status-badge.green  { background: #1a3d2a; color: #81c995; }
html[data-dark] .op-status-badge.yellow { background: #3d2e00; color: #fdd663; }
html[data-dark] .op-status-badge.red    { background: #4a1c1a; color: #f28b82; }
.op-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.operators-list-body .operator-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 76px;
  padding: 14px 4px 14px 0;
}

.operator-row .op-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
}

.operator-row-badges {
  width: auto;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.operator-row-badges .wa-line-badge,
.operator-row-badges .op-role-badge,
.operator-row-badges .op-status-badge {
  width: auto;
  min-width: 72px;
}

.operator-self-badge {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

.operator-row-actions {
  width: auto;
  justify-content: flex-end;
  gap: 8px;
}

.operator-row-actions form {
  margin: 0;
}

.operator-row-actions .wa-line-set-btn,
.operator-row-actions .wa-session-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.operator-row-actions .wa-line-set-btn i,
.operator-row-actions .wa-session-btn i {
  font-size: 13px;
}

.operator-row-actions .wa-line-set-btn:hover,
.operator-row-actions .wa-line-set-btn:focus-visible {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

.operator-row-actions .wa-session-btn.disconnect:hover,
.operator-row-actions .wa-session-btn.disconnect:focus-visible {
  background: var(--red-light);
  opacity: 1;
}

@media (max-width: 760px) {
  .operators-list-body .operator-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 88px;
    padding: 14px 0;
  }

  .operator-row .op-avatar {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .operator-row .op-info {
    grid-column: 2;
  }

  .operator-row-badges {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .operator-row-badges .wa-line-badge,
  .operator-row-badges .op-role-badge,
  .operator-row-badges .op-status-badge {
    width: auto;
    min-width: 72px;
  }

  .operator-row-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    width: auto;
  }
}

.template-list-card .template-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 118px 122px;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 4px 14px 0;
}

.template-list-card .op-info {
  min-width: 0;
}

.template-row-badge {
  width: 118px;
  align-items: center;
}

.template-row-badge .wa-line-badge {
  width: 110px;
  min-width: 110px;
}

.template-row-actions {
  width: 122px;
  justify-content: flex-end;
  gap: 8px;
  margin-left: 0;
}

.template-row-actions form {
  margin: 0;
}

.template-row-actions .wa-line-set-btn,
.template-row-actions .wa-session-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.template-row-actions .wa-line-set-btn i,
.template-row-actions .wa-session-btn i {
  font-size: 13px;
}

.template-row-actions .wa-line-set-btn:hover,
.template-row-actions .wa-line-set-btn:focus-visible {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

.template-row-actions .wa-session-btn.disconnect:hover,
.template-row-actions .wa-session-btn.disconnect:focus-visible {
  background: var(--red-light);
  opacity: 1;
}

@media (max-width: 760px) {
  .template-list-card .template-row {
    grid-template-columns: 44px minmax(0, 1fr) 122px;
    gap: 10px;
    min-height: 84px;
    padding: 14px 0;
  }

  .template-row .op-avatar {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .template-row .op-info {
    grid-column: 2;
  }

  .template-row-badge {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    align-items: center;
  }

  .template-row-badge .wa-line-badge {
    width: auto;
    min-width: 72px;
  }

  .template-row-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }
}
.op-edit-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.op-edit-panel.hidden { display: none; }
.form-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.45;
}
.form-info i {
  flex-shrink: 0;
  margin-top: 0;
  color: var(--blue);
  font-size: 18px;
}
.op-card.op-editing {
  background: var(--blue-light, #e8f0fe);
  border-radius: 8px;
  padding-left: 10px;
  padding-right: 10px;
}
.op-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.op-row.single-col {
  grid-template-columns: 1fr;
}
.op-form-grid {
  gap: 14px;
}

.team-check-grid {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.team-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.team-check-item input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.team-check-item span {
  font-size: 13px;
  color: var(--text);
}

.team-check-item small {
  color: var(--text-3);
}

.multi-select-option {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}

.multi-select-option:hover {
  background: var(--blue-light);
}

.multi-select-option input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.multi-select-option span {
  font-size: 13px;
}

.multi-select-option small {
  color: var(--text-3);
}

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 200;
  width: 392px;
  max-width: min(92vw, 392px);
  max-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(60, 64, 67, 0.25);
  pointer-events: auto;
}

.emoji-search {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text-3);
}

.emoji-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-3);
}

.emoji-cats {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-x: hidden;
  padding-bottom: 0;
}

.emoji-cat {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.emoji-cat.active {
  background: var(--blue-light);
  border-color: var(--blue-light);
  color: var(--blue-dark);
}

.emoji-grid {
  position: relative;
  z-index: 1;
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  padding-right: 3px;
}

.emoji-item {
  min-height: 34px;
  border-radius: 8px;
  background: var(--bg-soft);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.emoji-item:hover {
  background: var(--blue-light);
}

.emoji-empty {
  grid-column: 1 / -1;
  color: var(--text-3);
  font-size: 12px;
  padding: 8px 2px;
}

.company-hours-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}

.company-hours-row {
  display: grid;
  grid-template-columns: 104px 80px repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  width: 100%;
}

.company-hours-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.company-hours-check {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
}

.company-hours-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.company-hours-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #cdd3db;
  transition: background-color 0.18s ease;
  flex-shrink: 0;
}

.company-hours-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.company-hours-check input[type="checkbox"]:checked + .company-hours-switch {
  background: var(--blue);
}

.company-hours-check input[type="checkbox"]:checked + .company-hours-switch::after {
  transform: translateX(16px);
}

.company-hour-input {
  min-height: 40px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-3);
  padding: 0;
}

.company-hour-control {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-3);
  padding: 0 8px;
  min-width: 0;
}

.company-settings-form .form-field textarea {
  min-height: 100px;
}

.company-mail-form {
  gap: 18px;
}

.company-mail-toggle-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.company-mail-toggle-card p {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}

.company-mail-global-notice {
  margin: 0;
}

.company-mail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  transition: opacity 0.18s ease;
}

.company-mail-grid.is-muted {
  opacity: 0.72;
}

.company-mail-grid-span {
  grid-column: 1 / -1;
}

.company-mail-password-note {
  display: block;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
}

.company-hour-control i {
  color: var(--text-3);
  font-size: 13px;
}

@media (max-width: 1360px) {
  .company-hours-row {
    grid-template-columns: 1fr 1fr;
  }

  .company-mail-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Avatar photo ──────────────────────────────────────────────── */
.avatar.avatar-photo {
  object-fit: cover;
  object-position: center;
  padding: 0;
  font-size: 0;
  overflow: hidden;
}

/* ── System event message ──────────────────────────────────────── */
.message-event {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(86%, 560px);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.4;
}

.message-event i {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--blue);
}

.message-event time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  padding-left: 6px;
}

html[data-dark] .message-event {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
  color: var(--text-3);
}

/* ── Shortcut popup ─────────────────────────────────────────────── */
.shortcut-popup {
  position: absolute;
  bottom: calc(100% + 1px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.12);
  max-height: 320px;
  overflow-y: auto;
  z-index: 60;
}
.shortcut-popup.hidden { display: none; }
.shortcut-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-0);
  transition: background 0.12s;
  overflow: hidden;
}
.shortcut-item:last-child { border-bottom: none; }
.shortcut-item:hover,
.shortcut-item.active {
  background: var(--surface-2);
}
.shortcut-item-cmd {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.shortcut-item-body {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Composer locked (unclaimed conversation) ───────────────────── */
.composer.composer-is-locked {
  pointer-events: none;
  opacity: 0.55;
}

.composer-lock-icon {
  font-size: 12px;
  color: var(--text-3);
  margin-right: 4px;
  flex-shrink: 0;
}

/* ── Message operator label ──────────────────────────────────────── */
.message .msg-operator {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  color: inherit;
  margin-top: 0;
  margin-bottom: 2px;
  justify-content: flex-start;
}

/* ── Media: image ────────────────────────────────────────────────── */
.msg-media-image {
  display: block;
  max-width: 280px;
}
.msg-media-image img {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  cursor: zoom-in;
}

.msg-sticker {
  display: block;
  width: 132px;
  max-width: 42vw;
}
.msg-sticker-wrap {
  position: relative;
  display: inline-block;
}
.msg-sticker img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
}
.msg-sticker-save {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.msg-sticker-save:hover,
.msg-sticker-save:focus-visible,
.msg-sticker-save.saved {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  outline: none;
}
.msg-sticker-save:disabled {
  cursor: default;
}

/* ── Media: audio ────────────────────────────────────────────────── */
.msg-audio-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.msg-audio {
  width: 100%;
  height: 36px;
}
.msg-transcription {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  margin: 0;
  line-height: 1.5;
}
.msg-transcription i {
  margin-right: 4px;
  opacity: 0.7;
}
.msg-transcribe-btn span {
  display: none;
}
.msg-transcribe-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Media: video ────────────────────────────────────────────────── */
.msg-video {
  display: block;
  max-width: 280px;
  border-radius: 8px;
}

/* ── Media: file download ────────────────────────────────────────── */
.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  max-width: 280px;
  overflow: hidden;
}
.msg-file span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-file .fa-file-lines {
  flex-shrink: 0;
  color: var(--text-3);
}
.msg-file .msg-file-dl {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--blue);
}
.msg-file:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ── Lightbox ────────────────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lbFadeIn 0.15s;
}
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}
@keyframes lbFadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

/* ── Channel label in list row and header ───────────────────────── */
.row-tag-channel {
  font-weight: 400;
  opacity: 0.7;
}

.header-channel-label {
  color: var(--blue);
  font-weight: 600;
}

/* ── Start event (Atendimento iniciado) ─────────────────────────── */
.message-event-start {
  max-width: min(92%, 680px);
  font-size: 13px;
  border-color: rgba(26, 115, 232, 0.3);
  background: rgba(26, 115, 232, 0.05);
}
.message-event-start i {
  font-size: 14px;
}
.message-event-start strong {
  font-weight: 700;
  color: var(--blue);
}
html[data-dark] .message-event-start {
  background: rgba(26, 115, 232, 0.08);
  border-color: rgba(26, 115, 232, 0.25);
}

/* ── Uploading placeholder ───────────────────────────────────────── */
.msg-uploading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
}

html[data-dark] .msg-transcribe-btn {
  background: var(--bg-soft);
  color: var(--text-3);
  border-color: var(--border);
}
html[data-dark] .msg-transcribe-btn:hover,
html[data-dark] .msg-transcribe-btn:focus-visible {
  border-color: rgba(26, 115, 232, 0.32);
  background: var(--blue-light);
  color: var(--blue);
}
html[data-dark] .msg-file {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

/* ── Pagination ── */
.pagination-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
a.page-btn:hover { background: var(--bg-soft); border-color: var(--color-primary, #1a73e8); color: var(--color-primary, #1a73e8); }
.page-btn.active { background: var(--color-primary, #1a73e8); border-color: var(--color-primary, #1a73e8); color: #fff; font-weight: 700; }
.page-btn.disabled { opacity: .4; cursor: default; pointer-events: none; }
.page-btn.page-dots { border: none; background: transparent; cursor: default; min-width: 24px; }
html[data-dark] .page-btn { background: var(--bg-soft); border-color: var(--border); }
html[data-dark] a.page-btn:hover { background: var(--bg); }

/* ── Service Orders / Generic Form Utilities ── */
.input-field {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s;
}
.input-field:focus {
  border-color: var(--color-primary, #1a73e8);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.input-field[disabled] { opacity: .55; cursor: not-allowed; }
select.input-field { cursor: pointer; }
textarea.input-field { font-family: inherit; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.os-modal-body {
  position: relative;
}

.os-contact-gate {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(2px);
}

.os-contact-card {
  width: min(100%, 360px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(60, 64, 67, 0.2);
}

.os-contact-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 18px;
}

.os-contact-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.os-contact-card p {
  margin: -4px 0 2px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.35;
}

.os-field-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.os-modal-shell {
  overflow: visible;
}

.os-modal-shell .modal-body {
  overflow: visible;
}

.os-ai-section:has(.os-ai-inline-status.hidden):has(.os-ai-retry.hidden):has(.form-alert.hidden) {
  display: none;
}

.os-confirm-form {
  margin-top: 0;
}

.os-modal-body .os-modal-dropdown .dropdown-trigger {
  min-height: 39px;
  padding: 0 12px;
  border-color: var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.os-modal-body .os-modal-dropdown .dropdown-trigger-label {
  color: inherit;
}

.os-modal-body .os-modal-dropdown .dropdown-leading-icon,
.os-modal-body .os-modal-dropdown .dropdown-caret {
  color: var(--text-muted);
}

.os-modal-body .os-modal-dropdown.open .dropdown-trigger,
.os-modal-body .os-modal-dropdown .dropdown-trigger:focus-visible {
  border-color: var(--color-primary, #1a73e8);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

.os-modal-body .os-modal-dropdown .dropdown-menu {
  position: absolute;
  z-index: 220;
  max-height: none;
  box-shadow: 0 8px 26px rgba(60, 64, 67, 0.18);
}

.os-modal-body .os-modal-dropdown .os-placeholder-option {
  display: none;
}

.os-modal-body .os-modal-dropdown .dropdown-search {
  min-height: 38px;
  padding: 0 10px;
  border-color: var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.os-modal-body .os-modal-dropdown .os-company-results {
  max-height: 128px;
  overflow-y: auto;
  padding-top: 4px;
}

.os-modal-body .os-modal-dropdown .os-company-create-option {
  margin-top: 2px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
}

.os-ai-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(248, 250, 252, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.os-ai-loading.active {
  opacity: 1;
  pointer-events: auto;
}

.os-ai-loading-card {
  width: min(100%, 260px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.os-ai-loading-card strong {
  font-size: 15px;
  line-height: 1.3;
}

.os-ai-loading-card small {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
}

.os-ai-spinner {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(26, 115, 232, 0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  color: var(--blue);
  animation: osSpin 0.75s linear infinite;
}

.os-ai-spinner i {
  font-size: 15px;
}

.os-ai-inline-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(26, 115, 232, 0.18);
  border-radius: 8px;
  background: rgba(26, 115, 232, 0.08);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.os-ai-inline-status.is-done {
  border-color: rgba(45, 164, 107, 0.2);
  background: rgba(45, 164, 107, 0.1);
  color: #16824f;
}

.os-ai-inline-status.is-error {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.1);
  color: #a16207;
}

.os-ai-retry {
  margin-top: 10px;
}

@keyframes osSpin {
  to { transform: rotate(360deg); }
}

html[data-dark] .os-ai-loading {
  background: rgba(17, 24, 39, 0.86);
}

.data-table { border-collapse: collapse; font-size: 14px; }
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-soft); }

.os-filter-bar { background: var(--bg); border-bottom: 1px solid var(--border); }

html[data-dark] .input-field {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}
html[data-dark] .data-table th,
html[data-dark] .data-table td { border-color: var(--border); }
html[data-dark] .data-table tbody tr:hover { background: var(--bg); }

.service-order-topbar {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

.service-order-actions form {
  margin: 0;
}

.service-order-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 24px;
  padding: 24px;
}

.service-order-form-card {
  gap: 18px;
}

.service-order-form {
  gap: 14px;
}

.service-order-fieldset {
  display: contents;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.service-order-fieldset:disabled {
  opacity: 0.82;
}

.service-order-field-full {
  min-width: 0;
}

.service-order-form .input-control i {
  width: 16px;
  flex: 0 0 16px;
  text-align: center;
}

.service-order-form select {
  cursor: pointer;
}

.service-order-textarea {
  min-height: 126px;
  line-height: 1.5;
}

.service-order-textarea-small {
  min-height: 92px;
}

.service-order-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.service-order-side-card {
  gap: 14px;
  padding: 20px;
}

.service-order-side-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.service-order-side-title i {
  color: var(--blue);
  font-size: 15px;
}

.service-order-info-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.service-order-info-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.service-order-info-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.service-order-info-row:last-child {
  padding-bottom: 0;
}

.service-order-info-row dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.service-order-info-row dt i {
  width: 14px;
  color: var(--blue);
  text-align: center;
}

.service-order-info-row dd {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.service-order-meta-link {
  color: var(--blue);
  font-weight: 700;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.service-order-meta-link:hover {
  text-decoration: underline;
}

.service-order-client-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.service-order-client-summary p {
  margin: 0;
}

.service-order-client-summary .muted {
  color: var(--text-3);
}

.service-order-list-layout {
  grid-template-columns: 1fr;
  padding: 0 24px 32px;
}

.service-order-list-head {
  flex-wrap: wrap;
  gap: 12px;
}

.service-order-list-title {
  flex: 1;
  min-width: 220px;
}

.service-order-filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 7;
  overflow: visible;
}

.service-order-search-control {
  flex: 1;
  min-width: 200px;
}

.service-order-status-control {
  width: 160px;
}

.service-order-per-page-control {
  width: 160px;
}

.service-order-list-body .service-order-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 4px 14px 0;
  min-width: 0;
}

.manual-os-modal {
  width: min(100%, 600px);
}

.manual-os-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-os-new-company {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.manual-os-email-hint {
  min-height: 16px;
  color: var(--text-3);
  font-size: 12px;
}

.manual-os-email-hint.is-warning {
  color: var(--red);
}

.manual-os-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.service-order-number {
  width: 44px;
  height: 44px;
  min-width: 44px;
  font-size: 13px;
}

.service-order-row-badges {
  width: auto;
  min-width: 110px;
  align-items: stretch;
  gap: 6px;
  justify-self: end;
}

.service-order-row-badges .op-status-badge {
  width: 110px;
  min-width: 110px;
  min-height: 24px;
  padding: 0 10px;
}

.service-order-priority {
  font-size: 11px;
}

.service-order-row-actions {
  width: max-content;
  max-width: 100%;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
}

.service-order-row-actions .wa-line-set-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.service-order-row-actions .wa-line-set-btn i {
  font-size: 13px;
}

.service-order-row-actions .service-order-email-btn.is-danger {
  background: #ffe4e4;
  border-color: #f4b6b6;
  color: #b42318;
}

.service-order-row-actions .service-order-email-btn.is-success {
  background: #e5f7eb;
  border-color: #b7e1c4;
  color: #137333;
}

.service-order-row-actions .wa-line-set-btn:hover,
.service-order-row-actions .wa-line-set-btn:focus-visible {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

.service-order-email-summary {
  color: var(--text-2);
}

.service-order-email-modal {
  max-width: 560px;
  width: 100%;
}

.service-order-email-modal-body {
  gap: 18px;
}

.service-order-email-headline strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.service-order-email-headline p {
  margin: 6px 0 0;
  color: var(--text-2);
  line-height: 1.5;
}

.service-order-email-status-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.service-order-email-status-card p {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}

.service-order-email-status-badge {
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.service-order-email-status-badge.is-success {
  background: #e5f7eb;
  color: #137333;
}

.service-order-email-status-badge.is-warning {
  background: #fff4d8;
  color: #8a5a00;
}

.service-order-email-status-badge.is-danger {
  background: #ffe4e4;
  color: #b42318;
}

.service-order-email-details {
  display: grid;
  gap: 12px;
  margin: 0;
}

.service-order-email-detail-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f7f9fc;
}

.service-order-email-detail-row dt {
  color: var(--text-2);
  font-weight: 600;
}

.service-order-email-detail-row dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.service-order-email-error-link {
  display: grid;
  gap: 6px;
  text-decoration: none;
}

.service-order-email-error-link strong {
  font-size: 12px;
  font-weight: 700;
}

.service-order-email-actions {
  padding-top: 4px;
}

.action-button.is-danger {
  background: #ffe4e4;
  color: #b42318;
  border: 1px solid #f4b6b6;
}
.action-button.is-danger i,
.action-button.is-danger span { color: #b42318; }
.action-button.is-danger:hover { background: #fcd4d4; }

.action-button.is-success {
  background: #e5f7eb;
  color: #137333;
  border: 1px solid #b7e1c4;
}
.action-button.is-success i,
.action-button.is-success span { color: #137333; }
.action-button.is-success:hover { background: #d4f0dd; }

.customer-company-list-card {
  height: var(--customer-company-form-height, auto);
  max-height: var(--customer-company-form-height, calc(var(--desktop-app-safe-height) - 176px));
  overflow: visible;
}

.company-list-card {
  height: var(--company-form-height, auto);
  max-height: var(--company-form-height, calc(var(--desktop-app-safe-height) - 176px));
  overflow: visible;
}

.saas-accounts-card {
  min-height: 360px;
  height: min(620px, calc(var(--desktop-app-safe-height) - 318px));
  overflow: hidden;
}

.saas-table-wrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.saas-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.saas-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.customer-company-list-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.service-order-list-body .customer-company-row {
  grid-template-columns: 52px minmax(0, 1fr) 104px 126px;
}

.customer-company-row-badges {
  width: 104px;
}

.customer-company-row-badges .op-status-badge {
  width: 96px;
  min-width: 96px;
}

.customer-company-row-actions {
  width: 126px;
}

.customer-company-row-actions form {
  margin: 0;
}

.customer-company-row-actions .wa-session-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.customer-company-row-actions .wa-session-btn i {
  font-size: 13px;
}

.customer-company-row-actions .wa-session-btn.disconnect:hover,
.customer-company-row-actions .wa-session-btn.disconnect:focus-visible {
  background: var(--red-light);
  opacity: 1;
}

.contact-row-actions form {
  margin: 0;
}

.contact-row-actions .wa-session-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.contact-row-actions .wa-session-btn i {
  font-size: 13px;
}

.contact-row-actions .wa-session-btn.disconnect:hover,
.contact-row-actions .wa-session-btn.disconnect:focus-visible {
  background: var(--red-light);
  opacity: 1;
}

@media (max-width: 1100px) {
  .service-order-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .service-order-layout,
  .service-order-list-layout {
    padding: 16px;
  }

  .service-order-form .op-row {
    grid-template-columns: 1fr;
  }

  .service-order-actions,
  .service-order-filter-form {
    width: 100%;
  }

  .service-order-list-body .service-order-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 84px;
    padding: 14px 0;
  }

  .service-order-list-body .customer-company-row {
    grid-template-columns: 44px minmax(0, 1fr) 112px;
  }

  .customer-company-row-badges {
    width: auto;
  }

  .customer-company-row-actions {
    width: 112px;
  }

  .service-order-number {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 12px;
  }

  .service-order-row .op-info {
    grid-column: 2;
  }

  .service-order-row-badges {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  .service-order-row-badges .op-status-badge {
    width: auto;
    min-width: 72px;
  }

  .service-order-row-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    width: max-content;
  }

  .service-order-actions .action-button,
  .service-order-actions form,
  .service-order-actions form .action-button,
  .service-order-filter-form .action-button,
  .service-order-search-control,
  .service-order-status-control,
  .service-order-per-page-control {
    width: 100%;
  }

  .manual-os-new-company {
    grid-template-columns: 1fr;
  }

  .manual-os-actions .action-button {
    width: 100%;
  }
}

/* ── O.S. Toast notification ── */
.os-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e7e34;
  color: #fff;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  max-width: 360px;
}
.os-toast a { color: #a8f0c0; font-weight: 700; text-decoration: underline; pointer-events: all; }
.os-toast.os-toast-show { opacity: 1; transform: translateY(0); pointer-events: all; }
html[data-dark] .os-toast { background: #166e2a; }

/* ── Conversation history modal ── */
.conv-history-modal {
  width: min(680px, 96vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.conv-history-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-soft, #f5f7fa);
}
.conv-history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 0;
  color: var(--text-3, #999);
  font-size: 13px;
}
.conv-hist-event {
  display: flex;
  align-items: center;
  gap: 7px;
  align-self: center;
  font-size: 11px;
  color: var(--text-3, #888);
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 3px 12px;
  margin: 4px 0;
}
.conv-hist-event i { font-size: 10px; }
.conv-hist-event time { margin-left: 4px; opacity: .7; }
.conv-hist-note {
  align-self: center;
  max-width: 80%;
}
.conv-hist-empty {
  text-align: center;
  color: var(--text-3, #999);
  font-size: 13px;
  padding: 40px 0;
}
html[data-dark] .conv-history-body { background: var(--bg, #1a1d23); }

/* Dashboard analitico */
.dashboard-analytics-page {
  gap: 18px;
}

.dashboard-topbar {
  align-items: center;
}

.dashboard-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  flex-wrap: wrap;
}

.dashboard-tabs .chip {
  min-width: 92px;
  justify-content: center;
}

.dashboard-filter-control {
  width: 220px;
}

.dashboard-account-dropdown {
  width: 260px;
}

.dashboard-filter-dropdown .dropdown-trigger,
.dashboard-account-dropdown .dropdown-trigger {
  min-height: 44px;
}

.dashboard-filter-dropdown .dropdown-caret,
.dashboard-account-dropdown .dropdown-caret {
  font-size: 11px;
}

.dashboard-filter-dropdown .dropdown-menu,
.dashboard-account-dropdown .dropdown-menu {
  max-height: 252px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.dashboard-filter-dropdown .dropdown-menu::-webkit-scrollbar,
.dashboard-account-dropdown .dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.dashboard-filter-dropdown .dropdown-menu::-webkit-scrollbar-thumb,
.dashboard-account-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

.dashboard-date-control {
  width: 180px;
  flex: 0 0 180px;
}

.dashboard-date-control input[type="date"] {
  min-width: 128px;
  color: var(--text);
  text-overflow: clip;
}

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

.dashboard-kpi-card {
  min-height: 112px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  padding-left: 34px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dashboard-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--kpi-accent);
}

.dashboard-kpi-card.slate { --kpi-accent: #415166; }
.dashboard-kpi-card.green { --kpi-accent: #22c55e; }
.dashboard-kpi-card.blue { --kpi-accent: #3b82f6; }
.dashboard-kpi-card.orange { --kpi-accent: #fb923c; }

.dashboard-kpi-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--kpi-accent) 14%, transparent);
  color: var(--kpi-accent);
  font-size: 22px;
}

.dashboard-kpi-card strong,
.dashboard-kpi-card b,
.dashboard-kpi-card small {
  display: block;
}

.dashboard-kpi-card strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
}

.dashboard-kpi-card b {
  margin-top: 6px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.1;
}

.dashboard-kpi-card small {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13px;
}

.dashboard-chart-card,
.dashboard-table-card {
  gap: 18px;
  padding: 22px 24px;
}

.dashboard-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
}

.dashboard-section-head p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.4;
}

.dashboard-section-head.with-filter {
  align-items: center;
}

.dashboard-user-filter-label {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface);
  white-space: nowrap;
}

.dashboard-chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 244px;
  gap: 20px;
  align-items: stretch;
}

.dashboard-chart-layout.compact-side {
  grid-template-columns: minmax(0, 1fr) 250px;
}

.dashboard-chart-box {
  min-height: 340px;
  position: relative;
}

.dashboard-side-metrics {
  display: grid;
  align-content: center;
  gap: 8px;
}

.dashboard-side-metrics.single {
  align-content: start;
  padding-top: 28px;
}

.dashboard-side-metric {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  background: var(--bg-soft);
  color: var(--text);
}

.dashboard-side-metric span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 14px;
}

.dashboard-side-metric span i {
  font-size: 12px;
  color: #7b8797;
}

.dashboard-info-tip {
  position: relative;
  cursor: help;
  outline: none;
}

.dashboard-info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #202124;
  color: #fff;
  font-size: 12px;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 22px rgba(32, 33, 36, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .16s ease, transform .16s ease;
}

.dashboard-info-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 21;
  border: 5px solid transparent;
  border-top-color: #202124;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .16s ease, transform .16s ease;
}

.dashboard-info-tip:hover::after,
.dashboard-info-tip:hover::before,
.dashboard-info-tip:focus-visible::after,
.dashboard-info-tip:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dashboard-side-metric strong {
  margin-top: 8px;
  color: var(--text);
  font-size: 36px;
  line-height: 1;
}

.dashboard-side-metric small {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 13px;
}

.dashboard-heatmap-wrap {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.dashboard-heatmap {
  min-width: max(760px, calc(var(--heatmap-days) * 112px));
  display: grid;
  grid-template-columns: 58px repeat(var(--heatmap-days), minmax(76px, 1fr));
  grid-auto-rows: 24px;
  gap: 2px;
  align-items: stretch;
}

.heatmap-corner,
.heatmap-day,
.heatmap-hour {
  display: flex;
  align-items: center;
  color: var(--text-3);
  font-size: 12px;
}

.heatmap-day {
  justify-content: center;
  font-weight: 500;
}

.heatmap-hour {
  justify-content: flex-end;
  padding-right: 10px;
}

.heatmap-cell {
  display: block;
  border-radius: 2px;
  background: var(--bg-soft);
  outline: 1px solid rgba(255, 255, 255, 0.55);
}

.heatmap-cell.has-volume {
  background: rgba(26, 115, 232, calc(0.18 + (var(--level) * 0.72)));
  cursor: pointer;
}

.heatmap-cell.has-volume:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.dashboard-heatmap-tooltip {
  position: fixed;
  z-index: 700;
  min-width: 148px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 5px;
  background: #202124;
  color: #fff;
  box-shadow: 0 10px 26px rgba(32, 33, 36, 0.24);
  pointer-events: none;
}

.dashboard-heatmap-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  border: 5px solid transparent;
  border-top-color: #202124;
  transform: translateX(-50%);
}

.dashboard-heatmap-tooltip strong {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-heatmap-tooltip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
}

.dashboard-heatmap-tooltip-row i {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 2px;
  background: #8ec5ff;
}

.dashboard-heatmap-tooltip-row b {
  color: #fff;
  font-weight: 500;
}

.dashboard-quality-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.dashboard-quality-table th,
.dashboard-quality-table td {
  text-align: center;
}

.dashboard-quality-table th:first-child,
.dashboard-quality-table td:first-child {
  text-align: left;
}

.dashboard-quality-table th i {
  margin-left: 4px;
  color: var(--text-3);
  font-size: 12px;
}

.dashboard-empty-row {
  padding: 28px 16px !important;
  text-align: center !important;
  color: var(--text-3) !important;
}

html[data-dark] .dashboard-filter-bar,
html[data-dark] .dashboard-user-filter-label {
  background: var(--surface);
  border-color: var(--border);
}

html[data-dark] .dashboard-kpi-card.slate { --kpi-accent: #64748b; }
html[data-dark] .dashboard-kpi-card.green { --kpi-accent: #22c55e; }
html[data-dark] .dashboard-kpi-card.blue { --kpi-accent: #60a5fa; }
html[data-dark] .dashboard-kpi-card.orange { --kpi-accent: #fb923c; }

html[data-dark] .heatmap-cell {
  outline-color: rgba(19, 21, 25, 0.8);
}

html[data-dark] .heatmap-cell.has-volume {
  background: rgba(138, 180, 248, calc(0.18 + (var(--level) * 0.72)));
}

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

  .dashboard-chart-layout,
  .dashboard-chart-layout.compact-side {
    grid-template-columns: 1fr;
  }

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

  .dashboard-side-metrics.single {
    grid-template-columns: 1fr;
    padding-top: 0;
  }
}

@media (max-width: 900px) {
  .dashboard-topbar,
  .dashboard-section-head,
  .dashboard-section-head.with-filter {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-filter-control,
  .dashboard-account-dropdown,
  .dashboard-date-control {
    width: 100%;
  }

  .dashboard-kpi-grid,
  .dashboard-side-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi-card {
    min-height: 104px;
  }

  .dashboard-chart-box {
    min-height: 280px;
  }
}

/* Remove a marca visual de campo selecionado no projeto todo. */
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible,
.login-field input:focus,
.search-inner:focus-within,
.input-control:focus-within,
.board-search:focus-within,
.dropdown-search:focus-within,
.form-field textarea:focus,
.dropdown-trigger:focus-visible,
.dropdown-select.open .dropdown-trigger,
.module-search:focus-within,
.input-field:focus,
.os-modal-body .os-modal-dropdown.open .dropdown-trigger,
.os-modal-body .os-modal-dropdown .dropdown-trigger:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.login-field input:focus,
.input-control:focus-within,
.board-search:focus-within,
.dropdown-search:focus-within,
.form-field textarea:focus,
.dropdown-trigger:focus-visible,
.dropdown-select.open .dropdown-trigger,
.module-search:focus-within {
  border-color: transparent !important;
  background: var(--bg-soft) !important;
}

.search-inner:focus-within {
  border-color: transparent !important;
  background: var(--bg) !important;
}

.input-field:focus,
.os-modal-body .os-modal-dropdown.open .dropdown-trigger,
.os-modal-body .os-modal-dropdown .dropdown-trigger:focus-visible {
  border-color: var(--border) !important;
  background: var(--bg) !important;
}

/* ── Drag-and-drop highlight ─────────────────────────────────────── */
.chat-main-panel.drag-over::after {
  content: "Solte para enviar";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 115, 232, 0.10);
  border: 2px dashed var(--blue, #1a73e8);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue, #1a73e8);
  pointer-events: none;
  z-index: 500;
}

/* ── Message delete button ───────────────────────────────────────── */
.message-delete-button {
  position: absolute;
  top: 50%;
  right: -72px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.18s ease, color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  z-index: 2;
}

.message.outgoing .message-delete-button {
  right: auto;
  left: -72px;
}

/* Se a mensagem tem botão transcrever, empurra o delete para -108px */
.message.outgoing:has(.msg-transcribe-btn) .message-delete-button {
  left: -108px;
}

.message:hover .message-delete-button,
.message:focus-within .message-delete-button,
.message-delete-button:focus-visible {
  opacity: 1;
}

.message-delete-button:hover,
.message-delete-button:focus-visible {
  border-color: rgba(212, 87, 112, 0.32);
  background: rgba(212, 87, 112, 0.1);
  color: var(--rose, #d45770);
  outline: none;
}

/* ── Attachment preview overlay ──────────────────────────────────── */
.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.attachment-preview-overlay.hidden {
  display: none;
}

.attachment-preview-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,0.22));
  padding: 20px;
  max-width: 520px;
  width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attachment-preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  max-height: 320px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-soft);
}

.attachment-preview-content img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  object-fit: contain;
}

.attachment-preview-content audio,
.attachment-preview-content video {
  width: 100%;
  border-radius: 8px;
}

.attachment-preview-content iframe {
  width: 100%;
  min-height: 56vh;
  border: 0;
  background: #fff;
  border-radius: 8px;
}

.attachment-preview-box.is-document {
  max-width: min(92vw, 960px);
}

.attachment-preview-box.is-document .attachment-preview-content {
  min-height: 56vh;
  max-height: 72vh;
  overflow: auto;
  align-items: stretch;
}

.attachment-preview-content .preview-file-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-3);
  font-size: 13px;
  width: 100%;
  text-align: center;
}

.attachment-preview-content .preview-file-icon i {
  font-size: 40px;
  color: var(--text-2);
}

.attachment-preview-content .preview-file-icon strong {
  font-size: 14px;
  color: var(--text-2);
  max-width: 100%;
  word-break: break-word;
}

.attachment-preview-content .preview-file-icon span {
  max-width: 100%;
  word-break: break-word;
}

.preview-file-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.14) inset;
}

.preview-file-open:hover {
  background: rgba(26, 115, 232, 0.08);
}

.attachment-preview-text {
  width: 100%;
  min-height: 56vh;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: var(--surface);
  color: var(--text-2);
  border-radius: 8px;
  font: 13px/1.55 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-preview-name {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
