:root{
  --bg:#0b1220;
  --card:#0f1b33;
  --card2:#111f3c;
  --text:#e8eefc;
  --muted:#a9b7d6;
  --line:rgba(255,255,255,.08);
  --accent:#4aa3ff;
  --danger:#ff4a6b;
  --ok:#37d39b;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius:14px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 600px at 20% 0%, #142857 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 10%, #12394e 0%, transparent 55%),
              var(--bg);
  color:var(--text);
}

a{color:var(--accent); text-decoration:none}
a:hover{opacity:.9}

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

.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding: 12px 14px;
  margin: 0 -16px 18px;     /* se estira al borde del container */
  border-bottom: 1px solid var(--line);
  background: rgba(6,10,18,.75);
  backdrop-filter: blur(10px);
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 240px;
}

.brand-ico{
  width:42px;height:42px;
  display:flex;align-items:center;justify-content:center;
  border-radius: 14px;
  border:1px solid rgba(74,163,255,.25);
  background: rgba(74,163,255,.12);
  font-size: 20px;
}
.brand-txt{min-width:0}
.brand-name{font-weight:900; letter-spacing:.2px}
.brand-sub{font-size:12px; color: rgba(255,255,255,.65); margin-top:2px}


.nav{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.nav-item{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.90);
  font-size: 13px;
  text-decoration:none;
}
.nav-item:hover{
  filter: brightness(1.08);
  border-color: rgba(74,163,255,.25);
  background: rgba(74,163,255,.10);
}

.nav-danger{
  border-color: rgba(255,74,107,.18);
  background: rgba(255,74,107,.10);
}
.nav-danger:hover{
  border-color: rgba(255,74,107,.30);
  background: rgba(255,74,107,.16);
}

.badge{
  font-size:12px;
  padding:4px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--muted);
  background:rgba(255,255,255,.03);
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 70%), var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 14px 0;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px){
  .grid{grid-template-columns:1fr}
}

h2{margin:0 0 10px; font-size:22px}
h3{margin:0 0 10px; font-size:16px; color:#dbe7ff}

label{
  display:block;
  margin:10px 0 6px;
  font-size:13px;
  color:var(--muted);
}

input, select, textarea{
  width:100%;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
input:focus, select:focus, textarea:focus{
  border-color: rgba(74,163,255,.6);
  box-shadow: 0 0 0 3px rgba(74,163,255,.15);
}
/* Opciones del dropdown */
select option {
  background-color: rgba(255,255,255,.03);
  color: var(--text);
}

button{
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(74,163,255,.18), rgba(74,163,255,.08));
  color: var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
}
button:hover{filter:brightness(1.08)}
button:active{transform:translateY(1px)}
button.danger{
  background: linear-gradient(180deg, rgba(255,74,107,.20), rgba(255,74,107,.08));
  border-color: rgba(255,74,107,.25);
}

.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.msg{
  margin-top:10px;
  font-size:13px;
  color:var(--muted);
}
.msg.ok{color:var(--ok)}
.msg.bad{color:var(--danger)}

.tbl{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--line);
}
.tbl th, .tbl td{
  padding:10px 10px;
  border-bottom:1px solid var(--line);
  font-size:13px;
}
.tbl th{
  text-align:left;
  color:#cfe0ff;
  background:rgba(255,255,255,.03);
  position:sticky; top:0;
}
.tbl tr:hover td{background:rgba(255,255,255,.02)}

.hidden{display:none !important}

/* Modal base */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Overlay reutilizado por login y por el editor */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

/* Modal tradicional del login */
.modal-card {
  position: relative;
  z-index: 2;
  background: #1e1e1e;
  padding: 20px;
  border-radius: 10px;
  width: 600px;
  max-width: 95%;
}

/* Modal del editor/verificación dentro de .modal-back */
.modal-back > .modal {
  position: relative;
  inset: auto;
  display: block;
  z-index: 9999;
  background: #1e1e1e;
  padding: 20px;
  border-radius: 10px;
  width: 600px;
  max-width: 95%;
}
.modal .head{display:flex; justify-content:space-between; align-items:center; gap:10px}

@media (max-width: 760px){
  .topbar{flex-direction:column; align-items:stretch}
  .nav{justify-content:flex-start}
  #topEmpresaSel{ width: 100%; }
  .emp-switch{ border-radius: 16px; }
}

