/* Design tokens — look & feel tipo panel limpio (referencia visual) */
:root {
  --sidebar-width: 240px;
  --topbar-height: 48px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.1);
  --bg-body: #f5f5f7;
  --bg-sidebar: #fff;
  --bg-card: #fff;
  --border: rgba(0, 0, 0, 0.06);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --login-bg: #f26522;
  --action-email: #facc15;
  --action-email-hover: #eab308;
  /* Referencia visual login: diseltec.directiva.mx */
  --login-accent-blue: #2d68ed;
  --login-form-bg: #ffffff;
  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --sidebar-icon-size: 1.8125rem;
  --sidebar-icon-chevron-size: 1.4rem;
  --sidebar-icon-footer-size: 1.875rem;
}

html {
  height: 100%;
}

/* Panel autenticado: escala ligeramente menor (login sin .app-layout conserva 16px) */
html:has(.app-layout) {
  font-size: 14px;
}

body {
  font-family: var(--font-stack);
  color: var(--text);
  background: var(--bg-body);
  min-height: 100%;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

.min-w-0 {
  min-width: 0;
}

/* ——— Card estilo “Apple” ——— */
.card-apple {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-apple:hover {
  box-shadow: var(--shadow-hover);
}

.login-card-diseltec.card-apple:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  transform: none;
}

/* ——— App shell ——— */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-body);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  transition: transform 0.25s ease;
}

.sidebar-brand {
  flex-shrink: 0;
  padding: 0.75rem 0.75rem 0.55rem;
  text-align: center;
}

.sidebar-brand-link {
  display: inline-block;
  max-width: 100%;
}

