:root {
  --vs: #dc2626;
  --vsd: #b91c1c
}

body {
  background: #0b1220;
  color: #e5e7eb
}

.soft {
  background: #0f172a;
  border: 1px solid #334155
}

.card {
  background: #0b1220;
  border: 1px solid #1f2937
}

.pill {
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700
}

dialog::backdrop {
  background: rgba(0, 0, 0, .55)
}

.drop {
  border: 2px dashed #475569
}

.tbl th {
  background: #0f172a;
  position: sticky;
  top: 0
}

.btn {
  border-radius: .5rem;
  padding: .5rem .75rem
}

.hover-row:hover {
  background: #0f172a
}

.link {
  cursor: pointer
}

.link:hover {
  text-decoration: underline
}

.row-ok {
  color: #34d399
}

.row-err {
  color: #f87171
}

.badge {
  border-radius: 999px;
  padding: .15rem .5rem;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap
}

.badge-ok {
  background: rgba(16, 185, 129, .15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, .35)
}

.badge-warn {
  background: rgba(245, 158, 11, .12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, .35)
}

.badge-err {
  background: rgba(248, 113, 113, .15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, .35)
}

.badge-info {
  background: rgba(96, 165, 250, .15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, .35)
}

/* ====== SIDEBAR BOT ====== */
.bot-sidebar {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  height: 100vh;
  background: #0b1220;
  border-left: 1px solid #1f2937;
  z-index: 100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.bot-sidebar.open {
  right: 0;
}

.bot-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
}

.bot-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.bot-sidebar-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
}

.bot-sidebar-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.bot-sidebar-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.bot-sidebar-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
}

.bot-sidebar-message {
  display: flex;
  gap: 8px;
}

.bot-sidebar-message.user {
  flex-direction: row-reverse;
}

.bot-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1930;
  border: 1px solid #1f2937;
  font-size: 1rem;
  flex-shrink: 0;
}

.bot-sidebar-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  background: #0f172a;
  border: 1px solid #1f2937;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.bot-sidebar-message.user .bot-sidebar-bubble {
  background: #1e3a8a;
  border-color: #3b82f6;
}

.bot-sidebar-message-time {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 4px;
}

.bot-sidebar-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 8px;
}

.bot-sidebar-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.bot-sidebar-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6b7280;
  display: inline-block;
  opacity: 0.7;
  animation: blink 1.2s infinite;
}

.bot-sidebar-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.bot-sidebar-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  80%,
  100% {
    opacity: 0.2;
  }

  40% {
    opacity: 1;
  }
}

.bot-sidebar-composer {
  padding: 16px;
  border-top: 1px solid #1f2937;
  background: #0c1426;
}

.bot-sidebar-form {
  display: flex;
  gap: 8px;
}

.bot-sidebar-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  padding: 8px 12px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: #e5e7eb;
  outline: none;
}

.bot-sidebar-send {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #20416e;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.bot-sidebar-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bot-sidebar-resizer {
  position: absolute;
  left: -4px;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 101;
}

.bot-sidebar-resizer:hover,
.bot-sidebar-resizer.dragging {
  background: rgba(59, 130, 246, 0.3);
}

/* Botón para abrir la sidebar */
.bot-sidebar-launcher {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: #1e3a8a;
  color: white;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 8px;
  cursor: pointer;
  z-index: 99;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.bot-sidebar-launcher:hover {
  background: #1e40af;
  padding-right: 12px;
}

.bot-sidebar-launcher-icon {
  font-size: 1.2rem;
}

/* Overlay para cuando está abierta */
.bot-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 90;
  display: none;
}

.bot-sidebar-overlay.open {
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .bot-sidebar {
    width: 100%;
    right: -100%;
  }

  .bot-sidebar.open {
    right: 0;
  }

  .bot-sidebar-resizer {
    display: none;
  }
}

/* === Legibilidad en Documentos (botoneras dentro del bloque) === */
.mt-6.soft.rounded-xl.p-5 button.soft {
  color: #fff;
  /* texto blanco */
}

/* === Modales: forzamos color legible === */
#dlg-prov {
  color: #e5e7eb;
}

/* texto general del modal Proveedor */
#dlg-doc {
  color: #e5e7eb;
}

/* texto general del modal Editar documento */
#dlg-doc button.soft {
  color: #fff;
}

/* ===== Modal (Digitalizador Sucursal) ===== */
.ds-modal-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.ds-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}

.ds-modal {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  margin: 10vh auto 0;
  background: #0b1220;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  overflow: hidden;
}

.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.ds-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,.92);
  margin: 0;
}

.ds-modal-close {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.70);
  cursor: pointer;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 8px;
}
.ds-modal-close:hover { background: rgba(255,255,255,.06); }

.ds-modal-body {
  padding: 14px 16px;
  color: rgba(255,255,255,.80);
  font-size: 14px;
  line-height: 1.45;
}

.ds-modal-body .ds-modal-muted { color: rgba(255,255,255,.60); }
.ds-modal-body .ds-modal-box {
  margin-top: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.ds-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.ds-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.ds-btn:hover { background: rgba(255,255,255,.10); }

.ds-btn-primary {
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.20);
}
.ds-btn-primary:hover { background: rgba(16,185,129,.28); }

.ds-btn-danger {
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.18);
}
.ds-btn-danger:hover { background: rgba(239,68,68,.25); }

/* ===== Fix dropdown oscuro (modal editar) ===== */
#modalRoot select {
  background: #111827;            /* gris oscuro */
  color: #e5e7eb;                 /* texto claro */
  border: 1px solid rgba(255,255,255,.12);
  color-scheme: dark;             /* ayuda a que el popup sea oscuro en Chrome/Edge */
}

#modalRoot option,
#modalRoot optgroup {
  background: #1f2937;            /* gris un poco mas claro */
  color: #e5e7eb;
}
