@font-face {
  font-family: "Open Sans";
  src: url("/fonts/open-sans-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --border: #dedede;
  --border-strong: #c7c7c7;
  --text: #333333;
  --muted: #757575;
  --sidebar: #424242;
  --sidebar-deep: #333333;
  --sidebar-text: #bdbdbd;
  --primary: #009688;
  --primary-strong: #00796b;
  --coral: #ff5252;
  --coral-strong: #d32f2f;
  --yellow: #f2b53f;
  --blue: #619bf2;
  --red: #c62828;
  --success: #43a047;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  --shadow-raised: 0 5px 16px rgba(0, 0, 0, 0.14);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  outline-color: var(--primary);
}

button,
summary {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-150%);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  box-shadow: var(--shadow-raised);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 100dvh;
  max-height: 100dvh;
  flex-direction: column;
  overflow-y: auto;
  background: var(--sidebar);
  color: #ffffff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.14);
}

.brand-block {
  display: flex;
  min-height: 80px;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--sidebar-deep);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 4px;
  background: var(--coral-strong);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy strong {
  color: #ffffff;
  font-size: 1rem;
}

.brand-copy span {
  color: #aeb7bd;
  font-size: 0.78rem;
}

.sidebar-profile {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.08);
}

.profile-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.profile-avatar.small {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-color: #d8dee2;
  font-size: 0.78rem;
}

.sidebar-profile strong,
.sidebar-profile span {
  display: block;
}

.sidebar-profile strong {
  font-size: 0.85rem;
}

.sidebar-profile span {
  margin-top: 3px;
  color: #aeb7bd;
  font-size: 0.75rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 159, 89, 0.14);
}

.nav-list {
  display: grid;
  padding: 12px 0;
}

.nav-item,
.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 52px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sidebar-text);
  padding: 0 20px;
  font-size: 0.88rem;
}

.nav-item::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  content: "";
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(0, 0, 0, 0.13);
  color: #ffffff;
}

.nav-item.is-active::before {
  background: var(--primary);
}

.nav-item svg,
button svg,
.data-source svg,
.input-with-icon svg,
.mode-summary svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  margin-right: 6px;
}

.sidebar-footer {
  display: grid;
  gap: 2px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 20px 20px;
  color: #d9dee1;
  font-size: 0.75rem;
}

.sidebar-footer small {
  color: #929ca3;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  padding: 12px 28px;
  box-shadow: 0 1px 4px rgba(28, 36, 40, 0.05);
}

.topbar-title {
  display: grid;
  gap: 3px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.72rem;
}

.breadcrumb strong {
  color: var(--primary-strong);
}

.topbar-actions,
.button-row,
.toolbar,
.report-controls,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pill.ok {
  border-color: rgba(46, 159, 89, 0.25);
  background: #effaf3;
  color: #247c46;
}

.status-pill.warn {
  border-color: rgba(198, 40, 40, 0.2);
  background: #fff3f3;
  color: var(--red);
}

.status-pill.warn .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.icon-button {
  width: 44px;
  padding: 0;
  border-color: var(--border);
  background: var(--surface);
  color: #4b555b;
}

.primary-button {
  padding: 0 16px;
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  padding: 0 14px;
  border-color: var(--border-strong);
  background: var(--surface);
  color: #414a50;
}

.danger-button {
  padding: 0 14px;
  border-color: rgba(198, 40, 40, 0.24);
  background: #fff2f2;
  color: #a61e1e;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.danger-button:hover {
  border-color: var(--red);
  background: #ffe7e7;
  color: var(--red);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.wide {
  width: 100%;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.main {
  min-width: 0;
  padding: 24px 28px 40px;
}

.section {
  display: none;
}

.section.is-active {
  display: grid;
  gap: 20px;
}

.report-toolbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.report-toolbar > div:first-child {
  display: grid;
  gap: 5px;
}

.report-toolbar p,
.panel-heading p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.overline {
  color: var(--coral-strong);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.data-source {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid #efd79e;
  border-radius: 999px;
  background: #fff9ea;
  padding: 0 11px;
  color: #8f6816;
  font-size: 0.73rem;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
}

.field.compact {
  width: min(100%, 220px);
}

.field-inline {
  grid-template-columns: auto 170px;
  align-items: center;
  gap: 9px;
}

.field span {
  color: #59636a;
  font-size: 0.76rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
}

input[readonly] {
  background: #f4f6f7;
  color: #59636a;
  cursor: default;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.11);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  gap: 14px;
}

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

.metric,
.panel,
.system-card,
.connection-status-card,
.login-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  display: grid;
  min-height: 128px;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  overflow: hidden;
  padding: 16px;
}

.metric::after {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--metric-color);
  content: "";
}

