:root {
  --primary: #e52520;
  --primary-dark: #b91c19;
  --primary-light: #fde3e3;
  --sidebar-bg: #1a1a1a;
  --sidebar-dark: #111111;
  --text-dark: #1a1a2e;
  --text-mid: #5a5a6e;
  --text-light: #8a8a9e;
  --bg: #f4f6f9;
  --card: #fff;
  --border: #e8eaef;
  --green: #43a047;
  --orange: #fb8c00;
  --red: #e53935;
  --purple: #7b1fa2;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text-dark);
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #f0f1f5;
}
::-webkit-scrollbar-thumb {
  background: #c0c4cc;
  border-radius: 3px;
}

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-page.hidden {
  display: none;
}
.login-box {
  display: flex;
  width: 880px;
  max-width: 95vw;
  min-height: 500px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s ease-out;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #e52520, #b91c19, #8a1512);
  padding: 44px 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}
.login-left .grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.l-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.l-brand-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.l-brand-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}
.l-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.l-brand span {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
}
.l-text {
  position: relative;
  z-index: 1;
}
.l-text h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 12px;
}
.l-text p {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}
.l-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.l-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 7px 16px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 500;
}
.l-pill svg {
  width: 15px;
  height: 15px;
  fill: rgba(255, 255, 255, 0.8);
}
.login-right {
  flex: 1;
  background: #fff;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-right h2 {
  font-size: 23px;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-right .sub {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 28px;
}
.fg {
  margin-bottom: 18px;
}
.fg label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.iw {
  position: relative;
}
.iw > svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: #9a9ab0;
  pointer-events: none;
}
.iw input {
  width: 100%;
  padding: 12px 12px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  background: #fafafe;
  transition:
    border 0.2s,
    box-shadow 0.2s;
}
.iw input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
  background: #fff;
}
.iw select {
  width: 100%;
  padding: 12px 12px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  background: #fafafe;
  cursor: pointer;
  transition:
    border 0.2s,
    box-shadow 0.2s;
}
.iw select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
  background: #fff;
}
.iw .toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.iw .toggle svg {
  width: 17px;
  height: 17px;
  fill: #9a9ab0;
}
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-mid);
}
.chk input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}
.flink {
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.15s,
    box-shadow 0.25s;
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21, 101, 192, 0.35);
}
.btn-login svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}
.btn-login.ld {
  pointer-events: none;
  opacity: 0.8;
}
.btn-login.ld .sp {
  display: block;
}
.btn-login.ld .bt,
.btn-login.ld .ba {
  display: none;
}
.sp {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.reg {
  text-align: center;
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--text-light);
}
.reg a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* APP */
.app {
  display: flex;
  min-height: 100vh;
}
.sb {
  width: 240px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}
.sb-head {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sb-head .ic {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sb-head .ic svg {
  width: 19px;
  height: 19px;
  fill: #64b5f6;
}
.sb-head .ic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sb-head span {
  font-size: 16px;
  font-weight: 700;
}
.sb-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  padding: 12px 18px 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sb-nav {
  flex: 1;
  padding: 4px 10px;
  overflow-y: auto;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
  text-decoration: none;
}
.sb-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
}
.sb-item.act {
  background: linear-gradient(135deg, var(--primary), #1976d2);
  color: #fff;
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}
.sb-item svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  flex-shrink: 0;
}
.sb-item .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.sb-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 11px;
}
.sb-av {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--green), #66bb6a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  position: relative;
}
.sb-av::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  border: 2px solid var(--sidebar-dark);
}
.sb-uinfo {
  flex: 1;
}
.sb-uinfo .n {
  font-size: 12.5px;
  font-weight: 600;
}
.sb-uinfo .r {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.38);
}
.sb-out {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: rgba(255, 255, 255, 0.38);
}
.sb-out:hover {
  color: var(--red);
}
.sb-out svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.main {
  flex: 1;
  margin-left: 240px;
  background: var(--bg);
  min-height: 100vh;
}
.topbar {
  background: #fff;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar > div {
  flex: 1;
}
.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}
.topbar p {
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 1px;
}
.topbar-r {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-r input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  width: 200px;
  outline: none;
}
.topbar-r input:focus {
  border-color: var(--primary);
}
.notif {
  position: relative;
  background: var(--bg);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.notif svg {
  width: 19px;
  height: 19px;
  fill: var(--text-mid);
}
.notif::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
}
.content {
  padding: 22px 28px;
}
.page {
  display: block;
  animation: fadeIn 0.35s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* BUTTONS */
.btn {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  text-decoration: none;
}
.btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.25);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-import {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  font-size: 12.5px;
}

/* ====== UNIDADES PAGE ====== */
.unidades-header-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.unidades-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.unidades-icon svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
}
.unidades-info {
  flex: 1;
}
.unidades-info h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}
.unidades-info p {
  font-size: 12.5px;
  color: var(--text-light);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-nueva-unidad {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-nueva-unidad:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.25);
}
.btn-nueva-unidad svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.unidades-search {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 0;
}
.unidades-search input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: #fafafe
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239a9ab0'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E")
    12px center/18px no-repeat;
  transition: border 0.2s;
}
.unidades-search input:focus {
  border-color: var(--primary);
  background-color: #fff;
}

/* Ocultar botón toggle en desktop, mostrar input */
.search-toggle-btn {
  display: none;
}
.search-input-wrapper {
  display: flex;
  align-items: center;
}
.search-input-wrapper input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 200px;
}
.search-input-wrapper input:focus {
  border-color: var(--primary);
}
.search-input-wrapper .search-close-btn {
  display: none;
}

/* ====== MARCAS PAGE ====== */
.marcas-header-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.marcas-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.marcas-icon svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
}
.marcas-info {
  flex: 1;
}
.marcas-info h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}
.marcas-info p {
  font-size: 12.5px;
  color: var(--text-light);
}
.btn-nueva-marca {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-nueva-marca:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.25);
}
.btn-nueva-marca svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid #f0f1f5;
  flex-wrap: wrap;
  border-radius: var(--radius);
}
.filter-row .flabel {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-row .flabel svg {
  width: 15px;
  height: 15px;
  fill: var(--text-light);
}
.filter-row input[type="date"],
.filter-row select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-mid);
  outline: none;
  background: #fff;
  min-width: 140px;
}
.filter-row input[type="date"]:focus,
.filter-row select:focus {
  border-color: var(--primary);
}
.filter-sep {
  color: #d0d4dc;
  font-size: 12px;
}

/* Unidades Table */
.u-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 16px;
}
.u-table {
  width: 100%;
  border-collapse: collapse;
}
.u-table thead {
  background: transparent;
}
.u-table th {
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: left;
  border-bottom: 2px solid #f0f1f5;
}
.u-table td {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-mid);
  border-bottom: 1px solid #f6f7fa;
  vertical-align: middle;
}
.u-table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}
.u-table tbody tr:hover td {
  background: #fafbfe;
}

