:root {
  /* Fondos principales */
  --bg-main: #303030;        /* fondo general casi negro */
  --bg-sidebar: #282828;     /* lateral ligeramente más claro */
  --bg-card: #282828;        /* tarjeta central */
  --bg-card-soft: #1d1d1d;   /* elementos dentro de la card */

  /* Verdes del diseño */
  --accent: #7ae0a9;         /* verde de textos y links */
  --accent-soft: #303030;    /* fondos suaves de iconos verdes */
  --accent-cta: #7ae0a9;     /* botones principales */

  /* Tipografía y bordes */
  --text-main: #f9f9f9;
  --text-muted: #bbb;
  --border-soft: #363636;
  --danger: #e74c3c;

  /* Radii */
  --radius-pill: 999px;
  --radius-card: 24px;
  --radius-input: 4px;

  /* Espaciados */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Otros */
  --transition-fast: 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* SHELL GENERAL */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.shell-main {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* HEADER SUPERIOR (header.html) */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  position: relative;
}

.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}

.topbar-brand-pill {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--accent, #7ae0a9);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: none;
  font-size: 22px;
  white-space: nowrap;
}

.topbar-brand-pill .brand-by {
  font-weight: 600;
  text-transform: lowercase;
  font-size: 14px;
}

.topbar-brand-pill .brand-rest {
  font-size: 16px;
  font-weight: 700;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo {
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 18px;
}

.logo img {
  height: 18px;
  width: auto;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Prefer Font Awesome (loaded via CDN); remove emoji fallbacks */

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border-soft);
  cursor: pointer;
  transition: background var(--transition-fast),
    transform var(--transition-fast);
  font-size: 14px;
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.avatar-btn {
  width: auto;
  padding: 0 10px 0 6px;
  gap: 6px;
  background: #ffffff;
}

.avatar-role-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

body[data-role="gdels"] .avatar-role-badge {
  color: #013088;
}

body[data-role="latvia"] .avatar-role-badge {
  color: #9d2235;
}

.notification-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  top: 2px;
  right: 2px;
  border: 2px solid var(--bg-card);
  display: none;
}

.notification-dot.is-visible {
  display: block;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

/* SIDEBAR (sidebar.html) */
.sidebar {
  position: relative;
  width: 220px;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-soft);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  transition: width var(--transition-fast);
  overflow: hidden;
}

body.sidebar-collapsed .sidebar {
  width: 72px;
}

/* botón plegar, solo visible al hacer hover */
.sidebar-toggle {
  position: absolute;
  top: 10px;
  right: -10px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-soft);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
  z-index: 5;
}

.sidebar:hover .sidebar-toggle {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-toggle:hover {
  background: var(--border-soft);
  transform: translateY(-1px);
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  padding: var(--space-sm);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opt-badge {
  display: inline-block;
  background: #0fa958;
  color: #ffffff;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.opt-badge-inline {
  margin-left: 4px;
  position: relative;
  top: -1px;
}

/* ITEM DEL MENÚ */
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 18px;
  margin: 2px 0;
  border-radius: 24px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

/* ICONO EN ESTADO NORMAL (sidebar expandido) */
.sidebar-item .icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast), font-size var(--transition-fast);
  position: relative;
}

.sidebar-alert-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  top: 0;
  right: 0;
  border: 2px solid var(--bg-sidebar);
  display: none;
}

.sidebar-alert-dot.is-visible {
  display: block;
}

/* Texto del item */
.sidebar-item-text {
  white-space: nowrap;
}

/* ESTADOS (expandido) */
.sidebar-item:hover {
  background: var(--bg-main);
  color: #ffffff;
  transform: translateY(-1px);
}

.sidebar-item:hover .icon {
  color: #ffffff;
}

.sidebar-item.active {
  background: #323232;
  color: var(--accent);
}

