*{box-sizing:border-box}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;background:#f5f6f8;color:#1d2433}aside{position:fixed;inset:0 auto 0 0;width:230px;background:#fff;border-right:1px solid #e5e7eb;padding:22px 14px}.brand{display:flex;align-items:center;gap:10px;padding:0 10px 22px}.mark{display:inline-grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#1769e0;color:white;font-weight:800}.mark.big{width:48px;height:48px;margin:auto;font-size:22px}.brand b{font-size:18px}nav{display:flex;flex-direction:column;height:calc(100% - 60px);gap:4px}nav a{color:#455066;text-decoration:none;padding:11px 12px;border-radius:9px}nav a:hover{background:#f0f4fa;color:#1769e0}.spacer{flex:1}main{margin-left:230px}header{height:68px;background:rgba(255,255,255,.9);border-bottom:1px solid #e5e7eb;display:flex;justify-content:flex-end;align-items:center;padding:0 28px;position:sticky;top:0;backdrop-filter:blur(12px);z-index:3}header div{display:flex;flex-direction:column}header small,.lead,.card small{color:#778195}.content{padding:32px;max-width:1350px;margin:auto}h1{font-size:28px;margin:0 0 5px}h2{font-size:17px}.lead{margin-top:0}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:24px 0}.card,.panel{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:20px;box-shadow:0 1px 2px rgba(0,0,0,.02)}.card{display:flex;flex-direction:column;gap:8px;text-decoration:none;color:inherit}.card strong{font-size:25px}.card.action strong{color:#1769e0}.panel{margin:18px 0;overflow:auto}table{width:100%;border-collapse:collapse;margin-top:14px}th,td{text-align:left;padding:13px 10px;border-bottom:1px solid #edf0f3;font-size:14px}th{color:#667085;font-weight:600;background:#fafbfc}label{font-size:13px;color:#596579;display:flex;flex-direction:column;gap:7px}input,select,button{font:inherit;border:1px solid #d8dde5;border-radius:9px;padding:11px 12px;background:#fff;color:#1d2433}input:focus,select:focus{outline:3px solid rgba(23,105,224,.12);border-color:#1769e0}button{background:#1769e0;color:#fff;border-color:#1769e0;cursor:pointer;font-weight:650}.inline,.entry,.form-grid{display:grid;grid-template-columns:1fr 2fr 1.4fr auto;gap:12px;align-items:end}.form-grid{grid-template-columns:2fr 1fr 1fr}.entry{grid-template-columns:3fr 1fr 1fr auto}.purchase-total{text-align:right;font-size:18px;padding:20px 0}.purchase-total strong{font-size:24px;margin-left:18px}.save{float:right;min-width:180px}.alert{padding:12px 14px;border-radius:10px;background:#fff1f0;color:#9b1c1c;margin:14px 0}.alert.ok{background:#eefaf3;color:#176b3a}.login-body{min-height:100vh;display:grid;place-items:center;background:#f2f4f7}.login-card{width:min(390px,92vw);background:#fff;border:1px solid #e2e6ec;border-radius:18px;padding:34px;box-shadow:0 18px 55px rgba(24,39,75,.08);text-align:center}.login-card form{text-align:left;display:grid;gap:16px;margin-top:25px}.login-card h1{margin-top:16px}.login-card p{color:#778195}@media(max-width:800px){aside{position:static;width:auto;height:auto;padding:10px}.brand{padding:5px 8px 10px}nav{height:auto;flex-direction:row;overflow:auto}.spacer{display:none}nav a{white-space:nowrap}main{margin:0}header{display:none}.content{padding:20px 14px}.cards{grid-template-columns:1fr}.inline,.entry,.form-grid{grid-template-columns:1fr}.panel{border-radius:12px;padding:15px}th,td{white-space:nowrap}}
@media(prefers-color-scheme:dark){body{background:#12161d;color:#e8edf5}aside,header,.card,.panel,.login-card{background:#191f28;border-color:#2b3441}nav a{color:#b9c3d1}nav a:hover,th{background:#222a35}th,td{border-color:#2b3441}input,select{background:#141a22;color:#e8edf5;border-color:#394352}.lead,header small,.card small,label{color:#9da8b7}.login-body{background:#10141a}}

/* v1.0.4: códigos y búsqueda inteligente */
.record-code{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;font-weight:700;letter-spacing:.02em;background:#f2f5f9;border:1px solid #e2e7ee;border-radius:7px;padding:4px 7px;color:#344054}.smart-filter{display:flex;align-items:center;gap:12px;margin:18px 0 6px}.smart-filter input{width:min(520px,100%)}.filter-count{font-size:12px;color:#778195;white-space:nowrap}.product-form{grid-template-columns:2fr 1.2fr 1.4fr auto}.supplier-form{grid-template-columns:1fr auto;max-width:720px}.smart-select-wrap{position:relative}.native-smart-select{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}.smart-select-search{width:100%}.smart-select-menu{display:none;position:absolute;z-index:50;top:calc(100% + 6px);left:0;right:0;max-height:280px;overflow:auto;background:#fff;border:1px solid #d8dde5;border-radius:10px;padding:5px;box-shadow:0 16px 35px rgba(16,24,40,.14)}.smart-select-menu.open{display:block}.smart-option{display:block;width:100%;text-align:left;background:transparent;color:#1d2433;border:0;padding:10px;border-radius:7px;font-weight:500}.smart-option:hover,.smart-option:focus,.smart-option.selected{background:#edf4ff;color:#1559b7;outline:none}.smart-empty{padding:12px;color:#778195;font-size:13px}tr[hidden]{display:none}@media(max-width:800px){.product-form,.supplier-form{grid-template-columns:1fr}.smart-filter{align-items:stretch;flex-direction:column}.filter-count{align-self:flex-end}}@media(prefers-color-scheme:dark){.record-code{background:#202833;border-color:#344050;color:#d6dfeb}.smart-select-menu{background:#191f28;border-color:#394352}.smart-option{color:#e8edf5}.smart-option:hover,.smart-option:focus,.smart-option.selected{background:#24344a;color:#8bbcff}}

/* v1.0.5: personalización, ayuda y temas */
.brand{min-width:0}.brand b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.brand-logo{width:38px;height:38px;object-fit:contain;border-radius:9px}.login-logo{display:block;max-width:180px;max-height:72px;object-fit:contain;margin:0 auto 14px}.theme-toggle{display:flex;align-items:center;gap:9px;width:100%;background:transparent!important;color:#455066!important;border:0!important;text-align:left;padding:11px 12px}.theme-toggle:hover{background:#f0f4fa!important;color:#1769e0!important}.help-text{color:#778195;font-size:13px;line-height:1.55}.context-help{background:#eef5ff;border:1px solid #d6e6ff;color:#36516f;border-radius:11px;padding:11px 14px;margin:12px 0 18px;font-size:13px;line-height:1.5}.settings-form{display:grid;gap:18px;max-width:820px}.settings-form label small{color:#778195}.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.current-file{display:flex;align-items:center;gap:9px;margin-top:5px}.current-file img{width:42px;height:42px;object-fit:contain;background:#f7f8fa;border:1px solid #e5e7eb;border-radius:8px;padding:4px}.checkline{display:flex;flex-direction:row;align-items:center;gap:7px}.checkline input{width:auto}.theme-choices{display:flex;gap:9px;flex-wrap:wrap}.theme-choices button{background:#fff;color:#344054;border-color:#d8dde5}.theme-choices button.active{background:#1769e0;color:#fff;border-color:#1769e0}
html[data-theme="dark"] body{background:#12161d;color:#e8edf5}html[data-theme="dark"] aside,html[data-theme="dark"] header,html[data-theme="dark"] .card,html[data-theme="dark"] .panel,html[data-theme="dark"] .login-card{background:#191f28;border-color:#2b3441}html[data-theme="dark"] nav a,html[data-theme="dark"] .theme-toggle{color:#b9c3d1!important}html[data-theme="dark"] nav a:hover,html[data-theme="dark"] th,html[data-theme="dark"] .theme-toggle:hover{background:#222a35!important}html[data-theme="dark"] th,html[data-theme="dark"] td{border-color:#2b3441}html[data-theme="dark"] input,html[data-theme="dark"] select{background:#141a22;color:#e8edf5;border-color:#394352}html[data-theme="dark"] .lead,html[data-theme="dark"] header small,html[data-theme="dark"] .card small,html[data-theme="dark"] label,html[data-theme="dark"] .help-text,html[data-theme="dark"] .settings-form label small{color:#9da8b7}html[data-theme="dark"] .login-body{background:#10141a}html[data-theme="dark"] .context-help{background:#172436;border-color:#29415e;color:#b9cbe0}html[data-theme="dark"] .theme-choices button{background:#202833;color:#d6dfeb;border-color:#394352}html[data-theme="dark"] .theme-choices button.active{background:#1769e0;color:#fff;border-color:#1769e0}html[data-theme="dark"] .current-file img{background:#202833;border-color:#394352}
html[data-theme="light"] body{background:#f5f6f8;color:#1d2433}html[data-theme="light"] aside,html[data-theme="light"] header,html[data-theme="light"] .card,html[data-theme="light"] .panel,html[data-theme="light"] .login-card{background:#fff;border-color:#e5e7eb}
@media(max-width:800px){.upload-grid{grid-template-columns:1fr}.theme-toggle{width:auto;white-space:nowrap}.brand b{max-width:220px}}

/* v1.0.6 — tema explícito. Estas reglas prevalecen sobre preferencias del SO. */
html[data-theme="light"]{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="light"] body{background:#f5f6f8!important;color:#1d2433!important}
html[data-theme="light"] aside,html[data-theme="light"] header,html[data-theme="light"] .card,html[data-theme="light"] .panel,html[data-theme="light"] .login-card{background:#fff!important;border-color:#e5e7eb!important;color:#1d2433!important}
html[data-theme="light"] nav a,html[data-theme="light"] .theme-toggle{color:#455066!important}
html[data-theme="light"] nav a:hover,html[data-theme="light"] .theme-toggle:hover,html[data-theme="light"] th{background:#f0f4fa!important}
html[data-theme="light"] th,html[data-theme="light"] td{border-color:#e5e7eb!important}
html[data-theme="light"] input,html[data-theme="light"] select,html[data-theme="light"] textarea{background:#fff!important;color:#1d2433!important;border-color:#d8dde5!important}
html[data-theme="light"] .lead,html[data-theme="light"] header small,html[data-theme="light"] .card small,html[data-theme="light"] label,html[data-theme="light"] .help-text{color:#667085!important}
html[data-theme="light"] .smart-select-menu{background:#fff!important;border-color:#d8dde5!important}
html[data-theme="light"] .smart-option{color:#1d2433!important}
html[data-theme="light"] .smart-option:hover,html[data-theme="light"] .smart-option:focus,html[data-theme="light"] .smart-option.selected{background:#edf4ff!important;color:#1559b7!important}
html[data-theme="light"] .record-code{background:#f2f5f9!important;border-color:#e2e7ee!important;color:#344054!important}
html[data-theme="light"] .context-help{background:#eef5ff!important;border-color:#d6e6ff!important;color:#36516f!important}
html[data-theme="light"] .theme-choices button{background:#fff!important;color:#344054!important;border-color:#d8dde5!important}
html[data-theme="light"] .theme-choices button.active{background:#1769e0!important;color:#fff!important;border-color:#1769e0!important}
html[data-theme="dark"] body{background:#12161d!important;color:#e8edf5!important}
html[data-theme="dark"] aside,html[data-theme="dark"] header,html[data-theme="dark"] .card,html[data-theme="dark"] .panel,html[data-theme="dark"] .login-card{background:#191f28!important;border-color:#2b3441!important;color:#e8edf5!important}
html[data-theme="dark"] nav a,html[data-theme="dark"] .theme-toggle{color:#b9c3d1!important}
html[data-theme="dark"] nav a:hover,html[data-theme="dark"] th,html[data-theme="dark"] .theme-toggle:hover{background:#222a35!important}
html[data-theme="dark"] th,html[data-theme="dark"] td{border-color:#2b3441!important}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#141a22!important;color:#e8edf5!important;border-color:#394352!important}
html[data-theme="dark"] .lead,html[data-theme="dark"] header small,html[data-theme="dark"] .card small,html[data-theme="dark"] label,html[data-theme="dark"] .help-text{color:#9da8b7!important}
html[data-theme="dark"] .smart-select-menu{background:#191f28!important;border-color:#394352!important}
html[data-theme="dark"] .smart-option{color:#e8edf5!important}
html[data-theme="dark"] .smart-option:hover,html[data-theme="dark"] .smart-option:focus,html[data-theme="dark"] .smart-option.selected{background:#24344a!important;color:#8bbcff!important}
html[data-theme="dark"] .record-code{background:#202833!important;border-color:#344050!important;color:#d6dfeb!important}
html[data-theme="dark"] .context-help{background:#172436!important;border-color:#29415e!important;color:#b9cbe0!important}
html[data-theme="dark"] .theme-choices button{background:#202833!important;color:#d6dfeb!important;border-color:#394352!important}
html[data-theme="dark"] .theme-choices button.active{background:#1769e0!important;color:#fff!important;border-color:#1769e0!important}


/* v1.0.7 — tema claro de alto contraste y superficies completas */
html[data-theme="light"]{color-scheme:light;background:#f4f6f8!important}
html[data-theme="light"] body,html[data-theme="light"] .login-body{background:#f4f6f8!important;color:#182230!important}
html[data-theme="light"] aside{background:#ffffff!important;border-color:#dfe3e8!important}
html[data-theme="light"] header{background:rgba(255,255,255,.96)!important;border-color:#dfe3e8!important;color:#182230!important}
html[data-theme="light"] main,html[data-theme="light"] .content{color:#182230!important}
html[data-theme="light"] h1,html[data-theme="light"] h2,html[data-theme="light"] h3,html[data-theme="light"] strong,html[data-theme="light"] b{color:#182230}
html[data-theme="light"] .panel,html[data-theme="light"] .card,html[data-theme="light"] .login-card{background:#ffffff!important;border-color:#dfe3e8!important;color:#182230!important;box-shadow:0 1px 3px rgba(16,24,40,.04)}
html[data-theme="light"] .lead,html[data-theme="light"] p,html[data-theme="light"] small,html[data-theme="light"] label,html[data-theme="light"] .help-text,html[data-theme="light"] .filter-count,html[data-theme="light"] .smart-empty,html[data-theme="light"] .settings-form label small{color:#5b6678!important}
html[data-theme="light"] a{color:#155eef}
html[data-theme="light"] nav a,html[data-theme="light"] .theme-toggle{color:#344054!important}
html[data-theme="light"] nav a:hover,html[data-theme="light"] nav a:focus,html[data-theme="light"] .theme-toggle:hover{background:#eef4ff!important;color:#155eef!important}
html[data-theme="light"] table{color:#182230!important}
html[data-theme="light"] th{background:#f7f9fb!important;color:#475467!important;border-color:#dfe3e8!important}
html[data-theme="light"] td{background:#fff!important;color:#273142!important;border-color:#e6e9ee!important}
html[data-theme="light"] tr:hover td{background:#fafcff!important}
html[data-theme="light"] input,html[data-theme="light"] select,html[data-theme="light"] textarea{background:#fff!important;color:#182230!important;border-color:#cbd2dc!important;box-shadow:none!important}
html[data-theme="light"] input::placeholder,html[data-theme="light"] textarea::placeholder{color:#8a94a6!important;opacity:1}
html[data-theme="light"] input:focus,html[data-theme="light"] select:focus,html[data-theme="light"] textarea:focus{border-color:#1769e0!important;outline:3px solid rgba(23,105,224,.13)!important}
html[data-theme="light"] button{background:#1769e0;color:#fff;border-color:#1769e0}
html[data-theme="light"] button:hover{filter:brightness(.96)}
html[data-theme="light"] .secondary-action{background:#fff!important;color:#344054!important;border-color:#cbd2dc!important}
html[data-theme="light"] .secondary-action:hover{background:#f7f9fb!important;color:#155eef!important;border-color:#9fb7dc!important;filter:none}
html[data-theme="light"] .theme-choices button{background:#fff!important;color:#344054!important;border-color:#cbd2dc!important}
html[data-theme="light"] .theme-choices button.active{background:#1769e0!important;color:#fff!important;border-color:#1769e0!important}
html[data-theme="light"] .context-help{background:#eef5ff!important;border-color:#cfe0fa!important;color:#294766!important}
html[data-theme="light"] .alert{background:#fff0ef!important;color:#8f1d18!important;border:1px solid #f1c7c4!important}
html[data-theme="light"] .alert.ok{background:#edf9f1!important;color:#176b3a!important;border-color:#c8e9d3!important}
html[data-theme="light"] .record-code{background:#f2f5f9!important;border-color:#d9e0e8!important;color:#344054!important}
html[data-theme="light"] .smart-select-menu{background:#fff!important;border-color:#cbd2dc!important;box-shadow:0 16px 35px rgba(16,24,40,.12)!important}
html[data-theme="light"] .smart-option{background:transparent!important;color:#273142!important}
html[data-theme="light"] .smart-option:hover,html[data-theme="light"] .smart-option:focus,html[data-theme="light"] .smart-option.selected{background:#eaf2ff!important;color:#1559b7!important}
html[data-theme="light"] .current-file img{background:#fff!important;border-color:#dfe3e8!important}
html[data-theme="light"] .mark{color:#fff!important}
html[data-theme="light"] .card.action strong{color:#155eef!important}
html[data-theme="light"] .purchase-total{color:#344054!important}
html[data-theme="light"] .purchase-total strong{color:#182230!important}

/* v1.0.8 — Tema claro suave y corrección de desplegables en Nueva compra */
html[data-theme="light"]{background:#e9edf2!important}
html[data-theme="light"] body,html[data-theme="light"] .login-body{background:#e9edf2!important;color:#202936!important}
html[data-theme="light"] aside{background:#f2f4f7!important;border-color:#d5dae1!important}
html[data-theme="light"] header{background:rgba(242,244,247,.96)!important;border-color:#d5dae1!important}
html[data-theme="light"] .panel,html[data-theme="light"] .card,html[data-theme="light"] .login-card{background:#f7f8fa!important;border-color:#d5dae1!important;box-shadow:0 1px 2px rgba(16,24,40,.035)!important}
html[data-theme="light"] th{background:#eceff3!important;color:#465164!important;border-color:#d5dae1!important}
html[data-theme="light"] td{background:#f7f8fa!important;color:#293445!important;border-color:#dde2e8!important}
html[data-theme="light"] tr:hover td{background:#f0f3f6!important}
html[data-theme="light"] input,html[data-theme="light"] select,html[data-theme="light"] textarea{background:#f0f2f5!important;color:#202936!important;border-color:#c6cdd6!important}
html[data-theme="light"] input:focus,html[data-theme="light"] select:focus,html[data-theme="light"] textarea:focus{background:#f7f8fa!important;border-color:#4c78b8!important;outline:3px solid rgba(76,120,184,.12)!important}
html[data-theme="light"] .smart-select-menu{background:#f7f8fa!important;border-color:#bcc5d0!important;box-shadow:0 12px 28px rgba(31,41,55,.16)!important}
html[data-theme="light"] .smart-option{color:#293445!important}
html[data-theme="light"] .smart-option:hover,html[data-theme="light"] .smart-option:focus,html[data-theme="light"] .smart-option.selected{background:#e3e9f1!important;color:#244f87!important}
html[data-theme="light"] .context-help{background:#e8edf4!important;border-color:#cbd5e1!important;color:#3d5068!important}
html[data-theme="light"] .record-code{background:#e9edf2!important;border-color:#cfd6df!important;color:#3b4657!important}
html[data-theme="light"] .secondary-action,html[data-theme="light"] .theme-choices button{background:#eef1f4!important;border-color:#c6cdd6!important}

/* Los menús inteligentes son absolutos. Un panel con overflow:auto los recortaba. */
.purchase-head-panel,.purchase-items-panel{overflow:visible!important;position:relative}
.purchase-head-panel{z-index:20}
.purchase-items-panel{z-index:10}
.purchase-head-panel .smart-select-wrap,.purchase-items-panel .smart-select-wrap{z-index:30}
.purchase-head-panel .smart-select-menu,.purchase-items-panel .smart-select-menu{z-index:1000}
.purchase-table-scroll{overflow-x:auto;overflow-y:visible;margin-top:14px}
.purchase-table-scroll table{margin-top:0}
@media(max-width:800px){.purchase-head-panel,.purchase-items-panel{overflow:visible!important}.purchase-table-scroll{overflow-x:auto}}
