*{box-sizing:border-box}
html{min-height:100%;scroll-behavior:smooth}
html,body{margin:0;padding:0;min-height:100%;font-family:Arial,Helvetica,sans-serif;color:#292529;background:#f7f6f6}
body{overflow-x:hidden}
button,input,textarea,select{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}
img{max-width:100%;height:auto}
a{color:inherit}
[hidden]{display:none!important}
:root{--naranja:#f57d05;--naranja-oscuro:#d96704;--naranja-claro:#fff1e2;--naranja-muy-claro:#fff8f2;--magenta:#e90371;--magenta-oscuro:#c90261;--magenta-claro:#fff0f7;--blanco:#fff;--fondo:#f7f6f6;--texto:#292529;--gris:#777;--borde:#e7e3e4;--rojo:#c62828;--verde:#237a42;--sombra:0 8px 25px rgba(0,0,0,.045);--sombra-hover:0 16px 38px rgba(0,0,0,.09)}

.form-group{margin-bottom:20px}
.form-group label{display:block;margin-bottom:8px;font-size:13px;font-weight:700}
.form-group input,.form-group textarea,.form-group select{width:100%;border:1px solid var(--borde);border-radius:11px;background:#fff;outline:none;transition:.2s}
.form-group input,.form-group select{height:50px;padding:0 14px}
.form-group textarea{min-height:130px;padding:14px;resize:vertical;line-height:1.5}
.form-group input:focus,.form-group textarea:focus,.form-group select:focus{border-color:var(--naranja);box-shadow:0 0 0 3px rgba(245,125,5,.1)}

.login-page{min-height:100vh;min-height:100dvh;padding:24px;background:linear-gradient(135deg,#fff8f2,#fff0e4 45%,#f89032);display:flex;align-items:center;justify-content:center}
.login-container{width:100%;max-width:500px}
.login-card{background:#fff;border-radius:26px;padding:38px;box-shadow:0 26px 70px rgba(100,54,12,.17)}
.login-logo{display:flex;justify-content:center;margin-bottom:17px}
.logo-placeholder{width:100px;height:100px;border-radius:20px;background:#fff;border:1px solid #eee;overflow:hidden;display:flex;align-items:center;justify-content:center}
.logo-placeholder img{width:100%;height:100%;object-fit:contain;padding:3px}
.login-header{text-align:center;margin-bottom:29px}
.login-header h1{margin:0;color:var(--naranja);font-size:32px}
.login-header h2{margin:4px 0 8px;color:var(--magenta);font-size:24px}
.login-header p{margin:0;color:#858585;font-size:14px}
.password-container{position:relative}
.password-container input{padding-right:78px}
.btn-password{position:absolute;right:7px;top:7px;height:36px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:var(--magenta);font-size:13px;font-weight:700}
.btn-password:hover{background:var(--magenta-claro)}
.btn-principal{width:100%;height:52px;border:0;border-radius:11px;background:var(--naranja);color:#fff;font-size:16px;font-weight:700}
.btn-principal:hover{background:var(--naranja-oscuro)}
.btn-principal:disabled{opacity:.6;cursor:not-allowed}
.login-message{min-height:20px;margin:-2px 0 13px;text-align:center;font-size:13px}
.login-message.error{color:var(--rojo)}
.login-message.success{color:var(--verde)}
.login-footer{margin-top:27px;padding-top:20px;border-top:1px solid #eee;text-align:center;color:#777;font-size:12px;line-height:1.5}
.login-footer strong,.login-footer span{display:block}
.login-footer strong{color:#444}
.volver-sitio{display:inline-block;margin-top:11px;color:var(--magenta);font-weight:700}
.volver-sitio:hover{text-decoration:underline}

.app-body{min-height:100vh;background:var(--fondo)}
.app-header{min-height:76px;padding:11px max(24px,calc((100vw - 1280px)/2));background:#fff;border-bottom:1px solid #e8e5e6;display:flex;align-items:center;justify-content:space-between;gap:20px;position:relative;z-index:20}
.app-brand{display:flex;align-items:center;gap:12px;min-width:0;flex:1}
.brand-logo{width:52px;height:52px;min-width:52px;border-radius:12px;background:#fff;border:1px solid #eee;overflow:hidden;display:flex;align-items:center;justify-content:center}
.brand-logo img{width:100%;height:100%;object-fit:contain;padding:2px}
.app-brand>div:last-child{min-width:0}
.app-brand strong,.app-brand span{display:block}
.app-brand strong{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.app-brand span{margin-top:3px;color:#888;font-size:11px}
.app-user{display:flex;align-items:center;justify-content:flex-end;gap:9px;flex-shrink:0}
.app-user>span{margin-right:5px;font-size:13px;font-weight:700}
.btn-salir,.btn-regresar{min-height:40px;padding:0 14px;border:1px solid #ddd;border-radius:9px;background:#fff;color:#555;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600}
.btn-salir:hover,.btn-regresar:hover{border-color:var(--naranja);color:var(--naranja);background:var(--naranja-muy-claro)}

.dashboard{width:min(1280px,calc(100% - 40px));margin:auto;padding:44px 0 55px}
.dashboard-welcome{position:relative;overflow:hidden;margin-bottom:24px;padding:38px 40px;border-radius:22px;background:linear-gradient(120deg,var(--naranja),#f79a44);color:#fff;box-shadow:0 15px 35px rgba(245,125,5,.16)}
.dashboard-welcome::before{content:"";position:absolute;width:210px;height:210px;border-radius:50%;right:-50px;top:-120px;background:rgba(233,3,113,.16)}
.dashboard-label{display:inline-block;margin-bottom:12px;padding:6px 10px;border-radius:7px;background:rgba(255,255,255,.19);font-size:10px;font-weight:700;letter-spacing:1.1px}
.dashboard-welcome h1{position:relative;margin:0 0 8px;font-size:31px}
.dashboard-welcome p{position:relative;margin:0;max-width:680px;font-size:14px;line-height:1.55}
.dashboard-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.action-card{padding:26px;background:#fff;border:1px solid #e7e4e5;border-radius:18px;text-decoration:none;color:var(--texto);display:flex;gap:18px;box-shadow:var(--sombra);transition:.2s}
.action-card:hover{transform:translateY(-3px);box-shadow:var(--sombra-hover)}
.action-icon{width:55px;height:55px;min-width:55px;border-radius:14px;background:#fff;color:var(--magenta);display:flex;align-items:center;justify-content:center;font-size:31px}
.action-icon-light{background:var(--magenta-claro)}
.action-card h2{margin:2px 0 7px;font-size:19px}
.action-card p{margin:0 0 14px;color:#777;font-size:13px;line-height:1.55}
.action-card span{color:var(--magenta);font-size:12px;font-weight:700}
.action-primary{background:linear-gradient(135deg,var(--naranja),#f78d2e);border-color:var(--naranja);color:#fff}
.action-primary p{color:rgba(255,255,255,.88)}
.action-primary span{color:#fff}
.business-info{margin-top:22px;padding:22px 24px;background:#fff;border:1px solid #e7e4e5;border-radius:17px;display:grid;grid-template-columns:1fr 2fr 1fr;gap:25px;box-shadow:var(--sombra)}
.business-info span,.business-info strong{display:block}
.business-info span{margin-bottom:6px;color:var(--magenta);font-size:9px;font-weight:700;letter-spacing:.8px}
.business-info strong{font-size:12px;line-height:1.55}

.nota-page,.historial-page{width:min(1280px,calc(100% - 40px));margin:auto;padding:34px 0 55px}
.nota-page-header,.historial-header{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:22px}
.nota-eyebrow{display:block;margin-bottom:6px;color:var(--magenta);font-size:10px;font-weight:700;letter-spacing:1.1px}
.nota-page-header h1,.historial-header h1{margin:0;font-size:29px}
.nota-page-header p,.historial-header p{margin:6px 0 0;color:#777;font-size:13px}
.folio-preview{min-width:220px;padding:14px 18px;background:#fff;border:1px solid #e5e2e3;border-top:3px solid var(--magenta);border-radius:13px;text-align:right;box-shadow:var(--sombra)}
.folio-preview span,.folio-preview strong{display:block}
.folio-preview span{margin-bottom:4px;color:#999;font-size:9px;font-weight:700}
.folio-preview strong{font-size:13px}
.nota-card,.historial-card{margin-bottom:20px;padding:23px;background:#fff;border:1px solid #e5e2e3;border-radius:17px;box-shadow:var(--sombra)}
.nota-section-title{margin-bottom:21px;display:flex;align-items:center;justify-content:space-between;gap:18px}
.nota-section-title>div{display:flex;align-items:center;gap:12px;min-width:0}
.nota-section-title>div>span{width:38px;height:38px;min-width:38px;border-radius:10px;background:var(--magenta-claro);color:var(--magenta);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700}
.nota-section-title h2{margin:0 0 3px;font-size:18px}
.nota-section-title p{margin:0;color:#888;font-size:11px}
.nota-grid-cliente{max-width:700px}
.btn-agregar-producto,.btn-nueva-historial{min-height:42px;padding:0 15px;border:0;border-radius:9px;background:var(--naranja);color:#fff;font-size:12px;font-weight:700;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.btn-agregar-producto:hover,.btn-nueva-historial:hover{background:var(--naranja-oscuro)}

.productos-table-header,.producto-row{display:grid;grid-template-columns:110px minmax(230px,1fr) 170px 140px 40px;gap:11px;align-items:center}
.productos-table-header{padding:0 5px 9px;color:#999;font-size:9px;font-weight:700;text-transform:uppercase}
.producto-row{padding:10px 5px;border-top:1px solid #eee}
.producto-row input{width:100%;min-width:0;height:44px;padding:0 11px;border:1px solid #ddd;border-radius:9px;background:#fff;outline:none}
.producto-row input:focus{border-color:var(--naranja);box-shadow:0 0 0 2px rgba(245,125,5,.09)}
.money-field{position:relative}
.money-field>span{position:absolute;left:11px;top:13px;color:#777}
.money-field input{padding-left:25px}
.producto-importe{text-align:right;font-size:14px;white-space:nowrap;color:var(--magenta)}
.btn-eliminar-producto{width:34px;height:34px;border:0;border-radius:8px;background:#fff0ef;color:#b9362d;font-size:21px}
.nota-bottom-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(300px,.7fr);gap:20px}
.nota-bottom-grid .nota-card{margin-bottom:0}
.resumen-card{align-self:start}
.resumen-title{margin-bottom:18px;font-size:17px;font-weight:700}
.resumen-row{padding:13px 0;border-bottom:1px solid #eee;display:flex;align-items:center;justify-content:space-between;gap:18px}
.money-input{width:140px;height:40px;padding:0 10px;border:1px solid #ddd;border-radius:9px;display:flex;align-items:center}
.money-input input{width:100%;border:0;outline:0;text-align:right}
.resumen-total{padding:21px 0;display:flex;align-items:center;justify-content:space-between;gap:15px}
.resumen-total strong{color:var(--magenta);font-size:27px}
.btn-guardar-nota{width:100%;height:50px;border:0;border-radius:10px;background:var(--naranja);color:#fff;font-size:14px;font-weight:700}
.btn-guardar-nota:hover{background:var(--naranja-oscuro)}
.nota-message{min-height:18px;margin-top:12px;text-align:center;font-size:12px}
.nota-message.error{color:var(--rojo)}
.nota-message.success{color:var(--verde)}

.historial-resumen{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}
.resumen-box{padding:18px;background:#fff;border:1px solid #e5e2e3;border-radius:14px;box-shadow:var(--sombra)}
.resumen-box span,.resumen-box strong{display:block}
.resumen-box span{margin-bottom:7px;color:#888;font-size:10px;font-weight:700;text-transform:uppercase}
.resumen-box strong{font-size:22px}
.resumen-box-total{background:var(--magenta-claro);border-color:#f5bfd9}
.resumen-box-total strong{color:var(--magenta)}
.historial-filtros{display:grid;grid-template-columns:minmax(230px,1.4fr) minmax(160px,.7fr) minmax(150px,.6fr) auto;gap:12px;align-items:end}
.historial-filtros label{display:block;margin-bottom:6px;font-size:11px;font-weight:700}
.historial-filtros input,.historial-filtros select{width:100%;height:43px;padding:0 11px;border:1px solid #ddd;border-radius:9px;background:#fff}
.filtros-acciones{display:flex;gap:7px}
.btn-buscar-nota,.btn-limpiar-nota{height:43px;padding:0 15px;border-radius:9px;font-size:12px;font-weight:700}
.btn-buscar-nota{border:0;background:var(--naranja);color:#fff}
.btn-limpiar-nota{border:1px solid #ddd;background:#fff;color:#555}
.historial-tabla-card{padding:0;overflow:hidden}
.historial-tabla-wrap{width:100%;overflow-x:auto}
.historial-tabla{width:100%;min-width:940px;border-collapse:collapse}
.historial-tabla th{padding:12px 14px;background:#fafafa;border-bottom:1px solid #e5e5e5;color:#777;font-size:9px;text-align:left;text-transform:uppercase}
.historial-tabla td{padding:13px 14px;border-bottom:1px solid #eee;font-size:12px}
.folio-tabla{color:var(--magenta)}
.estado-nota{display:inline-flex;padding:5px 9px;border-radius:20px;font-size:9px;font-weight:700;text-transform:uppercase}
.estado-activa{background:#e9f8ee;color:#207442}
.estado-cancelada{background:#fceaea;color:#a93226}
.historial-acciones{display:flex;gap:6px}
.btn-pdf-historial,.btn-cancelar-historial{height:33px;padding:0 10px;border-radius:8px;text-decoration:none;font-size:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.btn-pdf-historial{border:1px solid #f4bdd7;background:var(--magenta-claro);color:var(--magenta)}
.btn-cancelar-historial{border:1px solid #efc1bd;background:#fff;color:#b4372d}
.historial-mensaje{text-align:center;font-size:12px}
.historial-mensaje:not(:empty){padding:12px;border-bottom:1px solid #eee}
.historial-mensaje.error{color:var(--rojo)}
.historial-mensaje.success{color:var(--verde)}
.historial-vacio{padding:60px 20px;text-align:center}
.historial-vacio-icon{width:52px;height:52px;margin:0 auto 13px;border-radius:50%;background:var(--magenta-claro);color:var(--magenta);display:flex;align-items:center;justify-content:center;font-size:25px}
.historial-vacio strong{display:block}
.historial-vacio p{color:#888;font-size:12px}

@media(max-width:1100px){
.app-header{padding-left:20px;padding-right:20px}
.dashboard,.nota-page,.historial-page{width:calc(100% - 30px)}
.business-info{grid-template-columns:1fr 1.5fr}
.business-info>div:last-child{grid-column:1/-1}
.nota-bottom-grid{grid-template-columns:1fr}
.productos-table-wrap{overflow-x:auto}
.productos-table-header,.producto-row{min-width:800px}
.historial-filtros{grid-template-columns:1fr 1fr}
.filtro-busqueda{grid-column:1/-1}
}

@media(max-width:820px){
.app-header{padding:11px 14px}
.brand-logo{width:46px;height:46px;min-width:46px}
.app-brand strong{font-size:14px}
.app-user>span{display:none}
.btn-salir,.btn-regresar{padding:0 10px;font-size:11px}
.dashboard,.nota-page,.historial-page{width:calc(100% - 24px);padding:24px 0 40px}
.dashboard-welcome{padding:27px 22px}
.dashboard-welcome h1{font-size:25px}
.dashboard-actions{grid-template-columns:1fr;gap:14px}
.business-info{grid-template-columns:1fr;gap:17px}
.business-info>div:last-child{grid-column:auto}
.nota-page-header,.historial-header{align-items:flex-start;flex-direction:column}
.folio-preview,.btn-nueva-historial{width:100%}
.nota-card{padding:18px}
.productos-title{align-items:flex-start;flex-direction:column}
.btn-agregar-producto{width:100%}
.productos-table-header{display:none}
.productos-table-wrap{overflow:visible}
.producto-row{min-width:0;display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-bottom:12px;padding:14px;background:#fafafa;border:1px solid #e9e9e9;border-radius:13px}
.producto-row .producto-concepto{grid-column:1/-1;grid-row:1}
.producto-row .producto-cantidad{grid-column:1}
.producto-row .money-field{grid-column:2}
.producto-row .producto-importe{grid-column:1/-1;text-align:right}
.producto-row .btn-eliminar-producto{grid-column:1/-1;width:100%}
.producto-row .btn-eliminar-producto::after{content:" Eliminar producto";font-size:11px}
.historial-resumen{grid-template-columns:1fr 1fr}
.historial-filtros{grid-template-columns:1fr}
.filtro-busqueda{grid-column:auto}
.historial-tabla-card{padding:0;background:transparent;border:0;box-shadow:none}
.historial-tabla-wrap{overflow:visible}
.historial-tabla{min-width:0;display:block}
.historial-tabla thead{display:none}
.historial-tabla tbody{display:block}
.historial-tabla tr{display:block;margin-bottom:12px;padding:9px 14px;background:#fff;border:1px solid #e5e5e5;border-radius:14px}
.historial-tabla td{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:9px 0;border-bottom:1px solid #eee;text-align:right}
.historial-tabla td::before{content:attr(data-label);color:#999;font-size:9px;font-weight:700;text-transform:uppercase}
}

@media(max-width:560px){
.login-page{padding:13px}
.login-card{padding:26px 18px}
.logo-placeholder{width:84px;height:84px}
.login-header h1{font-size:27px}
.login-header h2{font-size:21px}
.app-header{gap:7px}
.brand-logo{width:41px;height:41px;min-width:41px}
.app-brand strong{max-width:175px;font-size:13px}
.app-brand span{font-size:10px}
.dashboard-welcome h1{font-size:22px}
.action-card{padding:18px}
.nota-page-header h1,.historial-header h1{font-size:24px}
.producto-row{grid-template-columns:1fr}
.producto-row .producto-concepto,.producto-row .producto-cantidad,.producto-row .money-field,.producto-row .producto-importe,.producto-row .btn-eliminar-producto{grid-column:1}
.resumen-total strong{font-size:23px}
.filtros-acciones{flex-direction:column}
.btn-buscar-nota,.btn-limpiar-nota{width:100%}
}

@media(max-width:400px){
.app-brand strong{max-width:130px}
.app-brand span{display:none}
.dashboard,.nota-page,.historial-page{width:calc(100% - 18px)}
.historial-resumen{grid-template-columns:1fr}
.resumen-row,.resumen-total{align-items:flex-start;flex-direction:column}
.money-input{width:100%}
}