.metric-teal { --metric-color: var(--primary); --metric-text-color: var(--primary-strong); }
.metric-coral { --metric-color: var(--coral); --metric-text-color: #a92532; }
.metric-blue { --metric-color: var(--blue); --metric-text-color: #3158b2; }
.metric-yellow { --metric-color: var(--yellow); --metric-text-color: #805800; }
.metric-red { --metric-color: var(--red); --metric-text-color: #9f2020; }

.metric-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric-color) 12%, white);
  color: var(--metric-text-color, var(--metric-color));
}

.metric-icon svg {
  width: 22px;
  height: 22px;
}

.metric-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.metric-copy > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.metric-copy strong {
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.metric-copy small {
  overflow-wrap: anywhere;
  color: var(--metric-text-color, var(--metric-color));
  font-size: 0.68rem;
  font-weight: 700;
}

.analytics-grid {
  display: grid;
  gap: 20px;
}

.analytics-grid-primary {
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.9fr);
}

.analytics-grid-secondary {
  grid-template-columns: minmax(350px, 0.85fr) minmax(0, 1.15fr);
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-action-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.chart-panel {
  min-height: 380px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot.current { background: var(--primary); }
.legend-dot.previous { background: var(--coral); }

.chart-frame {
  position: relative;
  width: 100%;
}

.chart-frame-large {
  height: 300px;
}

.chart-frame-donut {
  width: 190px;
  height: 190px;
  flex: 0 0 190px;
}

.donut-layout {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.donut-legend {
  display: grid;
  min-width: 150px;
  gap: 11px;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.donut-legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.donut-legend-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.operations-panel {
  min-height: 350px;
}

.service-list {
  display: grid;
}

.service-row {
  display: grid;
  min-height: 76px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.service-row:last-child {
  border-bottom: 0;
}

.service-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #eef8f7;
  color: var(--primary);
}

.service-icon svg {
  width: 19px;
  height: 19px;
}

.service-row strong,
.service-row small {
  display: block;
}

.service-row strong {
  font-size: 0.83rem;
}

.service-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.service-state {
  border-radius: 999px;
  background: #effaf3;
  padding: 5px 9px;
  color: #247c46;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.service-row.is-off .service-state {
  background: #fff2f2;
  color: var(--red);
}

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

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: #667178;
  font-size: 0.7rem;
  text-transform: uppercase;
}

td {
  color: #3e474d;
  font-size: 0.8rem;
}

tbody tr:hover {
  background: #fafcfc;
}

.customer-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.customer-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: #e6f5f3;
  color: var(--primary-strong);
  font-size: 0.7rem;
  font-weight: 800;
}

.contact-avatar-frame {
  position: relative;
  overflow: hidden;
}

.contact-avatar-frame > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  background: #e8f6f4;
  padding: 0 9px;
  color: var(--primary-strong);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: capitalize;
}

.badge.off,
.badge.status-novo {
  background: #eef1f3;
  color: #606a70;
}

.badge.status-encaminhado {
  background: #fff5de;
  color: #8b6516;
}

.badge.status-atendimento {
  background: #edf2ff;
  color: #3d60b8;
}

.badge.status-concluido {
  background: #eaf8ef;
  color: #247c46;
}

.badge.status-conectado {
  background: #eaf8ef;
  color: #247c46;
}

.badge.status-aguardando-qr {
  background: #fff5de;
  color: #8b6516;
}

.badge.status-desconectado {
  background: #eef1f3;
  color: #606a70;
}

.table-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px 220px;
  align-items: end;
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #8b959b;
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 40px;
}

.settings-panel {
  max-width: 1080px;
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  border: 0;
  margin: 0 0 18px;
  padding: 0;
}

.mode-option {
  position: relative;
  display: grid;
  min-height: 190px;
  align-content: start;
  gap: 8px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  padding: 22px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mode-option:hover {
  border-color: #9dcfc9;
}

.mode-option:has(input:checked) {
  border-color: var(--primary);
  background: #f6fcfb;
  box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.08);
}

.mode-option input {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.mode-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #e9f7f5;
  color: var(--primary);
}

.mode-icon svg {
  width: 22px;
  height: 22px;
}

.mode-option strong {
  margin-top: 5px;
  font-size: 1rem;
}

.mode-option small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.recommended-label {
  position: absolute;
  top: -11px;
  left: 18px;
  border-radius: 999px;
  background: var(--coral-strong);
  color: #ffffff;
  padding: 4px 9px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mode-summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  border-left: 3px solid var(--primary);
  background: #eef8f7;
  color: #405057;
  padding: 11px 14px;
  font-size: 0.8rem;
}

.panel-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

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

.single-field-row {
  grid-template-columns: minmax(260px, 420px);
}

.responses-list,
.team-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.response-item,
.team-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  background: var(--surface-soft);
  padding: 14px;
}

