/* =====================================================================
   Tema visual RUTEM para el Portal de Grúas.
   Mismos tokens y componentes que rutem_publico (por_web/css/variables.css,
   components.css, mis_concesiones.css, mis_tramites.css y el menú lateral).
   ===================================================================== */
:root {
  --vino: #891b35;
  --vino-dark: #6f1731;
  --vino-soft: #fdf2f5;
  --dorado: #bc955c;
  --dorado-borde: #a06b2c;
  --dorado-texto: #b8972a;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;

  --good: #157347;
  --good-soft: #e8f7ee;
  --warn: #92620a;
  --warn-soft: #fff3cd;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --neutral: #6b7280;
  --neutral-soft: #f3f4f6;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;
}

/* ===================== MENÚ LATERAL ===================== */
.rt-sidebar {
  width: 260px;
  min-height: 100%;
  position: sticky;
  top: 0;
  align-self: stretch;
  overflow-y: auto;
  background: #f8f9fa;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Montserrat', 'Poppins', sans-serif;
}

.rt-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.rt-sidebar__brand-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--vino);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.rt-sidebar__brand h5 { font-weight: 800; margin: 0; color: var(--text); }
.rt-sidebar__brand small { color: var(--muted); }

.rt-sidebar__nav { padding: 1rem; }
.rt-sidebar__nav .nav { gap: 0; }

/* Botones tipo tarjeta con borde dorado (igual que RUTEM) */
.rt-sidebar .rt-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #ffffff;
  border-left: 6px solid var(--dorado-borde);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333 !important;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .04);
  transition: all .25s ease;
}
.rt-sidebar .rt-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.rt-sidebar .rt-link:hover {
  background-color: #fef1f0;
  border-left-color: #760603;
  color: #760603 !important;
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}
.rt-sidebar .rt-link.active {
  background-color: #fcebea;
  border-left-color: #760603;
  color: #760603 !important;
  font-weight: 700;
}

.rt-sidebar__label {
  display: block;
  padding: .25rem .75rem;
  margin: .5rem 0 .4rem;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dorado-texto);
}

.rt-sidebar__session {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.rt-sidebar__session .rt-link { justify-content: space-between; margin-bottom: 0; }
.rt-sidebar__session .rt-link .rt-chevron { transition: transform .2s ease; width: auto; }
.rt-sidebar__session .rt-link[aria-expanded="true"] .rt-chevron { transform: rotate(180deg); }
.rt-sidebar__session .rt-sub { list-style: none; padding: .75rem 0 0 .75rem; margin: 0; }
/* Opciones de sesión: mismas tarjetas del menú, más compactas */
.rt-sidebar__session .rt-sub a {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-left: 4px solid var(--dorado-borde);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 6px;
  font-size: .86rem;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .04);
  transition: all .25s ease;
}
.rt-sidebar__session .rt-sub a i { width: 16px; text-align: center; flex-shrink: 0; }
.rt-sidebar__session .rt-sub a:hover,
.rt-sidebar__session .rt-sub a.active {
  background: #fcebea;
  border-left-color: #760603;
  color: #760603;
  transform: translateX(2px);
}
.rt-sidebar__session .rt-sub a.rt-sub-logout { color: var(--bad); border-left-color: var(--bad); }
.rt-sidebar__session .rt-sub a.rt-sub-logout:hover { background: var(--bad-soft); color: var(--bad); }

/* Misma tipografía en todo el menú (algunos enlaces heredaban Arial) */
.rt-sidebar, .rt-sidebar a, .rt-sidebar span, .rt-sidebar small, .rt-sidebar h5, .rt-sidebar li {
  font-family: 'Montserrat', 'Poppins', sans-serif !important;
}

/* ===================== CONTENIDO ===================== */
.manage-main { background: var(--bg); }

/* El margen lateral lo da .manage-content; aquí solo el vertical, igual en todas las pantallas. */
.rt-page { padding: .25rem 0 2rem; }

