:root {
  --brand: #075a9c;
  --brand-dark: #064777;
  --bg: #f4f7fa;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #75808b;
  --line: #e5ebf0;
  --danger: #c53d4c;
  --homolog: #e5a42b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 10%, rgba(7,90,156,.08), transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(7,90,156,.08), transparent 35%),
    #f5f8fb;
}

.login-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 18px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 50px rgba(15,44,72,.12);
  padding: 36px;
}

.brand-placeholder {
  text-align: center;
  margin-bottom: 25px;
}

.brand-mark {
  font-size: 17px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: .7px;
}

.brand-sub {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
}

.homolog-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 800;
  background: #fff5da;
  color: #8c6200;
  border: 1px solid #f2d78b;
  letter-spacing: .8px;
}

.login-card h1 {
  font-size: 23px;
  margin: 18px 0 5px;
  text-align: center;
}

.login-description {
  margin: 0 0 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  border: 1px solid #cfd8df;
  border-radius: 9px;
  padding: 12px 13px;
  outline: none;
  background: #fff;
}

.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(7,90,156,.10);
}

.primary-btn {
  border: 0;
  width: 100%;
  border-radius: 9px;
  padding: 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

/* FOOTER FLUXIA */

.dev-footer {
  height: 52px;
  border-top: 1px solid rgba(0,0,0,.05);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #9ba3aa;
  gap: 7px;
  font-size: 10px;
  background: rgba(255,255,255,.55);
}

.fluxia-mini {
  font-weight: 700;
  letter-spacing: .2px;
  opacity: .65;
}

.fluxia-mini .ia {
  background: linear-gradient(90deg,#e44baf,#785cff,#18cbd5);
  -webkit-background-clip: text;
  color: transparent;
}

/* PAINEL */

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

.sidebar {
  background: #082f50;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-brand {
  padding: 23px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.sidebar-brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: .3px;
}

.sidebar-brand small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: rgba(255,255,255,.6);
}

.nav {
  padding: 15px 10px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  font-size: 13px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-footer {
  padding: 15px;
  font-size: 9px;
  text-align: center;
  color: rgba(255,255,255,.48);
  border-top: 1px solid rgba(255,255,255,.08);
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 71px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-top: 4px solid var(--unit-color, var(--brand));
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title .group {
  font-size: 10px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: 1px;
}

.topbar-title h2 {
  margin: 3px 0 0;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.user-box {
  text-align: right;
}

.user-box strong {
  display: block;
  font-size: 12px;
}

.user-box small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.logout-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #59636d;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
}

.content {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

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

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

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

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

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

.metric strong {
  display: block;
  font-size: 25px;
  margin-top: 6px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 19px;
}

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

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

.unit-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  overflow: hidden;
}

.unit-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-color);
}

.unit-card strong {
  display: block;
  font-size: 13px;
}

.unit-card span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #2ab673;
  margin-right: 5px;
}

.global-dev-footer {
  min-height: 42px;
  border-top: 1px solid var(--line);
  color: #9aa2aa;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
}

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

  .sidebar-brand strong,
  .sidebar-brand small,
  .nav-item span {
    display: none;
  }

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

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


/* ==========================================================
   LOGOMARCAS OFICIAIS
   ========================================================== */

.login-company-logo {
  display: block;
  width: 100%;
  max-width: 285px;
  max-height: 125px;
  object-fit: contain;
  margin: 0 auto;
}

.sidebar-brand {
  padding: 14px 12px;
}

.sidebar-logo-box {
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
}

.sidebar-company-logo {
  display: block;
  width: 100%;
  max-width: 155px;
  max-height: 62px;
  object-fit: contain;
}

.fluxia-footer-logo {
  display: block;
  width: auto;
  height: 20px;
  max-width: 90px;
  object-fit: contain;
  opacity: .55;
  transition: opacity .2s ease;
}

.fluxia-footer-logo:hover {
  opacity: .8;
}

.dev-footer .fluxia-footer-logo {
  height: 22px;
}

.global-dev-footer .fluxia-footer-logo {
  height: 17px;
  max-width: 76px;
}

/* Mantém a assinatura FluxIA propositalmente discreta */
.dev-footer,
.global-dev-footer {
  gap: 7px;
}

@media (max-width: 900px) {
  .sidebar-logo-box {
    padding: 6px;
    min-height: 55px;
  }

  .sidebar-company-logo {
    max-height: 42px;
  }
}


/* ==========================================================
   ADMINISTRACAO DE UNIDADES
   ========================================================== */

.primary-action-btn {
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary-action-btn:hover {
  background: var(--brand-dark);
}


.unit-admin-summary {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 15px 17px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.summary-item strong {
  display: block;
  margin-top: 5px;
  font-size: 23px;
}


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

.unit-admin-card {
  position: relative;
  display: flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition:
    transform .15s ease,
    box-shadow .15s ease;
}

.unit-admin-card:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 22px rgba(20, 45, 70, .07);
}

.unit-admin-card.inactive {
  opacity: .65;
}

.unit-admin-color {
  width: 6px;
  flex: 0 0 6px;
  background:
    var(--unit-card-color);
}

.unit-admin-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
}