.response-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.team-item {
  grid-template-columns: minmax(220px, 1.35fr) minmax(140px, 0.8fr) minmax(130px, 0.65fr) minmax(100px, 0.55fr) auto auto;
  align-items: center;
  border-left-color: var(--coral);
  background: #ffffff;
}

.department-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}

.department-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #30383d;
}

.field-span-all {
  grid-column: 1 / -1;
}

.team-person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.team-person strong,
.team-person small,
.team-meta span,
.team-meta strong {
  display: block;
}

.team-person div,
.team-meta {
  min-width: 0;
}

.team-person strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.team-person small,
.team-meta span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.team-meta strong {
  margin-top: 3px;
  color: #30383d;
  font-size: 0.82rem;
}

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

/* Botões de ação da equipe: mesma altura (38px) e cantos suaves para alinhar. */
.team-disconnect-button {
  display: inline-flex;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(198, 40, 40, 0.22);
  border-radius: 9px;
  background: var(--surface);
  color: #b3261e;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  padding: 0 14px;
  transition: 0.15s ease;
}

.team-disconnect-button:hover:not(:disabled) {
  border-color: rgba(198, 40, 40, 0.55);
  background: #fdecec;
}

.team-disconnect-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.team-disconnect-button svg {
  width: 16px;
  height: 16px;
}

/* Ícones de editar/excluir alinhados aos 38px do Desconectar. */
.team-actions .icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 9px;
}

.team-presence {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border-radius: 4px;
  padding: 0 11px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
}

.team-presence svg {
  width: 15px;
  height: 15px;
}

.team-presence.is-online {
  border: 1px solid rgba(36, 124, 70, 0.22);
  background: #eaf8ef;
  color: #247c46;
}

.team-presence.is-offline {
  border: 1px solid rgba(198, 40, 40, 0.22);
  background: #fdecec;
  color: #a22222;
}

.danger-icon {
  border-color: rgba(198, 40, 40, 0.2);
  color: var(--red);
}

.toggle-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  color: #59636a;
  font-size: 0.76rem;
  font-weight: 700;
}

.toggle-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.connection-summary {
  display: flex;
  align-items: stretch;
  gap: 20px;
}

.connection-status-card {
  display: grid;
  min-width: 330px;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.connection-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: #eef8f7;
  color: var(--primary);
}

.connection-icon svg {
  width: 26px;
  height: 26px;
}

.connection-status-card span,
.connection-status-card strong,
.connection-status-card small {
  display: block;
}

.connection-status-card span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.connection-status-card strong {
  margin: 3px 0;
  font-size: 1.1rem;
}

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