.mini-link{
  display:inline-flex;
  align-items:center;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.90);
  font-size: 13px;
  text-decoration:none;
  white-space:nowrap;
}
.mini-link:hover{
  filter:brightness(1.08);
  border-color: rgba(74,163,255,.25);
  background: rgba(74,163,255,.10);
}

.emp-switch{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.emp-label{
  font-size: 12px;
  color: rgba(255,255,255,.65);
  padding-left: 6px;
}
#topEmpresaSel{
  width: 260px;
  height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.92);
}

.table-wrap{
  border:1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.table-scroll{
  overflow:auto;
  max-height: 62vh;
}
.tbl th{
  position: sticky;
  top: 0;
  z-index: 2;
}
.tbl td, .tbl th{ white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
tr.selected td{ background: rgba(74,163,255,.10) !important; }
.ctx{
  position:absolute;
  z-index:99999;
  background: #0f1b33;
  border:1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding:8px;
  min-width: 180px;
}
.ctx button{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius:10px;
  border:0;
  background:transparent;
}
.ctx button:hover{ background: rgba(255,255,255,.06); }
.ctx hr{
  border:0;
  border-top:1px solid rgba(255,255,255,.10);
  margin:6px 0;
}
.editor2{display:grid;grid-template-columns:1.1fr .9fr;gap:14px;align-items:start;}
@media (max-width: 1100px){ .editor2{grid-template-columns:1fr;} }

.tab-content{margin-top:10px;max-height:48vh;overflow:auto;display:grid;grid-template-columns:1fr 1fr;gap:10px;}
@media (max-width: 1100px){ .tab-content{grid-template-columns:1fr;} }

/* Modal ancho tipo editor */
.modal-wide{
  width: min(1100px, 96vw);
  max-height: 88vh;
}

/* Tabs y campos dentro del modal */
.tabs{display:flex;gap:8px;flex-wrap:wrap;}
.tab{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.90);
  padding:8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor:pointer;
}
.tab:hover{filter:brightness(1.08); border-color: rgba(74,163,255,.25); background: rgba(74,163,255,.10);}
.tab.active{
  border-color: rgba(74,163,255,.35);
  background: rgba(74,163,255,.16);
}

/* Grid de campos: 2 columnas en desktop */
.tab-content{
  margin-top:10px;
  max-height:56vh;     /* más alto porque ya no hay panel lateral */
  overflow:auto;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  padding: 2px;
}
@media (max-width: 980px){
  .tab-content{grid-template-columns:1fr;}
}

.fld{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  border-radius: 12px;
  padding: 10px;
}
.fld small{
  display:block;
  font-size:12px;
  color: rgba(255,255,255,.65);
  margin-bottom:6px;
}
.fld input{
  width:100%;
}
/* ===== Select Dark Dropdown ===== */
.select-dark-wrapper {
  position: relative;
  width: 100%;
  font-size: 14px;
}

.select-dark {
  background: #1f1f1f;
  color: #fff;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: 0.2s;
}

.select-dark:hover {
  border-color: #666;
}

.select-dark.open {
  border-color: #0d6efd;
}

.select-dark-options {
  position: absolute;
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 10px;
  margin-top: 5px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.select-dark-options div {
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.15s;
}

.select-dark-options div:hover {
  background: #2a2a2a;
}

.select-hidden {
  display: none !important;
}


/* === Prolyam seal === */
.brand-sub{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.brand-sep{opacity:.6}
.brand-prolyam{color:var(--muted); text-decoration:none}
.brand-prolyam:hover{color:var(--text); text-decoration:underline}

.footer{margin-top:26px; border-top:1px solid var(--line); background:rgba(0,0,0,.10)}
.footer-inner{max-width:1200px; margin:0 auto; padding:14px 18px; display:flex; align-items:center; justify-content:space-between; gap:10px}
.footer-left{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.footer .seal{color:var(--muted); font-size:13px}
.footer-brand{color:var(--text); text-decoration:none; font-weight:650}
.footer-brand:hover{text-decoration:underline}
.footer-link{color:var(--muted); text-decoration:none}
.footer-link:hover{color:var(--text); text-decoration:underline}

.auth-by{margin-top:8px; color:var(--muted); font-size:13px}
.auth-by a{color:var(--text); text-decoration:none}
.auth-by a:hover{text-decoration:underline}