.sidebar-item.active .icon,
.sidebar-item.active .sidebar-item-text {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

/* 🔻 MODO COLAPSADO 🔻 */

body.sidebar-collapsed .sidebar-item-text,
body.sidebar-collapsed .sidebar-section-title {
  display: none;
}

/* Centramos el contenido de cada item y quitamos el gap */
body.sidebar-collapsed .sidebar-item {
  justify-content: center;
  gap: 0;
  padding-left: 0;
  padding-right: 0;
  background: transparent;
  transform: none;
}

/* Iconos más grandes y centrados horizontalmente */
body.sidebar-collapsed .sidebar-item .icon {
  font-size: 24px;
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

/* Sin fondo en hover, solo cambio de color */
body.sidebar-collapsed .sidebar-item:hover {
  background: transparent;
}

body.sidebar-collapsed .sidebar-item:hover .icon {
  color: #ffffff;
}

/* Activo en colapsado: sin fondo, icono verde */
body.sidebar-collapsed .sidebar-item.active {
  background: transparent;
}

body.sidebar-collapsed .sidebar-item.active .icon {
  color: var(--accent);
}

/* MAIN CONTENT AREA */
.main {
  flex: 1;
  padding: var(--space-lg) calc(var(--space-lg) + 8px);
  min-width: 0;
  overflow: auto;
  background: var(--bg-main);
}

/* encabezado de página (título + botones) */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
}

.page-title-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* ---- BOTONES GENERALES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 24px;
  margin-right: 8px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--bg-card-soft);
  color: var(--text-main);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
}

.btn-table {
  padding: 6px 12px;
  font-size: 12px;
  margin-right: 0;
}

.btn-table .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-icon {
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
}

/* Botón fantasma oscuro */
.btn-ghost {
  background: var(--bg-card-soft);
  border-color: var(--border-soft);
}

.btn-ghost:hover {
  background: #22262d;
}

/* PRIMARIO – verde */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f2018;
}

.btn-primary:hover {
  background: #8df2bc;
  transform: translateY(-1px);
}

/* SECUNDARIO – gris oscuro */
.btn-secondary {
  background: #181b1f;
  border-color: var(--border-soft);
}

.btn-secondary:hover {
  background: #22262d;
  transform: translateY(-1px);
}

/* TERCIARIO – texto solo (para cancel o enlaces) */
.btn-tertiary {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  text-decoration: underline;
  padding-inline: 0;
}

.btn-tertiary:hover {
  color: #ffffff;
  transform: none;
}

/* DANGER – rojo */
.btn-danger {
  background: #b14848;
  border-color: #b14848;
  color: #ffffff;
}

.btn-danger:hover {
  background: #c75a5a;
  transform: translateY(-1px);
}

/* Disabled genérico */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* card tabla */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.card-header {
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select {
  position: relative;
  min-width: 180px;
}

.select button {
  width: 100%;
  padding: 7px 32px 7px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.select .fa-chevron-down {
  font-size: 11px;
  opacity: 0.6;
}

.badge-filter {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid #272b33;
}

.card-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* buscador */
.search-input {
  position: relative;
  min-width: 220px;
}

.search-input input {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  padding: 7px 10px 7px 30px;
  color: var(--text-main);
  font-size: 13px;
}

.search-input input::placeholder {
  color: var(--text-muted);
}

.search-input i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
}

/* tabla */
.table-wrapper {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

thead {
  background: var(--bg-card);
}

th,
td {
  text-align: left;
  padding: 6px 20px;
  border-bottom: 0;
  white-space: nowrap;
  height: 50px;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 500;
}

tbody tr {
  transition: background var(--transition-fast),
    transform var(--transition-fast);
}

tbody tr:hover {
  background: var(--border-soft);
  transform: translateY(-1px);
}

tbody tr:last-child td {
  border-bottom: none;
}

.cell-ref {
  font-weight: 500;
  color: var(--text-main);
}

.vehicle-summary-table {
  margin-bottom: 16px;
}

.vehicle-thumb {
  width: 88px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.vehicle-folder-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.vehicle-folder-link i {
  font-size: 18px;
}

.vehicle-folder-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-production {
  background: #fff3e0;
  color: #c45a00;
}

.status-service {
  background: #e6f6ed;
  color: #1c8c4c;
}

.status-maintenance {
  background: #e7f0ff;
  color: #2955d9;
}

.cell-name-link {
  color: var(--accent);
  cursor: pointer;
}

.cell-name-link:hover {
  text-decoration: underline;
}

.cell-price {
  font-weight: 600;
}

.cell-time {
  color: var(--text-muted);
}

.picture-thumb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #1f2329;
  border: 1px solid #272b33;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
}

.picture-img {
  width: 65px;
  height: 50px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #272b33;
}

.table-footer {
  padding: 10px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
}

.table-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.pager-btn:hover {
  background: var(--bg-main);
  color: #ffffff;
}

.table-pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* contenedor de las páginas */
.pager-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

/* botoncito de página 1, 2, 3... */
.pager-page {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.pager-page:hover {
  border-color: var(--border-soft);
  background: #181b1f;
  color: #ffffff;
  transform: translateY(-1px);
}

/* página actual */
.pager-page--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f2018;
  font-weight: 600;
  cursor: default;
  transform: none;
}

.warehouse-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* los "..." */
.pager-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
}

.brand-footer {
  position: absolute;
  z-index: 5;
  right: 24px;
  bottom: 24px;
  font-size: 11px;
  opacity: 0.65;
}

.app-brand-footer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  font-size: 11px;
  opacity: 0.65;
  z-index: 5;
}