.connection-toolbar {
  flex: 1;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 20px;
}

.qr-box {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  max-width: 350px;
  place-items: center;
  border: 1px dashed #aeb8be;
  border-radius: 4px;
  background: #ffffff;
  margin-bottom: 16px;
}

.qr-box img {
  width: min(90%, 320px);
  height: auto;
  image-rendering: crisp-edges;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.qr-placeholder svg {
  width: 52px;
  height: 52px;
  color: #a6b0b6;
}

.qr-placeholder.is-connected {
  color: var(--primary-strong);
}

.qr-placeholder.is-connected svg {
  color: var(--success);
}

.qr-placeholder small {
  color: var(--muted);
  font-size: 0.76rem;
}

.empty-inline {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.diagnostic-details {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.diagnostic-details summary {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.diagnostic {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  border-radius: 4px;
  background: #20272b;
  color: #d9e1e4;
  padding: 14px;
  white-space: pre-wrap;
  font-size: 0.72rem;
  line-height: 1.5;
}

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

.system-card {
  display: grid;
  min-height: 112px;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.system-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
}

.system-icon.teal { background: #e8f6f4; color: var(--primary); }
.system-icon.coral { background: #fff0f0; color: var(--coral-strong); }

.system-card span,
.system-card strong,
.system-card small {
  display: block;
}

.system-card > div > span,
.system-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.system-card strong {
  margin: 3px 0;
  font-size: 1.15rem;
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  background: var(--surface);
}

.login-visual {
  display: grid;
  min-height: 100dvh;
  align-items: end;
  overflow: hidden;
  background: var(--sidebar);
  padding: 64px;
}

.login-visual-content {
  display: grid;
  max-width: 560px;
  gap: 20px;
  color: #ffffff;
}

.login-visual-content > span {
  color: #9ad9d3;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-visual-content > strong {
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 1.12;
}

.login-chart-bars {
  display: flex;
  height: 160px;
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0 12px;
}

.login-chart-bars i {
  width: min(44px, 10%);
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}

.login-chart-bars i:nth-child(1) { height: 34%; }
.login-chart-bars i:nth-child(2) { height: 52%; }
.login-chart-bars i:nth-child(3) { height: 43%; }
.login-chart-bars i:nth-child(4) { height: 69%; background: var(--coral); }
.login-chart-bars i:nth-child(5) { height: 58%; }
.login-chart-bars i:nth-child(6) { height: 82%; background: var(--yellow); }
.login-chart-bars i:nth-child(7) { height: 94%; background: var(--coral); }

.login-card {
  align-self: center;
  justify-self: center;
  width: min(100% - 40px, 430px);
  border: 0;
  padding: 38px;
  box-shadow: none;
}

.login-brand {
  min-height: auto;
  margin-bottom: 42px;
  background: transparent;
  padding: 0;
}

.login-brand .brand-copy strong {
  color: var(--text);
}

.login-brand .brand-copy span {
  color: var(--muted);
}

.login-heading {
  display: grid;
  gap: 7px;
  margin-bottom: 28px;
}

.login-heading p {
  color: var(--muted);
  font-size: 0.84rem;
}

.login-card .field {
  margin-bottom: 15px;
}

.form-error {
  min-height: 24px;
  margin-top: 10px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: min(360px, calc(100vw - 40px));
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  background: #252c30;
  color: #ffffff;
  padding: 13px 15px;
  box-shadow: var(--shadow-raised);
  font-size: 0.8rem;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(21, 27, 31, 0.42);
  padding: 18px;
}

.modal-sheet {
  width: min(100%, 640px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-raised);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

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

.modal-toggle {
  grid-column: 1 / -1;
}

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

@media (max-width: 1320px) {
  .metric-grid-five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar > .brand-block {
    justify-content: center;
    padding: 16px 10px;
  }

  .sidebar .brand-copy,
  .sidebar-profile > div:last-child,
  .nav-item span,
  .sidebar-footer {
    display: none;
  }

  .sidebar-profile {
    justify-content: center;
    padding: 18px 8px;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item svg {
    margin-right: 0;
  }

  .analytics-grid-primary,
  .analytics-grid-secondary {
    grid-template-columns: 1fr;
  }

  .filter-toolbar {
    grid-template-columns: minmax(240px, 1fr) 190px 190px;
  }
}

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

  .sidebar {
    position: sticky;
    z-index: 30;
    min-height: auto;
    max-height: none;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar > .brand-block,
  .sidebar-profile,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: thin;
  }

  .nav-item {
    width: auto;
    min-width: 74px;
    min-height: 62px;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 3px;
    padding: 7px 10px;
    font-size: 0.62rem;
  }

  .nav-item span {
    display: block;
    white-space: nowrap;
  }

  .nav-item::before {
    inset: auto 0 0;
    width: auto;
    height: 3px;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .topbar {
    top: 62px;
    min-height: 68px;
    padding: 10px 16px;
  }

  .workspace,
  .topbar,
  .main {
    min-width: 0;
    width: 100%;
    max-width: 100vw;
  }

  .breadcrumb,
  .user-chip,
  .status-pill {
    display: none;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .main {
    padding: 18px 16px 32px;
  }

  .report-toolbar,
  .connection-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .report-controls {
    justify-content: space-between;
  }

  .metric-grid-five,
  .mode-selector,
  .form-grid,
  .modal-grid,
  .automation-status-grid,
  .qr-layout {
    grid-template-columns: 1fr;
  }

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

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

  .response-header,
  .team-item {
    grid-template-columns: 1fr;
  }

  .team-actions,
  .response-header .icon-button {
    justify-self: end;
  }

  .connection-status-card {
    min-width: 0;
  }

  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-card {
    min-height: 100dvh;
    align-content: center;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.25rem;
  }

  .topbar {
    gap: 10px;
  }

  .metric-grid-five,
  .filter-toolbar {
    grid-template-columns: 1fr;
  }

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

  .field.compact {
    width: 100%;
  }

  .field-inline {
    grid-template-columns: 1fr;
  }

  .report-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .data-source {
    align-self: flex-start;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-action-group,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-action-group .primary-button,
  .panel-action-group .secondary-button,
  .modal-actions .primary-button,
  .modal-actions .secondary-button {
    width: 100%;
  }

  .panel-heading .secondary-button,
  .panel-heading .primary-button {
    align-self: flex-start;
  }

  .chart-legend {
    flex-wrap: wrap;
  }

  .chart-frame-large {
    height: 260px;
  }

  .donut-layout {
    align-items: center;
    flex-direction: column;
  }

  .button-row,
  .connection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row button,
  .connection-toolbar button {
    width: 100%;
  }

  .login-card {
    width: 100%;
    padding: 28px 20px;
  }
}

/* Admin-IO alignment pass: narrow alternative sidebar, Material cards, and simple sign-in. */
:root {
  --nav-width: 150px;
  --topbar-height: 80px;
  --material-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.23);
  --material-shadow-raised: 0 3px 10px rgba(0, 0, 0, 0.22);
}

body {
  background: #f3f3f3;
  font-size: 14px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 400;
}

h2 {
  font-size: 1.12rem;
  font-weight: 400;
}

.app-shell {
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}

.sidebar {
  width: var(--nav-width);
  min-width: var(--nav-width);
  background: var(--sidebar);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.2);
}

.sidebar-profile {
  min-height: 154px;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 24px 10px;
  border-bottom: 0;
  background: transparent;
  text-align: center;
}

.sidebar-profile .profile-avatar:not(.small) {
  width: 80px;
  height: 80px;
  flex-basis: 80px;
  border: 0;
  background: var(--primary);
  box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.2);
  font-size: 1.2rem;
}

.sidebar-profile strong {
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 600;
}

.nav-list {
  padding: 0;
}

.nav-item {
  min-height: 88px;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 13px 10px;
  color: #bdbdbd;
  font-size: 0.82rem;
  font-weight: 400;
  text-align: center;
}

.nav-item svg {
  width: 30px;
  height: 30px;
  margin-right: 0;
  color: #ffffff;
  stroke-width: 1.8;
}

.nav-item span {
  white-space: normal;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(0, 0, 0, 0.1);
  color: #ffffff;
}

.nav-item.is-active::before {
  background: var(--primary);
}

.sidebar-footer {
  display: none;
}

.workspace,
.main {
  background: #f3f3f3;
}

.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  border-bottom: 0;
  background: #ffffff;
  padding: 0 28px;
  box-shadow: var(--material-shadow);
}

.topbar-title {
  gap: 2px;
}

.topbar-title h1 {
  color: #333333;
  font-size: 1.5rem;
  font-weight: 400;
}

.breadcrumb {
  font-size: 0.75rem;
}

.icon-button {
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
}

.icon-button:hover {
  border-color: transparent;
  background: #f5f5f5;
  color: var(--primary-strong);
}

.primary-button,
.secondary-button,
.danger-button {
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: none;
}

.primary-button {
  box-shadow: 0 2px 5px rgba(0, 150, 136, 0.24);
}

.primary-button:hover {
  box-shadow: 0 3px 9px rgba(0, 121, 107, 0.26);
}

.secondary-button {
  border-color: #dedede;
}

.main {
  padding: 20px;
}

.report-toolbar {
  min-height: 56px;
  margin-bottom: -2px;
}

.metric,
.panel,
.system-card,
.connection-status-card,
.login-card {
  border: 0;
  border-radius: 3px;
  box-shadow: var(--material-shadow);
}

.metric {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  grid-template-columns: none;
  gap: 8px;
  padding: 18px 14px;
  text-align: center;
}

.metric::after {
  display: none;
}

.metric-icon {
  width: 56px;
  height: 44px;
  margin: 0 auto;
  border-radius: 0;
  background: transparent;
  color: var(--metric-color);
}

.metric-icon svg {
  width: 34px;
  height: 34px;
}

.metric-copy {
  gap: 5px;
}

.metric-copy > span {
  color: #757575;
  font-size: 0.78rem;
  font-weight: 400;
}

.metric-copy strong {
  color: var(--metric-text-color, var(--metric-color));
  font-size: 1.85rem;
  font-weight: 600;
}

.metric-copy small {
  color: #8d8d8d;
  font-size: 0.72rem;
  font-weight: 600;
}

.panel {
  padding: 20px;
}

.panel-heading {
  margin-bottom: 18px;
}

.panel-heading h2 {
  color: #333333;
  font-size: 1.14rem;
  font-weight: 400;
}

.overline {
  color: var(--coral);
  font-size: 0.68rem;
  font-weight: 700;
}

.chart-panel,
.operations-panel {
  min-height: 360px;
}

table {
  background: #ffffff;
}

th,
td {
  padding: 12px 10px;
}

th {
  background: #fafafa;
  color: #757575;
  font-weight: 700;
}

.status-pill,
.data-source,
.service-state,
.badge,
.department-badge,
.owner-tag {
  border-radius: 3px;
}

input,
select,
textarea {
  border-radius: 0;
}

.login-screen {
  min-height: 100dvh;
  grid-template-columns: 1fr;
  place-items: start center;
  background: #f3f3f3;
}

.login-screen::before {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  background: var(--primary);
  content: "";
}

.login-visual {
  display: none;
}

.login-card {
  width: min(calc(100% - 32px), 420px);
  min-height: 0;
  align-self: start;
  justify-self: center;
  margin: 86px auto 0;
  background: #ffffff;
  padding: 34px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 11px;
  margin-bottom: 28px;
  text-align: center;
}

.login-brand .brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary);
  font-size: 1.15rem;
}

.login-brand .brand-copy strong {
  font-size: 1.04rem;
  font-weight: 600;
}

.login-heading {
  gap: 6px;
  margin-bottom: 24px;
  text-align: center;
}

.login-heading h1 {
  font-size: 1.25rem;
}

.login-card .primary-button.wide {
  min-height: 48px;
}

.modal-sheet {
  border: 0;
  border-radius: 3px;
  box-shadow: var(--material-shadow-raised);
}

@media (max-width: 1320px) {
  .metric-grid-five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: sticky;
    z-index: 30;
    width: 100%;
    min-width: 0;
    min-height: auto;
    max-height: none;
    overflow: hidden;
  }

  .sidebar-profile,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-item {
    width: auto;
    min-width: 82px;
    min-height: 64px;
    flex: 0 0 auto;
    gap: 4px;
    padding: 7px 10px;
    font-size: 0.68rem;
  }

  .nav-item svg {
    width: 22px;
    height: 22px;
  }

  .nav-item::before {
    inset: auto 0 0;
    width: auto;
    height: 3px;
  }

  .topbar {
    top: 64px;
    height: auto;
    min-height: 68px;
    padding: 10px 16px;
  }

  .main {
    padding: 18px 16px 32px;
  }

  .metric-grid-five,
  .mode-selector,
  .form-grid,
  .modal-grid,
  .automation-status-grid,
  .qr-layout {
    grid-template-columns: 1fr;
  }

  .login-card {
    margin-top: 54px;
  }
}

@media (max-width: 560px) {
  .panel {
    padding: 16px;
  }

  .metric {
    min-height: 118px;
  }

  .metric-copy strong {
    font-size: 1.55rem;
  }

  .login-card {
    width: min(calc(100% - 24px), 420px);
    padding: 28px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Detalhes da conversa (log estilo terminal) ---------- */

.conversation-row {
  cursor: pointer;
}

.conversation-row:hover td {
  background: #f2f6fb;
}

.conversation-details-sheet {
  width: min(720px, calc(100vw - 32px));
}

.conversation-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px 18px;
  margin: 4px 0 16px;
}

.meta-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.meta-item strong {
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.chatlog {
  max-height: 340px;
  overflow-y: auto;
  border-radius: 12px;
  background: #0c1526;
  padding: 14px 16px;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-line {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 1px 0;
  color: #d9e4f5;
}

.log-time {
  color: #5d7ba3;
  white-space: nowrap;
}

.log-msg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-line.log-in .log-msg strong {
  color: #7ddfa9;
}

.log-line.log-out .log-msg strong {
  color: #7cb5ff;
}

@media (max-width: 700px) {
  .log-line {
    grid-template-columns: 1fr;
    gap: 0;
    padding-bottom: 6px;
  }
}

/* Editor de horário de funcionamento (seção Respostas) */
.hours-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.hours-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}
.hours-row .hours-day {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 175px;
  font-weight: 600;
}
/* sobrescreve o input global (width:100%/44px) para caber inline */
.hours-row .hours-day input[type="checkbox"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  flex: 0 0 20px;
  accent-color: var(--primary);
  cursor: pointer;
}
.hours-row input[type="time"] {
  width: 128px;
  flex: 0 0 128px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}
.hours-row .hours-sep { color: var(--muted); }
.hours-row.is-closed { opacity: .72; }
.hours-row.is-closed input[type="time"] { opacity: .45; }
.hours-row .hours-closed-label { color: var(--muted); font-size: .92em; margin-left: auto; font-weight: 600; }
@media (max-width: 640px) {
  .hours-row { flex-wrap: wrap; gap: 10px; }
  .hours-row .hours-day { flex-basis: 100%; }
  .hours-row input[type="time"] { flex: 1 1 40%; width: auto; }
  .hours-row .hours-closed-label { margin-left: 0; }
}

/* Relatório de atividade por atendente (modal) */
.activity-chart { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.activity-bar-row { display: flex; align-items: center; gap: 12px; }
.activity-bar-label { flex: 0 0 64px; font-size: 0.82rem; color: var(--muted); }
.activity-bar-track { flex: 1 1 auto; height: 12px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.activity-bar-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width 0.4s ease; }
.activity-bar-count { flex: 0 0 32px; text-align: right; font-weight: 700; font-size: 0.85rem; }
.activity-note { margin-top: 12px; color: var(--muted); font-size: 0.82rem; }
