:root {
  --bg: #020617;
  --bg-card: rgba(15, 23, 42, 0.9);
  --bg-card-soft: rgba(15, 23, 42, 0.7);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #06b6d4;
  --primary-soft: #0ea5e9;
  --danger: #f97373;
  --ok: #4ade80;
  --warn: #facc15;
  --radius-lg: 1.2rem;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);

  /* Navbar */
  --nav-bg: rgba(15, 23, 42, 0.9);
  --nav-border: rgba(148, 163, 184, 0.18);
}

html[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-card: #ffffff;
  --bg-card-soft: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #0284c7;
  --primary-soft: #0ea5e9;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.1);

  --nav-bg: rgba(255, 255, 255, 0.96);
  --nav-border: rgba(148, 163, 184, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Fondo general */
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #0b1120 0, var(--bg) 40%, #000 100%);
  color: var(--text);
}

/* Fondo específico en modo claro */
html[data-theme="light"] body {
  background: #e5e7eb;
}

/* ===== Layout general con sidebar ===== */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: linear-gradient(180deg, #020617, #020617 55%, #0b1120);
  padding: 1.5rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  box-shadow: var(--shadow-soft);
  z-index: 10;
}

/* Sidebar más clara en modo claro */
html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.sidebar h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  border-radius: .9rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}

.sidebar a span:first-child {
  font-size: 1.1rem;
}

.sidebar a.active,
.sidebar a:hover {
  background: rgba(15, 118, 110, 0.15);
  color: var(--primary-soft);
  transform: translateX(2px);
}

/* ===== Main ===== */
.main {
  padding: 1.6rem 2.2rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1.4rem;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--nav-bg);
  padding: .9rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--nav-border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(16px);
}

.navbar > div {
  font-weight: 500;
}

/* Botón menú */
.navbar .menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: .5rem;
  border-radius: 999px;
}

/* Botón tema */
.theme-btn {
  border-radius: 999px;
  padding-inline: .85rem;
}

/* ===== Botones ===== */
button {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: #0b1120;
  padding: .6rem 1.05rem;
  border-radius: .75rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(8, 47, 73, 0.6);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(8, 47, 73, 0.7);
  filter: brightness(1.03);
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ===== Cards genéricas ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

/* ===== Pantalla de login ===== */
/* ===== Pantalla de login / modales tipo formulario ===== */

.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1e293b, #020617);
}

html[data-theme="light"] .auth-body {
  background: radial-gradient(circle at top, #e5e7eb, #f9fafb);
}

.auth-card {
  width: 420px;
  max-width: 95vw;
  padding: 2.4rem 2.2rem;
  border-radius: 1.4rem;
  background: radial-gradient(circle at top left,
              rgba(15, 23, 42, 0.96),
              rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  color: var(--text);
  font-family: var(--font-sans, "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif);
}

html[data-theme="light"] .auth-card {
  background: linear-gradient(135deg, #ffffff, #e5e7eb);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}

.auth-card h1 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 0.3rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-soft);
}

.auth-card p.subtitle {
  font-size: 0.9rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* Campos de formulario dentro de auth-card */
.auth-card label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: block;
}

.auth-card input,
.auth-card select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 0.9rem;
}

html[data-theme="light"] .auth-card input,
html[data-theme="light"] .auth-card select {
  background: rgba(243, 244, 246, 0.9);
}

.auth-card input:focus,
.auth-card select:focus {
  outline: none;
  border-color: var(--primary-soft);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.auth-card .actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.auth-card .actions a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.auth-card .actions a:hover {
  color: var(--primary-soft);
}

/* Botón principal dentro de auth-card hereda estilos globales button */
.auth-card button {
  width: 100%;
  margin-top: 0.4rem;
}

/* Errores / mensajes */
.auth-card .error {
  color: #f97316;
  font-size: 0.85rem;
  text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.6rem;
  }
}


.error {
  color: #f97316;
  font-size: .85rem;
  text-align: center;
}

/* ===== KPIs base ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi {
  display: grid;
  gap: .3rem;
  text-align: center;
}

.kpi-title {
  font-size: .9rem;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  /* Sidebar como panel lateral SOLO en móvil */
  .sidebar {
    position: fixed;
    inset: 0 40% 0 0;
    max-width: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar h2 {
    display: none;
  }

  .main {
    padding: 1rem 1rem 1.4rem;
  }

  .navbar {
    border-radius: .9rem;
  }
}

@media (max-width: 480px) {
  .auth-card {
    width: 100%;
    max-width: 100%;
    margin: 0 1rem;
    padding: 2rem 1.6rem;
  }
}


/* ===== Página de medicamentos (tabla + buscador + estados) ===== */

.medicamentos-card {
  width: 95vw;
  max-width: 1600px;  
  padding: 1.6rem 2rem 1.5rem;
  margin-top: 0.5rem;
}



.medicamentos-card .med-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.9rem;
}

/* Botón principal en la cabecera de medicamentos */
.medicamentos-card .med-header .med-btn {
  min-width: auto;
  height: 32px;
  padding: 0 1.1rem;
  font-size: 0.85rem;
  border-radius: 999px;
}

.medicamentos-card .med-subtitle {
  font-size: 0.86rem;
  color: var(--muted);
}

/* ----- Filtros ----- */
.medicamentos-card .med-filters {
  margin-bottom: 1rem;
}

.medicamentos-card .med-filters-row {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1.3fr auto;
  gap: 0.8rem;
  align-items: end;
}

.medicamentos-card .med-filter-item label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.medicamentos-card .med-filter-item input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
}

