.app-shell { min-height: 100vh; }
.app-shell-no-sidebar .content {
  width: 100%;
}
.sidebar { width: 260px; min-height: 100vh; transition: width 0.2s ease; }
.sidebar.collapsed { width: 80px; }
.sidebar-brand-lockup {
  display: flex;
  align-items: center;
}
.sidebar-brand-lockup h4 {
  margin: 0;
}
.sidebar .nav-link { font-size: 0.95rem; }
.sidebar .nav-link { border-radius: 14px; margin-bottom: 0.35rem; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar.collapsed .nav-link { text-align: center; }
.sidebar.collapsed .nav-link i { display: block; margin: 0 auto 4px; }
.sidebar.collapsed .sidebar-brand h4 { font-size: 1rem; }
.sidebar-backdrop { display: none; }
.content { min-height: 100vh; background: #f8f9fa; }
.content > .container-fluid {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(14, 165, 233, 0.16), transparent 28%),
    linear-gradient(180deg, #0f172a 0%, #111827 55%, #0f172a 100%);
  color: #fff;
  opacity: 1;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.app-splash-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
}
.app-splash-subtitle {
  margin-top: 0.55rem;
  max-width: 360px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.98rem;
}
.login-screen { background: #f1f3f5; }
.status-card { min-width: 140px; }
.admin-hero-card {
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.admin-hero-kicker {
  display: inline-block;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
  font-weight: 700;
}
.admin-glance-card {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  background: rgba(255, 255, 255, 0.92);
  min-height: 100%;
}
.admin-glance-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}
.admin-glance-card strong {
  display: block;
  margin-top: 0.3rem;
  color: #0f172a;
  font-size: 1.7rem;
  line-height: 1;
}
.admin-glance-card-attention {
  border-color: #fecaca;
  background: #fff7ed;
}
.integration-glance-card {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-height: 100%;
}
.integration-glance-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}
.integration-glance-card strong {
  display: block;
  margin-top: 0.35rem;
  color: #0f172a;
  font-size: 1.65rem;
  line-height: 1.1;
}
.integration-glance-card-ok {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}
.integration-glance-card-error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
}
.integration-glance-card-waiting {
  border-color: #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.integration-message-cell {
  min-width: 280px;
}
.presentation-hero-card {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 26px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
}
.presentation-kicker {
  display: inline-block;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
  font-weight: 700;
}
.presentation-subtitle {
  max-width: 760px;
  color: #475569;
  font-size: 1rem;
}
.presentation-metric-card {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-height: 100%;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}
.presentation-metric-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}
.presentation-metric-card strong {
  display: block;
  margin-top: 0.35rem;
  color: #0f172a;
  font-size: 1.55rem;
  line-height: 1.2;
}
.presentation-card {
  border-radius: 24px;
}
.presentation-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 700;
}
.presentation-feature-card,
.presentation-profile-card,
.presentation-flow-card,
.presentation-benefit-card {
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  padding: 1rem;
}
.presentation-feature-card,
.presentation-flow-card,
.presentation-benefit-card {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.presentation-profile-card {
  background: #ffffff;
}
.audit-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.audit-badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}
.audit-badge-primary {
  background: #dbeafe;
  color: #1d4ed8;
}
.audit-badge-warning {
  background: #fef3c7;
  color: #a16207;
}
.audit-badge-muted {
  background: #e5e7eb;
  color: #374151;
}
.bg-purple { background-color: #6f42c1 !important; }
.card { border: none; }
.navbar { position: sticky; top: 0; z-index: 10; }
.print-section { margin-top: 1rem; }
.op-page { max-width: 760px; margin: 0 auto; }
.pwa-install-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 28%),
    linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.08);
}
.pwa-install-panel strong {
  display: block;
  color: #0f172a;
}
.pwa-install-panel p {
  margin: 0.2rem 0 0;
  color: #475569;
  font-size: 0.95rem;
}
.pwa-install-panel-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pwa-install-panel-passive {
  border-color: #cbd5e1;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}
.op-hero {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: #fff;
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.18);
}
.op-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}
.op-card {
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.op-card .form-label {
  font-weight: 600;
  color: #334155;
}
.op-card .form-control,
.op-card textarea {
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid #dbe2ea;
}
.op-card textarea { min-height: 140px; }
.op-submit {
  min-height: 56px;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.16);
}
.op-tip {
  color: #64748b;
  font-size: 0.95rem;
}
.scan-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.scan-actions .form-control {
  flex: 1 1 320px;
}
.scan-panel {
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  background: #f8fafc;
  padding: 0.75rem;
}
.scan-view {
  overflow: hidden;
  border-radius: 14px;
  min-height: 260px;
  background: #0f172a;
}
.scan-status {
  color: #64748b;
  font-size: 0.92rem;
}
.op-secondary-btn {
  min-height: 52px;
  border-radius: 16px;
  font-weight: 600;
}
.op-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.op-summary-card {
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  padding: 0.9rem 1rem;
}
.op-summary-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}
.op-summary-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.45rem;
  color: #0f172a;
}
.op-list {
  border: 1px solid #dbe2ea;
  border-radius: 18px;
  background: #fff;
  padding: 1rem;
}
.op-scanned-list,
.op-pending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.op-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.88rem;
  line-height: 1.2;
}
.op-chip-success {
  background: #dcfce7;
  color: #166534;
}
.op-chip-muted {
  background: #e2e8f0;
  color: #334155;
}
.op-empty {
  color: #64748b;
  font-size: 0.92rem;
}
.op-feedback-success {
  animation: opPulseSuccess 0.5s ease;
}
.op-feedback-error {
  animation: opPulseError 0.45s ease;
}
.barcode-label {
  max-width: 100%;
  height: auto;
}
.print-label-card {
  min-height: 80mm;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 0.4rem;
}
.report-chart-wrap {
  position: relative;
  width: 100%;
}
.report-chart-medium {
  height: 260px;
}
.report-chart-small {
  height: 220px;
}
.report-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.print-label-title {
  font-size: 1.15rem;
  line-height: 1.08;
  margin: 0;
  word-break: break-word;
}
.label-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.label-header-main {
  min-width: 0;
}
.label-brand {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}
.label-volume-box {
  min-width: 4.6rem;
  border: 1px solid #111827;
  padding: 0.35rem 0.5rem;
  text-align: center;
  text-transform: uppercase;
}
.label-volume-box span {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}
.label-volume-box strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}
.label-route-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.label-route-item {
  border: 1px solid #111827;
  min-height: 2.55rem;
  padding: 0.35rem 0.45rem;
  overflow: hidden;
}
.label-route-item span {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}
.label-route-item strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.08;
  word-break: break-word;
}
.label-meta-strip {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid #111827;
  border-bottom: 1px solid #111827;
  padding: 0.25rem 0;
  font-size: 0.66rem;
  line-height: 1.05;
  overflow: hidden;
}
.label-meta-strip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label-barcode-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.print-code-text {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.08;
  text-align: center;
  word-break: break-all;
}
.print-label-card .barcode-label {
  display: block;
}
.role-motorista .content,
.role-cd .content,
.role-loja .content {
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 24%),
    linear-gradient(180deg, #eef2f7 0%, #f8fafc 100%);
}
.is-standalone .navbar {
  padding-top: calc(0.9rem + env(safe-area-inset-top));
}
.is-standalone .sidebar {
  padding-top: env(safe-area-inset-top);
}
.is-standalone.role-motorista .sidebar,
.is-standalone.role-cd .sidebar,
.is-standalone.role-loja .sidebar {
  display: none;
}
.is-standalone.role-motorista .content,
.is-standalone.role-cd .content,
.is-standalone.role-loja .content {
  width: 100%;
}
.is-standalone.role-motorista .navbar,
.is-standalone.role-cd .navbar,
.is-standalone.role-loja .navbar {
  background: rgba(248, 250, 252, 0.92) !important;
  backdrop-filter: blur(18px);
  border-bottom-color: rgba(148, 163, 184, 0.18) !important;
}
.is-standalone.role-motorista #mobileMenuButton,
.is-standalone.role-cd #mobileMenuButton,
.is-standalone.role-loja #mobileMenuButton {
  display: none !important;
}
.is-standalone.role-motorista .content > .container-fluid,
.is-standalone.role-cd .content > .container-fluid,
.is-standalone.role-loja .content > .container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1rem;
}
.is-standalone .op-page {
  max-width: 820px;
}
.is-standalone .op-hero {
  border-radius: 28px;
}
.is-standalone .op-card {
  border-radius: 28px;
}
.is-standalone .op-card .form-control,
.is-standalone .op-card textarea {
  background: #fff;
}
body.role-motorista .content > .container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
}
body.role-motorista .navbar {
  background: rgba(248, 250, 252, 0.92) !important;
  backdrop-filter: blur(18px);
  border-bottom-color: rgba(148, 163, 184, 0.18) !important;
}
body.role-motorista #mobileMenuButton {
  display: none !important;
}
body.role-motorista .op-page {
  max-width: 900px;
}

