/* Extras do Ordem de Compra sobre o SaaS (saas.css = Tailwind compilado do Exemplo/Cardápio) */

html, body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  height: 100%;
  display: flex;
  min-height: 0;
}

.app-main-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.app-main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.app-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 100;
  min-width: 240px;
  max-width: 420px;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  font-size: 0.875rem;
  font-weight: 500;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.app-toast.toast-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.app-toast.toast-danger, .app-toast.toast-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.app-toast.toast-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.app-toast.toast-info { background: #f0f9ff; border-color: #bae6fd; color: #0c4a6e; }

html.dark .app-toast { background: #111827; border-color: #374151; color: #f3f4f6; }
html.dark .app-toast.toast-success { background: #064e3b; border-color: #065f46; color: #a7f3d0; }
html.dark .app-toast.toast-danger,
html.dark .app-toast.toast-error { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
html.dark .app-toast.toast-warning { background: #78350f; border-color: #92400e; color: #fde68a; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.625rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: #e5e7eb;
}
html.dark .timeline::before { background: #374151; }
.timeline-item { position: relative; padding: 0 0 1.1rem 2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: 0.25rem;
  top: 0.25rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 999px;
  background: #ea580c;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #ffedd5;
}
html.dark .timeline-dot { border-color: #111827; box-shadow: 0 0 0 2px rgba(234,88,12,.25); }

.aprov-steps { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.aprov-step {
  flex: 1;
  min-width: 140px;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 0.75rem 0.85rem;
  background: #f9fafb;
}
html.dark .aprov-step { background: #1f2937; border-color: #374151; }
.aprov-step.is-done { border-color: #34d399; background: #ecfdf5; }
.aprov-step.is-current { border-color: #ea580c; box-shadow: 0 0 0 2px #ffedd5; }
.aprov-step.is-rejected { border-color: #f87171; background: #fef2f2; }
html.dark .aprov-step.is-done { background: rgba(16,185,129,.12); }
html.dark .aprov-step.is-rejected { background: rgba(239,68,68,.12); }
.aprov-step .as-level { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; }
.aprov-step .as-label { font-weight: 600; font-size: 0.9rem; }
.aprov-step .as-status { font-size: 0.8rem; margin-top: 0.25rem; color: #6b7280; }

/* botões — ícone + texto com espaçamento consistente */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.btn-primary i,
.btn-secondary i,
.btn-ghost i,
.btn-danger i {
  line-height: 1;
  flex-shrink: 0;
  font-size: 1em;
}

.painel-topbar .btn-primary,
.painel-topbar .btn-secondary,
.painel-topbar .btn-danger,
.painel-topbar .btn-ghost,
.painel-topbar a.btn-primary,
.painel-topbar a.btn-secondary {
  min-height: 2.35rem !important;
  padding: 0.45rem 0.9rem !important;
  white-space: nowrap;
  font-size: 0.875rem;
}

.painel-topbar #actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem 0.9rem;
  max-height: 360px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #f9fafb;
}
html.dark .perm-grid { background: #1f2937; border-color: #374151; }
.perm-grid label { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.84rem; cursor: pointer; line-height: 1.35; }
.perm-grid label input { margin-top: 0.2rem; flex-shrink: 0; }

.table-saas { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table-saas th {
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}
.table-saas td {
  padding: 0.85rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
html.dark .table-saas th,
html.dark .table-saas td { border-color: #1f2937; color: #e5e7eb; }
.table-saas tbody tr:hover { background: #fafafa; }
html.dark .table-saas tbody tr:hover { background: #1f2937; }

.kv {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr;
  gap: 0.55rem 1rem;
  font-size: 0.9rem;
  align-items: baseline;
}
.kv dt { color: #9ca3af; margin: 0; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

.level-row {
  display: grid;
  grid-template-columns: 5rem 1fr 1fr 1fr auto;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.65rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.875rem;
  background: #f9fafb;
}
html.dark .level-row {
  background: #1f2937;
  border-color: #374151;
}
@media (max-width: 900px) {
  .level-row { grid-template-columns: 1fr 1fr; }
}

/* Modal SaaS (substitui Bootstrap modal sem CSS) */
.oc-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.oc-modal.hidden { display: none !important; }
.oc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}
.oc-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 36rem;
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.oc-modal__panel--lg { max-width: 42rem; }
html.dark .oc-modal__panel { background: #111827; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}
html.dark .badge.bg-gray-100 { background: #1f2937; color: #e5e7eb; }
html.dark .badge.bg-emerald-100 { background: rgba(16,185,129,.2); color: #6ee7b7; }
html.dark .badge.bg-amber-100 { background: rgba(245,158,11,.2); color: #fcd34d; }
html.dark .badge.bg-sky-100 { background: rgba(14,165,233,.2); color: #7dd3fc; }
html.dark .badge.bg-red-100 { background: rgba(239,68,68,.2); color: #fca5a5; }
html.dark .badge.bg-violet-100 { background: rgba(139,92,246,.2); color: #c4b5fd; }
html.dark .badge.bg-orange-100 { background: rgba(249,115,22,.2); color: #fdba74; }