.unit-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.unit-admin-header h3 {
  margin: 4px 0 0;
  font-size: 14px;
}

.unit-code {
  display: inline-block;
  color:
    var(--unit-card-color);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.unit-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.unit-color-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #89929a;
  font-size: 10px;
}

.unit-color-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 800;
}

.status-active {
  background: #e7f7ef;
  color: #168752;
}

.status-inactive {
  background: #f1f1f1;
  color: #777;
}

.unit-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
  padding-top: 12px;
  border-top:
    1px solid var(--line);
}

.action-btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #53606b;
  padding: 7px 9px;
  font-size: 10px;
  cursor: pointer;
}

.action-btn:hover {
  background: #f6f8fa;
}

.warning-action {
  color: #8d6500;
}

.success-action {
  color: #168752;
}

.danger-action {
  color: #b63d49;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 35px;
  text-align: center;
  color: var(--muted);
}


/* MODAL */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    rgba(14, 27, 39, .48);
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 570px;
  background: #fff;
  border-radius: 15px;
  box-shadow:
    0 24px 70px rgba(0,0,0,.22);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 22px 14px;
  border-bottom:
    1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

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

.modal-close {
  border: 0;
  background: transparent;
  color: #8c969f;
  font-size: 27px;
  cursor: pointer;
}

#unitForm {
  padding: 20px 22px 22px;
}

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

.field-full {
  grid-column: 1 / -1;
}

.field select {
  width: 100%;
  border: 1px solid #cfd8df;
  border-radius: 9px;
  padding: 12px 13px;
  outline: none;
  background: #fff;
}

.field select:focus {
  border-color: var(--brand);
  box-shadow:
    0 0 0 3px rgba(7,90,156,.10);
}

.color-field {
  display: flex;
  gap: 8px;
}

.color-field input[type="color"] {
  width: 48px;
  padding: 3px;
  cursor: pointer;
}

.color-field input[type="text"],
.color-field input:not([type]) {
  flex: 1;
}

.form-error {
  min-height: 18px;
  margin-top: 5px;
  color: var(--danger);
  font-size: 11px;
}

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

.secondary-btn,
.save-btn {
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #66717b;
}

.save-btn {
  border: 0;
  background: var(--brand);
  color: #fff;
}


@media (max-width: 850px) {

  .unit-admin-grid {
    grid-template-columns: 1fr;
  }

  .unit-admin-summary {
    grid-template-columns:
      repeat(3, 1fr);
  }

}


@media (max-width: 600px) {

  .unit-admin-summary {
    grid-template-columns: 1fr;
  }

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

  .field-full {
    grid-column: auto;
  }

}


/* ==========================================================
   USUARIOS
   ========================================================== */

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

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th {
  padding: 11px 12px;
  text-align: left;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom:
    1px solid var(--line);
}

.users-table td {
  padding: 13px 12px;
  border-bottom:
    1px solid var(--line);
  font-size: 11px;
  vertical-align: middle;
}

.users-table tbody tr:hover {
  background: #fafbfd;
}

.user-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name-cell strong {
  display: block;
  font-size: 12px;
}

.user-name-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    linear-gradient(
      135deg,
      #075a9c,
      #268fca
    );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.role-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 800;
}

.role-admin {
  background: #efe9ff;
  color: #6143a8;
}

.role-general {
  background: #e8f1ff;
  color: #2660a5;
}

.role-manager {
  background: #fff2db;
  color: #9b6200;
}

.role-attendant {
  background: #e8f7f0;
  color: #168752;
}

.user-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-unit-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.muted {
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.field-hint {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}


@media (max-width: 900px) {

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

}


@media (max-width: 600px) {

  .user-summary {
    grid-template-columns: 1fr;
  }

}


/* ==========================================================
   AJUSTE VISUAL - MODAL DE USUARIOS
   ========================================================== */

#userModal .modal-card {
  max-width: 720px;
  border-radius: 14px;
}

#userModal .modal-header {
  padding: 18px 20px 12px;
}

#userModal .modal-header h2 {
  font-size: 17px;
}

#userModal .modal-header p {
  margin-top: 3px;
  font-size: 10px;
}

#userForm {
  padding: 18px 20px 18px;
}

#userForm .form-grid {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

#userForm .field {
  margin-bottom: 0;
}

#userForm .field label {
  margin-bottom: 5px;
  font-size: 11px;
}

#userForm .field input,
#userForm .field select {
  min-height: 40px;
  padding: 9px 11px;
  font-size: 12px;
  border-radius: 8px;
}

#userForm .field-full {
  grid-column: 1 / -1;
}

#userForm .modal-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