.brand-login-footer {
  margin-top: 56px;
  margin-bottom: -20px;
  font-size: 11px;
  opacity: 0.65;
}

/* responsive */
@media (max-width: 900px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-actions {
    align-self: stretch;
    justify-content: flex-end;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-header-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* ========= MODAL SUBIDA DE FICHEROS ========= */

.upload-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none; /* se muestra con .is-open */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.upload-modal-backdrop.is-open {
  display: flex;
}

.upload-modal {
  position: relative;
  width: min(720px, calc(100% - 48px));
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: var(--space-xl) 40px 40px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.9);
}

.upload-modal-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 16px;
}

.upload-modal-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.upload-modal-link {
  color: #4aa5ff;
  text-decoration: underline;
}

.upload-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.upload-modal-close:hover {
  color: #ffffff;
  transform: scale(1.05);
}

/* Dropzone */

.upload-dropzone {
  border-radius: var(--radius-card);
  border: 1px dashed #4b4b4b;
  padding: 48px 24px 40px;
  background: var(--bg-card-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.upload-dropzone-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-pill);
  background: #181b1f;
  border: 2px solid #3b3b3b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #ffffff;
}

.upload-dropzone-btn {
  margin-top: 8px;
  padding: 10px 40px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent-cta);
  color: #04110a;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.upload-dropzone-btn:hover {
  background: var(--accent-cta);
  transform: translateY(-2px);
}

.upload-dropzone-help {
  font-size: 14px;
  color: var(--text-main);
}

.upload-input-hidden {
  display: none;
}

@media (max-width: 600px) {
  .upload-modal {
    padding: 24px 20px 32px;
  }

  .upload-modal-title {
    font-size: 24px;
  }

  .upload-dropzone {
    padding: 32px 16px 28px;
  }
}

/* ========== MODAL NEW / EDIT SPARE PART ========== */

.spare-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none; /* se activa con .is-open */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spare-modal-backdrop.is-open {
  display: flex;
}

.spare-modal {
  position: relative;
  width: min(960px, calc(100% - 48px));
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: var(--space-xl) 40px 40px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-soft);
}

.spare-modal-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 32px;
}

.spare-edit-modal .spare-modal-title {
  margin-bottom: 16px;
}

.order-detail-modal {
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-lg) 32px 32px;
}

.order-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
  padding-right: 48px;
  flex-wrap: wrap;
}

.order-detail-header-info .spare-modal-title {
  margin-bottom: 8px;
}

.order-detail-created {
  font-size: 14px;
  color: var(--text-muted);
}

.order-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-card {
  background: var(--bg-main);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  padding: 16px;
}

.detail-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-card p {
  font-size: 18px;
  font-weight: 600;
}

.order-status-select {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.order-status-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.order-status-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
}

.order-status-trigger select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.order-status-trigger select:focus {
  outline: none;
}

.order-status-trigger.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge--pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.status-badge--processing {
  background: rgba(0, 123, 255, 0.15);
  color: #4da3ff;
}

.status-badge--in-transit {
  background: rgba(0, 210, 181, 0.15);
  color: #34d5c3;
}

.status-badge--delivered {
  background: rgba(40, 167, 69, 0.15);
  color: #6fda4f;
}

.status-badge--cancelled {
  background: rgba(231, 76, 60, 0.15);
  color: #ff6b6b;
}

.order-progress-card {
  background: var(--bg-main);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-progress-header h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.order-progress-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.order-progress-scroll {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.order-progress-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-progress-item {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  padding: 12px 16px;
}

.order-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 12px;
}

.order-progress-head strong {
  font-size: 14px;
}

.order-progress-head span {
  font-size: 12px;
  color: var(--text-muted);
}

.order-progress-empty {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  padding: 24px 12px;
}

.order-progress-form {
  border-top: 1px solid var(--border-soft);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-progress-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.order-progress-meta strong {
  color: var(--text-main);
}

.order-progress-fields {
  display: flex;
  flex-direction: column;
}

.order-progress-fields textarea {
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
}

.order-progress-form button {
  align-self: flex-end;
}

/* Layout del formulario */

.spare-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.spare-edit-fields .spare-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}

.spare-edit-modal .spare-edit-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.spare-edit-preview-panel {
  flex: 0 0 320px;
}

.spare-edit-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.spare-edit-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  min-height: 100px;
}