.rt-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.rt-title {
  margin: 0;
  color: var(--vino);
  font-size: 1.9rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rt-subtitle { margin: 8px 0 0; color: #667085; font-size: .88rem; }
.rt-page-head__aside { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.badge-soft {
  background: #f8eef2;
  color: var(--vino);
  border: 1px solid #ead1d8;
  padding: .5rem .9rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: .88rem;
}

.portys-card {
  background: #fff;
  border: 1px solid #ececf2;
  border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
  overflow: hidden;
}

/* Buscador */
.search-card { padding: 22px 24px; margin-bottom: 28px; }
.search-form { display: flex; gap: 14px; align-items: center; }
.search-input-wrap {
  flex: 1;
  min-height: 48px;
  border: 1px solid #dde3ea;
  border-radius: var(--r-sm);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.search-input-wrap i { color: #8b95a5; }
.search-input-wrap input { border: 0; outline: 0; width: 100%; color: #374151; font-size: .9rem; background: transparent; }
.search-input-wrap input::placeholder { color: #8b95a5; }

/* Botón principal vino (no usa .btn: base.css lo fuerza a dorado) */
.btn-vino-pill {
  height: 46px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--vino);
  color: #fff !important;
  font-weight: 800;
  padding: 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  transition: all .25s ease;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-vino-pill:hover { background: var(--vino-dark); transform: translateY(-1px); color: #fff !important; }

/* Filtros tipo píldora + orden */
.rt-filters { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.rt-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px solid #dde3ea;
  background: #fff;
  color: #374151;
  transition: all .2s ease;
}
.rt-chip:hover { border-color: var(--vino); color: var(--vino); }
.rt-chip.active { background: var(--vino); border-color: var(--vino); color: #fff; }
.rt-chip .cnt { background: rgba(0, 0, 0, .06); border-radius: var(--r-pill); padding: 1px 7px; font-size: .72rem; }
.rt-chip.active .cnt { background: rgba(255, 255, 255, .25); }

.rt-sort { display: flex; gap: 6px; align-items: center; }
.rt-sort a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px solid #dde3ea;
  background: #fff;
  color: #667085;
}
.rt-sort a.active { border-color: var(--vino); background: var(--vino-soft); color: var(--vino); }

/* Tabla */
.table-card { margin-bottom: 28px; }
.table.rt-table { margin: 0; border: none; }
.rt-table thead th {
  background: #fbfcfe !important;
  color: var(--vino) !important;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 900;
  border-bottom: 1px solid #edf0f4;
  padding: 18px 24px;
  text-align: center;
  vertical-align: middle;
}
.rt-table tbody td {
  padding: 18px 24px;
  color: #1f2937;
  font-size: .86rem;
  border-bottom: 1px solid #f1f2f4;
  text-align: center;
  vertical-align: middle;
  background: #fff;
}
.rt-table tbody tr:last-child td { border-bottom: none; }
.rt-table tbody tr:hover td { background: #fbfafb; }

.folio-pill { color: #d4145a; font-size: .76rem; font-weight: 900; font-family: monospace; }
.modalidad-text { color: #111827; font-weight: 700; }

.accion-icon {
  font-size: .82rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .2s ease;
}
.accion-detalle { color: #006847; }
.accion-detalle:hover { color: #00523a; transform: scale(1.04); }

/* Insignias de estado */
.badge--success { background: var(--good-soft); color: var(--good); border: 1px solid #b7e4c7; }
.badge--warning { background: var(--warn-soft); color: var(--warn); border: 1px solid #ffc107; }
.badge--danger  { background: var(--bad-soft); color: var(--bad); border: 1px solid #f5b5b5; }
.badge--neutral { background: var(--neutral-soft); color: var(--neutral); border: 1px solid #d1d5db; }

/* Paginación en vino */
.pagination .page-link { color: var(--vino); border-color: #e5e7eb; }
.pagination .page-item.active .page-link { background: var(--vino); border-color: var(--vino); color: #fff; }
.pagination .page-link:hover { background: var(--vino-soft); color: var(--vino); }

/* Estado vacío */
.rt-empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.rt-empty i { font-size: 2.2rem; color: #d1d5db; display: block; margin-bottom: 10px; }

@media (max-width: 768px) {
  .rt-title { font-size: 1.4rem; }
  .search-form { flex-direction: column; align-items: stretch; }
  .btn-vino-pill { justify-content: center; }
  .rt-table thead th, .rt-table tbody td { padding: 12px 10px; }
}

/* ===================== PERFIL (igual que RUTEM) ===================== */
.perfil-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: .9rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 6px rgba(15, 23, 42, .05);
}
.perfil-head-avatar {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: #fbf4f6;
  color: var(--vino);
  display: grid; place-items: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.perfil-head-nombre { font-size: 1.05rem; font-weight: 800; color: var(--text); margin: 0 0 .35rem; line-height: 1.2; }
.perfil-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perfil-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-pill);
  font-size: .73rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
}
.perfil-chip-gold { background: #fff8e6; border-color: #f0d98b; color: #7a5b00; }
.perfil-chip-good { background: var(--good-soft); border-color: #b7e4c7; color: var(--good); }

.pf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(15, 23, 42, .04);
  height: 100%;
}
.pf-card-header {
  display: flex; align-items: center; gap: 7px;
  padding: .55rem 1rem;
  background: #fbf4f6;
  border-bottom: 1px solid rgba(137, 27, 53, .1);
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--vino);
}
.pf-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: .55rem 1rem;
  border-bottom: 1px solid #f3f4f6; font-size: .86rem;
}
.pf-row:last-child { border-bottom: none; }
.pf-row-label { color: var(--muted); font-size: .78rem; flex-shrink: 0; }
.pf-row-value { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }

@media (max-width: 576px) {
  .perfil-head { flex-direction: column; align-items: flex-start; }
}

/* =====================================================================
   MODALES — mismo estilo que los de la intranet (app-modal-content):
   tarjeta blanca, título vino, etiquetas en mayúsculas, "Cancelar" blanco
   y acción principal vino. Va con !important porque cada pantalla trae
   su propio CSS de modales y base.css fuerza .btn a dorado.
   ===================================================================== */
body .modal .modal-content {
  border-radius: 14px !important;
  border: none !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18) !important;
  overflow: hidden;
}
body .modal .modal-header {
  background: #fff !important;
  color: inherit !important;
  padding: 1.1rem 1.5rem !important;
  border-bottom: 1px solid #ede0da !important;
}
body .modal .modal-title {
  color: var(--vino) !important;
  font-weight: 800 !important;
  font-size: 1.2rem !important;
  margin: 0;
}
body .modal .modal-header .btn-close { filter: none !important; opacity: .6; }
body .modal .modal-body { padding: 1.6rem 1.75rem !important; }

/* Encabezado del modal "Nueva cotización": mismo encabezado simple */
body .modal .quote-modal-heading__icon,
body .modal .quote-modal-heading__eyebrow,
body .modal .quote-modal-heading__description { display: none !important; }

/* Etiquetas */
body .modal .form-label,
body .modal .label-clean,
body .modal .label-vino,
body .modal .app-form-label,
body .modal .row > [class*="col-"] > label:not(.form-check-label) {
  display: block;
  font-size: .78rem !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #4b5563 !important;
  margin-bottom: .4rem;
}

/* Campos */
body .modal .form-control,
body .modal .form-select {
  border: 1px solid #dde3ea !important;
  border-radius: 8px !important;
  min-height: 44px;
  font-size: .95rem;
  box-shadow: none;
}
body .modal textarea.form-control { min-height: 90px; }
body .modal .form-control:focus,
body .modal .form-select:focus {
  border-color: var(--dorado) !important;
  box-shadow: 0 0 0 3px rgba(188, 149, 92, .18) !important;
}
body .modal .form-control[readonly] { background: #f6f7f9 !important; }
body .modal .form-check-input:checked { background-color: var(--vino) !important; border-color: var(--vino) !important; }
body .modal .form-text { color: #6b7280; font-size: .85rem; }

/* Pie: línea superior y botones a la derecha */
body .modal .modal-footer,
body .modal .modal-footer-clean,
body .modal .modal-content > .d-flex.justify-content-end {
  border-top: 1px solid #ede0da !important;
  padding: 1rem 1.5rem !important;
  display: flex !important;
  justify-content: flex-end;
  align-items: center;
  gap: .6rem;
  background: #fff !important;
}
body .modal .modal-footer-clean { margin-top: 1.25rem; padding: 1rem 0 0 !important; }

/* Botón Cancelar (cualquier botón que cierra el modal, menos la X) */
body .modal .btn[data-bs-dismiss="modal"]:not(.btn-close) {
  min-height: 46px !important;
  padding: 0 22px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff !important;
  border: 1px solid #dde3ea !important;
  color: #667085 !important;
  font-weight: 700 !important;
  font-size: .95rem !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
body .modal .btn[data-bs-dismiss="modal"]:not(.btn-close):hover { border-color: #c7cdd6 !important; color: #4b5563 !important; }

/* Acción principal (botones del pie que no cierran ni eliminan) */
body .modal .modal-footer .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger),
body .modal .modal-footer-clean .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger),
body .modal .modal-content > .d-flex.justify-content-end .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger) {
  min-height: 46px !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: var(--vino) !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: .95rem !important;
  padding: 0 1.25rem !important;
  display: inline-flex !important;
  align-items: center;
  gap: .45rem;
  transition: all .25s ease;
}
body .modal .modal-footer .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger):hover,
body .modal .modal-footer-clean .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger):hover,
body .modal .modal-content > .d-flex.justify-content-end .btn:not([data-bs-dismiss]):not(.btn-danger):not(.btn-outline-danger):hover {
  background: var(--vino-dark) !important;
  transform: translateY(-1px);
}

/* Eliminar: mismo tamaño, en rojo */
body .modal .modal-footer .btn-danger,
body .modal .modal-content > .d-flex.justify-content-end .btn-danger {
  min-height: 46px !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: var(--bad) !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: .95rem !important;
  padding: 0 1.25rem !important;
  display: inline-flex !important;
  align-items: center;
  gap: .45rem;
}
body .modal .modal-footer .btn-danger:hover,
body .modal .modal-content > .d-flex.justify-content-end .btn-danger:hover { background: #991b1b !important; }

/* Pie del modal "Nueva cotización": texto de obligatorios a la izquierda */
body .modal .quote-modal-footer { justify-content: space-between !important; }

/* ===================== RESPONSIVO (páginas con .rt-page) ===================== */
/* cotizaciones-list.css la limitaba a 1280px y dejaba vacío el lado derecho */
.rt-page.cotizaciones-page { max-width: none; width: 100%; }

@media (max-width: 991.98px) {
  .rt-page-head { flex-direction: column; align-items: stretch; }
  .rt-page-head__aside { justify-content: space-between; }
}

@media (max-width: 767.98px) {
  .rt-page-head__aside .btn-vino-pill { flex: 1; justify-content: center; }
  .rt-filters { flex-direction: column; align-items: stretch; }
  .rt-chips { display: grid; grid-template-columns: 1fr 1fr; }
  .rt-chip { justify-content: center; }
  .rt-sort a { flex: 1; justify-content: center; }
  .search-card { padding: 16px; margin-bottom: 18px; }
}

@media (max-width: 575.98px) {
  .rt-page-head__aside { flex-direction: column; align-items: stretch; }
  .rt-page-head__aside .btn-vino-pill { flex: none; }
  .badge-soft { text-align: center; }
}