#userForm .secondary-btn,
#userForm .save-btn {
  min-width: 110px;
  padding: 9px 14px;
  font-size: 11px;
}

#userForm .field-hint {
  font-size: 8.5px;
}

/* Unidade e senha ficam lado a lado em telas maiores */
#userForm #unitField {
  grid-column: auto;
}

@media (max-width: 700px) {

  #userModal .modal-card {
    max-width: 95vw;
  }

  #userForm .form-grid {
    grid-template-columns: 1fr;
  }

  #userForm .field-full,
  #userForm #unitField {
    grid-column: auto;
  }

}


/* ==========================================================
   FILA DE ATENDIMENTO
   ========================================================== */

.sound-toggle {
  border: 1px solid var(--line);
  background: #fff;
  color: #5f6a74;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 10px;
  cursor: pointer;
}

.queue-counter {
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff2db;
  color: #9a6505;
  border: 1px solid #f0d293;
  font-size: 10px;
  font-weight: 800;
}

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

.queue-card {
  display: flex;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(20,45,70,.04);
}

.queue-card-accent {
  width: 5px;
  flex: 0 0 5px;
  background:
    var(--queue-unit-color);
}

.queue-card-body {
  flex: 1;
  min-width: 0;
  padding: 15px;
}

.queue-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.queue-protocol {
  color:
    var(--queue-unit-color);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .6px;
}

.queue-card h3 {
  margin: 5px 0 0;
  font-size: 14px;
}

.queue-wait {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff5de;
  color: #996300;
  padding: 5px 7px;
  font-size: 9px;
  font-weight: 700;
}

.queue-client-data {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 13px;
  color: #65717c;
  font-size: 10px;
}

.queue-unit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: #7a858f;
  font-size: 10px;
}

.queue-unit-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.queue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top:
    1px solid var(--line);
}

.queue-status {
  color: #a46c00;
  font-size: 9px;
  font-weight: 700;
}

.queue-accept-btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background:
    var(--queue-unit-color);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.queue-accept-btn:hover {
  filter: brightness(.93);
}

.queue-empty {
  grid-column: 1 / -1;
  min-height: 260px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  padding: 30px;
}

.queue-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #e9f8f1;
  color: #23a36c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  margin-bottom: 12px;
}

.queue-empty strong {
  color: #3d4851;
  font-size: 14px;
}

.queue-empty span {
  max-width: 360px;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.5;
}


@media (max-width: 1100px) {

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

}


@media (max-width: 700px) {

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

}

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


/* ==========================================================
   MODAL - CHAMADO DE TESTE
   ========================================================== */

.test-unit-modal-card {
  max-width: 560px;
}

.test-unit-modal-body {
  padding: 18px 20px 8px;
}

.test-unit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.test-unit-option {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0;
  display: flex;
  align-items: stretch;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition:
    transform .12s ease,
    box-shadow .12s ease,
    border-color .12s ease;
}

.test-unit-option:hover {
  transform: translateY(-1px);
  border-color:
    var(--test-unit-color);
  box-shadow:
    0 6px 18px rgba(20,45,70,.07);
}

.test-unit-option-color {
  width: 6px;
  flex: 0 0 6px;
  background:
    var(--test-unit-color);
}

.test-unit-option-text {
  flex: 1;
  padding: 12px 14px;
}

.test-unit-option-text strong {
  display: block;
  color: #26333d;
  font-size: 12px;
}

.test-unit-option-text small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.test-unit-option-arrow {
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color:
    var(--test-unit-color);
  font-size: 24px;
  font-weight: 300;
}

.test-unit-modal-actions {
  padding: 10px 20px 18px;
  margin-top: 0;
}


/* ==========================================================
   CONVERSAS / CHAT
   ========================================================== */

.conversation-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns:
    310px minmax(0, 1fr);
  overflow: hidden;
  background: #eef3f7;
}

.conversation-list-panel {
  min-width: 0;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.conversation-list-header {
  padding: 18px 16px 12px;
}

.conversation-list-header h1 {
  margin: 0;
  font-size: 17px;
}

.conversation-list-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.conversation-search {
  padding: 0 12px 12px;
}

.conversation-search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7f9fb;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 11px;
  outline: none;
}

.conversation-search input:focus {
  border-color: var(--brand);
}