.medicamentos-card .med-filter-item input:focus {
  outline: none;
  border-color: var(--primary-soft);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.medicamentos-card .med-filter-actions {
  display: flex;
  gap: 0.4rem;
}

.medicamentos-card .med-filter-actions button {
  padding-inline: 0.9rem;
}

.medicamentos-card .med-filter-actions .med-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

/* ----- Tabla ----- */
.medicamentos-card .med-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.medicamentos-card .med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.medicamentos-card .med-table thead {
  background: rgba(148, 163, 184, 0.16);
}

.medicamentos-card .med-table th,
.medicamentos-card .med-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.medicamentos-card .med-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Filas por tema */
html[data-theme="dark"] .medicamentos-card .med-table tbody tr:nth-child(even),
html[data-theme="dark"] .medicamentos-card .med-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

html[data-theme="light"] .medicamentos-card .med-table tbody tr:nth-child(even),
html[data-theme="light"] .medicamentos-card .med-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.medicamentos-card .med-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

/* Columnas */
.medicamentos-card .col-id {
  width: 60px;
  color: var(--muted);
}

.medicamentos-card .col-nombre {
  width: 40%;
}

.medicamentos-card .col-cantidad {
  width: 80px;
  text-align: center;
}

.medicamentos-card .col-cad {
  width: 110px;
  text-align: center;
}

.medicamentos-card .col-estado {
  width: 150px;
}

.medicamentos-card .col-acciones {
  width: 220px;
  text-align: right;
}

/* ----- Estado stock/caducidad ----- */
.medicamentos-card .badge-estado {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.medicamentos-card .estado-ok {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.medicamentos-card .estado-caducar {
  background: rgba(250, 204, 21, 0.22);
  color: #facc15;
}

.medicamentos-card .estado-bajo {
  background: rgba(249, 115, 22, 0.25);
  color: #fb923c;
}

.medicamentos-card .estado-sin {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* ----- Botones acción ----- */
.medicamentos-card .med-fab-group {
  display: inline-flex;
  gap: 0.25rem;
}

.medicamentos-card .med-btn {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.4);
  cursor: pointer;
  background: linear-gradient(135deg, #0369a1, #0ea5e9);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.medicamentos-card .med-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.7);
}

.medicamentos-card .med-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Responsive */
@media (max-width: 900px) {
  .medicamentos-card {
    max-width: 100%;
    padding-inline: 1.1rem;
  }

  .medicamentos-card .med-filters-row {
    grid-template-columns: 1fr;
  }

  .medicamentos-card .col-nombre {
    width: 40%;
  }

  .medicamentos-card .col-acciones {
    width: 170px;
  }
}

.med-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.med-btn:hover {
  background: var(--color-primary-hover);
}

.med-btn[style*="success"]:hover {
  background: var(--color-success) !important;
  opacity: 0.9;
}

.pdf-dropdown {
  position: relative;
  background: var(--color-success) !important;
}

.pdf-dropdown:hover {
  background: #388e3c !important;
}

/* --- Filtro de estado como desplegable --- */
.medicamentos-card .med-state-filters {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 150px;
}

.medicamentos-card .med-state-filters label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.medicamentos-card .med-state-filters select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
}

/* Móvil: que el select baje como el resto de filtros */
@media (max-width: 900px) {
  .medicamentos-card .med-filters-row {
    grid-template-columns: 1fr;
  }
}


/* ===== Página de usuarios (tabla + acciones) ===== */

.usuarios-card {
  width: 95vw;
  max-width: 1600px;
  padding: 1.6rem 2rem 1.5rem;
  margin-top: 0.5rem;
  margin-inline: auto;
}

.usuarios-card .usr-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.9rem;
}

.usuarios-card .usr-subtitle {
  font-size: 0.86rem;
  color: var(--muted);
}

/* Tabla */
.usuarios-card .usr-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.usuarios-card .usr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.usuarios-card .usr-table thead {
  background: rgba(148, 163, 184, 0.16);
}

.usuarios-card .usr-table th,
.usuarios-card .usr-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.usuarios-card .usr-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Filas por tema */
html[data-theme="dark"] .usuarios-card .usr-table tbody tr:nth-child(even),
html[data-theme="dark"] .usuarios-card .usr-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

html[data-theme="light"] .usuarios-card .usr-table tbody tr:nth-child(even),
html[data-theme="light"] .usuarios-card .usr-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.usuarios-card .usr-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

/* Columnas */

.usuarios-card .u-col-id {
  width: 60px;
  color: var(--muted);
}

.usuarios-card .u-col-user {
  width: 18%;
}

.usuarios-card .u-col-name {
  width: 22%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuarios-card .u-col-email {
  width: 24%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuarios-card .u-col-rol {
  width: 110px;
}

.usuarios-card .u-col-pass {
  width: 16%;
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

/* Acciones: alineadas a la izquierda */

.usuarios-card .u-col-actions {
  width: 140px;
  text-align: left;
  padding-right: 0.4rem;
}

/* Contenedor de botones alineado a la izquierda */

.usuarios-card .u-col-actions .usr-actions {
  display: flex;             /* en vez de inline-flex */
  justify-content: flex-start;
  align-items: center;
  gap: 0.25rem;
  width: auto;
  margin-left: 0;
  margin-right: auto;        /* empuja hacia la izquierda */
}

/* Badge de rol */

.usuarios-card .badge-rol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.usuarios-card .badge-rol-admin {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

.usuarios-card .badge-rol-user {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

/* Botones de acción */

.usuarios-card .usr-btn {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.4);
  cursor: pointer;
  background: linear-gradient(135deg, #0369a1, #0ea5e9);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.usuarios-card .usr-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.7);
}

.usuarios-card .usr-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.usuarios-card .usr-btn-danger {
  background: linear-gradient(135deg, #dc2626, #f97373);
}

/* Modal edición datos personales */

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  padding: 1.6rem 1.8rem;
  border-radius: 8px;
  width: 400px;
  max-width: 90%;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.8);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.modal-content label {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  margin-bottom: 0.15rem;
}

.modal-content input {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
}

.modal-actions {
  margin-top: 0.9rem;
  text-align: right;
}

.modal-actions button {
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

/* Responsive */

@media (max-width: 900px) {
  .usuarios-card {
    max-width: 100%;
    padding-inline: 1.1rem;
  }

  .usuarios-card .u-col-user,
  .usuarios-card .u-col-name,
  .usuarios-card .u-col-email {
    width: 23%;
  }

  .usuarios-card .u-col-pass {
    width: 18%;
  }

  .usuarios-card .u-col-actions {
    width: 130px;
  }
}

@media (max-width: 600px) {
  .usuarios-card .usr-table {
    font-size: 0.8rem;
  }

  .usuarios-card .usr-table th {
    font-size: 0.7rem;
  }

  .usuarios-card .u-col-user,
  .usuarios-card .u-col-name,
  .usuarios-card .u-col-email,
  .usuarios-card .u-col-rol,
  .usuarios-card .u-col-pass {
    width: 20%;
  }

  .usuarios-card .u-col-actions {
    width: 110px;
  }

  .usuarios-card .usr-btn {
    min-width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
}


/* ===== Página de registros (movimientos) ===== */

.registros-card {
  width: 95vw;
  max-width: 1600px;  
  padding: 1.6rem 2rem 1.5rem;
  margin-top: 0.5rem;
}

.registros-card .reg-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.9rem;
}

.registros-card .reg-subtitle {
  font-size: 0.86rem;
  color: var(--muted);
}

/* Tabla */
.registros-card .reg-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.registros-card .reg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: fixed;
}

.registros-card .reg-table thead {
  background: rgba(148, 163, 184, 0.16);
}

.registros-card .reg-table th,
.registros-card .reg-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.registros-card .reg-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Filas por tema */
html[data-theme="dark"] .registros-card .reg-table tbody tr:nth-child(even),
html[data-theme="dark"] .registros-card .reg-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

html[data-theme="light"] .registros-card .reg-table tbody tr:nth-child(even),
html[data-theme="light"] .registros-card .reg-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.registros-card .reg-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

/* Columnas */
.registros-card .reg-col-id {
  width: 60px;
  color: var(--muted);
}

.registros-card .reg-col-fecha {
  width: 150px;
}

.registros-card .reg-col-med {
  width: 28%;
}

.registros-card .reg-col-tipo {
  width: 110px;
}

.registros-card .reg-col-cant {
  width: 90px;
  text-align: center;
}

.registros-card .reg-col-user {
  width: 130px;
}

.registros-card .reg-col-rol {
  width: 110px;
}

/* Badge de tipo (ENTRADA / SALIDA / AJUSTE) */
.registros-card .badge-tipo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.registros-card .badge-tipo-entrada {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
}

.registros-card .badge-tipo-salida {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.registros-card .badge-tipo-ajuste {
  background: rgba(250, 204, 21, 0.22);
  color: #facc15;
}

/* Badge de rol (reutiliza estilo de usuarios) */
.registros-card .badge-rol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.registros-card .badge-rol-admin {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

.registros-card .badge-rol-user {
  background: rgba(148, 163, 184, 0.22);
  color: #e5e7eb;
}

/* Responsive */
@media (max-width: 900px) {
  .registros-card {
    max-width: 100%;
    padding-inline: 1.1rem;
  }
}

/* ===== Diseño asistente (chat) para base.css ===== */

.asistente-card {
  width: 95vw;
  max-width: 1600px;      /* caja aún más ancha */
  margin: 1.5rem auto;
  padding: 2rem 2.5rem;
  border-radius: 1rem;
  background: var(--card-bg);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  height: 750px;          /* altura grande */
  color: var(--text);
  font-family: var(--font-sans);
}

.asistente-header {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.asistente-mensajes {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 1rem;
  background: var(--bg-secondary);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.msg {
  max-width: 80%;
  padding: 0.65rem 1rem;
  border-radius: 1rem;
  line-height: 1.3;
  word-wrap: break-word;
}

.msg.usuario {
  align-self: flex-end;
  background: var(--primary);
  color: var(--on-primary);
  border-bottom-right-radius: 0;
}

.msg.asistente {
  align-self: flex-start;
  background: rgba(59, 130, 246, 0.22);
  color: var(--primary);
  border-bottom-left-radius: 0;
}

.asistente-input-wrapper {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
}

.asistente-input {
  flex-grow: 1;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 1rem;
  background: var(--bg-secondary);
  color: var(--text);
}

.asistente-input::placeholder {
  color: rgba(229, 231, 235, 0.6);
}

.asistente-boton {
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.asistente-boton:hover {
  background: var(--primary-soft);
}

@media (max-width: 900px) {
  .asistente-card {
    width: 95vw;
    max-width: 95vw;
    height: 500px;
    padding: 1rem;
  }
}

