:root {
  --sidebar-w: 248px;
  --sidebar-collapsed: 76px;
  --bg-sidebar: #0b1120;
  --bg-active: #1e293b;
  --bg-main: #f1f5f9;
  --accent: #0ea5e9;
  --accent-2: #6366f1;
  --sidebar-text: #cbd5e1;
  --sidebar-text-dim: #8b9bb4;
  --text: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text);
  min-height: 100vh;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* —— Sidebar —— */
.sidebar {
  width: var(--sidebar-w);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(99, 102, 241, 0.16), transparent 60%),
    linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s ease;
  overflow: hidden;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.layout.collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  margin-bottom: 4px;
}

.btn-toggle {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-toggle:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
}

.btn-toggle:active {
  transform: translateY(0);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: linear-gradient(90deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.2s;
}

.layout.collapsed .sidebar-brand,
.layout.collapsed .nav-label,
.layout.collapsed .nav-group-caret,
.layout.collapsed .sidebar-hint {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-nav {
  padding: 10px 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 3px;
  border-radius: 11px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #fff;
}

.nav-item:active {
  transform: scale(0.99);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.95), rgba(99, 102, 241, 0.95));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.3);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  background: #fff;
}

.nav-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.12);
  transition: background 0.18s ease;
}

.nav-item:hover .nav-icon {
  background: rgba(148, 163, 184, 0.2);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.18);
}

.layout.collapsed .nav-item {
  justify-content: center;
  padding: 10px 8px;
  gap: 0;
}

.layout.collapsed .nav-item.active::before {
  display: none;
}

.nav-label {
  white-space: nowrap;
}

/* —— Grupos desplegables del menú —— */
.nav-group {
  margin: 2px 0;
}

.nav-group-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--sidebar-text);
  text-align: left;
  margin-bottom: 0;
}