.vin-cell {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 13px;
  white-space: nowrap;
}
.vehicle-cell {
  color: var(--text-mid);
  font-size: 13px;
}
.color-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.date-cell {
  font-size: 12.5px;
  color: var(--text-light);
}

/* Novedad badge */
.novedad-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fce4ec;
  color: var(--red);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 8px;
}
.novedad-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
}

/* Status badges */
.st-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.st-badge.finalizado {
  background: #e8f5e9;
  color: #2e7d32;
}
.st-badge.no-iniciado {
  background: #f5f5f5;
  color: #757575;
}
.st-badge.en-proceso {
  background: #fde3e3;
  color: #e52520;
}
.st-badge.pendiente {
  background: #fff3e0;
  color: #e65100;
}

/* Layout badge */
.layout-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.layout-status .ls-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
}
.layout-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fde3e3;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  width: fit-content;
}
.layout-tag.bodega {
  background: #fff3e0;
  color: #e65100;
}
.layout-tag.puerto {
  background: #e8f5e9;
  color: #2e7d32;
}
.layout-tag.patio {
  background: #ede7f6;
  color: #5e35b1;
}
.layout-tag.recinto {
  background: #e3f2fd;
  color: #1565c0;
}
.layout-tag.alistamiento {
  background: #e8eaf6;
  color: #283593;
}
.layout-tag.despacho {
  background: #e8f5e9;
  color: #2e7d32;
}
.layout-tag.transito {
  background: #e1f5fe;
  color: #0277bd;
}
.layout-tag.concesionario {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* Arrow action */
.row-arrow {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f4f6f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.row-arrow:hover {
  background: var(--primary-light);
}
.row-arrow svg {
  width: 18px;
  height: 18px;
  fill: var(--text-light);
}
.row-arrow:hover svg {
  fill: var(--primary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid #f0f1f5;
}
.pag-info {
  font-size: 12.5px;
  color: var(--text-light);
}
.pag-btns {
  display: flex;
  gap: 4px;
}
.pag-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.pag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pag-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pag-btn.disabled,
.pag-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.pag-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  font-size: 12px;
  color: var(--text-light);
  user-select: none;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.kpi:hover {
  transform: translateY(-2px);
}
.kpi-l {
  flex: 1;
  min-width: 0;
}
.kpi-l .kpi-lab {
  font-size: 11.5px;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 3px;
}
.kpi-l .kpi-val {
  font-size: 26px;
  font-weight: 700;
}
.kpi-l .kpi-ch {
  font-size: 11px;
  margin-top: 2px;
}
.kpi-ch.up {
  color: var(--green);
}
.kpi-ch.down {
  color: var(--red);
}
.kpi-ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-ic svg {
  width: 22px;
  height: 22px;
}
.kpi-ic.bl {
  background: var(--primary-light);
}
.kpi-ic.bl svg {
  fill: var(--primary);
}
.kpi-ic.gr {
  background: #e8f5e9;
}
.kpi-ic.gr svg {
  fill: var(--green);
}
.kpi-ic.or {
  background: #fff3e0;
}
.kpi-ic.or svg {
  fill: var(--orange);
}
.kpi-ic.re {
  background: #fce4ec;
}
.kpi-ic.re svg {
  fill: var(--red);
}
.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-t {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-t svg {
  width: 17px;
  height: 17px;
  fill: var(--primary);
}
.ch-box {
  position: relative;
  height: 210px;
}
.bot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Próximos Arribos */
.arr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #f8f9fc;
  border-radius: 9px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.arr-item:hover {
  background: #f0f2f8;
}
.arr-item:active {
  background: #e8eaef;
}
.arr-item:last-child {
  margin-bottom: 0;
}
.arr-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.arr-dot-primary {
  background: var(--primary);
}
.arr-dot-green {
  background: var(--green);
}
.arr-dot-orange {
  background: var(--orange);
}
.arr-dot-purple {
  background: var(--purple);
}
.arr-info {
  flex: 1;
  min-width: 0;
}
.arr-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
}
.arr-subtitle {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}
.arr-time {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* Actividad Reciente */
.act-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8f9fc;
  border-radius: 9px;
  margin-bottom: 8px;
  transition: background 0.2s;
}
.act-item:hover {
  background: #f0f2f8;
}
.act-item:last-child {
  margin-bottom: 0;
}
.act-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.act-icon svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}
.act-icon-primary {
  background: var(--primary);
}
.act-icon-orange {
  background: var(--orange);
}
.act-icon-red {
  background: var(--red);
}
.act-icon-green {
  background: var(--green);
}
.act-content {
  flex: 1;
  min-width: 0;
}
.act-text {
  font-size: 12.5px;
  color: var(--text-dark);
  margin-bottom: 3px;
  line-height: 1.4;
}
.act-text strong {
  font-weight: 600;
}
.act-time {
  font-size: 11px;
  color: var(--text-light);
}

/* ====== DETALLE UNIDAD ====== */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
  transition: all 0.2s;
}
.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.back-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.detail-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: visible;
}
.detail-vin {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.detail-vin h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  word-break: break-word;
}
.detail-vin .st-badge {
  font-size: 12px;
}
.detail-meta {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.detail-dates {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.detail-date-item {
  font-size: 12.5px;
}
.detail-date-item strong {
  display: block;
  color: var(--text-mid);
  margin-bottom: 2px;
}
.detail-date-item span {
  color: var(--text-light);
}

/* Grid de 2 columnas para detalle */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.detail-grid .detail-card {
  margin-bottom: 0;
}

/* Flujo Logístico */
.flujo-section {
  margin-top: 24px;
  overflow: visible;
}
.flujo-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 16px;
}
.flujo-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 28px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 0;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.flujo-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  padding: 0 10px;
}
.flujo-step-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9e9e9e;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
  transition: all 0.3s;
}
.flujo-step.completed .flujo-step-dot {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 10px rgba(46, 125, 50, 0.25);
}
.flujo-step.current .flujo-step-dot {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(21, 101, 192, 0.4);
  animation: pulse 2s infinite;
}
.flujo-step.pending .flujo-step-dot {
  background: #f5f5f5;
  color: #bdbdbd;
  border: 2px dashed #e0e0e0;
}
.flujo-step-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.flujo-step-sublabel {
  font-size: 10.5px;
  color: var(--text-mid);
  text-align: center;
  margin-bottom: 3px;
}
.flujo-step-date {
  font-size: 10px;
  color: var(--text-light);
  text-align: center;
  font-weight: 500;
}
.flujo-step-chofer {
  font-size: 9px;
  color: var(--primary);
  text-align: center;
  font-weight: 600;
  margin-top: 2px;
}
.flujo-step::after {
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  width: 100%;
  height: 3px;
  background: #e0e0e0;
  z-index: 1;
}
.flujo-step.completed::after {
  background: linear-gradient(90deg, var(--green), var(--green));
}
.flujo-step.current::after {
  background: linear-gradient(90deg, var(--green), #e0e0e0);
}
.flujo-step:last-child::after {
  display: none;
}

/* Nodo intermedio - Días en bodega */
.flujo-step.flujo-step-dias {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}
.flujo-step-dias .flujo-dias-dot {
  background: #81d4fa !important;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(129, 212, 250, 0.3) !important;
}
.flujo-step-dias.completed .flujo-dias-dot {
  background: #81d4fa !important;
}
.flujo-step-dias.pending .flujo-dias-dot {
  background: #f5f5f5 !important;
  color: #bdbdbd !important;
  border: 2px dashed #e0e0e0 !important;
  box-shadow: none !important;
}
.flujo-step-dias.completed::after {
  background: #81d4fa !important;
}
.flujo-step-dias .flujo-step-label {
  color: #81d4fa;
}
.flujo-step-dias.pending .flujo-step-label {
  color: #bdbdbd;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 2px 12px rgba(21, 101, 192, 0.4);
  }
  50% {
    box-shadow: 0 2px 20px rgba(21, 101, 192, 0.6);
  }
}

