:root{
  --navy:#1A0E45; --p2:#2B1A6B; --p3:#4A1A8A; --fuchsia:#C41884;
  --orange:#F47920; --orange2:#E05C14; --dark:#111827; --gray:#6B7280;
  --lgray:#F3F4F6; --border:#E5E7EB; --white:#FFFFFF;
}
*{box-sizing:border-box; margin:0; padding:0;}
body{font-family:'Segoe UI',Calibri,Arial,sans-serif; color:var(--dark); background:var(--lgray);}
a{color:inherit; text-decoration:none;}
button{font-family:inherit; cursor:pointer;}
input,select{font-family:inherit;}

.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(120deg,var(--fuchsia) 0%,var(--p3) 48%,var(--p2) 78%,var(--navy) 100%);
  padding:20px;
}
.login-card{
  background:#fff; border-radius:16px; padding:44px 40px; width:100%; max-width:400px;
  box-shadow:0 24px 60px rgba(0,0,0,.35);
}
.login-card img{height:42px; display:block; margin:0 auto 28px;}
.login-card h1{font-size:20px; color:var(--navy); text-align:center; margin-bottom:6px;}
.login-card p.sub{font-size:13px; color:var(--gray); text-align:center; margin-bottom:28px;}
.field{margin-bottom:16px;}
.field label{display:block; font-size:12px; font-weight:700; color:var(--gray); margin-bottom:6px; text-transform:uppercase; letter-spacing:.4px;}
.field input{width:100%; padding:11px 14px; border:1.5px solid var(--border); border-radius:8px; font-size:14px;}
.field input:focus{outline:none; border-color:var(--fuchsia);}
.btn-primary{
  width:100%; background:linear-gradient(90deg,var(--orange),var(--orange2)); color:#fff; border:none;
  border-radius:8px; padding:13px; font-weight:700; font-size:14px; margin-top:8px; transition:transform .15s;
}
.btn-primary:hover{transform:translateY(-1px);}
.btn-primary:disabled{opacity:.6; cursor:not-allowed; transform:none;}
.error-msg{background:#FEF2F2; color:#B91C1C; border:1px solid #FCA5A5; border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:16px; display:none;}
.error-msg.show{display:block;}

.app-shell{display:flex; min-height:100vh;}
.sidebar{
  width:260px; background:var(--navy); color:#fff; display:flex; flex-direction:column;
  padding:24px 0; flex-shrink:0;
}
.sidebar .logo{padding:0 24px 24px; border-bottom:1px solid rgba(255,255,255,.1); margin-bottom:16px;}
.sidebar .logo img{height:32px;}
.sidebar nav{flex:1; overflow-y:auto;}
.nav-item{
  display:flex; align-items:center; gap:10px; padding:11px 24px; font-size:13.5px; color:rgba(255,255,255,.75);
  cursor:pointer; border-left:3px solid transparent; transition:.15s;
}
.nav-item:hover{background:rgba(255,255,255,.06); color:#fff;}
.nav-item.active{background:rgba(244,121,32,.14); border-left-color:var(--orange); color:#fff; font-weight:600;}
.nav-section-title{padding:16px 24px 8px; font-size:10.5px; font-weight:800; letter-spacing:1px; color:rgba(255,255,255,.35); text-transform:uppercase;}
.sidebar .user-box{padding:16px 24px; border-top:1px solid rgba(255,255,255,.1);}
.sidebar .user-box .name{font-size:13px; font-weight:700;}
.sidebar .user-box .role{font-size:11px; color:rgba(255,255,255,.5); margin-bottom:10px;}
.sidebar .user-box button{background:none; border:1px solid rgba(255,255,255,.25); color:#fff; font-size:12px; padding:6px 12px; border-radius:6px; width:100%;}
.sidebar .user-box button:hover{background:rgba(255,255,255,.08);}

.main{flex:1; display:flex; flex-direction:column; min-width:0;}
.topbar{
  background:#fff; border-bottom:1px solid var(--border); padding:16px 32px;
  display:flex; align-items:center; justify-content:space-between;
}
.topbar h2{font-size:19px; color:var(--navy);}
.search-box{position:relative; width:320px;}
.search-box input{width:100%; padding:9px 14px 9px 36px; border:1.5px solid var(--border); border-radius:8px; font-size:13.5px;}
.search-box svg{position:absolute; left:11px; top:50%; transform:translateY(-50%); width:15px; height:15px; color:var(--gray);}
.content{padding:28px 32px; flex:1; overflow-y:auto;}

.cat-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px; margin-top:8px;}
.cat-card{
  background:#fff; border:1px solid var(--border); border-radius:12px; padding:20px;
  cursor:pointer; transition:.15s; box-shadow:0 1px 3px rgba(0,0,0,.04);
}
.cat-card:hover{border-color:var(--orange); box-shadow:0 6px 18px rgba(0,0,0,.08); transform:translateY(-2px);}
.cat-card .icon{width:44px; height:44px; border-radius:10px; background:var(--navy); display:flex; align-items:center; justify-content:center; margin-bottom:14px;}
.cat-card .icon svg{width:22px; height:22px; color:var(--orange);}
.cat-card h3{font-size:14.5px; color:var(--navy); margin-bottom:4px;}
.cat-card .count{font-size:12px; color:var(--gray);}

.doc-table{width:100%; background:#fff; border:1px solid var(--border); border-radius:12px; overflow:hidden; border-collapse:collapse;}
.doc-table th{background:var(--lgray); text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; color:var(--gray); padding:12px 16px; font-weight:700;}
.doc-table td{padding:13px 16px; border-top:1px solid var(--border); font-size:13.5px;}
.doc-table tr:hover td{background:#FAFAFA;}
.doc-name{display:flex; align-items:center; gap:10px; font-weight:600; color:var(--navy);}
.doc-name svg{width:17px; height:17px; color:var(--gray); flex-shrink:0;}
.doc-actions{display:flex; gap:8px;}
.btn-sm{border:1px solid var(--border); background:#fff; border-radius:6px; padding:6px 12px; font-size:12px; font-weight:600; color:var(--navy);}
.btn-sm:hover{border-color:var(--orange); color:var(--orange);}
.btn-sm.danger:hover{border-color:#DC2626; color:#DC2626;}

.btn-upload{
  background:linear-gradient(90deg,var(--orange),var(--orange2)); color:#fff; border:none; border-radius:8px;
  padding:10px 18px; font-size:13.5px; font-weight:700; display:inline-flex; align-items:center; gap:8px;
}
.btn-upload svg{width:16px; height:16px;}

.empty-state{text-align:center; padding:60px 20px; color:var(--gray);}
.empty-state svg{width:48px; height:48px; margin-bottom:12px; opacity:.4;}

.modal-overlay{
  position:fixed; inset:0; background:rgba(17,24,39,.55); display:none;
  align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal-overlay.show{display:flex;}
.modal{background:#fff; border-radius:14px; padding:28px; width:100%; max-width:420px; max-height:88vh; overflow-y:auto;}
.modal h3{font-size:17px; color:var(--navy); margin-bottom:18px;}
.modal .field{margin-bottom:14px;}
.modal-actions{display:flex; gap:10px; margin-top:20px;}
.modal-actions .btn-sm{flex:1; text-align:center; padding:10px;}
.dropzone{
  border:2px dashed var(--border); border-radius:10px; padding:30px 16px; text-align:center;
  color:var(--gray); font-size:13px; cursor:pointer; transition:.15s;
}
.dropzone.drag{border-color:var(--orange); background:#FFF7F0;}
.rol-check-row{display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:13px;}
.rol-check-row label{display:flex; align-items:center; gap:6px; font-size:12px; color:var(--gray);}

.toast{
  position:fixed; bottom:24px; right:24px; background:var(--navy); color:#fff; padding:13px 20px;
  border-radius:8px; font-size:13.5px; box-shadow:0 8px 24px rgba(0,0,0,.25); z-index:100;
  display:none; max-width:340px;
}
.toast.show{display:block;}
.toast.error{background:#B91C1C;}

@media(max-width:860px){
  .sidebar{position:fixed; left:-260px; top:0; bottom:0; z-index:40; transition:.2s;}
  .sidebar.open{left:0;}
  .search-box{width:180px;}
}
