/* ProducarMobile · panel Web */
:root {
  --green: #176b32; --green-2: #1f8a43; --green-soft: #e8f3ec; --green-line: #cfe3d6;
  --ink: #17221b; --ink-2: #4a5a50; --ink-3: #7b8a80; --bg: #f3f6f4; --card: #ffffff; --line: #e1e8e3;
  --amber: #b26a00; --amber-soft: #fff4e0; --red: #b42318; --red-soft: #fdecea; --blue: #1d5fa8; --blue-soft: #e8f0fa;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 40, 24, .06), 0 4px 16px rgba(16, 40, 24, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #0f3d1f; color: #d7e8dc; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.side .brand img { height: 68px; }  /* logo al doble de tamaño (pedido del cliente) */
.side nav a { display: block; color: #d7e8dc; padding: 9px 12px; border-radius: 8px; margin: 2px 0; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side nav a.on { background: #1f6b38; color: #fff; }
.side .who { border-top: 1px solid rgba(255,255,255,.12); margin-top: 18px; padding: 14px 10px 0; font-size: 12.5px; }
.side .who b { display: block; color: #fff; font-size: 13.5px; }
.side .who-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.side .who-actions form { margin: 0; }
.side .who-actions a { color: #d7e8dc; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 10px; }
.side .who-actions a:hover, .side .who-actions a.on { background: rgba(255,255,255,.1); text-decoration: none; }
.side .who-actions button { margin-top: 0 !important; }
.side .who button { margin-top: 10px; background: transparent; color: #d7e8dc; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; }
.main { padding: 22px 28px 48px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar { display: none; }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.kpi .delta { font-size: 12px; margin-top: 2px; }
.up { color: var(--green-2); } .down { color: var(--red); }

/* tables */
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafcfb; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; } .t tr.click:hover td { background: #f7faf8; }
.table-wrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef2ef; color: var(--ink-2); white-space: nowrap; }
.b-ok { background: var(--green-soft); color: var(--green); } .b-warn { background: var(--amber-soft); color: var(--amber); }
.b-err { background: var(--red-soft); color: var(--red); } .b-info { background: var(--blue-soft); color: var(--blue); }
.b-fact { background: var(--green); color: #fff; }  /* pedido migrado que ya tiene factura en Waldbott */

/* forms */
label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cdd8d0; border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-line); border-color: var(--green); }
input[type=checkbox], input[type=radio] { width: auto; }
.field { margin-bottom: 12px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font: 600 13.5px var(--font); cursor: pointer; text-decoration: none !important; line-height: 1.2; }
.btn-primary { background: var(--green); color: #fff; } .btn-primary:hover { background: #12592a; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #cdd8d0; } .btn-ghost:hover { background: #f4f7f5; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0c6c2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; background: #fff; border: 1px solid #cdd8d0; border-radius: 8px; overflow: hidden; }
.seg a { padding: 7px 12px; color: var(--ink-2); font-weight: 600; font-size: 12.5px; border-right: 1px solid #e3eae5; }
.seg a:last-child { border-right: 0; } .seg a.on { background: var(--green); color: #fff; } .seg a:hover { text-decoration: none; }

/* alerts */
.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.alert.ok { background: var(--green-soft); border-color: var(--green-line); color: #0f4d24; }
.alert.warn { background: var(--amber-soft); border-color: #f1d9ad; color: #7a4a00; }
.alert.error { background: var(--red-soft); border-color: #f3c9c4; color: #8a1c12; }

/* specific */
.suggest { position: relative; } .suggest .box { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.suggest .box button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 9px 12px; font: inherit; cursor: pointer; }
.suggest .box button:hover { background: var(--green-soft); }
.map { height: 420px; border-radius: 10px; border: 1px solid var(--line); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 34px; background: var(--green); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .bar span { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; white-space: nowrap; }
.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #eef2ef; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 18px; }
.facts div span { display: block; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.facts div b { font-weight: 600; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(720px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 30, 16, .45); }
dialog .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-body { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.empty { text-align: center; color: var(--ink-3); padding: 36px 12px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #0f3d1f url("/static/img/login_bg_food.png") center/cover; position: relative; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(15,61,31,.75), rgba(15,61,31,.35)); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form .card { width: min(380px, 100%); padding: 28px; }
.login-form img { height: 46px; margin-bottom: 18px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: 0 30% 0 0; z-index: 50; height: 100vh; }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: #0f3d1f; position: sticky; top: 0; z-index: 40; }
  .topbar img { height: 28px; } .topbar button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; }
  .main { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; }
  .hide-sm { display: none; }
}
@media print { .side, .topbar, .head .actions, .no-print { display: none !important; } .shell { display: block; } .card { box-shadow: none; border: 0; } }
input.upper { text-transform: uppercase; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb-left { float: left; margin-right: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: #1e8e3e; } .dot-warn { background: #c77c02; } .dot-err { background: #c62828; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f6faf7; }

/* mapas: leyenda de cobertura */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.35); }
.summary-line { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.summary-line b { color: var(--ink); }
.map-pick { margin-top: 12px; height: 340px; }

/* R95 · reporte de facturas entregadas (mismo diseño que el Excel y el PDF) */
.rep .rep-head { padding: 16px 18px 6px; text-align: center; border-top: 3px solid var(--green); }
.rep .rep-head h2 { margin: 0 0 4px; font-size: 19px; }
.rep .rep-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.rep-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rep-t th { background: var(--green); color: #fff; text-align: left; padding: 7px 8px; font-size: 12px; }
.rep-t td { border: 1px solid #8caf96; padding: 6px 8px; vertical-align: top; }
.rep-t td.r { text-align: right; white-space: nowrap; }
.rep-t tr.nc td { background: #fff7e6; font-size: 12px; }
.rep-t tr.nc td.l { color: #8a4b00; font-weight: 700; }
.rep-t tr.com td { background: #f4f7f5; font-size: 12px; font-style: italic; color: #333; }
.rep-tag { display: inline-block; padding: 1px 6px; border-radius: 8px; background: #fde7c7; color: #8a4b00; font-weight: 700; font-size: 11px; }
.rep-t tr.rej td { background: #fdecec; font-size: 12px; font-weight: 600; color: #b42318; }
.rep-rej { display: inline-block; padding: 1px 6px; border-radius: 8px; background: #fdecec; color: #b42318; font-weight: 700; font-size: 11px; }
.rep-tot { display: flex; justify-content: flex-end; gap: 30px; font-size: 15px; padding: 14px 18px; flex-wrap: wrap; }
.rep-tot b { color: var(--green); font-size: 17px; }
.rep-pay { margin: 0 18px 16px auto; border-collapse: collapse; min-width: 340px; font-size: 14px; }
.rep-pay td { padding: 5px 4px; border-bottom: 1px solid #e3ebe5; }
.rep-pay td.r { text-align: right; white-space: nowrap; padding-left: 24px; }
.rep-pay tr.rep-pay-total td { border-top: 2px solid var(--green); border-bottom: 0; font-weight: 800; font-size: 17px; color: var(--green); padding-top: 8px; }
.assign-ok { color: var(--green); font-size: 11.5px; font-weight: 600; }
.assign-err { color: var(--red); font-size: 11.5px; font-weight: 600; }
/* C24: listados agrupados y selector de varios vendedores */
.multi-pick { position: relative; }
.multi-pick summary { list-style: none; cursor: pointer; min-width: 220px; padding: 9px 34px 9px 12px; border: 1px solid #cfd8d2; border-radius: 8px; background: #fff; }
.multi-pick summary::-webkit-details-marker { display: none; }
.multi-pick summary::after { content: "▾"; position: absolute; right: 12px; top: 9px; color: #6b7a70; }
.multi-pick-box { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 300px; max-height: 320px; overflow: auto; background: #fff; border: 1px solid #cfd8d2; border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); padding: 8px; }
.multi-pick-box label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; font-weight: 500; margin: 0; white-space: nowrap; }
.multi-pick-box label:hover { background: #f0f6f2; }
.multi-pick-all { border-bottom: 1px solid #e3ebe5; margin-bottom: 4px !important; font-weight: 700 !important; }
.rep-t.lst tr.lst-grp td { background: #e7f2ea; color: var(--green); font-weight: 800; font-size: 14px; }
.rep-t.lst tr.lst-sub td { background: #f4f7f5; font-weight: 700; }
.rep-t.lst tr.lst-tot td { border-top: 2px solid var(--green); font-weight: 800; color: var(--green); font-size: 14px; }
.rep-t.lst td.neg { color: #b42318; }
/* C27: ingreso al panel: logo más grande, título más chico, sin subtítulo */
.login-form img.login-logo { display: block; height: auto; width: min(260px, 100%); margin: 4px auto 14px; }
.login-form .login-title { font-size: 1.05rem; text-align: center; margin: 0 0 18px; color: #176b32; letter-spacing: .02em; }
/* C30: cuadros resaltados del inicio (comisión y kilos) */
.kpi.kpi-hl { border: 2px solid var(--green); background: linear-gradient(180deg, rgba(23,107,50,.09), rgba(23,107,50,.02)); }
.kpi.kpi-hl .value { color: var(--green); }
.kpi-delta { font-weight: 800; margin-left: 4px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: #b42318; }
/* C38: tortas del inicio (mismas que en la app) */
.pm-donuts{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;margin-top:12px}
.pm-donut-card{margin:0}.pm-donut-card h3{font-size:.98rem;margin:0 0 12px}
.pm-donut-wrap{display:grid;grid-template-columns:118px 1fr;gap:14px;align-items:center}
.pm-donut{width:118px;height:118px;border-radius:50%;display:grid;place-items:center;position:relative}
.pm-donut:after{content:'';position:absolute;width:68px;height:68px;border-radius:50%;background:#fff}
.pm-donut span{position:relative;z-index:1;font-size:13px;font-weight:800}
.pm-donut-legend{display:grid;gap:8px}.pm-donut-legend>div{display:grid;grid-template-columns:12px 1fr auto;gap:7px;align-items:center;font-size:13px}
.pm-donut-legend i{width:10px;height:10px;border-radius:50%}
/* C41: modo demo (cualquier marca) */
.demo-ribbon { position: sticky; top: 0; z-index: 60; background: repeating-linear-gradient(135deg, #ffcf3f 0 14px, #ffc21a 14px 28px); color: #3a2a00; font-weight: 800; font-size: 12.5px; letter-spacing: .04em; text-align: center; padding: 5px 10px; }
.demo-box { margin-top: 18px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--bg); font-size: 13px; }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.demo-user { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; cursor: pointer; font: inherit; }
.demo-user b { display: block; color: var(--green); font-size: 13.5px; } .demo-user span { color: var(--ink-3); font-size: 12px; }
.demo-user:hover { border-color: var(--green); }
.login-tagline { margin: -8px 0 18px; color: var(--ink-2); }
/* C42: columnas ordenables */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: " ↕"; color: var(--ink-3); font-size: 11px; opacity: .55; }
th.sortable[data-dir="asc"]::after { content: " ▲"; opacity: 1; color: var(--green); }
th.sortable[data-dir="desc"]::after { content: " ▼"; opacity: 1; color: var(--green); }
/* C44: permisos del dashboard por app / portal */
.dash-perm{border-collapse:collapse;width:100%;max-width:560px;margin-top:8px}
.dash-perm th{font-size:12px;color:var(--muted,#6b7a72);font-weight:700;text-align:center;padding:4px 10px}
.dash-perm td{padding:5px 10px;border-bottom:1px solid var(--line,#e3e9e5);font-size:14px}
.dash-perm td:nth-child(2),.dash-perm td:nth-child(3){text-align:center;width:72px}
.dash-perm .dash-perm-sec td{font-weight:800;font-size:12px;text-transform:uppercase;letter-spacing:.04em;padding-top:12px;border-bottom:0}
.dash-perm input{width:18px;height:18px}
/* C49: títulos de columnas numéricas alineados a la derecha, como sus valores */
.rep-t th.r, table.t th.right { text-align: right; }
/* C50: subtotal de cada tipo de NC en el reporte de entregas */
.rep-t tr.nc.ncsum td { font-weight: 800; border-top: 1.5px solid #e0b46a; }

/* C51: animación de carga del portal (cuadritos), al cambiar de página, consultar o guardar */
.pm-loading{position:fixed;inset:0;z-index:9000;display:flex;align-items:center;justify-content:center;background:rgba(10,30,18,.28);cursor:progress}
.pm-loading[hidden]{display:none}
.pm-loading-card{display:flex;align-items:center;gap:14px;padding:16px 22px;border-radius:14px;background:#fff;color:var(--ink);font-weight:700;box-shadow:0 12px 40px rgba(0,0,0,.22)}
.pm-loader{display:grid;grid-template-columns:repeat(2,13px);gap:5px}
.pm-loader i{display:block;width:13px;height:13px;border-radius:3px;background:var(--green-2);animation:pm-sq 1.2s ease-in-out infinite}
.pm-loader i:nth-child(2){animation-delay:.3s}.pm-loader i:nth-child(4){animation-delay:.6s}.pm-loader i:nth-child(3){animation-delay:.9s}
@keyframes pm-sq{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.45);opacity:.35}}

/* C54: píldora deslizante (pestañas .seg y menú lateral) */
.pm-pill-host { position: relative; isolation: isolate; }
.pm-pill { position: absolute; z-index: 0; border-radius: inherit; background: var(--green); pointer-events: none; }
.pm-pill-item { position: relative; z-index: 1; }
.seg.pm-pill-host { border-radius: 8px; }
.seg.pm-pill-host .pm-pill { border-radius: 7px; }
.seg.pm-pill-host a.on { background: transparent; }
.seg.pm-pill-host a { border-right-color: transparent; transition: color .25s; }
.side nav.pm-pill-host .pm-pill { background: #1f6b38; border-radius: 8px; }
.side nav.pm-pill-host a.on { background: transparent; }

/* C55: copia de las etiquetas en blanco, recortada con la forma de la marca */
.pm-pill-ink { position: absolute; z-index: 2; margin: 0; box-sizing: border-box; pointer-events: none; background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.pm-pill-ink, .pm-pill-ink * { color: var(--pm-ink, #fff) !important; background: transparent !important; border-color: transparent !important; }
.pm-pill-ink .pm-pill { display: none; }

/* C55: mientras carga la página, la opción elegida no se pinta sola (la pinta la marca al iniciar), así no aparece
   un instante en su lugar final y después "vuelve" a la posición donde iba el deslizamiento. */
html.pm-js .seg:not(.pm-pill-host) a.on { background: transparent; color: inherit; }
html.pm-js .side nav:not(.pm-pill-host) a.on { background: transparent; }
/* La etiqueta elegida toma el color normal; el blanco lo pone la copia recortada solo donde está la marca
   (si no, mientras la marca todavía viene en camino, la palabra blanca queda invisible sobre fondo blanco). */


/* C56: logo de Producar más grande en el menú. La imagen trae mucho margen transparente arriba y abajo
   (el dibujo ocupa 372×138 de 378×268): se recorta ese margen y el logo ocupa el ancho del menú. */
.side .brand-producar { justify-content: center; padding: 6px 4px 20px; }
.side .brand-producar img { width: 100%; max-width: 196px; height: 72px; object-fit: cover; object-position: center; }

/* C56: sin copia de etiquetas; la opción elegida es blanca cuando la marca está quieta sobre ella */
.seg.pm-pill-host a.on { color: #fff; transition: color .12s; }
.seg.pm-pill-host.pm-pill-moving a.on { color: var(--pm-rest, var(--ink-2)); }