.conversation-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.conversation-loading,
.conversation-list-empty {
  padding: 30px 15px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.conversation-item {
  position: relative;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0;
  display: flex;
  text-align: left;
  cursor: pointer;
}

.conversation-item:hover {
  background: #f7fafc;
}

.conversation-item.active {
  background: #eef6fb;
}

.conversation-item-accent {
  width: 4px;
  flex: 0 0 4px;
  background:
    var(--conversation-color);
}

.conversation-item-body {
  min-width: 0;
  flex: 1;
  padding: 12px 12px 11px;
}

.conversation-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.conversation-item-top strong {
  min-width: 0;
  font-size: 11px;
  color: #24323d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-top small {
  color: var(--muted);
  font-size: 8.5px;
}

.conversation-item-protocol {
  display: block;
  margin-top: 3px;
  color:
    var(--conversation-color);
  font-size: 8px;
  font-weight: 800;
}

.conversation-item-preview {
  display: block;
  margin-top: 7px;
  color: #6d7882;
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-unit {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  color: #89939b;
  font-size: 8.5px;
}

.conversation-item-unit i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}


.chat-area {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f4f7f9;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.chat-empty-icon {
  font-size: 35px;
  margin-bottom: 10px;
}

.chat-empty strong {
  color: #4f5a63;
  font-size: 14px;
}

.chat-empty span {
  margin-top: 5px;
  font-size: 10px;
}

.chat-header {
  height: 68px;
  flex: 0 0 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-top: 3px solid
    var(--chat-unit-color);
  padding: 9px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chat-customer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    var(--chat-unit-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.chat-header-main h2 {
  margin: 0;
  font-size: 14px;
}

.chat-header-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

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

.chat-protocol {
  border-radius: 999px;
  background: #f3f6f8;
  color: #65727d;
  padding: 6px 8px;
  font-size: 9px;
  font-weight: 800;
}

.chat-action-btn,
.chat-finish-btn {
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 9px;
  font-weight: 700;
}

.chat-action-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #66717a;
}

.chat-finish-btn {
  border: 0;
  background: #218e62;
  color: #fff;
}

.chat-action-btn:disabled,
.chat-finish-btn:disabled {
  opacity: .45;
}


.chat-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) 235px;
}

.chat-messages {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px;
  background:
    linear-gradient(
      rgba(255,255,255,.90),
      rgba(255,255,255,.90)
    ),
    radial-gradient(
      circle at 20% 20%,
      rgba(7,90,156,.06),
      transparent 40%
    );
}

.message-row {
  display: flex;
  margin-bottom: 9px;
}

.message-row.customer,
.message-row.ai {
  justify-content: flex-start;
}

.message-row.human {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 72%;
  border-radius: 11px;
  padding: 8px 10px 6px;
  box-shadow:
    0 1px 2px rgba(0,0,0,.06);
}

.message-row.customer
.message-bubble {
  background: #fff;
  border: 1px solid #e3e8ec;
}

.message-row.ai
.message-bubble {
  background: #f4ecff;
  border: 1px solid #ddcaf7;
}

.message-row.human
.message-bubble {
  background: #dff1ff;
  border: 1px solid #c4e3f7;
}

.message-row.deleted
.message-bubble {
  opacity: .65;
}

.message-sender {
  display: block;
  margin-bottom: 3px;
  color: #65727c;
  font-size: 8px;
  font-weight: 800;
}

.message-content {
  color: #25333d;
  font-size: 10.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-meta {
  margin-top: 4px;
  text-align: right;
  color: #89949c;
  font-size: 7.5px;
}

.no-messages {
  color: var(--muted);
  text-align: center;
  padding: 30px;
  font-size: 10px;
}


.message-composer {
  flex: 0 0 auto;
  min-height: 62px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.composer-tool {
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 8px;
  background: #f2f5f7;
  cursor: pointer;
}

.composer-tool:disabled {
  opacity: .4;
}

.message-composer textarea {
  flex: 1;
  max-height: 110px;
  min-height: 35px;
  resize: none;
  border: 1px solid #d8e0e5;
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  font: inherit;
  font-size: 10.5px;
}

.message-composer textarea:focus {
  border-color: var(--brand);
}

.message-send-btn {
  min-height: 35px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  background:
    var(--chat-unit-color);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}


.customer-sidebar {
  min-width: 0;
  background: #fff;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}

.customer-sidebar-section {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.customer-sidebar-section h3 {
  margin: 0 0 12px;
  font-size: 11px;
}

.customer-info-row {
  margin-bottom: 10px;
}

.customer-info-row span {
  display: block;
  color: var(--muted);
  font-size: 8px;
}

.customer-info-row strong {
  display: block;
  margin-top: 2px;
  color: #394750;
  font-size: 9.5px;
  word-break: break-word;
}


@media (max-width: 1000px) {

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

  .chat-body {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .customer-sidebar {
    display: none;
  }

}


/* ==========================================================
   EDITAR CONTATO NO CHAT
   ========================================================== */

.customer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.customer-section-title h3 {
  margin: 0;
}

.customer-edit-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #5c6872;
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 8px;
  cursor: pointer;
}

.customer-edit-btn:hover {
  background: #f5f8fa;
}

.customer-edit-modal {
  max-width: 620px;
}

#customerForm {
  padding: 18px 20px 20px;
}


/* ==========================================================
   TRANSFERENCIA DE ATENDIMENTO
   ========================================================== */

.transfer-modal-card {
  max-width: 580px;
}

#transferForm {
  padding: 18px 20px 20px;
}

.transfer-current-box {
  position: relative;
  border: 1px solid var(--line);
  background: #f7f9fb;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 15px;
}

.transfer-current-box span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.transfer-current-box strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #2d3b45;
}

.transfer-current-box small {
  display: block;
  margin-top: 3px;
  color: #77838d;
  font-size: 9px;
  font-weight: 700;
}

.transfer-selected-info {
  min-height: 0;
  margin-top: 4px;
}

.transfer-person-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f3f8fb;
  border: 1px solid #d9e7ef;
  border-radius: 9px;
  padding: 10px 12px;
}

.transfer-person-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
}

