:root{--bordo:#7b1e3a;--bordo2:#5e1429;--gris:#f4f2f3;--txt:#2b2b2b;--pos:#1e8449;--neg:#c0392b}
*{box-sizing:border-box}
body{margin:0;font-family:"Segoe UI",Arial,sans-serif;color:var(--txt);background:var(--gris)}
.top{display:flex;align-items:center;gap:24px;background:var(--bordo);color:#fff;padding:10px 24px;flex-wrap:wrap}
.top a{color:#fff;text-decoration:none;margin-right:14px;opacity:.9}.top a:hover{opacity:1;text-decoration:underline}
.brand{font-weight:700;font-size:18px}.top nav{flex:1}
.who{display:flex;align-items:center;gap:14px;font-size:14px}.who small{opacity:.8}
.wrap{max-width:1150px;margin:22px auto;padding:0 16px}
h1{font-size:22px;color:var(--bordo2);margin:0 0 14px}h2{font-size:16px;color:var(--bordo2);margin:0 0 10px}
.card{background:#fff;border-radius:10px;padding:18px;margin-bottom:18px;box-shadow:0 1px 4px rgba(0,0,0,.08);overflow-x:auto}
.login{max-width:380px;margin:60px auto}
.form{max-width:640px}
label{display:block;font-size:14px;margin-bottom:12px;font-weight:600}
input[type=text],input[type=email],input[type=password],select,input[type=file]{display:block;width:100%;margin-top:4px;padding:9px;border:1px solid #cfc8cb;border-radius:6px;font-size:14px;font-family:inherit}
.btn{display:inline-block;background:var(--bordo);color:#fff;border:0;border-radius:6px;padding:10px 18px;font-size:14px;cursor:pointer;text-decoration:none}
.btn:hover{background:var(--bordo2)}
button.link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;text-decoration:underline;padding:0}
.card button.link{color:var(--bordo)}
form.inline{display:inline;margin:0}
.head-row{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:6px}
.filtro label{margin:0;font-weight:600}.filtro select{min-width:220px}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;margin-bottom:18px}
.kpi{background:#fff;border-radius:10px;padding:14px 16px;box-shadow:0 1px 4px rgba(0,0,0,.08);border-top:3px solid var(--bordo)}
.kpi span{display:block;font-size:12px;color:#777;text-transform:uppercase;letter-spacing:.3px}
.kpi b{display:block;font-size:26px;margin:4px 0;color:var(--bordo2)}.kpi small{color:#777}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}@media(max-width:850px){.grid2{grid-template-columns:1fr}}
table{width:100%;border-collapse:collapse;font-size:14px}
th{background:var(--bordo2);color:#fff;text-align:left;padding:8px 10px;font-weight:600}
td{padding:7px 10px;border-bottom:1px solid #eee}tbody tr:nth-child(even){background:#faf8f9}
.r{text-align:right}.tot td{font-weight:700;background:#efe6ea}
.pos{color:var(--pos)}.neg{color:var(--neg)}
.flash{padding:11px 14px;border-radius:6px;margin-bottom:14px;font-size:14px}
.flash.error{background:#fdecea;color:#8a1f17}.flash.ok{background:#e8f5e9;color:#1b5e20}
.flash.secreto{background:#fff8e1;color:#5d4300;border:1px dashed #e0a800;font-family:Consolas,monospace;word-break:break-all}
.muted{color:#777;font-size:13px}
.tag{padding:2px 8px;border-radius:10px;font-size:12px;color:#fff;background:#888}
.tag.admin{background:var(--bordo)}.tag.gerente{background:#c9892b}.tag.vendedor{background:#4a7fb0}
tr.off td{opacity:.5}.acc a,.acc button{margin-right:10px;font-size:13px}

/* barra de filtros por fecha */
.filtro.barra{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px 16px;background:#fff;border-radius:10px;padding:14px 16px;margin-bottom:18px;box-shadow:0 1px 4px rgba(0,0,0,.08)}
.filtro.barra label{font-size:13px}
.filtro.barra select{min-width:180px}
input[type=date]{display:block;margin-top:4px;padding:8px;border:1px solid #cfc8cb;border-radius:6px;font-size:14px;font-family:inherit}
.filtro .acciones{display:flex;align-items:center;gap:14px}
.filtro .limpiar{color:var(--bordo);font-size:14px}
h1 .periodo{display:block;font-size:14px;font-weight:400;color:#777;margin-top:4px}
.filtro .chk{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;padding-bottom:10px;cursor:pointer}
.filtro .chk input{width:16px;height:16px;accent-color:var(--bordo)}
input[type=search]{display:block;margin-top:4px;padding:9px;border:1px solid #cfc8cb;border-radius:6px;font-size:14px;font-family:inherit;min-width:260px}

/* tabla clientes x mes */
.cm-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.cm-head h2{margin:0}
.cm-anios{display:flex;border:1px solid #cfc8cb;border-radius:6px;overflow:hidden}
.cm-btn{background:#fff;border:0;padding:8px 26px;font:inherit;font-size:14px;cursor:pointer;color:var(--txt)}
.cm-btn+.cm-btn{border-left:1px solid #cfc8cb}
.cm-btn.activo{background:var(--bordo);color:#fff;font-weight:600}
.tabla-meses{font-size:13px;white-space:nowrap}
.tabla-meses th,.tabla-meses td{padding:6px 8px}
.tabla-meses td:first-child{white-space:normal;min-width:200px;font-weight:600;color:var(--bordo2)}
.tabla-meses tr.otros td{color:#666;font-style:italic}
.cm-acciones{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.cm-acciones .link{color:var(--bordo);font-size:13px;background:none;border:0;cursor:pointer;text-decoration:underline;padding:0}
.cm-exp{width:22px;height:22px;border:1px solid #b9aeb3;background:#fff;border-radius:3px;cursor:pointer;font-weight:700;line-height:1;color:var(--bordo2);margin-right:6px}
.tabla-meses tr.marca td{background:#f6eff2}
.tabla-meses tr.producto td:first-child{padding-left:42px;font-weight:400;color:var(--txt)}
.cm-scroll{max-height:460px;overflow:auto;border:1px solid #eadfe3;border-radius:6px}
.cm-scroll thead th{position:sticky;top:0;z-index:2}
.cm-scroll tfoot td{position:sticky;background:#efe4e8;z-index:1;font-weight:700}
.cm-scroll tfoot tr.tot td{bottom:31px}
.cm-scroll tfoot tr.activos td{bottom:0;font-weight:400;font-style:italic;color:#6b5d63;background:#f7f1f3}
.cm-buscar{padding:7px 10px;border:1px solid #cdbfc5;border-radius:6px;font-size:13px;min-width:200px}
.tabla-meses tr.sin-res td{text-align:center;color:#8a7c82;font-style:italic}
.cm-scroll tfoot td:first-child{white-space:nowrap}
.proy-reg{margin-top:16px;overflow-x:auto}
.proy-tabla{border-collapse:collapse;font-size:13px;white-space:nowrap;min-width:420px}
.proy-tabla th{background:#1f3864;color:#fff;padding:7px 12px;text-align:center;text-transform:uppercase;font-size:12px}
.proy-tabla th:first-child{text-align:left;min-width:120px}
.proy-tabla td{padding:6px 12px;text-align:center;border-bottom:1px solid #e6e1e3}
.proy-tabla td.et{text-align:left;font-weight:700;color:#1f3864;background:#eef2f8;text-transform:uppercase;font-size:12px}
.proy-tabla tr.resta td{background:#fff2cc;font-weight:700;color:#7f6000}
.proy-tabla tr.resta td.et{color:#7f6000}
.av{font-weight:700}.av.ok{color:var(--pos)}.av.medio{color:#b7791f}.av.bajo{color:var(--neg)}
.barra-av{display:inline-block;width:120px;height:8px;background:#eee;border-radius:4px;vertical-align:middle;margin-right:8px;overflow:hidden}
.barra-av i{display:block;height:100%;background:#999}.barra-av i.ok{background:var(--pos)}.barra-av i.medio{background:#d69e2e}.barra-av i.bajo{background:var(--neg)}
.proy-resumen td.resta{color:#7f6000;font-weight:700}
.aporte{margin:8px 0 0;font-size:14px}
#proy select{padding:6px 8px;border-radius:6px;border:1px solid #cdbfc5}
#proy .cm-head select{width:auto;min-width:180px}
#proy .cm-head a.link{color:var(--bordo);font-size:13px;font-weight:600;text-decoration:none}

/* accesos */
.acc-est{display:inline-block;padding:2px 10px;border-radius:10px;font-size:12px;font-weight:600}
.acc-est.entro{background:#e8f5e9;color:#1b5e20}
.acc-est.sin{background:#fff3e0;color:#8a5300}
.acc-est.nunca{background:#fdecea;color:#8a1f17}

/* hojas por usuario */
.hojas-chk{display:flex;gap:22px;flex-wrap:wrap;margin:6px 0 4px}
.chk-h{display:flex;align-items:center;gap:6px;font-weight:400;margin:0;cursor:pointer}
.chk-h input{width:16px;height:16px;accent-color:var(--bordo)}
#hojas-box{margin-bottom:12px}
