/* cadizweb Gestión — colores del logotipo */
:root {
  --navy: #0F3A5A;
  --navy-2: #13466F;
  --blue: #1A6AA3;
  --blue-soft: #E8F1F8;
  --green: #8BC53D;
  --green-dark: #5E8F1F;
  --lime: #C2DE4B;
  --green-soft: #EFF7E3;
  --gray: #7B868F;
  --ink: #1C2A36;
  --ink-2: #4A5866;
  --line: #E3E8ED;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --red: #C0392B;   --red-soft: #FBEAE8;
  --amber: #B7791F; --amber-soft: #FDF3E1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15,58,90,.06), 0 2px 8px rgba(15,58,90,.05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0; }
h2 { font-size: 16px; font-weight: 600; }
.muted { color: var(--gray); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { background: #fff; border-radius: 50%; padding: 2px; }
.brand span { font-size: 19px; line-height: 1.05; letter-spacing: -.2px; }
.brand strong { font-weight: 700; }
.brand em { font-style: normal; font-weight: 700; color: var(--green); }
.brand small { display: block; font-size: 10.5px; letter-spacing: 1.2px; white-space: nowrap; text-transform: uppercase; color: rgba(255,255,255,.6); margin-top: 3px; }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.82); font-weight: 500; text-decoration: none; }
.sidebar nav a svg { width: 19px; height: 19px; fill: currentColor; opacity: .85; flex: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.on { background: rgba(139,197,61,.18); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.sidebar nav a.on svg { color: var(--lime); opacity: 1; }
.side-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.side-foot a { color: rgba(255,255,255,.7); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 18px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.menu-btn svg { width: 24px; height: 24px; fill: var(--navy); }
.user { display: flex; align-items: center; gap: 10px; }
.user form { margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.uname { font-weight: 500; color: var(--ink-2); }
.content { padding: 24px 28px 40px; flex: 1; }
.foot { padding: 14px 28px; color: var(--gray); font-size: 12px; border-top: 1px solid var(--line); background: var(--card); }
.scrim { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.flush { padding: 0; }
.card.flush > h2 { padding: 16px 20px 0; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; color: inherit; text-decoration: none !important; display: block; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.kpi.green::before { background: var(--green); }
.kpi.amber::before { background: var(--amber); }
.kpi.red::before { background: var(--red); }
a.kpi:hover { border-color: #cfd8e0; }
.kpi .lbl { color: var(--gray); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.kpi .val { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--ink-2); font-size: 12.5px; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tbody tr:hover td { background: #F8FAFC; }
.t tr.clickable { cursor: pointer; }
.t tfoot td { font-weight: 700; background: #FAFBFC; border-bottom: 0; }
.t td.empty { text-align: center; color: var(--gray); padding: 28px; }
.card.flush .t th:first-child, .card.flush .t td:first-child { padding-left: 20px; }
.card.flush .t th:last-child, .card.flush .t td:last-child { padding-right: 20px; }
.card.flush .pager, .card.flush > .small { padding: 12px 20px; margin: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.gray { background: #EEF1F4; color: var(--ink-2); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.green { background: var(--green-soft); color: var(--green-dark); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 8px 16px; font: 600 14px var(--font); cursor: pointer; background: var(--blue); color: #fff; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #155A8B; }
.btn.green { background: var(--green); color: #fff; }
.btn.green:hover { background: #79B12E; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: #F4F7FA; }
.btn.danger { background: #fff; color: var(--red); border-color: #F0C8C3; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
button.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.alert.success { background: var(--green-soft); border-color: #D3E9B5; color: #3F6614; }
.alert.error { background: var(--red-soft); border-color: #F0C8C3; color: #8E2A20; }
.alert.info { background: var(--blue-soft); border-color: #C9DDEC; color: var(--navy); }

/* ---------- Formularios ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .f { display: flex; flex-direction: column; gap: 4px; }
label, .lbl-sm { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea {
  font: 14px var(--font); color: var(--ink); padding: 8px 11px; border: 1px solid #CFD8E0; border-radius: 8px; background: #fff; min-height: 38px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,106,163,.15); }
.filters input[type=search] { min-width: 240px; }
textarea { min-height: 70px; resize: vertical; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }

.lines td { padding: 6px 6px; vertical-align: middle; }
.lines input, .lines select { min-height: 34px; padding: 6px 8px; }
.lines .c-qty { width: 100px; } .lines .c-price { width: 120px; } .lines .c-disc { width: 90px; } .lines .c-sub { width: 120px; } .lines .c-del { width: 44px; }
.lines .hint { font-size: 12px; color: var(--gray); margin-top: 2px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--gray); font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { color: var(--red); background: var(--red-soft); }
.totals { margin-left: auto; min-width: 280px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 8px; font-size: 17px; font-weight: 700; color: var(--navy); }

dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--gray); font-size: 13px; }
dl.info dd { margin: 0; }

/* ---------- Gráficos ---------- */
.chart { margin: 0; position: relative; }
.chart figcaption { font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: #EDF0F3; stroke-width: 1; }
.chart .base { stroke: #B9C3CC; stroke-width: 1; }
.chart .axis { fill: var(--gray); font-size: 11px; }
.chart .mark { fill: var(--blue); }
.chart .hit { fill: transparent; }
.chart .bar:hover .mark { fill: #155A8B; }
.chart .bar:hover .hit { fill: rgba(26,106,163,.06); }
.chart .tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); }
.hbar { display: flex; align-items: center; gap: 10px; }
.hbar .track { flex: 1; height: 10px; background: #EEF2F5; border-radius: 0 4px 4px 0; min-width: 80px; }
.hbar .fill { height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(139,197,61,.18), transparent 60%),
              linear-gradient(160deg, var(--navy) 0%, #175F93 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 34px 34px 28px; }
.login-card .logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 22px; }
.login-card h1 { font-size: 18px; text-align: center; margin-bottom: 20px; font-weight: 600; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 6px; }
.login-card .note { text-align: center; color: var(--gray); font-size: 12.5px; margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
  .menu-btn { display: block; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px 16px 32px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .uname { display: none; }
  dl.info { grid-template-columns: 120px 1fr; }
  .filters input[type=search] { min-width: 0; }
  .filters .f { flex: 1 1 140px; }
}
@media print {
  .sidebar, .topbar, .foot, .filters, .actions { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}

/* Evitar desbordes en pantallas estrechas */
.grid > *, .kpis > * { min-width: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.chart { overflow-x: auto; }
@media (max-width: 900px) {
  .chart svg { min-width: 560px; }
  .t th, .t td { padding: 8px 10px; }
  .card.flush .t th:first-child, .card.flush .t td:first-child { padding-left: 14px; }
}
.form-row .wide { grid-column: span 2; }
@media (max-width: 560px) { .form-row .wide { grid-column: auto; } .totals { min-width: 0; width: 100%; } }

/* ===================== Aplicación móvil (PWA) ===================== */
.tabbar { display: none; }
.install { display: none; }
@media (max-width: 900px) {
  /* Cabecera con zona segura (muesca del iPhone) */
  .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
  .foot { display: none; }
  .content { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

  /* Barra inferior de pestañas */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(15,58,90,.06);
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: 0; padding: 4px 0; color: var(--gray); font: 600 11px var(--font);
    text-decoration: none !important; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .tabbar .ti { width: 40px; height: 28px; display: grid; place-items: center; border-radius: 14px; }
  .tabbar svg { width: 22px; height: 22px; fill: currentColor; }
  .tabbar a.on { color: var(--navy); }
  .tabbar a.on .ti { background: var(--green-soft); color: var(--green-dark); }
  .tabbar a.plus .ti { background: var(--green); color: #fff; width: 48px; height: 32px; border-radius: 16px; box-shadow: 0 2px 6px rgba(139,197,61,.45); }
  .tabbar a.plus { color: var(--green-dark); }

  /* Aviso de instalación */
  .install:not([hidden]) {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 12px; right: 12px; z-index: 25;
    bottom: calc(76px + env(safe-area-inset-bottom)); background: #fff; border-radius: 14px;
    padding: 12px 10px 12px 14px; box-shadow: 0 8px 30px rgba(15,58,90,.25); border: 1px solid var(--line);
  }
  .login-page ~ .install:not([hidden]) { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .install img { border-radius: 10px; flex: none; }
  .install-txt { flex: 1; display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; color: var(--ink-2); }
  .install-txt strong { color: var(--navy); font-size: 14px; }

  /* Controles más cómodos para el dedo (y sin zoom automático en iPhone) */
  input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 42px; }
  .filters { gap: 8px; }
  .filters .actions { width: 100%; }

  /* Columnas secundarias ocultas en las listas */
  .t-pedidos :is(th, td):is(:nth-child(2), :nth-child(4), :nth-child(5), :nth-child(8), :nth-child(9)),
  .t-facturas :is(th, td):is(:nth-child(2), :nth-child(5), :nth-child(6), :nth-child(7), :nth-child(8)),
  .t-clientes :is(th, td):is(:nth-child(2), :nth-child(4), :nth-child(5), :nth-child(6), :nth-child(8)),
  .t-productos :is(th, td):is(:nth-child(3), :nth-child(5), :nth-child(6), :nth-child(7), :nth-child(8), :nth-child(10)) { display: none; }
  .t-pedidos tfoot, .t-facturas tfoot { display: none; }
  .t-productos tbody td[colspan] { display: table-cell; }
}
/* Abierta como aplicación instalada */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; }
  input, textarea, td, dd { -webkit-user-select: text; user-select: text; }
}
/* Filtros plegables en el móvil */
.filter-toggle { display: none; }
@media (max-width: 900px) {
  .filter-toggle { display: inline-flex; }
  .filters.folded > .f:not(:first-child) { display: none; }
  .filters > .f:first-child { flex: 1 1 100%; }
}
@media (max-width: 900px) { .hide-sm { display: none !important; } }

/* ---------- Fichas de producto ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.pcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.pcard-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pcode { font: 600 12.5px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--blue); background: var(--blue-soft);
  padding: 3px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.3; margin: 2px 0 0; }
.pcat { font-size: 12.5px; color: var(--gray); margin-top: -4px; }
.pprice { display: flex; flex-direction: column; padding: 8px 0 2px; border-top: 1px dashed var(--line); }
.pp-main { font-size: 22px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.pp-main small { font-size: 13px; font-weight: 500; color: var(--gray); }
.pp-sub { font-size: 12.5px; color: var(--ink-2); }
.pstock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 2px 0 0; }
.pstock > div { background: #F6F8FA; border-radius: 8px; padding: 6px 4px; text-align: center; min-width: 0; }
.pstock dt { font-size: 10.5px; color: var(--gray); text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstock dd { margin: 0; font-weight: 700; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pstock .ok { background: var(--green-soft); } .pstock .ok dd { color: var(--green-dark); }
.pstock .ko { background: var(--red-soft); }  .pstock .ko dd { color: var(--red); }
.pcard-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.pcard-foot .btn { flex: 1; justify-content: center; }
@media (max-width: 900px) { .pgrid { grid-template-columns: 1fr; gap: 12px; } }

/* ---------- Botón flotante para subir ---------- */
.to-top { position: fixed; right: 18px; bottom: 24px; z-index: 14; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--navy); color: #fff; box-shadow: 0 6px 18px rgba(15,58,90,.35); cursor: pointer; display: grid; place-items: center;
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none; transition: opacity .2s, transform .2s; }
.to-top svg { width: 24px; height: 24px; fill: currentColor; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--blue); }
@media (max-width: 900px) { .to-top { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media print { .to-top { display: none; } }

/* Nombre de la aplicación en la pantalla de inicio */
.appname { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1; margin: -4px 0 6px; color: var(--navy); }
.appname em { font-style: normal; color: var(--green); }
.login-card .logo { max-width: 220px; margin-bottom: 16px; }

/* ---------- Fichas de cliente ---------- */
.ccard .pcard-head { align-items: flex-start; }
.cav { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px;
  color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue)); text-decoration: none !important; }
.chead { flex: 1; min-width: 0; }
.chead .pname { margin: 0; }
.chead .pname a { color: var(--ink); }
.chead .pcat { margin-top: 2px; }
.ccontact { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ccontact a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cstats { grid-template-columns: 0.7fr 1.15fr 1.15fr; }
.cstats dd { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- PC: tablas con scroll · Móvil: fichas ---------- */
.only-mobile { display: none; }
.table-scroll { max-height: calc(100vh - 250px); min-height: 240px; overflow: auto; border-radius: var(--radius); }
.t.sticky thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
.card.flush .table-scroll .t th:first-child, .card.flush .table-scroll .t td:first-child { padding-left: 20px; }
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: #C9D3DC; border-radius: 10px; border: 2px solid #fff; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 900px) {
  .only-desk { display: none !important; }
  .only-mobile { display: block; }
}
.t.sticky th.c-name { min-width: 240px; }
.t.sticky th.c-city { min-width: 150px; }

/* ---------- PC: menú lateral contraíble ---------- */
@media (min-width: 901px) {
  .menu-btn { display: block; margin-left: -8px; border-radius: 8px; }
  .menu-btn:hover { background: #EEF2F5; }
  .sidebar { transition: width .2s ease, flex-basis .2s ease; overflow: hidden; }
  .side-mini .sidebar { width: 72px; flex-basis: 72px; }
  .side-mini .brand { padding: 18px 0 16px; justify-content: center; }
  .side-mini .brand span, .side-mini .sidebar .lbl { display: none; }
  .side-mini .sidebar nav { padding: 12px 10px; }
  .side-mini .sidebar nav a { justify-content: center; padding: 11px 0; }
  .side-mini .sidebar nav a svg { width: 22px; height: 22px; }
  .side-mini .side-foot { padding: 14px 0; text-align: center; }
  .sidebar nav a, .side-foot a { white-space: nowrap; }
}

/* ---------- Botón compartir y presupuesto rápido ---------- */
.share-btn { flex: none; width: 36px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--blue);
  display: inline-grid; place-items: center; cursor: pointer; vertical-align: middle; padding: 0; }
.share-btn svg { width: 19px; height: 19px; fill: currentColor; }
.share-btn:hover { background: var(--blue-soft); border-color: #C9DDEC; }
.share-btn.big { width: 44px; height: auto; min-height: 34px; }
.row-acts { display: flex; gap: 6px; align-items: center; }
.row-acts .btn { margin: 0; }

.qdlg { border: 0; padding: 0; border-radius: 22px; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  box-shadow: 0 24px 70px rgba(0,0,0,.35); color: var(--ink); }
.qdlg::backdrop { background: rgba(15, 30, 45, .55); }
.qstep { padding: 26px 26px 22px; display: flex; flex-direction: column; }
.qstep h2 { text-align: center; font-size: 21px; margin-bottom: 4px; }
.qprod { text-align: center; color: var(--gray); font-size: 13px; margin: 0 0 14px; }
.qstep label { font-size: 15px; font-weight: 500; color: var(--ink); margin: 6px 0 6px; }
.qstep input { font-size: 18px; min-height: 52px; border-radius: 12px; margin-bottom: 10px; }
.qbig { width: 100%; justify-content: center; min-height: 52px; font-size: 17px; border-radius: 12px; margin-top: 10px; }
.qcancel { background: #EDEFF2; color: var(--ink-2); }
.qcancel:hover { background: #E2E6EA; }
.qtext { background: #F5F6F8; border-radius: 14px; padding: 16px 18px; margin: 0; font: 14px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 46vh; overflow: auto; color: #222; }
.qok { text-align: center; color: var(--green-dark); font-weight: 600; margin: 14px 0 6px; }
.qok.err { color: var(--red); }
.qshare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.qapp { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; border: 0; cursor: pointer;
  font: 600 13px var(--font); color: var(--ink-2); background: #F5F6F8; text-decoration: none !important; }
.qapp svg { width: 30px; height: 30px; fill: #fff; padding: 7px; border-radius: 10px; box-sizing: content-box; }
.qapp.wa svg { background: #25D366; } .qapp.mail svg { background: var(--blue); } .qapp.copy svg { background: #6B7785; }
.qapp:hover { background: #ECEFF2; }
.qbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qbtns .qbig:only-child, .qbtns .qbig:first-child:nth-last-child(2) ~ [hidden] { grid-column: 1 / -1; }
.qbtns:has(#qnative[hidden]) { grid-template-columns: 1fr; }
.qclose { background: var(--navy); color: #fff; }
.qclose:hover { background: #0B2C45; }

/* Unidad de venta */
.uom-chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font-weight: 700; font-size: 12.5px; }
.puom { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--ink-2); }
.puom em { flex-basis: 100%; font-style: normal; color: var(--gray); }

/* ---------- Buscador desplegable vertical ---------- */
.ac { position: fixed; z-index: 60; background: #fff; border: 1px solid #CFD8E0; border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15,58,90,.22); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px; }
.ac-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.ac-item + .ac-item { border-top: 1px solid #F0F3F6; }
.ac-item strong { font-weight: 600; color: var(--ink); font-size: 14px; }
.ac-item span { font-size: 12.5px; color: var(--gray); }
.ac-item:hover, .ac-item.sel { background: var(--blue-soft); }
.ac-empty { padding: 14px; color: var(--gray); text-align: center; }

/* ---------- Líneas del presupuesto en el móvil: una tarjeta por producto ---------- */
@media (max-width: 900px) {
  .ac-item { padding: 13px 12px; }
  .ac-item strong { font-size: 15px; }
  #lines thead { display: none; }
  #lines, #lines tbody { display: block; width: 100%; }
  #lines tbody { padding: 4px 12px; }
  #lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr 40px; gap: 8px 8px; padding: 12px; margin: 8px 0;
    border: 1px solid var(--line); border-radius: 12px; background: #FAFBFC; }
  #lines td { display: block; padding: 0; border: 0; width: auto !important; }
  #lines tbody tr:hover td { background: transparent; }
  #lines td.c-prod { grid-column: 1 / -1; }
  #lines td.c-prod .p-input { width: 100%; font-weight: 600; }
  #lines td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; color: var(--gray);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 3px; }
  #lines td.sub { grid-column: 1 / -1; grid-row: 3; text-align: right; font-weight: 700; color: var(--navy); font-size: 16px;
    display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line); padding-top: 8px; }
  #lines td.sub::before { margin: 0; }
  #lines td.c-del { grid-column: 4; grid-row: 2; align-self: end; }
  #lines .icon-btn { width: 40px; height: 44px; font-size: 24px; }
  #lines .table-wrap, .card.flush .table-wrap:has(#lines) { overflow: visible; }
  .card.flush .t#lines td:first-child { padding-left: 0; }
  .card.flush .t#lines td:last-child { padding-right: 0; }
}
#partner, .p-input { scroll-margin-top: calc(84px + env(safe-area-inset-top)); }

/* ---------- Fichas de presupuestos y pedidos (móvil) ---------- */
.osum { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.osum span { color: var(--gray); font-size: 13px; flex: 1; }
.osum strong { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.osum small { color: var(--gray); font-size: 12px; width: 100%; text-align: right; }
.ocard .pcode { text-decoration: none !important; }
.ocard .pname a { color: var(--ink); }
.ocard .pcat { line-height: 1.45; }
.ocard.ocard-draft::before, .ocard.ocard-sent::before { background: linear-gradient(90deg, var(--blue), var(--blue)); }
.ocard.ocard-sale::before { background: linear-gradient(90deg, var(--green), var(--lime)); }
.ocard.ocard-cancel::before { background: var(--red); opacity: .6; }
.ocard.ocard-cancel { opacity: .75; }
.obadges { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 8px; align-items: center; font-size: 12px; color: var(--gray); }
.obadges .badge { justify-self: start; }
.alb-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; margin-top: 4px; white-space: nowrap; }
.alb-btn { background: var(--navy); color: #fff; justify-content: center; }
.alb-btn:hover { background: #0B2C45; }
.pcard-foot { flex-wrap: wrap; }

/* Fechas Desde / Hasta en el móvil: una al lado de otra y sin salirse de la pantalla (iPhone fija un ancho mínimo propio) */
@media (max-width: 900px) {
  .filters .f:has(input[type=date]) { flex: 1 1 calc(50% - 4px); min-width: 0; max-width: calc(50% - 4px); }
  .filters input[type=date] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%;
    padding: 8px 8px; font-size: 15px; line-height: 1.2; background: #fff; }
  .filters input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; }
  .filters input[type=date]::-webkit-calendar-picker-indicator { margin-left: 2px; padding: 0; }
}
@media (max-width: 900px) {
  .filters .f:not(:has(input[type=date])) { flex: 1 1 100%; }
}
.adlg .qshare { margin: 10px 0 2px; }
.adlg .qapp.wa svg { background: var(--green); }
.adlg .qapp:disabled { opacity: .45; cursor: wait; }
.adlg .qapp[hidden] + .qapp { grid-column-start: 1; }
.adlg .qshare { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }

/* ---------- Histórico de cliente ---------- */
.hist-form .hf-cli { flex: 2 1 320px; }
.hist-form .hf-prod { flex: 2 1 320px; }
.hist-title { font-size: 17px; margin: 4px 0 14px; }
.hist-title a { color: var(--navy); }
.hcard { color: inherit; text-decoration: none !important; }
.hcard:active { background: #F6F8FA; }
.hcard .pstock dd small { font-weight: 500; color: var(--gray); font-size: 11px; }
.hmore { text-align: right; color: var(--blue); font-weight: 600; font-size: 13.5px; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--gray); }

/* ---------- Buscador a pantalla completa en el móvil ---------- */
.acx { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; }
.acx-head { display: flex; gap: 8px; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(15,58,90,.06); }
.acx-in { flex: 1; font-size: 16px !important; min-height: 44px; border-radius: 12px; background: #F2F4F7; border-color: transparent; }
.acx-cancel { background: none; border: 0; color: var(--blue); font: 600 16px var(--font); padding: 8px 4px; cursor: pointer; }
.acx-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 6px 10px calc(16px + env(safe-area-inset-bottom)); }
.acx-list .ac-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 6px 0; padding: 13px 14px; }
.acx-list .ac-item + .ac-item { border-top: 1px solid var(--line); }
.acx-list .ac-item:active, .acx-list .ac-item.sel { background: var(--blue-soft); }
html.acx-open, html.acx-open body { overflow: hidden; }

/* Botón de copiar código */
.code-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.copy-code { flex: none; width: 26px; height: 26px; padding: 0; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--gray); cursor: pointer; display: inline-grid; place-items: center; }
.copy-code svg { width: 14px; height: 14px; fill: currentColor; }
.copy-code:hover { color: var(--blue); background: var(--blue-soft); border-color: #C9DDEC; }
.copy-code .i-ok { display: none; }
.copy-code.ok { color: #2E7D32; border-color: #A5D6A7; background: #E8F5E9; }
.copy-code.ok .i-copy { display: none; }
.copy-code.ok .i-ok { display: block; }
.copy-code.err { color: #C62828; border-color: #EF9A9A; }

/* Botones de acción sin contorno (copiar fila, presupuesto rápido) */
.row-acts { justify-content: flex-end; }
.act-btn, .share-btn.act-btn { width: 36px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: #EEF1F5;
  color: var(--navy, #0F3A5A); cursor: pointer; display: inline-grid; place-items: center; }
.act-btn svg { width: 18px; height: 18px; fill: currentColor; }
.act-btn:hover, .share-btn.act-btn:hover { background: #E1E7EF; border: 0; }
.copy-code:not(.act-btn) { border: 0; background: transparent; }
.copy-code:not(.act-btn):hover { background: var(--blue-soft); }
.act-btn.ok { background: #E8F5E9; color: #2E7D32; }
.act-btn.err { background: #FDECEA; color: #C62828; }

/* Stock por almacén desplegable */
.alm-toggle { border: 0; background: transparent; color: var(--navy, #0F3A5A); font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 6px; }
.alm-toggle:hover { background: var(--blue-soft); }
.alm-toggle svg { width: 18px; height: 18px; fill: currentColor; transition: transform .15s; }
.alm-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
tr.alm-row > td { background: #F6F8FA; padding: 10px 20px; }
.alm-chip { display: inline-flex; align-items: baseline; gap: 6px; margin: 2px 8px 2px 0; padding: 6px 12px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line); font-size: 13px; text-transform: uppercase; color: var(--gray); letter-spacing: .02em; }
.alm-chip strong { color: var(--navy, #0F3A5A); font-weight: 600; text-transform: none; }
.alm-chip em { font-style: normal; text-transform: none; font-size: 12px; color: var(--gray); }
.alm-chip.off { opacity: 1; }
.alm-det { margin-top: 10px; }
.alm-det summary { cursor: pointer; font-weight: 600; color: var(--navy, #0F3A5A); font-size: 14px; }
.alm-list { margin-top: 8px; }
/* Tabla de productos: celdas algo más compactas para que quepa la columna Acción */
.t.prod th, .t.prod td { padding-left: 8px; padding-right: 8px; }
.t.prod .row-acts { gap: 4px; }
.t.prod .alm-toggle { padding: 4px 2px; }
/* Tabla de productos: cabecera azul como el menú lateral y columnas numéricas centradas */
.t.prod thead th { background: var(--blue); color: #fff; border-bottom: 0; box-shadow: none; }
.t.prod th:nth-child(n+3), .t.prod tbody tr:not(.alm-row) > td:nth-child(n+3) { text-align: center; }
.t.prod .row-acts { justify-content: center; }
/* Ranking de agentes */
.t.rank thead th, .t.months thead th { background: var(--blue); color: #fff; border-bottom: 0; box-shadow: none; }
.t.rank tr.me > td, .t.months tr.me > td { background: #F1F7EA; }
.t.rank tr.sel > td { box-shadow: inset 3px 0 0 var(--blue); }
.t.rank tr.sel > td:not(:first-child) { box-shadow: none; }
.pos { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 13px;
  background: #EEF1F5; color: var(--navy); }
.pos1 { background: #F6C343; color: #5A4300; }
.pos2 { background: #D5DBE1; color: #3A4652; }
.pos3 { background: #E3B48A; color: #5B3714; }
.c-bar { min-width: 160px; }
.rbar { height: 8px; border-radius: 4px; background: #EEF1F5; overflow: hidden; margin: 6px 0 3px; }
.rbar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.delta { font-weight: 600; font-size: 13px; white-space: nowrap; }
.delta.up { color: #2E7D32; }
.delta.down { color: #C62828; }
.t.months td, .t.months th { padding-left: 8px; padding-right: 8px; }
.t.months tr.tot > td { background: #F6F8FA; border-top: 2px solid var(--line); }
.t.months .delta { font-size: 11.5px; }
/* Diferencia de precio en el histórico (▲ subido, ▼ bajado, = igual) */
.dif { font-weight: 600; font-size: 13px; white-space: nowrap; }
.dif.up { color: #E07B00; }
.dif.down { color: var(--navy); }
.dif.eq { color: var(--gray); font-weight: 500; }
.t.sticky.hist th.c-name { min-width: 190px; }

/* Ventana emergente de factura */
.fdlg { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 58, 90, .35); overflow: hidden; display: none; flex-direction: column; }
.fdlg[open] { display: flex; }
.fdlg::backdrop { background: rgba(15, 30, 45, .45); }
.fdlg-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: var(--blue); color: #fff; font-weight: 600; }
.fdlg-bar .icon-btn { color: #fff; font-size: 24px; line-height: 1; background: transparent; border: 0; cursor: pointer; }
.fdlg-body { overflow: auto; padding: 18px; }
.fdlg-load { text-align: center; padding: 40px 0; }
.fac-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.fac-tit { font-size: 20px; font-weight: 700; color: var(--navy); }
.fac-cli { text-align: right; font-size: 14px; line-height: 1.45; }
.fac-lin tr.fac-txt td { color: var(--gray); font-style: italic; }
.fac-pie { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.fac-tot { margin: 0; min-width: 280px; }
.fac-tot > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.fac-tot dt { color: var(--gray); }
.fac-tot dd { margin: 0; font-variant-numeric: tabular-nums; }
.fac-total { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 8px !important; font-weight: 700; font-size: 17px; color: var(--navy); }
.fac-total dt { color: var(--navy); }
.pcard-head .ver-fac { margin-left: auto; }
@media (max-width: 600px) { .fac-cli { text-align: left; } .fdlg { width: 100vw; max-height: 100vh; border-radius: 0; } }

/* Números de serie / lotes en la factura */
.ns-list { margin-top: 5px; font-size: 12.5px; color: var(--gray); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.ns-lbl { font-weight: 600; }
.ns { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--navy);
  font: 600 12px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.ns em { font-style: normal; color: var(--gray); font-weight: 500; }
.ns-sueltos { margin-top: 12px; }
.fac-pdf { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 9px; border-radius: 6px;
  background: #EEF1F5; color: var(--navy); font-size: 12.5px; font-weight: 600; text-decoration: none !important; }
.fac-pdf:hover { background: #E1E7EF; }
/* Casilla de filtro (Tarifa Kemppi) */
.f-check { flex: 0 0 auto; }
.chk { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-weight: 600; color: var(--navy); cursor: pointer; white-space: nowrap; }
.chk input { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; }
.chk:has(input:checked) { background: var(--blue-soft); border-color: #C9DDEC; }
/* Naranja corporativo de Kemppi (RGB 245,115,0 · Pantone 166 C) */
:root { --kemppi: #F57300; }
.kemppi { color: var(--kemppi); font-weight: 700; }
.chk-kemppi input { accent-color: var(--kemppi); }
.chk-kemppi:has(input:checked) { background: #FFF1E5; border-color: #FBC99B; }
.badge.badge-kemppi { background: #FFF1E5; color: var(--kemppi); }
/* Recuadro de estado seleccionado (filtro) */
a.kpi.on { box-shadow: 0 0 0 2px var(--blue) inset, 0 1px 3px rgba(15,58,90,.08); }
.fac-tit .badge { vertical-align: middle; font-size: 12px; margin-left: 6px; }
.t.docs th, .t.docs td { padding-left: 8px; padding-right: 8px; } .t.sticky.docs th.c-name { min-width: 200px; }

/* Búsqueda de nº de serie / lote */
mark { background: #FFE58A; color: inherit; padding: 0 1px; border-radius: 2px; }

/* Nuevo presupuesto */
.link-btn { background: none; border: 0; padding: 2px 0; margin-top: 2px; color: var(--blue); font-size: 12.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.lines .m-input { width: 100%; margin-top: 6px; min-height: 54px; font-size: 13.5px; resize: vertical; }
.card.prueba { border-left: 4px solid var(--amber, #E0A100); }
.card.prueba details { margin-top: 10px; }
.card.prueba summary { cursor: pointer; margin-bottom: 6px; }
.t.kv th { width: 140px; text-align: left; font-family: ui-monospace, monospace; font-size: 12.5px; }
.card.prueba td { font-size: 13px; }
.card.ok-card { border-left: 4px solid var(--green, #3BA55C); }
#cli-info { margin-top: 4px; font-size: 12.5px; color: var(--gray); }
.dir-box { margin: 4px 0 14px; padding: 12px 14px 2px; background: var(--bg, #F4F6F8); border-radius: 10px; }
.dir-box .field { margin-bottom: 6px; }
.dir-ver { font-size: 13px; color: var(--gray); padding: 0 2px 10px; }
/* Cabecera del presupuesto: todas las casillas en una fila, alineadas arriba */
.form-row.quote-top { grid-template-columns: 2.2fr 1fr 1fr 1fr; align-items: start; }
.form-row.quote-top .wide { grid-column: auto; }
.form-row.quote-top .field { min-width: 0; }
.form-row.quote-top select, .form-row.quote-top input { width: 100%; }
@media (max-width: 1100px) { .form-row.quote-top { grid-template-columns: 1fr 1fr; } .form-row.quote-top .wide { grid-column: 1 / -1; } }
@media (max-width: 560px) { .form-row.quote-top { grid-template-columns: 1fr; } }
.fac-del { display: inline-block; margin-left: 6px; }
.fac-pdf.del-btn { border: 0; cursor: pointer; font-family: inherit; color: #B42318; background: #FEE4E2; }
.fac-pdf.del-btn:hover { background: #FECDCA; }

/* ===== Nuevo presupuesto: aspecto más cuidado ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.qform { padding-bottom: 84px; }
.qform .card { border-radius: 14px; padding: 22px 24px; }
.qform .card.flush { padding: 0; }
.qform .card > h2 { margin-bottom: 18px; }
.qform .card.flush > h2 { padding: 22px 24px 0; margin-bottom: 14px; }
.q-tit { display: inline-flex; align-items: center; gap: 10px; font-size: 16.5px; letter-spacing: -.1px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
        background: var(--navy); color: #fff; font-size: 13px; font-weight: 700; }
.q-chip { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line);
          padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.q-help { margin: 2px 0 0; font-size: 12.5px; color: var(--gray); }
.qform .field label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .35px; }
.qform input[type=text], .qform select, .qform textarea { border-radius: 9px; }
#cli-info { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; min-height: 22px; }

/* Dirección de entrega */
.qform .dir-box { background: linear-gradient(180deg, #F7FAFC, #F2F6F9); border: 1px solid var(--line); border-left: 3px solid var(--blue);
                  border-radius: 12px; padding: 14px 16px 4px; margin: 6px 0 14px; }
.qform .dir-ver { padding-left: 22px; position: relative; color: var(--ink-2); }
.qform .dir-ver:not(:empty)::before { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px;
  background: var(--blue); -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/></svg>") center/contain no-repeat; }

/* Líneas: aspecto de hoja limpia */
.qform #lines th { background: #F7F9FB; font-size: 11.5px; letter-spacing: .5px; }
.qform #lines .c-pos { width: 46px; text-align: center; color: var(--gray); font-weight: 600; font-size: 12.5px; vertical-align: top; padding-top: 16px; }
.qform #lines td { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qform #lines tbody tr:hover td { background: #FBFCFD; }
.qform #lines input { background: transparent; border-color: transparent; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.qform #lines input:hover { border-bottom-color: #C5CFD8; }
.qform #lines input:focus { background: #fff; border-color: var(--blue); border-radius: 6px; }
.qform #lines .p-input { font-weight: 600; color: var(--navy); }
.qform #lines td.sub { font-weight: 700; color: var(--navy); padding-top: 17px; font-variant-numeric: tabular-nums; }
.qform #lines .num, .qform #lines input.num { font-variant-numeric: tabular-nums; }
.qform #lines .icon-btn.del { opacity: .35; transition: opacity .15s; margin-top: 4px; }
.qform #lines tr:hover .icon-btn.del, .qform #lines .icon-btn.del:focus { opacity: 1; color: var(--red); }
.qform #lines .hint { margin-top: 4px; }
.qform .m-input { background: #FBFCFD; }

.q-foot { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; padding: 16px 24px 22px; }
.q-add { border: 1.5px dashed #BFCAD5; background: transparent; color: var(--blue); font: 600 13.5px var(--font);
         padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.q-add span { font-size: 17px; line-height: 1; }
.q-add:hover { border-color: var(--blue); background: var(--blue-soft); }
.q-totals { background: #F7F9FB; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; min-width: 300px; }
.q-totals div { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.q-totals .grand { color: var(--navy); font-size: 19px; }

/* Barra fija con el total y guardar */
.q-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px;
         padding: 12px 28px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
         border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(15,58,90,.07); }
@media (min-width: 901px) { .q-bar { left: 236px; } }
.q-bar-tot { display: flex; align-items: baseline; gap: 10px; }
.q-bar-tot span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--gray); }
.q-bar-tot strong { font-size: 21px; color: var(--navy); font-variant-numeric: tabular-nums; }
.q-bar-btns { display: flex; gap: 10px; }
.q-bar .btn { padding: 10px 20px; }
@media (max-width: 900px) {
  .q-bar { bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 16px; }
  .qform { padding-bottom: 150px; }
  .qform #lines .c-pos { display: none; }
  .q-totals { min-width: 0; width: 100%; }
  .qform .card { padding: 18px 16px; }
  .qform .card.flush > h2 { padding: 18px 16px 0; }
  .q-foot { padding: 14px 16px 18px; }
}
@media (min-width: 901px) { .side-mini .q-bar { left: 72px; } }
body:has(.q-bar) .to-top { bottom: 92px; }
@media (max-width: 900px) { body:has(.q-bar) .to-top { bottom: calc(150px + env(safe-area-inset-bottom)); } }
.qform .card > h2 { flex-wrap: wrap; }
.q-bar-tot strong { white-space: nowrap; }
@media (max-width: 900px) {
  .q-chip { font-size: 11px; padding: 2px 8px; }
  .q-bar { gap: 10px; }
  .q-bar-tot { flex-direction: column; gap: 0; }
  .q-bar-tot strong { font-size: 18px; }
  .q-bar-btns .btn.ghost { display: none; }
  .q-bar .btn { padding: 10px 16px; font-size: 14px; }
}
.qform input:disabled { background: var(--bg); color: var(--ink-2); cursor: not-allowed; }
/* Panel */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-hola { font-size: 22px; margin-bottom: 2px; }
.card.flush > h2 a.small { font-size: 13px; font-weight: 600; }
.kpi .sub .delta { font-size: 12.5px; }
.panel-kpis .kpi .val { white-space: nowrap; font-size: clamp(19px, 1.55vw, 24px); }

/* ===== Tarifa Kemppi: todo en el naranja corporativo ===== */
.kemppi-mode { --blue: var(--kemppi); --blue-soft: #FFF1E5; --navy: #A84E00; }
.kemppi-mode .pcard::before { background: linear-gradient(90deg, #F57300, #FFA552); }
.kemppi-mode .act-btn, .kemppi-mode .share-btn.act-btn { background: #FFF1E5; color: #C25B00; }
.kemppi-mode .act-btn:hover, .kemppi-mode .share-btn.act-btn:hover { background: #FFE0C2; }
.kemppi-mode .btn:not(.ghost) { background: var(--kemppi); }
.kemppi-mode .btn:not(.ghost):hover { background: #DB6600; }
.kemppi-mode .btn.ghost { color: #C25B00; border-color: #FBC99B; }
.kemppi-mode input:focus, .kemppi-mode select:focus { border-color: var(--kemppi); box-shadow: 0 0 0 3px rgba(245,115,0,.18); }
.kemppi-mode .t.prod tbody tr:hover td { background: #FFF8F1; }
.kemppi-mode .kemppi { color: #C25B00; }
.kemppi-mode a { color: #C25B00; }

/* ===== Documentos en el móvil ===== */
@media (max-width: 600px) {
  /* La ventana no tapa la barra de estado: sube desde abajo como una hoja */
  .fdlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0;
          max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 28px); }
  .fdlg-body { padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .fdlg-bar { padding: 12px 16px; }
  /* Líneas como fichas */
  .fac-lin thead { display: none; }
  .fac-lin, .fac-lin tbody { display: block; width: 100%; }
  .fac-lin tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 10px; padding: 12px 14px; margin: 0 0 10px;
                border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
  .fac-lin td { display: block; padding: 0 !important; border: 0 !important; text-align: left; white-space: normal; }
  .fac-lin td.c-cod { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--gray); }
  .fac-lin td.c-cod:empty { display: none; }
  .fac-lin td.c-des { grid-column: 1 / -1; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
  .fac-lin td.c-n { font-variant-numeric: tabular-nums; font-size: 13.5px; }
  .fac-lin td.c-n::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
                            letter-spacing: .3px; color: var(--gray); }
  .fac-lin td.c-n:empty { display: none; }
  .fac-lin td.c-imp { text-align: right; font-weight: 700; color: var(--navy); }
  .fac-lin tr.fac-txt { background: #FAFBFC; box-shadow: none; }
  .fac-lin tr.fac-txt td.c-des { font-weight: 400; color: var(--gray); margin: 0; }
  .fac-lin td.empty { grid-column: 1 / -1; }
  .fdlg .table-wrap { overflow: visible; }
  .fac-head { gap: 10px; }
  .fac-tot { min-width: 0; width: 100%; }
}
.panel-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel-ag select { min-width: 220px; }
@media (max-width: 600px) { .panel-acts, .panel-ag, .panel-ag select { width: 100%; } }
.est-acts { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 0 6px; vertical-align: top; }
.est-acts .fac-del { margin-left: 0; }
.fac-pdf.est-btn { border: 0; cursor: pointer; font-family: inherit; }
.est-ok { background: var(--green-soft); color: var(--green-dark); }
.est-ok:hover { background: #E1F0CC; }
.est-no { background: var(--red-soft); color: var(--red); }
.est-no:hover { background: #F6D5D1; }
.est-back { background: var(--amber-soft); color: var(--amber); }
.est-mail { background: var(--blue); color: #fff; }
.est-mail:hover { background: #155A8B; }

/* Buscar producto en ventana emergente (PC) */
.q-add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pdlg { width: min(1000px, calc(100vw - 64px)); height: min(720px, calc(100vh - 64px)); }
.pdlg[open] { flex-direction: column; }
.pdlg-search { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pdlg-search input { flex: 1; font-size: 15px; padding: 10px 14px; }
.pdlg-body { flex: 1; overflow: auto; }
.pdlg-t thead th { position: sticky; top: 0; z-index: 1; background: #F7F9FB; }
.pdlg-t th:first-child, .pdlg-t td:first-child { padding-left: 18px; }
.pdlg-t th:last-child, .pdlg-t td:last-child { padding-right: 18px; }
.pdlg-t tbody tr[data-i] { cursor: pointer; }
.pdlg-t tbody tr[data-i]:hover td, .pdlg-t tbody tr.sel td { background: var(--blue-soft); }
.pdlg-t td { font-variant-numeric: tabular-nums; }
.pdlg-add { font-size: 12.5px; font-weight: 600; color: var(--blue); opacity: 0; }
.pdlg-t tr:hover .pdlg-add, .pdlg-t tr.sel .pdlg-add { opacity: 1; }
.pdlg-foot { padding: 10px 18px; border-top: 1px solid var(--line); }
#lines tr.flash td { background: var(--green-soft) !important; transition: background .3s; }
.pdlg-t th.num { text-align: right; }
/* Rentabilidad */
.t.rent tr.tot > td { background: #F6F8FA; border-top: 2px solid var(--line); }
.t.rent tr.on > td { background: var(--blue-soft); }
.rent-p { display: inline-block; min-width: 58px; padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 12.5px; }
.rent-p.good { background: var(--green-soft); color: var(--green-dark); }
.rent-p.mid { background: var(--amber-soft); color: var(--amber); }
.rent-p.low { background: var(--red-soft); color: var(--red); }
.t.rent th.num { text-align: right; }
.xls-bar { display: flex; justify-content: flex-end; margin: -6px 0 12px; }
.xls-btn { color: #1D6F42 !important; border-color: #BFDCCB !important; }
.xls-btn:hover { background: #EAF5EE !important; }
.t.comis tr.nocom td { color: var(--gray); }
.t.comis td, .t.comis th { padding-left: 8px; padding-right: 8px; }
.t.comis .c-cli { max-width: 170px; }
.t.comis .sub2 { display: block; font-size: 12px; color: var(--gray); }
.t.comis .rent-p { min-width: 0; }
/* Pie del menú: Odizweb Beta → manual */
.side-foot a.beta-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.side-foot a.beta-link:hover { text-decoration: none; }
.side-foot a.beta-link:hover .beta-mark { box-shadow: 0 0 0 3px rgba(139,197,61,.35); }
.beta-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 800 14px var(--font);
             background: linear-gradient(135deg, var(--green), var(--lime)); color: var(--navy); }
.beta-link .lbl { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; line-height: 1.2; }
.beta-link strong { font-weight: 700; color: #fff; font-size: 14px; }
.beta-link em { font-style: normal; font-weight: 700; color: var(--green); font-size: 14px; margin-left: -4px; }
.beta-tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 1px 6px; border-radius: 999px;
            background: var(--green); color: var(--navy); }
.beta-link small { flex-basis: 100%; font-size: 11.5px; color: rgba(255,255,255,.6); margin-top: 2px; }
.side-mini .side-foot a.beta-link { justify-content: center; }
.t.comis.mini { table-layout: fixed; }
.t.comis.mini th:nth-child(1) { width: 92px; } .t.comis.mini th:nth-child(4) { width: 110px; }
.t.comis.mini td { white-space: normal; overflow-wrap: anywhere; }
.t.comis.mini td.nowrap { white-space: nowrap; }
.t.comis.mini .c-cli { max-width: none; }
/* Dirección de entrega como fichas compactas */
.dir-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; max-height: 128px; overflow: auto; padding: 2px; }
.dir-opt { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer;
           font: 12.5px var(--font); color: var(--ink); display: flex; flex-direction: column; min-width: 0; outline: none; }
.dir-opt strong, .dir-opt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-opt strong { color: var(--navy); font-size: 12.5px; }
.dir-opt span { color: var(--gray); font-size: 11.5px; line-height: 1.3; }
.dir-opt:hover { border-color: #B9CAD9; }
.dir-opt:focus-visible { box-shadow: 0 0 0 2px rgba(26,106,163,.3); }
.dir-opt.on { border-color: var(--blue); background: var(--blue-soft); }
.dir-opt.on strong::before { content: "✓ "; color: var(--blue); }
.qform .dir-box { padding: 10px 14px 2px; }
.qform .dir-ver { padding-bottom: 6px; font-size: 12.5px; }
select.chg { box-shadow: 0 0 0 3px rgba(139,197,61,.45) !important; border-color: var(--green) !important; transition: box-shadow .3s; }
/* Ventas por agente: cabeceras a la derecha (como las cifras) a partir de la columna Agente / Cliente */
table[data-xls="Ranking"] thead th:nth-child(n+3),
table[data-xls="Por periodo"] thead th:nth-child(n+2),
table[data-xls="Mejores clientes"] thead th:nth-child(n+3) { text-align: right; }
table[data-xls="Ranking"] thead th.c-bar { text-align: left; }

/* Teclado abierto en móvil: las barras fijas de abajo se ocultan para no subirse encima del teclado */
@media (max-width: 900px) {
  body.kb-open .tabbar, body.kb-open .q-bar, body.kb-open .to-top, body.kb-open .install { display: none !important; }
}

/* Agencias de transporte en la lista de albaranes: un color por agencia */
.badge.ag0 { background: #E8F1FB; color: #1A5FA3; }
.badge.ag1 { background: #EAF6E3; color: #3F7A1C; }
.badge.ag2 { background: #FFF1E5; color: #B4541A; }
.badge.ag3 { background: #F2EAFB; color: #6B3FA6; }
.badge.ag4 { background: #E4F6F5; color: #16796F; }
.badge.ag5 { background: #FDEAF1; color: #A8325E; }
.badge.ag6 { background: #FFF7D9; color: #8A6A00; }
.badge.ag7 { background: #ECEFF3; color: #44515F; }
.pcat.ag-line { margin-top: 6px; }

/* Enlace al documento del lote en Google Drive */
.drive-lnk { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: #E8F1FB; color: #1A5FA3; text-decoration: none !important; vertical-align: 1px; }
.drive-lnk svg { fill: currentColor; }
.drive-lnk:hover { background: #D6E6F8; }
.pcat .drive-lnk { margin-left: 0; }

/* Trazabilidad presupuesto → pedido → albarán → factura */
.fac-pdf.trz-btn { border: 0; cursor: pointer; font-family: inherit; color: #1A5FA3; background: #E8F1FB; }
.fac-pdf.trz-btn:hover { background: #D6E6F8; }
.trz-intro { margin: 0 0 12px; }
.trz-flow { display: flex; gap: 10px; align-items: stretch; overflow-x: auto; padding-bottom: 4px; }
.trz-col { flex: 1 1 0; min-width: 150px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.trz-col + .trz-col { padding-left: 22px; }
.trz-col + .trz-col::before { content: "→"; position: absolute; left: 0; top: 2px; color: #8A96A3; font-size: 16px; }
.trz-col h4 { margin: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #5B6775; }
.trz-doc { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 9px 11px; border-radius: 10px; border: 1px solid #DCE3EA; background: #fff; color: inherit; }
button.trz-doc:hover { border-color: #1A5FA3; box-shadow: 0 2px 8px rgba(26, 95, 163, .12); }
.trz-doc.actual { cursor: default; border: 2px solid #7AB648; background: #F4FAEF; }
.trz-num { font-weight: 700; color: #123A61; }
.trz-num em { font-style: normal; font-size: 11px; font-weight: 600; color: #3F7A1C; margin-left: 4px; }
.trz-fec { font-size: 12px; color: #6B7785; }
.trz-tot { font-weight: 600; font-variant-numeric: tabular-nums; }
.trz-cli { margin: 12px 0 0; }
@media (max-width: 700px) {
  .trz-flow { flex-direction: column; overflow: visible; }
  .trz-col + .trz-col { padding-left: 0; padding-top: 18px; }
  .trz-col + .trz-col::before { content: "↓"; left: 4px; top: -2px; }
}

/* Productos en el PC: botones Lista / Fichas */
.vista-bar { display: flex; justify-content: flex-end; gap: 0; margin: 0 0 10px; }
.vista-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid #CFD8E2; background: #fff; color: #44515F; }
.vista-btn:first-child { border-radius: 8px 0 0 8px; }
.vista-btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.vista-btn svg { fill: currentColor; }
.vista-btn[aria-pressed="true"] { background: #1A5FA3; border-color: #1A5FA3; color: #fff; }
@media (min-width: 901px) {
  .prod-vista.vista-fichas .prod-lista { display: none !important; }
  .prod-vista.vista-fichas .prod-fichas { display: block; }
}
/* En las fichas del PC caben 3 recuadros de stock con su nombre completo */
@media (min-width: 901px) { .prod-vista .pstock { grid-template-columns: repeat(3, 1fr); } .prod-vista .pstock dt { letter-spacing: 0; } }

/* Clientes: botón al histórico de facturas */
.hist-btn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: #E8F1FB; color: #1A5FA3; text-decoration: none !important; white-space: nowrap; }
.hist-btn svg { fill: currentColor; }
.hist-btn:hover { background: #D6E6F8; }
.ccard .pcard-foot { display: flex; gap: 8px; }
.ccard .pcard-foot .btn { flex: 1; }

/* Histórico: pestañas Por cliente / Por producto */
.modo-bar { display: flex; margin: 0 0 14px; }
.modo-bar .vista-btn { text-decoration: none !important; }

/* Nuevo presupuesto: Dto. 2 opcional y descuento para todas las líneas */
#lines .c-disc2 { display: none; width: 90px; }
#lines.con-dto2 .c-disc2 { display: table-cell; }
.q-add.q-opt[aria-pressed="true"] { background: #E8F1FB; border-color: #1A5FA3; color: #1A5FA3; }
.ddlg { width: min(420px, calc(100vw - 32px)); }
.ddlg-body { padding: 16px 18px 4px; display: flex; flex-direction: column; gap: 10px; }
.ddlg-body label[for] { font-weight: 600; font-size: 13px; }
.ddlg-body #ddlg-v { font-size: 22px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; box-sizing: border-box; }
.ddlg-body p { margin: 0; }
.ddlg-err { color: var(--red); font-size: 13px; font-weight: 600; }
.ddlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
@keyframes odzflash { from { background: #FFF3C4; } to { background: transparent; } }
.flash { animation: odzflash 1.2s ease-out; border-radius: 4px; }
@media (max-width: 900px) {
  #lines.con-dto2 .c-disc2 { display: block; }
  #lines.con-dto2 tr { grid-template-columns: 1fr 1fr 1fr 1fr 40px; }
  #lines.con-dto2 td.c-del { grid-column: 5; }
}

/* Búsqueda de objetivo */
.gsdlg { width: min(460px, calc(100vw - 32px)); }
.gs-info { background: #F4F7FA; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.gs-modos { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.gsdlg.gs-linea .gs-t, .gsdlg.gs-total .gs-l { display: none; }
.gs-res { min-height: 42px; }
.gs-dto { font-size: 22px; font-weight: 700; color: var(--navy); }
.link-btn.gs-btn { margin-left: 12px; }

/* Productos bloqueados en FactuSOL: en gris, como allí */
tr.art-blq td, .pcard.art-blq .pname a, .pcard.art-blq .pp-main { color: #8A96A3; }
tr.art-blq td a { color: #7D8B99; }
.pcard.art-blq { background: #FAFBFC; }

/* Productos bloqueados en el presupuesto: otro color y no se pueden elegir */
.ac-item.ac-blq { background: #FDF1F0; cursor: not-allowed; }
.ac-item.ac-blq strong { color: #A33A2E; text-decoration: line-through; text-decoration-thickness: 1px; }
.ac-item.ac-blq span { color: #B42318; font-weight: 600; }
.pdlg-t tr.pdlg-blq td { color: #A33A2E; background: #FDF1F0; cursor: not-allowed; }
.pdlg-t tr.pdlg-blq td strong { text-decoration: line-through; }
.odz-aviso { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); z-index: 10000; max-width: calc(100vw - 32px);
  background: #B42318; color: #fff; font-weight: 600; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.odz-aviso.on { opacity: 1; transform: translate(-50%, 0); }

.hint.hint-blq { color: #B42318; font-weight: 600; }

/* Avisos de línea: descuento sin comisión y precio por debajo del coste */
.l-avisos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.l-avisos:empty { display: none; }
.l-av { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.l-av.amber { background: #FFF1D6; color: #8A5300; }
.l-av.red { background: #FEE4E2; color: #B42318; }
.cdlg .cdlg-bar { background: #B42318; }
.cdlg-msg { margin: 0; color: #B42318; }
.btn.cdlg-si { background: #B42318; border-color: #B42318; }

.l-av.blue { background: #E8F1FB; color: #1A5FA3; }

.trz-nota { display: inline-block; margin: 6px 4px 0 0; padding: 3px 9px; border-radius: 6px; background: #F4F6F8; }

/* Buscador de productos: disponible como etiqueta de color */
.ac-item .ac-disp { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 6px; font-style: normal; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.ac-item .ac-disp.si { background: #EAF6E3; color: #3F7A1C; }
.ac-item .ac-disp.no { background: #FEE4E2; color: #B42318; }