.transfer-person-preview strong {
  display: block;
  color: #2e3a43;
  font-size: 11px;
}

.transfer-person-preview span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}


/* ==========================================================
   FINALIZAR ATENDIMENTO
   ========================================================== */

.finalize-modal-card {
  max-width: 500px;
}

.finalize-modal-body {
  padding: 24px 28px 10px;
  text-align: center;
}

.finalize-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #e5f6ee;
  color: #1f9b68;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: 900;
}

.finalize-modal-body h3 {
  margin: 0;
  color: #273640;
  font-size: 15px;
}

.finalize-modal-body > span {
  display: block;
  margin-top: 4px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
}

.finalize-modal-body p {
  max-width: 390px;
  margin: 15px auto 0;
  color: #69757e;
  font-size: 10px;
  line-height: 1.6;
}

.finalize-next-step {
  margin-top: 15px;
  border: 1px solid #eee0ad;
  background: #fff9e8;
  color: #80620e;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 9px;
  line-height: 1.45;
}

.finalize-actions {
  padding: 14px 20px 20px;
  margin-top: 0;
}

.finish-confirm-btn {
  border: 0;
  background: #218e62;
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 10px;
  cursor: pointer;
}

.finish-confirm-btn:hover {
  background: #197950;
}

.finish-confirm-btn:disabled,
#confirmTransferBtn:disabled {
  opacity: .55;
  cursor: wait;
}


/* BOTOES DO CABECALHO AGORA ATIVOS */

.chat-action-btn,
.chat-finish-btn {
  cursor: pointer;
}

.chat-action-btn:hover {
  background: #f4f7f9;
}

.chat-finish-btn:hover {
  background: #197950;
}



/* ==========================================================
   AJUSTE FINO DAS IMAGENS NO CHAT
   ========================================================== */

.message-row .message-bubble:has(.message-media-image) {
  padding: 6px;
  width: auto;
  max-width: 300px;
}

.message-media-image {
  width: auto;
  max-width: 280px;
  overflow: hidden;
  border-radius: 9px;
}

.message-media-image a {
  display: block;
  line-height: 0;
}

.message-media-image img {
  display: block;
  width: auto;
  max-width: 280px;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto;
}

.message-media-name {
  max-width: 270px;
  padding: 5px 3px 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: normal;
}



/* ==========================================================
   AJUSTE VISUAL DE DOCUMENTOS / PDF
   ========================================================== */

.message-row .message-bubble:has(.message-document-card) {
  width: auto;
  max-width: 380px;
  padding: 6px;
}

.message-document-card {
  width: 320px;
  max-width: 100%;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 14px;

  border: 1px solid #d9e2e8;
  border-radius: 10px;

  background: #ffffff;

  text-decoration: none !important;
  color: inherit !important;

  box-sizing: border-box;
}

.message-document-card:hover {
  background: #f8fafb;
  border-color: #c9d6de;
}

.message-document-icon {
  width: 42px;
  height: 42px;

  flex: 0 0 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  background: #eef3f7;

  font-size: 20px;
  line-height: 1;
}

.message-document-info {
  min-width: 0;
  flex: 1;

  display: flex;
  flex-direction: column;
  justify-content: center;
}

.message-document-info strong {
  display: block;

  width: 100%;

  color: #263640;

  font-size: 10.5px;
  font-weight: 700;

  line-height: 1.3;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  text-decoration: none !important;
}

.message-document-info small {
  display: block;

  margin-top: 4px;

  color: #7e8992;

  font-size: 8.5px;
  font-weight: 700;

  line-height: 1;
}

.message-document-open {
  width: 28px;
  height: 28px;

  flex: 0 0 28px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 7px;

  background: #f1f4f6;

  color: #68757e;

  font-size: 13px;

  text-decoration: none !important;
}

.message-document-card * {
  text-decoration: none !important;
}


/* PDF com aparência mais clara */

.message-document-card[href*="/media"] .message-document-icon {
  background: #fff1f1;
}


/* Mobile */

@media (max-width: 700px) {

  .message-document-card {
    width: 270px;
  }

}


/* ==========================================================
   IDENTIDADE VISUAL POR TIPO DE DOCUMENTO
   ========================================================== */

/* Base do selo */
.message-document-icon {
  position: relative;
  overflow: hidden;
  font-weight: 900;
  font-size: 0;
}

