:root {
  color-scheme: dark;
  --jr-red: #e3352f;
  --jr-red-dark: #b61f1b;
  --jr-red-soft: rgba(227, 53, 47, .14);
  --bg: #121214;
  --bg-raised: #1a1a1d;
  --bg-input: #0e0e10;
  --border: #2c2c30;
  --border-hover: #3d3d42;
  --text: #f2f2f0;
  --text-muted: #a3a3a8;
  --text-faint: #6f6f76;
  --ok-bg: #142e1f;
  --ok-border: #2e6b45;
  --ok-text: #8fd6a8;
  --fail-bg: #331414;
  --fail-border: #8a2c26;
  --fail-text: #f4a9a4;
  --radius: 10px;
  --radius-sm: 6px;
  --focus-ring: 0 0 0 3px var(--jr-red-soft);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

/* ---------- Layout con sidebar ---------- */

.appShell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 18px 22px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar .brand .brandName {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar .brand img { display: block; flex-shrink: 0; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 2px;
  flex: 1;
}

.sidebar .navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar .navItem .icon { font-size: 1rem; width: 1.2em; text-align: center; }
.sidebar .navItem:hover { background: var(--bg-input); color: var(--text); }
.sidebar .navItem.active { background: var(--jr-red-soft); color: var(--text); }
.sidebar .navItem.active .icon { filter: none; }

.sidebar .navGroup { display: flex; flex-direction: column; }
.sidebar .navSubmenu {
  display: none;
  flex-direction: column;
  padding: 2px 0 4px 34px;
  gap: 1px;
}
.sidebar .navGroup.expanded .navSubmenu { display: flex; }
.sidebar .navSubItem {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar .navSubItem:hover { background: var(--bg-input); color: var(--text); }
.sidebar .navSubItem.active { background: var(--jr-red-soft); color: var(--text); }
.sidebar .navSubItem:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sidebar .navItem:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sidebar .sidebarFooter {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar #userInfo { font-size: .76rem; color: var(--text-muted); line-height: 1.4; }
.sidebar #userInfo b { color: var(--text); display: block; }
.sidebar #logoutBtn { width: 100%; text-align: center; }

.appMain {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  color-scheme: light;
  --bg: #ffffff;
  --bg-raised: #ffffff;
  --bg-input: #f5f5f6;
  --border: #e2e2e5;
  --border-hover: #cfcfd4;
  --text: #1a1a1d;
  --text-muted: #5c5c63;
  --text-faint: #8a8a91;
  --ok-bg: #eafbf1;
  --ok-border: #a9e3c1;
  --ok-text: #14743f;
  --fail-bg: #fdecec;
  --fail-border: #f0b4b1;
  --fail-text: #9c231d;
  background: #ffffff;
  color: var(--text);
}

.pageHeader {
  margin: 0 0 24px;
}
.pageHeader h1 {
  font-size: 1.25rem;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.pageHeader p {
  margin: 0;
  color: var(--text-muted);
  font-size: .85rem;
}

.sidebarToggle { display: none; }

/* ---------- Menú compacto (solo íconos; panel.js: agregarBotonPlegar) ---------- */
.sidebar .navSubTitulo { display: none; }
.sidebar .menuPlegar {
  margin: 0 12px 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: none; color: var(--text-faint); font: inherit; font-size: .78rem; cursor: pointer; text-align: left;
}
.sidebar .menuPlegar:hover { color: var(--text); background: var(--bg-input); }
.sidebar .menuPlegar:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (min-width: 861px) {
  .menuCompacto .sidebar { width: 64px; overflow: visible; }
  .menuCompacto .sidebar .brand { padding: 14px 6px; }
  .menuCompacto .sidebar .brand img { width: 44px; height: 44px; }
  .menuCompacto .sidebar .brandName,
  .menuCompacto .sidebar .navTexto,
  .menuCompacto .sidebar #userInfo { display: none; }
  .menuCompacto .sidebar nav { padding: 10px 8px; }
  .menuCompacto .sidebar .navItem { justify-content: center; padding: 10px 0; }
  .menuCompacto .sidebar .navItem .icon { font-size: 1.15rem; }
  /* Submenú flotante a la derecha del ícono. */
  .menuCompacto .sidebar .navGroup { position: relative; }
  .menuCompacto .sidebar .navGroup .navSubmenu,
  .menuCompacto .sidebar .navGroup.expanded .navSubmenu { display: none; }
  .menuCompacto .sidebar .navGroup:hover .navSubmenu,
  .menuCompacto .sidebar .navGroup:focus-within .navSubmenu {
    display: flex; position: absolute; left: 100%; top: 0; z-index: 60; min-width: 210px;
    padding: 6px; margin-left: 2px; background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }
  /* Puente invisible para que el mouse cruce el margen sin cerrar el submenú. */
  .menuCompacto .sidebar .navGroup:hover::after { content: ''; position: absolute; left: 100%; top: 0; width: 6px; height: 100%; }
  .menuCompacto .sidebar .navSubTitulo {
    display: block; padding: 6px 10px 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
  .menuCompacto .sidebar .navSubItem { font-size: .82rem; color: var(--text-muted); }
  .menuCompacto .sidebar .menuPlegar { margin: 0 8px 8px; text-align: center; font-size: 1rem; }
  .menuCompacto .sidebar .sidebarFooter { padding: 10px 8px; }
  .menuCompacto .sidebar #logoutBtn { font-size: 0; padding: 8px 0; }
  .menuCompacto .sidebar #logoutBtn::before { content: '⏻'; font-size: 1rem; }
}
@media (max-width: 860px) { .sidebar .menuPlegar { display: none; } }

@media (max-width: 860px) {
  .appShell { flex-direction: column; }
  .sidebar {
    position: relative;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .sidebar .brand { border-bottom: none; border-right: 1px solid var(--border); }
  .sidebar nav { flex-direction: row; padding: 8px; }
  .sidebar .sidebarFooter { flex-direction: row; border-top: none; border-left: 1px solid var(--border); }
  .appMain { padding: 20px 16px 32px; }
}

/* ---------- Header simple (páginas sin sidebar, ej. login) ---------- */

header {
  max-width: 1100px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 .logo { display: block; }

h1 .sub {
  color: var(--text-faint);
  font-weight: 400;
}

.accent { color: var(--jr-red); }

#userInfo { font-size: .82rem; color: var(--text-muted); }
#userInfo b { color: var(--text); }

.headerActions { display: flex; align-items: center; gap: 10px; }

.navLink, #logoutBtn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.navLink:hover, #logoutBtn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--bg-raised);
}
.navLink:focus-visible, #logoutBtn:focus-visible,
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--jr-red);
}

.panelsGrid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panelsGrid.single { grid-template-columns: 1fr; max-width: 640px; }
@media (max-width: 800px) { .panelsGrid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .15s;
}

.panel h2 {
  font-size: .92rem;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
}

.panel h2 .badge {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .68rem;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 400;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 90px; }

label {
  font-size: .72rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

/* El atributo hidden siempre oculta: cualquier display:flex/grid de una clase
   le ganaba al estilo por defecto del navegador (pasó con el form "Abrir caja"
   de mostrador.html, que se veía vacío sin haberlo abierto). */
[hidden] { display: none !important; }

input, select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--text-faint); }
input:hover, select:hover { border-color: var(--border-hover); }

/* Campo obligatorio: asterisco rojo tras la etiqueta. */
label.req::after { content: ' *'; color: var(--fail-text); font-weight: 700; }
.reqMark { color: var(--fail-text); font-weight: 700; }

input.rut-invalido,
input.campo-invalido {
  border-color: var(--fail-border);
  background: var(--fail-bg);
}

button.action {
  align-self: flex-start;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--jr-red);
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  margin-top: 4px;
  font-family: inherit;
  transition: background .15s, transform .1s;
}
button.action:hover { background: var(--jr-red-dark); }
button.action:active { transform: translateY(1px); }
button.action:disabled { opacity: .55; cursor: default; transform: none; }

button.action.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
button.action.secondary:hover {
  background: var(--bg-input);
  border-color: var(--border-hover);
}

.result {
  margin-top: 4px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .74rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
  display: none;
}
.result.ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok-text); }
.result.fail { border-color: var(--fail-border); background: var(--fail-bg); color: var(--fail-text); }

.full { grid-column: 1 / -1; }
.note { font-size: .72rem; color: var(--text-faint); line-height: 1.5; }
.note.fail { color: var(--fail-text); font-weight: 600; }

.agenciaResuelta { font-size: .74rem; margin: 6px 0 0; color: var(--text-faint); }
.agenciaResuelta.ok { color: var(--ok-text); }
.agenciaResuelta.fail { color: var(--fail-text); }
.agenciaResuelta.warn { color: #B45309; font-weight: 600; }

/* ---------- Dashboard: totales de ventas ---------- */

.statsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
  gap: 16px;
  width: 100%;
  margin: 0 0 24px;
}
@media (max-width: 700px) {
  .statsGrid { grid-template-columns: 1fr; }
}
.statCard {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.statCard .label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 8px;
}
.statCard .value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.statCard.highlight { border-color: var(--jr-red-dark); background: linear-gradient(180deg, var(--jr-red-soft), var(--bg-raised) 60%); }
.statCard.highlight-warn { border-color: #c77d12; background: linear-gradient(180deg, rgba(199,125,18,.12), var(--bg-raised) 60%); }

/* ---------- Tarjeta de estado de caja (agencia) ---------- */
.cajaCard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.cajaCard__estado { display: flex; align-items: center; gap: 12px; }
.cajaCard__titulo { margin: 0; font-weight: 700; font-size: .95rem; }
.cajaCard__sub { margin: 2px 0 0; font-size: .78rem; color: var(--text-muted); }
.cajaCard__monto {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* Abrir caja desde el resumen de Agencia (mostrador.html) */
.cajaAbrir {
  flex-basis: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
/* Desglose del turno abierto: Total | Efectivo | T. débito | T. crédito | Otros */
.cajaDesglose { display: flex; flex-wrap: wrap; gap: 6px 0; font-size: 1rem; }
.cajaDesglose__item { padding: 0 16px; border-left: 1px solid var(--border); }
.cajaDesglose__item:first-child { border-left: 0; }
.cajaDesglose__item--total { font-size: 1.3rem; }
@media (max-width: 640px) {
  .cajaDesglose { text-align: left; }
  .cajaDesglose__item { padding: 0 12px 0 0; border-left: 0; min-width: 45%; }
}
.cajaAbrir > div { min-width: 160px; }
.cajaAbrir__unica { margin: 0; padding: 9px 0; font-weight: 600; }
.cajaAbrir .result { flex-basis: 100%; }
.cajaCard__montoLabel {
  display: block;
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.cajaDot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-faint);
}
.cajaDot--abierta { background: #1e9e52; box-shadow: 0 0 0 3px rgba(30, 158, 82, .18); }
.cajaDot--cerrada { background: var(--jr-red); box-shadow: 0 0 0 3px var(--jr-red-soft); }

.dashboardFilters {
  width: 100%;
  margin: 0 0 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.dashboardFilters label { margin-bottom: 4px; }
.dashboardFilters select { min-width: 220px; }

/* ---------- Gráfico de ventas ---------- */

.chartCard {
  width: 100%;
  margin: 0 0 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.chartCard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.chartCard__head h2 { margin: 0; font-size: .95rem; font-weight: 600; }
.chartCard__body { position: relative; height: 280px; }

.periodTabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.periodTab {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.periodTab:hover { border-color: var(--border-hover); color: var(--text); }
.periodTab.active { background: var(--jr-red); border-color: var(--jr-red); color: #fff; }
.periodTab:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Toggle segmentado (ej. tipo de entrega) ---------- */

.segmented {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 16px;
}
.segmented__btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented__btn:hover { color: var(--text); }
.segmented__btn.active { background: var(--jr-red); color: #fff; }
.segmented__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Resumen por agencia ---------- */

.sucursalesTable {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.sucursalesTable__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 4px;
}
.sucursalesTable__head h2 { margin: 0; font-size: .95rem; font-weight: 600; }
.sucursalesTable table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 10px; }
.sucursalesTable th, .sucursalesTable td {
  text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.sucursalesTable th { color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.sucursalesTable td.amount { text-align: right; font-variant-numeric: tabular-nums; }
.sucursalesTable tr:last-child td { border-bottom: none; }

/* ---------- Mantenedores: pestañas + tabla CRUD genérica ---------- */

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tabBtn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .86rem;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabBtn:hover { color: var(--text); }
.tabBtn.active { color: var(--text); border-bottom-color: var(--jr-red); }
.tabBtn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.tabPanel { display: none; }
.tabPanel.active { display: block; }

.dataTable {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.dataTable table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.dataTable th, .dataTable td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.dataTable th { color: var(--text-muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.dataTable tr:last-child td { border-bottom: none; }
.dataTable td.actions { text-align: right; white-space: nowrap; }
.dataTable .badgeState {
  display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.dataTable .badgeState.on { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }
.dataTable .badgeState.off { background: var(--fail-bg); color: var(--fail-text); border: 1px solid var(--fail-border); }
.dataTable .linkBtn {
  background: none; border: none; color: var(--jr-red); font-family: inherit; font-size: .8rem;
  font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.dataTable .linkBtn:hover { text-decoration: underline; }

.crudForm {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.crudForm h3 { margin: 0 0 4px; font-size: .9rem; font-weight: 600; }
.crudForm .checkRow { display: flex; align-items: center; gap: 8px; }
.crudForm .checkRow label { margin: 0; }
.crudForm .checkRow input[type="checkbox"] { width: auto; }
.crudForm .formActions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Wizard de pasos (ej. Recepción Carga) ---------- */

.wizardSteps {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.wizardStep {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 9px 16px 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.wizardStep:hover { border-color: var(--border-hover); color: var(--text); }
.wizardStep.active { border-color: var(--jr-red); color: var(--text); background: var(--jr-red-soft); }
.wizardStep__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: .72rem;
  flex-shrink: 0;
}
.wizardStep.active .wizardStep__num { background: var(--jr-red); color: #fff; }
.wizardStep:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.wizardPanel { display: none; }
.wizardPanel.active { display: flex; }

.wizardNav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
/* El botón de avance siempre a la derecha, aunque el aviso de la izquierda
   esté oculto (paso 1 de Recepción). */
.wizardNav > :last-child { margin-left: auto; }

/* ---------- Cotizador (estilo tipo Starken) ---------- */

.quoteCard {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.quoteCard__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--jr-red);
}

.quoteCard__subtitle { font-size: .95rem; font-weight: 700; margin: 0 0 4px; }
.quoteCard__hint { font-size: .8rem; color: var(--text-muted); margin: 0 0 20px; }

.quoteGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.quoteGrid--5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 700px) {
  .quoteGrid, .quoteGrid--5 { grid-template-columns: 1fr 1fr; }
}

.unitInput {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color .15s, box-shadow .15s;
}
.unitInput:focus-within { border-color: var(--jr-red); box-shadow: var(--focus-ring); }
.unitInput input {
  border: none;
  background: none;
  flex: 1;
  min-width: 0;
}
.unitInput input:focus { box-shadow: none; }
.unitInput__tag {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border);
  white-space: nowrap;
}
.unitInput__tag--left { order: -1; }

.tariffGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) { .tariffGrid { grid-template-columns: 1fr; } }

.tariffCard {
  border: 1px solid var(--border);
  border-top: 3px solid var(--jr-red);
  border-radius: var(--radius);
  padding: 20px 24px;
  background: var(--bg-raised);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.tariffCard--alt { border-top-color: #16a34a; }
.tariffCard__label { margin: 0 0 14px; font-size: .85rem; font-weight: 700; }
.tariffCard__price { margin: 0 0 12px; font-size: 1.9rem; font-weight: 800; color: var(--jr-red); letter-spacing: -.02em; }
.tariffCard--alt .tariffCard__price { color: #16a34a; }

/* Destaca la tarifa que corresponde al modo elegido (a sucursal/domicilio)
   arriba en el formulario, atenuando la otra como referencia. */
.tariffCard--dim { opacity: .45; box-shadow: none; }
.tariffCard--focus {
  border-width: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .1);
  transform: translateY(-2px);
}
.tariffCard--focus .tariffCard__price { font-size: 2.2rem; }
.tariffCard__eta { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-muted); }
.tariffCard__details { display: flex; gap: 24px; flex-wrap: wrap; font-size: .82rem; color: var(--text-muted); }
.tariffCard__details b { color: var(--text); font-weight: 600; }

/* Tarjeta clicable para elegir tipo de entrega (ej. Recepción Carga) —
   reset de <button> nativo, mismo look que .tariffCard estático. */
.tariffCard--pick {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s, opacity .15s;
}
.tariffCard--pick:hover { border-color: var(--border-hover); }
.tariffCard--pick:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Launcher (menú por rol) */
.menuGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.menuCard {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.menuCard:hover {
  border-color: var(--jr-red);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.menuCard:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--jr-red);
}
.menuCard .icon { font-size: 1.6rem; }
.menuCard h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.menuCard p { margin: 0; font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

.roleBadge {
  display: inline-block;
  font-size: .68rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--jr-red);
  background: var(--jr-red-soft);
  border: 1px solid var(--jr-red-dark);
  padding: 3px 9px;
  border-radius: 4px;
  margin: 24px auto 0;
  max-width: 1100px;
  width: 100%;
}

/* ---------- Inicio: fecha bajo cada tarjeta + detalle semanal ---------- */
.statCard .periodo { margin: 6px 0 0; font-size: .78rem; color: var(--text-muted); }

.detalleVentas { margin-top: 20px; }
.detalleVentas .sucursalesTable__head .note { color: var(--text-muted); font-size: .78rem; }
.detalleVentas__scroll { overflow-x: auto; }
.detalleVentas table { min-width: 720px; }
.detalleVentas th:not(:first-child), .detalleVentas td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detalleVentas tr.semana td { font-weight: 600; background: var(--bg-input); }
.detalleVentas tr.semana button {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.detalleVentas tr.semana button:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.detalleVentas tr.semana .flecha { display: inline-block; width: 1em; transition: transform .15s; color: var(--text-muted); }
.detalleVentas tr.semana.abierta .flecha { transform: rotate(90deg); }
.detalleVentas tr.semana .rangoSemana { font-weight: 400; color: var(--text-muted); font-size: .8rem; }
.detalleVentas tr.dia td:first-child { padding-left: 40px; color: var(--text-muted); text-transform: capitalize; }
.detalleVentas tr.dia.cero td { color: var(--text-muted); opacity: .6; }
.detalleVentas tr.totalPeriodo td { font-weight: 700; border-top: 2px solid var(--border); }

/* ---------- Agencia: turnos del día bajo el total de caja ---------- */
.cajaTurnos { flex-basis: 100%; overflow-x: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.cajaTurnos table { width: 100%; border-collapse: collapse; font-size: .78rem; color: var(--text-muted); }
.cajaTurnos th { font-weight: 500; font-size: .7rem; text-align: right; padding: 2px 10px; white-space: nowrap; }
.cajaTurnos td { text-align: right; padding: 4px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cajaTurnos th:first-child, .cajaTurnos td:first-child { text-align: left; padding-left: 0; }
.cajaTurnos tr.actual td { color: var(--text); font-weight: 600; }
.cajaTurnos .marcaActual {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .68rem; font-weight: 600;
  background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border);
}

/* ---------- Agencia: cierre de caja con arqueo ---------- */
.cajaCerrar__esperado { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--text-muted); }
.cajaCerrar__diferencia { margin: 0; padding: 9px 0; font-weight: 600; font-size: .9rem; }
.cajaCerrar__diferencia.ok { color: var(--ok-text); }
.cajaCerrar__diferencia.descuadre { color: #c77d12; }
.cajaCard .result.cajaCerrada { flex-basis: 100%; display: block; margin: 0; }
.cajaCard .result.cajaCerrada[hidden] { display: none; }

/* ---------- Recepción: panel "Envío creado" (paso 4) ---------- */
.envioCreado { margin-top: 4px; }
.envioCreado__titulo { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ok-text); }
.envioCreado__codigo { margin: 6px 0 2px; font-size: 1.7rem; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.envioCreado__acciones { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }

/* ---------- Paquetes en Agencia: orden por recibido + documentos ---------- */
.dataTable th .ordenBtn {
  all: unset; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.dataTable th .ordenBtn:hover { color: var(--text); }
.dataTable th .ordenBtn:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.dataTable .docLink { font-variant-numeric: tabular-nums; margin-right: 6px; }
.dataTable .docLink.anulado { text-decoration: line-through; opacity: .6; }

/* ---------- Recepción: lista de bultos (paso 1) ---------- */
.bultoFila { padding: 10px 0 2px; border-bottom: 1px dashed var(--border); }
.bultoFila:last-child { border-bottom: 0; }
.bultoFila__titulo { margin: 0 0 4px; font-size: .78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.bultoFila .quoteGrid { margin-bottom: 4px; }
.bultoFila__acciones { display: flex; align-items: flex-end; padding-bottom: 6px; }
.bultoFila__quitar {
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--text-muted); border-radius: var(--radius-sm);
  width: 38px; height: 38px; cursor: pointer; font-size: .9rem;
}
.bultoFila__quitar:hover { border-color: var(--jr-red); color: var(--jr-red); }
.bultoFila__quitar:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bultoFila__quitar[hidden] { display: none; }
/* Verde (agregar), distinto del rojo de las acciones principales. */
button.action.bultosAgregar {
  margin: 8px 0 14px;
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}
/* Documentos asociados del envío (agencia/recepcion.html). */
.docsAsociados { margin: 4px 0 16px; padding: 12px; border: 1px dashed var(--border-hover); border-radius: var(--radius); }
.docsAsociados__titulo { font-weight: 600; margin: 0 0 8px; color: var(--text-muted); font-size: .85rem; }
.docsAsociados__fila { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.docsAsociados__fila > div { flex: 1 1 180px; }
/* Misma altura para tipo, número y botón: quedan alineados abajo. */
.docsAsociados__fila input, .docsAsociados__fila select, .docsAsociados__fila button.action { height: 44px; box-sizing: border-box; }
/* button.action trae align-self: flex-start: aquí va abajo, a la par de los campos. */
.docsAsociados__fila button.action { margin: 0; flex: 0 0 auto; padding: 0 22px; align-self: flex-end; }
/* Verde de "agregar", igual que + Agregar bulto. */
button.action.docsAsociados__agregar { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); font-weight: 700; }
button.action.docsAsociados__agregar:hover { border-color: var(--ok-text); filter: brightness(.97); }
/* Rojo de la marca: fondo translúcido y trazo marcado. */
.docsAsociados__quitar {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; cursor: pointer;
  border: 1.5px solid var(--jr-red); background: var(--jr-red-soft); color: var(--jr-red); border-radius: var(--radius-sm);
}
.docsAsociados__quitar svg { stroke-width: 2.4; }
.docsAsociados__quitar:hover { background: var(--jr-red); color: #fff; }
.docsAsociados__lista { list-style: none; margin: 8px 0 0; padding: 0; }
.docsAsociados__lista li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.docsAsociados__lista li:last-child { border-bottom: 0; }

/* Buscador de dirección de entrega (agencia/recepcion.html). */
.buscaDireccion { position: relative; margin-bottom: 10px; }
.buscaDireccion__lista {
  position: absolute; z-index: 20; left: 0; right: 0; margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: var(--bg-raised); border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12); max-height: 280px; overflow-y: auto;
}
.buscaDireccion__lista button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--text); cursor: pointer;
}
.buscaDireccion__lista button:hover, .buscaDireccion__lista button:focus { background: var(--bg-input); }
.buscaDireccion__excepcion { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.buscaDireccion__excepcion input[type="text"], .buscaDireccion__excepcion input:not([type]) { flex: 1 1 240px; }

/* Despacho al CD (agencia/paquetes.html). */
.despachoCd {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--ok-border); background: var(--ok-bg); border-radius: var(--radius);
}
.despachoCd > div { flex: 1 1 280px; }
.despachoCd p { margin: 0; }
.despachoCd__titulo { font-weight: 700; color: var(--ok-text); margin-bottom: 2px !important; }
.despachoCd button.action { margin: 0; }

/* Aviso de caja cerrada (recepcion.html), con apertura en línea. */
.avisoCaja {
  max-width: 720px; margin: 0 auto 16px; padding: 14px 16px;
  background: var(--fail-bg); border: 1px solid var(--fail-border); border-radius: var(--radius); color: var(--text);
}
.avisoCaja__titulo { font-weight: 700; color: var(--fail-text); margin: 0 0 4px; }
.avisoCaja p { margin: 0; }
.avisoCaja__form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; }
.avisoCaja__form > div { flex: 1 1 180px; }
.avisoCaja__form button.action { margin: 0; }
/* Lector de e-RUT (recepcion.html): campo para la pistola + botón cámara. */
.erutLector { margin: 10px 0 14px; padding: 12px; border: 1px dashed var(--border-hover); border-radius: var(--radius); }
.erutLector__fila { display: flex; gap: 8px; }
.erutLector__fila input { flex: 1; min-width: 0; }
.erutLector__fila button.action { margin: 0; white-space: nowrap; }
button.action.bultosAgregar:hover { background: var(--ok-bg); border-color: var(--ok-text); filter: brightness(.97); }
.dataTable .nBultos { display: block; font-size: .72rem; color: var(--text-muted); }
.dataTable .subDato { display: block; font-size: .72rem; color: var(--text-muted); }

/* ---------- Aviso de impresión (panel.js: avisoImpresion) ---------- */
.avisoImpresion {
  position: fixed; right: 16px; bottom: 16px; z-index: 1000; max-width: min(420px, calc(100vw - 32px));
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg-raised); color: var(--text); border: 1px solid #c77d12; border-left-width: 4px;
  border-radius: var(--radius); padding: 12px 14px; font-size: .85rem; line-height: 1.4;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.avisoImpresion button { all: unset; cursor: pointer; color: var(--text-muted); padding: 0 2px; }
.avisoImpresion button:hover { color: var(--text); }
.dataTable td.codigoEnvio { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Recepción: manejo especial (frágil / no apilar) ---------- */
.manejoEspecial { display: flex; gap: 20px; flex-wrap: wrap; margin: 4px 0 14px; }
.checkInline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.checkInline input { width: 18px; height: 18px; accent-color: var(--jr-red); }
/* Cantidad de bultos iguales en la fila (recepcion.html). */
.checkInline.bultoFila__cantidad input { width: 72px; height: auto; padding: 6px 8px; }

/* ---------- Inicio: comisión bajo la venta (index.html) ---------- */
.statCard .comision { margin: 6px 0 0; font-size: .85rem; color: var(--text); }
.statCard .comision b { font-variant-numeric: tabular-nums; }
.statCard .comision__base { color: var(--text-muted); font-size: .76rem; }
.detalleVentas td.colComision { color: var(--ok-text); font-weight: 600; }

/* ---------- Comisiones (comisiones.html) ---------- */
.semanaNav { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.semanaNav__titulo { display: flex; flex-direction: column; gap: 2px; }
.semanaNav__titulo b { font-size: 1.05rem; }
.semanaNav button.action { margin: 0; padding: 8px 14px; }
.dataTable th.num, .dataTable td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dataTable tr.filaTotal td { border-top: 2px solid var(--border); font-weight: 700; }
.accionesSemana { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.pagoForm { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagoForm input { padding: 5px 8px; font-size: .8rem; width: auto; }
.sucursalesTable tr.filaHistorial { cursor: pointer; }
.sucursalesTable tr.filaHistorial:hover td { background: var(--bg-input); }
.badgeState.warn { background: #fff4e5; color: #8a5300; border: 1px solid #f5c77e; }
.sucursalesTable .badgeState { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.sucursalesTable .badgeState.on { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }

/* ---------- Manifiestos (manifiestos.html) ---------- */
.manifToolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.manifToolbar .tabs { margin: 0; border: 0; }
.dataTable tr.filaManif { cursor: pointer; }
.dataTable tr.filaManif:hover td { background: var(--bg-input); }
.manifCabecera { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.manifCabecera h2 { margin: 0; font-size: 1.25rem; }
.manifCabecera__acciones { display: flex; gap: 10px; align-items: center; }
.manifCabecera__acciones button.action { margin: 0; }
.badgeEstado { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); margin-left: 4px; }
.badgeEstado.e-preparacion { background: #fff4e5; color: #8a5300; border-color: #f5c77e; }
.badgeEstado.e-en_ruta { background: #e8f0fe; color: #1a4fb4; border-color: #b3c9f5; }
.badgeEstado.e-recibido { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.badgeEstado.e-aviso { background: var(--fail-bg); color: var(--fail-text); border-color: var(--fail-border); font-size: .66rem; padding: 1px 7px; }
.escaner { background: var(--bg-raised); border: 2px solid var(--jr-red); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0 18px; }
.escaner > label { font-weight: 700; display: block; margin-bottom: 8px; }
.escaner__fila { display: flex; gap: 10px; }
.escaner__fila input { flex: 1; font-size: 1.15rem; letter-spacing: .04em; text-transform: uppercase; }
.escaner__fila button.action { margin: 0; white-space: nowrap; }
.escaner .checkInline { margin-top: 10px; }
.escaner #camara { margin-top: 12px; max-width: 420px; }
.escaner__msg { margin: 12px 0 0; font-size: 1rem; font-weight: 700; min-height: 1.4em; }
.escaner__msg.ok { color: var(--ok-text); }
.escaner__msg.fail { color: var(--fail-text); }
.escaner__msg.repetido { color: #8a5300; }
.escaner__progreso { margin: 4px 0 0; color: var(--text-muted); font-size: .85rem; }
.dataTable tr.bultoRecibido td { background: var(--ok-bg); }
.altaRapida { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }

/* Títulos de sección dentro de una página (carga.html). */
.seccionTitulo { font-size: 1rem; margin: 24px 0 10px; }
.dataTable tfoot td { border-top: 2px solid var(--border-hover); }

/* Diálogo del panel (panel.js: dialogo), en vez de confirm/prompt/alert. */
.dialogoFondo {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(10, 10, 12, .55); animation: dialogoAparece .12s ease-out;
}
.dialogo {
  width: min(460px, 100%); background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 22px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
.dialogo h2 { margin: 0 0 10px; font-size: 1.1rem; }
.dialogo__cuerpo { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }
.dialogo__cuerpo p { margin: 0 0 8px; }
.dialogo__cuerpo b { color: var(--text); }
.dialogo__cuerpo .dialogo__resumen {
  margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text);
}
.dialogo__cuerpo .dialogo__alerta {
  margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--fail-bg); border: 1px solid var(--fail-border); color: var(--fail-text);
}
.dialogo__etiqueta { display: block; margin: 12px 0 4px; font-weight: 600; font-size: .8rem; }
.dialogo__error { margin: 6px 0 0; color: var(--fail-text); font-size: .8rem; }
.dialogo__acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialogo__acciones button.action { margin: 0; align-self: auto; }
button.action.peligro { background: var(--jr-red-dark); }
button.action.peligro:hover { background: var(--jr-red); }
@keyframes dialogoAparece { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Acciones de fila como íconos (agencia/paquetes.html) ---------- */
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dataTable td.accionesIconos { white-space: nowrap; width: 1%; padding-right: 4px; }
.iconBtn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: 0 1px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text-muted);
  cursor: pointer; vertical-align: middle; text-decoration: none; padding: 0;
}
.iconBtn:hover { background: var(--bg-input); border-color: var(--border); color: var(--jr-red); }
.iconBtn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.iconBtn.deshabilitado { opacity: .25; cursor: default; }
.iconBtn.deshabilitado:hover { background: none; border-color: transparent; color: var(--text-muted); }
/* Reetiquetar: la etiqueta ya se usó; se marca en ámbar. */
.iconBtn.reetiquetar { color: #b26a00; }
.iconBtn.ocupado { opacity: .5; cursor: progress; animation: iconoOcupado 1s ease-in-out infinite; }
@keyframes iconoOcupado { 50% { opacity: .2; } }

/* Fila bajo el puntero, resaltada en todas las tablas (filas de datos, no
   las vacías de "sin resultados"). */
.dataTable tbody tr:has(td:not([colspan])):hover td {
  background: color-mix(in srgb, var(--jr-red) 6%, var(--bg-input));
}
.dataTable tbody tr:has(td:not([colspan])):hover td:first-child { box-shadow: inset 3px 0 0 var(--jr-red); }

/* ---------- Descuentos: solicitud (Recepción) y aviso para quien aprueba ---------- */
.autorizacionDescuento { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -4px 0 14px; }
.autorizacionDescuento button.action { margin: 0; }
.avisoDescuentos {
  position: fixed; right: 18px; bottom: 18px; z-index: 900; width: min(380px, calc(100vw - 32px));
  max-height: 70vh; overflow-y: auto; padding: 12px 14px; border-radius: var(--radius);
  background: #fff; color: #1a1a1d; border: 2px solid var(--jr-red); box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}
.avisoDescuentos__titulo { margin: 0 0 8px; font-weight: 800; color: var(--jr-red); }
.avisoDescuentos__item { border-top: 1px solid #e2e2e5; padding: 8px 0 4px; font-size: .86rem; }
.avisoDescuentos__item p { margin: 0 0 4px; }
.avisoDescuentos__item .note { color: #5c5c63; }
.avisoDescuentos__acciones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.avisoDescuentos__acciones button.action { margin: 0; padding: 6px 14px; }
/* Flete por pagar (lo paga el destinatario): marca en listas. */
.porPagar { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .68rem; font-weight: 700; white-space: nowrap; background: #fff4e5; border: 1px solid #f5c77e; color: #8a5300; }
td[style*="text-align:right"] .porPagar { display: block; width: max-content; margin: 3px 0 0 auto; }
