*{box-sizing:border-box}html,body{height:100%}body{margin:0;background:#edf1f7;color:#1f2937;font:14px "Segoe UI",Arial,sans-serif}
:root{--brand:#11b9bf;--brand-dark:#0d8c97;--brand-soft:#dff7f6;--ink:#111111;--line:#dbe3ef;--panel:#ffffff;--muted:#6b7280;--ok:#0f9d58;--warn:#b45309}
.sidebar{position:fixed;left:0;top:0;bottom:0;width:226px;background:#fff;border-right:1px solid var(--line);display:flex;flex-direction:column}
.brand-card{padding:18px 16px 10px}.brand-logo{width:100%;height:64px;object-fit:contain;border-radius:8px;background:#fff}
.side-nav{display:flex;flex-direction:column;gap:8px;padding:8px 12px}.nav{border:0;background:transparent;border-radius:12px;padding:14px 16px;text-align:left;color:#3b4a63;font-size:15px;display:flex;align-items:center;gap:12px;cursor:pointer}
.nav:hover{background:#f4f8fb}.nav.active{background:#e6f7f6;color:#0d8190;font-weight:700}
.side-foot{margin-top:auto;padding:14px 20px;color:#94a3b8;font-size:12px}
.main{margin-left:226px;min-height:100%}.topbar{height:70px;background:linear-gradient(90deg,var(--brand-dark),var(--brand));color:#fff;padding:0 28px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 8px rgba(13,140,151,.12)}
.topbar small{opacity:.9}.right-top{display:flex;gap:22px;align-items:center}.status{display:flex;align-items:center;gap:10px}.status i{width:8px;height:8px;background:#b8ffcf;border-radius:50%}
.content{padding:28px}
.hero-banner{width:100%;height:420px;object-fit:cover;border-radius:22px;display:block;box-shadow:0 8px 24px rgba(0,0,0,.08);background:#dceff1}
.welcome{background:linear-gradient(135deg,var(--brand-dark),var(--brand));border-radius:22px;padding:42px;color:#fff;display:flex;justify-content:space-between;align-items:center;min-height:220px}
.eyebrow{letter-spacing:.16em;font-weight:700;font-size:12px;opacity:.9}.welcome h1{font-size:58px;line-height:1.06;margin:8px 0 10px}.welcome h1 em{font-style:normal;color:#dcffff}.welcome p{font-size:21px;max-width:700px}
.welcome-mark{font-size:170px;font-weight:900;opacity:.10}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin:24px 0}
.stats article,.card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:22px;box-shadow:0 2px 10px rgba(16,24,40,.03)}
.stats label{display:block;color:#64748b;margin-bottom:14px}.stats strong{font-size:28px;display:block;margin-bottom:8px}.green{color:var(--ok)}
h2{margin:18px 0 14px;font-size:18px}.tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.tile{background:#fff;border:1px solid var(--line);border-radius:14px;padding:20px;text-align:left;cursor:pointer}.tile:hover{border-color:#b8d7dd;box-shadow:0 4px 14px rgba(0,0,0,.04)}
.tile b{display:block;font-size:22px;margin-bottom:10px;color:var(--brand-dark)}.tile strong{display:block;font-size:24px;margin-bottom:6px}.tile small{color:#718096}
.notice{margin-top:22px;background:#eef6ff;border-left:4px solid #2f80ed;padding:16px 18px;border-radius:10px;color:#345}
.panel{background:#fff;border:1px solid var(--line);border-radius:16px;padding:22px;box-shadow:0 2px 10px rgba(16,24,40,.03)}
.toolbar{display:flex;gap:12px;justify-content:space-between;align-items:center;margin-bottom:18px;flex-wrap:wrap}
.search{min-width:320px;max-width:460px;flex:1;background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:12px 14px}
.btn{border:1px solid var(--line);background:#fff;color:#1f2937;border-radius:10px;padding:11px 16px;cursor:pointer;font-weight:600}
.btn.primary{background:linear-gradient(90deg,var(--brand-dark),var(--brand));color:#fff;border-color:transparent}.btn.primary:hover{opacity:.95}
.btn.small{padding:8px 12px;font-size:13px}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:14px}.table-wrap table{width:100%;border-collapse:collapse;background:#fff}
.table-wrap th,.table-wrap td{padding:13px 14px;border-bottom:1px solid #eef2f7}.table-wrap th{background:#f8fafc;text-align:left;color:#64748b;font-size:13px}
.table-wrap tr:hover td{background:#fbfdff}.table-wrap .money{text-align:right}.tag{display:inline-block;padding:5px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand-dark);font-size:12px;font-weight:700}
.empty{text-align:center;color:#7a8699;padding:26px}
.kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:16px}.kpis div{background:#f8fafc;border-radius:14px;padding:16px;border:1px solid #edf2f7}.kpis strong{display:block;font-size:23px;margin-top:6px}
.config-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:18px}.cfg-box{background:#fff;border:1px solid var(--line);border-radius:16px;padding:20px}.cfg-box h3{margin:0 0 12px}
form label{display:block;font-weight:600;color:#334155;margin:10px 0 12px}form input,form select,form textarea{width:100%;padding:11px 12px;margin-top:6px;border:1px solid var(--line);border-radius:10px;background:#fff}
.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.actions{display:flex;justify-content:flex-end;gap:10px;margin-top:12px}
.preview{border:1px dashed #bfd7db;border-radius:14px;padding:12px;background:#fbffff}.preview img{max-width:100%;display:block;border-radius:12px}
.preview.banner img{height:180px;object-fit:cover;width:100%}.preview.logo img{height:80px;object-fit:contain;background:#fff}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.45);display:grid;place-items:center;padding:18px;z-index:50}.hidden{display:none}
.dialog{width:min(700px,100%);background:#fff;border-radius:18px;border:1px solid var(--line);padding:20px;box-shadow:0 25px 60px rgba(15,23,42,.2)}
.dialog.small{width:min(560px,100%)}.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:6px}.dialog-head h2{margin:2px 0 0}.dialog-head small{color:#0d8c97;font-weight:700;letter-spacing:.12em}
.x{border:0;background:transparent;font-size:26px;cursor:pointer;line-height:1;color:#64748b}
.error{color:#c62828;min-height:18px}.toast{position:fixed;right:24px;bottom:24px;background:#0f172a;color:#fff;padding:13px 16px;border-radius:12px;opacity:0;transform:translateY(18px);transition:all .25s;pointer-events:none}.toast.show{opacity:1;transform:translateY(0)}
.muted{color:var(--muted)}.section-subtitle{color:#64748b;margin-top:0}.split-sale{display:grid;grid-template-columns:1.2fr .8fr;gap:18px}.sale-box{background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px}.sale-total{font-size:34px;color:#0d8c97;font-weight:800}
@media (max-width:1100px){.tiles,.stats,.config-grid,.kpis,.split-sale{grid-template-columns:1fr}.main{margin-left:0}.sidebar{position:static;width:auto;height:auto}.brand-card{padding-bottom:0}.topbar{position:sticky;top:0;z-index:10}}
.tag.inactive{background:#fee2e2;color:#991b1b}

/* Autenticación v0.5 */
body.logged-out .sidebar,body.logged-out .topbar{display:none}body.logged-out .main{margin-left:0;min-height:100vh}body.logged-out .content{min-height:100vh;padding:24px;display:grid;place-items:center;background:linear-gradient(135deg,#eaf3f6,#f5f8fc)}
.auth-shell{width:100%;display:grid;place-items:center}.auth-card{width:min(440px,100%);background:#fff;border:1px solid var(--line);border-radius:20px;padding:34px;box-shadow:0 18px 55px rgba(15,45,60,.12)}.auth-card>img{width:190px;height:70px;object-fit:contain;display:block;margin:0 auto 18px}.auth-kicker{text-align:center;color:var(--brand-dark);font-size:11px;font-weight:800;letter-spacing:.16em;margin:0}.auth-card h1{text-align:center;font-size:26px;margin:8px 0 6px}.auth-card>.section-subtitle{text-align:center;margin-bottom:24px}.auth-card label{margin:14px 0}.auth-submit{width:100%;margin:8px 0 14px;padding:13px}.auth-card>small{display:block;text-align:center}.user-label{font-size:12px;font-weight:600;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.logout-button{border:1px solid rgba(255,255,255,.55);background:transparent;color:white;border-radius:8px;padding:8px 11px;cursor:pointer;font-weight:600}.logout-button:hover{background:rgba(255,255,255,.12)}.nav.hidden{display:none}
/* OptiMEDIC POS v0.7 */
.pos-layout{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(420px,.9fr);gap:18px;align-items:start}.pos-products,.pos-checkout{min-width:0}.pos-product-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px}.pos-product{display:flex;flex-direction:column;align-items:flex-start;gap:7px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#fff;text-align:left;cursor:pointer}.pos-product:hover{border-color:var(--brand);background:#f7ffff}.pos-product small{color:var(--muted)}.pos-product strong{color:var(--brand-dark);font-size:17px}.pos-checkout h2{margin-top:0}.pos-checkout .table-wrap{max-height:330px}.pos-checkout table{font-size:12px}.pos-checkout th,.pos-checkout td{padding:8px 7px}.pos-checkout td input{width:66px;padding:7px 5px;margin:0}.sale-summary{margin:14px 0;padding:12px;background:#f8fbfc;border:1px solid var(--line);border-radius:12px}.sale-summary>div,.payment-balance{display:flex;justify-content:space-between;padding:6px 0}.sale-summary .grand{border-top:1px solid var(--line);margin-top:6px;padding-top:12px;color:var(--brand-dark)}.sale-summary .grand strong{font-size:24px}.payment-head{display:flex;align-items:center;justify-content:space-between;margin-top:14px}.payment-head h3{font-size:15px}.payment-row{display:grid;grid-template-columns:1fr 110px 1fr 34px;gap:7px;margin:8px 0}.payment-row input,.payment-row select{min-width:0;padding:9px 7px;border:1px solid var(--line);border-radius:8px}.payment-balance{font-size:12px;color:var(--muted)}.full{width:100%;margin-top:8px}.cash-form{max-width:560px;background:#f8fbfc;border:1px solid var(--line);border-radius:14px;padding:20px;margin-top:16px}.cash-open-card{background:var(--brand-soft);border:1px solid #bce9e8;border-radius:14px;padding:20px;max-width:650px}.cash-open-card h3{margin-top:0}.cash-open-card p{margin:8px 0}.cash-form h3{margin-top:0}.cash-form label{display:block}.cash-form input,.cash-form select{width:100%;padding:11px;border:1px solid var(--line);border-radius:9px;margin-top:6px}.btn:disabled{opacity:.55;cursor:not-allowed}
@media(max-width:1250px){.pos-layout{grid-template-columns:1fr}.pos-checkout{order:2}}
@media(max-width:700px){.pos-product-grid{grid-template-columns:1fr}.payment-row{grid-template-columns:1fr 1fr}.payment-row .pay-reference{grid-column:1/2}.payment-row .pay-remove{grid-column:2/3;grid-row:2}}

/* Historial y reportes v0.7 */
.history-filters{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:16px 0 20px}.history-filters label{min-width:180px;margin:0}.history-filters input{display:block;min-width:180px}.history-detail{margin-top:18px}.history-detail h3{margin-top:0}.history-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:14px 0 22px}.history-detail-grid>div{background:#f8fbfc;border:1px solid var(--line);border-radius:12px;padding:14px}.history-detail-grid p{margin:7px 0 0}.history-detail .table-wrap{max-width:620px}.history-detail .money{text-align:right}@media(max-width:750px){.history-detail-grid{grid-template-columns:1fr 1fr}.history-filters label,.history-filters input{min-width:100%}}
@media print{.sidebar,.topbar,.history-filters,.toolbar button,.nav,.btn,#history-error{display:none!important}.main{margin:0!important}.content{padding:0!important}.panel{border:0!important;box-shadow:none!important}.history-detail{break-inside:avoid}}

/* OptiMEDIC v0.8: compras y proveedores */
.purchase-tabs{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0 20px}.purchase-split{display:grid;grid-template-columns:minmax(280px,.85fr) minmax(420px,1.15fr);gap:22px;align-items:start}.purchase-split h3{margin:12px 0}.purchase-product-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:12px}.purchase-product{display:flex;flex-direction:column;gap:5px;text-align:left;border:1px solid var(--line);background:#fff;border-radius:12px;padding:12px;cursor:pointer}.purchase-product:hover{border-color:var(--brand);background:#f5ffff}.purchase-product small{color:var(--muted)}.purchase-product strong{color:var(--brand-dark);font-size:12px}.purchase-split table{font-size:12px}.purchase-split td input{width:82px;padding:7px 5px;margin:0}.purchase-split .cash-form{margin-top:0}.purchase-split .sale-summary{margin-top:14px}@media(max-width:950px){.purchase-split{grid-template-columns:1fr}.purchase-product-results{grid-template-columns:1fr 1fr}}@media(max-width:600px){.purchase-product-results{grid-template-columns:1fr}}
/* v0.11 expenses form */
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 14px;align-items:end}
.form-grid .actions,.form-grid .error{grid-column:1/-1}
@media (max-width:760px){.form-grid{grid-template-columns:1fr}}

/* v0.12 financial dashboard */
.financial-filters{align-items:end;gap:12px;margin:18px 0 22px}
.financial-filters label{min-width:180px;max-width:240px}
.financial-stats{grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 0 24px}
.financial-stats article{min-height:92px}
.financial-stats strong{font-size:1.35rem}
.financial-stats .green{color:#079b68}
@media(max-width:900px){.financial-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.financial-stats{grid-template-columns:1fr}.financial-filters{align-items:stretch;flex-direction:column}.financial-filters label{max-width:none}}

/* v0.13 inventory controls */
.inventory-stats{grid-template-columns:repeat(3,minmax(0,1fr));margin:18px 0 24px}
.inventory-stats article{min-height:90px}
.inventory-stats strong{font-size:1.35rem}
.inventory-filters{align-items:end;gap:12px;margin:16px 0}
.inventory-filters label{min-width:190px}
.tag.danger{background:#fff0f0;color:#b42318}
@media(max-width:850px){.inventory-stats{grid-template-columns:1fr 1fr}.inventory-filters{align-items:stretch;flex-direction:column}}
@media(max-width:560px){.inventory-stats{grid-template-columns:1fr}}

/* OptiMEDIC v0.14 — optical prescriptions */
.rx-form{border:1px solid var(--line,#dbe5ef);border-radius:14px;padding:18px;margin:18px 0 26px;background:#fbfdff}
.rx-form h3,.rx-history h3{margin:0 0 12px}
.rx-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.rx-grid label,.rx-observations{display:flex;flex-direction:column;gap:6px;font-size:13px}
.rx-grid input,.rx-grid select,.rx-observations textarea{width:100%;min-width:0}
.rx-meta{grid-template-columns:repeat(4,minmax(0,1fr));margin:14px 0}
.rx-eyes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:12px 0}
.rx-eye{border:1px solid #dbe5ef;border-radius:12px;padding:14px;background:#fff}
.rx-eye h4{margin:0 0 12px;color:#078f98}
.rx-eye .rx-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.rx-observations{margin:12px 0}
.rx-history{margin-top:26px}
.rx-paper{background:#fff;color:#172033;padding:28px;max-width:900px;margin:0 auto;font-size:13px}
.rx-paper-head{display:flex;align-items:center;gap:22px;border-bottom:2px solid #079da5;padding-bottom:16px}
.rx-paper-head img{width:170px;height:auto;object-fit:contain}
.rx-paper-head h1{font-size:22px;margin:0 0 5px;color:#087f87}
.rx-paper-head p{margin:0;color:#526174}
.rx-paper-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 20px;margin:22px 0}
.rx-paper-meta p{margin:3px 0}
.rx-paper h3{margin:20px 0 10px}
.rx-print-table{width:100%;border-collapse:collapse}
.rx-print-table th,.rx-print-table td{border:1px solid #aebbc9;padding:10px;text-align:center}
.rx-print-table thead th{background:#eaf7f7}
.rx-paper-notes{margin-top:24px;min-height:70px}
.rx-paper-notes p{white-space:pre-wrap}
.rx-signatures{display:grid;grid-template-columns:1fr 1fr;gap:70px;margin:70px 30px 30px}
.rx-signatures div{border-top:1px solid #526174;text-align:center;padding-top:8px}
.rx-paper footer{border-top:1px solid #d5dde6;padding-top:10px;color:#637184;text-align:center;font-size:11px}
@media(max-width:900px){.rx-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.rx-eyes{grid-template-columns:1fr}}
@media(max-width:560px){.rx-grid,.rx-eye .rx-grid,.rx-meta{grid-template-columns:1fr}.rx-paper{padding:12px}.rx-paper-head{gap:10px}.rx-paper-head img{width:100px}.rx-paper-head h1{font-size:16px}.rx-paper-meta{grid-template-columns:1fr}}
/* v0.14.1: print only the actual prescription, not the empty app layout. */
@media print {
 @page { size: A4 portrait; margin: 10mm 12mm; }
 html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: white !important; }
 body.rx-print-mode { margin: 0 !important; padding: 0 !important; display: block !important; }
 body.rx-print-mode .sidebar, body.rx-print-mode .topbar,
 body.rx-print-mode #content > .panel > :not(#rx-print) { display: none !important; }
 body.rx-print-mode .main, body.rx-print-mode .content,
 body.rx-print-mode #content, body.rx-print-mode #content > .panel {
  position: static !important; display: block !important; height: auto !important;
  min-height: 0 !important; max-height: none !important;
  width: 100% !important; max-width: 100% !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
  box-shadow: none !important; overflow: visible !important;
  background: white !important;
 }
 body.rx-print-mode #rx-print { display: block !important; position: static !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
  width: 100% !important; height: auto !important; visibility: visible !important; }
 body.rx-print-mode .rx-paper { box-sizing: border-box !important;
  display: block !important; width: 100% !important; max-width: 100% !important;
  margin: 0 !important; padding: 0 !important; font-size: 10pt !important;
  line-height: 1.3 !important; background: white !important;
  page-break-before: avoid !important; page-break-after: avoid !important;
 }
 body.rx-print-mode .rx-paper-head { gap: 12px !important; padding: 0 0 8px !important; }
 body.rx-print-mode .rx-paper-head img { width: 110px !important; height: auto !important; max-height: 68px !important; }
 body.rx-print-mode .rx-paper-head h1 { font-size: 17px !important; }
 body.rx-print-mode .rx-paper-meta { margin: 10px 0 !important; gap: 2px 14px !important; }
 body.rx-print-mode .rx-paper-meta p { margin: 2px 0 !important; }
 body.rx-print-mode .rx-paper h3 { margin: 10px 0 5px !important; }
 body.rx-print-mode .rx-print-table th, body.rx-print-mode .rx-print-table td { padding: 6px !important; }
 body.rx-print-mode .rx-paper-notes { margin-top: 12px !important; min-height: 0 !important; }
 body.rx-print-mode .rx-paper-notes p { margin: 5px 0 !important; }
 body.rx-print-mode .rx-signatures { margin: 36px 15px 16px !important; gap: 35px !important; }
 body.rx-print-mode .rx-paper footer { margin-top: 12px !important; }
 body.rx-print-mode .rx-paper-head, body.rx-print-mode .rx-paper-meta,
 body.rx-print-mode .rx-print-table, body.rx-print-mode .rx-paper-notes,
 body.rx-print-mode .rx-signatures, body.rx-print-mode .rx-paper footer {
  break-inside: avoid !important; page-break-inside: avoid !important;
 }
}

/* v0.18: receta vinculada en órdenes de trabajo */
.wo-rx-preview{margin:16px 0;padding:16px;border:1px solid #b8dfe1;border-left:4px solid #079da5;border-radius:10px;background:#f7fcfc}
.wo-rx-preview h3{margin:0 0 4px}.wo-rx-table th,.wo-rx-table td{padding:9px 12px;text-align:center}.wo-rx-table thead th{background:#edf6f7;color:#18394a}.wo-rx-preview .toolbar{align-items:center}
.admin-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:18px 0}.admin-form{display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:12px;padding:16px;margin:12px 0 18px;border:1px solid var(--line,#dce5ef);border-radius:12px;background:#f8fbfd}.admin-form label{display:flex;flex-direction:column;gap:5px;font-size:12px;color:#53677e}.admin-form input:not([type=checkbox]){width:100%;padding:10px;border:1px solid #d7e1ed;border-radius:8px;background:white}.admin-form .check-label{flex-direction:row;align-items:center}.admin-form .form-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end}.admin-form .error{grid-column:1/-1}.admin-nav{margin-top:8px}@media(max-width:700px){.admin-form{grid-template-columns:1fr}}

.business-selector-wrap{display:flex;align-items:center;gap:7px;color:white;font-size:12px;font-weight:600}.business-selector-wrap select{border:1px solid #9fe6e0;border-radius:6px;padding:5px 7px;max-width:200px;background:white;color:#17354c;font-size:12px}@media(max-width:950px){.business-selector-wrap{max-width:180px}.business-selector-wrap select{max-width:135px}}

/* UNIVASQUEZ Business v1.0.3: identidad independiente por negocio */
.profile-chip{display:flex;align-items:center;gap:8px;border:0;color:white;background:transparent;cursor:pointer;font:inherit;max-width:260px}
.profile-chip img{height:30px;width:30px;object-fit:cover;border-radius:50%;border:2px solid #ffffff88}
.profile-editor{display:flex;align-items:center;gap:24px;flex-wrap:wrap}.profile-editor-photo{width:96px;height:96px;object-fit:cover;border-radius:50%;background:#eef2f7}
.identity-preview{border:1px solid var(--line);border-radius:16px;overflow:hidden;background:white}.identity-cover{height:145px}.identity-cover img{width:100%;height:100%;object-fit:cover}.identity-head{display:flex;align-items:center;gap:18px;padding:15px}.identity-logo{height:84px;width:84px;object-fit:contain;background:white;border-radius:14px;padding:8px;border:1px solid var(--line)}.placeholder-logo{display:grid;place-items:center;font-size:35px;font-weight:800;color:var(--preview-primary)}.identity-head h2{margin:0 0 6px}.identity-head p{margin:0;color:var(--muted)}
.identity-colors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.identity-colors input{width:100%;height:44px;padding:4px}.identity-uploads{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px;margin-top:14px}
@media(max-width:800px){.identity-colors,.identity-uploads{grid-template-columns:1fr}.profile-chip .user-label{display:none}}
.side-nav .nav.active{background:var(--brand-soft);color:var(--brand-dark)}

/* UNIVASQUEZ v1.0.4 — rediseño visual y responsive. Sin modificaciones a lógica de negocio. */
:root{--uv-radius:18px;--uv-shadow:0 8px 24px rgba(18,49,68,.055)}
body{background:#f3f7f8;color:#223143;overflow-x:hidden}
.sidebar{z-index:35;box-shadow:3px 0 15px rgba(10,43,60,.025);overflow-y:auto}
.brand-card{position:relative;display:flex;align-items:center;min-height:90px}
.brand-logo{max-height:68px}
.side-nav{gap:4px}
.side-nav .nav{min-height:43px;padding:11px 13px;font-size:13px;transition:background-color .16s ease}
.main{min-width:0}
.topbar{gap:12px;background:linear-gradient(105deg,var(--brand-dark),#075e68);height:70px;position:sticky;top:0;z-index:30;padding-inline:24px}
.topbar>div:first-of-type{min-width:0}
.right-top{gap:12px;min-width:0}
.content{padding:24px;min-width:0;max-width:1800px;margin:0 auto}
.panel,.card,.cfg-box,.stats article{border-radius:var(--uv-radius);box-shadow:var(--uv-shadow)}
input,select,textarea{max-width:100%}
.uv-menu-toggle,.uv-drawer-close,.uv-account-toggle,.uv-search-btn{font:inherit;cursor:pointer;border:0}
.uv-menu-toggle{display:none;background:#ffffff20;color:white;border-radius:11px;padding:8px 12px;font-size:19px}
.uv-drawer-close{display:none;position:absolute;right:8px;top:7px;background:transparent;color:#576575;font-size:25px}
.uv-mobile-scrim{display:none}
.uv-account-toggle{background:#ffffff24;color:#fff;padding:8px 10px;border-radius:10px}
.uv-account-menu{position:absolute;right:14px;top:calc(100% - 3px);width:220px;padding:9px;background:#fff;box-shadow:0 16px 35px #142e3a30;border:1px solid var(--line);border-radius:15px;z-index:45;color:#1e293b}
.uv-account-menu.hidden{display:none!important}
.uv-account-menu button{display:block;width:100%;padding:12px;text-align:left;background:transparent;border:0;border-radius:9px;cursor:pointer;color:inherit;font:inherit}
.uv-account-menu button:hover{background:#e6f4f5}.uv-account-menu hr{border:0;border-top:1px solid #e5e9ee}
.uv-search-btn{border-radius:999px;background:#ffffff1d;color:white;padding:9px 15px;white-space:nowrap}
.uv-top-brand,.uv-top-links{display:none}
.uv-settings-header h1{margin:0;font-size:32px;line-height:1.2}.uv-settings-header p{color:var(--muted);margin:7px 0 22px}
.uv-settings-layout{display:grid;grid-template-columns:200px minmax(0,1fr);gap:22px;align-items:start}
.uv-settings-nav{position:sticky;top:90px;display:flex;flex-direction:column;gap:6px;padding:12px;border-right:1px solid var(--line)}
.uv-settings-nav a{padding:13px;border-radius:10px;text-decoration:none;color:#475569;font-weight:600}
.uv-settings-nav a:hover,.uv-settings-nav a:first-child{background:var(--brand-soft);color:var(--brand-dark)}
.uv-settings-body{display:flex;flex-direction:column;gap:18px;min-width:0}
.uv-settings-card{background:linear-gradient(125deg,#fff,#f1f8f8);padding:24px;border-radius:22px;border:1px solid #e0e9ed;box-shadow:var(--uv-shadow);scroll-margin-top:90px}
.uv-section-heading{display:flex;align-items:flex-start;gap:15px;margin-bottom:22px}
.uv-section-heading h2{font-size:20px;margin:0 0 5px}.uv-section-heading p{color:#64748b;margin:0;line-height:1.5}
.uv-feature-icon{display:grid;place-items:center;background:#d5ebeb;color:#00616a;font-size:22px;border-radius:14px;width:45px;height:45px;flex-shrink:0}
.uv-settings-card h3{font-size:13px;color:#506778;margin:19px 0 10px}
.uv-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.uv-options-3{grid-template-columns:repeat(3,minmax(0,1fr))}.uv-options-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.uv-choice{position:relative;min-height:74px;border:1px solid #d6e0e5;background:white;border-radius:13px;padding:15px 34px 14px 15px;text-align:left;color:#233146;cursor:pointer;font:inherit;display:flex;flex-direction:column;gap:5px}
.uv-choice b{font-size:14px}.uv-choice small{font-size:12px;color:#64748b;line-height:1.3}.uv-choice:hover{border-color:var(--brand)}.uv-choice.selected{border:2px solid var(--brand-dark);background:#f0f5fe;padding:14px 33px 13px 14px}
.uv-check{position:absolute;right:12px;bottom:15px;color:var(--brand-dark);font-weight:800}
.uv-brand-preview{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.uv-color-dot{width:36px;height:36px;border-radius:50%;border:1px solid #bbcbd0}.uv-brand-hint{color:#6b7280;font-size:13px;flex:1;min-width:150px}
.uv-legacy-settings{margin-top:25px;border-top:1px solid var(--line);padding-top:12px}
.uv-settings-card button:focus-visible,.uv-menu-toggle:focus-visible,.uv-account-menu button:focus-visible,.uv-settings-nav a:focus-visible{outline:3px solid #eab308;outline-offset:2px}
/* Nav superior y compacta según selección del usuario */
body.uv-nav-compacta .sidebar{width:74px}
body.uv-nav-compacta .main{margin-left:74px}
body.uv-nav-compacta .brand-logo{width:50px;height:50px}
body.uv-nav-compacta .brand-card{padding:11px}
body.uv-nav-compacta .side-nav{padding:8px}
body.uv-nav-compacta .side-nav .nav{justify-content:center;padding:12px 0;font-size:19px}
body.uv-nav-compacta .side-nav .nav span,body.uv-nav-compacta .side-foot{display:none}
body.uv-nav-superior .sidebar{display:none}
body.uv-nav-superior .main{margin-left:0}
body.uv-nav-superior .topbar{gap:10px;padding:0 20px}
body.uv-nav-superior .topbar>div:first-of-type{display:none}
body.uv-nav-superior .uv-top-brand{display:flex;flex-direction:column;font-weight:900;color:white;font-size:17px;white-space:nowrap;line-height:1.05}
body.uv-nav-superior .uv-top-brand small{font-weight:400;font-size:13px}
body.uv-nav-superior .uv-top-links{display:flex;gap:3px;min-width:0;overflow-x:auto;scrollbar-width:thin;align-items:center;flex:1}
.uv-top-links button{flex-shrink:0;display:inline-flex;gap:7px;align-items:center;background:transparent;color:white;border:0;border-radius:9px;padding:11px;font-size:13px;cursor:pointer;white-space:nowrap}
.uv-top-links button.active,.uv-top-links button:hover{background:#ffffff22}
.uv-top-links button span{white-space:nowrap}
/* Preferencias */
body.uv-dense .content{padding:14px}body.uv-dense .panel,body.uv-dense .card,body.uv-dense .cfg-box{padding:14px}body.uv-dense .table-wrap td,body.uv-dense .table-wrap th{padding:7px}
body.uv-text-small{font-size:12px}body.uv-text-large{font-size:16px}body.uv-text-xlarge{font-size:18px}
body.uv-text-large .nav,body.uv-text-large .btn,body.uv-text-large input,body.uv-text-large select,body.uv-text-xlarge .nav,body.uv-text-xlarge .btn,body.uv-text-xlarge input,body.uv-text-xlarge select{font-size:inherit}
body.uv-motion-reduced *,body.uv-motion-reduced *::before,body.uv-motion-reduced *::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
body.uv-dark{background:#111d29;color:#e5edf2;--panel:#1a2a39;--line:#344656;--muted:#a9b8c7}
body.uv-dark .sidebar,body.uv-dark .panel,body.uv-dark .card,body.uv-dark .cfg-box,body.uv-dark .stats article,body.uv-dark .tile,body.uv-dark .uv-settings-card,body.uv-dark .uv-choice,body.uv-dark .uv-account-menu{background:#1a2a39;color:#e5edf2;border-color:#344656}
body.uv-dark .uv-choice.selected,body.uv-dark .uv-settings-nav a:hover{background:#214351}
body.uv-dark .uv-section-heading p,body.uv-dark .uv-choice small,body.uv-dark .uv-brand-hint{color:#b5c5d2}
body.uv-dark input,body.uv-dark select,body.uv-dark textarea,body.uv-dark .table-wrap table,body.uv-dark .table-wrap th,body.uv-dark .table-wrap td,body.uv-dark .admin-form{background:#213447;color:#e5edf2;border-color:#344656}
body.uv-dark .notice{background:#203b4b;color:#c2e7f1}body.uv-dark .side-nav .nav{color:#d3e1e9}body.uv-dark .side-nav .nav.active{color:var(--brand)}
body.uv-dark .uv-account-menu button:hover{background:#29485b}
body.uv-dark .uv-settings-nav a{color:#c7d3dc}
/* Tablet: la barra lateral se sustituye por cajón; escritorio conserva la elección */
@media(max-width:1100px){
 body .sidebar,body.uv-nav-compacta .sidebar,body.uv-nav-superior .sidebar{display:flex;position:fixed;left:0;top:0;bottom:0;width:min(310px,85vw);height:100dvh;transform:translateX(-110%);transition:transform .18s ease;z-index:65}
 body.uv-drawer-open .sidebar{transform:translateX(0)}
 body .sidebar .side-nav .nav,body.uv-nav-compacta .sidebar .side-nav .nav{justify-content:flex-start;font-size:14px;padding:12px 15px}
 body.uv-nav-compacta .sidebar .side-nav .nav span,body.uv-nav-compacta .sidebar .side-foot{display:initial}
 body.uv-nav-compacta .sidebar .brand-card{padding:18px 16px 10px}
 body.uv-nav-compacta .sidebar .brand-logo{width:100%;height:64px}
 body .main,body.uv-nav-compacta .main,body.uv-nav-superior .main{margin-left:0}
 body .uv-menu-toggle{display:inline-flex}
 body .uv-drawer-close{display:block}
 body .uv-mobile-scrim{display:none;position:fixed;inset:0;background:#061a23a8;z-index:60}
 body.uv-drawer-open .uv-mobile-scrim{display:block}
 body.uv-nav-superior .uv-top-links{display:none}
 body.uv-nav-superior .topbar>div:first-of-type{display:block}
 .uv-settings-layout{grid-template-columns:150px minmax(0,1fr)}
}
@media(max-width:760px){
 .topbar{height:60px;padding:0 12px!important;gap:8px}
 .topbar>div:first-of-type small{display:none}
 .topbar #crumb{font-size:12px}
 .uv-top-brand{display:none!important}
 .uv-search-btn span,.status,.right-top #currency{display:none!important}
 .uv-search-btn{padding:7px 10px}
 .right-top{gap:6px;margin-left:auto}
 .business-selector-wrap{font-size:0;max-width:126px}.business-selector-wrap select{font-size:11px;max-width:120px}
 .profile-chip{max-width:38px;padding:0}.profile-chip img{width:33px;height:33px}
 .uv-account-toggle{padding:7px}
 .content{padding:12px!important}
 .uv-settings-header h1{font-size:25px}
 .uv-settings-layout{grid-template-columns:minmax(0,1fr);gap:12px}
 .uv-settings-nav{position:static;display:flex;flex-direction:row;overflow-x:auto;border:0;border-bottom:1px solid var(--line);padding:0 0 10px;white-space:nowrap}
 .uv-settings-nav a{padding:9px}
 .uv-settings-card{padding:16px}
 .uv-options-3,.uv-options-4{grid-template-columns:repeat(2,minmax(0,1fr))}
 .table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
 .stats,.tiles,.config-grid,.two,.split-sale,.kpis,.history-detail-grid{grid-template-columns:1fr!important}
 .welcome{padding:20px;min-height:140px}.welcome h1{font-size:32px}.welcome p{font-size:15px}
 .hero-banner{height:170px}
 .panel,.cfg-box,.card{padding:14px}
 .modal .dialog{width:min(95vw,640px);max-height:92dvh;overflow-y:auto}
 .admin-form{grid-template-columns:1fr}
}
@media(max-width:420px){.uv-options,.uv-options-3,.uv-options-4{grid-template-columns:1fr}.uv-choice{min-height:58px}.business-selector-wrap{max-width:95px}.business-selector-wrap select{max-width:90px}.uv-section-heading h2{font-size:18px}}
/* Mantener recibos y recetas impresas sin estilos interactivos */
@media print{.uv-menu-toggle,.uv-top-brand,.uv-top-links,.uv-account-menu,.uv-mobile-scrim{display:none!important}}
/* Cuenta personal, coherente con el diseño de configuración */
.uv-account-page{max-width:1070px;margin:15px auto}.uv-account-heading h1{font-size:34px;margin:0 0 8px}.uv-account-heading p{color:var(--muted);margin:0 0 23px}
.uv-account-grid{display:grid;grid-template-columns:minmax(240px,310px) minmax(0,1fr);gap:22px;align-items:start}
.uv-account-person{border-radius:23px;background:linear-gradient(145deg,var(--brand-soft),#e6f0f2);padding:28px;text-align:center;border:1px solid var(--line)}
.uv-avatar-holder{height:125px;width:125px;margin:0 auto 14px;border-radius:50%;background:#b5d2d7;position:relative;display:grid;place-items:center;overflow:hidden}
.uv-avatar-holder img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1}.uv-avatar-placeholder{font-size:53px;color:#236a73}
.uv-account-person h2{font-size:22px;margin:0 0 6px;overflow-wrap:anywhere}.uv-account-person>p{margin:0 0 14px;color:#4f6672;overflow-wrap:anywhere}
.uv-role-tag{display:inline-block;padding:7px 14px;border:1px solid var(--brand-dark);border-radius:20px;color:var(--brand-dark);font-weight:600;font-size:12px;margin-bottom:16px}
.uv-photo-action{display:block;font-weight:600;cursor:pointer;text-align:left;margin:8px 0}.uv-photo-action input{width:100%;margin-top:7px;font-size:12px}.uv-account-person .btn{width:100%}
.uv-account-details{display:flex;flex-direction:column;gap:5px;min-width:0}.uv-account-details h3{margin:9px 0 7px;color:var(--brand-dark);font-size:14px}
.uv-account-field{background:var(--panel);border:1px solid var(--line);padding:15px 18px;border-radius:13px;display:flex;flex-direction:column;gap:5px}
.uv-account-field span{font-size:12px;color:var(--muted)}.uv-account-field strong{font-size:16px;overflow-wrap:anywhere}
.uv-account-details #uv-profile-logout{align-self:flex-start;margin-top:10px}
body.uv-dark .uv-account-person{background:#203b48}body.uv-dark .uv-account-person>p{color:#c0d5df}
@media(max-width:650px){.uv-account-grid{grid-template-columns:1fr}.uv-account-person{padding:20px}.uv-account-heading h1{font-size:27px}}

/* v1.0.8 - distribución uniforme y responsiva de Productos e Inventario */
.uv-business-workspace{min-width:0}.uv-workspace-filters{display:flex;flex-wrap:wrap;align-items:end;gap:14px;margin:16px 0 20px}.uv-workspace-filters label{flex:1 1 240px;max-width:460px;min-width:0}.uv-workspace-filters select,.uv-workspace-filters input{width:100%;min-width:0}.uv-product-form{border:1px solid var(--line);background:var(--panel);border-radius:14px;padding:20px;margin:14px 0 22px;max-width:100%}.uv-product-form h3{margin-top:0}.uv-product-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.uv-product-fields label{min-width:0;display:flex;flex-direction:column;gap:6px}.uv-product-fields input{width:100%;min-width:0}.uv-product-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;margin-top:18px}.uv-product-actions .btn{height:auto;min-height:40px;width:auto;min-width:130px;white-space:normal}.uv-business-workspace .table-wrap{overflow-x:auto;max-width:100%}.uv-business-workspace h3{margin-top:25px}
@media(max-width:700px){.uv-product-fields{grid-template-columns:1fr}.uv-product-form{padding:14px}.uv-product-actions .btn{flex:1 1 130px}.uv-workspace-filters label{max-width:100%}}

/* v1.0.18 · asignaciones de usuarios por negocio y sucursal */
#user-assignment-modal .dialog{max-height:90vh;overflow:auto}
.user-assignment-list{display:grid;gap:12px;max-height:58vh;overflow:auto;padding:4px 2px}
.user-assignment-branch{border:1px solid var(--line);border-radius:12px;padding:12px;margin:0}
.user-assignment-branch legend{padding:0 6px;color:var(--text)}
.user-assignment-roles{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:9px}
.user-assignment-roles label{display:flex;align-items:center;gap:7px;font-weight:500}
.user-assignment-roles input{width:auto}


.dashboard-wrap{margin-top:24px}
.dashboard-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
.dashboard-card{padding:18px}
.dashboard-pie-wrap{display:grid;grid-template-columns:220px 1fr;gap:18px;align-items:center}
.dashboard-pie{width:220px;height:220px;border-radius:50%;display:grid;place-items:center;margin:0 auto;box-shadow:inset 0 0 0 1px rgba(15,23,42,.06)}
.dashboard-pie-center{width:118px;height:118px;border-radius:50%;background:#fff;display:grid;place-items:center;text-align:center;box-shadow:0 2px 10px rgba(16,24,40,.06)}
.dashboard-pie-center strong{display:block;font-size:18px;color:#0f172a}
.dashboard-pie-center small{color:#64748b}
.dashboard-legend{display:grid;gap:10px}
.dashboard-legend-item{display:grid;grid-template-columns:16px 1fr auto;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}
.dashboard-legend-item .swatch{width:12px;height:12px;border-radius:999px;display:inline-block}
.dashboard-legend-item b{white-space:nowrap}
.dashboard-empty{min-height:220px;display:grid;place-items:center;text-align:center;border:1px dashed var(--line);border-radius:16px;color:#64748b;background:#f8fafc;padding:20px}
@media (max-width:1100px){
 .dashboard-grid{grid-template-columns:1fr}
 .dashboard-pie-wrap{grid-template-columns:1fr}
}

.dashboard-filters{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:4px 0 20px;padding:14px;background:#f8fafc;border:1px solid var(--line);border-radius:14px}
.dashboard-filters label{display:grid;gap:6px;margin:0;min-width:170px;color:#334155;font-weight:600}
.dashboard-filters select,.dashboard-filters input{min-width:170px;padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:#fff;color:#172033}
.dashboard-custom-dates{display:flex;gap:12px;flex-wrap:wrap}
.dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.dashboard-product-card{grid-column:1/-1}
.dashboard-chart-title{margin:20px 0 12px}
.dashboard-bars{display:grid;gap:10px;max-height:560px;overflow:auto;padding:2px 4px 2px 0}
.dashboard-bar-row{display:grid;grid-template-columns:minmax(120px,220px) minmax(80px,1fr) 72px;gap:12px;align-items:center}
.dashboard-bar-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#334155;font-size:13px}
.dashboard-bar-track{height:13px;border-radius:999px;background:#edf2f7;overflow:hidden}
.dashboard-bar-track span{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#0f766e,#38bdf8)}
.dashboard-bar-row>b{text-align:right;font-variant-numeric:tabular-nums;color:#0f172a}
@media(max-width:900px){.dashboard-grid{grid-template-columns:1fr}.dashboard-product-card{grid-column:auto}.dashboard-pie-wrap{grid-template-columns:1fr}}
@media(max-width:560px){.dashboard-filters,.dashboard-custom-dates{display:grid;grid-template-columns:1fr}.dashboard-filters label,.dashboard-filters select,.dashboard-filters input{width:100%;min-width:0}.dashboard-bar-row{grid-template-columns:100px minmax(60px,1fr) 54px;gap:7px}.dashboard-pie{width:190px;height:190px}.dashboard-pie-center{width:105px;height:105px}}

/* Executive dashboard inspired by the supplied reference */
.dashboard-wrap{margin:26px 0 8px;padding:0;background:transparent;border:0;box-shadow:none}
.dashboard-topline{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 16px}
.dashboard-topline h2{font-size:21px;margin:0 0 5px;color:#152b43}
.dashboard-topline .section-subtitle{margin:0;color:#73849a}
.dashboard-period-pill{background:#eaf4f7;color:#176a70;border:1px solid #d2e8eb;padding:9px 14px;border-radius:12px;font-weight:700;font-size:12px;white-space:nowrap}
.dashboard-filters{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:0 0 18px;padding:13px 16px;background:#fff;border:1px solid #e4ebf2;border-radius:14px;box-shadow:0 5px 18px rgba(20,45,70,.04)}
.dashboard-filters label{display:grid;gap:6px;margin:0;min-width:170px;color:#51647a;font-weight:600;font-size:12px}
.dashboard-filters select,.dashboard-filters input{min-width:170px;padding:10px 12px;border:1px solid #dce5ee;border-radius:9px;background:#fff;color:#172d45}
.dashboard-custom-dates{display:flex;gap:12px;flex-wrap:wrap}
.dashboard-filters .btn{min-height:39px}
.dashboard-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}
.dashboard-kpi{position:relative;min-height:116px;padding:18px 18px 15px 20px;border-radius:16px;color:#fff;overflow:hidden;box-shadow:0 9px 22px rgba(27,49,70,.09);display:flex;flex-direction:column;gap:5px}
.dashboard-kpi:after{content:"";position:absolute;width:115px;height:115px;border:18px solid rgba(255,255,255,.12);border-radius:50%;right:-30px;top:28px}
.dashboard-kpi-icon{position:absolute;right:17px;top:14px;width:34px;height:34px;border-radius:11px;background:rgba(255,255,255,.18);display:grid;place-items:center;font-size:20px;font-weight:800}
.dashboard-kpi span{font-size:12px;font-weight:600;opacity:.9}
.dashboard-kpi strong{font-size:27px;line-height:1.25;letter-spacing:-.5px;z-index:1}
.dashboard-kpi small{font-size:11px;opacity:.86}
.kpi-sales{background:linear-gradient(120deg,#16a36a,#70c27c)}
.kpi-purchases{background:linear-gradient(120deg,#087b82,#55afb0)}
.kpi-products{background:linear-gradient(120deg,#277fe0,#65b3ef)}
.kpi-stock{background:linear-gradient(120deg,#7252c8,#a18be8)}
.dashboard-main-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(300px,1fr);gap:16px}
.dashboard-panel{min-width:0;background:#fff;border:1px solid #e5ebf1;border-radius:16px;padding:18px 19px;box-shadow:0 7px 22px rgba(23,45,68,.045)}
.dashboard-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.dashboard-panel-head h3{font-size:15px;margin:0 0 5px;color:#17324c}
.dashboard-panel-head p{font-size:11px;color:#8290a2;margin:0}
.dashboard-chart-legend{display:flex;gap:13px;flex-wrap:wrap;color:#64748b;font-size:11px;padding-top:4px}
.dashboard-chart-legend span{display:flex;align-items:center;gap:6px}
.dashboard-chart-legend i{display:inline-block;width:17px;height:3px;border-radius:4px}
.legend-sales{background:#18a66a}.legend-purchases{background:#2699e8}
.dashboard-evolution{grid-row:span 2}
.dashboard-line-host{width:100%;min-height:280px}
.dashboard-line-chart{width:100%;height:auto;display:block;overflow:visible}
.dashboard-product-panel{grid-column:2}
.dashboard-bars-panel{grid-column:1/-1}
.dashboard-pie-wrap{grid-template-columns:minmax(130px,180px) 1fr;gap:14px;min-height:190px}
.dashboard-pie{width:174px;height:174px}
.dashboard-pie-center{width:96px;height:96px}
.dashboard-pie-center strong{font-size:15px}
.dashboard-legend{gap:7px}
.dashboard-legend-item{padding:8px 9px;background:#fbfcfe;border-color:#edf1f5;font-size:11px}
.dashboard-empty{min-height:170px;background:#fafcfe;border-color:#e5ebf1}
.dashboard-chart-title{margin:18px 0 12px}
.dashboard-bars{display:grid;gap:11px;max-height:420px;overflow:auto;padding:2px 5px 2px 0}
.dashboard-bar-row{display:grid;grid-template-columns:minmax(120px,220px) minmax(80px,1fr) 75px;gap:12px;align-items:center}
.dashboard-bar-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#41566d;font-size:12px}
.dashboard-bar-track{height:12px;border-radius:999px;background:#edf2f7;overflow:hidden}
.dashboard-bar-track span{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#13a7a0,#4bb8df)}
.dashboard-bar-row>b{text-align:right;font-variant-numeric:tabular-nums;color:#17324c;font-size:12px}
.dashboard-small-tag{font-size:10px;color:#287c83;background:#eaf7f7;padding:6px 9px;border-radius:8px;white-space:nowrap}
@media(max-width:1100px){.dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-main-grid{grid-template-columns:1fr}.dashboard-evolution,.dashboard-product-panel,.dashboard-bars-panel{grid-column:auto;grid-row:auto}.dashboard-pie-wrap{grid-template-columns:minmax(130px,180px) 1fr}}
@media(max-width:620px){.dashboard-topline{align-items:flex-start;flex-direction:column}.dashboard-kpis{grid-template-columns:1fr 1fr;gap:9px}.dashboard-kpi{padding:14px;min-height:105px}.dashboard-kpi strong{font-size:21px}.dashboard-kpi-icon{display:none}.dashboard-pie-wrap{grid-template-columns:1fr}.dashboard-filters,.dashboard-custom-dates{display:grid;grid-template-columns:1fr}.dashboard-filters label,.dashboard-filters select,.dashboard-filters input{width:100%;min-width:0}.dashboard-bar-row{grid-template-columns:100px minmax(60px,1fr) 52px;gap:7px}}

/* Separar los gráficos de evolución de ventas y compras */
.dashboard-evolution{grid-row:auto}

/* Inventario unificado: estado y existencias en un único panel */
.dashboard-inventory-panel{grid-column:1/-1;grid-row:auto}
.dashboard-inventory-content{display:grid;grid-template-columns:minmax(260px,.85fr) minmax(0,1.6fr);gap:24px;align-items:start}
.dashboard-inventory-content section{min-width:0}
.dashboard-inventory-content h4{margin:4px 0 12px;color:#41566d;font-size:13px}
.dashboard-inventory-status{padding-right:18px;border-right:1px solid #edf1f5}
.dashboard-inventory-products .dashboard-bars{max-height:460px}
@media(max-width:900px){
 .dashboard-inventory-content{grid-template-columns:1fr}
 .dashboard-inventory-status{padding-right:0;border-right:0;border-bottom:1px solid #edf1f5;padding-bottom:18px}
}

/* Dashboard financiero visual para OptiMEDIC y negocios multinegocio */
.financial-dashboard{padding:22px}
.financial-filters{display:flex;align-items:end;gap:14px;flex-wrap:wrap;margin:16px 0 22px}
.financial-filters label{display:grid;gap:6px;color:#52657a;font-size:12px;font-weight:600}
.financial-filters input,.financial-filters select{min-width:170px;padding:9px 11px;border:1px solid #dce5ee;border-radius:9px;background:#fff}
.financial-chart-grid{display:grid;grid-template-columns:1.15fr 1fr;gap:16px;margin:18px 0 24px}
.financial-chart-panel{padding:18px;min-width:0}
.financial-chart-panel h3{margin:0 0 5px}
.financial-chart-panel .section-subtitle{margin:0 0 18px}
.fin-compare{display:grid;gap:22px;padding:15px 2px}
.fin-compare>div{display:grid;grid-template-columns:76px minmax(60px,1fr) 110px;gap:12px;align-items:center}
.fin-compare label{font-size:12px;color:#52657a}
.fin-compare b{font-size:12px;text-align:right;white-space:nowrap}
.fin-track{height:17px;background:#edf2f7;border-radius:999px;overflow:hidden}
.fin-track i{height:100%;display:block;border-radius:999px;min-width:0}
.fin-track i.sales{background:linear-gradient(90deg,#18a66a,#67c78b)}
.fin-track i.purchases{background:linear-gradient(90deg,#2699e8,#76bff0)}
.fin-donut-layout{display:grid;grid-template-columns:155px minmax(0,1fr);gap:16px;align-items:center;min-height:180px}
.fin-donut{width:150px;height:150px;border-radius:50%;display:grid;place-items:center}
.fin-donut>div{width:88px;height:88px;border-radius:50%;background:#fff;display:grid;place-content:center;text-align:center;box-shadow:0 2px 8px rgba(15,23,42,.08)}
.fin-donut b{font-size:13px;color:#17324c}
.fin-donut small{font-size:10px;color:#8290a2}
.fin-legend{display:grid;gap:10px}
.fin-legend>div{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:center;gap:8px;font-size:11px;color:#52657a}
.fin-legend i{width:10px;height:10px;border-radius:50%}
.fin-legend b{white-space:nowrap;color:#17324c}
@media(max-width:900px){.financial-chart-grid{grid-template-columns:1fr}}
@media(max-width:600px){.financial-dashboard{padding:12px}.fin-donut-layout{grid-template-columns:1fr;justify-items:center}.fin-legend{width:100%}.fin-compare>div{grid-template-columns:60px minmax(50px,1fr) 85px;gap:8px}}


/* v1.0.42 — ventana de permisos adaptable con lista desplazable y acciones siempre visibles */
.uv-module-permissions-modal{
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:12px;
}
#uv-module-permission-form{
  display:flex;
  flex-direction:column;
  width:min(700px,100%);
  max-height:calc(100vh - 24px);
  max-height:calc(100dvh - 24px);
  min-height:0;
  overflow:hidden;
}
#uv-module-permission-form .dialog-head,
#uv-module-permission-form > label,
#uv-module-permission-form > #uv-mp-business,
#uv-module-permission-form > #uv-module-permission-hint,
#uv-module-permission-form > #uv-mp-error{
  flex:0 0 auto;
}
#uv-module-permission-form .table-wrap{
  flex:1 1 auto;
  min-height:120px;
  max-height:none;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
}
#uv-module-permission-form .table-wrap thead th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f8fafc;
}
#uv-module-permission-form .actions{
  flex:0 0 auto;
  position:sticky;
  bottom:0;
  margin:0 -20px -20px;
  padding:14px 20px 18px;
  background:#fff;
  border-top:1px solid var(--line);
  z-index:3;
}
@media(max-width:640px){
  .uv-module-permissions-modal{padding:8px;align-items:center}
  #uv-module-permission-form{
    max-height:calc(100vh - 16px);
    max-height:calc(100dvh - 16px);
    padding:16px;
    border-radius:14px;
  }
  #uv-module-permission-form .actions{
    margin:0 -16px -16px;
    padding:12px 16px 14px;
  }
  #uv-module-permission-form .table-wrap{min-height:100px}
}

/* v1.0.45: panel de roles y plantillas dentro de Usuarios */
.uv-role-manager-dialog{
  display:flex;
  flex-direction:column;
  width:min(850px,100%);
  max-height:calc(100dvh - 26px);
  min-height:0;
  overflow:hidden;
}
.uv-role-manager-dialog>.dialog-head{flex:0 0 auto}
.uv-role-manager-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:4px}
.uv-role-manager-body label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:#475569}
.uv-role-manager-body label.check-label{flex-direction:row;align-items:center}
.uv-role-manager-body input:not([type=checkbox]),.uv-role-manager-body select{min-height:38px;border:1px solid var(--line);border-radius:9px;padding:8px 11px;width:100%;background:#fff}
.uv-rm-tools{gap:12px;align-items:end;margin:8px 0 16px}
.uv-rm-tools>label{flex:1}
.uv-role-name-fields{display:grid;grid-template-columns:1fr 1.5fr;gap:12px;margin-bottom:14px}
.uv-rm-permissions{max-height:380px;overflow:auto;margin:10px 0}
.uv-rm-permissions thead th{position:sticky;top:0;background:#f6f8fb;z-index:1}
.uv-rm-permissions td:nth-child(2),.uv-rm-permissions td:nth-child(3){text-align:center}
.uv-rm-role-note{display:block;margin-top:3px}
.uv-rm-footer{flex:0 0 auto;padding:14px 18px 4px;border-top:1px solid var(--line);background:#fff}
@media(max-width:650px){
 .uv-role-manager-dialog{max-height:calc(100dvh - 14px);padding:13px}
 .uv-role-name-fields{grid-template-columns:1fr}
 .uv-rm-tools{align-items:stretch;flex-direction:column}
 .uv-rm-tools>label,.uv-rm-tools>button{width:100%}
 .uv-rm-permissions{max-height:320px}
}

/* Submenú de Caja e Historial integrado dentro de Ventas */
.sales-submenu{display:flex;flex-direction:column;gap:3px;margin:-5px 0 7px 42px;padding-left:12px;border-left:2px solid #d9e8ee}
.sales-submenu button{border:0;background:transparent;border-radius:8px;padding:9px 10px;text-align:left;color:#60738a;font-size:13px;cursor:pointer}
.sales-submenu button:hover{background:#f1f7f9;color:#087f8c}
.sales-submenu button.active{background:#e6f7f6;color:#087f8c;font-weight:700}
.sales-submenu.hidden{display:none!important}