/* PDF */
.message-document-card .message-document-icon::before {
  content: "DOC";
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .4px;
}

/* Identificação visual pela extensão exibida */
.message-document-card:has(.message-document-info small) {
  --doc-bg: #eef3f7;
  --doc-fg: #52616b;
}

/* PDF */
.message-document-card:has(.message-document-info small:nth-child(2)) .message-document-icon {
  background: var(--doc-bg);
  color: var(--doc-fg);
}

/* O JS já escreve a extensão no <small>.
   Vamos estilizar os casos mais comuns usando classes adicionadas depois
   via atributo data-ext. */


/* PDF */
.message-document-card[data-ext="PDF"] .message-document-icon {
  background: #fff0f0;
  color: #c62828;
}

.message-document-card[data-ext="PDF"] .message-document-icon::before {
  content: "PDF";
}


/* WORD */
.message-document-card[data-ext="DOC"] .message-document-icon,
.message-document-card[data-ext="DOCX"] .message-document-icon {
  background: #eef4ff;
  color: #2457a7;
}

.message-document-card[data-ext="DOC"] .message-document-icon::before,
.message-document-card[data-ext="DOCX"] .message-document-icon::before {
  content: "DOC";
}


/* EXCEL */
.message-document-card[data-ext="XLS"] .message-document-icon,
.message-document-card[data-ext="XLSX"] .message-document-icon,
.message-document-card[data-ext="CSV"] .message-document-icon {
  background: #edf8f1;
  color: #217346;
}

.message-document-card[data-ext="XLS"] .message-document-icon::before,
.message-document-card[data-ext="XLSX"] .message-document-icon::before,
.message-document-card[data-ext="CSV"] .message-document-icon::before {
  content: "XLS";
}


/* TXT */
.message-document-card[data-ext="TXT"] .message-document-icon {
  background: #f3f4f6;
  color: #4b5563;
}

.message-document-card[data-ext="TXT"] .message-document-icon::before {
  content: "TXT";
}


/* PFX / P12 */
.message-document-card[data-ext="PFX"] .message-document-icon,
.message-document-card[data-ext="P12"] .message-document-icon {
  background: #fff7df;
  color: #9a6b00;
  font-size: 18px;
}

.message-document-card[data-ext="PFX"] .message-document-icon::before,
.message-document-card[data-ext="P12"] .message-document-icon::before {
  content: "🔐";
  font-size: 18px;
}


/* Destaque discreto da extensão */
.message-document-info small {
  display: inline-flex;
  align-items: center;
  width: fit-content;

  padding: 3px 6px;
  border-radius: 999px;

  background: #f1f4f6;
  color: #6d7881;

  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: .4px;
}



/* ==========================================================
   GRAVADOR DE AUDIO
   ========================================================== */

.message-composer {
  position: relative;
}

.audio-record-btn {
  transition:
    background .15s ease,
    transform .15s ease;
}

.audio-record-btn.recording {
  background: #ffe8e8;
  color: #c62828;
  transform: scale(1.04);
}

.audio-recording-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 7px;

  min-height: 44px;

  display: flex;
  align-items: center;
  gap: 9px;

  padding: 6px 8px 6px 12px;

  background: #fff;
  border: 1px solid #e1e6ea;
  border-radius: 10px;

  box-shadow:
    0 4px 14px rgba(25,45,60,.10);

  z-index: 20;
}

.audio-recording-bar[hidden] {
  display: none !important;
}

.audio-recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;

  background: #d32f2f;

  animation:
    audioPulse 1s infinite;
}

.audio-recording-bar strong {
  color: #c62828;
  font-size: 10px;
}

#audioRecordingTime {
  color: #596670;
  font-size: 10px;
  font-variant-numeric:
    tabular-nums;
}

.audio-cancel-btn {
  margin-left: auto;

  width: 31px;
  height: 31px;

  border: 0;
  border-radius: 7px;

  background: #f3f5f7;
  color: #6b747c;

  cursor: pointer;
}

.audio-send-btn {
  min-height: 31px;

  border: 0;
  border-radius: 7px;

  padding: 0 11px;

  background: #218e62;
  color: #fff;

  font-size: 9px;
  font-weight: 800;

  cursor: pointer;
}

@keyframes audioPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .3;
  }
}



/* ==========================================================
   CHAT FIXO - MENU / TOPO / COMPOSITOR
   ========================================================== */

html,
body {
  height: 100%;
  overflow: hidden;
}


/* Aplicação ocupa exatamente a tela */
.app-shell {
  height: 100vh;
  overflow: hidden;
}


/* Menu lateral sempre fixo dentro da tela */
.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}


/* Caso o menu fique maior que a tela */
.sidebar .nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}


/* Área principal não rola inteira */
.main-area {
  height: 100vh;
  min-height: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}


/* Cabeçalho superior sempre visível */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;

  flex: 0 0 auto;

  background: #fff;
}