/* Novedades */
.novedad-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #fff8e1;
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  margin-bottom: 12px;
}
.novedad-icon {
  width: 20px;
  height: 20px;
  fill: var(--orange);
  flex-shrink: 0;
}
.novedad-content {
  flex: 1;
}
.novedad-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}
.novedad-desc {
  font-size: 12px;
  color: var(--text-mid);
}
.novedad-step {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 3px;
  font-style: italic;
}
.novedad-status {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--orange);
  color: #fff;
  border-radius: 12px;
  white-space: nowrap;
}
.novedad-icon-ok {
  fill: var(--green);
}
.novedad-ok {
  opacity: 0.7;
}
.novedad-ok .novedad-title {
  font-weight: 500;
}
.novedad-status-ok {
  background: var(--green);
}

/* Órdenes de Trabajo */
.ot-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ot-item:last-child {
  margin-bottom: 0;
}
.ot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ot-codigo {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.ot-tipo {
  font-size: 11px;
  padding: 2px 10px;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 12px;
  font-weight: 500;
}
.ot-prioridad {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.ot-prio-alta {
  background: #fde3e3;
  color: var(--red);
}
.ot-prio-media {
  background: #fff3e0;
  color: #e65100;
}
.ot-prio-baja {
  background: #e8f5e9;
  color: #2e7d32;
}
.ot-estado {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
  margin-left: auto;
}
.ot-estado-completada {
  background: #e8f5e9;
  color: var(--green);
}
.ot-estado-proceso {
  background: #fff3e0;
  color: var(--orange);
}
.ot-body {
  padding-left: 2px;
}
.ot-desc {
  font-size: 12.5px;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.ot-meta {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ot-obs {
  font-size: 11px;
  color: var(--text-mid);
  font-style: italic;
  margin-top: 6px;
  padding: 6px 10px;
  background: #f8f9fb;
  border-radius: 6px;
}

/* Historial Table */
.historial-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}
.historial-table thead {
  background: #f8f9fc;
}
.historial-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 2px solid #f0f1f5;
}
.historial-table td {
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-mid);
  border-bottom: 1px solid #f6f7fa;
}
.historial-table tbody tr:hover {
  background: #fafbfe;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 22px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show {
  transform: translateX(0);
}
.toast.success {
  background: #2e7d32;
}
.toast.error {
  background: #c62828;
}
.toast svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ====== MOBILE RESPONSIVE ====== */

/* Hamburger Menu Button */
.menu-toggle {
  display: none;
  background: transparent;
  color: var(--text-dark);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.menu-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.menu-toggle:hover {
  background: var(--bg);
}
.menu-toggle:active {
  background: #e8eaef;
}

/* Overlay para cerrar sidebar en mobile */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 49;
  opacity: 0;
  transition: opacity 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.sb-overlay.show {
  display: block;
  opacity: 1;
}

/* Mejorar elementos táctiles en móvil */
@media (max-width: 768px) {
  button,
  a,
  .btn,
  .sb-item {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Large Tablet/Small Desktop (1024px - 1280px) */
@media (max-width: 1280px) and (min-width: 1025px) {
  .kpi-grid {
    gap: 14px;
  }
  .charts-grid {
    gap: 14px;
  }
  .bot-grid {
    gap: 14px;
  }
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .sb {
    width: 220px;
  }
  .main {
    margin-left: 220px;
  }
  .topbar {
    padding: 14px 24px;
  }
  .content {
    padding: 18px 24px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .bot-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
  /* Sidebar mobile */
  .menu-toggle {
    display: flex;
  }
  .sb {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
    max-width: 85vw;
  }
  .sb.active {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    width: 100%;
  }

  /* Topbar mobile - Con botón hamburguesa integrado */
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .topbar > div {
    flex: 1;
    min-width: 0;
  }
  .topbar h1 {
    font-size: 18px;
  }
  .topbar p {
    font-size: 11px;
  }
  .topbar-r {
    width: 100%;
    margin-top: 8px;
    gap: 8px;
  }
  .topbar-r input {
    width: 100%;
    flex: 1;
  }

  /* Content padding */
  .content {
    padding: 16px;
    overflow-x: hidden;
  }

  /* KPI Cards - Cuadrícula 2x2 en móvil con iconos a los lados */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .kpi {
    padding: 12px;
    min-height: auto;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  .kpi-l {
    flex: 1;
    min-width: 0;
  }
  .kpi-l .kpi-lab {
    font-size: 10px;
    line-height: 1.3;
  }
  .kpi-l .kpi-val {
    font-size: 18px;
    line-height: 1.2;
  }
  .kpi-l .kpi-ch {
    font-size: 9.5px;
    margin-top: 2px;
  }
  .kpi-ic {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  .kpi-ic svg {
    width: 18px;
    height: 18px;
  }

  /* Charts - Una sola columna en móvil */
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }
  .card {
    padding: 16px;
    overflow: hidden;
  }
  .card-t {
    font-size: 13.5px;
    margin-bottom: 12px;
    gap: 6px;
    font-weight: 600;
  }
  .card-t svg {
    width: 16px;
    height: 16px;
  }
  .ch-box {
    height: 220px;
  }
  canvas {
    max-width: 100%;
    height: auto !important;
  }

  /* Dashboard specific - Próximos Arribos */
  .arr-item {
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  .arr-dot {
    width: 8px;
    height: 8px;
  }
  .arr-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .arr-subtitle {
    font-size: 10.5px;
  }
  .arr-time {
    font-size: 11px;
  }

  /* Dashboard specific - Actividad Reciente */
  .act-item {
    padding: 9px 10px;
  }
  .act-icon {
    width: 32px;
    height: 32px;
  }
  .act-icon svg {
    width: 16px;
    height: 16px;
  }
  .act-text {
    font-size: 12px;
    line-height: 1.4;
  }
  .act-time {
    font-size: 10px;
  }

  /* Bot grid - Una sola columna en móvil */
  .bot-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Unidades page */
  .unidades-header-box {
    padding: 16px 18px;
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .unidades-icon {
    width: 46px;
    height: 46px;
  }
  .unidades-icon svg {
    width: 24px;
    height: 24px;
  }
  .unidades-info h2 {
    font-size: 16px;
  }
  .unidades-info p {
    font-size: 11.5px;
  }

  /* Header actions */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .btn-nueva-unidad {
    flex: 1;
    justify-content: center;
  }

  /* Botón de búsqueda en header */
  .search-toggle-btn {
    background: var(--primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
  }
  .search-toggle-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
  }
  .search-toggle-btn:active {
    transform: scale(0.95);
  }

  /* Botón nueva unidad - mantener visible en header */
  .btn-nueva-unidad {
    font-size: 12px;
    padding: 9px 16px;
  }
  .btn-nueva-unidad svg {
    width: 15px;
    height: 15px;
  }

  /* Ocultar búsqueda desktop */
  .unidades-search {
    display: none;
  }

  /* Marcas page */
  .marcas-header-box {
    padding: 16px 18px;
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .marcas-icon {
    width: 46px;
    height: 46px;
  }
  .marcas-icon svg {
    width: 24px;
    height: 24px;
  }
  .marcas-info h2 {
    font-size: 16px;
  }
  .marcas-info p {
    font-size: 11.5px;
  }
  .btn-nueva-marca {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    padding: 9px 16px;
  }
  .btn-nueva-marca svg {
    width: 15px;
    height: 15px;
  }

  /* Tabla Marcas - Cards en móvil */
  .page:has(table.gen) .tbl-wrap {
    background: transparent;
    box-shadow: none;
  }

  table.gen {
    border: none;
  }

  table.gen thead {
    display: none;
  }

  table.gen tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  table.gen tr {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: none;
  }

  table.gen td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid #f4f5f8;
  }

  table.gen tr:hover td {
    background: transparent;
  }

  table.gen td:last-child {
    border-bottom: none;
  }

  table.gen td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  table.gen td:nth-child(1) {
    background: #f8f9fc;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
  }

  table.gen td:nth-child(2) strong {
    font-size: 14px;
    color: var(--text-dark);
  }

  table.gen td:nth-child(3) {
    font-size: 12.5px;
    color: var(--text-mid);
  }

  table.gen td:nth-child(4) {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  table.gen td:nth-child(4) .badge-st {
    align-self: flex-end;
  }

  table.gen td:nth-child(5) {
    background: #f8f9fc;
    padding: 12px 16px;
  }

  table.gen td:nth-child(5):before {
    display: none;
  }

  .td-actions {
    width: 100%;
    gap: 8px;
  }

  .td-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 16px;
    font-size: 12px;
  }

  .td-actions .btn svg {
    width: 16px;
    height: 16px;
  }

  .td-actions .btn:active {
    transform: scale(0.98);
  }

  /* Filtros compactos en móvil */
  .filter-row {
    padding: 10px 16px;
    gap: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
  .filter-row .flabel {
    grid-column: 1/-1;
    font-size: 10.5px;
    margin-bottom: 2px;
    gap: 4px;
  }
  .filter-row .flabel svg {
    width: 13px;
    height: 13px;
  }
  .filter-row .filter-sep {
    display: none;
  }
  .filter-row input[type="date"],
  .filter-row select {
    min-width: auto;
    width: 100%;
    flex: none;
    font-size: 12px;
    padding: 8px 10px;
    min-height: 38px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  .filter-row select {
    grid-column: 1/-1;
  }

  /* Wrapper del input de búsqueda */
  .search-input-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 16px;
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .search-input-wrapper.active {
    transform: translateY(0);
  }
  .search-input-wrapper input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
  }
  .search-input-wrapper input:focus {
    border-color: var(--primary);
  }
  .search-close-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-mid);
  }
  .search-close-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
  }
  .search-close-btn:active {
    color: var(--primary);
  }

  /* Mejorar inputs en general para móvil */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Tabla responsive - modo card en móvil */
  .u-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    box-shadow: none;
  }
  .u-table thead {
    display: none;
  }
  .u-table,
  .u-table tbody,
  .u-table tr,
  .u-table td {
    display: block;
    width: 100%;
  }
  .u-table tr {
    background: #fff;
    margin-bottom: 12px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    position: relative;
    border: 1px solid var(--border);
    cursor: pointer;
  }
  .u-table tr:hover td {
    background: transparent;
  }
  .u-table tr:active {
    background: #fafbfe;
  }
  .u-table td {
    padding: 0;
    margin-bottom: 10px;
    border: none;
    font-size: 13px;
    word-wrap: break-word;
  }
  .u-table td:last-child {
    margin-bottom: 0;
  }
  .u-table td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 10px;
    color: var(--text-light);
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .u-table td:last-child {
    display: none;
  }
  .u-table td:nth-child(1) {
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f1f5;
  }
  .u-table td:nth-child(2),
  .u-table td:nth-child(3) {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }
  .u-table td:nth-child(3) {
    margin-left: 0;
  }
  .vin-cell {
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
    line-height: 1.3;
    color: var(--text-dark);
  }
  .vehicle-cell {
    font-size: 12.5px;
  }
  .novedad-badge {
    margin-left: 0;
    margin-top: 8px;
    display: inline-flex;
    font-size: 10px;
    padding: 3px 9px;
  }
  .color-cell {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .color-dot {
    width: 12px;
    height: 12px;
  }
  .layout-status .ls-title {
    font-size: 13px;
    margin-bottom: 4px;
  }
  .layout-tag {
    font-size: 10px;
    padding: 3px 9px;
  }
  .row-arrow {
    display: none;
  }

  /* Pagination */
  .pagination {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 16px;
  }
  .pag-info {
    font-size: 12px;
    text-align: center;
  }
  .pag-btns {
    justify-content: center;
  }
  .pag-btn {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  /* Detail page */
  .detail-header {
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .back-btn {
    font-size: 12px;
    padding: 8px 12px;
    min-height: 40px;
    width: auto;
  }

  .detail-card {
    padding: 16px;
    margin-bottom: 16px;
    overflow: visible;
  }
  .detail-vin {
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .detail-vin h2 {
    font-size: 17px;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
  }
  .detail-vin .st-badge {
    font-size: 10px;
    padding: 3px 12px;
    flex-shrink: 0;
  }
  .detail-meta {
    font-size: 12px;
    margin-bottom: 14px;
    line-height: 1.5;
  }
  .detail-dates {
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }
  .detail-date-item {
    font-size: 12px;
    padding: 8px 0;
  }
  .detail-date-item strong {
    font-size: 11px;
    display: block;
    margin-bottom: 4px;
  }

  /* Flujo timeline - vertical en mobile */
  .flujo-section {
    margin-top: 18px;
    overflow: visible;
  }
  .flujo-title {
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 600;
  }
  .flujo-timeline {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    overflow: visible;
    gap: 0;
  }
  .flujo-step {
    min-width: 100%;
    width: 100%;
    max-width: 100%;
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
    position: relative;
  }
  .flujo-step:last-child {
    margin-bottom: 0;
  }
  .flujo-step-dot {
    width: 40px;
    height: 40px;
    font-size: 12px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .flujo-step > div:last-child {
    flex: 1;
    min-width: 0;
  }
  .flujo-step-label {
    font-size: 11.5px;
    margin-bottom: 3px;
    line-height: 1.4;
    padding: 0;
    text-align: left;
    font-weight: 600;
  }
  .flujo-step-sublabel {
    font-size: 10.5px;
    margin-bottom: 3px;
    line-height: 1.4;
    padding: 0;
    text-align: left;
    color: var(--text-mid);
  }
  .flujo-step-date {
    font-size: 9.5px;
    line-height: 1.3;
    padding: 0;
    text-align: left;
    color: var(--text-light);
  }
  .flujo-step-chofer {
    font-size: 8.5px;
    text-align: left;
  }
  .flujo-step::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 40px;
    width: 3px;
    height: calc(100% + 22px);
    background: #e0e0e0;
    z-index: 1;
  }
  .flujo-step:last-child::after {
    display: none;
  }
  .flujo-step.completed::after {
    background: var(--green);
  }

  /* Nodo intermedio - Días en bodega (tablet) */
  .flujo-step-dias.completed::after {
    background: #81d4fa !important;
  }

  /* Detail grid */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Novedad */
  .novedad-item {
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .novedad-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  .novedad-content {
    flex: 1;
    min-width: 0;
  }
  .novedad-title {
    font-size: 12px;
    line-height: 1.4;
  }
  .novedad-desc {
    font-size: 11px;
    line-height: 1.5;
    margin-top: 2px;
  }
  .novedad-status {
    font-size: 10px;
    padding: 3px 10px;
    white-space: nowrap;
    align-self: flex-start;
  }

  /* Historial table - card mode */
  .historial-table {
    font-size: 11px;
  }
  .historial-table thead {
    display: none;
  }
  .historial-table,
  .historial-table tbody,
  .historial-table tr,
  .historial-table td {
    display: block;
  }
  .historial-table tr {
    background: #fafbfe;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #f0f1f5;
  }
  .historial-table td {
    padding: 6px 0;
    border: none;
    font-size: 12px;
  }
  .historial-table td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 10px;
    color: var(--text-light);
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
  }

  /* Marcas page */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header h2 {
    font-size: 17px;
  }
  .page-header .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .filter-bar {
    flex-direction: column;
    gap: 10px;
  }
  .filter-bar input,
  .filter-bar select {
    width: 100%;
    min-height: 44px;
  }
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    box-shadow: none;
  }
  table.gen thead {
    display: none;
  }
  table.gen,
  table.gen tbody,
  table.gen tr,
  table.gen td {
    display: block;
    width: 100%;
  }
  table.gen tr {
    background: #fff;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
  }
  table.gen tr:active {
    background: #fafbfe;
  }
  table.gen td {
    padding: 6px 0;
    border: none;
    font-size: 13px;
    word-wrap: break-word;
  }
  table.gen td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 10px;
    color: var(--text-light);
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
  }
  table.gen td:last-child {
    position: absolute;
    top: 12px;
    right: 12px;
  }
  table.gen td:last-child:before {
    display: none;
  }
  .td-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  /* Novedades page */
  .tabs {
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    justify-content: center;
    padding: 4px;
  }
  .tab {
    padding: 10px 18px;
    font-size: 12.5px;
    white-space: nowrap;
    min-height: 44px;
    font-weight: 600;
  }

  table.tickets thead {
    display: none;
  }
  table.tickets,
  table.tickets tbody,
  table.tickets tr,
  table.tickets td {
    display: block;
    width: 100%;
  }
  table.tickets tr {
    background: #fff;
    margin-bottom: 14px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    overflow: hidden;
  }
  table.tickets tr:active {
    background: #fafbfe;
    transform: scale(0.98);
  }
  table.tickets td {
    padding: 0;
    border: none;
    font-size: 13px;
    word-wrap: break-word;
  }
  table.tickets td:before {
    display: none;
  }

  /* Ticket Header - #ID y Fecha */
  table.tickets td:nth-child(1) {
    background: #f8f9fc;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  table.tickets td:nth-child(1) .ticket-fecha {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
  }
  table.tickets td:nth-child(1) .ticket-fecha .f:first-child {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
  }
  table.tickets td:nth-child(1) .ticket-fecha .f:last-of-type {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dark);
  }
  table.tickets td:nth-child(1) .ticket-fecha .h {
    font-size: 10.5px;
    color: var(--text-light);
    margin-left: auto;
  }

  /* VIN y Vehículo */
  table.tickets td:nth-child(2) {
    padding: 14px 16px 12px;
  }
  table.tickets td:nth-child(2) strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: block;
    margin-bottom: 4px;
  }
  table.tickets td:nth-child(2) small {
    font-size: 12px;
  }

  /* Ubicación / Layout */
  table.tickets td:nth-child(3) {
    padding: 0 16px 12px;
    font-size: 12px;
    line-height: 1.6;
  }
  table.tickets td:nth-child(3) svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Descripción con imagen */
  table.tickets td:nth-child(4) {
    padding: 0 16px 14px;
  }
  .ticket-desc {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }
  .ticket-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .ticket-text {
    flex: 1;
    min-width: 0;
  }
  .ticket-text-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 4px;
  }
  .ticket-text-sub {
    font-size: 11.5px;
    color: var(--text-mid);
    line-height: 1.5;
  }

  /* Badges - Severidad y Estado con títulos */
  table.tickets td:nth-child(5),
  table.tickets td:nth-child(6) {
    display: inline-flex;
    flex-direction: column;
    width: auto;
    padding: 0 8px 14px 16px;
    gap: 6px;
  }
  table.tickets td:nth-child(5) {
    padding-left: 16px;
  }
  table.tickets td:nth-child(5):before,
  table.tickets td:nth-child(6):before {
    display: block !important;
    font-weight: 600;
    font-size: 9px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
  }
  table.tickets td:nth-child(5):before {
    content: "Severidad";
  }
  table.tickets td:nth-child(6):before {
    content: "Estado";
  }
  .badge-sev,
  .badge-estado {
    font-size: 10px;
    padding: 4px 12px;
    white-space: nowrap;
    border-radius: 16px;
    width: fit-content;
  }

  /* Botón de acción - Ancho completo */
  table.tickets td:nth-child(7) {
    padding: 0 16px 14px;
    width: 100%;
  }
  .btn-atender {
    font-size: 12px;
    padding: 10px 16px;
    min-height: 44px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
  }
  .btn-atender svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Detalle Novedad page */
  .detalle-novedad-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }
  .nov-back {
    font-size: 12px;
    padding: 8px 12px;
    min-height: 40px;
  }
  .nov-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .nov-card,
  .nov-card-left {
    padding: 16px;
    word-wrap: break-word;
  }
  .nov-card-left {
    border-left-width: 3px;
  }
  .nov-card-right {
    gap: 16px;
  }
  .nov-top-right {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .nov-badges {
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .badge-ticket,
  .badge-sev-detail {
    font-size: 10.5px;
    padding: 5px 14px;
    white-space: nowrap;
  }
  .nov-vin {
    font-size: 16px;
    margin-bottom: 8px;
    word-break: break-word;
    line-height: 1.3;
  }
  .nov-vehiculo {
    font-size: 12px;
    margin-bottom: 16px;
    line-height: 1.4;
  }
  .nov-info {
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
  .nov-info-item {
    font-size: 11.5px;
    line-height: 1.4;
  }
  .nov-info-item svg {
    width: 14px;
    height: 14px;
  }
  .btn-gestionar {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    padding: 9px 16px;
    min-height: 44px;
  }
  .nov-section {
    margin-top: 16px;
  }
  .nov-section-title {
    font-size: 13.5px;
    margin-bottom: 10px;
    font-weight: 600;
  }
  .nov-reporte-img {
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    height: auto;
    border-radius: 8px;
  }
  .nov-reporte-desc {
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.5;
  }
  .nov-form {
    margin-top: 0;
  }
  .nov-form-actions {
    margin-bottom: 10px;
  }
  .nov-textarea {
    min-height: 90px;
    font-size: 14px;
    padding: 12px;
    margin-bottom: 10px;
    line-height: 1.5;
  }
  .nov-checkbox {
    margin-bottom: 12px;
  }
  .nov-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
  }
  .nov-checkbox label {
    font-size: 12px;
    line-height: 1.4;
  }
  .btn-agregar {
    font-size: 12px;
    padding: 10px 16px;
    min-height: 44px;
  }
  .btn-foto {
    font-size: 11px;
    padding: 7px 12px;
    min-height: 40px;
  }
  .btn-foto svg {
    width: 15px;
    height: 15px;
  }
  .historial-entry {
    padding: 12px;
  }
  .historial-entry-icon {
    width: 13px;
    height: 13px;
  }
  .historial-entry-date {
    font-size: 10px;
  }
  .historial-entry-text {
    font-size: 11.5px;
    line-height: 1.5;
  }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
  /* Login page */
  .login-page {
    padding: 0;
  }
  .login-box {
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
  }
  .login-left {
    padding: 32px 24px 28px;
    min-height: auto;
    flex: 0;
  }
  .l-brand {
    margin-bottom: 16px;
  }
  .l-brand-icon {
    width: 36px;
    height: 36px;
  }
  .l-brand-icon svg {
    width: 20px;
    height: 20px;
  }
  .l-brand span {
    font-size: 18px;
  }
  .l-text {
    margin-bottom: 16px;
  }
  .l-text h1 {
    font-size: 22px;
    line-height: 1.3;
  }
  .l-text p {
    font-size: 12px;
    line-height: 1.5;
  }
  .l-pills {
    gap: 8px;
  }
  .l-pill {
    padding: 6px 14px;
    font-size: 11px;
  }
  .login-right {
    padding: 28px 24px;
    flex: 1;
  }
  .login-right h2 {
    font-size: 19px;
  }
  .login-right .sub {
    font-size: 12px;
  }
  .fg {
    margin-bottom: 16px;
  }
  .iw input {
    padding: 11px 11px 11px 40px;
    font-size: 14px;
  }
  .btn-login {
    padding: 12px;
    font-size: 14px;
  }
  .reg {
    font-size: 12px;
  }

  /* Sidebar y menú hamburguesa */
  .menu-toggle {
    width: 38px;
    height: 38px;
  }
  .menu-toggle svg {
    width: 22px;
    height: 22px;
  }
  .sb {
    width: 260px;
    max-width: 80vw;
  }
  .sb-item {
    font-size: 14px;
    padding: 12px 14px;
  }

  /* Topbar ajustado */
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 16px;
  }
  .topbar p {
    font-size: 10.5px;
  }

  /* Filtros aún más compactos */
  .filter-row {
    padding: 8px 14px;
    gap: 5px;
  }
  .filter-row .flabel {
    font-size: 10px;
  }
  .filter-row input[type="date"],
  .filter-row select {
    font-size: 11.5px;
    padding: 7px 9px;
    min-height: 43px;
  }

  /* Botón de búsqueda más pequeño */
  .search-toggle-btn {
    width: 40px;
    height: 40px;
  }
  .search-toggle-btn svg {
    width: 18px;
    height: 18px;
  }

  .search-input-wrapper {
    padding: 10px 14px;
  }
  .search-input-wrapper input {
    font-size: 13px;
    padding: 9px 12px;
  }
  .search-close-btn {
    width: 34px;
    height: 34px;
  }
  .search-close-btn svg {
    width: 22px;
    height: 22px;
  }

  /* KPI - Mantener cuadrícula 2x2 con iconos a los lados */
  .kpi-grid {
    gap: 8px;
  }
  .kpi {
    padding: 10px;
    gap: 6px;
  }
  .kpi-l .kpi-lab {
    font-size: 9.5px;
    line-height: 1.3;
  }
  .kpi-l .kpi-val {
    font-size: 16px;
    line-height: 1.2;
  }
  .kpi-l .kpi-ch {
    font-size: 9px;
    margin-top: 1px;
  }
  .kpi-ic {
    width: 32px;
    height: 32px;
  }
  .kpi-ic svg {
    width: 16px;
    height: 16px;
  }

  /* Charts Dashboard */
  .ch-box {
    height: 200px !important;
  }
  .card-t {
    font-size: 12.5px !important;
  }
  .arr-title {
    font-size: 11px !important;
  }
  .act-item > div:last-child > div:first-child {
    font-size: 11px !important;
  }

  /* Buttons */
  .btn {
    font-size: 12px;
    padding: 8px 14px;
    min-height: 40px;
  }
  .btn-sm {
    padding: 7px 12px;
    font-size: 11px;
    min-height: 36px;
  }
  .btn svg {
    width: 15px;
    height: 15px;
  }
  .btn-nueva-unidad {
    font-size: 11.5px;
    padding: 8px 14px;
  }
  .btn-nueva-unidad svg {
    width: 14px;
    height: 14px;
  }

  /* Toast */
  .toast {
    left: 16px;
    right: 16px;
    top: 16px;
    font-size: 12px;
  }

  /* Detail */
  .detail-card {
    padding: 14px;
  }
  .detail-vin {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .detail-vin h2 {
    font-size: 15px;
    word-break: break-all;
  }
  .detail-vin .st-badge {
    font-size: 9px;
    padding: 2px 10px;
  }
  .detail-meta {
    font-size: 11px;
  }
  .detail-date-item strong {
    font-size: 10px;
  }
  .detail-date-item span {
    font-size: 11px;
  }

  /* Flujo - vertical en mobile small */
  .flujo-section {
    margin-top: 16px;
  }
  .flujo-title {
    font-size: 13px;
    margin-bottom: 12px;
  }
  .flujo-timeline {
    padding: 12px 16px;
  }
  .flujo-step {
    min-width: 100%;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin-bottom: 20px;
  }
  .flujo-step-dot {
    width: 34px;
    height: 34px;
    font-size: 11px;
    margin-bottom: 0;
  }
  .flujo-step-label {
    font-size: 10px;
    line-height: 1.4;
    padding: 0;
    margin-bottom: 2px;
  }
  .flujo-step-sublabel {
    font-size: 9px;
    line-height: 1.4;
    padding: 0;
    margin-bottom: 2px;
  }
  .flujo-step-date {
    font-size: 8.5px;
    line-height: 1.3;
    padding: 0;
  }
  .flujo-step-chofer {
    font-size: 8px;
    text-align: left;
  }
  .flujo-step::after {
    left: 17px;
    top: 34px;
    width: 3px;
    height: calc(100% + 20px);
  }

  /* Nodo intermedio - Días en bodega (mobile) */
  .flujo-step-dias.completed::after {
    background: #81d4fa !important;
  }

  /* Cards spacing */
  .card {
    padding: 14px;
  }
  .card-t {
    font-size: 13px;
    margin-bottom: 12px;
  }

  /* Unidades mobile cards */
  .u-table tr {
    padding: 10px 12px;
  }
  .u-table td {
    margin-bottom: 8px;
    font-size: 12px;
  }
  .u-table td:nth-child(1) {
    padding-bottom: 8px;
  }
  .u-table td:before {
    font-size: 9.5px;
  }
  .vin-cell {
    font-size: 14px;
    line-height: 1.3;
  }
  .vehicle-cell {
    font-size: 12px;
  }
  .color-cell {
    font-size: 11.5px;
    gap: 6px;
  }
  .color-dot {
    width: 11px;
    height: 11px;
  }
  .layout-status .ls-title {
    font-size: 12px;
  }
  .layout-tag {
    font-size: 9.5px;
    padding: 3px 8px;
  }
  .st-badge {
    font-size: 9.5px;
    padding: 3px 10px;
  }
  .novedad-badge {
    font-size: 9.5px;
    padding: 3px 8px;
    margin-top: 6px;
  }

  /* Pagination mobile */
  .pagination {
    padding: 12px;
  }
  .pag-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  /* Detalle Novedad page */
  .detalle-novedad-header {
    margin-bottom: 14px;
  }
  .nov-back {
    font-size: 11px;
    padding: 7px 12px;
  }
  .nov-card,
  .nov-card-left {
    padding: 14px;
  }
  .nov-card-left {
    border-left-width: 3px;
  }
  .nov-card-right {
    gap: 14px;
  }
  .nov-top-right {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .nov-badges {
    gap: 6px;
    margin-bottom: 10px;
  }
  .badge-ticket,
  .badge-sev-detail {
    font-size: 10px;
    padding: 4px 12px;
  }
  .nov-vin {
    font-size: 14px;
    margin-bottom: 6px;
  }
  .nov-vehiculo {
    font-size: 11px;
    margin-bottom: 14px;
  }
  .nov-info {
    gap: 7px;
    margin-bottom: 14px;
  }
  .nov-info-item {
    font-size: 10.5px;
  }
  .nov-info-item svg {
    width: 13px;
    height: 13px;
  }
  .btn-gestionar {
    width: 100%;
    justify-content: center;
    font-size: 11px;
    padding: 8px 14px;
  }
  .nov-section {
    margin-top: 14px;
  }
  .nov-section-title {
    font-size: 12.5px;
    margin-bottom: 8px;
  }
  .nov-reporte-img {
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
  }
  .nov-reporte-desc {
    font-size: 11px;
    margin-bottom: 8px;
  }
  .nov-form {
    margin-top: 0;
  }
  .nov-form-actions {
    margin-bottom: 8px;
  }
  .nov-textarea {
    min-height: 85px;
    font-size: 11.5px;
    padding: 10px;
    margin-bottom: 8px;
  }
  .nov-checkbox {
    margin-bottom: 10px;
  }
  .nov-checkbox input[type="checkbox"] {
    width: 15px;
    height: 15px;
  }
  .nov-checkbox label {
    font-size: 11px;
  }
  .btn-agregar {
    font-size: 11.5px;
    padding: 9px 14px;
  }
  .btn-foto {
    font-size: 10px;
    padding: 6px 10px;
  }
  .btn-foto svg {
    width: 14px;
    height: 14px;
  }
  .historial-entry {
    padding: 10px;
  }
  .historial-entry-icon {
    width: 12px;
    height: 12px;
  }
  .historial-entry-date {
    font-size: 9.5px;
  }
  .historial-entry-text {
    font-size: 10.5px;
    line-height: 1.5;
  }
}

/* NUEVA UNIDAD */
.nueva-unidad-form {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.25s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(21, 101, 192, 0.35);
}

.btn-primary svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: #e8eaef;
  border-color: #d0d2d9;
}

.btn-secondary svg {
  width: 17px;
  height: 17px;
  fill: var(--text-mid);
}

.color-picker-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-picker-wrapper input[type="color"] {
  width: 60px;
  height: 46px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #fafafe;
  transition: border 0.2s, box-shadow 0.2s;
}

.color-picker-wrapper input[type="color"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.color-picker-wrapper input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  background: #fafafe;
  transition: border 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}

.color-picker-wrapper input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
  background: #fff;
}

/* Responsive para nueva unidad */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 42px;
  }
}

/* PLANIFICAR DESPACHO */
.nineras-selection-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ninera-selection-card {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
}

.ninera-selection-card:has(.ninera-checkbox:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.ninera-checkbox {
  width: 20px;
  height: 20px;
  margin: 16px 0 16px 16px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.ninera-selection-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 14px 12px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.ninera-selection-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ninera-selection-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--primary);
}

.ninera-selection-info {
  flex: 1;
  min-width: 0;
}

.ninera-selection-placa {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: monospace;
  margin-bottom: 3px;
}

.ninera-selection-vehiculo {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 2px;
}

.ninera-selection-empresa {
  font-size: 11.5px;
  color: var(--text-light);
}

.ninera-selection-capacidad {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.capacidad-badge {
  background: #f8f9fc;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
}

/* Asignación Header */
.asignacion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.asignacion-ninera-info {
  flex: 1;
  min-width: 0;
}

.asignacion-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.asignacion-subtitle {
  font-size: 12.5px;
  color: var(--text-mid);
}

.progress-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.progress-badge.warning {
  background: #fff3e0;
  color: #e65100;
}

.progress-badge.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.progress-badge.error {
  background: #ffebee;
  color: #c62828;
}

/* Add Vehiculo Group */
.add-vehiculo-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.btn-add-vehiculo {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-add-vehiculo:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.btn-add-vehiculo:disabled {
  background: #e0e0e0;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-add-vehiculo svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Vehículos Asignados */
.vehiculos-asignados {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.vehiculos-asignados-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.vehiculos-asignados-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vehiculo-asignado-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f8f9fc;
  border: 1px solid #e8eaef;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  transition: all 0.2s;
}

.vehiculo-asignado-item:hover {
  background: #fde3e3;
  border-left-color: var(--primary-dark);
}

.vehiculo-asignado-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vehiculo-asignado-vin {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  font-family: monospace;
}

.vehiculo-asignado-modelo {
  font-size: 11.5px;
  color: var(--text-mid);
}

.btn-remove-vehiculo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-mid);
}

.btn-remove-vehiculo:hover {
  background: #ffebee;
  border-color: #ef5350;
  color: #c62828;
}

.btn-remove-vehiculo svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Resumen Despacho */
.resumen-despacho {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.resumen-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8f9fc;
  border-radius: 10px;
  border: 1px solid #e8eaef;
}

.resumen-label {
  font-size: 12.5px;
  color: var(--text-mid);
  font-weight: 500;
}

.resumen-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

/* Responsive para planificar despacho */
@media (max-width: 768px) {
  .ninera-selection-card {
    flex-direction: column;
  }

  .ninera-checkbox {
    margin: 14px;
  }

  .ninera-selection-label {
    padding: 0 14px 14px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ninera-selection-icon {
    width: 38px;
    height: 38px;
  }

  .ninera-selection-icon svg {
    width: 20px;
    height: 20px;
  }

  .ninera-selection-placa {
    font-size: 13px;
  }

  .ninera-selection-vehiculo {
    font-size: 12px;
  }

  .ninera-selection-empresa {
    font-size: 11px;
  }

  .ninera-selection-capacidad {
    width: 100%;
  }

  .capacidad-badge {
    font-size: 11px;
    padding: 5px 12px;
  }

  .asignacion-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .asignacion-title {
    font-size: 15px;
  }

  .asignacion-subtitle {
    font-size: 11.5px;
  }

  .progress-badge {
    min-width: 50px;
    font-size: 12px;
    padding: 6px 14px;
  }

  .add-vehiculo-group {
    flex-direction: column;
  }

  .btn-add-vehiculo {
    width: 100%;
    height: 42px;
  }

  .vehiculo-asignado-item {
    padding: 9px 12px;
  }

  .vehiculo-asignado-vin {
    font-size: 12px;
  }

  .vehiculo-asignado-modelo {
    font-size: 11px;
  }

  .resumen-despacho {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .resumen-item {
    padding: 12px 16px;
  }

  .resumen-label {
    font-size: 12px;
  }

  .resumen-value {
    font-size: 18px;
  }
}

/* ========== PDI INSPECTION ========== */

/* Botón PDI en detalle-unidad */
.btn-pdi {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-pdi svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}
.btn-pdi:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 37, 32, 0.3);
}
.btn-pdi.pdi-exists {
  background: linear-gradient(135deg, var(--green), #2e7d32);
}
.btn-pdi.pdi-exists:hover {
  box-shadow: 0 4px 12px rgba(67, 160, 71, 0.3);
}

/* PDI Header Card */
.pdi-header-card {
  text-align: center;
}
.pdi-logos {
  margin-bottom: 12px;
}
.pdi-logo {
  height: 40px;
  object-fit: contain;
}
.pdi-main-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.pdi-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 20px;
}
.pdi-info-grid {
  text-align: left;
}
.pdi-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-mid);
}
.pdi-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pdi-legend-item strong {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* PDI Section Cards */
.pdi-section-card {
  margin-bottom: 16px;
}
.pdi-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}
.pdi-section-title svg {
  width: 20px;
  height: 20px;
  fill: var(--primary);
  flex-shrink: 0;
}

/* PDI Table */
.pdi-table {
  width: 100%;
  border-collapse: collapse;
}
.pdi-table thead th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 2px solid #f0f1f5;
  text-align: left;
}
.pdi-th-no {
  width: 50px;
  text-align: center !important;
}
.pdi-th-result {
  width: 160px;
  text-align: center !important;
}
.pdi-table tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dark);
  border-bottom: 1px solid #f6f7fa;
  vertical-align: top;
}
.pdi-table tbody td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--text-mid);
  width: 50px;
}
.pdi-table tbody tr:hover {
  background: #fafbfe;
}