.sidebar-brand-img {
  max-width: 56%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.sidebar-nav {
  overflow-y: auto;
  padding: 0.4rem 0.55rem 0.7rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 0.08rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-sprite-root {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-icon-svg {
  width: var(--sidebar-icon-size);
  height: var(--sidebar-icon-size);
  flex-shrink: 0;
  color: inherit;
  opacity: 0.88;
  shape-rendering: geometricPrecision;
}

.sidebar-link.active .sidebar-icon-svg,
.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-toggle-inner .sidebar-icon-svg {
  opacity: 1;
}

.sidebar-icon-svg.sidebar-icon-chevron {
  width: var(--sidebar-icon-chevron-size);
  height: var(--sidebar-icon-chevron-size);
  opacity: 0.65;
}

.sidebar-group {
  margin-top: 0.25rem;
}

.sidebar-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
  transition: background 0.15s ease;
}

.sidebar-group-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-group-toggle[aria-expanded="true"],
.sidebar-group-toggle.sidebar-group-open {
  color: var(--accent);
}

.sidebar-group-toggle-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-group-chevron {
  transition: transform 0.2s ease;
  opacity: 0.65;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group-menu {
  padding: 0.15rem 0 0.25rem 0.4rem;
  margin-left: 0.4rem;
  border-left: 1px solid var(--border);
}

.sidebar-link-sub {
  font-size: 0.8125rem;
  padding-left: 1.2rem;
}

.sidebar-modulo .form-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 0.6rem 0.7rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-footer .btn.sidebar-footer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  line-height: 1.2;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.22s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.sidebar-footer .btn.sidebar-footer-action:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 8px 20px rgba(15, 23, 42, 0.1);
}

.sidebar-footer .btn.sidebar-footer-action:active {
  transform: translateY(0);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.sidebar-footer .btn.sidebar-footer-action .action-icon-svg {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  display: block;
  shape-rendering: geometricPrecision;
}

.sidebar-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.sidebar-footer .sidebar-footer-settings.btn-icon-sm {
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-footer .sidebar-footer-user-icon.btn-icon-sm {
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  flex-shrink: 0;
  pointer-events: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text);
  min-width: 0;
}

.sidebar-footer .sidebar-footer-logout {
  gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1030;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.app-layout.sidebar-open .sidebar-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: var(--topbar-height);
  padding: 0 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar-menu {
  color: var(--text);
  border-radius: 8px;
}

.topbar-menu:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.content-area {
  flex: 1;
  padding: 1rem 1.1rem;
  padding-bottom: 4rem;
}

/* Footer de notificaciones */
.app-footer-notifications {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  z-index: 1080;
  pointer-events: none;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  box-sizing: border-box;
}

.app-footer-notifications-inner {
  width: 100%;
  max-width: 42rem;
  pointer-events: none;
}

.app-footer-notifications .alert {
  pointer-events: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .app-footer-notifications {
    left: var(--sidebar-width);
  }
}

@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-hover);
  }

  .main-content {
    margin-left: 0;
  }
}

/* ——— Login (referencia: diseltec — naranja liso; puntos blancos solo en esquinas) ——— */
.login-page {
  min-height: 100vh;
  font-family: "Inter", var(--font-stack);
  background-color: var(--login-bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

.login-corner-dots {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  width: min(56vw, 480px);
  height: min(56vw, 480px);
  background-image: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.62) 1.15px,
    transparent 2.1px
  );
  background-size: 24px 24px;
  background-repeat: repeat;
}

.login-corner-dots--tl {
  top: -40px;
  left: -40px;
  -webkit-mask-image: radial-gradient(ellipse 118% 118% at 0% 0%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 118% 118% at 0% 0%, #000 12%, transparent 78%);
}

.login-corner-dots--tr {
  top: -40px;
  right: -40px;
  -webkit-mask-image: radial-gradient(ellipse 118% 118% at 100% 0%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 118% 118% at 100% 0%, #000 12%, transparent 78%);
}

.login-corner-dots--bl {
  bottom: -40px;
  left: -40px;
  -webkit-mask-image: radial-gradient(ellipse 118% 118% at 0% 100%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 118% 118% at 0% 100%, #000 12%, transparent 78%);
}

.login-corner-dots--br {
  bottom: -40px;
  right: -40px;
  -webkit-mask-image: radial-gradient(ellipse 118% 118% at 100% 100%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 118% 118% at 100% 100%, #000 12%, transparent 78%);
}

.login-page .login-wrap {
  position: relative;
  z-index: 1;
}

/* Mensajes Django en login: mismo pie que el panel */
.login-messages {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  z-index: 1090;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  box-sizing: border-box;
  pointer-events: none;
}

.login-messages .alert {
  width: 100%;
  max-width: 42rem;
  pointer-events: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 880px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  border-radius: var(--radius-lg);
}

.login-card-diseltec {
  max-width: 520px;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.login-card-main {
  flex: 1 1 auto;
  background: var(--login-form-bg);
  padding: 1.75rem 1.5rem 1.25rem;
  min-width: 0;
}

.login-brand-diseltec {
  text-align: left;
}

/* Imagen única logo + títulos (DirectivaSoftware_Titulos_Base.png) */
.login-brand-diseltec .login-brand-img-combined {
  margin: 0;
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.login-brand-img {
  max-width: 240px;
  height: auto;
  display: block;
}

.login-heading {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.login-label-diseltec {
  color: #86868b;
  font-weight: 500;
}

.login-label-diseltec i {
  color: #aeaeb2;
}

.login-label i {
  margin-right: 0.25rem;
  font-size: 0.85rem;
}

.login-input-diseltec {
  border-radius: 10px;
  border: 1px solid #d8d8dc;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
}

.login-input-diseltec:focus {
  border-color: var(--login-accent-blue);
  box-shadow: 0 0 0 3px rgba(45, 104, 237, 0.2);
}

.login-card-main .form-control,
.login-card-main .form-select {
  border-radius: 10px;
}

/* Contexto de trabajo — botones con imagen */
.login-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
}

@media (min-width: 420px) {
  .login-context-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .login-context-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.login-context-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  color: inherit;
  font: inherit;
  width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.login-context-btn-visual {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-context-btn-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 0.35rem;
}

.login-context-btn-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.3;
  padding: 0.15rem 0.2rem 0;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
}

.login-context-btn:hover .login-context-btn-visual {
  border-color: rgba(45, 104, 237, 0.45);
  box-shadow: 0 6px 20px rgba(45, 104, 237, 0.15);
}

.login-context-btn:hover {
  transform: translateY(-1px);
}

.login-context-btn:focus-visible {
  outline: none;
}

.login-context-btn:focus-visible .login-context-btn-visual {
  box-shadow: 0 0 0 3px rgba(45, 104, 237, 0.45);
}

.login-context-btn.is-selected .login-context-btn-visual {
  border-color: var(--login-accent-blue);
  box-shadow: 0 0 0 2px rgba(45, 104, 237, 0.35), 0 4px 16px rgba(45, 104, 237, 0.2);
}

.login-context-btn.is-selected .login-context-btn-label {
  color: var(--login-accent-blue);
}

.btn-login-studio {
  --bs-btn-color: #fff;
  --bs-btn-bg: #2563eb;
  --bs-btn-border-color: #2563eb;
  --bs-btn-hover-bg: #1d4ed8;
  --bs-btn-hover-border-color: #1d4ed8;
  --bs-btn-focus-shadow-rgb: 37, 99, 235;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
}

/* Carrusel inferior del login (Bootstrap) */
.login-card-carousel-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 260px;
  background: #1a1a1c;
  color: #fff;
}

.login-context-carousel {
  min-height: 260px;
}

.login-context-carousel .carousel-inner {
  min-height: 260px;
}

.login-carousel-item {
  position: relative;
  min-height: 260px;
}

.login-carousel-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 0;
}

.login-carousel-bg-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.52);
  pointer-events: none;
}

.login-carousel-text {
  position: relative;
  z-index: 2;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.25rem 1.75rem 3.25rem;
  max-width: 40rem;
  margin: 0 auto;
}

.login-carousel-indicators {
  position: absolute;
  bottom: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 3;
  gap: 0.4rem;
}

.login-carousel-indicators [type="button"] {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  margin: 0;
  padding: 0;
  background-color: rgba(255, 255, 255, 0.35);
  opacity: 1;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.login-carousel-indicators [type="button"]:hover {
  background-color: rgba(255, 255, 255, 0.55);
}

.login-carousel-indicators .active {
  background-color: #fff;
  transform: scale(1.15);
}

.login-info-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

.login-info-text {
  font-size: 0.875rem;
  line-height: 1.55;
  margin: 0;
  max-width: 42ch;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 400;
}

.login-footnote {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 991.98px) {
  .login-card:not(.login-card-diseltec) {
    flex-direction: column;
    max-width: 480px;
  }

  .login-card:not(.login-card-diseltec) .login-card-carousel-wrap {
    flex-basis: auto;
    width: 100%;
    min-height: 220px;
    order: -1;
  }
}

/* Tablas y cards en contenido — densidad compacta */
.content-area .table {
  --bs-table-cell-padding-y: 0.35rem;
  --bs-table-cell-padding-x: 0.45rem;
  font-size: 0.8125rem;
}

.content-area .table thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.content-area .table td,
.content-area .table tbody th {
  vertical-align: middle;
}

/* Tablas anchas: expandir columnas al contenido y scroll horizontal automático */
.content-area .table-responsive,
.modal-body .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.content-area .table-responsive > .table,
.modal-body .table-responsive > .table {
  width: max-content;
  min-width: 100%;
}

.content-area .table-responsive > .table thead th,
.modal-body .table-responsive > .table thead th {
  white-space: nowrap;
}

.content-area .table-responsive > .table td.text-end,
.content-area .table-responsive > .table th.text-end,
.modal-body .table-responsive > .table td.text-end,
.modal-body .table-responsive > .table th.text-end,
.content-area .table-responsive > .table .font-monospace,
.modal-body .table-responsive > .table .font-monospace {
  white-space: nowrap;
}

.content-area .card {
  --bs-card-spacer-y: 0.75rem;
  --bs-card-spacer-x: 1rem;
}

.content-area .card-body.p-4 {
  padding: 0.85rem 1rem !important;
}

.content-area .btn:not(.btn-icon):not(.btn-icon-sm) {
  font-size: 0.8125rem;
}

.content-area .btn-sm {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 7px;
}

/* Acciones en tablas: botón “pastilla” con SVG nítido (vector, no fuente de iconos) */
.content-area .btn.btn-icon-sm {
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  line-height: 0;
  transition:
    transform 0.18s ease,
    box-shadow 0.22s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.content-area .btn.btn-icon-sm:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 8px 20px rgba(15, 23, 42, 0.1);
}

.content-area .btn.btn-icon-sm:active {
  transform: translateY(0);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.content-area .btn.btn-icon-sm:focus-visible {
  z-index: 1;
}

.content-area .btn.btn-icon-sm .action-icon-svg {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  display: block;
  shape-rendering: geometricPrecision;
}

.content-area .btn.btn-primary.btn-icon-sm .action-icon-svg,
.content-area .btn.btn-primary .action-icon-svg {
  color: #fff;
}

.content-area .auxiliar-pago-indent {
  display: inline-block;
  padding-left: 1rem;
}

/* Enviar por correo — amarillo brillante (hover sólido como Autorizar / outline-success) */
.btn-outline-email {
  --bs-btn-color: var(--action-email);
  --bs-btn-border-color: var(--action-email);
  --bs-btn-hover-color: #1d1d1f;
  --bs-btn-hover-bg: var(--action-email);
  --bs-btn-hover-border-color: var(--action-email-hover);
  --bs-btn-focus-shadow-rgb: 250, 204, 21;
  --bs-btn-active-color: #1d1d1f;
  --bs-btn-active-bg: var(--action-email-hover);
  --bs-btn-active-border-color: var(--action-email-hover);
  --bs-btn-disabled-color: var(--action-email);
  --bs-btn-disabled-border-color: var(--action-email);
  --bs-btn-disabled-opacity: 0.45;
}

/* Botón + alta en tarjeta de filtros (misma familia visual que acciones de tabla) */
.content-area .btn.btn-primary.btn-icon {
  width: 2.65rem;
  height: 2.65rem;
  min-width: 2.65rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  line-height: 0;
  transition:
    transform 0.18s ease,
    box-shadow 0.22s ease,
    border-color 0.15s ease,
    filter 0.2s ease;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 4px 16px rgba(13, 110, 253, 0.35);
}

.content-area .btn.btn-primary.btn-icon:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 10px 28px rgba(13, 110, 253, 0.48);
}

.content-area .btn.btn-primary.btn-icon:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.content-area .btn.btn-primary.btn-icon .action-icon-svg {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  display: block;
  shape-rendering: geometricPrecision;
}

/* Modales: Guardar / Cancelar / Agregar con SVG + texto */
.content-area .btn .modal-action-svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  display: block;
  shape-rendering: geometricPrecision;
}

.content-area .btn.btn-sm .modal-action-svg {
  width: 0.95rem;
  height: 0.95rem;
}

.content-area .btn.btn-modal-foot {
  transition:
    transform 0.16s ease,
    box-shadow 0.2s ease,
    filter 0.15s ease;
}

.content-area .btn.btn-primary.btn-modal-foot:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 110, 253, 0.28);
}

.content-area .btn.btn-outline-secondary.btn-modal-foot:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.09);
}

