/* ===== Repuestos ZA · Costos proveedor ===== */
:root {
  --navy: #0f2a4a;
  --navy-2: #1b3d66;
  --navy-3: #24507f;
  --orange: #f26b1d;
  --orange-2: #ff8a3d;
  --orange-bg: #fff1e8;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #16202e;
  --muted: #6b7686;
  --line: #e6eaf0;
  --line-2: #eef1f5;
  --good: #15803d;
  --good-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info-bg: #e7efff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 42, 74, .05), 0 4px 14px rgba(15, 42, 74, .05);
  --sidebar: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.small { font-size: 12.5px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.link { background: none; border: 0; color: var(--navy-3); cursor: pointer; font-weight: 600; padding: 0; font-size: 13px; }

/* ----- Botones y campos ----- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #c9d2de; background: #fafbfd; }
.btn.primary { background: linear-gradient(180deg, var(--orange-2), var(--orange)); border-color: var(--orange); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(242, 107, 29, .25); }
.btn.primary:hover { filter: brightness(1.04); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.accent { border-color: var(--orange); color: var(--orange); font-weight: 600; }
.quick .btn.accent.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time], select {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fff; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(36, 80, 127, .12); }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.check.big { font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 12px; }
.chip-check { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; }
.chip-check:has(input:checked) { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip-check input { accent-color: var(--orange); }

/* ----- Login ----- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% 0%, var(--navy-3), var(--navy) 60%); }
.login-card { background: #fff; width: 100%; max-width: 380px; border-radius: 18px; padding: 30px; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.login-card p { margin: 0 0 18px; color: var(--muted); }
.login-card label { display: block; font-weight: 600; margin: 12px 0 4px; }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 11px; }
.login-card .login-hint { margin: 14px 0 0; font-size: 12px; text-align: center; }
.error { color: var(--bad); margin-top: 10px; min-height: 20px; }

/* ----- Estructura ----- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: linear-gradient(180deg, var(--navy) 0%, #0b2140 100%); color: #d6e0ee; display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--orange-2), var(--orange)); color: #fff; font-weight: 800; display: grid; place-items: center; letter-spacing: .5px; box-shadow: 0 6px 16px rgba(242, 107, 29, .35); }
.side-title { color: #fff; font-weight: 700; font-size: 15px; }
.side-title span { color: var(--orange-2); }
.side-sub { font-size: 12px; color: #9fb2c9; }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.side-group { text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; color: #7f96b2; margin: 16px 10px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #d6e0ee; font-weight: 500; margin-bottom: 2px; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side-nav a.active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.side-nav .ico { width: 20px; text-align: center; opacity: .85; }
.badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 8px; font-size: 12.5px; }
.side-status { display: flex; align-items: center; gap: 8px; color: #c3d1e2; }
.side-user { display: flex; justify-content: space-between; align-items: center; color: #9fb2c9; }
.side-user .link { color: var(--orange-2); }
.backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(244, 246, 250, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar > div:not(.spacer):not(.top-status) { flex: 1 1 auto; min-width: 0; }
.topbar h1 { margin: 0; font-size: 20px; color: var(--navy); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 0 0 0; }
.top-status { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; color: var(--muted); white-space: nowrap; flex: 0 1 auto; min-width: 0; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.top-status .dot { flex: none; }
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.content { padding: 22px 28px 40px; max-width: 1500px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.toolbar { padding: 12px 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { flex: 1 1 260px; }

/* ----- Estado de ejecución ----- */
.run-bar { padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.run-bar .state { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); font-size: 15px; }
.run-bar .meta { color: var(--muted); font-size: 13px; }
.run-bar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; flex: none; display: inline-block; }
.dot.running { background: var(--orange); box-shadow: 0 0 0 4px rgba(242, 107, 29, .18); animation: pulse 1.2s infinite; }
.dot.done { background: #22c55e; }
.dot.failed { background: #ef4444; }
.dot.cancelled { background: #f59e0b; }
@keyframes pulse { 50% { opacity: .4; } }
.progress { flex-basis: 100%; height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); width: 0; transition: width .4s; }
.workers-live { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.worker-chip { border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; background: #fafbfd; font-size: 12.5px; }
.worker-chip b { color: var(--navy); }
.worker-chip .bar { height: 5px; background: #e5e7eb; border-radius: 99px; margin: 6px 0 4px; overflow: hidden; }
.worker-chip .bar > div { height: 100%; background: var(--orange); }

/* ----- Indicadores ----- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line); }
.kpi:hover { transform: translateY(-1px); border-color: #cfd8e3; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 800; color: var(--navy); margin-top: 2px; letter-spacing: -.02em; }
.kpi .hint { color: var(--muted); font-size: 12px; }
.kpi.bad::before { background: #ef4444; } .kpi.bad .value { color: var(--bad); }
.kpi.warn::before { background: #f59e0b; } .kpi.warn .value { color: var(--warn); }
.kpi.good::before { background: #22c55e; } .kpi.good .value { color: var(--good); }

/* ----- Resumen ----- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-grid > .card { padding: 16px 18px; }
.span-2 { grid-column: span 2; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini-kpis div { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.mini-kpis b { display: block; font-size: 19px; color: var(--navy); }
.dash-pickup .big { font-size: 30px; font-weight: 800; color: var(--orange); line-height: 1.1; }
.dash-pickup .row { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin-top: 4px; }
.chart svg { width: 100%; height: 180px; display: block; }
.chart .bar { fill: var(--navy-3); transition: fill .15s; }
.chart .bar:hover { fill: var(--orange); }
.chart .axis { font-size: 10px; fill: var(--muted); }
.chart .grid { stroke: var(--line-2); }
.top-list { display: grid; gap: 6px; }
.top-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) 120px 60px; gap: 10px; align-items: center; font-size: 13px; }
.top-item .rank { width: 24px; height: 24px; border-radius: 8px; background: var(--info-bg); color: var(--navy); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.top-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-item .meter { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.top-item .meter div { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); }

/* ----- Tablas ----- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; z-index: 1; }
table.data tbody tr:hover > td { background: #fbfcfe; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.prod-name { font-weight: 600; }
.prod-name a { color: var(--text); }
.strike { text-decoration: line-through; color: var(--muted); font-size: 12px; }
.offer { color: var(--bad); font-weight: 700; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: var(--good-bg); color: var(--good); }
.pill.not_found { background: #f1f5f9; color: var(--muted); }
.pill.ambiguous { background: var(--warn-bg); color: var(--warn); }
.pill.error, .pill.removed { background: var(--bad-bg); color: var(--bad); }
.pill.pending { background: var(--info-bg); color: var(--navy-3); }
.tag { display: inline-block; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; }
.tag.info { background: var(--info-bg); color: var(--navy); }
.margin { font-weight: 700; }
.margin.neg { color: var(--bad); }
.margin.low { color: var(--warn); }
.margin.mid { color: var(--navy-3); }
.margin.high { color: var(--good); }
.below { color: var(--bad); font-weight: 600; }
.candidates { margin-top: 6px; display: grid; gap: 4px; }
.candidates button { text-align: left; }
.multiple { margin-top: 6px; padding: 7px 9px; border: 1px dashed #c7d2fe; border-radius: 10px; background: #f8faff; display: grid; gap: 3px; }
.multiple select { padding: 3px 6px; font-size: 12.5px; max-width: 240px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.order-lines > td { background: #f8fafc; }
.order-lines table { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0 8px; }

/* ----- Pedidos ----- */
.retiro-card { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; padding: 16px 18px; margin-bottom: 10px; border-left: 4px solid var(--orange); background: linear-gradient(90deg, var(--orange-bg), #fff 60%); }
.retiro-card .rc-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 22px; flex: none; }
.retiro-card .rc-body { flex: 1 1 320px; min-width: 0; }
.retiro-card .rc-tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: .05em; }
.retiro-card h3 { margin: 2px 0 4px; color: var(--navy); font-size: 18px; text-transform: none; }
.retiro-card .rc-window { color: var(--text); font-size: 13.5px; }
.retiro-card .rc-window b { color: var(--navy); }
.retiro-card .rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.totals-bar { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; padding: 12px 18px; margin-bottom: 10px; }
.totals-bar div { display: grid; }
.totals-bar span { font-size: 12px; color: var(--muted); }
.totals-bar b { font-size: 19px; color: var(--navy); font-variant-numeric: tabular-nums; }
.totals-bar .grand b { color: var(--orange); }
.totals-bar .label { font-weight: 700; color: var(--navy); font-size: 13px; align-self: center; }
.iva-box { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; padding: 12px 18px; margin-bottom: 10px; border-left: 4px solid var(--navy-3); }
.iva-box:empty { display: none; }
.iva-box div { display: grid; }
.iva-box span { font-size: 12px; color: var(--muted); }
.iva-box b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.iva-box .grand b { color: var(--orange); }
.iva-box .label { font-weight: 700; color: var(--navy); font-size: 13px; align-self: center; }
.iva-cell { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.iva-cell span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; margin-right: 3px; }
.iva-cell .iva-pay b { color: var(--navy); font-size: 13.5px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick .btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg { display: inline-flex; background: #e9edf3; border-radius: 10px; padding: 3px; margin: 2px 0 8px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
#o-pager-top { justify-content: flex-start; padding: 0 0 8px; }
.page > .run-bar { margin-bottom: 14px; }

/* ----- Retiro ----- */
.fuel-alert { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; font-weight: 600; }
.supplier { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; display: grid; gap: 12px; }
.supplier.despacho .route-only { display: none; }
.supplier .head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.supplier .head h4 { margin: 0; color: var(--navy); font-size: 16px; }
.hours { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 6px; }
.hours label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.tramos td input { width: 100%; padding: 5px 7px; }
.tramos td input[type=number] { width: 90px; }
.tramos tfoot td { font-weight: 700; background: #f8fafc; }
.scen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.scen div { background: #f8fafc; border-radius: 12px; padding: 10px 12px; border: 2px solid transparent; }
.scen div.sel { border-color: var(--orange); background: var(--orange-bg); }
.scen b { display: block; font-size: 20px; color: var(--navy); }
.plan td, .plan th { padding: 7px 9px; }
.tarifa { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.tarifa.tbfp { background: var(--good-bg); color: var(--good); }
.tarifa.tbp { background: var(--warn-bg); color: var(--warn); }
.tarifa.ts { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 860px) { .hours { grid-template-columns: repeat(2, 1fr); } .scen { grid-template-columns: 1fr; } }
#lk-codes { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 13px ui-monospace, Consolas, monospace; resize: vertical; }
.missing-list { max-height: 210px; overflow: auto; display: grid; gap: 4px; }
.missing-item { display: grid; grid-template-columns: 130px minmax(0, 1fr) 70px; gap: 8px; font-size: 12.5px; padding: 5px 8px; border-radius: 8px; background: #f8fafc; }
.missing-item .d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.lk-img { width: 64px; height: 48px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
#buy-items { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 13px ui-monospace, Consolas, monospace; }
.mode-banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.mode-banner.sim { background: var(--info-bg); color: var(--navy); }
.mode-banner.real { background: var(--bad-bg); color: var(--bad); }
.pill.simulado { background: var(--info-bg); color: var(--navy-3); }
.pill.enviado { background: var(--good-bg); color: var(--good); }
.pill.aprobacion, .pill.revisando, .pill.ejecutando { background: var(--warn-bg); color: var(--warn); }
.pill.rechazado, .pill.cancelado, .pill.manual { background: #f1f5f9; color: var(--muted); }
.buy-detail { font-size: 12.5px; color: var(--muted); }
.buy-detail li { margin: 2px 0; }
.origen { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-left: 4px; }
.origen.automatico { background: #ede9fe; color: #6d28d9; }
.canal { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-left: 4px; background: #fff7ed; color: #c2410c; }
.origen.manual { background: #f1f5f9; color: var(--muted); }
.buy-search { position: relative; }
.buy-search input { width: 100%; }
.bc-results { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 42, 74, .15); max-height: 360px; overflow: auto; }
.bc-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; align-items: center; }
.bc-item:hover { background: #f8fafc; }
.bc-item .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-item .m { font-size: 12px; color: var(--muted); }
.bc-item.disabled { opacity: .55; cursor: not-allowed; }
.bc-live .n { color: var(--navy-3); }
.bc-portal { cursor: default; background: #f8fffb; }
.bc-table td, .bc-table th { padding: 7px 9px; }
.bc-table input[type=number] { width: 80px; text-align: right; }
.bc-table tfoot td { font-weight: 700; background: #f8fafc; }
.pickup { padding: 18px 20px; }
.pickup h3 { margin: 0; color: var(--navy); font-size: 17px; }
.pickup-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pk-dispatch { padding: 10px 12px; background: var(--orange-bg); border: 1px solid #ffd9c2; border-radius: 12px; margin-bottom: 14px; }
.pk-group { margin-top: 14px; }
.pk-group h4 { margin: 0 0 8px; font-size: 14px; }
.pk-group.must h4 { color: var(--orange); }
.pk-group.optional h4 { color: var(--muted); }
.pk-order { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.pk-order:hover { border-color: #cfd8e3; }
.pk-order.done { opacity: .5; }
.pk-order .resumen { flex-basis: 100%; font-size: 12.5px; color: var(--muted); }

/* ----- Ejecuciones ----- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.sticky { position: sticky; top: 84px; align-self: start; }
.log { background: #0b1220; color: #d1d5db; border-radius: var(--radius); padding: 14px; font: 12.5px/1.55 ui-monospace, Consolas, monospace; max-height: 70vh; overflow: auto; white-space: pre-wrap; }
.log .warn { color: #fbbf24; }
.log .error { color: #f87171; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow); }
.day-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 11px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.day-head .date { font-weight: 700; color: var(--navy); text-transform: capitalize; }
.day-head .totals { color: var(--muted); font-size: 12.5px; }
.run { padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.run:last-child { border-bottom: 0; }
.run:hover, .run.selected { background: #fbfcfe; }
.run.selected { box-shadow: inset 3px 0 0 var(--orange); }
.run-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.run-head .title { font-weight: 600; }
.run table { margin-top: 8px; font-size: 12.5px; }
.run th, .run td { padding: 5px 8px; }
.worker-sum td { background: #fbfcfe; }
.total-row td { font-weight: 700; border-top: 2px solid var(--line); }
.mini-bar { width: 80px; height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mini-bar > div { height: 100%; background: var(--orange); }
.mini-bar.done > div { background: #22c55e; }

/* ----- Configuración y costos ----- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-card { padding: 18px 20px; }
.settings-card h3 { margin: 0 0 12px; color: var(--navy); font-size: 15px; }
.settings-card p.small { margin-top: -6px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; align-content: start; }
.field-label { font-weight: 600; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--info-bg); color: var(--navy); border-radius: 99px; padding: 4px 6px 4px 12px; font-weight: 600; }
.chip button { border: 0; background: rgba(15, 42, 74, .12); color: var(--navy); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; cursor: pointer; user-select: none; font-weight: 500; }
.days label.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.days input { display: none; }
.estimate { background: #f8fafc; border: 1px dashed #d5dce6; border-radius: 12px; padding: 11px 13px; color: var(--muted); font-size: 13px; }
.estimate:empty { display: none; }
.estimate-card, .save-bar { padding: 14px 18px; margin-top: 14px; }
.save-bar { position: sticky; bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; box-shadow: 0 -6px 24px rgba(15, 42, 74, .08), var(--shadow); }
#page-settings { padding-bottom: 20px; }
.accounts { display: grid; gap: 12px; }
.account { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.account h4 { margin: 0; color: var(--navy); }
.account input { width: 100%; }
.account .msg { min-height: 18px; font-size: 12.5px; }
.account .msg.ok { color: var(--good); }
.account .msg.bad { color: var(--bad); }
.holidays { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-top: 10px; }
.holiday { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; font-size: 13px; }
.holiday.off { opacity: .5; text-decoration: line-through; }
.holiday .date { font-weight: 700; color: var(--navy); white-space: nowrap; }
.supply { display: grid; grid-template-columns: minmax(140px, 1.2fr) 110px 160px minmax(180px, 2fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.supply label { display: grid; gap: 4px; }
.supply select[multiple] { min-height: 74px; }
.supply .sp-del { grid-column: -2; justify-self: end; align-self: end; width: 34px; height: 36px; padding: 0; font-size: 18px; line-height: 1; }
.supply label.hidden + .sp-del, .supply .sp-del { margin-bottom: 1px; }
.value-big { font-size: 24px; font-weight: 800; color: var(--orange); }

/* ----- Diálogo ----- */
dialog { border: 0; border-radius: 16px; padding: 0; max-width: 540px; width: calc(100% - 32px); box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(11, 18, 32, .45); }
dialog .dlg-body { padding: 20px; }
dialog h3 { margin: 0 0 10px; color: var(--navy); }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .top-status { display: none; }
  .dash-grid, .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(11, 18, 32, .45); z-index: 25; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .top-status { display: none; }
  .supply { grid-template-columns: 1fr 1fr; }
  .top-item { grid-template-columns: 24px minmax(0, 1fr) 50px; }
  .top-item .meter { display: none; }
}

/* ----- Tabla de productos: filas compactas ----- */
#page-products table.data { min-width: 1150px; }
#page-products td { font-size: 13px; }
#page-products td:nth-child(1) { min-width: 200px; max-width: 240px; }
#page-products td:nth-child(2) { min-width: 210px; max-width: 250px; }
#page-products .prod-name a, #page-products .prod-name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-transform: none; }
#page-products td:last-child { white-space: nowrap; }
#page-products td:last-child .btn { margin: 0 0 4px 4px; }

/* Costo en la tabla de productos */
.cost-real { font-size: 14px; }
.cost-real span, .cost-line span:first-child { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-right: 2px; }
.cost-real b { color: var(--navy); }
.cost-line { font-size: 12.5px; color: var(--muted); }
.cost-line .offer { font-size: 12.5px; }

/* Márgenes con filas rotuladas */
.m-row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; line-height: 1.6; }
.m-row > span:first-child { width: 72px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.m-row b { min-width: 52px; text-align: right; font-size: 13px; }

.real-margin b { font-size: 18px; }
.real-margin .small { white-space: nowrap; }

#page-products th, #page-products td { padding-left: 9px; padding-right: 9px; }
.row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; width: 190px; }
.row-actions .btn { margin: 0 !important; padding: 4px 6px; font-size: 12px; width: 100%; }

.dot.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 2px; animation: livepulse 2s infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
tr.muted td { opacity: .5; }
.notice { background: #fff7ed; border-color: #fed7aa; }
.ml-card { padding: 18px 20px; }
.ml-notice { background: #fff7ed; border: 1px solid #fed7aa; margin-bottom: 14px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--navy-3); }
.sort-ico { font-size: 10px; }
.pill.bad { background: #fee2e2; color: #b91c1c; }
.quick .count { opacity: .75; font-weight: 600; }
tr.pv-open td { background: #fff7f7; }
.pill.doc-factura { background: #dbeafe; color: #1d4ed8; }
dialog.wide { max-width: 880px; }
.doc-cli { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.doc-ml { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
@media (max-width: 700px) { .doc-cli { grid-template-columns: 1fr; } }
