:root {
  /* línea de diseño de Rexpo (rexpoparts.com): azul noche, rojo Rexpo, gris claro; Poppins + Lexend */
  --navy: #03001F; --navy-2: #000738; --red: #D7132F; --red-logo: #E2211C; --grey: #EFEFEF; --blue: #1D3FB8;
  --bg: #F4F4F6; --card: #fff; --line: #E2E2E8; --text: #03001F; --muted: #5F6170;
  --real: #E8F2EA; --fore: #E9EEF8; --pend: #EEF2FB; --warn: #FBE8EB; --warn-text: #B0102A; --ok: #E6F4EA; --ok-text: #1E6B35;
}
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/lexend-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/lexend-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/poppins-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/poppins-latin-600-normal.woff2) format('woff2'); }

* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; font-family: 'Lexend', 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
h1, h2, h3, .btn, .menu, .tabs, .tbl th, .brand-app, legend, .kpi b { font-family: 'Poppins', 'Segoe UI', Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .3rem; color: var(--navy); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; color: var(--navy); font-weight: 600; }
h2::before { content: ''; display: inline-block; width: 4px; height: .95em; background: var(--red); margin-right: .5rem; vertical-align: -1px; border-radius: 2px; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; color: var(--navy); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }

/* cabecera: blanca con el logo, como la web de Rexpo */
.top { background: #fff; color: var(--navy); display: flex; align-items: center; gap: 1.4rem; padding: 0 1.4rem; min-height: 66px; flex-wrap: wrap;
       position: sticky; top: 0; z-index: 20; border-top: 4px solid var(--red); box-shadow: 0 1px 0 var(--line), 0 4px 14px rgba(3,0,31,.05); }