/* PDI Result Buttons */
.pdi-result-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.pdi-result-btn {
  width: 40px;
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fafafe;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-mid);
}
.pdi-result-btn:hover {
  border-color: var(--text-mid);
}
.pdi-opt-si.active {
  background: #e8f5e9;
  border-color: var(--green);
  color: var(--green);
}
.pdi-opt-no.active {
  background: #fbe9e7;
  border-color: var(--red);
  color: var(--red);
}
.pdi-opt-na.active {
  background: #fff3e0;
  border-color: var(--orange);
  color: var(--orange);
}

/* PDI Tire Inputs */
.pdi-tire-inputs {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pdi-tire-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdi-tire-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  min-width: 28px;
}
.pdi-tire-field input {
  width: 70px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  background: #fafafe;
  outline: none;
  transition: border 0.2s;
}
.pdi-tire-field input:focus {
  border-color: var(--primary);
}

/* PDI Inline Field */
.pdi-inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.pdi-inline-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
}
.pdi-inline-field input {
  width: 80px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  background: #fafafe;
  outline: none;
  transition: border 0.2s;
}
.pdi-inline-field input:focus {
  border-color: var(--primary);
}
.pdi-inline-field span {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

/* PDI VDS Fields */
.pdi-vds-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.pdi-vds-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdi-vds-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
}
.pdi-vds-field input {
  width: 70px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  background: #fafafe;
  outline: none;
  transition: border 0.2s;
}
.pdi-vds-field input:focus {
  border-color: var(--primary);
}
.pdi-vds-field span {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

/* PDI Textarea */
.pdi-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dark);
  background: #fafafe;
  outline: none;
  resize: vertical;
  transition: border 0.2s, box-shadow 0.2s;
}
.pdi-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 37, 32, 0.08);
  background: #fff;
}