/* Workspace ocupa somente o espaço restante */
.conversation-workspace {
  flex: 1;
  min-height: 0;
  height: auto;

  overflow: hidden;
}


/* Lista esquerda das conversas rola sozinha */
.conversation-list-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}


/* Apenas a lista interna rola */
.conversation-list {
  min-height: 0;
  overflow-y: auto;
}


/* Área direita do chat */
.chat-area {
  height: 100%;
  min-height: 0;

  overflow: hidden;
}


/* Cabeçalho do cliente permanece no topo */
.chat-header {
  position: relative;
  z-index: 20;

  flex: 0 0 auto;
}


/* Corpo ocupa o restante da altura */
.chat-body {
  flex: 1;
  min-height: 0;

  overflow: hidden;
}


/* Coluna central */
.chat-messages {
  height: 100%;
  min-height: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}


/* SOMENTE AS MENSAGENS ROLAM */
.message-list {
  flex: 1;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  overscroll-behavior: contain;
}


/* Campo de mensagem sempre embaixo */
.message-composer {
  position: relative;
  bottom: auto;

  flex: 0 0 auto;

  z-index: 30;

  background: #fff;

  border-top: 1px solid var(--line);
}


/* Lateral de informações rola separadamente */
.customer-sidebar {
  height: 100%;
  min-height: 0;

  overflow-y: auto;
}


/* Rodapé não interfere na altura do chat */
.global-dev-footer {
  flex: 0 0 auto;
}


/* Scroll mais discreto */
.message-list::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar,
.customer-sidebar::-webkit-scrollbar,
.sidebar .nav::-webkit-scrollbar {
  width: 7px;
}

.message-list::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb,
.customer-sidebar::-webkit-scrollbar-thumb,
.sidebar .nav::-webkit-scrollbar-thumb {
  background: rgba(80,100,115,.22);
  border-radius: 20px;
}



/* ==========================================================
   DASHBOARD MACRO POR UNIDADE
   ========================================================== */

.dashboard-unit-card {
  padding: 0 !important;
  overflow: hidden;
  min-height: 125px;
  border-left: 4px solid var(--card-color);
}

.dashboard-unit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;

  padding: 13px 14px 11px;
  border-bottom: 1px solid #edf1f4;
}

.dashboard-unit-header > div {
  min-width: 0;
}

.dashboard-unit-header strong {
  display: block;
  color: #17242d;
  font-size: 11px;
  line-height: 1.25;
}

.dashboard-unit-header span {
  display: block;
  margin-top: 4px;
  color: #77838c;
  font-size: 8.5px;
}

.dashboard-unit-status {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-unit-status .status-dot {
  display: inline-block;
  margin-right: 4px;
}

.dashboard-unit-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-unit-metric {
  padding: 10px 8px;
  text-align: center;
  border-right: 1px solid #edf1f4;
}

.dashboard-unit-metric:last-child {
  border-right: 0;
}

.dashboard-unit-metric span {
  display: block;
  min-height: 22px;
  color: #7b8790;
  font-size: 7.5px;
  line-height: 1.2;
}

.dashboard-unit-metric strong {
  display: block;
  margin-top: 3px;
  color: #17242d;
  font-size: 15px;
  line-height: 1;
}

.dashboard-unit-card:hover {
  box-shadow:
    0 4px 14px rgba(25, 45, 60, .07);
  transform: translateY(-1px);
}

.dashboard-unit-card {
  transition:
    box-shadow .15s ease,
    transform .15s ease;
}

.dashboard-empty {
  padding: 25px;
  color: #7b8790;
  text-align: center;
}


/* Em telas menores */
@media (max-width: 1100px) {

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

  .dashboard-unit-metric {
    border-bottom:
      1px solid #edf1f4;
  }

}



/* ==========================================================
   DASHBOARD - DISTRIBUICAO VISUAL FINAL
   ========================================================== */

/* 5 indicadores alinhados na mesma linha */
.metrics {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
}


/* Todos os indicadores com a mesma altura */
.metrics .metric {
  min-width: 0 !important;
  min-height: 82px !important;
  height: auto !important;

  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;

  padding: 14px 16px !important;
  margin: 0 !important;

  box-sizing: border-box !important;
}


/* Título do indicador */
.metrics .metric span {
  min-height: 17px !important;
  display: flex !important;
  align-items: center !important;

  margin-bottom: 5px !important;
  line-height: 1.2 !important;
}


/* Número */
.metrics .metric strong {
  margin: 0 !important;
  line-height: 1 !important;
}


/* Painel das unidades */
.panel {
  margin-top: 14px !important;
}


/* Unidades: 3 cartões na primeira linha */
.unit-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
}


/* Cartões com tamanho uniforme */
.dashboard-unit-card {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 112px !important;

  margin: 0 !important;

  box-sizing: border-box !important;
}


/* Cabeçalho das unidades mais compacto */
.dashboard-unit-header {
  min-height: 46px !important;

  padding: 10px 12px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}