.top a { color: var(--navy); }
.brand { display: flex; align-items: center; gap: .9rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-app { border-left: 1px solid var(--line); padding-left: .9rem; font-weight: 600; font-size: .98rem; line-height: 1.15; color: var(--navy); }
.brand-app small { display: block; font-family: 'Lexend', sans-serif; font-weight: 400; font-size: .74rem; color: var(--muted); }
.menu { display: flex; gap: .1rem; flex-wrap: wrap; flex: 1; align-items: stretch; align-self: stretch; }
.menu > a, .drop > summary { display: flex; align-items: center; padding: 0 .75rem; color: var(--navy); cursor: pointer; list-style: none; font-weight: 500; font-size: .93rem;
       border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: 62px; }
.menu > a.on, .drop > summary.on { border-bottom-color: var(--red); color: var(--navy); }
.menu > a:hover, .drop > summary:hover { color: var(--red); text-decoration: none; }
.drop { position: relative; display: flex; }
.drop > summary::-webkit-details-marker { display: none; }
.drop > summary::after { content: ' ▾'; font-size: .8em; margin-left: .2rem; }
.drop-list { position: absolute; top: 62px; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(3,0,31,.14); padding: .35rem; min-width: 190px; z-index: 30; }
.drop-list a { display: block; color: var(--navy); padding: .45rem .7rem; border-radius: 5px; font-family: 'Poppins', sans-serif; font-weight: 500; font-size: .9rem; }
.drop-list a:hover { background: var(--grey); color: var(--red); text-decoration: none; }
.me { display: flex; gap: 1rem; align-items: center; font-size: .88rem; }
.me a { color: var(--muted); }
.me form { margin: 0; }
.linkbtn { background: none; border: 1px solid var(--line); color: var(--navy); cursor: pointer; font: inherit; padding: .3rem .7rem; border-radius: 20px; }
.linkbtn:hover { border-color: var(--red); color: var(--red); }
.pill { background: var(--red); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; font-weight: 600; margin-left: .3rem; font-family: 'Lexend', sans-serif; }

.wrap { max-width: 1600px; margin: 0 auto; padding: 1.2rem; }
.foot { text-align: center; color: #C9CBE0; background: var(--navy-2); font-size: .78rem; padding: 1.1rem 1rem; margin-top: 2rem; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.foot-mark { height: 20px; width: auto; background: #fff; border-radius: 4px; padding: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(3,0,31,.04); }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.card.danger { border-color: #f4c7b8; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .2rem; font-size: .9rem; }
.odoo-state { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

/* botones */
.btn { display: inline-block; border: 1px solid #C9CBD6; background: #fff; color: var(--navy); padding: .5rem .95rem; border-radius: 6px; cursor: pointer; font-family: 'Poppins', sans-serif; font-weight: 500; font-size: .9rem; line-height: 1.2; }
.btn:hover { background: var(--grey); text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #1b1847; }
.btn.accent { background: var(--red); border-color: var(--red); color: #fff; }
.btn.accent:hover { background: #b80f27; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.tiny { padding: .12rem .45rem; font-size: .78rem; }
.btn.wide { width: 100%; padding: .6rem; }

/* avisos */
.flash { padding: .7rem .9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok); border-color: #b7dfc3; color: var(--ok-text); }
.flash.error { background: var(--warn); border-color: #f4c7b8; color: var(--warn-text); }
.flash.info { background: var(--pend); border-color: #c4dbf3; color: #1d4f86; }
.flash.clave { background: #fff6d6; border-color: #f0d77a; color: #5c4400; font-size: 1.05rem; }
.alerts { display: grid; gap: .5rem; margin-bottom: 1rem; }
.alert { display: block; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red); color: var(--navy); padding: .65rem .95rem; border-radius: 8px; }
.alert:hover { text-decoration: none; background: #FFF7F8; }
.badge { display: inline-block; padding: .08rem .45rem; border-radius: 4px; font-size: .78rem; font-weight: bold; white-space: nowrap; }
.badge.ok { background: var(--ok); color: var(--ok-text); }
.badge.pend { background: #dbeafb; color: #1d4f86; }
.badge.warn { background: var(--warn); color: var(--warn-text); }
.badge.grey { background: #eceff3; color: #4b5565; }
.warn-text { color: var(--warn-text); font-weight: bold; }
.from-odoo { font-size: .66rem; background: var(--navy); color: #fff; border-radius: 3px; padding: 0 .3rem; margin-left: .35rem; font-weight: bold; vertical-align: middle; }

/* tablas */
.scroll { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tbl th { background: var(--grey); text-align: left; font-weight: 500; color: var(--navy); padding: .5rem .5rem; border-bottom: 2px solid #DADAE2; white-space: nowrap; position: sticky; top: 0; font-size: .86rem; }
.tbl td { padding: .38rem .5rem; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.tbl tfoot td { font-weight: 600; border-top: 2px solid #DADAE2; background: var(--grey); }
.tbl .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl td.real { background: var(--real); }
.tbl td.fore { background: var(--fore); }
.tbl th.real { background: #DCEADF; }
.tbl th.fore { background: #DCE4F3; }
.tbl td.big { font-size: 1.08rem; font-weight: bold; }
.tbl td.neg { color: var(--warn-text); font-weight: bold; }
.tbl td.warn { background: var(--warn); color: var(--warn-text); font-weight: bold; }
.tbl tr.link { cursor: pointer; }
.tbl tbody tr:hover td { background-color: #F6F6FA; }
.tbl tbody tr:hover td.real { background-color: #DCEADF; }
.tbl tr.pend td { background: var(--pend); font-style: italic; color: #1E3A8A; }
.tbl tr.apertura td { background: #F1F1F4; font-weight: 600; }
.tbl td.notes { max-width: 300px; min-width: 160px; font-size: .82rem; color: #475467; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl tr.flashrow td { outline: 2px solid #f79009; outline-offset: -2px; }
.tbl.mov .det { display: none; }
.tbl.mov.show-det .det { display: table-cell; }
.tbl.mov tr.hide { display: none; }
.tbl.mov { font-size: .84rem; }
.tbl.mov td, .tbl.mov th { padding: .32rem .4rem; }
.hecho { display: flex; gap: .3rem; align-items: center; margin: 0; white-space: nowrap; }
.ignore { display: flex; gap: .3rem; margin: 0; }
.ignore input { width: 130px; padding: .15rem .35rem; }
.narrow-tbl { max-width: 640px; }
.row-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.pager a, .pager b { padding: 0 .25rem; }

/* pestañas y filtros */
.tabs { display: flex; gap: .2rem; border-bottom: 2px solid var(--line); margin: 1.3rem 0 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .95rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--red); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--navy); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }
.filters input[type=search] { min-width: 280px; flex: 1; }
.chk { display: flex; gap: .3rem; align-items: center; white-space: nowrap; }

/* formularios */
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #c5cbd6; border-radius: 5px; background: #fff; color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5f0; border-color: var(--blue); }
.form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.1rem; }
.form label, .stack label { display: flex; flex-direction: column; gap: .3rem; font-weight: bold; font-size: .9rem; color: #344054; }
.form label input, .form label select, .form label textarea, .stack input { font-weight: normal; }
.form label.full { grid-column: 1 / -1; margin-top: .6rem; }
.form small { font-weight: normal; color: var(--muted); font-size: .8rem; }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.radios legend { font-weight: bold; font-size: .9rem; color: #344054; margin-bottom: .2rem; }
.form label.radio { flex-direction: row; align-items: center; font-weight: normal; gap: .4rem; }
.form-actions { margin-top: 1.1rem; display: flex; gap: .5rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.side .card { margin-bottom: 1rem; }
.hist { font-size: .85rem; border-bottom: 1px solid #edf0f4; padding: .35rem 0; }
.hist ul { margin: .2rem 0 0 1rem; padding: 0; }

/* login */
html:has(.login), body:has(.login) { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #12104a 100%); min-height: 100vh; }
.login { min-height: 82vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 14px; padding: 2.2rem 2.2rem 1.6rem; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.35); border-top: 5px solid var(--red); }
.login-brand img { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto .4rem; }
.login-card h1 { margin-top: .9rem; text-align: center; }
.login-card > p { text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: .8rem; margin: 1.2rem 0; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
body:has(.login) .foot { background: transparent; }

/* resumen de cliente */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; border-left: 4px solid var(--navy); }
.kpi span { display: block; color: var(--muted); font-size: .8rem; }
.kpi b { font-size: 1.35rem; color: var(--navy); font-weight: 600; }
a.ext { color: var(--red); font-weight: 600; text-decoration: none; padding: 0 .15rem; }
a.ext:hover { color: var(--navy); }

/* buscador de contactos de Odoo */
.ac-wrap { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(3,0,31,.16); z-index: 40; max-height: 320px; overflow-y: auto; font-weight: normal; }
.ac-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .5rem .7rem; cursor: pointer; font: inherit; color: var(--navy); border-bottom: 1px solid #F0F0F4; }
.ac-list button:hover, .ac-list button.sel { background: var(--grey); }
.ac-list button small { display: block; color: var(--muted); font-size: .76rem; }
.ac-state a { color: var(--red); }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .wrap { padding: .8rem; }
  .top { position: static; gap: .3rem; padding: .4rem .8rem; }
  .menu { flex-wrap: nowrap; overflow-x: auto; width: 100%; order: 3; align-self: auto; }
  .menu > a, .drop > summary { min-height: 44px; }
  .brand-app { display: none; }
  .brand-logo { height: 30px; }
  .brand { order: 1; }
  .me { order: 2; }
  .me > a { display: none; }
  .tbl.summary .tiny { display: none; }
  .pagehead h1 { font-size: 1.3rem; }
  .menu > a, .drop > summary { white-space: nowrap; }
  .me { margin-left: auto; }
  .drop-list { position: fixed; top: auto; left: .8rem; }
}
@media print {
  .top, .actions, .filters, .tabs, .foot, .hecho button { display: none !important; }
  .card { border: 0; padding: 0; }
}

/* almacén de tránsito (GMA) */
[hidden] { display: none !important; }
.dest { line-height: 1.45; padding: 1px 0; }
.dest + .dest { border-top: 1px dashed var(--line, #e3e3e3); }
.cont-box { background: var(--grey, #EFEFEF); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.cont-box b { font-family: Poppins, sans-serif; }
.tbl.conts { min-width: 1200px; }
.tbl.conts td.destcol { min-width: 260px; max-width: 380px; }
.tbl.conts td { vertical-align: top; }

/* inicio: cuadro de stock por almacén y referencia */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 999px; padding: .4rem .9rem; color: var(--navy); font-size: .9rem; }
.chip b { color: var(--red); font-family: 'Poppins', sans-serif; margin-right: .15rem; }
.chip:hover { background: #FFF7F8; text-decoration: none; }
.mx-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: .4rem .9rem; font: 500 .9rem 'Poppins', sans-serif; color: var(--navy); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }
.mx { border-collapse: separate; border-spacing: 4px; width: 100%; }
.mx thead th { font: 600 .78rem 'Poppins', sans-serif; color: var(--muted); text-align: center; padding: .2rem .3rem; white-space: nowrap; }
.mx th.mx-alm { text-align: left; white-space: nowrap; font: 600 .95rem 'Poppins', sans-serif; padding: .3rem .5rem .3rem 0; min-width: 120px; }
.mx th.mx-alm a { color: var(--navy); }
.mx td.mx-c { text-align: center; border-radius: 8px; background: #F7F7F9; min-width: 74px; height: 54px; padding: 0; vertical-align: middle; }
.mx td.mx-c a { display: block; padding: .45rem .3rem; color: var(--navy); }
.mx td.mx-c a:hover { text-decoration: none; outline: 2px solid var(--navy); border-radius: 8px; }
.mx td.mx-c b { display: block; font: 600 1.15rem 'Poppins', sans-serif; line-height: 1.15; }
.mx td.mx-c small { display: block; font-size: .72rem; white-space: nowrap; }
.mx td.empty { background: transparent; border: 1px dashed #ECECF1; }
.mx td.h0 { background: #F7F7F9; } .mx td.h1 { background: #E8F2EA; } .mx td.h2 { background: #D3E9D9; } .mx td.h3 { background: #B9DCC3; }
.mx td.h4 { background: #9ACDA9; } .mx td.h5 { background: #7BBE8F; }
.mx td.mx-tot, .mx tfoot td.mx-c { background: #EEF0F6; }
.mx tfoot th, .mx tfoot td b { color: var(--navy); }
.mx .v-pron { display: none !important; }
.mx.show-pron .v-pron { display: block !important; }
.mx.show-pron .v-real { display: none !important; }
.mx-ll { color: #1d4f86; margin: 0 .15rem; } .mx-rr { color: #B0102A; margin: 0 .15rem; }
.dot { display: inline-block; font: 600 .7rem 'Lexend', sans-serif; border-radius: 999px; padding: 0 .4rem; margin-left: .25rem; vertical-align: middle; }
.dot.warn { background: var(--warn); color: var(--warn-text); }
.dot.odoo { background: #FFF1D6; color: #8A5A00; }
.form label.chk { display: flex; flex-direction: row; align-items: center; gap: .5rem; margin: .7rem 0; font-weight: normal; }
.form label.chk input { width: auto; margin: 0; }
.inv-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.mx td.mx-c b.neg { color: var(--warn-text); }

/* apuntar: lo justo */
.mas-datos { margin: .4rem 0 1rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.mas-datos > summary { cursor: pointer; font: 600 .95rem 'Poppins', sans-serif; color: var(--navy); }
.odoo-hint { background: #EEF4FF; border: 1px solid #C9D8F5; border-radius: 8px; padding: .6rem .8rem; margin: .2rem 0 1rem; }
.odoo-hint p { margin: 0 0 .4rem; font-size: .9rem; }
.odoo-hint button { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid #C9D8F5; border-radius: 6px; padding: .45rem .6rem; margin: .3rem 0;
  cursor: pointer; font: .9rem 'Lexend', sans-serif; color: var(--navy); }
.odoo-hint button:hover { border-color: var(--navy); }
.odoo-hint button small { color: var(--muted); }
.alm-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; }
.alm-btn { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; color: var(--navy); border-left: 4px solid var(--red); }
.alm-btn b { display: block; font: 600 1.1rem 'Poppins', sans-serif; }
.alm-btn small { color: var(--muted); }
.alm-btn:hover { text-decoration: none; background: #FFF7F8; }
.pagehead .actions { display: flex; gap: .5rem; }

/* acciones del almacén y vista reducida */
details.more { position: relative; }
details.more > summary { list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
.more-list { position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(3,0,31,.14); padding: .35rem; min-width: 230px; z-index: 20; }
.more-list a { display: block; padding: .45rem .7rem; border-radius: 5px; color: var(--navy); font: 500 .9rem 'Poppins', sans-serif; }
.more-list a:hover { background: var(--grey); color: var(--red); text-decoration: none; }
.tbl.mini td { padding-top: .45rem; padding-bottom: .45rem; }
.neg-text { color: var(--warn-text); }
.tbl td.muted { color: var(--muted); }

.mx-pp { color: #6B4FA0; margin: 0 .15rem; }
form.search { display: flex; align-items: center; margin: 0 .6rem; }
form.search input { width: 230px; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 999px; font: .88rem 'Lexend', sans-serif; background: var(--grey); }
form.search input:focus { outline: 2px solid var(--navy); background: #fff; }
@media (max-width: 1100px) { form.search input { width: 160px; } }