@media (display-mode: standalone) {
  body.role-motorista .sidebar,
  body.role-cd .sidebar,
  body.role-loja .sidebar {
    display: none;
  }

  body.role-motorista .content,
  body.role-cd .content,
  body.role-loja .content {
    width: 100%;
  }

  body.role-motorista .navbar,
  body.role-cd .navbar,
  body.role-loja .navbar {
    padding-top: calc(0.9rem + env(safe-area-inset-top));
    background: rgba(248, 250, 252, 0.92) !important;
    backdrop-filter: blur(18px);
    border-bottom-color: rgba(148, 163, 184, 0.18) !important;
  }

  body.role-motorista #mobileMenuButton,
  body.role-cd #mobileMenuButton,
  body.role-loja #mobileMenuButton {
    display: none !important;
  }

  body.role-motorista .content > .container-fluid,
  body.role-cd .content > .container-fluid,
  body.role-loja .content > .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 1rem;
    padding-bottom: calc(7rem + env(safe-area-inset-bottom));
  }

  body.role-motorista .op-page,
  body.role-cd .op-page,
  body.role-loja .op-page {
    max-width: none;
  }
}

@keyframes opPulseSuccess {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.28);
    background-color: rgba(34, 197, 94, 0.06);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(34, 197, 94, 0);
    background-color: transparent;
  }
}