/* Nome da unidade */
.dashboard-unit-header strong {
  font-size: 10px !important;
  line-height: 1.2 !important;
}


/* Cidade / tipo */
.dashboard-unit-header span {
  margin-top: 3px !important;
  font-size: 7.5px !important;
}


/* Status ativo alinhado no topo direito */
.dashboard-unit-status {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;

  margin-top: 0 !important;

  font-size: 7.5px !important;
}


/* Métricas internas divididas igualmente */
.dashboard-unit-metrics {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  width: 100% !important;
}


/* Cada número interno */
.dashboard-unit-metric {
  min-width: 0 !important;
  min-height: 58px !important;

  padding: 8px 4px !important;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;

  box-sizing: border-box !important;
}


/* Títulos internos */
.dashboard-unit-metric span {
  min-height: 19px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  text-align: center !important;

  font-size: 6.8px !important;
  line-height: 1.15 !important;
}


/* Valores internos */
.dashboard-unit-metric strong {
  margin-top: 4px !important;

  font-size: 14px !important;
  line-height: 1 !important;
}


/* Avaliação fica exatamente alinhada com Concluídos */
.dashboard-unit-metric:last-child span {
  min-height: 19px !important;
}

.dashboard-unit-metric:last-child strong {
  margin-top: 4px !important;
}


/* Em telas médias, mantém boa distribuição */
@media (max-width: 1180px) {

  .metrics {
    grid-template-columns:
      repeat(5, minmax(0, 1fr)) !important;
  }

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

}


/* Em telas pequenas */
@media (max-width: 850px) {

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

  .unit-grid {
    grid-template-columns:
      1fr !important;
  }

}



/* ==========================================================
   LAYOUT - RODAPE FLUXIA SEMPRE VISIVEL
   ========================================================== */

/* A aplicação ocupa exatamente a altura da tela */
.app-shell {
  height: 100vh !important;
  min-height: 100vh !important;
  overflow: hidden !important;
}


/* Área da direita organizada em:
   cabeçalho + conteúdo rolável + rodapé */
.main-area {
  height: 100vh !important;
  min-height: 0 !important;

  display: flex !important;
  flex-direction: column !important;

  overflow: hidden !important;
}


/* Cabeçalho não se move */
.main-area > .topbar {
  flex: 0 0 auto !important;
}


/* Somente o conteúdo central passa a rolar */
.main-area > .content {
  flex: 1 1 auto !important;
  min-height: 0 !important;

  overflow-y: auto !important;
  overflow-x: hidden !important;
}


/* Rodapé da FluxIA permanece visível */
.global-dev-footer {
  flex: 0 0 auto !important;

  position: relative !important;
  bottom: auto !important;

  width: 100% !important;

  min-height: 26px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  box-sizing: border-box !important;

  background: #ffffff !important;
  border-top: 1px solid #e7ebef !important;

  z-index: 20 !important;
}


/* Mantém logo e texto centralizados */
.global-dev-footer span {
  line-height: 1 !important;
}

.global-dev-footer .fluxia-footer-logo {
  max-height: 15px !important;
  width: auto !important;
}


/* Em telas pequenas volta ao comportamento natural */
@media (max-width: 800px) {

  .app-shell {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
  }

  .main-area {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
  }

  .main-area > .content {
    overflow: visible !important;
  }

}



/* LAYOUT SEM CABEÇALHO 1.4.0 */

.main-area > .topbar,
.main-area > header.topbar {
  display: none !important;
}

.sidebar {
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar .nav {
  flex: 1 0 auto;
}

.sidebar-session-panel {
  margin-top: auto;
  padding: 14px 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-session-unit {
  display: block;
  margin: 0 0 9px;
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  text-transform: uppercase;
}

.sidebar-session-panel .homolog-badge {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 9px;
  font-size: 10px;
}

.sidebar-session-panel .user-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0 0 10px;
  color: #fff;
}

.sidebar-session-panel .user-box strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
}

.sidebar-session-panel .user-box small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.sidebar-session-panel .logout-btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-session-panel .logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-session-panel + .sidebar-footer {
  margin-top: 0;
}

@media (max-width: 760px) {
  .sidebar-session-panel {
    padding: 10px 8px;
  }
}


/* CONVERSAS UNIFICADAS 1.5.0 */

.conversation-view-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid #dce4eb;
  background: #fff;
}

.conversation-view-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 5px;
  border: 1px solid #d4dee7;
  border-radius: 8px;
  background: #f7f9fb;
  color: #526171;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.conversation-view-tab.active {
  border-color: #075a9c;
  background: #075a9c;
  color: #fff;
}

.conversation-view-tab span {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 10px;
}

.conversation-view-tab.active span {
  background: rgba(255, 255, 255, 0.2);
}

.conversation-item-protocol {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-unread-badge {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 20px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  text-align: center;
}

