:root {
  color-scheme: dark;
  --bg: #182235;
  --surface: #263149;
  --surface-2: #202a40;
  --surface-3: #303b55;
  --text: #d7dce7;
  --muted: #aab2c2;
  --line: #39465f;
  --accent: #1479ff;
  --accent-2: #44c2e8;
  --green: #20b26b;
  --yellow: #f4ca4d;
  --red: #ef4f6d;
  --shadow: 0 18px 40px rgba(5, 10, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

.login-body {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-panel h1 {
  font-size: 26px;
}

.login-kicker {
  margin-bottom: 5px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-error {
  min-height: 20px;
  color: #ff8aa0;
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1590px, calc(100% - 14px));
  margin: 0 auto;
  padding: 7px 0 28px;
}

.topbar,
.filters,
.panel-heading,
.topbar-actions,
.brand,
.legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  justify-content: space-between;
  min-height: 62px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  background: var(--surface);
  padding: 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  white-space: nowrap;
}

.status-pill.on {
  border-color: rgba(32, 178, 107, 0.45);
  color: #9af2c7;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  filter: brightness(1.08);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.filters {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1.2fr 1.2fr 1.2fr 1.2fr auto;
  margin-bottom: 24px;
  border-radius: 6px;
  background: var(--surface);
  padding: 28px 18px 32px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #29344d;
  color: var(--text);
  padding: 8px 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(20, 121, 255, 0.16);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.kpi-card,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  display: grid;
  gap: 7px;
  min-height: 94px;
  padding: 20px 21px;
}

.kpi-card.span-2 {
  grid-column: span 2;
}

.kpi-card span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.kpi-card strong {
  color: var(--text);
  font-size: 25px;
  line-height: 1.05;
  word-break: break-word;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(340px, 1.4fr) minmax(280px, 0.8fr);
  gap: 20px;
  margin-bottom: 20px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.panel {
  padding: 20px;
}

.panel.tall {
  grid-row: span 2;
  min-height: 324px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading.split {
  margin-bottom: 12px;
}

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

.form-grid .full,
.form-grid .button {
  grid-column: 1 / -1;
}

.generated-link,
.code-block {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1e283d;
  color: var(--text);
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

#testVisitButton {
  margin-top: 12px;
  width: 100%;
}

.chart {
  display: grid;
  min-height: 225px;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  align-items: end;
  gap: 10px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 8px 0;
}

.bar {
  display: grid;
  align-items: end;
  gap: 6px;
  min-width: 0;
}

.bar-fill {
  min-height: 4px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.bar span {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 14px;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-item strong {
  display: block;
  margin-bottom: 3px;
}

.list-item span,
.payment-total span {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  align-self: start;
  border-radius: 999px;
  background: #1f2a40;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.payment-total {
  display: grid;
  min-height: 170px;
  place-items: center;
  text-align: center;
}

.payment-total strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.legend {
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 999px;
}

.dot.pix {
  background: var(--accent);
}

.dot.cartao {
  background: var(--accent-2);
}

.dot.boleto {
  background: var(--yellow);
}

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

.approval {
  display: grid;
  gap: 12px;
}

.approval-row {
  display: grid;
  grid-template-columns: 1fr 54px auto;
  align-items: center;
  gap: 12px;
}

.ring {
  --value: 0deg;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: conic-gradient(var(--accent) var(--value), #151e31 0);
  box-shadow: inset 0 0 0 4px #151e31;
}

.approval-row strong {
  justify-self: end;
}

.connection-list {
  display: grid;
  gap: 12px;
}

.connection-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

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

.connection-row span {
  color: var(--muted);
}

.connection-row strong {
  justify-self: end;
  border-radius: 999px;
  background: #1f2a40;
  color: var(--text);
  font-size: 12px;
  padding: 5px 9px;
  white-space: nowrap;
}

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

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

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 18px, 1590px);
  }

  .topbar,
  .brand,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 16px;
  }

  .filters,
  .kpi-grid,
  .dashboard-grid,
  .tools-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card.span-2 {
    grid-column: auto;
  }

  .panel.tall {
    grid-row: auto;
  }

  .button {
    width: 100%;
  }
}