@keyframes opPulseError {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.28);
    background-color: rgba(239, 68, 68, 0.08);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
    background-color: transparent;
  }
}
.role-motorista .alert-success,
.role-cd .alert-success,
.role-loja .alert-success {
  border: 1px solid #86efac;
  background: #ecfdf5;
  color: #166534;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(22, 101, 52, 0.08);
  font-weight: 600;
}
@media (max-width: 767.98px) {
  .app-shell { display: block !important; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.collapsed { width: 280px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
  }
  .sidebar-backdrop.show { display: block; }
  .content { width: 100%; }
  .container-fluid { padding-left: 1rem; padding-right: 1rem; }
  .pwa-install-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .pwa-install-panel-actions {
    width: 100%;
    justify-content: stretch;
  }
  .pwa-install-panel-actions .btn {
    flex: 1 1 0;
  }
  .status-card { min-width: 100%; }
  .op-hero { padding: 1.25rem; border-radius: 20px; }
  .op-card { border-radius: 20px; }
  .role-motorista .content > .container-fluid,
  .role-cd .content > .container-fluid,
  .role-loja .content > .container-fluid {
    padding-bottom: calc(7rem + env(safe-area-inset-bottom));
  }
  .scan-actions > * { width: 100%; }
  .scan-view { min-height: 220px; }
  .op-summary {
    grid-template-columns: 1fr;
  }
  .op-submit {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 1030;
    min-height: 58px;
    border-radius: 20px;
  }
  .op-card form {
    padding-bottom: 5.5rem;
  }
  .report-chart-medium,
  .report-chart-small {
    height: 220px;
  }
  .navbar { padding-left: 1rem !important; padding-right: 1rem !important; }
  .role-motorista .sidebar-brand,
  .role-cd .sidebar-brand,
  .role-loja .sidebar-brand {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .is-standalone.role-motorista .navbar,
  .is-standalone.role-cd .navbar,
  .is-standalone.role-loja .navbar {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .is-standalone.role-motorista .op-page,
  .is-standalone.role-cd .op-page,
  .is-standalone.role-loja .op-page {
    max-width: none;
  }
  .is-standalone.role-motorista .op-hero,
  .is-standalone.role-cd .op-hero,
  .is-standalone.role-loja .op-hero {
    margin-top: 0.25rem;
  }
}
@media print {
  @page {
    size: 100mm 80mm;
    margin: 0;
  }
  html,
  body {
    width: 100mm;
    min-height: 80mm;
    background: #fff !important;
  }
  body * { visibility: hidden; }
  .print-section, .print-section * { visibility: visible; }
  .print-section {
    position: absolute;
    left: 0;
    top: 0;
    width: 100mm;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
  }
  .print-section h5 {
    display: none;
  }
  .print-section .row {
    display: block !important;
    margin: 0 !important;
  }
  .print-label {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    break-after: page;
    page-break-after: always;
  }
  .print-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .print-label-card {
    width: 100mm;
    height: 80mm;
    margin: 0 !important;
    padding: 3mm 4mm !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: auto auto auto 1fr auto;
    gap: 1.4mm;
    color: #000 !important;
  }
  .label-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 3mm;
  }
  .label-brand {
    font-size: 8.6pt;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
  }
  .print-label-title {
    font-size: 16pt;
    line-height: 1.05;
    margin: 0;
    word-break: break-word;
  }
  .label-volume-box {
    min-width: 28mm;
    border: 0.35mm solid #000;
    padding: 1.5mm 2mm;
    text-align: center;
  }
  .label-volume-box span {
    display: block;
    font-size: 7.2pt;
    line-height: 1;
    font-weight: 700;
  }
  .label-volume-box strong {
    display: block;
    font-size: 19pt;
    line-height: 1;
  }
  .label-route-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 2mm;
  }
  .label-route-item {
    border: 0.25mm solid #000;
    min-height: 15mm;
    padding: 1.4mm 2mm;
    overflow: hidden;
  }
  .label-route-item span {
    display: block;
    font-size: 7pt;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
  }
  .label-route-item strong {
    display: block;
    margin-top: 0.8mm;
    font-size: 9.6pt;
    line-height: 1.08;
    word-break: break-word;
  }
  .label-meta-strip {
    display: flex !important;
    justify-content: space-between;
    gap: 2mm;
    border-top: 0.25mm solid #000;
    border-bottom: 0.25mm solid #000;
    padding: 0.8mm 0;
    font-size: 7.5pt;
    line-height: 1.05;
    overflow: hidden;
  }
  .label-meta-strip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .label-barcode-area {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0.6mm 0;
  }
  .barcode-label {
    width: 100% !important;
    height: 34mm !important;
  }
  .print-code-text {
    font-size: 6.4pt;
    font-weight: 700;
    line-height: 1.08;
    text-align: center;
    word-break: break-all;
  }
}