/* PDI Warning Card */
.pdi-warning-card {
  background: #fff8e1;
  border: 1px solid #ffe082;
}
.pdi-warning-title {
  border-bottom-color: var(--orange) !important;
  color: #e65100 !important;
}
.pdi-warning-title svg {
  fill: var(--orange) !important;
}
.pdi-notes {
  list-style: decimal;
  padding-left: 20px;
  font-size: 12px;
  color: #5d4037;
  line-height: 1.7;
}
.pdi-notes li {
  margin-bottom: 6px;
}

/* PDI Form Actions */
.pdi-form-actions {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

/* PDI Responsive */
@media (max-width: 768px) {
  .pdi-table thead {
    display: none;
  }
  .pdi-table tbody tr {
    display: block;
    padding: 14px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 8px;
    border-radius: 10px;
    background: #fafbfe;
  }
  .pdi-table tbody td {
    display: block;
    padding: 4px 0;
    border-bottom: none;
    text-align: left !important;
  }
  .pdi-table tbody td:first-child {
    font-size: 11px;
    color: var(--primary);
    margin-bottom: 4px;
  }
  .pdi-table tbody td:first-child::before {
    content: 'Item ';
  }
  .pdi-table tbody td:last-child {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .pdi-result-group {
    justify-content: flex-start;
  }
  .pdi-tire-inputs {
    gap: 8px;
  }
  .pdi-vds-fields {
    grid-template-columns: 1fr;
  }
  .btn-pdi {
    font-size: 12px;
    padding: 8px 14px;
  }
}
