:root {
  --navy: #0f172a;
  --navy-2: #111c33;
  --navy-3: #172642;
  --mint: #10b981;
  --mint-dark: #047857;
  --mint-soft: #d1fae5;
  --cyan: #06b6d4;
  --cyan-dark: #0e7490;
  --cyan-soft: #cffafe;
  --ice: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #102033;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --sidebar-width: 288px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--ice);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

body[data-auth="checking"] .auth-view,
body[data-auth="clinic"] .auth-view,
body[data-auth="admin"] .auth-view,
body[data-auth="login"] .app-shell,
body[data-auth="login"] .admin-shell,
body[data-auth="checking"] .app-shell,
body[data-auth="checking"] .admin-shell,
body[data-auth="clinic"] .admin-shell,
body[data-auth="admin"] .app-shell {
  display: none;
}

body[data-auth="login"] {
  overflow: auto;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 32px));
  transform: translateY(18px);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  max-width: min(260px, calc(100vw - 16px));
  transform: translateY(calc(-100% - 8px));
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--navy);
}

.auth-view {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.05fr);
  background:
    radial-gradient(circle at 16% 18%, rgba(6, 182, 212, 0.2), transparent 32%),
    linear-gradient(135deg, var(--navy), #08111f 55%, #071522);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px;
  color: #ffffff;
}

.auth-brand img {
  width: min(360px, 86vw);
  height: 90px;
  object-fit: contain;
  object-position: left center;
}

.auth-brand h1 {
  max-width: 560px;
  margin: 34px 0 14px;
  color: #ffffff;
  font-size: 42px;
  line-height: 1.08;
}

.auth-brand p {
  max-width: 560px;
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1.65;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(440px, calc(100vw - 32px));
  border: 1px solid rgba(226, 232, 240, 0.75);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-card-head {
  display: grid;
  gap: 7px;
  margin-bottom: 22px;
}

.login-card-head span,
.panel-kicker {
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-card-head strong {
  color: var(--navy);
  font-size: 24px;
  line-height: 1.2;
}

.login-card label,
.field {
  display: grid;
  gap: 7px;
}

.login-card label > span,
.field > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.setting-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--muted) !important;
  font-weight: 700 !important;
}

.setting-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.clinic-logo-uploader {
  display: grid;
  gap: 10px;
}

.clinic-logo-preview {
  width: auto;
  max-width: 220px;
  max-height: 90px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.clinic-logo-placeholder {
  display: flex;
  align-items: center;
  width: 220px;
  height: 90px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.clinic-logo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.clinic-logo-file-label {
  cursor: pointer;
}

.clinic-logo-uploader > small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding-top: 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12);
}

.login-card label + label {
  margin-top: 14px;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 20px;
}

.check-label {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.check-label input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--mint);
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  gap: 8px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: var(--navy);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--navy);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--navy);
  font-size: 13px;
}

.danger-button {
  border: 1px solid rgba(225, 29, 72, 0.25);
  background: var(--rose-soft);
  color: #9f1239;
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--cyan-dark);
  padding: 0;
  font-size: 13px;
}

.full {
  width: 100%;
}

.login-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.form-feedback {
  min-height: 20px;
  margin-top: 12px;
  color: #9f1239;
  font-size: 13px;
  line-height: 1.45;
}

.app-shell,
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 680px;
}

.sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(6, 182, 212, 0.08), transparent 220px),
    var(--navy);
  color: #e5f3f6;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

.brand-block {
  padding: 22px 18px 18px;
}

.brand-logo {
  display: block;
  width: 205px;
  max-width: 100%;
  height: 58px;
  object-fit: contain;
  object-position: left center;
}

.tenant-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 14px;
  padding: 0 10px;
  border: 1px solid rgba(6, 182, 212, 0.34);
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.11);
  color: #b6f6ff;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 6px;
  padding: 0 14px 18px;
}

.nav-group {
  display: grid;
  gap: 3px;
}

.nav-title {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.nav-title:hover {
  background: rgba(6, 182, 212, 0.08);
  color: #bae6fd;
}

.nav-title:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* The section holding the current screen stays identifiable even when the
   person collapsed it by hand. */
.nav-group:has(.nav-item.is-active) > .nav-title {
  color: #ffffff;
}

.nav-title-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  opacity: 0.8;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.nav-group.is-collapsed .nav-chevron {
  transform: rotate(0deg);
}

.nav-group-items {
  display: grid;
  gap: 3px;
  padding-left: 14px;
}

.nav-group.is-collapsed .nav-group-items {
  display: none;
}

/* Searching the menu must show every match, collapsed section or not. */
.sidebar-nav.is-searching .nav-group.is-collapsed .nav-group-items {
  display: grid;
}

/* A collapsed section still signals when something inside needs attention
   (hot leads, open follow-ups, unanswered WhatsApp) — plain totals like
   "Agenda 1" are informational and don't light it. */
.nav-title-alert {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fb7185;
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.14);
}

.nav-group.is-collapsed:has(.nav-count.hot:not(:empty), .nav-count.warn:not(:empty), .nav-count.live:not(.is-idle)) .nav-title-alert {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .nav-chevron,
  .nav-title {
    transition: none;
  }
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 36px;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.nav-item > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(6, 182, 212, 0.16);
  color: #ffffff;
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-root {
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 42px;
  padding: 0 11px;
}

/* Auditoria + Configurações pinned together at the bottom — a single
   margin-top:auto on the wrapper (not one per button, which split the free
   space between them and left Auditoria floating mid-sidebar). */
.sidebar-footer-links {
  display: grid;
  gap: 3px;
  margin-top: auto;
}

.nav-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.11);
  color: #67e8f9;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.admin-sidebar .nav-icon svg {
  fill: none;
}

.nav-dot {
  justify-self: center;
  width: 7px;
  height: 7px;
  border: 1.5px solid rgba(148, 163, 184, 0.8);
  border-radius: 50%;
}

.nav-item.is-active .nav-dot {
  border-color: var(--mint);
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.14);
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.nav-count:empty {
  display: none;
}

.nav-count.hot {
  background: rgba(225, 29, 72, 0.18);
  color: #fecdd3;
}

.nav-count.warn {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

.nav-count.live {
  display: block;
  width: 9px;
  min-width: 9px;
  height: 9px;
  padding: 0;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}

/* Off/unlit when there's nothing new to notify about — see
   hasUnreadWhatsappActivity() in app.js. */
.nav-count.live.is-idle {
  background: rgba(148, 163, 184, 0.45);
  box-shadow: none;
}

.sidebar-scrim {
  display: none;
}

.main-shell {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(6, 182, 212, 0.06), transparent 260px),
    var(--ice);
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 72px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 0 26px;
  backdrop-filter: blur(12px);
}

