:root {
  --azul: #1d4ed8;
  --azul-osc: #1e3a8a;
  --gris: #f3f4f6;
  --gris-borde: #d1d5db;
  --texto: #1f2937;
  --verde: #15803d;
  --rojo: #b91c1c;
  --amarillo: #92400e;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  background: #fafafa;
  color: var(--texto);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--azul-osc);
  color: white;
  padding: 10px 24px;
  flex-wrap: wrap;
}
.topbar .brand a { color: white; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #dbeafe; text-decoration: none; font-size: 0.92rem; }
.topbar nav a:hover { color: white; text-decoration: underline; }
.user-menu { display: flex; gap: 12px; align-items: center; font-size: 0.9rem; }
.user-menu a { color: #fecaca; text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }

.footer { text-align: center; color: #6b7280; font-size: 0.78rem; padding: 20px; }

h1 { font-size: 1.4rem; margin-bottom: 4px; }
.muted { color: #6b7280; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; background: white; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gris-borde); font-size: 0.9rem; }
th { background: var(--gris); }
tr:hover td { background: #f9fafb; }

form label { display: block; margin-bottom: 12px; font-size: 0.9rem; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--gris-borde);
  border-radius: 4px; font-size: 0.95rem; font-family: inherit;
}
button, .btn {
  background: var(--azul); color: white; border: none; padding: 9px 16px;
  border-radius: 4px; cursor: pointer; font-size: 0.9rem; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--azul-osc); }
.btn-secundario { background: #6b7280; }
.btn-secundario:hover { background: #4b5563; }
.btn-peligro { background: var(--rojo); }
.btn-peligro:hover { background: #7f1d1d; }

.flashes { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; font-size: 0.9rem; }
.flash-success { background: #dcfce7; color: var(--verde); }
.flash-danger { background: #fee2e2; color: var(--rojo); }
.flash-warning { background: #fef3c7; color: var(--amarillo); }

.login-box {
  max-width: 380px; margin: 60px auto; background: white; padding: 32px;
  border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; background: white; padding: 12px; border-radius: 6px; margin-bottom: 14px; }
.filtros label { margin-bottom: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; }
.badge-activo { background: #dcfce7; color: var(--verde); }
.badge-sustituido { background: #e0e7ff; color: #3730a3; }
.badge-anulado { background: #fee2e2; color: var(--rojo); }

.envio-row { display: grid; grid-template-columns: 2fr 2fr 2fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.envio-row label { margin-bottom: 0; }

.ficha { background: white; padding: 20px; border-radius: 8px; margin-bottom: 16px; }
.ficha dl { display: grid; grid-template-columns: 200px 1fr; gap: 6px 12px; margin: 0; }
.ficha dt { color: #6b7280; font-size: 0.85rem; }
.ficha dd { margin: 0; font-size: 0.95rem; }

.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.aviso-caja { background: #fffbeb; border: 1px solid #fde68a; padding: 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.88rem; }
