:root {
  --bg: #f6f6f6;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --text: #050505;
  --muted: #7d7d7d;
  --line: #e8e8e8;
  --orange: #ff7300;
  --orange-dark: #d96200;
  --orange-soft: #ffe7db;
  --black: #050505;
  --amber: #b7791f;
  --red: #c24135;
  --green: #166534;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 115, 0, 0.16), rgba(255, 115, 0, 0) 220px),
    var(--black);
  color: #ffffff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 115, 0, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--orange);
  color: #111111;
  font-weight: 800;
}

.brand-logo {
  width: 136px;
  max-width: 58%;
  height: auto;
  display: block;
  object-fit: contain;
}

.brand-block strong,
.brand-block small {
  display: block;
}

.brand-block small {
  color: #bdbdbd;
  margin-top: 2px;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  color: #d8d8d8;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 850;
}

.nav-item::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-block;
  background-color: currentColor;
  mask: var(--nav-icon, url("../assets/icons/settings-sliders.png")) center / contain no-repeat;
  -webkit-mask: var(--nav-icon, url("../assets/icons/settings-sliders.png")) center / contain no-repeat;
}

.nav-item[data-view="overview"] { --nav-icon: url("../assets/icons/settings-sliders.png"); }
.nav-item[data-view="corridas"] { --nav-icon: url("../assets/icons/vehicle.png"); }
.nav-item[data-view="motoristas"] { --nav-icon: url("../assets/icons/vehicle.png"); }
.nav-item[data-view="estafetas"] { --nav-icon: url("../assets/icons/motorcycle.png"); }
.nav-item[data-view="usuarios"] { --nav-icon: url("../assets/icons/user.png"); }
.nav-item[data-view="funcionarios"] { --nav-icon: url("../assets/icons/building.png"); }
.nav-item[data-view="acessos"] { --nav-icon: url("../assets/icons/bell.png"); }
.nav-item[data-view="promocoes"] { --nav-icon: url("../assets/icons/star.png"); }
.nav-item[data-view="certificados"] { --nav-icon: url("../assets/icons/document.png"); }
.nav-item[data-view="rankings"] { --nav-icon: url("../assets/icons/star.png"); }
.nav-item[data-view="feedback"] { --nav-icon: url("../assets/icons/bell.png"); }
.nav-item[data-view="pagamentos"] { --nav-icon: url("../assets/icons/wallet.png"); }
.nav-item[data-view="logs"] { --nav-icon: url("../assets/icons/calendar-clock.png"); }
.nav-item[data-view="configuracoes"] { --nav-icon: url("../assets/icons/settings-sliders.png"); }

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 115, 0, 0.18);
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 4px 0 0 var(--orange);
}

.main-content {
  min-width: 0;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 115, 0, 0.08), rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.topbar h1,
.panel h2,
.login-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 34px;
  font-weight: 900;
}

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

.admin-name {
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.metric-card {
  padding: 18px;
  border-top: 0;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
  font-weight: 900;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}

.panel {
  padding: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 20px;
  font-weight: 900;
}

.search {
  width: min(360px, 100%);
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--surface-2);
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f9fafb;
}

.two-line strong,
.two-line small {
  display: block;
}

.two-line small {
  color: var(--muted);
  margin-top: 3px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: #344054;
}

.badge-pago,
.badge-ativo,
.badge-online,
.badge-concluida,
.badge-definida,
.pill-success {
  color: #7a3500;
  background: #ffedd5;
}

.badge-pendente,
.badge-pendente_validacao,
.badge-em_analise,
.badge-iniciada,
.badge-aceite,
.badge-temporaria {
  color: #92400e;
  background: #fef3c7;
}

.badge-cancelada,
.badge-falhou,
.badge-inativo,
.badge-suspenso,
.badge-rejeitado,
.pill-danger {
  color: #991b1b;
  background: #fee2e2;
}

.badge-aprovado {
  color: #166534;
  background: #dcfce7;
}

.badge-offline,
.pill-muted {
  color: #475467;
  background: #eef2f5;
}

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.10);
}

.btn-primary {
  color: #ffffff;
  background: var(--orange);
  box-shadow: 0 12px 22px rgba(255, 115, 0, 0.20);
}

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

.btn-secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.btn-success {
  color: #ffffff;
  background: var(--green);
}

.btn-danger {
  color: #ffffff;
  background: var(--red);
}

.empty-state,
.alert-error {
  padding: 14px;
  border-radius: 14px;
}

.empty-state {
  background: #f9fafb;
  color: var(--muted);
}

.alert-error,
.error-text {
  color: #991b1b;
}

.success-text {
  color: #7a3500;
  margin: 0;
  font-weight: 700;
}

.alert-error {
  margin-bottom: 12px;
  background: #fee2e2;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 115, 0, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 115, 0, 0.12), transparent 30%),
    #f6f6f6;
}

.login-shell {
  width: min(460px, 100%);
  display: block;
}

.login-panel {
  padding: 30px;
  display: grid;
  gap: 22px;
  border-color: rgba(255, 115, 0, 0.18);
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.14);
}

.login-panel h1 {
  font-size: 36px;
  font-weight: 900;
}

.login-brand {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.login-brand .brand-mark {
  margin-bottom: 8px;
}

.login-logo {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: 6px;
}

.stack {
  display: grid;
  gap: 14px;
}

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

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

.permissions-field {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.permissions-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #ffffff;
  font-weight: 700;
}

.check-card input {
  min-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
}

.login-subform {
  padding: 14px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.login-footer strong {
  color: var(--orange-dark);
}

.link-button {
  border: 0;
  padding: 0;
  justify-self: start;
  color: var(--orange-dark);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 700;
}

input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-2);
}

select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-2);
}

.mt {
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  top: 92px;
  z-index: 10;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #111111;
  background: #ffffff;
  border: 1px solid #fdba74;
  border-left: 5px solid var(--orange);
  box-shadow: 0 18px 38px rgba(16, 24, 40, 0.16);
  font-weight: 700;
}

.toast-error {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.provider-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
  background: #ffffff;
}

.provider-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.switch-row input {
  min-height: 0;
  width: 18px;
  height: 18px;
}

.tab-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 800;
}

.tab-btn.active {
  color: var(--orange-dark);
  border-color: #fdba74;
  background: var(--orange-soft);
}

.modal-wide {
  width: min(860px, 100%);
}

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

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.detail-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.detail-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f2f4f7;
}

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

.detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  min-width: 0;
  word-break: break-word;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

code {
  display: inline-block;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 6px;
  border-radius: 10px;
  background: #f4f4f5;
}

.secret-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #fdba74;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
}

.account-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #fdba74;
  border-left: 5px solid var(--orange);
  border-radius: 14px;
  background: #fff7ed;
  box-shadow: var(--shadow);
}

.account-notice strong,
.account-notice span {
  display: block;
}

.account-notice span {
  color: var(--muted);
  margin-right: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 9, 9, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid rgba(255, 115, 0, 0.28);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.modal-panel.modal-wide {
  width: min(860px, 100%);
}

.icon-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  color: #111111;
  background: var(--orange-soft);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.secret-box p,
.secret-box small {
  margin: 4px 0 0;
  color: var(--muted);
}

.secret-box code {
  max-width: none;
  color: #111111;
  background: #ffffff;
  border: 1px solid #fed7aa;
  font-weight: 800;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    min-width: max-content;
  }

  .metrics-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

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

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

  .secret-box {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-footer {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .main-content {
    padding: 16px;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 24px;
  }
}
