:root{
  --bg:#ffffff;
  --card:#f9fafb;
  --panel:#f3f4f6;
  --text:#111827;
  --muted:#4b5563;
  --line:#d1d5db;
  --gray:#e5e7eb;
  --gray-hover:#d1d5db;
  --danger:#dc2626;
  --shadow:0 6px 18px rgba(0,0,0,.08);
  --radius:14px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: system-ui,Segoe UI,Roboto,Arial;
  background:var(--bg);
  color:var(--text);
}

/* ===== LOGIN ===== */
.login-container{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:16px;
}

.login-title{
  width:360px;
  text-align:center;
  font-size:20px;
  font-weight:700;
  padding:14px;
}

.login-box{
  width:360px;
}

.hint{
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
}

.kbd{
  border:1px solid var(--line);
  background:var(--panel);
  padding:2px 6px;
  border-radius:8px;
  font-weight:700;
}

/* ===== GENERAL ===== */
.wrap{
  max-width:1100px;
  margin:auto;
  padding:20px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.p24{padding:24px}
.subtitle{color:var(--muted)}

.module{
  padding:18px;
}

.inner{
  padding:14px;
  box-shadow:none;
  background:#fff;
}

.hr{
  height:1px;
  background:var(--line);
  margin:14px 0;
}

/* ===== TOPBAR ===== */
.topbar{
  background:#fff;
  border-bottom:1px solid var(--line);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 20px;
}

.spacer{flex:1}

/* ===== HOME ===== */
.home-header{
  text-align:center;
}

.home-logos{
  display:flex;
  justify-content:center;
  gap:20px;
  margin-bottom:14px;
}

.logo-box{display:flex;align-items:center;justify-content:center}

.logo-placeholder{
  width:70px;
  height:70px;
  border:1px dashed var(--line);
  border-radius:12px;
  background:var(--panel);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

.logo-img{
  width:70px;
  height:70px;
  object-fit:contain;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.home-welcome{
  margin:10px 0 20px;
}

.home-municipio{
  margin-top:8px;
  color:var(--muted);
}

/* ===== FORM ===== */
label{
  display:block;
  margin-top:12px;
  font-size:13px;
  color:var(--muted);
}

.input{
  width:100%;
  padding:10px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
}

/* ===== BOTONES ===== */
.btn{
  border:1px solid var(--line);
  background:var(--gray);
  padding:8px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
  color:var(--text);
}

.btn:hover{background:var(--gray-hover)}

.btn-danger{
  background:#fee2e2;
  border-color:#fca5a5;
  color:#7f1d1d;
}

.btn-primary{
  background:var(--gray-hover);
}

/* ===== MENÚ ===== */
.menu-grid{
  margin-top:16px;
  display:grid;
  grid-template-columns:repeat(12,1fr);
  gap:14px;
}

.menu-item{
  grid-column:span 4;
  padding:16px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
  cursor:pointer;
}

.menu-item:hover{
  background:var(--gray-hover);
}

@media(max-width:900px){
  .menu-item{grid-column:span 6}
}
@media(max-width:520px){
  .menu-item{grid-column:span 12}
}

/* ===== NAV ===== */
.pillbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.navlink{
  background:var(--gray);
  border:1px solid var(--line);
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  cursor:pointer;
}

.navlink.active{
  background:var(--gray-hover);
  font-weight:600;
}

/* ===== TOAST ===== */
.toast{
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  background:var(--panel);
  border:1px solid var(--line);
  padding:10px 14px;
  border-radius:10px;
  box-shadow:var(--shadow);
  display:none;
  z-index:3000;
}

.toast.show{display:block}

/* ===== MODAL ===== */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:2000;
}

.modal{
  width:min(900px, 100%);
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow: var(--shadow);
  overflow:hidden;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  background:var(--panel);
}

.modal-title{font-weight:800}
.modal-body{padding:14px}

.modal-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding:12px 14px;
  border-top:1px solid var(--line);
  background:#fff;
}

/* ===== LAYOUT HELPERS ===== */
.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-top:12px;
}
@media(max-width:900px){
  .grid2{grid-template-columns:1fr}
}

/* ===== TABLE ===== */
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  font-size:13px;
}

.table th, .table td{
  border-bottom:1px solid var(--line);
  padding:10px 8px;
  text-align:left;
}

.table th{
  background:var(--panel);
  font-weight:800;
}

/* ===== LIST ===== */
.list{
  margin-top:10px;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
  max-height:360px;
  overflow:auto;
}

.list-item{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  cursor:pointer;
}

.list-item:last-child{border-bottom:none}
.list-item:hover{background:var(--panel)}
.list-item.active{background:var(--gray-hover)}

.list-item .t{font-weight:800}
.list-item .s{font-size:12px;color:var(--muted)}

.muted{color:var(--muted)}

/* ===== KV ===== */
.kv{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:8px 12px;
  font-size:13px;
}

.kv .k{ color:var(--muted); }
.kv .v{ color:var(--text); }

/* ===== DOCS ===== */
.docs{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.doc-item{
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px;
  background:#fff;
  font-size:13px;
}