.icon-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--navy);
}

.icon-button.is-danger {
  border-color: rgba(225, 29, 72, 0.25);
  background: var(--rose-soft);
  color: #9f1239;
}

.report-actions {
  display: flex;
  gap: 6px;
}

.icon-button.menu-toggle {
  display: none;
}

.icon-button svg,
.action-button svg,
.global-search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.global-search {
  display: flex;
  align-items: center;
  width: min(520px, 45vw);
  min-width: 240px;
  height: 42px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 13px;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.global-search:hover,
.global-search:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.global-search span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 1;
  gap: 10px;
}

.notification-anchor {
  position: relative;
  flex: 0 0 auto;
}

.notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: min(380px, calc(100vw - 30px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.18);
}

.notification-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.notification-popover-head > div {
  display: grid;
  gap: 3px;
}

.notification-popover-head strong {
  color: var(--navy);
  font-size: 15px;
}

.compact-icon.icon-button {
  width: 32px;
  height: 32px;
}

.notification-list {
  display: grid;
  max-height: min(390px, calc(100vh - 120px));
  overflow: auto;
}

.notification-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 14px 16px;
  text-align: left;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:not(:disabled):hover {
  background: var(--ice);
}

.notification-item strong {
  color: var(--navy);
  font-size: 13px;
}

.notification-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.notification-item.is-empty {
  cursor: default;
}

.connection-choice-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ice);
  padding: 16px;
}

.connection-choice-note strong,
.connection-choice-note small {
  display: block;
}

.connection-choice-note strong {
  color: var(--navy);
  font-size: 14px;
}

.connection-choice-note small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.connection-choice-note.is-connected {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.linked-device-qr-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ice);
  padding: 18px;
  text-align: center;
}

.linked-device-qr-wrap strong {
  color: var(--navy);
  font-size: 14px;
}

.linked-device-qr {
  display: block;
  width: min(280px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  object-fit: contain;
  padding: 10px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 900;
  white-space: nowrap;
}

.tenant-selector {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  width: 190px;
  min-height: 42px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 10px;
  text-align: left;
}

.tenant-selector strong,
.tenant-selector small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-selector strong {
  font-size: 13px;
}

.tenant-selector small {
  color: var(--muted);
  font-size: 12px;
}

.clinic-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.92), rgba(6, 182, 212, 0.92)),
    var(--cyan);
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--rose);
}

.user-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--mint);
  color: #052e25;
  font-size: 13px;
  font-weight: 900;
}

.admin-topline {
  display: grid;
  gap: 2px;
}

.admin-topline strong {
  color: var(--navy);
}

.admin-topline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.content-shell {
  min-height: 0;
  overflow: auto;
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.breadcrumb {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--navy);
  font-size: 31px;
  line-height: 1.15;
}

.page-head p {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.date-filter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.date-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--navy);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.date-filter-trigger svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-filter-popover {
  width: min(360px, calc(100vw - 28px));
}

.period-filter-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-filter-shortcuts button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--navy);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.period-filter-shortcuts button.is-selected {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.period-filter-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.period-filter-divider::before,
.period-filter-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.period-filter-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.help-chat-popover {
  width: min(480px, calc(100vw - 28px));
  margin-top: 64px;
}

.help-chat-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.help-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#newWhatsappConversationInput {
  margin: 14px 0 10px;
}

#newWhatsappConversationResults {
  max-height: 320px;
  overflow-y: auto;
}

.help-chat-head h2 {
  margin-top: 7px;
  color: var(--navy);
  font-size: 20px;
}

.help-chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.help-chat-message {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
}

.help-chat-message.is-assistant {
  justify-self: start;
  max-width: 92%;
  background: var(--cyan-soft);
  color: var(--navy);
}

.help-chat-message.is-user {
  justify-self: end;
  max-width: 85%;
  background: var(--navy);
  color: #ffffff;
}

.help-chat-message p {
  margin: 0;
}

.help-chat-goto {
  justify-self: start;
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: #ffffff;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
}

.help-chat-path {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.help-chat-results {
  display: grid;
  gap: 6px;
}

.help-chat-result {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 11px;
  color: var(--navy);
  text-align: left;
}

.help-chat-result:hover,
.help-chat-result:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  outline: none;
}

.help-chat-result small {
  color: var(--muted);
  font-weight: 700;
}

.help-chat-result-more {
  justify-items: center;
  border-style: dashed;
  color: var(--cyan-dark);
  font-weight: 800;
}

.help-chat-more-results {
  max-height: 380px;
  overflow-y: auto;
}

.help-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.help-chat-chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}

.help-chat-chip:hover,
.help-chat-chip:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  outline: none;
}

.help-chat-input-row {
  display: flex;
  gap: 8px;
}

.help-chat-input-row input {
  flex: 1;
}

.new-contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contact-picker-field {
  gap: 8px;
}

.contact-picker-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--cyan-soft);
  padding: 10px 12px;
}

.contact-picker-selected-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.contact-picker-selected-info strong {
  color: var(--navy);
  font-size: 14px;
}

.contact-picker-selected-info small {
  color: var(--muted);
  font-weight: 700;
}

.contact-picker-picking {
  display: grid;
  gap: 8px;
}

.contact-picker-results {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.contact-picker-new {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--cyan-dark);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.contact-picker-new:hover,
.contact-picker-new:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  outline: none;
}

.contact-picker-list {
  display: grid;
  gap: 6px;
}

.contact-picker-result {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 11px;
  color: var(--navy);
  text-align: left;
}

.contact-picker-result:hover,
.contact-picker-result:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  outline: none;
}

.contact-picker-result small {
  color: var(--muted);
  font-weight: 700;
}

.contact-picker-empty {
  margin: 4px 2px;
  color: var(--muted);
  font-size: 13px;
}

/* Same pill-button look as .date-filter above, reused for in-page section
   tabs (e.g. Configurações) instead of a date range. */
.pill-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
  margin-bottom: 18px;
}

.pill-tabs button,
.pill-tabs label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.pill-tabs button.is-selected,
.pill-tabs label.is-selected {
  background: var(--navy);
  color: #ffffff;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-option {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.chip-option.is-selected {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.import-flow {
  display: grid;
  gap: 10px;
}

.import-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.import-mapping-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
}

.import-mapping-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.import-mapping-source {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 4px 0 8px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 13px 30px rgba(15, 23, 42, 0.05);
}

.metric-card .metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--navy);
  font-size: 28px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metric-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.metric-icon.mint {
  background: var(--mint-soft);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.18);
}

