:root{font-family:system-ui,-apple-system,Segoe UI,sans-serif;background:#edf4ff;color:#162f54}*{box-sizing:border-box}body{margin:0;min-height:100vh}button,input,select,textarea{font:inherit}button{cursor:pointer}a{color:#1259c3}header.brand{position:sticky;z-index:2;top:0;background:#fff;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px clamp(14px,3vw,32px);border-bottom:1px solid #d8e5f4;box-shadow:0 3px 12px #0c397212}.brandname{display:flex;align-items:center;gap:12px}.brandname b{display:block;font-size:18px;color:#0743a5}.brandname small{display:block;font-size:12px;color:#40669b}.dot{width:42px;height:42px;border-radius:13px;background:linear-gradient(145deg,#1765ed,#48a3ff);display:grid;place-items:center;font-weight:900;color:white;font-size:23px}.right{display:flex;gap:12px;align-items:center;flex-wrap:wrap;font-size:13px}main{max-width:1180px;margin:0 auto;padding:22px 16px 56px}h1{font-size:clamp(22px,4vw,30px);margin:8px 0}h2{font-size:18px;margin:0 0 14px}h3{font-size:16px}p{line-height:1.55}small,.hint{color:#5b7192}.notice{padding:16px;border-radius:12px;background:#fff2d6;border:1px solid #e6d2a7}.notice.info{background:#e4f1ff;border-color:#bddeff}.panel{background:#fff;border-radius:16px;padding:22px;border:1px solid #d6e3f5;box-shadow:0 5px 18px #1039680b;margin-bottom:17px}.narrow{max-width:520px;margin:5vh auto}.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.kpi{background:white;border:1px solid #d6e4f7;border-radius:17px;padding:18px;min-width:0}.kpi label{display:block;color:#617797;text-transform:uppercase;font-size:11px;font-weight:750;margin-bottom:10px}.kpi strong{display:block;font-size:clamp(21px,3vw,28px);letter-spacing:-.7px;white-space:nowrap}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.field{display:flex;flex-direction:column;gap:6px;min-width:0}.field label{font-weight:680;font-size:13px}.field input,.field select,.field textarea{border:1px solid #bbcce3;border-radius:10px;padding:11px 12px;background:white;color:#173b69;min-width:0;width:100%}.field input:focus,.field select:focus{outline:3px solid #b3dcff;border-color:#3886ff}.span2{grid-column:1/-1}.btn{border:0;border-radius:10px;background:#2563eb;color:white;padding:11px 17px;font-weight:750;transition:.12s}.btn:hover{filter:brightness(.96)}.btn:disabled{opacity:.55;cursor:wait}.btn.ghost{background:#ebf2ff;color:#114b9b}.btn.outline{background:white;border:1px solid #bad2f7;color:#1257c2}.btn.danger{background:#bb2c3b}.buttons{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}.nav{display:flex;gap:7px;overflow-x:auto;padding:4px 0 15px;scrollbar-width:thin}.nav button{white-space:nowrap;border-radius:10px;padding:10px 13px;border:1px solid #c9ddfa;background:white;color:#214e8c;font-weight:750}.nav button.active{background:#185be6;color:white;border-color:#185be6}.chip{display:inline-block;padding:4px 8px;background:#e5edfe;border-radius:20px;font-size:11px;font-weight:700}.topline{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:14px}.tablewrap{overflow-x:auto}table{width:100%;border-collapse:collapse;min-width:540px;font-size:13px}th,td{text-align:left;padding:11px 9px;border-bottom:1px solid #e8edf5}th{color:#5d7191;font-size:11px;text-transform:uppercase}tr:last-child td{border-bottom:0}.muted{color:#657898}.bad{color:#b72937;font-weight:700}.good{color:#07835e;font-weight:700}.open{color:#087252}.closed{color:#6a7890}.submit{margin-top:16px}.alert{background:#fff5dd;border:1px solid #f4d69a;padding:12px;border-radius:10px;font-size:13px}footer{text-align:center;color:#667d9f;font-size:12px;padding:18px}footer a{margin-left:8px}#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#173b66;color:white;border-radius:12px;padding:13px 19px;box-shadow:0 9px 26px #163b6959;max-width:90vw;z-index:6;display:none}#toast.show{display:block}.note{font-size:12px;color:#5e7190;margin:10px 0 0}.tag{border-radius:8px;padding:2px 8px;background:#eef3ff;font-size:12px}form{margin:0}@media(max-width:700px){main{padding:14px 10px 45px}.grid{grid-template-columns:repeat(2,minmax(0,1fr))}.formgrid{grid-template-columns:1fr}.panel{padding:16px;border-radius:13px}.right #who{display:none}.brandname b{font-size:16px}.brandname small{font-size:11px}.kpi{padding:13px}.kpi strong{font-size:21px}.span2{grid-column:auto}.btn{padding:11px 13px}}

/* Autogestión de accesos desde móviles y escritorio */
.user-edit{border:1px solid #cad8f1;border-radius:12px;padding:12px;margin:12px 0;background:#f9fcff}
.user-edit summary{cursor:pointer;font-weight:700;color:#13427d}
.user-actions{padding:12px 2px 0}
.user-actions form{padding:12px;margin:12px 0;background:#fff;border:1px solid #e0e9fb;border-radius:10px}
.user-actions .btn{margin-top:8px}

/* Diseño de gestión V4.3: estilo original, datos D1 intactos */
body.dashboard-active{background:#edf5ff;color:#14223b}
.dashboard-active header.brand,.dashboard-active footer{display:none}
.dashboard-active main#app{max-width:none;padding:0;margin:0}
.app-frame{display:grid;grid-template-columns:214px minmax(0,1fr);min-height:100vh}
.app-sidebar{background:#fff;border-right:1px solid #dfebf8;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;padding:25px 14px 14px;overflow-y:auto}
.brand-aside{padding:0 5px;margin-bottom:28px}.brand-aside b,.app-mobile-header b{display:block;color:#1453b6;font-size:17px;font-weight:850}.brand-aside small,.app-mobile-header small{font-size:12px;color:#4773a3;display:block;margin-top:3px}
.aside-hello{font-size:12px;color:#64768d;margin:0 5px 7px}.aside-role{font-size:10px;font-weight:800;color:#225cec;letter-spacing:.4px;margin:0 5px 20px}
.app-menu{display:flex;flex-direction:column;gap:3px}
.menu-link{display:flex;align-items:center;gap:12px;border:0;background:transparent;color:#4e5e75;border-radius:11px;padding:12px;font-size:14px;font-weight:620;text-align:left;cursor:pointer}
.app-menu .menu-link{width:100%}.app-menu .menu-link.active,.app-menu .menu-link:hover{background:#dceaff;color:#205ef0;font-weight:800}
.menu-icon{width:20px;height:20px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.aside-footer{margin-top:auto;border-top:1px solid #edf1f7;padding:13px 5px 0;display:grid;gap:12px;color:#738198}.aside-footer .btn{font-size:12px;padding:9px}
.app-content{min-width:0;padding:30px clamp(15px,3.1vw,43px) 65px}.app-content-inner{max-width:1080px;margin:auto}
.page-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:28px}.page-heading h1{font-size:24px;letter-spacing:-.8px;margin:0 0 3px}.page-heading p{font-size:14px;color:#65788f;margin:0}.heading-chip{font-size:11px;border-radius:20px;background:#e4eeff;color:#2354a1;padding:7px 10px;white-space:nowrap}
.dashboard-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:0 0 23px}
.dashboard-card{min-width:0;display:flex;align-items:flex-start;flex-direction:column;background:#fff;border:1px solid #edf1f7;border-radius:20px;padding:22px;min-height:150px;box-shadow:0 6px 18px #20386b0a}
.dash-icon{width:37px;height:37px;border-radius:11px;color:#fff;display:grid;place-items:center;margin-bottom:13px}.dash-icon svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
.dash-icon.blue{background:linear-gradient(135deg,#3984ff,#2563eb)}.dash-icon.red{background:linear-gradient(135deg,#ff7171,#ea4949)}.dash-icon.purple{background:linear-gradient(135deg,#7974ff,#4f46e5)}.dash-icon.green{background:linear-gradient(135deg,#1ac995,#069970)}
.dash-label{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:#8090a5;font-weight:750}
.dashboard-card strong{color:#122238;font-size:24px;letter-spacing:-.8px;font-weight:850;line-height:1.4}.dashboard-card small{font-size:11px;color:#93a0b3}
.dashboard-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:12px}.dashboard-actions .btn{width:100%;min-height:45px;border-radius:11px}.extra-action{display:flex;justify-content:flex-end;margin-bottom:20px}.extra-action .btn{font-size:12px}
.app-content .panel{border-radius:18px;border-color:#edf1f7}.app-content .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.app-mobile-header,.app-mobile-nav,.app-mobile-more{display:none}
@media(max-width:760px){.app-frame{display:block}.app-sidebar{display:none}.app-content{padding:15px 12px 95px}
.app-mobile-header{display:flex;align-items:center;justify-content:space-between;margin:-15px -12px 16px;padding:12px;background:white;border-bottom:1px solid #dfebf8}.app-mobile-header .btn{font-size:12px;padding:8px 11px}
.page-heading{margin-bottom:18px}.page-heading h1{font-size:20px}.page-heading p{font-size:12px}.heading-chip{font-size:10px}
.dashboard-cards{gap:10px}.dashboard-card{padding:14px;border-radius:17px;min-height:131px}.dash-icon{width:34px;height:34px;margin-bottom:9px}.dashboard-card strong{font-size:19px;overflow-wrap:anywhere}.dash-label{font-size:10px}.dashboard-actions .btn{font-size:12px;padding:11px 6px;white-space:normal}
.app-mobile-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;bottom:0;left:0;right:0;background:white;border-top:1px solid #dfe8f8;padding:5px 0 env(safe-area-inset-bottom);height:calc(66px + env(safe-area-inset-bottom));z-index:5;box-shadow:0 -6px 20px #182f660b}
.app-mobile-nav .menu-link{font-size:10px;color:#91a2b8;flex-direction:column;gap:5px;justify-content:center;align-items:center;min-width:0;padding:5px 0}.app-mobile-nav .menu-link.active{color:#205feb;font-weight:800}
.app-mobile-more{display:flex;flex-direction:column;position:fixed;right:8px;bottom:78px;background:white;border:1px solid #e1eaf5;border-radius:13px;box-shadow:0 6px 30px #223f6e30;z-index:6;min-width:200px;max-height:60vh;overflow-y:auto;padding:8px}
.app-mobile-more[hidden]{display:none}.app-mobile-more .menu-link.active{background:#dceaff;color:#215ed9}
}
