:root {
  --azul: #1e3a5f;
  --azul-claro: #2c5282;
  --fondo: #f4f6f8;
  --borde: #d9e0e7;
  --texto: #223;
  --verde: #2f855a;
  --rojo: #c53030;
}

* { box-sizing: border-box; }

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

.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 300px;
  flex-shrink: 0;
  height: 100vh;
  background: var(--azul);
  color: #fff;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .35) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .35);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .55); }

.sidebar__marca {
  padding: 18px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.sidebar__usuario {
  padding: 10px 16px;
  font-size: .85rem;
  color: #cbd8e8;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

details.modulo { border-bottom: 1px solid rgba(255, 255, 255, .1); }

details.modulo > summary {
  cursor: pointer;
  padding: 10px 16px;
  list-style: none;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
}
details.modulo > summary::-webkit-details-marker { display: none; }
details.modulo > summary:hover { background: var(--azul-claro); }

.seccion__titulo {
  padding: 6px 16px 2px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9db3c9;
}

.opcion {
  display: block;
  padding: 6px 24px;
  color: #e6edf5;
  text-decoration: none;
  font-size: .88rem;
}
.opcion:hover { background: var(--azul-claro); }
.opcion--no-disponible { color: #8fa3b8; font-style: italic; }

.salir { display: block; padding: 14px 16px; color: #ffb3b3; text-decoration: none; font-weight: 600; }
.salir:hover { text-decoration: underline; }

.contenido { flex: 1; padding: 24px 32px; min-width: 0; height: 100vh; overflow-y: auto; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}

.tarjeta {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.tabla-scroll {
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--borde);
  border-radius: 6px;
}
.tabla-scroll--chica { max-height: 260px; }

table.grilla { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grilla th, table.grilla td {
  border-bottom: 1px solid var(--borde);
  padding: 6px 10px;
  text-align: left;
  font-size: .9rem;
}
table.grilla th {
  background: #eef2f6;
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 var(--borde);
}
table.grilla tbody tr:hover { background: #f8fafc; }
table.grilla th.th-ordenable { cursor: pointer; user-select: none; }
table.grilla th.th-ordenable:hover { background: #e2e9f0; }

form.form-grilla {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 16px;
  margin-bottom: 14px;
}
form.form-grilla .campo { display: flex; flex-direction: column; gap: 3px; }
form.form-grilla label { font-size: .8rem; color: #556; }
form.form-grilla input, form.form-grilla select, form.form-grilla textarea {
  padding: 6px 8px; border: 1px solid var(--borde); border-radius: 4px; font-size: .9rem;
}

/* Tom-Select: que el combo con búsqueda combine con el resto de los inputs */
.ts-wrapper.single .ts-control, .ts-wrapper .ts-control {
  padding: 5px 8px; border: 1px solid var(--borde); border-radius: 4px;
  font-size: .9rem; min-height: unset; box-shadow: none;
}
.ts-wrapper.focus .ts-control { border-color: var(--azul-claro); box-shadow: none; }
.ts-dropdown { font-size: .9rem; border-color: var(--borde); }
.ts-dropdown .active { background: var(--fondo); }

.botones { display: flex; gap: 8px; margin: 10px 0 18px; }

.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 4px;
  border: 1px solid var(--azul);
  background: var(--azul);
  color: #fff;
  cursor: pointer;
  font-size: .88rem;
  text-decoration: none;
}
.btn:hover { background: var(--azul-claro); }
.btn--secundario { background: #fff; color: var(--azul); }
.btn--peligro { background: #fff; border-color: var(--rojo); color: var(--rojo); }
.btn--peligro:hover { background: var(--rojo); color: #fff; }

.mensajes { list-style: none; padding: 0; margin: 0 0 16px; }
.mensajes li { padding: 8px 12px; border-radius: 4px; margin-bottom: 6px; background: #e6f4ea; color: var(--verde); }
.mensajes li.error { background: #fde8e8; color: var(--rojo); }

.errorlist { color: var(--rojo); font-size: .8rem; margin: 2px 0 0; padding: 0; list-style: none; }

.login-page {
  min-height: 100%; margin: -24px -32px;
  display: flex; align-items: center; justify-content: center; background: var(--azul);
}
.login-caja {
  background: #fff; padding: 32px; border-radius: 8px; width: 320px;
}
.login-caja h1 { margin-top: 0; font-size: 1.2rem; color: var(--azul); }
