/* Tema Just — paleta extraída del logo (colores just.jpeg) */
:root {
  --just-azul:        #2E4A9E;  /* azul marca (el "Just") */
  --just-azul-osc:    #243C82;
  --just-violeta:     #5B6FD6;  /* azul violáceo de las flores */
  --just-violeta-cl:  #6C7FE0;
  --just-lavanda:     #C7CEF0;  /* trazos suaves */
  --just-lavanda-cl:  #E1E5F8;
  --just-fondo:       #EEF0FB;  /* fondo lavanda de la imagen */
  --just-blanco:      #FFFFFF;
  --just-rojo:        #E63329;  /* rojo suizo (la crucecita) */
  --just-texto:       #2A2E45;
  --just-gris:        #8A8FA8;
  --just-borde:       #D5DAF0;
  --just-ok:          #2E9E5B;
  --sombra:           0 8px 30px rgba(46, 74, 158, 0.15);
  --radio:            14px;
  --fuente: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fuente);
  color: var(--just-texto);
  background: var(--just-fondo);
  -webkit-font-smoothing: antialiased;
}

/* ====== LOGIN ====== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--just-lavanda-cl), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--just-lavanda), transparent 55%),
    var(--just-fondo);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--just-blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 36px 32px 30px;
  border: 1px solid var(--just-borde);
}
.brand {
  text-align: center;
  margin-bottom: 8px;
}
.brand .logo {
  font-size: 46px;
  font-weight: 800;
  font-style: italic;
  color: var(--just-azul);
  letter-spacing: -1px;
  position: relative;
  display: inline-block;
}
.brand .logo .cross {
  position: absolute;
  top: 4px; right: -18px;
  background: var(--just-rojo);
  color: #fff;
  width: 16px; height: 16px;
  border-radius: 3px;
  font-size: 12px;
  font-style: normal;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
}
.brand .sub {
  color: var(--just-gris);
  font-size: 13px;
  margin-top: 10px;
  letter-spacing: .3px;
}
.login-card h1 {
  font-size: 18px;
  text-align: center;
  margin: 18px 0 22px;
  color: var(--just-azul-osc);
  font-weight: 600;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--just-azul-osc);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--just-borde);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--just-texto);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--just-violeta);
  box-shadow: 0 0 0 3px rgba(91, 111, 214, 0.18);
}

/* Campo "Código de empresa": input angosto + descripción de la empresa al lado */
.empresa-row { display: flex; align-items: center; gap: 12px; }
.empresa-row .empresa-input { width: 110px; flex: 0 0 auto; }
.empresa-desc { font-size: 14px; font-weight: 600; color: var(--just-azul); min-height: 1em; }

.btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform .05s, background .15s, box-shadow .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--just-violeta), var(--just-azul));
  color: #fff;
  box-shadow: 0 6px 18px rgba(46, 74, 158, 0.3);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(46, 74, 158, 0.42); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--just-azul);
  border: 1.5px solid var(--just-borde);
}
.btn-ghost:hover { background: var(--just-lavanda-cl); }

.alert {
  margin: 0 0 16px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #fde8e7; color: #a3231b; border: 1px solid #f5c4c0; }
.alert-ok    { background: #e6f5ec; color: #1e7a44; border: 1px solid #bfe6cd; }

/* ====== APP / MENU ====== */
.topbar {
  background: linear-gradient(135deg, var(--just-azul), var(--just-violeta));
  color: #fff;
  padding: 0 22px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(46,74,158,.25);
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo {
  font-style: italic; font-weight: 800; font-size: 26px; letter-spacing: -.5px;
}
.topbar .logo .cross {
  background: var(--just-rojo); color:#fff; border-radius:3px;
  font-size:11px; font-style:normal; padding:1px 4px; vertical-align: super; margin-left:2px;
}
.topbar .session { font-size: 13px; display: flex; align-items: center; gap: 14px; }
.topbar .session .empresa-chip {
  background: rgba(255,255,255,.18);
  padding: 5px 12px; border-radius: 20px; font-weight: 600;
}
.topbar .session button {
  background: rgba(255,255,255,.15); color:#fff; border:1px solid rgba(255,255,255,.35);
  padding: 6px 12px; border-radius: 8px; cursor:pointer; font-size:13px; font-family:inherit;
}
.topbar .session button:hover { background: rgba(255,255,255,.28); }

.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 240px; background: #fff; border-right: 1px solid var(--just-borde);
  padding: 18px 12px; flex-shrink: 0;
}
.sidebar h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--just-gris); margin: 6px 10px 12px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px; cursor: pointer;
  color: var(--just-texto); font-size: 14.5px; font-weight: 500;
  margin-bottom: 3px; border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.nav-item:hover { background: var(--just-lavanda-cl); }
.nav-item.active { background: var(--just-azul); color: #fff; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; background: var(--just-rojo); color:#fff;
  padding: 2px 7px; border-radius: 10px; font-weight: 700;
}
.nav-item.active .badge { background: rgba(255,255,255,.3); }

.content { flex: 1; padding: 26px 30px; overflow: auto; }
.content-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.content-head h2 { margin: 0; color: var(--just-azul-osc); font-size: 22px; }

.card { background:#fff; border:1px solid var(--just-borde); border-radius: var(--radio); box-shadow: var(--sombra); }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--just-lavanda-cl); }
table.grid th { background: var(--just-lavanda-cl); color: var(--just-azul-osc); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
table.grid tr:hover td { background: #fafbff; }
table.grid .row-actions { display: flex; gap: 8px; }
table.grid .row-actions button { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; cursor: pointer; border:1px solid var(--just-borde); background:#fff; font-family:inherit; }
table.grid .row-actions button:hover { background: var(--just-lavanda-cl); }
table.grid .row-actions .del { color: var(--just-rojo); border-color:#f3c9c6; }

.empty { padding: 40px; text-align: center; color: var(--just-gris); }

/* Modal de formulario */
.modal-bg { position: fixed; inset:0; background: rgba(36,60,130,.35); display:none; place-items:center; z-index: 50; padding:20px; }
.modal-bg.show { display: grid; }
.modal { background:#fff; border-radius: var(--radio); box-shadow: var(--sombra); width:100%; max-width: 520px; max-height: 90vh; overflow:auto; }
.modal header { padding: 18px 22px; border-bottom:1px solid var(--just-borde); display:flex; justify-content:space-between; align-items:center; }
.modal header h3 { margin:0; color: var(--just-azul-osc); }
.modal header .x { background:none; border:none; font-size:22px; cursor:pointer; color:var(--just-gris); }
.modal .body { padding: 20px 22px; }
.modal .foot { padding: 16px 22px; border-top:1px solid var(--just-borde); display:flex; gap:10px; justify-content:flex-end; }
.modal .foot .btn { width:auto; padding: 10px 18px; }
.field small { display:block; color: var(--just-gris); font-size:12px; margin-top:4px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--just-azul-osc); color:#fff; padding: 13px 18px; border-radius:10px; box-shadow: var(--sombra); display:none; z-index:100; font-size:14px; }
.toast.show { display:block; }
.toast.err { background: #a3231b; }