.spare-edit-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  min-height: 100px;
}

.spare-edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spare-edit-thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
}

.spare-edit-thumb-remove:hover {
  background: rgba(0, 0, 0, 0.9);
}

.spare-gallery-add-btn {
  width: 100%;
  margin-top: 12px;
}

.spare-edit-new-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.spare-picture-readonly {
  cursor: default;
  pointer-events: none;
}

.spare-edit-form {
  flex: 1;
}

.spare-form-row {
  display: flex;
  gap: 24px;
}

.spare-edit-fields .spare-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.spare-edit-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.spare-form-row-file {
  margin-top: 8px;
}

.spare-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spare-field--full {
  grid-column: span 2;
}

.spare-field label {
  font-size: 14px;
}

.spare-field input {
  border-radius: var(--radius-input);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 14px;
}

.spare-field input::placeholder {
  color: #b0b0b0;
}

.spare-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* File row (alta) */

.spare-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spare-file-name {
  font-size: 14px;
  color: var(--text-main);
}

.spare-file-clear {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: none; /* se muestra cuando hay archivo */
  align-items: center;
  justify-content: center;
}

.spare-file-clear:hover {
  color: #ffffff;
}

.spare-file-help {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* acciones alta */

.spare-form-actions {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft); /* línea separadora */
  display: flex;
  justify-content: flex-end;
}

.spare-submit-btn {
  min-width: 140px;  /* mismo ancho que Save/Cancel */
}

.spare-edit-buyer-cta {
  display: none;
  justify-content: flex-end;
  flex: 1;
  gap: 10px;
  margin-left: auto;
}

.spare-readonly input {
  background: #1a1a1a;
  border-color: #2b2b2b;
  color: var(--text-main);
  cursor: default;
}

.buy-modal {
  max-width: 520px;
}

.buy-quantity-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 24px;
}

.buy-quantity-input input {
  border-radius: var(--radius-input);
  border: 1px solid var(--border-soft);
  background: var(--bg-main);
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 14px;
}

.buy-confirm-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* responsive */

@media (max-width: 800px) {
  .spare-modal {
    padding: 24px 20px 32px;
  }

  .spare-modal-title {
    font-size: 24px;
  }

  .spare-form-row {
    flex-direction: column;
  }

  .spare-edit-modal .spare-edit-layout {
    flex-direction: column;
  }

  .spare-edit-preview-panel {
    width: 100%;
  }

  .spare-edit-fields .spare-form-row {
    grid-template-columns: 1fr;
  }
}

/* ========== LOGIN PAGE ========== */

.login-body {
  position: relative;
  background: #000;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0.35);
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35));
  z-index: 1;
}

.login-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: var(--space-lg);
}

.login-card {
  background: rgba(40, 40, 40, 0.78);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-card);
  padding: 32px 28px 36px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-soft);
}

.login-logo img {
  height: 32px;
  width: auto;
  display: block;
  margin: 0 auto;
  margin-bottom: 56px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 14px;
}

.login-field input {
  border-radius: var(--radius-input);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 14px;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.login-submit {
  width: 100%;
  margin-top: 8px;
  text-align: center;
}

.login-error {
  min-height: 18px;
  font-size: 13px;
  color: var(--danger);
  margin-top: 4px;
}

/* SELECT GENÉRICO (filtro categoría) */

.select-menu {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 6px 0;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 10;
}

.select-menu.open {
  display: block;
}

.select-menu-item {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}

.select-menu-item:hover {
  background: var(--border-soft);
}

/* ==== EDIT SPARE PART MODAL – CTA ROW ==== */

.spare-edit-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.spare-edit-cta-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spare-save-cancel-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.spare-save-btn,
.spare-cancel-btn {
  min-width: 140px;
}

/* Delete de edición como botón terciario en rojo */
.spare-delete-link.btn-tertiary {
  color: var(--danger);
}

.spare-delete-link.btn-tertiary:hover {
  color: #ff8787;
}

/* ==== PICTURE PREVIEW (modal edición) ==== */

.spare-picture-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spare-picture-preview {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  background: var(--bg-card-soft);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.spare-picture-preview:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  transform: translateY(-1px);
}

.spare-picture-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* se muestra solo si hay imagen */
}

.spare-picture-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.spare-picture-placeholder i {
  font-size: 20px;
  opacity: 0.7;
}

/* ==== CONFIRM DELETE MODAL ==== */

.confirm-modal {
  max-width: 360px;
}

.additive-modal {
  max-width: 640px;
  padding: 48px 48px 40px;
}