.content-area .btn.btn-modal-foot:active {
  transform: translateY(0);
}

.content-area .form-control,
.content-area .form-select {
  font-size: 0.8125rem;
  padding: 0.35rem 0.55rem;
  min-height: calc(1.4em + 0.45rem + 2px);
}

.content-area .form-label {
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.content-area .nav-tabs .nav-link {
  padding: 0.4rem 0.65rem;
  font-size: 0.8125rem;
}

.content-area .btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
}

/* Listados tipo catálogo: tarjeta filtros al ras del topbar; mismo padding horizontal */
.content-area:has(.cliente-list-layout),
.content-area:has(.producto-servicio-list-layout),
.content-area:has(.cotizacion-list-layout),
.content-area:has(.settings-list-layout) {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-top: 0;
}

.cotizacion-form-max {
  max-width: min(72rem, calc(100vw - 2rem));
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.modal-dialog.cotizacion-form-max {
  max-width: min(72rem, calc(100vw - 2rem));
}

/* Cotización: encabezado fijo y cuerpo con scroll vertical cuando hay muchas partidas */
.modal-dialog.cotizacion-form-max.modal-dialog-scrollable {
  max-height: calc(100% - 2rem);
}

.modal-dialog.cotizacion-form-max.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.cotizacion-form-max.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.modal-dialog.cotizacion-form-max.modal-dialog-scrollable .modal-header {
  flex-shrink: 0;
}

.modal-dialog.cotizacion-form-max.modal-dialog-scrollable .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cotizacion-totales .cotizacion-totales-row {
  margin-left: 0;
  margin-right: 0;
}

.cotizacion-totales .cotizacion-totales-row > [class*="col-"] {
  padding-left: 0;
  padding-right: 0;
}

.settings-empresa-logo-preview {
  max-height: 72px;
  max-width: 220px;
  object-fit: contain;
}

.cliente-form-half-max {
  max-width: min(60rem, calc(100vw - 2rem));
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.modal-dialog.cliente-form-half-max {
  max-width: min(60rem, calc(100vw - 2rem));
}

/* Pestaña Datos de contacto: misma escala que .content-area (formularios Datos generales + tablas) */
.cliente-contactos-formset .table {
  table-layout: auto;
  --bs-table-cell-padding-y: 0.35rem;
  --bs-table-cell-padding-x: 0.45rem;
  font-size: 0.8125rem;
}

/* Cabeceras de columnas: equivalente a .content-area .form-label */
.cliente-contactos-formset .table thead th {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--bs-body-color);
}

.cliente-contactos-formset .table tbody td {
  vertical-align: middle;
}

.cliente-contactos-formset .contacto-col-nombre .form-control,
.cliente-contactos-formset .contacto-col-puesto .form-control,
.cliente-contactos-formset .contacto-col-telefono .form-control {
  min-width: 11rem;
}

.cliente-contactos-formset .contacto-col-email .form-control {
  min-width: 16rem;
}

.cliente-contactos-formset .contacto-col-actions-header {
  min-width: 3rem;
  padding-inline-end: 0.65rem;
}

.cliente-contactos-formset .table tbody td.contacto-col-actions {
  min-width: 3rem;
  width: 1%;
  white-space: nowrap;
  padding-inline-end: 0.65rem;
}

/* Solo dimensiones: tipografía y padding heredan de .content-area .form-control */
.cliente-contactos-formset .form-control {
  width: 100%;
  min-width: 9rem;
}

/* Icono alineado al cuerpo del .btn-sm del área de contenido */
.cliente-contactos-formset .btn-contacto-remove .bi {
  font-size: 1em;
  vertical-align: -0.06em;
}

/* Orden de compra: botón informativo de historial de compras */
.oc-historial-info-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.65rem;
  padding-inline: 0.65rem;
  color: #fff;
  background: linear-gradient(135deg, #0dcaf0 0%, #0d6efd 100%);
  border: none;
  box-shadow: 0 0 0 0 rgba(13, 202, 240, 0.55);
  animation: oc-historial-info-pulse 2.2s ease-in-out infinite;
}

.oc-historial-info-btn:hover,
.oc-historial-info-btn:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, #31d2f2 0%, #0b5ed7 100%);
  box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.35);
}

.oc-historial-info-btn .action-icon-svg {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

@keyframes oc-historial-info-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(13, 202, 240, 0.55);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 0.45rem rgba(13, 202, 240, 0);
  }
}

.oc-historial-compras-modal .modal-body {
  max-height: min(24rem, 55vh);
  overflow-y: auto;
}

/* Detalle de documento: totales como en formato de impresión */
.documento-detail-totales.cotiz-print-totales-wrap {
  margin-top: 0.25rem;
  margin-bottom: 0;
  margin-left: 76%;
  width: 24%;
  font-size: 0.875rem;
}

.documento-detail-totales .cotiz-print-totales-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.12rem 0;
}

.documento-detail-totales .cotiz-print-totales-row dt {
  margin: 0;
  font-weight: 400;
}

.documento-detail-totales .cotiz-print-totales-row dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 5.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.documento-detail-totales .cotiz-print-totales-row--total dt,
.documento-detail-totales .cotiz-print-totales-row--total dd {
  font-weight: 700;
  padding-top: 0.15rem;
}

@media (max-width: 767.98px) {
  .documento-detail-totales.cotiz-print-totales-wrap {
    margin-left: 0;
    width: 100%;
    max-width: 16rem;
    margin-inline-start: auto;
  }
}