.nav-group-caret {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--sidebar-text-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-group.open > .nav-group-toggle .nav-group-caret {
  transform: rotate(90deg);
}

.nav-group-items {
  display: none;
  margin: 2px 0 4px 18px;
  padding-left: 8px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.nav-group.open > .nav-group-items {
  display: block;
}

.nav-group-items .nav-item {
  font-size: 0.88rem;
  padding: 9px 12px;
}

.layout.collapsed .nav-group-caret {
  display: none;
}

.layout.collapsed .nav-group-items {
  display: block;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}

.sidebar-hint {
  font-size: 0.7rem;
  color: var(--sidebar-text-dim);
  text-align: center;
  padding: 12px;
}

/* —— Main —— */
.main {
  flex: 1;
  padding: 0 28px 40px;
  overflow-x: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 16px 0 12px;
  margin: 0 -28px 20px;
  padding-left: 28px;
  padding-right: 28px;
  background: linear-gradient(var(--bg-main) 70%, transparent);
}

.global-search-form {
  max-width: 720px;
}

.global-search-wrap {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.global-search-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.global-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.global-search-btn {
  flex-shrink: 0;
  padding-left: 18px;
  padding-right: 18px;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow: auto;
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 10px 0;
}

.global-search-dropdown[hidden] {
  display: none !important;
}

.global-search-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.global-search-grupo {
  padding: 4px 0 8px;
  border-bottom: 1px solid #f1f5f9;
}

.global-search-grupo:last-of-type {
  border-bottom: none;
}

.global-search-grupo-titulo {
  padding: 6px 16px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.global-search-grupo-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}

.global-search-hit {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: inherit;
}

.global-search-hit:hover {
  background: #f8fafc;
}

.global-search-hit-titulo {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.global-search-hit-detalle {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.global-search-ver-todos {
  display: block;
  padding: 12px 16px 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid #f1f5f9;
}

.global-search-ver-todos:hover {
  text-decoration: underline;
}

.buscar-grupo {
  margin-bottom: 16px;
}

.buscar-grupo-titulo {
  font-size: 1.05rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.buscar-grupo-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}

.buscar-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}

.buscar-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.buscar-item:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

.buscar-item-titulo {
  display: block;
  font-weight: 600;
}

.buscar-item-detalle {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

/* —— Forms —— */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.form-grid--viajes {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.field label,
.field .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.input-fecha {
  max-width: 11rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.flatpickr-calendar {
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  border-radius: 10px;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--accent);
  border-color: var(--accent);
}

.flatpickr-day.selected:hover,
.flatpickr-day:hover {
  background: #0284c7;
  border-color: #0284c7;
}

.flatpickr-months .flatpickr-month {
  height: 40px;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 600;
}

.row-bultos-choferes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 38%);
  gap: 16px 24px;
  align-items: start;
}

.row-bultos-choferes > .field-bultos,
.row-bultos-choferes > .field-choferes {
  margin: 0;
  min-width: 0;
}

.bultos-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.field-inline label {
  font-size: 0.75rem;
  color: var(--muted);
}

.field-inline input {
  width: 80px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

/* —— Buttons —— */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #0284c7;
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.inline-form {
  display: inline;
}

/* —— Table —— */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: #f8fafc;
}

tbody tr:hover {
  background: #f8fafc;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty {
  color: var(--muted);
  padding: 12px 0;
}

/* —— Alerts —— */
.alerts {
  margin-bottom: 16px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.alert-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* —— Mayúsculas y totales —— */
.input-mayus {
  text-transform: uppercase;
}

.card-tarifas {
  border-left: 4px solid var(--accent);
}

.form-tarifas {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  width: fit-content;
  max-width: 100%;
}

.form-tarifas .field {
  margin: 0;
  flex: 0 0 auto;
}

.form-tarifas .field label {
  font-size: 0.75rem;
  margin-bottom: 3px;
}

.form-tarifas .field input {
  width: 5.25rem;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.form-tarifas .form-actions {
  grid-column: unset;
  flex: 0 0 auto;
  padding-top: 0;
  margin: 0;
  display: flex;
  align-items: flex-end;
}

.form-tarifas .form-actions .btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.precio-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.2;
}

.field-inline .precio-hint {
  display: inline;
  margin-left: 2px;
}

.subtotal-line {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.field-total-viaje {
  grid-column: 1 / -1;
}

.total-viaje {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

.total-cell {
  font-weight: 600;
  color: #0369a1;
}

.total-readonly {
  display: inline-block;
  padding: 8px 12px;
  background: #f0f9ff;
  border-radius: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.footer-total td {
  background: #f1f5f9;
  border-top: 2px solid #cbd5e1;
  padding: 14px 12px;
}

.edit-hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.pedidos-lista {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pedido-card {
  border-left: 4px solid var(--accent);
}

.pedido-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.pedido-card-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.total-viaje-card {
  font-size: 1rem;
  color: var(--muted);
}

.total-viaje-card strong {
  color: var(--accent);
  font-size: 1.25rem;
}

.pedido-actions {
  grid-column: 1 / -1;
}

.form-eliminar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.card-total-dia {
  text-align: right;
  font-size: 1.1rem;
}

.card-total-dia p {
  margin: 0;
}

/* —— Viajes: búsqueda y tabla editable —— */
.card-search .search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.search-bar--filtros .filtro-estado {
  width: 100%;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  background: #fff;
  cursor: pointer;
}

.search-bar--filtros .filtro-estado:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.card-search .field {
  min-width: 160px;
}

.search-hint {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.table-editable .row-form,
.table-lineas .row-form {
  display: contents;
}

.table-lineas th,
.table-lineas td {
  vertical-align: middle;
}

.table-lineas .cell-actions {
  white-space: nowrap;
  width: 100px;
}

.table-listado tbody tr:hover {
  background: #f8fafc;
}

.table-listado td {
  padding: 12px;
}

.table-viajes .col-expand {
  width: 28px;
  padding-right: 0;
  color: var(--muted);
}

.fila-expand-icon {
  display: inline-block;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.fila-pedido {
  cursor: pointer;
}

.fila-pedido--activa {
  background: #eff6ff !important;
}

.fila-pedido--activa .fila-expand-icon {
  transform: rotate(90deg);
  color: var(--accent);
}

.fila-detalle td {
  padding: 0 !important;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
}

.detalle-bultos-form {
  padding: 16px 18px 16px 36px;
  border-left: 4px solid var(--accent);
  background: #f8fafc;
}

.form-grid--viajes-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
}

.form-grid--viajes-inline .field-bultos {
  flex: 1 1 320px;
  grid-column: unset;
  margin: 0;
}

.form-grid--viajes-inline .field-total-viaje--inline {
  grid-column: unset;
  flex: 0 0 auto;
  margin: 0;
}

.form-grid--viajes-inline .field-total-viaje--inline .total-viaje {
  font-size: 1.5rem;
  margin-top: 2px;
}

.form-grid--viajes-inline .field:not(.field-bultos):not(.field-total-viaje) {
  flex: 0 0 auto;
  min-width: 7rem;
  margin: 0;
}

.form-grid--viajes-inline .form-actions--inline {
  flex: 1 1 100%;
  grid-column: unset;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  margin: 8px 0 0;
  border-top: 1px solid #e2e8f0;
}

.label-ref {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #334155;
  font-size: 0.85rem;
}

.detalle-bultos-msg {
  font-size: 0.85rem;
  color: var(--muted);
}

.detalle-bultos-msg--ok {
  color: #047857;
}

.detalle-bultos-msg--error {
  color: #b91c1c;
}

.table-liq-libro .fila-liq {
  cursor: pointer;
}

.table-liq-libro .fila-liq:hover {
  background: #f8fafc;
}

.table-liq-libro .fila-liq.fila-pedido--activa {
  background: #eff6ff !important;
}

.table-liq-libro .fila-liq.fila-pedido--activa .fila-expand-icon {
  transform: rotate(90deg);
  color: var(--accent);
}

.detalle-liq-panel {
  padding: 14px 16px 16px 36px;
  border-left: 4px solid var(--accent);
  background: #f8fafc;
}

.detalle-liq-titulo {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.table-wrap--nested {
  margin: 0;
}

.table-liq-detalle {
  font-size: 0.85rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.table-liq-detalle th,
.table-liq-detalle td {
  padding: 8px 10px;
}

.table-liq-detalle .bultos-compact {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.detalle-liq-cargando,
.detalle-liq-vacio,
.detalle-liq-error {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.detalle-liq-error {
  color: #b91c1c;
}

.detalle-pendiente-panel {
  padding-bottom: 18px;
}

.detalle-pedido-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
  margin: 0 0 16px;
}

.detalle-pedido-item {
  margin: 0;
}

.detalle-pedido-item--wide {
  grid-column: 1 / -1;
}

.detalle-pedido-item dt {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.detalle-pedido-item dd {
  margin: 0;
  font-size: 0.92rem;
  color: #1e293b;
}

.detalle-pendiente-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.badge-concepto {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-cobro {
  background: #ecfdf5;
  color: #047857;
}

.badge-concepto.badge-pago {
  background: #fef2f2;
  color: #b91c1c;
}

.form-grid--config {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.form-grid--config .field-chofer-config {
  grid-column: 1 / -1;
  min-width: 240px;
}

.form-grid--config .field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.form-grid--config .field-cadete-config {
  grid-column: 1 / -1;
}

.form-grid--config .input-nuevo-cadete {
  margin-top: 8px;
}

.row-cadete-transporte {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  grid-column: 1 / -1;
}

.row-cadete-transporte .field-cadete {
  flex: 1 1 220px;
  min-width: 180px;
}

.row-cadete-transporte .field-transporte {
  flex: 0 0 auto;
  min-width: 100px;
}

.input-readonly {
  background: var(--surface-2, #f3f4f6);
  color: var(--text);
  cursor: default;
}

#comision[readonly] {
  background: var(--surface-2, #f3f4f6);
}

.config-dia-hint {
  grid-column: 1 / -1;
  margin: 0;
}

/* —— Formulario nuevo pedido —— */
.card-pedido {
  border-top: 3px solid var(--accent);
}

.pedido-form-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.pedido-form-head h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.pedido-form-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.form-pedido {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pedido-section {
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
}

.pedido-section--resumen {
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  border-color: #bae6fd;
}

.pedido-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.pedido-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.pedido-section-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 36rem;
}

.filtro-transporte {
  font-weight: 600;
}

.field-transporte-elegir select {
  min-width: 6rem;
}

.pedido-banner strong {
  color: #0c4a6e;
}

@media (max-width: 560px) {
  .pedido-section-grid--compact {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.pedido-section-grid .field-span-full {
  grid-column: 1 / -1;
}

.pedido-section-grid .field-span-2 {
  grid-column: span 2;
}

.pedido-section .field select,
.pedido-resumen-card select,
.pedido-resumen-card input:not([type="hidden"]) {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--card);
}

.pedido-section .field select:focus,
.pedido-resumen-card select:focus,
.pedido-resumen-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.pedido-banner {
  margin: 12px 0 0;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.pedido-banner[hidden] {
  display: none !important;
}

.row-bultos-choferes--pedido {
  grid-column: unset;
  margin: 0;
}

.pedido-bultos-panel {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.row-bultos-choferes--pedido > .field-choferes {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pedido-resumen {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr 1.1fr;
  gap: 12px;
  align-items: stretch;
}

.pedido-resumen-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-width: 0;
}

.pedido-resumen-card label,
.pedido-resumen-card > .label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pedido-resumen-card .field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}

.pedido-resumen-card--transporte select {
  font-weight: 600;
  font-size: 1rem;
}

.pedido-resumen-card--cadete .cadete-row-label,
.pedido-resumen-card--cadete > label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.cadete-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cadete-nombre {
  flex: 1;
  min-width: 0;
}

.factor-comision-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.factor-comision-btn {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.factor-comision-btn input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.factor-comision-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 6px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.factor-comision-btn input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.factor-comision-btn:hover span {
  border-color: var(--accent);
}

.pedido-resumen-card--total {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12);
  justify-content: center;
  text-align: right;
}

.pedido-resumen-card--total .total-viaje {
  font-size: 1.65rem;
  margin: 0;
  line-height: 1.2;
}

.form-actions--pedido {
  grid-column: unset;
  padding-top: 4px;
  margin-top: 4px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
}

@media (max-width: 960px) {
  .pedido-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pedido-section-grid .field-span-2 {
    grid-column: 1 / -1;
  }

  .pedido-resumen {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pedido-resumen-card--total {
    grid-column: 1 / -1;
    text-align: left;
  }

  .row-bultos-choferes--pedido {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .pedido-section-grid {
    grid-template-columns: 1fr;
  }

  .pedido-resumen {
    grid-template-columns: 1fr;
  }

  .pedido-section {
    padding: 14px;
  }
}

.detalle-item--full {
  grid-column: 1 / -1;
}

.card-resumen-config {
  margin-top: 16px;
  border-left: 4px solid var(--accent);
}

.card-listado-config {
  margin-top: 16px;
}

.card-listado-config h2,
.card-resumen-config h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.table-configuraciones td:nth-child(5) {
  max-width: 280px;
  word-break: break-word;
}

@media (max-width: 640px) {
  .form-grid--config .field-chofer-config {
    grid-column: span 1;
  }
}

.card-search--contable .card-search-contable-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
}

.card-search--contable .card-search-filtros {
  flex: 1 1 360px;
  min-width: 0;
}

.card-search--contable .card-search-filtros h2 {
  margin-bottom: 12px;
}

.contable-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0 4px;
}

.contable-subnav-item {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: background 0.15s ease, color 0.15s ease;
}

.contable-subnav-item:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.contable-subnav-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.contable-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.contable-hub-card {
  display: block;
  padding: 20px 22px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contable-hub-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.contable-hub-card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #1e293b;
}

.contable-hub-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.45;
}

.cierre-caja-bloque {
  margin-bottom: 18px;
}

.cierre-caja-bloque:last-child {
  margin-bottom: 0;
}

.card-resumen-forma--inline {
  flex: 0 0 auto;
  min-width: 200px;
  max-width: 280px;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 4px solid var(--accent);
  background: transparent;
  box-shadow: none;
}

.card-resumen-forma h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-bottom: 10px;
}

.resumen-forma-grid--inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resumen-forma-grid--inline .resumen-forma-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.resumen-forma-grid--inline .resumen-forma-label {
  display: inline;
  margin-bottom: 0;
  font-size: 0.8rem;
}

.resumen-forma-grid--inline .resumen-forma-item strong {
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .card-resumen-forma--inline {
    flex: 1 1 100%;
    max-width: none;
    padding: 16px 0 0;
    border-left: none;
    border-top: 4px solid var(--accent);
  }
}

.total-cobro-foot {
  color: #047857;
}

.total-pago-foot {
  color: #b91c1c;
}

.total-sep {
  color: var(--muted);
  font-weight: 400;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.badge-estado {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pendiente {
  background: #fef3c7;
  color: #92400e;
}

.badge-en-transporte {
  background: #dbeafe;
  color: #1e40af;
}

.badge-en-deposito {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-entregado {
  background: #d1fae5;
  color: #047857;
}

.badge-pago {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pago--pendiente {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-pago--ok {
  background: #d1fae5;
  color: #047857;
}

.detalle-pago-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
}

.detalle-pago-ok {
  font-size: 0.9rem;
  color: #047857;
}

.form-pago-viajes {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  max-width: none;
}

.form-pago-viajes .field-forma-pago-accion .label {
  visibility: hidden;
}

.form-pago-viajes .field-forma-pago-accion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.form-pago-pedido-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 8px;
}

.form-pago-pedido-row select {
  min-width: 180px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.detalle-pago-msg {
  font-size: 0.85rem;
  color: var(--muted);
}

.pedido-section-grid--pago {
  max-width: 24rem;
}

.field-forma-pago-pedido select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cell-acciones {
  width: 1%;
  white-space: nowrap;
}

.acciones-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-accion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  border: none;
  line-height: 1.2;
  flex-shrink: 0;
}

.btn-accion--ver {
  background: #e2e8f0;
  color: #334155;
}

.btn-accion--ver:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.btn-accion--editar {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.35);
}

.btn-accion--editar:hover {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.4);
}

.btn-accion--borrar {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-accion--borrar:hover {
  background: #fecaca;
  color: #991b1b;
}

.col-acciones {
  white-space: nowrap;
}

.col-acciones .form-borrar-inline {
  display: inline;
  margin: 0;
}

.table-configuraciones .col-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.table-configuraciones tr.fila-activa {
  background: #e0f2fe;
}

.table-configuraciones tr.fila-activa td {
  border-color: #bae6fd;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 17px;
  height: 17px;
}

.btn-icon--editar {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.35);
}

.btn-icon--editar:hover {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.4);
}

.btn-icon--borrar {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-icon--borrar:hover {
  background: #fecaca;
  color: #991b1b;
}

.estado-form {
  margin: 0;
  display: flex;
  align-items: center;
}

.estado-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 2px;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.estado-picker:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.estado-picker--pendiente { border-left: 3px solid #f59e0b; }
.estado-picker--en-transporte { border-left: 3px solid #3b82f6; }
.estado-picker--en-deposito { border-left: 3px solid #8b5cf6; }
.estado-picker--entregado { border-left: 3px solid #10b981; }

.estado-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 32px 7px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  cursor: pointer;
  min-width: 148px;
  line-height: 1.2;
}

.estado-select:focus {
  outline: none;
}

.estado-picker--pendiente .estado-select { color: #92400e; }
.estado-picker--en-transporte .estado-select { color: #1e40af; }
.estado-picker--en-deposito .estado-select { color: #5b21b6; }
.estado-picker--entregado .estado-select { color: #047857; }

.table-listado .cell-acciones {
  text-align: right;
  padding-right: 16px;
}

.table-listado thead th:last-child {
  text-align: right;
  padding-right: 16px;
}

.table-editable .input-cell {
  width: 100%;
  min-width: 100px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fafafa;
}

.table-editable .input-cell:focus {
  background: #fff;
  border-color: var(--accent);
  outline: none;
}

.table-editable .input-num {
  max-width: 110px;
  text-align: right;
}

.table-editable td {
  vertical-align: middle;
}

/* —— Liquidación (mismo estilo que Viajes/Pedidos) —— */
.form-grid--toolbar {
  margin-bottom: 16px;
}

.field-check .chk-todos {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.col-chk {
  width: 44px;
  text-align: center;
}

.col-chk input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.liq-seleccion {
  margin-top: 8px;
  margin-bottom: 0;
}

.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

.field select:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.field-cliente .input-nuevo-cliente {
  margin-top: 8px;
}

.col-debe {
  color: #1e40af;
}

.col-haber {
  color: #9d174d;
}

.col-saldo {
  font-weight: 600;
  color: #0f172a;
}

.card-header-row,
.page-header--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header-row {
  margin-bottom: 12px;
}

.page-header--actions .subtitle {
  margin-top: 4px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px 24px;
  margin: 0;
}

.detalle-item {
  margin: 0;
}

.detalle-item dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 4px;
}

.detalle-item dd {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.detalle-hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.detalle-item--total {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.detalle-item--total .total-viaje {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.cell-acciones .acciones-toolbar {
  min-width: 280px;
}

.field-choferes .label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field-choferes-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row-bultos-choferes .field-choferes-body {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.choferes-checklist {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

.check-row input {
  width: auto;
  margin: 0;
}

.field-chofer-nuevo {
  flex: 1;
  min-width: min(100%, 220px);
  margin: 0;
}

.field-chofer-nuevo label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.field-choferes .field-hint {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 6px 0 0;
  width: 100%;
}

@media (max-width: 720px) {
  .row-bultos-choferes {
    grid-template-columns: 1fr;
  }
}

.card-header-row h2 {
  margin-bottom: 0;
}

#libro-liquidaciones,
#filtros-liquidacion {
  scroll-margin-top: 16px;
}

@media (max-width: 640px) {
  .layout:not(.collapsed) .sidebar {
    position: fixed;
    z-index: 100;
    height: 100vh;
  }

  .main {
    padding: 0 16px 16px;
  }

  .topbar {
    margin: 0 -16px 16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .global-search-wrap {
    flex-direction: column;
  }

  .global-search-btn {
    width: 100%;
  }
}

/* —— Dashboard —— */
.dash-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  padding: 28px 28px 22px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius);
  color: #f8fafc;
  box-shadow: var(--shadow);
}

.dash-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  width: 100%;
}

.dash-hero-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dash-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
}

.dash-fecha-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-fecha-form label {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.dash-fecha-form input {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #334155;
  color: #f8fafc;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dash-kpi {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-kpi-ok { border-left-color: #22c55e; }
.dash-kpi-warn { border-left-color: #f59e0b; }
.dash-kpi-money { border-left-color: #6366f1; }
.dash-kpi-alert { border-left-color: #0ea5e9; }
.dash-kpi-danger { border-left-color: #ef4444; }

.dash-kpi-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.dash-kpi-money .dash-kpi-value {
  font-size: 1.35rem;
}

.dash-kpi-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 2px;
}

.dash-kpi-link:hover {
  text-decoration: underline;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}

.dash-charts h2,
.dash-movimientos h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.dash-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-chart-box h3 {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.dash-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-feed-item {
  display: grid;
  grid-template-columns: 52px 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.dash-feed-item:last-child {
  border-bottom: none;
}

.dash-feed-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dash-feed-icon {
  font-size: 1rem;
  text-align: center;
}

.dash-feed-text {
  font-size: 0.92rem;
  line-height: 1.35;
}

.dash-empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 12px 0;
}

@media (max-width: 960px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dash-hero {
    padding: 18px 16px;
  }

  .dash-kpi-value {
    font-size: 1.5rem;
  }
}

/* —— Login —— */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0ea5e9 100%);
  padding: 20px;
}

.login-card {
  background: var(--card);
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

.login-brand {
  font-size: 1.6rem;
  text-align: center;
  color: var(--text);
}

.login-subtitle {
  text-align: center;
  color: var(--muted);
  margin: 6px 0 22px;
  font-size: 0.92rem;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.login-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
}

.login-form input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

/* —— Caja de usuario en el menú —— */
.sidebar-user {
  margin: 8px 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--sidebar-text);
}

.sidebar-user-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-rol {
  font-size: 0.72rem;
  color: var(--sidebar-text-dim);
}

.sidebar-logout {
  flex-shrink: 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.layout.collapsed .sidebar-user {
  margin: 8px auto 14px;
  padding: 6px;
  background: none;
  border: none;
}

.layout.collapsed .sidebar-user-info,
.layout.collapsed .sidebar-logout {
  display: none;
}

/* —— Usuarios y permisos —— */
.permisos-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 14px 0;
}

.permisos-fieldset legend {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 6px;
}

.permisos-fieldset--disabled {
  opacity: 0.5;
}

.permisos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 16px;
  margin-top: 8px;
}

.permiso-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.usuarios-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.usuario-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.usuario-item.open {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.12);
}

.usuario-item-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.15s ease;
}

.usuario-item-head:hover {
  background: #f1f5f9;
}

.usuario-item.open .usuario-item-head {
  background: #eff6ff;
}

.usuario-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.usuario-head-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.usuario-head-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
}

.usuario-head-sub {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-head-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.usuario-caret {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.usuario-item.open .usuario-caret {
  transform: rotate(90deg);
}

.usuario-detalle {
  display: none;
  padding: 18px 16px;
  border-top: 1px solid #e2e8f0;
}

.usuario-item.open .usuario-detalle {
  display: block;
}

.usuario-item-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
}

@media (max-width: 560px) {
  .usuario-head-sub {
    display: none;
  }
}

.reset-password-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.reset-password-form input {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 999px;
}

.badge-admin {
  background: #0ea5e9;
  color: #fff;
}

.badge-user {
  background: #e2e8f0;
  color: var(--text);
}

.badge-off {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-super {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.super-aviso {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  color: #1e3a8a;
  font-size: 0.92rem;
}

.super-aviso p + p {
  margin-top: 6px;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.92rem;
}
