:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #38bdf8;
  --topbar-height: 64px;
  --brand: #0ea5e9;
  --brand-dark: #0369a1;
}

html, body { height: 100%; }
body.app-body {
  background: #f1f5f9;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #0ea5e9 140%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand { color: #0f172a; font-weight: 700; letter-spacing: .02em; }

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1030;
}
.app-sidebar .brand {
  color: #fff;
  font-weight: 700;
  padding: 1.25rem 1.25rem .5rem;
  font-size: 1.05rem;
}
.app-sidebar .brand small {
  display: block;
  font-weight: 400;
  color: #94a3b8;
  font-size: .75rem;
  margin-top: .15rem;
}
.app-sidebar .nav-section {
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .08em;
  color: #64748b;
  padding: 1rem 1.25rem .35rem;
}
.app-sidebar .nav-link {
  color: var(--sidebar-text);
  border-radius: 8px;
  margin: 0 .6rem;
  padding: .45rem .75rem;
}
.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
  background: rgba(14, 165, 233, .15);
  color: #fff;
}
.app-sidebar .nav-link.active { box-shadow: inset 3px 0 0 var(--sidebar-active); }

.app-main { margin-left: var(--sidebar-width); min-height: 100vh; }
.app-topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.app-content { padding: 1.5rem; }
.page-title { font-size: 1.35rem; font-weight: 700; color: #0f172a; }
.page-subtitle { color: #64748b; font-size: .9rem; }

.stat-card {
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { color: #64748b; font-size: .85rem; }

.card-soft {
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.badge-status { font-weight: 600; }
.badge-RASCUNHO, .badge-PENDENTE { background: #e2e8f0; color: #334155; }
.badge-EM_PREPARACAO, .badge-NA_FILA { background: #fef3c7; color: #92400e; }
.badge-VALIDADO, .badge-PRONTO { background: #d1fae5; color: #065f46; }
.badge-PROCESSANDO, .badge-ENVIANDO { background: #dbeafe; color: #1e40af; }
.badge-CONCLUIDO, .badge-ENVIADO { background: #bbf7d0; color: #166534; }
.badge-CONCLUIDO_COM_ERROS, .badge-ERRO_ENVIO, .badge-ERRO_VALIDACAO { background: #fecaca; color: #991b1b; }
.badge-CANCELADO { background: #e2e8f0; color: #475569; }

.batch-tabs .nav-link { font-weight: 600; color: #475569; }
.batch-tabs .nav-link.active { color: var(--brand-dark); }

.dropzone {
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: .15s ease;
}
.dropzone.dragover { background: #e0f2fe; border-color: var(--brand); }

.filter-pills .btn { border-radius: 999px; font-size: .8rem; }

.wizard-steps {
  list-style: none;
  display: flex;
  gap: .75rem;
  padding: 0;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
}
.wizard-steps li {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #64748b;
  font-weight: 600;
  font-size: .9rem;
  padding: .45rem .85rem;
  border-radius: 999px;
  background: #e2e8f0;
}
.wizard-steps .wizard-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #94a3b8;
  color: #fff;
  font-size: .8rem;
}
.wizard-steps .is-current {
  background: #e0f2fe;
  color: #0369a1;
}
.wizard-steps .is-current .wizard-num { background: var(--brand); }
.wizard-steps .is-done {
  background: #d1fae5;
  color: #065f46;
}
.wizard-steps .is-done .wizard-num { background: #059669; }

.pick-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding: .85rem 1rem;
  margin: 0 -1px -1px;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 -8px 20px rgba(15, 23, 42, .06);
}

.badge-status-toggle {
  cursor: pointer;
  font-size: .85em;
  font-weight: 600;
}
.badge-status-toggle:hover {
  filter: brightness(0.9);
}

.delivery-page { max-width: 920px; }

.delivery-toolbar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}
.delivery-toolbar .form-control { max-width: 320px; flex: 1; }

.delivery-list-card { overflow: hidden; }
.delivery-list {
  display: flex;
  flex-direction: column;
}
.delivery-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 0;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: background .12s ease;
}
.delivery-item:last-child { border-bottom: 0; }
.delivery-item:hover { background: #f8fafc; }
.delivery-item.is-ok { background: #ecfdf5; }
.delivery-item.is-ok:hover { background: #d1fae5; }

.delivery-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.delivery-item.is-ok .delivery-avatar {
  background: #059669;
  color: #fff;
}
.delivery-info { flex: 1; min-width: 0; }
.delivery-name {
  display: block;
  font-weight: 600;
  color: #0f172a;
}
.delivery-email {
  display: block;
  color: #64748b;
  font-size: .82rem;
}

.delivery-mark {
  flex-shrink: 0;
  min-width: 7.2rem;
  height: 2.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px dashed #94a3b8;
  color: #64748b;
  background: #fff;
}
.delivery-ok-label { display: none; }
.delivery-item.is-ok .delivery-wait-label { display: none; }
.delivery-item.is-ok .delivery-ok-label { display: inline; }
.delivery-item.is-ok .delivery-mark {
  border: 0;
  background: #059669;
  color: #fff;
}

.delivery-progress .progress { height: .7rem; border-radius: 999px; background: #e2e8f0; }
.delivery-savebar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: .9rem 1.15rem;
  margin-top: 1rem;
  box-shadow: 0 -10px 30px rgba(15, 23, 42, .08);
}
.btn-save-dirty {
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .25);
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: .2s; }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
}