.metric-icon.cyan {
  background: var(--cyan-soft);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.18);
}

.metric-icon.amber {
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.metric-icon.rose {
  background: var(--rose-soft);
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.14);
}

.work-area {
  display: grid;
  gap: 18px;
}

.panel,
.table-card,
.kanban-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.table-card {
  padding: 18px;
}

.panel-header,
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2,
.section-header h2 {
  color: var(--navy);
  font-size: 18px;
  line-height: 1.25;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.span-2 {
  grid-column: 1 / -1;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.65fr);
  gap: 18px;
}

/* Painel de crescimento do Dashboard do Super Admin (estilo "Power BI") */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

/* Cards in the same row now stretch to match each other's height (grid's
   default) instead of each hugging its own content — a short donut next to
   a tall empty-state box looked visibly unbalanced. The card is a flex
   column so its own chart/empty-state area (the second child, after
   panel-header) can grow and center itself in that extra space instead of
   leaving it as dead space at the bottom. */
.dash-card {
  display: flex;
  flex-direction: column;
}

.dash-card > *:nth-child(2) {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-height: 220px;
}

.dash-card .panel-header {
  align-items: center;
}

/* The generic .empty-state (min-height: 220px, sized for an empty table)
   is too tall for these compact chart cards — a donut naturally sits
   around 150-170px, so pairing it with the generic empty-state made both
   cards in the row balloon together once they stretch to match. */
.dash-card .empty-state {
  min-height: 140px;
  padding: 16px;
}

.dash-card-highlight {
  color: var(--cyan-dark);
  font-size: 18px;
  white-space: nowrap;
}

.dash-card-highlight small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* height fixed (not "auto") on purpose — with a fixed viewBox, width:100% +
   height:auto scales height to match whatever width the card happens to
   be, so a chart with a narrow viewBox (e.g. a 2-bar chart) blows up huge
   inside a wide card. Natural width, capped height, never wider than the
   card — no distortion for any bar count/aspect ratio. */
.dash-chart {
  width: auto;
  height: 190px;
  max-width: 100%;
  overflow: visible;
}

