:root {
  color-scheme: light;
  --bg: #f1f2f3;
  --surface: #ffffff;
  --surface-soft: #f7f8f9;
  --border: #dfe3e6;
  --border-strong: #cbd1d5;
  --text: #24292d;
  --muted: #6f7a81;
  --sidebar: #3d4144;
  --sidebar-deep: #34383b;
  --sidebar-text: #c8ced2;
  --primary: #007f75;
  --primary-strong: #00685f;
  --coral: #ff5252;
  --coral-strong: #b92f3a;
  --yellow: #f2b53f;
  --blue: #4f7df3;
  --red: #c62828;
  --success: #2e9f59;
  --shadow: 0 2px 8px rgba(28, 36, 40, 0.09);
  --shadow-raised: 0 10px 30px rgba(28, 36, 40, 0.14);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: "Open Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", 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: 92px;
  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-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;
}

.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(150px, 1fr) minmax(160px, 1fr) minmax(180px, 1fr) auto auto;
  align-items: end;
}

.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;
}

@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,
  .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-item .icon-button,
  .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-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;
  }
}

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