.additive-modal--warning {
  border: 1px solid #f39c12;
}

.additive-modal .confirm-title {
  font-size: 26px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.additive-modal .confirm-text {
  font-size: 16px;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 24px;
}

.additive-modal .confirm-actions .btn {
  min-width: 120px;
  font-size: 15px;
}

.confirm-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.confirm-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.confirm-input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

.confirm-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.confirm-cta-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Campos de formulario (inputs + selects) ---------- */

input.spare-input,
select.spare-input {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-input);
  border: 1px solid var(--border-soft);
  background-color: var(--);
  color: #000000;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

/* efecto hover/focus común */
input.spare-input:hover,
select.spare-input:hover {
  border-color: var(--accent);
}

input.spare-input:focus,
select.spare-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(122, 224, 169, 0.35);
}

/* ---------- Ajustes específicos para SELECT ---------- */

select.spare-input {
  /* quitar aspecto nativo y poner nuestra flecha */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding-right: calc(var(--space-md) * 2);

  background-image: url("data:image/svg+xml;utf8,<svg fill='%23666666' xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.news-card,
.news-create-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  min-height: 260px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.news-card--home {
  min-height: 0;
}

.news-card-thumb {
  width: 100%;
  height: 170px;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
}

.news-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-card-thumb--placeholder {
  color: var(--text-muted);
  font-size: 32px;
}

.news-card__body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.news-card__body h3 {
  margin: 0;
  font-size: 18px;
}

.news-card__body h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.news-card__body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.news-card__date {
  font-size: 12px;
  color: var(--text-muted);
}

.news-create-card {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  border: 1px dashed var(--border-soft);
  background: var(--bg-main);
  color: var(--text-muted);
}

.news-create-card:hover {
  border-color: var(--accent);
  color: #fff;
}

.news-create-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px dashed var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto;
}

.news-empty {
  border: 1px dashed var(--border-soft);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.news-modal .spare-modal-title {
  margin-bottom: 12px;
}

.news-editor-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-main);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
}

.news-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.news-picture-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-picture-input img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  display: none;
}

.news-picture-input img.is-visible {
  display: block;
}

.news-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.news-view-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.news-view-header span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.news-view-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.news-view-actions .btn {
  min-height: 36px;
}

.news-view-modal {
  max-width: 760px;
}

.news-view-body img {
  width: min(100%, 600px);
  border-radius: 12px;
  margin: 0 auto 16px;
  display: block;
}

.news-view-body p {
  white-space: pre-wrap;
  line-height: 1.6;
}

.news-view-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.news-view-meta {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.home-news-section {
  margin: 24px 0;
}

.home-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0 32px;
}

.home-widget-card {
  border-radius: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.home-widget-card h4 {
  margin-bottom: 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.home-widget-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-widget-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px 0;
}

.home-widget-row strong {
  color: var(--text-main);
}

.home-widget-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

.home-news-header {
  margin-bottom: 12px;
}

.text-muted {
  color: var(--text-muted);
}
.trend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: var(--radius-pill);
  background: rgba(122, 224, 169, 0.2);
  color: var(--accent);
  margin-left: 6px;
}

.trend-badge--new {
  background: rgba(122, 224, 169, 0.2);
  color: var(--accent);
}

.trend-badge--updated {
  background: rgba(1, 48, 136, 0.2);
  color: #8db1ff;
}
.documents-actions {
  display: flex;
  gap: 12px;
}

.documents-breadcrumb-row {
  display: flex;
  align-items: center;
  padding: 12px 16px 0;
  margin-bottom: 16px;
  gap: 12px;
}

.documents-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.documents-back-row {
  padding: 0 16px 12px;
}

.breadcrumb-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
}

.breadcrumb-btn:disabled {
  color: var(--text-muted);
  cursor: default;
}

.documents-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  padding: 0 16px 12px;
}

.documents-table-title {
  padding: 0 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.folder-card {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 16px;
  background: var(--bg-card);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  position: relative;
}

.folder-card:hover {
  transform: translateY(-2px);
}

.folder-card__icon {
  font-size: 28px;
  color: var(--accent);
}

.folder-card__body {
  display: flex;
  flex-direction: column;
}

.folder-card__rename {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: #4a5a73;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.folder-card__rename:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1f2a3c;
}

.documents-empty {
  border: 1px dashed var(--border-soft);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.documents-modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.documents-modal-actions .btn {
  min-width: 100px;
}

.documents-table thead th {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.documents-table td {
  vertical-align: middle;
}

.documents-table .doc-icon {
  font-size: 18px;
  text-align: center;
}