.dash-chart-line {
  stroke: var(--cyan);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-chart-dot {
  fill: var(--surface);
  stroke: var(--cyan);
  stroke-width: 2.5;
}

.dash-chart-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.dash-chart-bar {
  transition: opacity 0.15s ease;
}

.dash-chart-bar:hover {
  opacity: 0.85;
}

.dash-chart-value-label {
  font-size: 11px;
  font-weight: 800;
  fill: var(--text);
}

.dash-chart-axis-label {
  font-size: 10.5px;
  fill: var(--muted);
  text-transform: capitalize;
}

.dash-donut-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.dash-donut {
  flex: 0 0 auto;
  width: 150px;
  height: 150px;
}

.dash-donut-total {
  font-size: 26px;
  font-weight: 900;
  fill: var(--navy);
}

.dash-donut-total-label {
  font-size: 10.5px;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dash-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  flex: 1 1 160px;
}

.dash-legend li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.dash-legend li span:last-child {
  color: var(--muted);
  margin-left: auto;
}

.dash-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

@media (max-width: 960px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

.full-span {
  grid-column: 1 / -1;
}

/* Two or more full-width cards on one screen (Valores → Consultas: the
   clinic's consultation catalog above the per-doctor price table). */
.stacked-cards {
  display: grid;
  gap: 18px;
}

/* Visão Geral's growth dashboard (parte 40). */
.growth-dashboard .panel-header {
  flex-wrap: wrap;
}

.growth-metric-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.growth-metric-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.growth-chart {
  width: 100%;
  margin: 6px 0;
}

.growth-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

.growth-point {
  cursor: pointer;
  transition: r 0.1s ease;
}

.growth-point:hover,
.growth-point:focus-visible {
  r: 6;
  outline: none;
}

.growth-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.growth-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.growth-legend-item strong {
  color: var(--text);
}

.integration-panel {
  padding-bottom: 8px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  border-top: 1px solid var(--line);
}

.integration-item {
  min-width: 0;
  padding: 18px 0;
}

.integration-item + .integration-item {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.integration-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.integration-item-head strong,
.integration-item-head small {
  display: block;
}

.integration-item-head strong {
  color: var(--navy);
  font-size: 15px;
}

.integration-item-head small {
  max-width: 440px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.integration-warning,
.integration-error {
  margin: -2px 0 16px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  padding: 10px 12px;
  color: #92400e !important;
  font-size: 13px;
  font-weight: 700;
}

.integration-error {
  border-left-color: var(--rose);
  background: var(--rose-soft);
  color: #9f1239 !important;
}

.quiet-label {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-list .compact-item {
  min-height: 76px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filters input,
.filters select {
  width: auto;
  min-width: 165px;
}

.table-wrap {
  overflow-x: auto;
}

/* Filter and order for every table (app.js: startTableTools). */
.table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
}

.table-filter {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 340px;
  min-width: 190px;
}

.table-filter svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.table-filter-input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.table-filter-input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.table-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-tools .table-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap;
}

.table-tools .table-export svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

th[data-sortable] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th[data-sortable]:hover {
  color: var(--text);
}

th[data-sortable]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.sort-mark {
  display: inline-block;
  min-width: 1ch;
  margin-left: 5px;
  opacity: 0.35;
}

.sort-mark::before {
  content: "↕";
}

th[aria-sort="ascending"] .sort-mark,
th[aria-sort="descending"] .sort-mark {
  color: var(--cyan-dark);
  opacity: 1;
}

th[aria-sort="ascending"] .sort-mark::before {
  content: "↑";
}

th[aria-sort="descending"] .sort-mark::before {
  content: "↓";
}

.table-no-results td {
  padding: 22px 10px;
  color: var(--muted);
  text-align: center;
}

@media print {
  .table-tools,
  .sort-mark {
    display: none;
  }
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 13px;
}

td strong {
  display: block;
  color: var(--navy);
  font-size: 14px;
}

td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.price-proposal-pending {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--amber-soft);
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.mint,
.status-confirmado,
.status-realizado,
.status-ativa,
.status-ativo,
.status-pago {
  background: var(--mint-soft);
  color: var(--mint-dark);
}

.badge.cyan,
.status-pre-agendamento,
.status-em-atendimento,
.status-novo,
.status-trial {
  background: var(--cyan-soft);
  color: var(--cyan-dark);
}

.badge.amber,
.status-reagendado,
.status-pendente,
.status-a-receber,
.status-aberto {
  background: var(--amber-soft);
  color: #92400e;
}

.badge.rose,
.status-cancelado,
.status-faltou,
.status-inativa,
.status-bloqueada,
.status-atrasado {
  background: var(--rose-soft);
  color: #9f1239;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
  padding: 22px;
}

.insight-list,
.activity-list,
.schedule-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.insight-item,
.activity-item,
.schedule-item,
.compact-item {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.insight-item {
  border-left: 4px solid var(--cyan);
}

.insight-item:nth-child(2n) {
  border-left-color: var(--mint);
}

.insight-item:nth-child(3n) {
  border-left-color: var(--amber);
}

.insight-item strong,
.activity-item strong,
.schedule-item strong,
.compact-item strong {
  display: block;
  overflow: hidden;
  color: var(--navy);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-item span,
.activity-item span,
.schedule-item span,
.compact-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.activity-time {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 900;
}

/* Auditoria (plataforma e por clínica) — seletores de drill-down e o
   detalhe expansível de cada evento. */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-row select {
  min-width: 220px;
  flex: 1 1 220px;
}

.audit-toolbar {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.audit-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 320px;
}

.audit-toolbar-filters input[type="search"] {
  flex: 2 1 260px;
  min-width: 200px;
}

.audit-toolbar-filters select {
  flex: 1 1 180px;
  min-width: 160px;
}

.audit-toolbar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.audit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 10px;
}

.audit-item summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.audit-item summary::-webkit-details-marker {
  display: none;
}

.audit-item-detail {
  padding: 0 12px 12px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
  padding-top: 10px;
  font-size: 13px;
}

.audit-summary {
  margin: 0 0 8px;
  font-weight: 700;
}

.audit-meta {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
}

.audit-meta div {
  display: flex;
  gap: 6px;
  font-size: 12.5px;
}

.audit-meta dt {
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.audit-meta dd {
  margin: 0;
  word-break: break-word;
}

.audit-meta-empty {
  color: var(--muted);
  font-size: 12.5px;
  margin: 8px 0 0;
}

.schedule-item {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.schedule-item time {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #e2e8f0;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  align-items: start;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  height: 420px;
  padding: 12px;
}

.kanban-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 14px;
  flex-shrink: 0;
}

.kanban-column-body {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.kanban-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.kanban-card strong {
  color: var(--navy);
}

.kanban-card span {
  color: var(--muted);
  font-size: 13px;
}

.kanban-actions {
  display: flex;
  gap: 7px;
}

.mini-button.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.week-calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.week-calendar-toolbar strong {
  color: var(--navy);
  margin-left: auto;
}

.week-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.week-calendar-day {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  min-height: 220px;
}

.week-calendar-day.is-today {
  border-color: var(--navy);
}

.week-calendar-day header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--navy);
  font-size: 13px;
}

.week-calendar-day-body {
  display: grid;
  gap: 8px;
}

.week-calendar-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.week-calendar-card strong {
  color: var(--navy);
}

.week-calendar-card span {
  color: var(--muted);
  font-size: 12px;
}

.week-calendar-empty {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.origin-bars {
  display: grid;
  gap: 12px;
}

.origin-row {
  display: grid;
  grid-template-columns: 150px minmax(120px, 1fr) 52px;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.origin-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.origin-bar span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field.full-width {
  grid-column: 1 / -1;
}

/* Fields side by side line up at the top: a neighbour's help text never
   stretches this one's input. */
.form-grid > .field {
  align-content: start;
}

.module-access-heading {
  display: grid;
  gap: 4px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--line);
}

.module-access-heading.full-width {
  grid-column: 1 / -1;
}

.module-access-heading strong {
  color: var(--navy);
  font-size: 15px;
}

.module-access-heading small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.module-access-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 12px;
  cursor: pointer;
}

.module-access-option:hover {
  border-color: rgba(6, 182, 212, 0.48);
  background: var(--ice);
}

.module-access-option input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--cyan);
}

.module-access-option > span {
  display: grid;
  gap: 3px;
}

.module-access-option strong {
  color: var(--text);
  font-size: 13px;
}

.module-access-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

/* Doctor schedule modal: a flag per weekday (all visible together) plus a
   pure-CSS, radio-driven tab per day for the actual time ranges — no JS
   wiring needed since openModal never re-renders after it opens, and a
   day's inputs still submit via FormData no matter which tab is active. */
.weekday-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weekday-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}

.weekday-flag input {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: var(--cyan);
}

.schedule-day-switcher {
  margin-top: 4px;
}

.day-tab-panels {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.day-tab-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#scheduleDayTab_sun:checked ~ .day-tab-panels .day-tab-panel[data-day="sun"],
#scheduleDayTab_mon:checked ~ .day-tab-panels .day-tab-panel[data-day="mon"],
#scheduleDayTab_tue:checked ~ .day-tab-panels .day-tab-panel[data-day="tue"],
#scheduleDayTab_wed:checked ~ .day-tab-panels .day-tab-panel[data-day="wed"],
#scheduleDayTab_thu:checked ~ .day-tab-panels .day-tab-panel[data-day="thu"],
#scheduleDayTab_fri:checked ~ .day-tab-panels .day-tab-panel[data-day="fri"],
#scheduleDayTab_sat:checked ~ .day-tab-panels .day-tab-panel[data-day="sat"] {
  display: grid;
}

#scheduleDayTab_sun:checked ~ .schedule-day-tabs label[for="scheduleDayTab_sun"],
#scheduleDayTab_mon:checked ~ .schedule-day-tabs label[for="scheduleDayTab_mon"],
#scheduleDayTab_tue:checked ~ .schedule-day-tabs label[for="scheduleDayTab_tue"],
#scheduleDayTab_wed:checked ~ .schedule-day-tabs label[for="scheduleDayTab_wed"],
#scheduleDayTab_thu:checked ~ .schedule-day-tabs label[for="scheduleDayTab_thu"],
#scheduleDayTab_fri:checked ~ .schedule-day-tabs label[for="scheduleDayTab_fri"],
#scheduleDayTab_sat:checked ~ .schedule-day-tabs label[for="scheduleDayTab_sat"] {
  background: var(--navy);
  color: #ffffff;
}

/* A day without its "Atende neste dia" flag isn't selectable — its radio
   is `disabled` (kept in sync by wireScheduleDayFlags), so the label just
   looks inert; the browser already blocks the click natively. */
#scheduleDayTab_sun:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_sun"],
#scheduleDayTab_mon:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_mon"],
#scheduleDayTab_tue:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_tue"],
#scheduleDayTab_wed:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_wed"],
#scheduleDayTab_thu:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_thu"],
#scheduleDayTab_fri:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_fri"],
#scheduleDayTab_sat:disabled ~ .schedule-day-tabs label[for="scheduleDayTab_sat"] {
  color: var(--muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.modal {
  width: min(820px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.modal-card {
  overflow: auto;
  max-height: min(780px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 20px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h2 {
  color: var(--navy);
  font-size: 21px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* F3.3: the lock screen — narrower than a form modal, darker backdrop, nothing behind it is readable */
.session-lock-modal {
  width: min(420px, calc(100vw - 28px));
}

.session-lock-modal::backdrop {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
}

.session-lock-note {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.access-popover {
  width: min(500px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.access-popover::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.access-popover-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 26px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
}

.access-popover-card h2 {
  margin-top: 7px;
  color: var(--navy);
  font-size: 24px;
}

.access-popover-card > p {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.access-mode-search {
  margin: 4px 0 10px;
}

.access-mode-options {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.access-mode-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  color: var(--navy);
  text-align: left;
}

.access-mode-option:hover,
.access-mode-option:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  outline: none;
}

.access-mode-option strong,
.access-mode-option small {
  display: block;
}

.access-mode-option strong {
  font-size: 15px;
}

.access-mode-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.access-mode-option > span:last-child {
  color: var(--cyan-dark);
  font-size: 21px;
  font-weight: 900;
}

.access-popover-card > .link-button {
  margin-top: 18px;
}

.confirm-popover {
  width: min(420px, calc(100vw - 28px));
}

.confirm-popover-card > p {
  margin-bottom: 0;
}

/* Who continues a conversation the AI is attending (WhatsApp composer). */
.handoff-choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.handoff-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.handoff-choice span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.handoff-choice.is-recommended {
  border-color: var(--mint);
  background: var(--mint-soft);
}

.handoff-choice:hover,
.handoff-choice:focus-visible {
  border-color: var(--mint-dark);
  outline: none;
  box-shadow: 0 0 0 3px var(--mint-soft);
}

.is-search-hidden {
  display: none;
}

.whatsapp-inbox {
  display: grid;
  grid-template-columns: minmax(280px, 348px) minmax(0, 1fr);
  height: clamp(460px, calc(100vh - 250px), 640px);
  height: clamp(460px, calc(100dvh - 250px), 640px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* WhatsApp route: the inbox fills the height under the global header — no
   page title above, no empty space below. Only the conversation list and the
   message history scroll; the composer stays at the bottom of the panel. */
.content-shell.is-whatsapp-route {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 20px 16px;
}

.content-shell.is-whatsapp-route > .page-head {
  display: none;
}

.content-shell.is-whatsapp-route > .work-area {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.content-shell.is-whatsapp-route .whatsapp-inbox {
  flex: 1;
  height: auto;
  min-height: 0;
}

.whatsapp-inbox-sidebar {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.whatsapp-sidebar-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.whatsapp-sidebar-header > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.whatsapp-sidebar-header strong {
  color: var(--navy);
  font-size: 18px;
  line-height: 1.2;
}

.whatsapp-sidebar-actions {
  display: flex;
  gap: 8px;
}

.whatsapp-sidebar-actions .icon-button {
  width: 36px;
  height: 36px;
}

.whatsapp-search-field {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ice);
  padding: 0 11px;
  color: var(--muted);
}

.whatsapp-search-field:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
}

.whatsapp-search-field svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.whatsapp-search-field input {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.whatsapp-conversation-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-sidebar-empty {
  padding: 20px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.whatsapp-conversation-item {
  display: grid;
  width: 100%;
  min-height: 76px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  padding: 12px 8px 12px 14px;
  color: var(--text);
  text-align: left;
}

.whatsapp-conversation-entry:hover .whatsapp-conversation-item {
  background: #f8fafc;
}

.whatsapp-conversation-item:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(6, 182, 212, 0.24);
  outline-offset: -3px;
}

.whatsapp-conversation-entry {
  position: relative;
  display: grid;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  background: #ffffff;
}

.whatsapp-conversation-entry.is-selected {
  border-left-color: var(--cyan);
  background: #ecfeff;
}

.whatsapp-conversation-entry.is-selected .whatsapp-conversation-item,
.whatsapp-conversation-entry.is-selected:hover .whatsapp-conversation-item {
  background: transparent;
}

.whatsapp-conversation-entry.is-menu-open {
  z-index: 3;
}

.whatsapp-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 50%;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 13px;
  font-weight: 900;
}

.whatsapp-conversation-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.whatsapp-conversation-copy-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.whatsapp-conversation-copy-row strong,
.whatsapp-conversation-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-conversation-copy-row strong {
  color: var(--navy);
  font-size: 14px;
}

.whatsapp-conversation-copy-row time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.whatsapp-conversation-preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.whatsapp-conversation-menu-trigger {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.whatsapp-conversation-menu-trigger:hover,
.whatsapp-conversation-menu-trigger[aria-expanded="true"] {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-dark);
}

.whatsapp-conversation-menu-trigger:focus-visible {
  outline: 3px solid rgba(6, 182, 212, 0.24);
  outline-offset: 1px;
}

.whatsapp-conversation-menu-trigger svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.whatsapp-conversation-menu {
  position: absolute;
  z-index: 5;
  top: 50px;
  right: 8px;
  display: grid;
  min-width: 164px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.whatsapp-conversation-menu[hidden] {
  display: none;
}

.whatsapp-conversation-menu button {
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
}

.whatsapp-conversation-menu button:last-child {
  border-bottom: 0;
}

.whatsapp-conversation-menu button:hover {
  background: var(--ice);
}

.whatsapp-conversation-menu button.is-danger:hover {
  background: var(--rose-soft);
  color: var(--danger);
}

/* Generic "⋮" row-actions menu (parte 41) — same dropdown look as the
   WhatsApp conversation menu above, generalized to every table's Ações
   column. position:fixed on purpose: several tables sit inside a
   .table-wrap with overflow-x:auto, which also clips overflow-y per the
   CSS overflow spec, so an absolutely-positioned dropdown could get cut
   off instead of floating over the page — positionActionMenu() computes
   left/top in JS from the trigger's real screen position. */
.action-menu {
  position: relative;
  display: inline-block;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.action-menu-trigger {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
}

.action-menu-trigger:hover,
.action-menu-trigger[aria-expanded="true"] {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-dark);
  border-color: rgba(6, 182, 212, 0.35);
}

.action-menu-trigger svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.action-menu-dropdown {
  position: fixed;
  z-index: 40;
  display: grid;
  min-width: 170px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.action-menu-dropdown[hidden] {
  display: none;
}

.action-menu-dropdown button {
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.action-menu-dropdown button:last-child {
  border-bottom: 0;
}

.action-menu-dropdown button:hover {
  background: var(--ice);
}

.action-menu-dropdown button.is-danger:hover {
  background: var(--rose-soft);
  color: #9f1239;
}

.action-menu-dropdown em {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.whatsapp-thread {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #f6fafb;
}

.whatsapp-thread-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 14px 18px;
}

.whatsapp-thread-contact {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.whatsapp-thread-header-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.whatsapp-owner-toggle {
  display: inline-flex;
  flex-shrink: 0;
  padding: 3px;
  gap: 2px;
  background: var(--cloud, #f1f5f9);
  border-radius: 999px;
  border: 1px solid var(--line);
}

.owner-toggle-option {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  white-space: nowrap;
}

.owner-toggle-option.is-active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.owner-toggle-option:disabled {
  cursor: default;
}

.reengagement-popovers {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: grid;
  gap: 10px;
  max-width: 340px;
}

.reengagement-popover {
  background: #ffffff;
  border: 1px solid var(--amber);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  font-size: 13px;
  color: var(--navy);
}

.reengagement-popover-message {
  margin: 6px 0 10px;
  font-style: italic;
  color: var(--muted, #64748b);
}

.reengagement-popover-actions {
  display: flex;
  gap: 8px;
}

.whatsapp-thread-contact strong,
.whatsapp-thread-contact small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-thread-contact strong {
  color: var(--navy);
  font-size: 15px;
}

.whatsapp-thread-contact small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.whatsapp-thread-state {
  flex-shrink: 0;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-dark);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.whatsapp-contact-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.tag-chip {
  min-height: 20px;
  padding: 0 7px;
  font-size: 10px;
}

.tag-add-button {
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.tag-add-button:hover {
  color: var(--navy);
  border-color: var(--navy);
}

.help-transcription-bar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.help-transcription-bar label {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
}

.help-transcription-bar textarea {
  width: 100%;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px;
  font: inherit;
}

.whatsapp-message-scroll {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.whatsapp-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.whatsapp-date-divider span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.whatsapp-message {
  max-width: min(74%, 620px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 11px 8px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.whatsapp-message.is-inbound {
  align-self: flex-start;
}

.whatsapp-message.is-outbound {
  align-self: flex-end;
  border-color: rgba(16, 185, 129, 0.28);
  background: var(--mint-soft);
}

.whatsapp-message.is-failed {
  border-color: rgba(225, 29, 72, 0.4);
  background: var(--rose-soft);
}

.whatsapp-message p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.whatsapp-audio-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.whatsapp-audio-trigger,
.whatsapp-audio-label {
  display: inline;
  margin: 0;
  border: 0;
  background: transparent;
  color: #087c9c;
  font: inherit;
  font-weight: 850;
}

.whatsapp-audio-trigger {
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.whatsapp-audio-trigger:hover,
.whatsapp-audio-trigger:focus-visible {
  color: #075a73;
}

.whatsapp-audio-card {
  width: min(560px, calc(100vw - 28px));
}

.whatsapp-audio-transcript {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.whatsapp-audio-player {
  display: block;
  width: 100%;
}

.whatsapp-image-card {
  width: min(560px, calc(100vw - 28px));
}

.whatsapp-image-viewer {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
}

.whatsapp-message-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.whatsapp-composer-region {
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 10px 14px 14px;
}

.whatsapp-template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 9px;
}

.whatsapp-template-button {
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--navy);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.whatsapp-template-button:hover {
  border-color: rgba(6, 182, 212, 0.45);
  background: #ecfeff;
}

.whatsapp-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 10px;
}

.whatsapp-composer textarea {
  min-height: 44px;
  max-height: 140px;
  resize: none;
  overflow-y: auto;
  padding: 10px 12px;
}

.whatsapp-send-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
}

.whatsapp-send-button:hover:not(:disabled) {
  background: var(--navy-3);
}

.whatsapp-send-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.whatsapp-send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.whatsapp-thread-empty {
  grid-template-rows: 1fr;
}

.whatsapp-empty-thread {
  display: grid;
  max-width: 460px;
  align-content: center;
  justify-items: center;
  gap: 10px;
  margin: auto;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.whatsapp-empty-thread strong {
  color: var(--navy);
  font-size: 18px;
}

.whatsapp-empty-thread p {
  margin: 0;
  line-height: 1.5;
}

.whatsapp-inbox-disconnected .whatsapp-inbox-sidebar {
  grid-template-rows: auto minmax(0, 1fr);
}

.automation-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.7fr);
  align-items: start;
  gap: 16px;
}

/* Top-level Chatbox/Modo IA picker (parte 44) — only rendered when the
   clinic's plan includes both engines; spans the whole studio since the
   choice drives both the diagram panel and the builder panel below it. */
.automation-engine-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.automation-engine-picker .automation-template-choice {
  min-height: 64px;
}

/* The inactive engine while the other is live (parte 47) — clicking it
   doesn't enter its settings, it asks to switch the live engine first, so
   it reads as "locked" rather than a plain unselected choice. */
.automation-engine-picker .automation-template-choice.is-locked {
  border-style: dashed;
  background: #fafbfc;
  color: var(--muted);
}

.automation-engine-picker .automation-template-choice.is-locked:hover {
  border-color: var(--line-strong);
  background: #fafbfc;
}

.automation-engine-picker .automation-template-choice.is-locked strong {
  color: var(--muted);
}

.automation-program-panel,
.automation-builder-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.automation-panel-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.automation-panel-header h2 {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 20px;
}

.automation-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.automation-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 13px 18px;
}

.automation-flow-header > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.automation-flow-header strong,
.automation-flow-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-flow-header strong {
  color: var(--navy);
  font-size: 15px;
}

.automation-flow-header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.automation-runtime-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
}

.automation-flow-canvas {
  display: grid;
  min-height: 390px;
  align-content: center;
  justify-items: center;
  gap: 10px;
  background: #f7fbfc;
  padding: 20px;
}

.automation-flow-node {
  display: grid;
  width: min(100%, 420px);
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid #64748b;
  border-radius: 7px;
  background: #ffffff;
  padding: 11px 13px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.automation-flow-node strong {
  color: var(--navy);
  font-size: 13px;
}

.automation-flow-node small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.automation-flow-node.is-trigger {
  border-left-color: var(--cyan);
}

.automation-flow-node.is-message {
  border-left-color: var(--mint);
}

.automation-flow-node.is-decision {
  border-left-color: var(--amber);
}

.automation-flow-node.is-branch {
  width: 100%;
  border-left-color: #818cf8;
}

.automation-flow-connector {
  width: 2px;
  height: 18px;
  background: #94a3b8;
}

.automation-branch-grid {
  display: grid;
  width: min(100%, 720px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

/* Modo IA's settings preview (parte 47) — replaces the flow diagram, which
   never fit a motor with no fixed steps. Reuses .automation-flow-canvas for
   the same background/padding/min-height as the diagram it replaces. */
.automation-ia-preview {
  grid-auto-flow: row;
  justify-items: stretch;
  gap: 16px;
  padding: 24px;
}

.automation-ia-greeting {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 16px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.automation-ia-greeting small {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
}

.automation-ia-greeting p {
  margin: 0;
  color: var(--navy);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
}

.automation-ia-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.automation-ia-facts > div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 10px 12px;
}

.automation-ia-facts small {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
}

.automation-ia-facts strong {
  color: var(--navy);
  font-size: 13px;
}

.automation-ia-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.automation-flow-empty {
  display: grid;
  min-height: 390px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  background: #f7fbfc;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.automation-flow-empty strong {
  color: var(--navy);
  font-size: 17px;
}

.automation-flow-empty p {
  max-width: 320px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Small active/paused indicator on each template-picker card (parte 50) —
   the left panel's toggle only ever shows the status of whichever
   automation is currently open, so without this, switching between the 4
   template cards gave no clue which of the real ones (Recepção WhatsApp/
   Confirmação/Pós-atendimento) were already live vs. still a draft. */
.automation-template-status {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.automation-template-status.is-active {
  background: var(--mint);
}

.automation-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px 18px 0;
}

.automation-template-choice {
  position: relative;
  display: grid;
  min-height: 74px;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 10px;
  color: var(--text);
  text-align: left;
}

.automation-template-choice:hover {
  border-color: rgba(6, 182, 212, 0.5);
  background: #f7feff;
}

.automation-template-choice.is-selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
  background: var(--cyan-soft);
}

.automation-template-choice strong {
  color: var(--navy);
  font-size: 12px;
}

.automation-template-choice small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.automation-builder-form {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.automation-builder-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}

.automation-builder-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.automation-builder-fields .field {
  margin: 0;
}

.automation-builder-fields textarea {
  min-height: 96px;
  resize: vertical;
}

/* Modo IA / Chatbox engine-specific fields (parte 44) — which group is
   visible is decided by the top-level picker in automationStudioHtml, not
   by anything inside this form; the other group stays in the DOM (just
   `hidden`) so its saved values are never dropped on submit. */
.automation-mode-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.automation-mode-fields .field {
  margin: 0;
}

.automation-mode-fields textarea {
  min-height: 96px;
  resize: vertical;
}

.automation-enable-toggle {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 10px 12px;
  cursor: pointer;
}

/* A system tag's "automatize or not" switch inside the Tags table (parte
   47) — compact inline version of the same idea, not a full field row. */
.tag-automatic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.tag-automatic-toggle small {
  color: var(--muted);
  font-weight: 650;
}

.automation-enable-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan-dark);
}

.automation-enable-toggle > span {
  display: grid;
  gap: 2px;
}

.automation-enable-toggle strong {
  color: var(--navy);
  font-size: 13px;
}

.automation-enable-toggle small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.automation-builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.automation-builder-readonly {
  display: grid;
  min-height: 250px;
  align-content: center;
  gap: 7px;
  padding: 24px;
  color: var(--muted);
}

.automation-builder-readonly strong {
  color: var(--navy);
}

.automation-builder-readonly p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .integration-grid {
    grid-template-columns: 1fr;
  }

  .automation-studio {
    grid-template-columns: 1fr;
  }

  .integration-item + .integration-item {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .auth-view {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 34px 24px 12px;
  }

  .auth-brand h1 {
    font-size: 32px;
  }

  .login-card {
    margin: 12px 0 34px;
  }

  .app-shell,
  .admin-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: none;
    background: rgba(15, 23, 42, 0.48);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
  }

  .main-shell {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .icon-button.menu-toggle {
    display: grid;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 10px;
    padding: 12px 16px;
  }

  .global-search {
    width: 100%;
    min-width: 0;
  }

  .tenant-selector,
  #logoutButton {
    display: none;
  }

  .content-shell {
    padding: 20px 16px 24px;
  }

  .page-head {
    display: grid;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
  }

  .global-search {
    order: 3;
    flex-basis: 100%;
  }

  .topbar-actions {
    flex: 1;
  }

  .action-button span {
    display: none;
  }

  h1 {
    font-size: 25px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-list {
    grid-template-columns: 1fr;
  }

  .schedule-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .schedule-item .badge {
    grid-column: 2;
    justify-self: start;
  }

  .date-filter {
    width: 100%;
  }

  .date-filter-trigger {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .period-filter-fields {
    grid-template-columns: 1fr;
  }

  .pill-tabs {
    width: 100%;
  }

  .pill-tabs button,
  .pill-tabs label {
    flex: 1;
    padding: 0 8px;
  }

  .origin-row {
    grid-template-columns: 1fr;
  }

  .whatsapp-inbox {
    grid-template-columns: 1fr;
    height: clamp(500px, calc(100vh - 196px), 720px);
    height: clamp(500px, calc(100dvh - 196px), 720px);
    min-height: 0;
  }

  /* Phones: the list and the conversation stack, and the page scrolls. */
  .content-shell.is-whatsapp-route {
    display: block;
    overflow: auto;
    padding: 12px;
  }

  .content-shell.is-whatsapp-route .whatsapp-inbox {
    height: clamp(500px, calc(100dvh - 140px), 760px);
  }

  .whatsapp-inbox-sidebar {
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .whatsapp-thread {
    min-height: 58vh;
  }

  .whatsapp-thread-state {
    display: none;
  }

  .whatsapp-message {
    max-width: 88%;
  }

  .automation-branch-grid {
    grid-template-columns: 1fr;
  }

  .automation-builder-fields {
    grid-template-columns: 1fr;
  }

  .automation-mode-fields {
    grid-template-columns: 1fr;
  }

  .automation-engine-picker {
    grid-template-columns: 1fr;
  }

  .whatsapp-message-scroll {
    padding: 14px;
  }

  .whatsapp-composer-region {
    padding: 10px 12px 12px;
  }
}

/* Printable report document (parte 51) — the .print-report-* classes below
   are the actual document look, shared by two different containers: the
   always-hidden #printReportContainer (direct print, no preview) and
   #reportViewerBody inside the on-screen viewer popover (parte 52) — same
   markup, same styling, one of them just also happens to sit inside
   @media print's "everything else is hidden" swap. Plain print-safe
   styling (serif, black on white, no shadows/gradients) since it's meant
   to be handed to someone on paper, not just looked at on a monitor. */
.print-report {
  display: none;
}

/* Header banner, info grid, section titles and chart all use the app's
   own navy/cyan palette (parte 54, user request) instead of the
   orange/blue of the reference template they sent — same layout idea
   (gradient banner with a logo circle, two-column info block, colored
   section headings, a bar chart), our colors. */
.print-report-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, var(--navy), var(--cyan-dark));
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  color: #ffffff;
}

.print-report-banner-text h1 {
  margin: 0 0 4px;
  color: #ffffff;
  font-size: 22px;
}

.print-report-banner-text p {
  margin: 0;
  max-width: 440px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  line-height: 1.5;
}

.print-report-logo-circle {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  object-fit: cover;
  background: #ffffff;
}

.print-report-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
}

.print-report-infogrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 22px;
}

.print-report-infogrid > div {
  display: grid;
  gap: 2px;
}

.print-report-infogrid-full {
  grid-column: 1 / -1;
}

.print-report-infogrid strong {
  color: var(--cyan-dark);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.print-report-infogrid span {
  color: #0f172a;
  font-size: 13px;
}

.print-report-section-title {
  margin: 0 0 10px;
  border-bottom: 2px solid var(--cyan);
  padding-bottom: 6px;
  color: var(--cyan-dark);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.print-report-chart-wrap {
  margin-bottom: 22px;
  text-align: center;
}

.print-report-chart {
  width: 100%;
  max-width: 480px;
  height: auto;
}

.print-report-chart-axis {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.print-report-chart-bar {
  fill: var(--cyan);
}

.print-report-chart-value {
  fill: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.print-report-chart-label {
  fill: #334155;
  font-size: 11px;
}

.print-report-table {
  width: 100%;
  border-collapse: collapse;
}

.print-report-table th,
.print-report-table td {
  border: 1px solid #94a3b8;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  color: #0f172a;
}

.print-report-table th {
  width: 55%;
  background: #f1f5f9;
  font-weight: 700;
}

/* Auditoria's printed table has 4-5 columns, not the report's 2-column
   key/value layout — the 55% first-column width above would badly squash
   the rest, so a real header row resets it. */
.print-audit-table th {
  width: auto;
}

.print-report-footer {
  margin-top: 24px;
  color: #64748b;
  font-size: 11px;
}

@media print {
  body > *:not(.print-report) {
    display: none !important;
  }

  .print-report {
    display: block !important;
    color: #0f172a;
    font-family: Georgia, "Times New Roman", serif;
  }

  /* Browsers drop background colors on print by default (ink-saving) —
     without this the gradient banner and table header shading print as
     plain white, and the chart bars print unfilled. */
  .print-report * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.report-viewer-popover {
  width: min(560px, calc(100vw - 28px));
}

.report-viewer-body {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
}

/* Questions the Lia had no source for (HumanAttentionRequest). */
.notification-item.is-attention {
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
}

.notification-item.is-attention:not(:disabled):hover {
  background: #fde9a6;
}

.notification-item.attention-topics {
  cursor: default;
  background: var(--ice);
}

.whatsapp-message.has-attention {
  border-color: var(--amber);
}

.whatsapp-message.is-highlighted {
  box-shadow: 0 0 0 3px var(--amber), 0 4px 10px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.3s ease;
}

.whatsapp-attention-mark {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
  border-radius: 6px;
  background: var(--amber-soft);
  color: #92400e;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.whatsapp-attention-mark button {
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: #ffffff;
  color: #92400e;
  padding: 2px 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.whatsapp-attention-mark button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.whatsapp-attention-dot {
  color: var(--amber);
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-message.is-highlighted {
    transition: none;
  }
}

/* WhatsApp composer: emojis, stickers, files. */
.whatsapp-composer.has-tools {
  grid-template-columns: auto minmax(0, 1fr) 44px;
}

.whatsapp-composer-region {
  position: relative;
}

.whatsapp-composer-tools {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.whatsapp-tool-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.whatsapp-tool-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.whatsapp-tool-button:hover,
.whatsapp-tool-button.is-active {
  border-color: var(--line);
  background: var(--ice);
  color: var(--text);
}

.whatsapp-tool-button:focus-visible,
.whatsapp-emoji:focus-visible,
.whatsapp-sticker-button:focus-visible {
  outline: 2px solid var(--cyan, #06b6d4);
  outline-offset: 2px;
}

.whatsapp-composer-input {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.whatsapp-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ice);
  padding: 6px 8px;
  font-size: 0.85rem;
}

.whatsapp-attachment-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-attachment-chip small {
  color: var(--muted);
  white-space: nowrap;
}

.whatsapp-attachment-chip button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.whatsapp-picker {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 12px;
  z-index: 20;
  width: min(420px, calc(100% - 24px));
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.whatsapp-picker-group + .whatsapp-picker-group {
  margin-top: 8px;
}

.whatsapp-picker-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.whatsapp-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 2px;
}

.whatsapp-emoji {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 4px 0;
  font-size: 1.35rem;
  line-height: 1.2;
  cursor: pointer;
}

.whatsapp-emoji:hover {
  background: var(--ice);
}

.whatsapp-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

/* The box's two actions are icon buttons, drawn as buttons (the composer's tool buttons are bare until hovered). */
.whatsapp-picker-actions .whatsapp-tool-button {
  border-color: var(--line);
  background: var(--surface);
}

.whatsapp-tool-button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.whatsapp-tool-button.is-syncing svg {
  animation: whatsapp-tool-spin 1s linear infinite;
}

@keyframes whatsapp-tool-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-tool-button.is-syncing svg { animation: none; }
}

.whatsapp-sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}

.whatsapp-sticker-cell {
  position: relative;
}

.whatsapp-sticker-button {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--ice);
  padding: 4px;
  cursor: pointer;
}

.whatsapp-sticker-button:hover {
  border-color: var(--line-strong);
}

.whatsapp-sticker-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.whatsapp-sticker-star {
  position: absolute;
  bottom: 4px;
  left: 6px;
  color: var(--amber);
  font-size: 0.8rem;
}

.whatsapp-sticker-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  line-height: 1;
  cursor: pointer;
}

.whatsapp-sticker-cell:hover .whatsapp-sticker-remove,
.whatsapp-sticker-remove:focus-visible {
  display: block;
}

.whatsapp-picker-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.whatsapp-sticker {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.whatsapp-file-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.whatsapp-file-line a {
  font-weight: 600;
  word-break: break-all;
}

.whatsapp-file-line small {
  color: var(--muted);
}
