:root {
  --bg: #f8fafc;
  --bg-strong: #f1f5f9;
  --panel: #ffffff;
  --panel-border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: var(--accent);
  --accent: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-rgb: 37, 99, 235;
  --sky: #60a5fa;
  --sky-deep: #2563eb;
  --sky-soft: #eff6ff;
  --sky-rgb: 96, 165, 250;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --gray-strong: #475569;
  --gray-soft: #f8fafc;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.04);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --surface-radius-xl: 10px;
  --surface-radius-lg: 8px;
  --surface-radius-md: 6px;
  --focus-ring: #2563eb;
  --focus-ring-soft: rgba(37, 99, 235, 0.18);
  --topbar-offset: 152px;
  --layout-gutter: clamp(0.9rem, 2vw, 1.5rem);
  --sidebar-width: clamp(196px, 14vw, 214px);
  --sidebar-gap: clamp(0.85rem, 1.2vw, 1rem);
  --sidebar-mobile-width: min(292px, calc(100vw - (var(--layout-gutter) * 2)));
  --responsive-control-height: 52px;
  --responsive-control-height-compact: 44px;
  --responsive-surface-padding: 1.2rem;
  --form-label-min-height: 2.55rem;
  --form-inline-control-offset: 2.9rem;
}

/* El visor solo se habilita en escritorio; en pantallas pequenas los enlaces conservan la descarga normal. */
.modal-previsualizacion-documento {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 2rem;
  position: fixed;
  z-index: 1200;
}

.modal-previsualizacion-documento[hidden] {
  display: none;
}

.modal-previsualizacion-documento-fondo {
  background: rgba(12, 22, 37, 0.7);
  inset: 0;
  position: absolute;
}

.modal-previsualizacion-documento-dialogo {
  background: var(--panel);
  border: 1px solid var(--color-linea-seccion, var(--panel-border));
  border-radius: 1rem;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  height: min(82vh, 58rem);
  max-width: 76rem;
  position: relative;
  width: min(100%, 76rem);
}

.modal-previsualizacion-documento-cabecera,
.acciones-archivo-documento {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

.modal-previsualizacion-documento-cabecera {
  border-bottom: 1px solid var(--color-linea-seccion-suave, #d6dde9);
}

.modal-previsualizacion-documento-cabecera h2 {
  flex: 1;
  font-size: 1rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-previsualizacion-documento-acciones-cabecera {
  align-items: center;
  display: flex;
  gap: .5rem;
}

.modal-previsualizacion-documento-expandir {
  align-items: center;
  background: transparent;
  border: 1px solid var(--color-linea-seccion, var(--panel-border));
  border-radius: .5rem;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: .45rem;
  padding: .45rem .65rem;
}

.modal-previsualizacion-documento-expandir:hover,
.modal-previsualizacion-documento-expandir:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-previsualizacion-documento-cerrar {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

.contenedor-vista-previa-archivo {
  align-items: center;
  background: rgba(127, 140, 160, 0.06);
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: auto;
}

.visor-previsualizacion-archivo {
  border: 0;
  height: 100%;
  width: 100%;
}

.mensaje-previsualizacion {
  line-height: 1.6;
  max-width: 34rem;
  padding: 2rem;
  text-align: center;
}

.acciones-archivo-documento {
  border-top: 1px solid var(--color-linea-seccion-suave, #d6dde9);
  justify-content: flex-end;
}

.modal-previsualizacion-documento-dialogo.is-ampliado {
  height: 100%;
  max-width: none;
  width: 100%;
}

.modal-previsualizacion-documento-dialogo:fullscreen {
  border: 0;
  border-radius: 0;
  height: 100%;
  max-width: none;
  width: 100%;
}

body.previsualizacion-documento-abierta {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .boton-previsualizar-archivo {
    display: none;
  }
}

@media (max-width: 640px) {
  .modal-previsualizacion-documento-expandir span {
    display: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--topbar-offset) + 1rem);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.06), transparent 24%),
    radial-gradient(circle at bottom left, rgba(var(--sky-rgb), 0.05), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 52%, #edf1f7 100%);
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  line-height: 1.55;
  position: relative;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

body.settings-modal-open {
  overflow: hidden;
}

.app-body,
.auth-body {
  padding-top: calc(var(--topbar-offset) + 1rem);
}

.background-glow {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.55;
  pointer-events: none;
}

.background-glow-a {
  width: 320px;
  height: 320px;
  background: rgba(var(--accent-rgb), 0.12);
  top: 4rem;
  right: 8rem;
}

.background-glow-b {
  width: 280px;
  height: 280px;
  background: rgba(var(--sky-rgb), 0.11);
  left: 4rem;
  bottom: 3rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  font-weight: 800;
  color: #1d2a3b;
  letter-spacing: -0.03em;
}

p,
small,
label,
a,
button,
input,
textarea,
select {
  font: inherit;
}

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

:where(a[href], button, input, textarea, select, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.topbar,
.layout,
.auth-layout {
  position: relative;
  z-index: 1;
}

.topbar {
  display: grid;
  gap: 0.08rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  z-index: 30;
}

.topbar::after {
  display: none;
}

.topbar-surface {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 0;
  box-shadow:
    0 16px 32px rgba(96, 112, 142, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(22px);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
  padding: 0.48rem 1rem;
  position: relative;
  z-index: 2;
}

.topbar-label {
  padding: 0.55rem 0.95rem;
  border-left: 0;
  border-radius: 0;
  background: rgba(109, 75, 242, 0.08);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0;
}

.brand-mark {
  width: 58px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-lockup {
  width: clamp(128px, 10vw, 148px);
  aspect-ratio: 10 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 12px 18px rgba(111, 122, 136, 0.15));
}

.brand-logo-full {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 16px 24px rgba(111, 122, 136, 0.08));
}

.sidebar-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(125, 135, 149, 0.16);
  border-radius: 0;
  background: rgba(249, 251, 254, 0.94);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.sidebar-toggle-nav {
  min-width: 38px;
  min-height: 38px;
  width: 38px;
  height: 38px;
  gap: 0;
  padding: 0;
  margin-right: 0.1rem;
  flex: 0 0 auto;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 158, 216, 0.22);
  background: rgba(237, 244, 252, 0.96);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(21, 158, 216, 0.28);
  outline-offset: 2px;
}

.sidebar-toggle-icon {
  width: 15px;
  height: 15px;
  display: block;
  opacity: 0.88;
}

.sidebar-toggle-nav .sidebar-toggle-icon {
  width: 14px;
  height: 14px;
}

.sidebar-toggle-copy {
  display: none;
}

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

.skip-link {
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 80;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: #ffffff;
  color: #12396f;
  border: 1px solid rgba(18, 57, 111, 0.16);
  box-shadow: 0 14px 28px rgba(23, 38, 66, 0.16);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.brand-copy strong {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.brand-copy small {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--gray-strong);
}

.brand-mark-large {
  width: 72px;
  height: 60px;
}

.brand small,
.topbar-user small,
.sidebar-note,
.help-text,
.panel-header p,
.hero p,
.auth-copy p,
.detail-header p {
  color: var(--muted);
}

.topbar-nav {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.2rem;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.35rem 0.6rem 0.45rem;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  scrollbar-width: thin;
  position: relative;
  z-index: 1;
}

.topbar-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  min-height: 54px;
  padding: 0.82rem 1rem 0.9rem;
  color: #40536f;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex: 0 0 auto;
  border-radius: 0;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.topbar-nav-link:not(:first-of-type) {
  border-left: 0;
}

.topbar-nav-link::after {
  content: "";
  position: absolute;
  left: 0.95rem;
  right: 0.95rem;
  bottom: 0.45rem;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--sky) 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s ease;
}

.topbar-nav-link:hover {
  color: var(--accent-deep);
  background: rgba(109, 75, 242, 0.05);
  transform: translateY(-1px);
}

.topbar-nav-link:hover::after,
.topbar-nav-link.is-active::after {
  transform: scaleX(1);
}

.topbar-nav-link.is-active {
  color: var(--accent-deep);
  background: rgba(109, 75, 242, 0.06);
}

.topbar-nav-link:focus-visible {
  outline: 2px solid rgba(21, 158, 216, 0.28);
  outline-offset: -4px;
  border-radius: 12px;
}

.topbar-nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-shrink: 0;
  min-width: 0;
}

.topbar-leading > *,
.topbar-actions > * {
  min-width: 0;
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, rgba(125, 135, 149, 0.02), rgba(198, 208, 226, 0.82), rgba(125, 135, 149, 0.02));
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.topbar-user strong,
.topbar-user small {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user strong {
  color: #243854;
  font-size: 0.84rem;
  line-height: 1;
}

.topbar-user-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  min-height: 40px;
  padding: 0.35rem 0.72rem;
  border-radius: 0;
  background: rgba(247, 250, 255, 0.92);
  border: 1px solid rgba(214, 222, 237, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.user-menu-shell {
  position: relative;
  min-width: 0;
  flex-shrink: 0;
}

.user-menu-trigger {
  width: auto;
  cursor: pointer;
  text-align: left;
  appearance: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.user-menu-trigger:hover {
  border-color: rgba(47, 158, 255, 0.2);
  background: rgba(247, 251, 255, 0.98);
  color: var(--accent-deep);
}

.user-menu-trigger:focus-visible {
  outline: none;
  border-color: rgba(15, 98, 215, 0.36);
  box-shadow:
    0 0 0 4px rgba(15, 98, 215, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.user-menu-trigger[aria-expanded="true"] {
  border-color: rgba(37, 87, 214, 0.22);
  background: rgba(240, 246, 255, 0.98);
  color: var(--accent-deep);
}

.topbar-user-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
}

.topbar-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(25, 177, 118, 0.12);
  flex-shrink: 0;
}

.topbar-user-caret {
  width: 11px;
  height: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #61718a;
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.topbar-user-caret i {
  font-size: 0.72rem;
  line-height: 1;
}

.user-menu-trigger[aria-expanded="true"] .topbar-user-caret {
  transform: rotate(180deg);
  color: var(--accent-deep);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 35;
  width: min(248px, calc(100vw - 2rem));
  display: grid;
  gap: 0.2rem;
  padding: 0.4rem;
  border: 1px solid rgba(214, 222, 237, 0.96);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(37, 87, 214, 0.06), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 255, 0.97));
  box-shadow:
    0 18px 34px rgba(56, 72, 104, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.user-menu-panel[hidden] {
  display: none;
}

.user-menu-logout {
  margin: 0;
}

.user-menu-item {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.62rem 0.72rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #243854;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.user-menu-item:hover {
  background: rgba(37, 87, 214, 0.08);
  color: var(--accent-deep);
}

.user-menu-item:focus-visible {
  outline: none;
  background: rgba(37, 87, 214, 0.08);
  box-shadow: 0 0 0 3px rgba(15, 98, 215, 0.1);
}

.user-menu-item-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-menu-item-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-menu-item-danger {
  color: #a13d5f;
}

.user-menu-item-danger:hover,
.user-menu-item-danger:focus-visible {
  background: rgba(161, 61, 95, 0.08);
  color: #8c2f4f;
}

.topbar-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  color: #233651;
  font-size: 0.82rem;
  line-height: 1.1;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 8px 18px rgba(102, 118, 148, 0.06);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.topbar-icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.topbar-button-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-button-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-button-copy {
  white-space: nowrap;
}

.settings-trigger {
  color: #2b3d59;
}

.topbar-button:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 158, 255, 0.2);
  background: rgba(247, 251, 255, 0.98);
  color: var(--accent-deep);
  box-shadow: 0 14px 24px rgba(96, 112, 142, 0.1);
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.settings-modal[hidden] {
  display: none;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 30, 50, 0.28);
  backdrop-filter: blur(6px);
}

.settings-modal-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  display: grid;
  gap: 1.2rem;
  padding: 1.6rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(109, 75, 242, 0.06), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.97));
  border: 1px solid rgba(208, 217, 235, 0.94);
  box-shadow: 0 24px 56px rgba(56, 72, 104, 0.18);
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.settings-modal-header h2 {
  margin-bottom: 0.4rem;
}

.settings-modal-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-modal-close {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: #31445f;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.settings-modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-form {
  display: grid;
  gap: 1.2rem;
}

.settings-form-copy {
  display: grid;
  gap: 0.25rem;
}

.settings-form-copy strong {
  color: #223654;
  font-size: 1rem;
}

.settings-form-copy small {
  color: var(--muted);
  line-height: 1.55;
}

.settings-section {
  display: grid;
  gap: 0.85rem;
}

.settings-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.settings-theme-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(208, 217, 235, 0.94);
  background: rgba(250, 252, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.settings-theme-option:focus-within {
  border-color: rgba(var(--accent-rgb), 0.36);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.settings-theme-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 0.12rem;
  accent-color: var(--accent);
}

.settings-theme-option-copy {
  display: grid;
  gap: 0.2rem;
}

.settings-theme-option-copy strong {
  color: #223654;
  font-size: 0.98rem;
}

.settings-theme-option-copy small {
  color: #6b7d95;
  line-height: 1.5;
}

@supports selector(:has(*)) {
  .settings-theme-option:has(input[type="radio"]:checked) {
    border-color: rgba(var(--accent-rgb), 0.3);
    background: rgba(var(--accent-rgb), 0.06);
    box-shadow: 0 10px 20px rgba(var(--accent-rgb), 0.08);
  }
}

.settings-option-list {
  display: grid;
  gap: 0.8rem;
}

.settings-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(208, 217, 235, 0.94);
  background: rgba(250, 252, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.settings-option:focus-within {
  border-color: rgba(var(--accent-rgb), 0.36);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.settings-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}

.settings-option-copy {
  display: grid;
  gap: 0.2rem;
}

.settings-option-copy strong {
  color: #223654;
  font-size: 0.98rem;
}

.settings-option-copy small {
  color: #6b7d95;
  line-height: 1.5;
}

.settings-modal-actions {
  justify-content: flex-end;
}

.settings-empty-state {
  padding: 1.25rem 0.25rem 0.5rem;
}

.topbar-button-logout {
  padding-left: 0.78rem;
  padding-right: 0.82rem;
}

.topbar-logout {
  margin: 0;
}

.topbar-auth .topbar-main {
  min-height: 50px;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--sidebar-gap);
  align-items: start;
  min-width: 0;
  padding: 0 var(--layout-gutter) 2rem;
  transition: grid-template-columns 0.28s ease, gap 0.28s ease;
}

.sidebar,
.panel,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 1rem;
  border-radius: var(--radius-lg);
  align-self: start;
  height: fit-content;
  max-height: calc(100vh - var(--topbar-offset) - 0.85rem);
  max-height: calc(100dvh - var(--topbar-offset) - 0.85rem);
  position: sticky;
  top: calc(var(--topbar-offset) + 0.2rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  background:
    radial-gradient(circle at top right, rgba(109, 75, 242, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.95)),
    var(--panel);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    padding 0.25s ease,
    border-color 0.25s ease,
    max-height 0.25s ease;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-backdrop {
  position: fixed;
  top: var(--topbar-offset);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 25, 42, 0.28);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 24;
}

.sidebar-collapsed .layout {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

.sidebar-collapsed .sidebar {
  opacity: 0;
  transform: translateX(-18px);
  padding: 0;
  border-color: transparent;
  max-height: 0;
  pointer-events: none;
}

.sidebar-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sidebar-mobile-header strong {
  color: #223654;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sidebar-close {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: #31445f;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.sidebar-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.menu-link {
  padding: 0.92rem 1rem;
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.9);
  border: 1px solid rgba(216, 224, 238, 0.92);
  color: #2d4060;
  font-size: 0.94rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.menu-link:hover {
  transform: translateX(2px);
  border-color: rgba(109, 75, 242, 0.16);
  background: linear-gradient(135deg, rgba(241, 237, 255, 0.96), rgba(237, 247, 255, 0.96));
}

.menu-link:focus-visible,
.page-context-link:focus-visible {
  outline-offset: 2px;
}

.menu-link.is-active,
.menu-link[aria-current="page"] {
  border-color: rgba(37, 87, 214, 0.26);
  background: linear-gradient(135deg, rgba(233, 241, 255, 0.98), rgba(241, 247, 255, 0.98));
  color: var(--accent-deep);
  box-shadow:
    inset 3px 0 0 var(--accent),
    0 10px 18px rgba(73, 102, 164, 0.08);
}

.menu-link.is-active:hover,
.menu-link[aria-current="page"]:hover {
  transform: none;
}

.sidebar-note {
  margin: auto 0 0;
  padding-top: 0.95rem;
  line-height: 1.5;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-width: 0;
}

.content > * {
  min-width: 0;
  max-width: 100%;
}

.content h1,
.content h2,
.content h3,
.content p,
.content strong,
.content small,
.content label,
.topbar-user strong,
.topbar-user small {
  overflow-wrap: anywhere;
}

.hero,
.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.85rem 1.95rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(47, 158, 255, 0.1), transparent 34%),
    linear-gradient(135deg, rgba(109, 75, 242, 0.06), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(208, 217, 235, 0.92);
}

.hero {
  display: none;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.55rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: stretch;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.1rem;
}

.stat-card {
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.95));
  border: 1px solid rgba(206, 216, 234, 0.92);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--sky));
}

.stat-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: 2.15rem;
  color: #172a4c;
}

.admin-stats-grid {
  margin-bottom: 1.2rem;
}

.panel {
  padding: 1.7rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(109, 75, 242, 0.05), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.96));
  border-color: rgba(208, 217, 235, 0.92);
  box-shadow: 0 18px 38px rgba(96, 112, 142, 0.1);
}

.panel-narrow {
  max-width: 760px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.35rem;
}

.panel-header h1,
.detail-header h1,
.hero h1 {
  font-size: clamp(2.45rem, 4vw, 3.6rem);
  line-height: 0.98;
  margin-bottom: 0.65rem;
}

.panel-header h2,
.detail-header h2,
.hero h2 {
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  line-height: 1.02;
  margin-bottom: 0.45rem;
}

.filters,
.form-grid {
  display: grid;
  gap: 1rem;
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  align-items: end;
  margin-bottom: 1.2rem;
}

.filters-wide {
  grid-template-columns: minmax(min(100%, 220px), 1.6fr) repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.field,
.checkbox-row {
  display: grid;
  gap: 0.55rem;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  min-height: 58px;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(204, 214, 232, 0.96);
  background: rgba(250, 252, 255, 0.98);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 2px 6px rgba(91, 108, 138, 0.02);
}

select[multiple] {
  min-height: 220px;
}

.input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--focus-ring-soft);
  border-color: rgba(15, 98, 215, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 0 0 4px rgba(15, 98, 215, 0.08);
}

textarea {
  min-height: 144px;
  resize: vertical;
}

.input-shell {
  position: relative;
}

.input-shell .input {
  padding-left: 3rem;
}

.input-shell-icon {
  position: absolute;
  top: 50%;
  left: 1rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #72849c;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-shell-icon svg,
.button svg,
.button-ghost svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 58px;
  border-radius: 18px;
  padding: 0.95rem 1.35rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 46%, var(--sky) 100%);
  color: white;
  box-shadow: 0 16px 28px rgba(var(--accent-rgb), 0.22);
}

.button-danger {
  background: linear-gradient(135deg, #db6e4d 0%, #c7492c 100%);
  box-shadow: 0 16px 28px rgba(199, 73, 44, 0.2);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-color: rgba(206, 216, 234, 0.96);
}

.button-inline-danger {
  min-height: 44px;
  padding: 0.65rem 0.95rem;
  border-radius: 14px;
  color: #c7492c;
  border-color: rgba(199, 73, 44, 0.18);
}

.button:hover,
.button-ghost:hover {
  transform: translateY(-1px);
  opacity: 0.98;
}

.button:hover {
  box-shadow: 0 18px 30px rgba(var(--accent-rgb), 0.24);
}

.button-ghost:hover {
  border-color: rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--accent-rgb), 0.06);
  box-shadow: 0 12px 22px rgba(103, 119, 149, 0.08);
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.data-table thead {
  position: relative;
  z-index: 3;
}

.data-table th,
.data-table td {
  padding: 1rem 1rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(217, 225, 239, 0.92);
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(248, 251, 255, 0.98);
  color: #465978;
  font-size: 0.79rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-top: 1px solid rgba(214, 223, 238, 0.94);
  border-bottom: 1px solid rgba(214, 223, 238, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.data-table thead th:first-child {
  border-top-left-radius: 20px;
}

.data-table thead th:last-child {
  border-top-right-radius: 20px;
}

.data-table th[data-nosort="true"] {
  white-space: nowrap;
}

.data-table tbody td {
  background: rgba(255, 255, 255, 0.84);
  color: #44556a;
  line-height: 1.5;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(248, 250, 255, 0.92);
}

.data-table tbody tr:hover td {
  background: rgba(242, 247, 255, 0.96);
  border-bottom-color: rgba(47, 158, 255, 0.16);
}

.data-table td strong {
  display: block;
  color: #3d4f65;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
}

.data-table td small {
  display: block;
  margin-top: 0.28rem;
  color: #708095;
  font-size: 0.84rem;
  line-height: 1.5;
  word-break: break-word;
}

.data-table td,
.data-table td a,
.data-table td span,
.data-table td strong {
  overflow-wrap: anywhere;
}

/* Limita una descripcion a dos lineas dentro de una fila de tabla, para que
   un texto largo no deforme el alto de la fila (listados de documentos). */
.descripcion-documento-limitada {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 32rem;
}

.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.96));
  box-shadow:
    0 14px 30px rgba(96, 112, 142, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(125, 135, 149, 0.24);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(125, 135, 149, 0.06);
}

.table-summary {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  color: #6f8095;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
}

.table-pagination-summary {
  color: #6f8095;
  font-size: 0.9rem;
  font-weight: 700;
}

.table-pagination-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.table-pagination-link,
.table-pagination-ellipsis {
  min-width: 40px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(208, 217, 235, 0.92);
  background: rgba(255, 255, 255, 0.96);
  color: #526377;
  font-size: 0.88rem;
  font-weight: 700;
}

.table-pagination-link:hover {
  border-color: rgba(47, 158, 255, 0.24);
  background: rgba(47, 158, 255, 0.06);
  color: var(--accent-deep);
}

.table-pagination-link-current {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  color: white;
  box-shadow: 0 12px 24px rgba(92, 73, 211, 0.18);
}

.table-pagination-link-disabled,
.table-pagination-ellipsis {
  color: #93a0b0;
  background: rgba(245, 248, 252, 0.94);
}

.table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.table-sort-button::after {
  content: "↕";
  color: #94a1b1;
  font-size: 0.84rem;
  line-height: 1;
}

.data-table th[aria-sort="ascending"] .table-sort-button::after {
  content: "↑";
  color: var(--accent-deep);
}

.data-table th[aria-sort="descending"] .table-sort-button::after {
  content: "↓";
  color: var(--accent-deep);
}

.table-sort-button::after {
  content: "\2195";
}

.data-table th[aria-sort="ascending"] .table-sort-button::after {
  content: "\2191";
}

.data-table th[aria-sort="descending"] .table-sort-button::after {
  content: "\2193";
}

.muted-copy {
  color: var(--muted);
}

.inline-code {
  display: inline-flex;
  max-width: 100%;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: rgba(111, 122, 136, 0.08);
  color: #4a596c;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  white-space: normal;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  background: rgba(111, 122, 136, 0.1);
}

.status-pendiente {
  background: rgba(239, 244, 250, 0.98);
  color: var(--gray-strong);
}

.status-en-progreso {
  background: rgba(241, 237, 255, 0.96);
  color: var(--accent-deep);
}

.status-bloqueada {
  background: rgba(255, 240, 232, 0.96);
  color: var(--danger);
}

.status-completada {
  background: rgba(234, 248, 242, 0.98);
  color: var(--success);
}

.text-link {
  color: var(--sky-deep);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  transition: color 0.2s ease;
}

.text-link:hover {
  color: var(--accent-deep);
}

.text-link:focus-visible {
  border-radius: 6px;
}

.text-link-danger {
  color: #a13d5f;
}

/* Permite usar .text-link sobre un <button> (por ejemplo, un boton de
   eliminar dentro de un <form>) sin heredar el estilo nativo del control. */
button.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.button-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 14px;
  flex-shrink: 0;
  text-decoration: none;
}

.button-icon-tile i {
  font-size: 1.05rem;
  line-height: 1;
}

.table-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(25, 127, 230, 0.18);
  background: rgba(245, 250, 255, 0.94);
  color: var(--sky-deep);
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 8px 16px rgba(71, 111, 165, 0.08);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.table-icon-action svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-shell-icon i {
  font-size: 1rem;
  line-height: 1;
}

.table-icon-action:hover {
  transform: translateY(-1px);
  border-color: rgba(25, 127, 230, 0.28);
  background: rgba(236, 245, 255, 0.98);
  color: var(--accent-deep);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 10px 18px rgba(71, 111, 165, 0.12);
}

.table-icon-action:focus-visible {
  outline: none;
  border-color: rgba(25, 127, 230, 0.42);
  box-shadow:
    0 0 0 4px rgba(25, 127, 230, 0.12),
    0 10px 18px rgba(71, 111, 165, 0.12);
}

.table-icon-action:active {
  transform: translateY(0);
  background: rgba(226, 239, 255, 1);
  box-shadow:
    inset 0 2px 4px rgba(71, 111, 165, 0.12),
    0 4px 10px rgba(71, 111, 165, 0.08);
}

.messages {
  display: grid;
  gap: 0.7rem;
}

.message,
.form-error {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(109, 75, 242, 0.08);
  color: var(--accent-deep);
  border: 1px solid rgba(109, 75, 242, 0.12);
}

.form-error > * {
  margin: 0;
}

.message.success {
  background: rgba(25, 177, 118, 0.08);
  color: #119464;
  border-color: rgba(25, 177, 118, 0.12);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.panel,
.detail-header,
.hero,
.table-wrap,
.messages,
.stats-grid,
.filters,
.detail-grid,
.attachment-item {
  min-width: 0;
  max-width: 100%;
}

.button-row > *,
.hero-actions > *,
.table-actions > *,
.attachment-item > *,
.topbar-actions > *,
.topbar-user-card > * {
  max-width: 100%;
}

h1,
h2,
h3,
p,
small,
.button,
.button-ghost,
.status-badge,
.role-chip,
.info-chip,
.inline-code,
.menu-link,
.text-link,
.attachment-link {
  overflow-wrap: anywhere;
}


.summary-list {
  display: grid;
  gap: 1rem;
}

.summary-list small,
.timeline-meta small {
  display: block;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.timeline {
  display: grid;
  gap: 1rem;
}

.attachment-list {
  display: grid;
  gap: 1rem;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(250, 252, 255, 0.88);
  border: 1px solid rgba(125, 135, 149, 0.12);
}

.attachment-item small {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
}

.progress-attachments {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.detail-attachments {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(125, 135, 149, 0.12);
}

.detail-attachments h3 {
  margin-bottom: 0.25rem;
  color: var(--gray-strong);
}

.attachment-link {
  display: inline-flex;
  width: fit-content;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: rgba(21, 158, 216, 0.1);
  color: var(--sky-deep);
}

.attachment-link-disabled {
  opacity: 0.7;
  cursor: default;
}

.timeline-item {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: rgba(250, 252, 255, 0.88);
  border-radius: 0 16px 16px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.timeline-meta {
  margin-bottom: 0.6rem;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* Acciones compactas de documentos (repositorios personales, de grupo y de
   proyecto): botones con icono en vez de enlaces de texto extensos, para que
   la columna de acciones se mantenga en una sola linea y no cargue la tabla. */
.acciones-documento {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
}

.columna-acciones-documento {
  white-space: nowrap;
}

.boton-accion-documento {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  opacity: 0.62;
  text-decoration: none;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.boton-accion-documento i {
  font-size: 1rem;
}

.boton-accion-documento:hover,
.boton-accion-documento:focus-visible {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.boton-accion-documento:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* La accion de eliminar se distingue de forma discreta, sin ser agresiva. */
.boton-accion-peligro {
  color: var(--danger);
  opacity: 0.55;
}

.boton-accion-peligro:hover,
.boton-accion-peligro:focus-visible {
  opacity: 1;
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  outline-color: var(--danger);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.data-table .table-actions {
  justify-content: flex-end;
}

/* Global visual cleanup to keep the UI airy and consistent. */
body {
  background:
    radial-gradient(circle at top right, rgba(37, 87, 214, 0.06), transparent 24%),
    radial-gradient(circle at bottom left, rgba(75, 137, 239, 0.05), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 52%, #edf1f7 100%);
}

.background-glow {
  filter: blur(68px);
  opacity: 0.3;
}

.background-glow-a {
  width: 260px;
  height: 260px;
  background: rgba(37, 87, 214, 0.08);
}

.background-glow-b {
  width: 220px;
  height: 220px;
  background: rgba(75, 137, 239, 0.07);
}

.topbar-surface {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(217, 224, 234, 0.94);
  box-shadow:
    0 8px 22px rgba(64, 82, 110, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.topbar-main {
  min-height: 58px;
  padding: 0.48rem 1rem;
}

.topbar-label {
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
}

.brand-logo-full,
.brand-logo-icon {
  filter: none;
}

.sidebar-toggle {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(208, 217, 231, 0.92);
  box-shadow: none;
}

.topbar-nav {
  gap: 0.45rem;
  padding: 0.45rem 0.9rem 0.65rem;
  border-top: 1px solid rgba(225, 231, 240, 0.9);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-nav-link {
  min-height: 48px;
  padding: 0.72rem 0.92rem 0.8rem;
  border-radius: 14px;
  color: #566678;
  font-size: 0.9rem;
  font-weight: 700;
}

.topbar-nav-link::after {
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.38rem;
  height: 3px;
}

.topbar-nav-link:hover {
  color: var(--accent-deep);
  background: rgba(37, 87, 214, 0.06);
  transform: none;
}

.topbar-nav-link.is-active {
  color: var(--accent-deep);
  background: rgba(37, 87, 214, 0.08);
}

.topbar-user-card {
  min-height: 40px;
  padding: 0.35rem 0.72rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(214, 221, 233, 0.94);
  box-shadow: none;
}

.topbar-button {
  min-height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(211, 219, 231, 0.94);
  box-shadow: none;
}

.topbar-button:hover {
  transform: none;
  border-color: rgba(37, 87, 214, 0.18);
  background: var(--gray-soft);
  box-shadow: none;
}

.settings-modal-card {
  gap: 1.1rem;
  padding: 1.75rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.99);
  border-color: rgba(214, 221, 233, 0.94);
  box-shadow: 0 22px 48px rgba(45, 60, 84, 0.14);
}

.layout {
  gap: var(--sidebar-gap);
}

.sidebar,
.panel,
.auth-card {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(211, 219, 231, 0.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.sidebar {
  padding: 1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 253, 255, 0.98));
}

.menu {
  gap: 0.45rem;
}

.menu-group {
  display: grid;
  gap: 0.28rem;
}

.menu-group + .menu-group {
  margin-top: 0.5rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(225, 231, 240, 0.92);
}

.menu-group-label {
  display: inline-flex;
  align-items: center;
  padding: 0 0.2rem;
  color: #6a798c;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.menu-link {
  display: block;
  padding: 0.72rem 0.82rem;
  border-radius: 14px;
  background: transparent;
  border-color: transparent;
  color: #32465c;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.menu-link:hover {
  transform: none;
  border-color: rgba(211, 219, 231, 0.92);
  background: var(--gray-soft);
}

.menu-link.is-active {
  background: rgba(37, 87, 214, 0.08);
  border-color: rgba(37, 87, 214, 0.14);
  color: var(--accent-deep);
  box-shadow: inset 3px 0 0 rgba(37, 87, 214, 0.82);
}

.menu-link-secondary {
  color: #4a5d74;
}

.menu-link-secondary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  margin-right: 0.35rem;
  color: var(--accent);
  font-weight: 900;
}

.menu,
.menu-group {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}

.menu-item-expandable {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.3rem;
}

.menu-item-expandable > .menu-link {
  flex: 1 1 auto;
  min-width: 0;
}

.menu-item-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  padding: 0;
  border-radius: 0.42rem;
  border: 1px solid transparent;
  background: transparent;
  color: #6a798c;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.menu-item-toggle:hover {
  border-color: rgba(211, 219, 231, 0.92);
  background: var(--gray-soft);
  color: var(--accent-deep);
}

.menu-item-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring-soft);
}

.menu-item-toggle i {
  font-size: 0.58rem;
  transition: transform 0.2s ease;
}

.menu-item-expandable.is-expanded .menu-item-toggle {
  color: var(--accent-deep);
}

.menu-item-expandable.is-expanded .menu-item-toggle i {
  transform: rotate(90deg);
}

.menu-item-expandable > .menu-link-caret {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding-right: 0.4rem;
  color: #9aa7b8;
}

.menu-submenu {
  flex: 0 0 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
  margin: 0 0 0.15rem;
  padding: 0;
  overflow-x: hidden;
  max-height: 15rem;
  overflow-y: auto;
}

.menu-submenu[hidden] {
  display: none;
}

.menu-submenu-link {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.4rem;
  padding: 0.32rem 0.5rem 0.32rem 1.87rem;
  border-radius: 8px;
  color: #4a5d74;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu-submenu-link:hover,
.menu-submenu-link:focus-visible {
  background: var(--gray-soft);
  color: var(--accent-deep);
}

.menu-submenu-link.is-active {
  background: rgba(37, 87, 214, 0.08);
  color: var(--accent-deep);
  font-weight: 700;
}

.menu-submenu-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-submenu-link-action {
  color: var(--accent-deep);
}

.menu-submenu-link-action i {
  font-size: 0.76rem;
}

.sidebar-note {
  margin-top: 1rem;
  font-size: 0.86rem;
  line-height: 1.55;
}

.page-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid rgba(214, 221, 233, 0.94);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(64, 82, 110, 0.05);
}

.page-context-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.page-context-section {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: rgba(237, 243, 255, 0.98);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
  min-width: 0;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  color: #6f7f92;
  font-size: 0.9rem;
}

.breadcrumb-item:not(:last-child)::after {
  content: "/";
  color: #9aa7b5;
  flex-shrink: 0;
}

.breadcrumb-item a,
.breadcrumb-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.breadcrumb-item a {
  color: #55677d;
  font-weight: 700;
}

.breadcrumb-item a:hover {
  color: var(--accent-deep);
}

.breadcrumb-item.is-current {
  color: #23364d;
  font-weight: 800;
}

.page-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.page-context-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(211, 219, 231, 0.94);
  background: rgba(255, 255, 255, 0.98);
  color: var(--accent-deep);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.page-context-link:hover {
  border-color: rgba(37, 87, 214, 0.16);
  background: var(--gray-soft);
}

.page-context-link-muted {
  color: #53667d;
}

.hero,
.detail-header {
  padding: 1.65rem 1.75rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 253, 0.97));
  border-color: rgba(211, 219, 231, 0.94);
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--accent);
  letter-spacing: 0.11em;
  font-size: 0.76rem;
}

.stats-grid {
  gap: 1rem;
}

.stat-card {
  padding: 1.2rem 1.25rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.99);
  border-color: rgba(214, 221, 233, 0.94);
  box-shadow: 0 8px 20px rgba(64, 82, 110, 0.06);
}

.stat-card::before {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--sky));
}

.stat-card small {
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.85rem;
  letter-spacing: -0.03em;
}

.panel {
  padding: 1.55rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(251, 253, 255, 0.98));
  box-shadow: 0 12px 28px rgba(64, 82, 110, 0.08);
}

.panel-header {
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}

.panel-header h1,
.detail-header h1,
.hero h1 {
  font-size: clamp(2rem, 3vw, 2.85rem);
  line-height: 1.04;
  margin-bottom: 0.5rem;
}

.panel-header h2,
.detail-header h2,
.hero h2 {
  font-size: clamp(1.45rem, 2vw, 1.95rem);
  line-height: 1.12;
  margin-bottom: 0.32rem;
}

.panel-header p,
.hero p,
.detail-header p {
  max-width: 60ch;
  font-size: 0.96rem;
  line-height: 1.7;
}

.filters,
.form-grid {
  gap: 1.05rem;
}

.field,
.checkbox-row {
  gap: 0.45rem;
}

.field label {
  color: #32465c;
  font-size: 0.92rem;
  font-weight: 700;
}

.selection-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.selection-group > legend {
  margin: 0 0 0.55rem;
  padding: 0;
  color: #32465c;
  font-size: 0.92rem;
  font-weight: 700;
}

.input,
textarea,
select {
  min-height: 54px;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border-color: rgba(211, 219, 231, 0.96);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: none;
}

.input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--focus-ring-soft);
  border-color: rgba(15, 98, 215, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 98, 215, 0.08);
}

.button,
.button-ghost {
  min-height: 52px;
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  font-size: 0.94rem;
}

.button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 10px 22px rgba(37, 87, 214, 0.18);
}

.button:hover {
  box-shadow: 0 12px 24px rgba(37, 87, 214, 0.2);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.99);
  color: var(--text);
  border-color: rgba(211, 219, 231, 0.96);
}

.button-ghost:hover {
  border-color: rgba(37, 87, 214, 0.16);
  background: var(--gray-soft);
  box-shadow: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.role-chip,
.info-chip,
.info-chip-muted {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(214, 221, 233, 0.96);
  background: rgba(246, 249, 253, 0.98);
  color: #3f5369;
  font-size: 0.82rem;
  font-weight: 700;
}

.role-chip {
  background: rgba(237, 243, 255, 0.98);
  color: var(--accent-deep);
}

.info-chip {
  background: rgba(238, 244, 255, 0.98);
  color: var(--sky-deep);
}

.info-chip-muted {
  color: var(--gray-strong);
}

.data-table th,
.data-table td {
  padding: 0.9rem 0.95rem;
}

.data-table thead th {
  background: rgba(247, 249, 252, 0.99);
  color: #5c6c7f;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  border-top-color: rgba(217, 224, 234, 0.94);
  border-bottom-color: rgba(217, 224, 234, 0.94);
  box-shadow: none;
}

.data-table tbody td {
  background: rgba(255, 255, 255, 0.98);
  color: #425266;
  line-height: 1.55;
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(250, 252, 255, 0.98);
}

.data-table tbody tr:hover td {
  background: rgba(244, 248, 253, 0.98);
  border-bottom-color: rgba(75, 137, 239, 0.14);
}

.table-wrap {
  border-color: rgba(214, 221, 233, 0.94);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 8px 20px rgba(64, 82, 110, 0.06);
}

.table-pagination {
  border-color: rgba(214, 221, 233, 0.94);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
}

.table-pagination-link,
.table-pagination-ellipsis {
  border-radius: 12px;
}

.table-pagination-link-current {
  background: linear-gradient(135deg, var(--accent), var(--sky));
  box-shadow: 0 10px 18px rgba(37, 87, 214, 0.16);
}

.status-badge {
  padding: 0.42rem 0.76rem;
  border: 1px solid rgba(214, 221, 233, 0.94);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.messages {
  gap: 0.6rem;
}

.message,
.form-error {
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: rgba(237, 243, 255, 0.98);
  color: var(--accent-deep);
  border-color: rgba(187, 205, 241, 0.9);
}

.message.success {
  background: rgba(234, 248, 242, 0.98);
  border-color: rgba(190, 230, 212, 0.92);
}

.attachment-item {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: rgba(249, 251, 254, 0.98);
  border-color: rgba(217, 224, 234, 0.94);
}

.timeline-item {
  border-left-width: 3px;
  background: rgba(249, 251, 254, 0.98);
  box-shadow: none;
}

.empty-state {
  max-width: 52ch;
  margin: 0 auto;
  padding: 1.8rem 1rem;
}

.form-layout {
  display: grid;
  gap: 1.15rem;
}

.form-meta,
.form-section,
.form-feedback,
.form-inline-status {
  border: 1px solid rgba(214, 221, 233, 0.94);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
}

.form-meta,
.form-inline-status {
  padding: 0.95rem 1rem;
}

.form-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
}

.form-meta strong,
.form-section-heading strong {
  display: block;
  margin-bottom: 0.18rem;
  color: #23364e;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-meta p,
.form-section-heading p,
.form-feedback p {
  margin: 0;
  color: #5d6d81;
  line-height: 1.62;
}

.form-meta-note {
  max-width: 28ch;
  color: #607286;
  font-size: 0.88rem;
}

.form-section {
  display: grid;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1.2rem;
}

.form-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
}

.form-section-heading h2,
.form-section-heading h3 {
  margin-bottom: 0.22rem;
  font-size: 1.12rem;
  color: #20324a;
}

.form-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.field label,
.checkbox-row label,
.selection-group > legend {
  line-height: 1.4;
}

.help-text {
  color: #64768b;
  line-height: 1.58;
}

.form-feedback {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
}

.panel > .form-feedback,
.auth-form-panel > .form-feedback {
  margin-bottom: 1rem;
}

.form-feedback-copy strong {
  display: block;
  margin-bottom: 0.2rem;
}

.form-feedback-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.15rem;
}

.form-feedback-list a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.form-feedback-error {
  background: rgba(255, 245, 242, 0.98);
  border-color: rgba(233, 186, 171, 0.94);
  color: #9b3e2a;
}

.form-inline-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #36516d;
}

.form-inline-status::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(21, 158, 216, 0.24);
  box-shadow: 0 0 0 6px rgba(21, 158, 216, 0.08);
  flex: 0 0 auto;
}

.form-inline-status.is-loading::before {
  border: 2px solid rgba(37, 87, 214, 0.2);
  border-top-color: rgba(37, 87, 214, 0.92);
  background: transparent;
  box-shadow: none;
  animation: spin 0.85s linear infinite;
}

.form-inline-status.is-success {
  color: #146545;
  background: rgba(234, 248, 242, 0.98);
  border-color: rgba(190, 230, 212, 0.92);
}

.form-inline-status.is-success::before {
  background: rgba(25, 177, 118, 0.28);
  box-shadow: 0 0 0 6px rgba(25, 177, 118, 0.08);
}

.form-inline-status.is-error {
  color: #9b3e2a;
  background: rgba(255, 245, 242, 0.98);
  border-color: rgba(233, 186, 171, 0.94);
}

.form-inline-status.is-error::before {
  background: rgba(199, 73, 44, 0.24);
  box-shadow: 0 0 0 6px rgba(199, 73, 44, 0.08);
}

.messages {
  gap: 0.72rem;
}

.message,
.form-error {
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
}

.message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(237, 243, 255, 0.98);
  color: var(--accent-deep);
  border: 1px solid rgba(187, 205, 241, 0.9);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.message.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.message-copy {
  flex: 1 1 auto;
  line-height: 1.58;
}

.message.success {
  background: rgba(234, 248, 242, 0.98);
  color: #146545;
  border-color: rgba(190, 230, 212, 0.92);
}

.message.error,
.message.danger {
  background: rgba(255, 245, 242, 0.98);
  color: #9b3e2a;
  border-color: rgba(233, 186, 171, 0.94);
}

.message.warning {
  background: rgba(255, 248, 236, 0.98);
  color: #8a5a16;
  border-color: rgba(235, 208, 156, 0.94);
}

.message-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.message-dismiss:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: scale(1.03);
}

.message-dismiss span {
  font-size: 1.15rem;
  line-height: 1;
}

.button.is-loading,
.button-ghost.is-loading,
.form-layout.is-submitting .button:not(.is-loading),
.form-layout.is-submitting .button-ghost:not(.is-loading) {
  pointer-events: none;
}

.button.is-loading,
.button-ghost.is-loading {
  position: relative;
  opacity: 0.92;
}

.button.is-loading::before,
.button-ghost.is-loading::before {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: rgba(255, 255, 255, 0.96);
  animation: spin 0.85s linear infinite;
}

.button-ghost.is-loading::before {
  border-color: rgba(37, 87, 214, 0.18);
  border-top-color: rgba(37, 87, 214, 0.92);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {

  :root {
    --topbar-offset: 204px;
  }

  .layout,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .hero,
  .detail-header {
    flex-direction: column;
  }

  .topbar-main {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-leading,
  .topbar-actions {
    justify-content: space-between;
  }

  .topbar-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .topbar-divider {
    display: none;
  }

  .topbar-user-card {
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .user-menu-shell {
    flex: 1 1 auto;
  }

  .topbar-nav {
    justify-content: flex-start;
  }

  .topbar {
    padding-left: 0;
    padding-right: 0;
  }

  .form-meta,
  .form-section-heading {
    flex-direction: column;
  }

  .form-meta-note {
    max-width: none;
  }

  .project-detail-hero,
  .project-summary-band {
    grid-template-columns: 1fr;
  }

  .project-hero-aside {
    width: 100%;
    flex: 1 1 auto;
  }

  .project-summary-band-visual {
    min-height: 120px;
  }

  .auth-copy h1 {
    max-width: 12ch;
    font-size: clamp(2.2rem, 6vw, 3.4rem);
  }

  .auth-highlight-grid {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: fixed;
    top: calc(var(--topbar-offset) + 0.5rem);
    left: var(--layout-gutter);
    bottom: 1rem;
    width: var(--sidebar-mobile-width);
    max-width: calc(100vw - (var(--layout-gutter) * 2));
    max-height: calc(100vh - var(--topbar-offset) - 1.5rem);
    height: auto;
    padding: 1.25rem;
    border-color: var(--panel-border);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    transform: translateX(calc(-100% - 1.4rem));
    pointer-events: none;
    z-index: 26;
  }

  .sidebar-mobile-header {
    display: flex;
  }

  .page-context-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-context-actions {
    width: 100%;
    justify-content: flex-start;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  body.sidebar-mobile-open .sidebar {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-collapsed .layout {
    gap: 1.35rem;
  }
}

@media (max-width: 860px) {
  .table-wrap {
    border-radius: 20px;
  }

  .data-table {
    min-width: 0;
  }

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

  .data-table tbody {
    display: grid;
    gap: 0.9rem;
    padding: 0.95rem;
  }

  .data-table tbody tr {
    display: grid;
    gap: 0.65rem;
    padding: 1rem;
    border: 1px solid rgba(125, 135, 149, 0.1);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 248, 252, 0.93));
    box-shadow:
      0 12px 22px rgba(84, 101, 122, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.92);
  }

  .data-table tbody td {
    display: grid;
    grid-template-columns: minmax(110px, 132px) minmax(0, 1fr);
    gap: 0.85rem;
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  .data-table tbody td::before {
    content: attr(data-column-label);
    color: #6b7b8f;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .data-table tbody td.table-cell-actions,
  .data-table tbody td[data-column-label=""] {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.25rem;
  }

  .data-table tbody td.table-cell-actions::before,
  .data-table tbody td[data-column-label=""]::before {
    display: none;
  }

  .data-table .table-actions,
  .data-table .acciones-documento {
    justify-content: flex-start;
  }

  .data-table .inline-code {
    justify-content: flex-start;
  }

  .table-pagination {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .layout {
    padding-left: var(--layout-gutter);
    padding-right: var(--layout-gutter);
  }

  .panel,
  .detail-header,
  .hero {
    padding: 1.35rem;
  }

  .page-context-bar {
    padding: 0.9rem;
  }

  .panel-header {
    flex-direction: column;
  }

  .stats-grid,
  .filters,
  .filters-wide,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .button-row,
  .hero-actions,
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button-row > *,
  .hero-actions > *,
  .table-actions > *,
  .attachment-item > * {
    width: 100%;
  }

  .attachment-item {
    align-items: flex-start;
  }

  .attachment-link {
    justify-content: center;
  }

  .topbar-user strong,
  .topbar-user small {
    max-width: none;
    white-space: normal;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-offset: 232px;
  }

  .layout {
    padding-left: var(--layout-gutter);
    padding-right: var(--layout-gutter);
  }

  .topbar {
    left: 0;
    right: 0;
    padding: 0;
  }

  .topbar-main,
  .topbar-nav {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .topbar-surface {
    border-radius: 0;
  }

  .topbar-actions,
  .button-row,
  .hero-actions,
  .page-context-actions {
    width: 100%;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .notification-shell {
    align-self: flex-start;
  }

  .notification-trigger {
    width: 40px;
    min-width: 40px;
    justify-content: center;
  }

  .notification-panel {
    right: 0;
    left: auto;
    width: min(420px, calc(100vw - 1.7rem));
  }

  .topbar-leading {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .topbar-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
  }

  .topbar-nav-link {
    min-height: 52px;
    padding: 0.72rem 0.95rem 0.86rem;
    font-size: 0.9rem;
  }

  .topbar-nav-icon {
    width: 24px;
    height: 24px;
  }

  .topbar-nav-icon svg {
    width: 22px;
    height: 22px;
  }

  .topbar-user-card {
    width: 100%;
    min-height: 40px;
    padding: 0.46rem 0.68rem;
  }

  .user-menu-shell {
    width: 100%;
  }

  .user-menu-panel {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
  }

  .topbar-logout,
  .topbar-button-logout,
  .page-context-link {
    width: 100%;
  }

  .topbar-user {
    gap: 0.3rem;
  }

  .topbar-user-meta {
    display: none;
  }

  .brand-lockup {
    width: min(100%, 140px);
  }

  .panel-projects {
    padding: 1.2rem;
  }

  .auth-layout {
    padding: 1rem;
  }

  .auth-card {
    padding: 0.9rem;
    gap: 1rem;
  }

  .auth-copy,
  .auth-form-panel {
    padding: 1.45rem;
  }

  .project-grid,
  .project-metrics,
  .project-summary-metrics,
  .project-hero-mini-metrics {
    grid-template-columns: 1fr;
  }

  .project-card-head,
  .project-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-detail-hero,
  .project-summary-panel,
  .project-team-panel,
  .project-task-panel,
  .project-updates-panel {
    padding: 1.25rem;
  }

  .project-hero-copy h1,
  .project-section-header h2 {
    font-size: 1.8rem;
  }

  .project-hero-meta {
    flex-direction: column;
  }

  .project-hero-meta-card,
  .project-hero-actions,
  .project-summary-band {
    width: 100%;
  }

  .project-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .project-summary-band {
    padding: 1rem;
  }

  .project-summary-band-visual {
    min-height: 96px;
  }

  .project-team-member {
    grid-template-columns: 1fr;
  }

  .project-team-avatar {
    width: 40px;
    height: 40px;
  }

  .table-pagination {
    padding: 0.85rem;
  }

  .table-pagination-links {
    width: 100%;
  }

  .table-pagination-link,
  .table-pagination-ellipsis {
    min-width: 36px;
    min-height: 36px;
    padding: 0.5rem 0.7rem;
  }

  .user-picker-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-form-panel h2 {
    font-size: 1.9rem;
  }

  .settings-modal {
    padding: 0.75rem;
  }

  .settings-modal-card {
    padding: 1.2rem;
  }

  .settings-modal-header {
    flex-direction: column;
  }

  .settings-modal-close {
    align-self: flex-end;
  }

  .settings-option {
    grid-template-columns: 1fr;
  }

  .settings-modal-actions {
    width: 100%;
  }

  .settings-modal-actions .button,
  .settings-modal-actions .button-ghost {
    width: 100%;
  }

  .settings-theme-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :root {
    --layout-gutter: 0.85rem;
  }

  .data-table tbody td {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .data-table tbody td::before {
    margin-bottom: 0.05rem;
  }

  .checkbox-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .topbar-main,
  .topbar-nav {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .brand-lockup {
    width: min(100%, 132px);
  }
}

/* Responsive hardening to keep shared layout pieces inside the viewport. */
.settings-modal-card {
  max-height: min(760px, calc(100vh - 3rem));
  max-height: min(760px, calc(100dvh - 3rem));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.filters > *,
.form-section-grid > *,
.detail-grid > *,
.stats-grid > *,
.page-context-actions > *,
.hero-actions > *,
.button-row > * {
  min-width: 0;
}

.topbar-nav {
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.topbar-nav-link {
  scroll-snap-align: start;
}

.menu-link-label,
.page-context-link,
.table-summary,
.form-meta-note,
.settings-option-copy,
.notification-copy {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .page-context-copy,
  .page-context-actions,
  .panel-header > *,
  .detail-header > *,
  .hero > * {
    min-width: 0;
  }

  .table-summary {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .settings-modal {
    place-items: start center;
    padding: 0.75rem;
  }

  .settings-modal-card {
    width: 100%;
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    padding: 1rem;
  }

  .notification-panel,
  .user-menu-panel {
    max-height: min(32rem, calc(100vh - var(--topbar-offset) - 1.25rem));
    max-height: min(32rem, calc(100dvh - var(--topbar-offset) - 1.25rem));
  }

  .page-context-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-context-link {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .topbar-nav-link {
    min-height: 48px;
    padding: 0.66rem 0.8rem;
    font-size: 0.84rem;
  }

  .topbar-nav-icon {
    width: 22px;
    height: 22px;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    width: min(272px, calc(100vw - (var(--layout-gutter) * 2)));
  }
}

/* SIGT SaaS redesign: tokens merged into the single :root at the top of this file. */

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  background-image: none;
  font-family: "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

.background-glow {
  display: none;
}

h1,
h2,
h3 {
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-weight: 700;
}

.muted-copy,
.panel-header p,
.page-context-copy p,
.table-summary,
.form-meta-note,
.empty-state p,
.empty-state-inline p,
.notification-empty p,
.task-scope-current {
  color: var(--muted);
}

.topbar {
  gap: 0.2rem;
}

.topbar-surface {
  border: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(18px);
}

.topbar-main {
  min-height: 66px;
  padding: 0.7rem 1rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1rem 0.85rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: rgba(248, 250, 252, 0.92);
}

.topbar-nav::-webkit-scrollbar {
  display: none;
}

.brand-lockup {
  width: clamp(118px, 9vw, 140px);
}

.topbar-actions,
.topbar-actions-compact {
  --topbar-control-height: 42px;
  align-items: center;
  gap: 0.75rem;
}

.topbar-greeting {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: min(34rem, 44vw);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-greeting-primary,
.topbar-greeting-secondary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-greeting-primary {
  color: var(--gray-strong);
  font-weight: 600;
}

.topbar-greeting-secondary {
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-greeting-secondary::before {
  content: "·";
  margin: 0 0.4rem;
  color: #cbd5e1;
}

.topbar-button,
.notification-trigger,
.sidebar-toggle {
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: #ffffff;
  box-shadow: none;
}

.topbar-button,
.notification-trigger,
.topbar-user-card {
  min-height: var(--topbar-control-height);
}

.notification-trigger {
  width: var(--topbar-control-height);
  min-width: var(--topbar-control-height);
  height: var(--topbar-control-height);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  line-height: 1;
}

.topbar-button:hover,
.notification-trigger:hover,
.sidebar-toggle:hover {
  border-color: rgba(var(--accent-rgb), 0.22);
  background: var(--accent-soft);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.sidebar-toggle-nav {
  margin-right: 0.15rem;
}

.topbar-nav-link {
  min-height: 42px;
  padding: 0.6rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
}

.topbar-nav-link::after {
  display: none;
}

.topbar-nav-link:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(37, 99, 235, 0.16);
  color: var(--accent-deep);
}

.topbar-nav-link.is-active,
.topbar-nav-link[aria-current="page"] {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.18);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.topbar-nav-icon {
  width: 1rem;
  height: 1rem;
}

.topbar-user-card {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  padding: 0 0.65rem 0 0.45rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  line-height: 1;
}

.topbar-user-avatar {
  width: calc(var(--topbar-control-height) - 10px);
  height: calc(var(--topbar-control-height) - 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 800;
  flex-shrink: 0;
}

.topbar-user strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
}

.topbar-user-meta small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1;
}

.topbar-status-dot {
  background: #22c55e;
}

.notification-panel,
.user-menu-panel,
.settings-modal-card,
.modal-content {
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.user-menu-panel {
  min-width: 240px;
}

.user-menu-item,
.notification-sound-toggle,
.notification-clear {
  border-radius: 12px;
}

.notification-panel-header,
.notification-item,
.notification-main,
.notification-meta-bottom {
  color: inherit;
}

.notification-item {
  border-bottom: 1px solid rgba(226, 232, 240, 0.72);
}

.notification-item:last-child {
  border-bottom: 0;
}

.layout {
  gap: var(--sidebar-gap);
  align-items: start;
}

.sidebar,
.panel,
.detail-header,
.filters,
.settings-modal-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.05rem 0.9rem;
  max-height: calc(100vh - var(--topbar-offset) - var(--layout-gutter));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu {
  display: grid;
  gap: 1rem;
}

.menu-group {
  display: grid;
  gap: 0.45rem;
}

.menu-group-label {
  padding: 0 0.2rem;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-link {
  min-height: 44px;
  padding: 0.72rem 0.82rem;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--gray-strong);
  font-size: 0.93rem;
  font-weight: 600;
  background: transparent;
}

.menu-link:hover,
.menu-link:focus-visible {
  background: rgba(var(--accent-rgb), 0.06);
  border-color: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-deep);
}

.menu-link.is-active,
.menu-link[aria-current="page"] {
  background: linear-gradient(
    180deg,
    rgba(var(--accent-rgb), 0.12) 0%,
    rgba(var(--sky-rgb), 0.1) 100%
  );
  border-color: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}

.menu-link-secondary::before {
  display: none;
}

.sidebar-note {
  margin-top: auto;
  padding: 0.95rem 0.25rem 0;
  border-top: 1px solid rgba(226, 232, 240, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.content,
.auth-layout {
  display: grid;
  gap: 1rem;
}

.page-context-bar {
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.page-context-copy strong,
.page-context-link {
  color: var(--text);
}

.page-context-link {
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: #ffffff;
  font-weight: 600;
}

.page-context-link:hover {
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--accent);
}

.panel,
.detail-header {
  padding: 1.4rem;
}

.panel-header {
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.panel-header h1,
.panel-header h2 {
  color: var(--text);
  line-height: 1.08;
}

.panel-header h1 {
  font-size: clamp(2rem, 2.4vw, 2.75rem);
}

.panel-header h2 {
  font-size: clamp(1.45rem, 2vw, 1.9rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.36rem 0.68rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button,
.button-ghost,
.button-danger {
  min-height: 44px;
  padding: 0.72rem 1rem;
  border-radius: 14px;
  font-size: 0.94rem;
  font-weight: 700;
  box-shadow: none;
}

.button {
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--sky) 0%, var(--accent) 100%);
  color: #ffffff;
}

.button:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #ffffff;
}

.button-ghost {
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: var(--text);
}

.button-ghost:hover {
  border-color: rgba(var(--accent-rgb), 0.2);
  background: var(--accent-soft);
  color: var(--accent);
}

.button-danger {
  border: 1px solid rgba(220, 38, 38, 0.16);
  background: #ffffff;
  color: var(--danger);
}

.button-danger:hover {
  background: var(--danger-soft);
  color: #b91c1c;
}

.filters,
.filters-wide,
.form-section,
.form-meta,
.settings-option,
.task-history-collapsible,
.json-block {
  background: #ffffff;
}

.filters {
  gap: 1rem;
  padding: 1.2rem;
  border-radius: 20px;
}

.field {
  gap: 0.45rem;
}

.field label,
.form-section-heading strong,
.audit-filters label {
  color: var(--text);
  font-size: 0.81rem;
  font-weight: 700;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-shell:focus-within {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.input-shell-icon {
  position: absolute;
  top: 50%;
  left: 0.95rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.input,
textarea,
select,
.bootstrap-ui .form-control,
.bootstrap-ui .form-select {
  min-height: 46px;
  padding: 0.72rem 0.92rem;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  box-shadow: none;
}

.input-shell .input {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.input-shell .input-shell-icon + .input,
.input-shell .input-shell-icon + input,
.input-shell .input-shell-icon + .form-control,
.input-shell .input-shell-icon + .form-select,
.input-shell .input-shell-icon + select {
  padding-inline-start: 2rem;
}

textarea,
.bootstrap-ui textarea.form-control {
  min-height: 120px;
}

.input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

.input:hover,
textarea:hover,
select:hover,
.bootstrap-ui .form-control:hover,
.bootstrap-ui .form-select:hover {
  border-color: #cbd5e1;
}

.input:focus,
textarea:focus,
select:focus,
.bootstrap-ui .form-control:focus,
.bootstrap-ui .form-select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.form-meta,
.form-section {
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: none;
}

.form-meta strong,
.form-section-heading h2 {
  color: var(--text);
}

.table-wrap {
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: none;
}

.data-table {
  table-layout: fixed;
}

.data-table thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.95rem;
}

.data-table tbody td {
  background: #ffffff;
  border-bottom-color: rgba(226, 232, 240, 0.9);
}

.data-table tbody tr:nth-child(even) td {
  background: #ffffff;
}

.data-table tbody tr:hover td {
  background: #f8fbff;
}

.table-icon-action {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--accent);
}

.table-icon-action:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.table-summary,
.button-row,
.table-actions,
.hero-actions,
.chip-row {
  gap: 0.75rem;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.38rem 0.72rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.info-chip-muted {
  background: var(--gray-soft);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.32rem 0.72rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}

.status-pendiente {
  background: #eef2ff;
  border-color: #dbe4ff;
  color: #475569;
}

.status-en-progreso {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.status-bloqueada,
.status-vencida {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.status-completada {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.messages {
  gap: 0.75rem;
}

.message {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.attachment-paste-hint,
.attachment-paste-inline-hint {
  display: block;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.attachment-feedback {
  margin-top: 0.8rem;
  padding: 0.7rem 0.82rem;
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-deep);
  font-size: 0.82rem;
}

.attachment-feedback.is-error {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.attachment-feedback.is-success {
  border-color: rgba(96, 165, 250, 0.24);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-deep);
}

.attachment-preview-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.attachment-preview-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.attachment-preview-thumb {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--accent);
  flex-shrink: 0;
}

.attachment-preview-thumb.is-icon i {
  font-size: 1.8rem;
  line-height: 1;
}

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

.attachment-preview-copy {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.attachment-preview-copy strong {
  color: var(--text);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.attachment-preview-remove {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.attachment-preview-remove:hover,
.attachment-preview-remove:focus-visible {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(254, 242, 242, 0.98);
  color: #b91c1c;
  transform: translateY(-1px);
}

body[data-theme="dark"] .attachment-paste-hint,
body[data-theme="dark"] .attachment-paste-inline-hint,
body[data-theme="dark"] .attachment-preview-copy small {
  color: #5D6F82;
}

body[data-theme="dark"] .attachment-feedback {
  border-color: rgba(103, 232, 249, 0.28);
  background: rgba(6, 182, 212, 0.16);
  color: #A5F3FC;
}

body[data-theme="dark"] .attachment-feedback.is-error {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(127, 29, 29, 0.34);
  color: #fecaca;
}

body[data-theme="dark"] .attachment-feedback.is-success {
  color: #A5F3FC;
}

body[data-theme="dark"] .attachment-preview-item,
body[data-theme="dark"] .attachment-preview-remove {
  border-color: #5D6F82;
  background: linear-gradient(180deg, rgba(11, 13, 16, 0.96), rgba(48, 59, 70, 0.92));
  box-shadow: none;
}

body[data-theme="dark"] .attachment-preview-thumb {
  background: rgba(48, 59, 70, 0.92);
  color: #67E8F9;
}

body[data-theme="dark"] .attachment-preview-copy strong,
body[data-theme="dark"] .attachment-preview-remove {
  color: #E7EEF5;
}

body[data-theme="dark"] .attachment-preview-remove:hover,
body[data-theme="dark"] .attachment-preview-remove:focus-visible {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(127, 29, 29, 0.4);
  color: #fecaca;
}

.settings-modal-backdrop,
.sidebar-backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.settings-modal-header h2,
.settings-option-copy strong {
  color: var(--text);
}

.modal-content {
  overflow: hidden;
}

.modal-header,
.modal-footer {
  border-color: var(--panel-border);
}

.empty-state,
.empty-state-inline {
  padding: 1.1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
}

.empty-state h3,
.empty-state-inline h3 {
  color: var(--text);
  font-size: 1.05rem;
}

@media (max-width: 1180px) {
  .topbar-nav {
    padding-top: 0.65rem;
    padding-bottom: 0.75rem;
  }

  .topbar-greeting {
    max-width: 13.5rem;
  }

  .topbar-greeting-secondary {
    display: none;
  }

  .topbar-user-card {
    padding-right: 0.55rem;
  }
}

@media (max-width: 980px) {
  .sidebar,
  .sidebar-collapsed .sidebar {
    padding: 1rem 0.85rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  }

  .topbar-nav {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .panel,
  .detail-header {
    padding: 1.15rem;
  }
}

@media (max-width: 760px) {
  .topbar-main {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .topbar-greeting {
    display: none;
  }

  .topbar-user strong {
    font-size: 0.9rem;
  }

  .topbar-user-meta small {
    font-size: 0.75rem;
  }

  .panel-header h1 {
    font-size: clamp(1.65rem, 7vw, 2.15rem);
  }

  .panel-header h2 {
    font-size: 1.35rem;
  }

  .filters,
  .form-meta,
  .form-section {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .topbar-actions,
  .topbar-actions-compact {
    --topbar-control-height: 40px;
  }

  .attachment-preview-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .attachment-preview-thumb {
    width: 72px;
    height: 72px;
  }

  .attachment-preview-remove {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar-user-card {
    padding-left: 0.4rem;
  }

  .topbar-user-avatar {
    font-size: 0.84rem;
  }

  .page-context-bar,
  .button-row,
  .hero-actions {
    gap: 0.65rem;
  }

  .page-context-link,
  .button,
  .button-ghost,
  .button-danger {
    width: 100%;
    justify-content: center;
  }
}

/* Final responsive polish for compact headers, mobile tables, and dense forms. */
@media (max-width: 980px) {
  .topbar-main {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.65rem 0.85rem 0.55rem;
  }

  .topbar-leading {
    flex: 1 1 16rem;
    align-items: center;
  }

  .brand-stack {
    min-width: 0;
  }

  .topbar-greeting {
    display: none;
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: auto;
    gap: 0.55rem;
  }

  .notification-shell,
  .user-menu-shell {
    flex: 0 0 auto;
  }

  .topbar-user-card {
    flex: 0 1 auto;
    max-width: min(100%, 17.5rem);
  }
}

@media (max-width: 760px) {
  .topbar-main {
    padding: 0.6rem 0.8rem 0.5rem;
  }

  .topbar-leading {
    flex: 1 1 10rem;
    gap: 0.55rem;
  }

  .topbar-actions,
  .topbar-actions-compact {
    gap: 0.45rem;
  }

  .topbar-nav {
    gap: 0.4rem;
    padding: 0 0.8rem 0.65rem;
  }

  .topbar-nav-link {
    min-height: 40px;
    padding: 0.5rem 0.8rem;
    font-size: 0.84rem;
  }

  .topbar-user {
    gap: 0.35rem;
  }

  .topbar-user strong {
    max-width: 9rem;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .topbar-user-meta {
    display: none;
  }

  .topbar-user-card {
    max-width: min(100%, 13rem);
    padding: 0 0.55rem 0 0.4rem;
  }

  .notification-panel,
  .user-menu-panel {
    width: min(22rem, calc(100vw - 1.6rem));
  }
}

@media (max-width: 640px) {
  :root {
    --layout-gutter: 0.75rem;
    --sidebar-mobile-width: min(280px, calc(100vw - 1rem));
  }

  .app-body,
  .auth-body {
    padding-top: calc(var(--topbar-offset) + 0.75rem);
  }

  .topbar-main {
    padding: 0.55rem 0.75rem 0.45rem;
  }

  .topbar-leading {
    flex: 1 1 auto;
    gap: 0.5rem;
  }

  .brand-lockup {
    width: min(100%, 124px);
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    gap: 0.45rem;
  }

  .notification-shell {
    align-self: auto;
  }

  .topbar-user-card {
    width: auto;
    min-width: 0;
    max-width: 11.5rem;
    padding: 0 0.45rem 0 0.34rem;
  }

  .user-menu-shell {
    width: auto;
  }

  .notification-panel {
    width: min(20.5rem, calc(100vw - 1.5rem));
  }

  .user-menu-panel {
    left: auto;
    right: 0;
    width: min(18rem, calc(100vw - 1.5rem));
  }

  .topbar-nav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.15rem 0.75rem 0.4rem;
    justify-content: flex-start;
    overflow: visible;
  }

  .topbar-nav-link {
    display: none;
  }

  .topbar-nav-icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .sidebar-toggle-nav {
    position: static;
    box-shadow: none;
    width: 2.15rem;
    min-width: 2.15rem;
    height: 2.15rem;
    min-height: 2.15rem;
    border-radius: 12px;
  }

  .panel,
  .detail-header,
  .filters,
  .form-meta,
  .form-section {
    padding: 0.95rem;
  }

  .table-wrap {
    border-radius: 16px;
    width: 100%;
  }

  .data-table tbody {
    padding: 0.8rem;
  }

  .data-table tbody tr {
    gap: 0.7rem;
    padding: 0.9rem;
  }

  .data-table tbody td {
    grid-template-columns: minmax(92px, 108px) minmax(0, 1fr);
    gap: 0.55rem;
  }

  .detail-grid,
  .stats-grid {
    gap: 1rem;
  }

  .filters,
  .form-section-grid {
    gap: 0.85rem;
  }

  .input,
  select,
  .bootstrap-ui .form-control,
  .bootstrap-ui .form-select,
  .button,
  .button-ghost,
  .button-danger {
    min-height: 42px;
    padding: 0.68rem 0.82rem;
    font-size: 0.9rem;
  }

  .input-shell .input {
    padding-left: 2.45rem;
  }
}

@media (max-width: 520px) {
  :root {
    --layout-gutter: 0.65rem;
    --sidebar-mobile-width: min(264px, calc(100vw - 0.8rem));
  }

  .topbar-main {
    gap: 0.5rem 0.6rem;
    padding: 0.5rem 0.65rem 0.4rem;
  }

  .topbar-leading {
    flex: 1 1 8.5rem;
  }

  .topbar-actions,
  .topbar-actions-compact {
    gap: 0.35rem;
  }

  .topbar-user-card {
    max-width: 9.5rem;
  }

  .topbar-user strong {
    max-width: 5.5rem;
    font-size: 0.8rem;
  }

  .topbar-nav {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .topbar-nav-link {
    padding: 0.42rem 0.65rem;
  }

  .brand-lockup {
    width: min(100%, 116px);
  }

  .page-context-bar {
    padding: 0.85rem;
  }

  .page-context-actions {
    gap: 0.5rem;
  }

  .page-context-link,
  .button,
  .button-ghost,
  .button-danger {
    min-height: 42px;
  }

  .data-table tbody td {
    grid-template-columns: 1fr;
    gap: 0.32rem;
  }

  .data-table tbody td.table-cell-actions,
  .data-table tbody td[data-column-label=""] {
    padding-top: 0.2rem;
  }
}

/* Responsive stabilization pass for shared layout pieces. */
html,
body {
  max-width: 100%;
}

body {
  overflow-x: hidden;
}

.layout > *,
.content > *,
.auth-layout > *,
.topbar-main > *,
.topbar-nav > *,
.page-context-bar > *,
.table-pagination > * {
  min-width: 0;
}

.page-context-bar,
.table-summary,
.table-pagination {
  flex-wrap: wrap;
}

.table-pagination-links,
.notification-panel,
.user-menu-panel {
  max-width: calc(100vw - 1rem);
}

@media (max-width: 980px) {
  .topbar-nav {
    scroll-padding-left: calc(var(--layout-gutter) + 3.5rem);
  }

  .sidebar-toggle-nav {
    position: sticky;
    left: 0;
    z-index: 4;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 6px 0 16px rgba(15, 23, 42, 0.08);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    width: min(20rem, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    border-radius: 22px;
  }

  .sidebar-mobile-header {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -0.1rem -0.1rem 0.85rem;
    padding: 0.1rem 0.1rem 0.75rem;
    background: inherit;
  }
}

@media (max-width: 760px) {
  .topbar-main {
    align-items: flex-start;
  }

  .topbar-leading {
    flex: 1 1 100%;
    width: 100%;
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-end;
  }

  .page-context-bar,
  .table-pagination {
    align-items: flex-start;
  }

  .table-pagination-links {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar-main {
    gap: 0.55rem;
  }

  .topbar-actions,
  .topbar-actions-compact {
    row-gap: 0.45rem;
    column-gap: 0.45rem;
  }

  .notification-panel,
  .user-menu-panel {
    width: min(18.5rem, calc(100vw - 1rem));
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    left: 0.5rem;
    width: min(18rem, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
  }

  .form-meta,
  .form-section-heading {
    flex-direction: column;
  }

  .form-meta-note {
    max-width: none;
  }

  .table-summary {
    gap: 0.45rem;
  }

  .table-pagination {
    padding: 0.85rem;
  }

  .data-table tbody td.table-cell-actions,
  .data-table tbody td[data-column-label=""] {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 520px) {
  .topbar-user-card {
    width: var(--topbar-control-height);
    min-width: var(--topbar-control-height);
    max-width: none;
    padding: 0;
    justify-content: center;
  }

  .topbar-user,
  .topbar-user-caret {
    display: none;
  }

  .topbar-user-avatar {
    margin: 0;
  }

  .notification-panel,
  .user-menu-panel {
    width: min(17.5rem, calc(100vw - 0.85rem));
  }

  .page-context-link,
  .table-pagination-link {
    min-width: 0;
  }
}

/* Per-user dark theme */
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] strong {
  color: var(--text);
}

body[data-theme="dark"] .background-glow-a {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(56, 189, 248, 0) 70%);
}

body[data-theme="dark"] .background-glow-b {
  background: radial-gradient(circle, rgba(103, 232, 249, 0.16) 0%, rgba(103, 232, 249, 0) 72%);
}

body[data-theme="dark"] .topbar-nav-link,
body[data-theme="dark"] .topbar-greeting,
body[data-theme="dark"] .topbar-user-meta small,
body[data-theme="dark"] .topbar-user-caret,
body[data-theme="dark"] .sidebar-note,
body[data-theme="dark"] .menu-group-label,
body[data-theme="dark"] .notification-panel-header small,
body[data-theme="dark"] .notification-copy p,
body[data-theme="dark"] .notification-popup-message,
body[data-theme="dark"] .notification-popup-meta small,
body[data-theme="dark"] .notification-popup-footer small,
body[data-theme="dark"] .message-copy,
body[data-theme="dark"] .table-summary,
body[data-theme="dark"] .table-pagination-summary,
body[data-theme="dark"] .table-pagination-ellipsis,
body[data-theme="dark"] .help-text,
body[data-theme="dark"] .form-meta p,
body[data-theme="dark"] .form-meta-note,
body[data-theme="dark"] .form-section-heading p,
body[data-theme="dark"] .empty-state,
body[data-theme="dark"] .empty-state p,
body[data-theme="dark"] .empty-state-inline p,
body[data-theme="dark"] .timeline-meta small,
body[data-theme="dark"] .attachment-item small,
body[data-theme="dark"] .project-hero-description,
body[data-theme="dark"] .project-list-toolbar-copy span,
body[data-theme="dark"] .project-directory-stat span,
body[data-theme="dark"] .task-history-description,
body[data-theme="dark"] .task-dashboard-compact-copy span,
body[data-theme="dark"] .task-mini-card small,
body[data-theme="dark"] .task-progress-card-copy small,
body[data-theme="dark"] .audit-secondary,
body[data-theme="dark"] .stat-card-copy small,
body[data-theme="dark"] .support-checklist {
  color: var(--muted);
}

body[data-theme="dark"] .topbar-greeting-primary,
body[data-theme="dark"] .topbar-user strong,
body[data-theme="dark"] .notification-copy strong,
body[data-theme="dark"] .notification-empty strong,
body[data-theme="dark"] .notification-popup-title,
body[data-theme="dark"] .settings-theme-option-copy strong,
body[data-theme="dark"] .settings-option-copy strong,
body[data-theme="dark"] .project-hero-copy h1,
body[data-theme="dark"] .project-hero-meta-card strong,
body[data-theme="dark"] .project-hero-progress strong,
body[data-theme="dark"] .project-hero-mini-metric strong,
body[data-theme="dark"] .project-summary-card strong,
body[data-theme="dark"] .project-team-member-copy strong,
body[data-theme="dark"] .project-directory-stat strong,
body[data-theme="dark"] .project-list-toolbar-copy strong,
body[data-theme="dark"] .task-history-summary-title,
body[data-theme="dark"] .task-progress-card-copy strong,
body[data-theme="dark"] .task-progress-card-percent,
body[data-theme="dark"] .task-mini-card strong,
body[data-theme="dark"] .task-detail-hero h1,
body[data-theme="dark"] .audit-primary,
body[data-theme="dark"] .stat-card-copy strong,
body[data-theme="dark"] .audit-detail-card h2,
body[data-theme="dark"] .dashboard-module-card strong,
body[data-theme="dark"] .dashboard-filter-toolbar-copy strong,
body[data-theme="dark"] .task-dashboard-compact-copy strong {
  color: var(--text);
}

body[data-theme="dark"] .notification-panel,
body[data-theme="dark"] .user-menu-panel,
body[data-theme="dark"] .settings-modal-card,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .detail-header,
body[data-theme="dark"] .hero,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .filters,
body[data-theme="dark"] .form-meta,
body[data-theme="dark"] .form-section,
body[data-theme="dark"] .task-history-collapsible,
body[data-theme="dark"] .json-block,
body[data-theme="dark"] .page-context-bar,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .audit-list-panel,
body[data-theme="dark"] .audit-detail-panel,
body[data-theme="dark"] .audit-filters,
body[data-theme="dark"] .audit-detail-card,
body[data-theme="dark"] .audit-change-table-wrapper,
body[data-theme="dark"] .stat-card-metric,
body[data-theme="dark"] .task-detail-hero,
body[data-theme="dark"] .task-summary-panel,
body[data-theme="dark"] .task-progress-panel,
body[data-theme="dark"] .task-history-panel,
body[data-theme="dark"] .task-status-panel,
body[data-theme="dark"] .task-form-panel,
body[data-theme="dark"] .task-list-page-panel,
body[data-theme="dark"] .dashboard-modules-panel,
body[data-theme="dark"] .support-cta-panel,
body[data-theme="dark"] .task-dashboard-compact,
body[data-theme="dark"] .dashboard-filter-toolbar,
body[data-theme="dark"] .dashboard-module-card,
body[data-theme="dark"] .task-mini-card,
body[data-theme="dark"] .task-progress-card-compact,
body[data-theme="dark"] .project-detail-hero,
body[data-theme="dark"] .project-summary-panel,
body[data-theme="dark"] .project-team-panel,
body[data-theme="dark"] .project-task-panel,
body[data-theme="dark"] .project-updates-panel,
body[data-theme="dark"] .project-directory-panel,
body[data-theme="dark"] .project-hero-meta-card,
body[data-theme="dark"] .project-hero-progress,
body[data-theme="dark"] .project-hero-mini-metrics,
body[data-theme="dark"] .project-hero-actions,
body[data-theme="dark"] .project-summary-card,
body[data-theme="dark"] .project-summary-band,
body[data-theme="dark"] .project-team-member,
body[data-theme="dark"] .project-directory-stat,
body[data-theme="dark"] .support-ticket-form-panel,
body[data-theme="dark"] .support-ticket-aside,
body[data-theme="dark"] .support-ticket-history-panel,
body[data-theme="dark"] .user-picker,
body[data-theme="dark"] .user-form-panel .user-picker,
body[data-theme="dark"] .project-form-panel .user-picker,
body[data-theme="dark"] .user-option {
  border-color: rgba(93, 111, 130, 0.72);
  background: linear-gradient(180deg, rgba(11, 13, 16, 0.96), rgba(11, 13, 16, 0.98));
  box-shadow: var(--shadow-soft);
}

@supports selector(:has(*)) {
  body[data-theme="dark"] .settings-theme-option:has(input[type="radio"]:checked) {
    border-color: rgba(103, 232, 249, 0.46);
    background: rgba(48, 59, 70, 0.98);
    box-shadow: 0 14px 28px rgba(23, 28, 34, 0.28);
  }
}

body[data-theme="dark"] .data-table tbody tr:hover td,
body[data-theme="dark"] .audit-change-table tbody tr:hover td,
body[data-theme="dark"] .project-directory-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .audit-list-panel .data-table tbody tr:hover {
  background: rgba(48, 59, 70, 0.98);
}

body[data-theme="dark"] .table-pagination,
body[data-theme="dark"] .notification-panel-header,
body[data-theme="dark"] .notification-item,
body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-footer {
  border-color: rgba(93, 111, 130, 0.5);
}

body[data-theme="dark"] .notification-item-unread {
  background: linear-gradient(90deg, rgba(48, 59, 70, 0.98), rgba(11, 13, 16, 0.96));
}

body[data-theme="dark"] .task-history-collapsible[open] .task-history-summary {
  border-bottom-color: rgba(93, 111, 130, 0.5);
}

body[data-theme="dark"] .message,
body[data-theme="dark"] .form-error,
body[data-theme="dark"] .notification-popup,
body[data-theme="dark"] .empty-state,
body[data-theme="dark"] .empty-state-inline,
body[data-theme="dark"] .attachment-item,
body[data-theme="dark"] .timeline-item {
  border-color: rgba(93, 111, 130, 0.6);
  background: rgba(11, 13, 16, 0.88);
  color: var(--text);
  box-shadow: none;
}

body[data-theme="dark"] .message.success {
  background: rgba(6, 78, 59, 0.45);
  border-color: rgba(52, 211, 153, 0.32);
  color: #d1fae5;
}

body[data-theme="dark"] .message.error,
body[data-theme="dark"] .message.danger {
  background: rgba(127, 29, 29, 0.42);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fee2e2;
}

body[data-theme="dark"] .message.warning {
  background: rgba(120, 53, 15, 0.44);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

body[data-theme="dark"] .message-dismiss {
  border-color: rgba(93, 111, 130, 0.7);
  background: rgba(11, 13, 16, 0.94);
  color: var(--text);
}

body[data-theme="dark"] .message-dismiss:hover {
  background: rgba(48, 59, 70, 0.98);
}

body[data-theme="dark"] .task-dashboard-compact-status.has-critical,
body[data-theme="dark"] .task-mini-card-overdue.has-critical,
body[data-theme="dark"] .task-progress-card-compact.has-critical {
  border-color: rgba(251, 146, 60, 0.36);
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.42), rgba(48, 59, 70, 0.98));
  color: #fdba74;
}

body[data-theme="dark"] .dashboard-module-card:hover,
body[data-theme="dark"] .user-option:hover,
body[data-theme="dark"] .project-updates-panel .timeline-item:hover {
  border-color: rgba(103, 232, 249, 0.34);
  background: linear-gradient(180deg, rgba(48, 59, 70, 0.96), rgba(11, 13, 16, 0.98));
}

body[data-theme="dark"] .project-updates-panel .timeline-item,
body[data-theme="dark"] .task-history-panel .timeline-item {
  border-color: rgba(93, 111, 130, 0.64);
  background: rgba(11, 13, 16, 0.86);
}

body[data-theme="dark"] .project-updates-panel .timeline-item::before,
body[data-theme="dark"] .stat-card-metric::before,
body[data-theme="dark"] .dashboard-module-card::before,
body[data-theme="dark"] .project-detail-hero::before {
  opacity: 0.95;
}

body[data-theme="dark"] .project-hero-progress strong,
body[data-theme="dark"] .project-hero-actions .button-ghost,
body[data-theme="dark"] .dashboard-task-project-link.text-link,
body[data-theme="dark"] .notification-mark,
body[data-theme="dark"] .notification-clear,
body[data-theme="dark"] .notification-popup-link,
body[data-theme="dark"] .text-link,
body[data-theme="dark"] .page-context-link {
  color: #A5F3FC;
}

body[data-theme="dark"] .project-hero-actions .button-ghost:hover,
body[data-theme="dark"] .dashboard-task-project-link.text-link:hover,
body[data-theme="dark"] .notification-popup-link:hover,
body[data-theme="dark"] .text-link:hover {
  color: #CFFAFE;
}

body[data-theme="dark"] .bootstrap-ui .form-check-input {
  background-color: #0B0D10;
  border-color: rgba(93, 111, 130, 0.72);
}

body[data-theme="dark"] .bootstrap-ui .form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

body[data-theme="dark"] .bootstrap-ui .form-check-label,
body[data-theme="dark"] .bootstrap-ui .form-text,
body[data-theme="dark"] .bootstrap-ui .col-form-label {
  color: var(--muted);
}

@media (max-width: 980px) {
  body[data-theme="dark"] .sidebar-toggle-nav {
    background: rgba(11, 13, 16, 0.98);
    box-shadow: 6px 0 16px rgba(23, 28, 34, 0.4);
  }
}

/* Dark theme palette refinements */
body[data-theme="dark"] .project-hero-meta-card,
body[data-theme="dark"] .project-hero-progress,
body[data-theme="dark"] .project-hero-mini-metrics,
body[data-theme="dark"] .project-hero-actions,
body[data-theme="dark"] .project-summary-card,
body[data-theme="dark"] .project-summary-band,
body[data-theme="dark"] .project-team-member,
body[data-theme="dark"] .project-directory-stat,
body[data-theme="dark"] .support-ticket-aside,
body[data-theme="dark"] .task-history-panel .timeline-item,
body[data-theme="dark"] .task-history-collapsible,
body[data-theme="dark"] .task-form-group,
body[data-theme="dark"] .dashboard-module-card,
body[data-theme="dark"] .project-card,
body[data-theme="dark"] .task-mini-card,
body[data-theme="dark"] .task-progress-card-compact,
body[data-theme="dark"] .stat-card-metric,
body[data-theme="dark"] .audit-detail-card,
body[data-theme="dark"] .audit-change-table-wrapper,
body[data-theme="dark"] .audit-change-table tbody tr,
body[data-theme="dark"] .user-picker,
body[data-theme="dark"] .user-form-panel .user-picker,
body[data-theme="dark"] .project-form-panel .user-picker,
body[data-theme="dark"] .user-option,
body[data-theme="dark"] .user-status-card,
body[data-theme="dark"] .permission-card,
body[data-theme="dark"] .permission-option {
  border-color: #5D6F82;
  background: linear-gradient(180deg, rgba(48, 59, 70, 0.94), rgba(42, 51, 61, 0.98));
  box-shadow: none;
}

body[data-theme="dark"] .stat-card-icon-failed {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.14);
  color: #fda4af;
}

body[data-theme="dark"] .stat-card-icon-database {
  border-color: rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.14);
  color: #67E8F9;
}

body[data-theme="dark"] .stat-card-icon-time {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.14);
  color: #67e8f9;
}

body[data-theme="dark"] .task-scope-button:hover,
body[data-theme="dark"] .dashboard-module-card:hover,
body[data-theme="dark"] .project-card:hover,
body[data-theme="dark"] .user-option:hover,
body[data-theme="dark"] .permission-option:hover,
body[data-theme="dark"] .project-updates-panel .timeline-item:hover {
  border-color: rgba(34, 211, 238, 0.44);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.14), rgba(42, 51, 61, 0.98));
  color: #E7EEF5;
}

body[data-theme="dark"] .project-hero-copy h1,
body[data-theme="dark"] .project-hero-meta-card strong,
body[data-theme="dark"] .project-hero-mini-metric strong,
body[data-theme="dark"] .project-summary-card strong,
body[data-theme="dark"] .project-directory-stat strong,
body[data-theme="dark"] .project-list-toolbar-copy strong,
body[data-theme="dark"] .project-updates-panel .timeline-meta strong,
body[data-theme="dark"] .permission-card h3,
body[data-theme="dark"] .permission-option-copy strong,
body[data-theme="dark"] .user-status-card strong,
body[data-theme="dark"] .user-warning-card strong,
body[data-theme="dark"] .task-detail-hero h1,
body[data-theme="dark"] .workgroup-name-link {
  color: #E7EEF5;
}

body[data-theme="dark"] .project-hero-progress strong,
body[data-theme="dark"] .project-summary-band-copy strong,
body[data-theme="dark"] .project-directory-panel .text-link,
body[data-theme="dark"] .audit-detail-link {
  color: #67E8F9;
}

body[data-theme="dark"] .project-hero-description,
body[data-theme="dark"] .project-list-toolbar-copy span,
body[data-theme="dark"] .project-directory-stat span,
body[data-theme="dark"] .project-updates-panel .timeline-item p,
body[data-theme="dark"] .permission-card-copy,
body[data-theme="dark"] .permission-option-copy small,
body[data-theme="dark"] .user-warning-list ul,
body[data-theme="dark"] .task-scope-button-copy span:last-child,
body[data-theme="dark"] .audit-change-table tbody td::before,
body[data-theme="dark"] .project-task-panel .data-table th,
body[data-theme="dark"] .support-checklist {
  color: #5D6F82;
}

body[data-theme="dark"] .project-task-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .project-directory-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .user-list-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .user-active-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .role-list-panel .data-table tbody tr:hover td,
body[data-theme="dark"] .workgroup-task-panel .data-table tbody tr:hover td {
  background: rgba(34, 211, 238, 0.12);
}

body[data-theme="dark"] .task-dashboard-compact-status.has-critical,
body[data-theme="dark"] .task-mini-card-overdue.has-critical,
body[data-theme="dark"] .task-progress-card-compact.has-critical {
  border-color: rgba(251, 146, 60, 0.3);
  background: linear-gradient(180deg, rgba(124, 45, 18, 0.34), rgba(48, 59, 70, 0.96));
  color: #fdba74;
}

body[data-theme="dark"] .topbar-nav-link:hover .topbar-nav-icon {
  border-color: rgba(34, 211, 238, 0.36);
  background: #3A4552;
}

.filter-layout-main,
.filter-layout-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.filter-layout-main .field,
.filter-layout-advanced-grid .field {
  min-width: 0;
}

.filter-span-2 {
  grid-column: span 2;
}

.filter-layout-advanced {
  display: grid;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: #f8fafc;
}

.filter-layout-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.filter-layout-toggle::-webkit-details-marker {
  display: none;
}

.filter-layout-toggle-copy {
  display: grid;
  gap: 0.15rem;
}

.filter-layout-toggle-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 700;
}

.filter-layout-toggle-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.filter-layout-toggle-chevron {
  color: var(--muted);
  font-size: 0.95rem;
  transition: transform 0.2s ease;
}

.filter-layout-advanced[open] .filter-layout-toggle-chevron {
  transform: rotate(180deg);
}

.filter-layout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

body[data-theme="dark"] .filter-layout-advanced {
  border-color: #5D6F82;
  background: #171C22;
}

body[data-theme="dark"] .filter-layout-toggle-title {
  color: #E7EEF5;
}

body[data-theme="dark"] .filter-layout-toggle-copy small,
body[data-theme="dark"] .filter-layout-toggle-chevron {
  color: #5D6F82;
}

@media (max-width: 760px) {
  .filter-span-2 {
    grid-column: span 1;
  }

  .filter-layout-advanced {
    padding: 0.9rem;
  }

  .filter-layout-actions {
    width: 100%;
  }
}

/* Structural surfaces: keep content areas rectangular and reserve softer rounding for action buttons. */
.sidebar,
.panel,
.detail-header,
.filters,
.settings-modal-card,
.auth-card,
.form-section,
.form-meta,
.settings-option,
.settings-theme-option,
.page-context-bar,
.table-wrap,
.empty-state,
.empty-state-inline,
.notification-panel,
.user-menu-panel,
.modal-content,
.message,
.stat-card,
.filter-layout-advanced {
  border-radius: var(--surface-radius-xl);
}

.topbar-nav-link,
.topbar-nav-icon,
.topbar-user-card,
.menu-group,
.menu-link,
.page-context-link,
.settings-modal-close,
.sidebar-close,
.input-shell,
.input,
textarea,
select,
.bootstrap-ui .form-control,
.bootstrap-ui .form-select,
.user-menu-item,
.notification-sound-toggle,
.notification-clear {
  border-radius: var(--surface-radius-lg);
}

.menu-group-label,
.eyebrow,
.info-chip,
.status-badge {
  border-radius: var(--surface-radius-md);
}

.messaging-trigger {
  position: relative;
}

.messaging-inline-badge,
.menu-link-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.messaging-inline-badge {
  margin-left: 0.35rem;
}

.menu-link-badge {
  margin-left: auto;
}

.messaging-toast-region {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 1040;
  display: grid;
  gap: 0.7rem;
  width: min(340px, calc(100vw - 2rem));
  pointer-events: none;
}

.messaging-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.messaging-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.messaging-toast.is-leaving {
  opacity: 0;
  transform: translateY(10px);
}

.messaging-toast-copy {
  display: grid;
  gap: 0.2rem;
}

.messaging-toast-copy strong {
  color: var(--text);
  font-size: 0.95rem;
}

.messaging-toast-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.messaging-toast-actions {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 0.5rem;
}

.messaging-toast-link,
.messaging-toast-close {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 700;
}

.messaging-toast-close {
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
}

.messaging-toast-link:hover,
.messaging-toast-link:focus-visible,
.messaging-toast-close:hover,
.messaging-toast-close:focus-visible {
  color: #1d4ed8;
}

.messaging-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1030;
  background: transparent;
  pointer-events: none;
}

.messaging-drawer-backdrop[hidden],
.messaging-drawer[hidden] {
  display: none;
}

.messaging-drawer {
  position: fixed;
  top: calc(var(--topbar-offset) + 0.45rem);
  right: var(--layout-gutter);
  bottom: 1rem;
  z-index: 1035;
  width: min(408px, calc(100vw - 1.5rem));
  pointer-events: none;
}

.messaging-drawer-shell {
  /* La cabecera reutiliza esta misma superficie para que los iconos queden
     integrados al panel en ambos temas y no parezcan botones aislados. */
  --mensajeria-cabecera-boton-fondo: transparent;
  --mensajeria-cabecera-boton-borde: transparent;
  --mensajeria-cabecera-boton-hover-fondo: rgba(255, 255, 255, 0.54);
  --mensajeria-cabecera-boton-hover-borde: rgba(255, 255, 255, 0.54);
  --mensajeria-cabecera-boton-color: #31445f;
  --mensajeria-cabecera-boton-hover-color: var(--accent-deep);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(211, 219, 231, 0.96);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(37, 87, 214, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.96));
  box-shadow: 0 26px 54px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(18px);
  overflow: hidden;
  pointer-events: auto;
}

.messaging-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0.95rem;
  border-bottom: 1px solid rgba(214, 222, 237, 0.9);
}

.messaging-drawer-heading {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.messaging-drawer-heading strong {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.2;
}

.messaging-drawer-heading small {
  color: var(--muted);
  font-size: 0.76rem;
}

.messaging-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.messaging-drawer-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mensajeria-cabecera-boton-borde);
  border-radius: 12px;
  background: var(--mensajeria-cabecera-boton-fondo);
  color: var(--mensajeria-cabecera-boton-color);
  cursor: pointer;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.messaging-drawer-icon:hover,
.messaging-drawer-icon:focus-visible {
  transform: translateY(-1px);
  border-color: var(--mensajeria-cabecera-boton-hover-borde);
  background: var(--mensajeria-cabecera-boton-hover-fondo);
  color: var(--mensajeria-cabecera-boton-hover-color);
}

.messaging-drawer-body {
  min-height: 0;
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.messaging-drawer-body > section {
  min-height: 0;
  height: 100%;
}

.messaging-drawer [hidden] {
  display: none !important;
}

.messaging-drawer-compose {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  min-height: 0;
  padding: 0.65rem;
  border: 1px solid rgba(214, 222, 237, 0.9);
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.96);
}

.messaging-drawer-compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.messaging-drawer-compose-header strong {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.2;
}

.messaging-drawer-compose-cancel {
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.messaging-drawer-compose-cancel:hover,
.messaging-drawer-compose-cancel:focus-visible {
  color: #1d4ed8;
}

.messaging-drawer-inbox {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
}

.messaging-drawer-input {
  min-height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.messaging-drawer-input i {
  color: var(--muted);
  font-size: 0.9rem;
}

.messaging-drawer-input input {
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.messaging-drawer-conversations,
.messaging-recipient-list,
.messaging-drawer-thread-messages {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.messaging-drawer-item,
.messaging-recipient-item {
  width: 100%;
  display: grid;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem;
  border: 1px solid rgba(214, 222, 237, 0.94);
  border-radius: 16px;
  background: rgba(250, 252, 255, 0.97);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.messaging-drawer-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.messaging-recipient-item {
  grid-template-columns: auto minmax(0, 1fr);
}

.messaging-drawer-item:hover,
.messaging-drawer-item:focus-visible,
.messaging-recipient-item:hover,
.messaging-recipient-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(47, 158, 255, 0.24);
  background: rgba(247, 251, 255, 0.98);
  box-shadow: 0 12px 22px rgba(96, 112, 142, 0.1);
}

.messaging-drawer-item.is-active {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(239, 246, 255, 0.98);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.messaging-drawer-avatar {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.messaging-drawer-item-body,
.messaging-recipient-copy {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.messaging-drawer-item-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.messaging-drawer-item-title-row {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.messaging-drawer-item-head strong,
.messaging-recipient-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.2;
}

.messaging-drawer-item-head small,
.messaging-recipient-copy small,
.messaging-drawer-item-preview {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.messaging-drawer-item-head small {
  flex-shrink: 0;
}

.messaging-drawer-item-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.messaging-drawer-item-kind {
  display: inline-flex;
  align-items: center;
  min-height: 1.2rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.messaging-drawer-item-preview,
.messaging-recipient-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messaging-recipient-copy small:empty {
  display: none;
}

.messaging-drawer-item-badge {
  min-width: 1.5rem;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.messaging-presence-dot {
  width: 0.52rem;
  height: 0.52rem;
  display: inline-flex;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.72);
  flex-shrink: 0;
}

.messaging-presence-dot.is-online {
  background: #22c55e;
}

.messaging-presence-dot.is-offline {
  background: #f59e0b;
}

.messaging-presence-dot.is-group {
  background: #3b82f6;
}

.messaging-drawer-thread {
  height: 100%;
  min-height: 0;
  display: grid;
}

.messaging-drawer-thread-pane {
  position: relative;
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(214, 222, 237, 0.94);
  border-radius: 18px;
  background: rgba(248, 250, 255, 0.97);
}

.messaging-drawer-thread-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  padding: 0.75rem;
}

.messaging-drawer-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.messaging-drawer-thread-header > div {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.messaging-drawer-thread-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.messaging-drawer-thread-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.92rem;
}

.messaging-drawer-thread-header small {
  color: var(--muted);
  font-size: 0.76rem;
}

.messaging-drawer-thread-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.messaging-drawer-thread-close:hover,
.messaging-drawer-thread-close:focus-visible {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(239, 246, 255, 0.96);
  color: #1d4ed8;
  transform: translateY(-1px);
}

.messaging-drawer-bubble {
  max-width: 92%;
  display: grid;
  gap: 0.35rem;
  padding: 0.68rem 0.75rem;
  border: 1px solid rgba(214, 222, 237, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.messaging-drawer-bubble.is-own {
  margin-left: auto;
  border-color: rgba(37, 99, 235, 0.18);
  background: linear-gradient(180deg, rgba(237, 244, 255, 0.98), rgba(224, 236, 255, 0.96));
}

.messaging-drawer-bubble.is-incoming {
  margin-right: auto;
}

.messaging-drawer-bubble p {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.messaging-drawer-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.messaging-drawer-thread-disabled {
  padding: 0.7rem 0.8rem;
  border: 1px dashed rgba(251, 146, 60, 0.28);
  border-radius: 14px;
  background: rgba(255, 244, 231, 0.86);
  color: #b45309;
  font-size: 0.8rem;
}

.messaging-drawer-form {
  --mensajeria-drawer-altura-control: 2.9rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.messaging-drawer-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.messaging-drawer-attach {
  width: var(--mensajeria-drawer-altura-control);
  min-width: var(--mensajeria-drawer-altura-control);
  height: var(--mensajeria-drawer-altura-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.messaging-drawer-attach:hover,
.messaging-drawer-attach:focus-visible {
  border-color: rgba(96, 165, 250, 0.46);
  background: rgba(239, 246, 255, 0.98);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.messaging-drawer-form textarea {
  min-height: var(--mensajeria-drawer-altura-control);
  height: var(--mensajeria-drawer-altura-control);
  max-height: calc((1.45em * 3) + 1.45rem + 2px);
  padding: 0.68rem 0.8rem;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: none;
  overflow-y: hidden;
}

.messaging-drawer-send {
  width: var(--mensajeria-drawer-altura-control);
  min-width: var(--mensajeria-drawer-altura-control);
  height: var(--mensajeria-drawer-altura-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 0;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.messaging-drawer-send:hover,
.messaging-drawer-send:focus-visible {
  border-color: rgba(96, 165, 250, 0.46);
  background: rgba(239, 246, 255, 0.98);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.messaging-drawer-send:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.messaging-drawer-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.messaging-selected-reference-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.messaging-selected-reference {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.96));
  color: var(--text);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.messaging-selected-reference-copy {
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

.messaging-selected-reference-eyebrow,
.messaging-reference-eyebrow,
.messaging-reference-result-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 1.3rem;
  padding: 0.08rem 0.46rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.messaging-selected-reference-copy strong,
.messaging-reference-card strong,
.messaging-reference-result strong {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messaging-selected-reference-copy small,
.messaging-reference-card small,
.messaging-reference-result small {
  color: #64748b;
  font-size: 0.74rem;
}

.messaging-selected-reference-remove {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: #526377;
}

.messaging-selected-reference-remove:hover,
.messaging-selected-reference-remove:focus-visible {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(254, 242, 242, 0.96);
  color: #b91c1c;
}

.messaging-reference-card {
  display: grid;
  gap: 0.16rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.messaging-reference-card:hover,
.messaging-reference-card:focus-visible {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(239, 246, 255, 0.98);
  color: inherit;
}

.messaging-reference-action {
  margin-top: 0.12rem;
  color: #1d4ed8;
  font-size: 0.74rem;
  font-weight: 700;
}

.messaging-reference-picker-shell {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.85rem;
}

.messaging-reference-picker-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(148, 163, 184, 0.3));
  backdrop-filter: blur(4px);
}

.messaging-reference-picker {
  position: relative;
  z-index: 1;
  width: min(100%, 42rem);
  max-height: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 255, 0.98) 100%);
  box-shadow:
    0 22px 48px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.messaging-reference-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.messaging-reference-picker-header > div {
  min-width: 0;
}

.messaging-reference-picker-header strong {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.2;
}

.messaging-reference-picker-header small {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  line-height: 1.45;
}

.messaging-reference-picker-close {
  width: 2.2rem;
  min-width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #526377;
}

.messaging-reference-picker-close:hover,
.messaging-reference-picker-close:focus-visible {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(239, 246, 255, 0.98);
  color: #1d4ed8;
}

.messaging-reference-picker-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid rgba(208, 217, 235, 0.94);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  color: #7a8aa0;
}

.messaging-reference-picker-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.messaging-reference-picker-search input:focus {
  outline: 0;
}

.messaging-reference-picker-search input::placeholder {
  color: #8a99ad;
}

.messaging-reference-picker-feedback {
  margin: 0;
  padding: 0.68rem 0.8rem;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.82rem;
}

.messaging-reference-picker-feedback.is-error {
  background: rgba(220, 38, 38, 0.14);
  color: #fecaca;
}

.messaging-reference-results {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 0.65rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.messaging-reference-result {
  width: 100%;
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(226, 232, 240, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.messaging-reference-result:hover,
.messaging-reference-result:focus-visible {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(239, 246, 255, 0.98);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.messaging-reference-result-head {
  display: grid;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.messaging-reference-result strong {
  display: block;
  font-size: 0.94rem;
  line-height: 1.35;
}

.messaging-reference-result small {
  line-height: 1.45;
}

.messaging-reference-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 1.1rem;
  border: 1px dashed rgba(208, 217, 235, 0.94);
  border-radius: 18px;
  background: rgba(248, 250, 255, 0.9);
  color: #64748b;
  text-align: center;
}

.messaging-drawer-attachment-list.attachment-preview-list {
  display: grid;
  gap: 0.65rem;
}

.messaging-drawer-thread-pane .messaging-reference-picker-shell {
  padding: 0.7rem;
}

.messaging-drawer-thread-pane .messaging-reference-picker {
  width: 100%;
  padding: 0.95rem;
  border-radius: 20px;
}

@media (max-width: 640px) {
  .messaging-reference-picker-shell {
    padding: 0.65rem;
  }

  .messaging-reference-picker {
    width: 100%;
    padding: 0.9rem;
    border-radius: 20px;
  }

  .messaging-reference-picker-header {
    gap: 0.75rem;
  }

  .messaging-reference-picker-header strong {
    font-size: 0.96rem;
  }
}

.messaging-drawer-thread-pane .attachment-paste-inline-hint {
  margin-top: -0.1rem;
  color: var(--muted);
}

.messaging-drawer-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  max-width: 100%;
  padding: 0.5rem 0.62rem;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

.messaging-drawer-attachment-pill-copy,
.messaging-drawer-attachment-copy {
  min-width: 0;
  display: grid;
}

.messaging-drawer-attachment-pill-copy strong,
.messaging-drawer-attachment-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.messaging-drawer-attachment-pill-copy small,
.messaging-drawer-attachment-copy small {
  color: var(--muted);
  font-size: 0.7rem;
}

.messaging-drawer-bubble-attachments {
  display: grid;
  gap: 0.45rem;
}

.messaging-drawer-attachment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  padding: 0.56rem 0.62rem;
  border: 1px solid rgba(208, 217, 235, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

.messaging-drawer-attachment-card.is-image {
  grid-template-columns: 1fr;
  padding: 0.38rem;
}

.messaging-drawer-attachment-card.is-image img {
  width: 100%;
  max-height: 156px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.messaging-drawer-attachment-card.is-image span {
  display: block;
  padding: 0.16rem 0.14rem 0;
  font-size: 0.72rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messaging-drawer-feedback {
  margin: 0;
  padding: 0.56rem 0.68rem;
  border-radius: 12px;
  background: rgba(37, 87, 214, 0.08);
  color: var(--accent-deep);
  font-size: 0.78rem;
  line-height: 1.4;
}

.messaging-drawer-feedback.is-error {
  background: rgba(223, 96, 56, 0.1);
  color: #b45309;
}

.messaging-drawer-placeholder {
  padding: 0.85rem;
  border: 1px dashed rgba(214, 222, 237, 0.92);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.94);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.messaging-drawer.is-collapsed {
  width: 88px;
}

.messaging-drawer.is-collapsed .messaging-drawer-header {
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.8rem 0.55rem;
}

.messaging-drawer.is-collapsed .messaging-drawer-heading {
  justify-items: center;
  text-align: center;
}

.messaging-drawer.is-collapsed .messaging-drawer-heading small {
  display: none;
}

.messaging-drawer.is-collapsed .messaging-drawer-heading strong {
  font-size: 0.78rem;
}

.messaging-drawer.is-collapsed .messaging-drawer-actions {
  width: 100%;
  display: grid;
  gap: 0.4rem;
}

.messaging-drawer.is-collapsed .messaging-drawer-icon {
  width: 100%;
}

.messaging-drawer.is-collapsed .messaging-drawer-body {
  display: none;
}

@media (max-width: 980px) {
  body.messaging-drawer-open {
    overflow: hidden;
  }

  .messaging-drawer-backdrop {
    background: rgba(15, 23, 42, 0.24);
    backdrop-filter: blur(4px);
    pointer-events: auto;
  }

  .messaging-drawer {
    top: var(--topbar-offset);
    right: 0;
    bottom: 0;
    width: min(100vw, 100%);
  }

  .messaging-drawer-shell {
    border-radius: 22px 0 0 0;
  }

  .messaging-drawer-inbox {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .messaging-drawer-body {
    padding: 0.75rem;
    gap: 0.65rem;
  }

  .messaging-drawer-thread-pane {
    padding: 0.7rem;
  }

  .messaging-drawer-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.5rem;
  }
}

body[data-theme="dark"] .messaging-inline-badge,
body[data-theme="dark"] .menu-link-badge {
  background: rgba(103, 232, 249, 0.18);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-toast {
  border-color: rgba(93, 111, 130, 0.18);
  background: rgba(11, 13, 16, 0.96);
  box-shadow: 0 24px 44px rgba(23, 28, 34, 0.4);
}

body[data-theme="dark"] .messaging-toast-copy strong {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-toast-copy p,
body[data-theme="dark"] .messaging-toast-close {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-drawer-shell,
body[data-theme="dark"] .messaging-drawer-compose,
body[data-theme="dark"] .messaging-drawer-thread-pane,
body[data-theme="dark"] .messaging-drawer-item,
body[data-theme="dark"] .messaging-recipient-item,
body[data-theme="dark"] .messaging-drawer-input,
body[data-theme="dark"] .messaging-drawer-thread-close,
body[data-theme="dark"] .messaging-drawer-form textarea,
body[data-theme="dark"] .messaging-drawer-placeholder {
  border-color: #5D6F82;
  background: linear-gradient(180deg, rgba(42, 51, 61, 0.98), rgba(48, 59, 70, 0.94));
  box-shadow: none;
}

body[data-theme="dark"] .messaging-drawer-shell {
  --mensajeria-cabecera-boton-fondo: transparent;
  --mensajeria-cabecera-boton-borde: transparent;
  --mensajeria-cabecera-boton-hover-fondo: rgba(48, 59, 70, 0.88);
  --mensajeria-cabecera-boton-hover-borde: rgba(48, 59, 70, 0.88);
  --mensajeria-cabecera-boton-color: #9AABBA;
  --mensajeria-cabecera-boton-hover-color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-heading strong,
body[data-theme="dark"] .messaging-drawer-item-head strong,
body[data-theme="dark"] .messaging-recipient-copy strong,
body[data-theme="dark"] .messaging-drawer-compose-header strong,
body[data-theme="dark"] .messaging-drawer-thread-header strong,
body[data-theme="dark"] .messaging-drawer-bubble p {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-heading small,
body[data-theme="dark"] .messaging-drawer-item-head small,
body[data-theme="dark"] .messaging-recipient-copy small,
body[data-theme="dark"] .messaging-drawer-item-preview,
body[data-theme="dark"] .messaging-drawer-thread-header small,
body[data-theme="dark"] .messaging-drawer-thread-close,
body[data-theme="dark"] .messaging-drawer-placeholder,
body[data-theme="dark"] .messaging-drawer-bubble-meta {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-drawer-header {
  border-bottom-color: #5D6F82;
}

body[data-theme="dark"] .messaging-drawer-icon {
  border-color: #5D6F82;
  background: #0B0D10;
  color: #9AABBA;
  box-shadow: none;
}

body[data-theme="dark"] .messaging-drawer-icon:hover,
body[data-theme="dark"] .messaging-drawer-icon:focus-visible {
  border-color: rgba(34, 211, 238, 0.38);
  background: #303B46;
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-thread-close:hover,
body[data-theme="dark"] .messaging-drawer-thread-close:focus-visible {
  border-color: rgba(34, 211, 238, 0.38);
  background: #303B46;
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-input i {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-drawer-attach {
  border-color: #5D6F82;
  background: #0B0D10;
  color: #67E8F9;
}

body[data-theme="dark"] .messaging-drawer-send {
  border-color: #5D6F82;
  background: #0B0D10;
  color: #67E8F9;
}

body[data-theme="dark"] .messaging-drawer-attach:hover,
body[data-theme="dark"] .messaging-drawer-attach:focus-visible,
body[data-theme="dark"] .messaging-drawer-send:hover,
body[data-theme="dark"] .messaging-drawer-send:focus-visible {
  border-color: rgba(34, 211, 238, 0.38);
  background: #303B46;
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-input input,
body[data-theme="dark"] .messaging-drawer-form textarea {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-attachment-pill,
body[data-theme="dark"] .messaging-drawer-attachment-card {
  border-color: #5D6F82;
  background: #171C22;
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-drawer-attachment-pill-copy small,
body[data-theme="dark"] .messaging-drawer-attachment-copy small,
body[data-theme="dark"] .messaging-drawer-attachment-card.is-image span {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-selected-reference {
  border-color: rgba(103, 232, 249, 0.18);
  background: rgba(48, 59, 70, 0.78);
  color: #E7EEF5;
  box-shadow: none;
}

body[data-theme="dark"] .messaging-selected-reference-eyebrow,
body[data-theme="dark"] .messaging-reference-eyebrow,
body[data-theme="dark"] .messaging-reference-result-badge {
  background: rgba(34, 211, 238, 0.18);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-selected-reference-copy strong,
body[data-theme="dark"] .messaging-reference-card strong,
body[data-theme="dark"] .messaging-reference-result strong {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-selected-reference-copy small,
body[data-theme="dark"] .messaging-reference-card small,
body[data-theme="dark"] .messaging-reference-result small {
  color: rgba(231, 238, 245, 0.76);
}

body[data-theme="dark"] .messaging-selected-reference-remove {
  border-color: rgba(103, 232, 249, 0.18);
  background: rgba(11, 13, 16, 0.78);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-selected-reference-remove:hover,
body[data-theme="dark"] .messaging-selected-reference-remove:focus-visible {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(127, 29, 29, 0.4);
  color: #fecaca;
}

body[data-theme="dark"] .messaging-reference-card {
  border-color: rgba(103, 232, 249, 0.18);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

body[data-theme="dark"] .messaging-reference-card:hover,
body[data-theme="dark"] .messaging-reference-card:focus-visible {
  border-color: rgba(103, 232, 249, 0.42);
  background: rgba(34, 211, 238, 0.16);
}

body[data-theme="dark"] .messaging-reference-action {
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-reference-picker-backdrop {
  background: linear-gradient(180deg, rgba(11, 13, 16, 0.06), rgba(11, 13, 16, 0.58));
}

body[data-theme="dark"] .messaging-reference-picker {
  border-color: rgba(93, 111, 130, 0.18);
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(11, 13, 16, 0.98) 0%, rgba(11, 13, 16, 0.98) 100%);
  box-shadow:
    0 22px 48px rgba(23, 28, 34, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .messaging-reference-picker-header strong {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-reference-picker-header small {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-reference-picker-close {
  border-color: rgba(103, 232, 249, 0.18);
  background: rgba(48, 59, 70, 0.88);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-reference-picker-close:hover,
body[data-theme="dark"] .messaging-reference-picker-close:focus-visible {
  border-color: rgba(103, 232, 249, 0.42);
  background: rgba(6, 182, 212, 0.22);
  color: #ffffff;
}

body[data-theme="dark"] .messaging-reference-picker-search {
  border-color: rgba(93, 111, 130, 0.16);
  background: rgba(48, 59, 70, 0.82);
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-reference-picker-search input {
  color: #E7EEF5;
}

body[data-theme="dark"] .messaging-reference-picker-search input::placeholder {
  color: #5D6F82;
}

body[data-theme="dark"] .messaging-reference-picker-feedback {
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-reference-result {
  border-color: rgba(93, 111, 130, 0.14);
  background: rgba(11, 13, 16, 0.76);
  color: #E7EEF5;
  box-shadow: none;
}

body[data-theme="dark"] .messaging-reference-result:hover,
body[data-theme="dark"] .messaging-reference-result:focus-visible {
  border-color: rgba(103, 232, 249, 0.34);
  background: rgba(48, 59, 70, 0.94);
  box-shadow: 0 14px 30px rgba(23, 28, 34, 0.24);
}

body[data-theme="dark"] .messaging-reference-empty {
  border-color: rgba(93, 111, 130, 0.18);
  background: rgba(11, 13, 16, 0.54);
  color: #9AABBA;
}

body[data-theme="dark"] .messaging-drawer-avatar {
  background: rgba(34, 211, 238, 0.16);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-drawer-item-kind {
  background: rgba(34, 211, 238, 0.16);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-presence-dot {
  box-shadow: 0 0 0 3px rgba(11, 13, 16, 0.72);
}

body[data-theme="dark"] .messaging-drawer-item:hover,
body[data-theme="dark"] .messaging-drawer-item:focus-visible,
body[data-theme="dark"] .messaging-recipient-item:hover,
body[data-theme="dark"] .messaging-recipient-item:focus-visible,
body[data-theme="dark"] .messaging-drawer-item.is-active {
  border-color: rgba(34, 211, 238, 0.42);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.16), rgba(42, 51, 61, 0.98));
}

body[data-theme="dark"] .messaging-drawer-item-badge {
  background: rgba(103, 232, 249, 0.18);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-drawer-bubble {
  border-color: #5D6F82;
  background: #0B0D10;
  box-shadow: none;
}

body[data-theme="dark"] .messaging-drawer-bubble.is-own {
  border-color: rgba(103, 232, 249, 0.34);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.26), rgba(48, 59, 70, 0.96));
}

body[data-theme="dark"] .messaging-drawer-thread-disabled {
  border-color: rgba(251, 146, 60, 0.3);
  background: rgba(124, 45, 18, 0.34);
  color: #fdba74;
}

body[data-theme="dark"] .messaging-drawer-feedback {
  background: rgba(34, 211, 238, 0.16);
  color: #A5F3FC;
}

body[data-theme="dark"] .messaging-drawer-feedback.is-error {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

body[data-theme="dark"] .messaging-drawer-compose-cancel {
  color: #67E8F9;
}

body[data-theme="dark"] .messaging-drawer-compose-cancel:hover,
body[data-theme="dark"] .messaging-drawer-compose-cancel:focus-visible {
  color: #CFFAFE;
}

@media (max-width: 980px) {
  body[data-theme="dark"] .messaging-drawer-backdrop {
    background: rgba(23, 28, 34, 0.56);
  }
}

/* Responsive system hardening: tokens merged into the single :root at the top of this file. */

.topbar-main > *,
.topbar-nav > *,
.layout > *,
.content > *,
.panel-header > *,
.page-context-bar > *,
.table-pagination > *,
.button-row > *,
.table-actions > *,
.chip-row > *,
.filters > *,
.form-section-grid > * {
  min-width: 0;
}

.topbar-nav-link,
.menu-link,
.page-context-link,
.user-menu-item,
.notification-clear,
.notification-sound-toggle {
  max-width: 100%;
}

.topbar-nav-text,
.menu-link-label,
.page-context-link,
.topbar-user strong,
.topbar-user small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-nav-text,
.menu-link-label {
  white-space: nowrap;
}

.menu-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.menu-link-caret,
.menu-link-icon,
.topbar-nav-icon {
  flex-shrink: 0;
}

.content,
.panel,
.detail-header,
.hero,
.filters,
.form-meta,
.form-section,
.table-wrap,
.empty-state,
.empty-state-inline,
.page-context-bar,
.settings-modal-card,
.modal-content,
.messages,
.notification-panel,
.user-menu-panel {
  max-width: 100%;
}

.input,
select,
.bootstrap-ui .form-control,
.bootstrap-ui .form-select,
.button,
.button-ghost,
.button-danger {
  min-height: var(--responsive-control-height);
}

textarea {
  min-height: clamp(6.5rem, 14vh, 8rem);
}

.panel,
.detail-header,
.hero {
  padding: var(--responsive-surface-padding);
}

.filters,
.form-meta,
.form-section,
.page-context-bar {
  padding: calc(var(--responsive-surface-padding) - 0.1rem);
}

.panel-header h1,
.detail-header h1,
.hero h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.04;
}

.panel-header h2,
.detail-header h2,
.hero h2 {
  font-size: clamp(1.45rem, 2vw, 2.15rem);
  line-height: 1.08;
}

.table-actions,
.button-row,
.hero-actions,
.page-context-actions,
.user-row-actions {
  flex-wrap: wrap;
}

.page-context-copy,
.table-summary,
.table-pagination-summary {
  min-width: 0;
}

.table-pagination-links {
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  :root {
    --layout-gutter: 0.9rem;
    --sidebar-mobile-width: min(320px, calc(100vw - 1.8rem));
    --responsive-control-height: 48px;
    --responsive-surface-padding: 1.05rem;
  }

  .topbar {
    z-index: 42;
  }

  .app-body,
  .auth-body {
    padding-top: calc(var(--topbar-offset) + 0.85rem);
  }

  .topbar-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.65rem 0.85rem 0.55rem;
  }

  .topbar-leading {
    min-width: 0;
    width: 100%;
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.55rem;
    min-width: 0;
    max-width: 100%;
  }

  .topbar-greeting,
  .topbar-greeting-secondary {
    display: none;
  }

  .topbar-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0 0.85rem 0.7rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-left: calc(var(--layout-gutter) + 3rem);
  }

  .topbar-nav-link {
    min-height: 40px;
    padding: 0.5rem 0.8rem;
    font-size: 0.84rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 0 var(--layout-gutter) 1.5rem;
  }

  .sidebar-backdrop {
    top: 0;
    z-index: 44;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: fixed;
    top: max(0.55rem, env(safe-area-inset-top));
    left: var(--layout-gutter);
    bottom: max(0.55rem, env(safe-area-inset-bottom));
    width: var(--sidebar-mobile-width);
    max-width: calc(100vw - (var(--layout-gutter) * 2));
    max-height: calc(
      100vh - max(1.1rem, env(safe-area-inset-top)) - max(1.1rem, env(safe-area-inset-bottom))
    );
    max-height: calc(
      100dvh - max(1.1rem, env(safe-area-inset-top)) - max(1.1rem, env(safe-area-inset-bottom))
    );
    height: auto;
    padding: 1rem 0.9rem calc(1rem + env(safe-area-inset-bottom));
    border-radius: 24px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
    opacity: 0;
    visibility: hidden;
    transform: translateX(calc(-100% - 1rem));
    pointer-events: none;
    z-index: 45;
  }

  .sidebar-mobile-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -0.1rem -0.1rem 0.8rem;
    padding: 0.1rem 0.1rem 0.7rem;
    background: inherit;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  body.sidebar-mobile-open .layout {
    z-index: 46;
  }

  body.sidebar-mobile-open .sidebar {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-collapsed .layout {
    gap: 1rem;
  }

  .page-context-bar,
  .panel-header,
  .detail-header,
  .hero {
    align-items: flex-start;
  }

  .content,
  .auth-layout,
  .panel,
  .detail-header,
  .filters,
  .form-meta,
  .form-section,
  .page-context-bar,
  .table-wrap,
  .table-pagination {
    max-width: 100%;
  }

  .page-context-bar {
    flex-direction: column;
    gap: 0.75rem;
  }

  .page-context-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .messaging-drawer {
    top: var(--topbar-offset);
    right: 0;
    bottom: 0;
    width: min(100vw, 100%);
  }

  .messaging-drawer-shell {
    border-radius: 22px 0 0 0;
  }

  body.messaging-drawer-open {
    overflow: hidden;
  }

  .messaging-drawer-backdrop {
    background: rgba(15, 23, 42, 0.24);
    backdrop-filter: blur(4px);
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  :root {
    --layout-gutter: 0.75rem;
    --sidebar-mobile-width: min(300px, calc(100vw - 1.5rem));
    --responsive-control-height: 46px;
    --responsive-surface-padding: 1rem;
  }

  .topbar-main {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.6rem 0.75rem 0.5rem;
  }

  .brand-lockup {
    width: min(124px, 100%);
  }

  .topbar-leading,
  .topbar-actions,
  .topbar-actions-compact {
    grid-column: 1 / -1;
  }

  .topbar-leading {
    width: 100%;
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
    gap: 0.45rem;
  }

  .topbar-user-card {
    max-width: min(100%, 12rem);
    padding-right: 0.5rem;
  }

  .topbar-user strong {
    max-width: 8rem;
    font-size: 0.84rem;
  }

  .topbar-user-meta {
    display: none;
  }

  .topbar-nav {
    gap: 0.35rem;
    padding: 0.2rem 0.75rem 0.45rem;
    min-height: 0;
  }

  .topbar-nav-link {
    min-height: 38px;
    padding: 0.45rem 0.72rem;
    font-size: 0.8rem;
  }

  .panel-header,
  .detail-header,
  .hero,
  .button-row,
  .hero-actions,
  .table-actions {
    flex-direction: column;
  }

  .button-row > *,
  .hero-actions > *,
  .table-actions > *,
  .page-context-actions > * {
    width: 100%;
  }

  .detail-grid,
  .stats-grid {
    gap: 0.95rem;
  }

  .input,
  select,
  .bootstrap-ui .form-control,
  .bootstrap-ui .form-select,
  .button,
  .button-ghost,
  .button-danger {
    min-height: 44px;
    padding: 0.72rem 0.9rem;
    border-radius: 12px;
    font-size: 0.92rem;
  }

  .input-shell .input {
    padding-left: 2.6rem;
  }

  .filters,
  .filters-wide,
  .form-grid,
  .form-section-grid,
  .settings-form-grid-columns,
  .user-report-filter-grid,
  .task-form-panel .task-form-section-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .table-pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .table-pagination-links {
    width: 100%;
    justify-content: flex-start;
  }

  .messaging-toast-region {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

@media (max-width: 480px) {
  :root {
    --layout-gutter: 0.65rem;
    --sidebar-mobile-width: min(284px, calc(100vw - 1rem));
    --responsive-control-height: 42px;
    --responsive-surface-padding: 0.92rem;
  }

  .topbar-main {
    gap: 0.5rem;
    padding: 0.5rem 0.65rem 0.42rem;
  }

  .brand-lockup {
    width: min(112px, 100%);
  }

  .topbar-user-card {
    width: var(--responsive-control-height);
    min-width: var(--responsive-control-height);
    max-width: none;
    padding: 0;
    justify-content: center;
  }

  .topbar-user,
  .topbar-user-caret {
    display: none;
  }

  .topbar-nav {
    display: flex;
    align-items: center;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0.1rem 0.65rem 0.35rem;
    overflow: visible;
  }

  .topbar-nav-link {
    justify-content: center;
    gap: 0;
    min-width: 0;
    padding: 0.42rem 0.5rem;
  }

  .topbar-nav-text {
    display: none;
  }

  .sidebar-toggle-nav {
    position: static;
    box-shadow: none;
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    min-height: 2rem;
    border-radius: 12px;
  }

  .notification-panel,
  .user-menu-panel {
    width: min(18rem, calc(100vw - 1rem));
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    left: 0.5rem;
    bottom: 0.5rem;
    width: min(18rem, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
  }

  .page-context-link,
  .button,
  .button-ghost,
  .button-danger {
    min-height: var(--responsive-control-height);
  }

  .input,
  select,
  .bootstrap-ui .form-control,
  .bootstrap-ui .form-select,
  .button,
  .button-ghost,
  .button-danger {
    padding: 0.62rem 0.75rem;
    font-size: 0.88rem;
  }

  .data-table tbody td {
    grid-template-columns: 1fr;
    gap: 0.32rem;
  }

  .data-table tbody td::before {
    font-size: 0.66rem;
    letter-spacing: 0.07em;
  }

  .data-table tbody td.table-cell-actions,
  .data-table tbody td[data-column-label=""] {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .messaging-drawer-form {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.45rem;
  }
}

@media (max-width: 360px) {
  :root {
    --layout-gutter: 0.5rem;
    --sidebar-mobile-width: min(264px, calc(100vw - 0.8rem));
    --responsive-control-height: 40px;
    --responsive-surface-padding: 0.85rem;
  }

  .brand-lockup {
    width: min(102px, 100%);
  }

  .topbar-main {
    padding: 0.45rem 0.5rem 0.4rem;
  }

  .topbar-nav {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .topbar-nav-link {
    min-height: 36px;
    padding: 0.35rem 0.4rem;
  }

  .panel,
  .detail-header,
  .hero,
  .filters,
  .form-meta,
  .form-section,
  .page-context-bar {
    padding: var(--responsive-surface-padding);
  }

  .data-table tbody {
    padding: 0.65rem;
  }

  .data-table tbody tr {
    padding: 0.8rem;
  }
}

body[data-theme="dark"] .sidebar-toggle-nav {
  background: rgba(11, 13, 16, 0.98);
  box-shadow: 6px 0 16px rgba(23, 28, 34, 0.34);
}

/* Shared form alignment normalization for multi-column layouts (tokens in the top :root). */

.filters,
.form-section-grid,
.settings-form-grid-columns,
.user-report-filter-grid,
.task-form-panel .task-form-section-grid {
  align-items: start;
}

.filters > *,
.form-section-grid > *,
.settings-form-grid-columns > *,
.user-report-filter-grid > *,
.task-form-panel .task-form-section-grid > * {
  align-self: start;
}

.form-control-field {
  min-width: 0;
  align-content: start;
}

.field.form-control-field > label {
  display: flex;
  align-items: flex-end;
  min-height: var(--form-label-min-height);
  margin: 0;
  overflow-wrap: anywhere;
}

.field.form-control-field > .help-text,
.field.form-control-field > .form-error,
.checkbox-row.form-control-field > .help-text,
.checkbox-row.form-control-field > .form-error {
  min-width: 0;
}

.checkbox-row.form-control-field {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "control label"
    "help help"
    "error error";
  gap: 0.55rem 0.7rem;
  align-items: start;
}

.form-section-grid > .checkbox-row.form-control-field,
.settings-form-grid-columns > .checkbox-row.form-control-field,
.user-report-filter-grid > .checkbox-row.form-control-field,
.filters > .checkbox-row.form-control-field,
.task-form-panel .task-form-section-grid > .checkbox-row.form-control-field {
  margin-top: var(--form-inline-control-offset);
}

.checkbox-row.form-control-field > input[type="checkbox"],
.checkbox-row.form-control-field > input[type="radio"] {
  grid-area: control;
  margin: 0.12rem 0 0;
}

.checkbox-row.form-control-field > label {
  grid-area: label;
  margin: 0;
  min-height: 0;
  overflow-wrap: anywhere;
}

.checkbox-row.form-control-field > .help-text {
  grid-area: help;
}

.checkbox-row.form-control-field > .form-error {
  grid-area: error;
}

@media (max-width: 640px) {
  .form-section-grid > .checkbox-row.form-control-field,
  .settings-form-grid-columns > .checkbox-row.form-control-field,
  .user-report-filter-grid > .checkbox-row.form-control-field,
  .filters > .checkbox-row.form-control-field,
  .task-form-panel .task-form-section-grid > .checkbox-row.form-control-field {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .topbar-main,
  .topbar-main.topbar-main-compact {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    min-height: 54px;
    padding: 0.45rem 0.65rem;
  }

  .topbar-leading {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    align-self: center;
  }

  .brand-stack,
  .brand {
    min-width: 0;
  }

  .brand-lockup {
    width: min(108px, 38vw);
  }

  .topbar-actions,
  .topbar-actions-compact {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
  }

  .notification-shell,
  .user-menu-shell {
    flex: 0 0 auto;
  }

  .topbar-button,
  .notification-trigger,
  .messaging-trigger,
  .topbar-user-card {
    min-height: 38px;
  }

  .notification-trigger,
  .messaging-trigger,
  .topbar-user-card {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 14px;
  }

  .topbar-user-card {
    max-width: none;
    padding: 0;
    justify-content: center;
  }

  .topbar-user,
  .topbar-user-caret {
    display: none;
  }

  .topbar-user-avatar {
    width: 30px;
    height: 30px;
    margin: 0;
    font-size: 0.82rem;
  }

  .topbar-nav {
    padding: 0.08rem 0.65rem 0.28rem;
    min-height: 0;
  }

  .sidebar-toggle-nav {
    width: 1.95rem;
    min-width: 1.95rem;
    height: 1.95rem;
    min-height: 1.95rem;
    margin-right: 0;
    border-radius: 10px;
  }
}

@media (max-width: 420px) {
  .topbar-main,
  .topbar-main.topbar-main-compact {
    gap: 0.45rem;
    padding: 0.42rem 0.55rem;
  }

  .brand-lockup {
    width: min(98px, 35vw);
  }

  .topbar-actions,
  .topbar-actions-compact {
    gap: 0.28rem;
  }

  .notification-trigger,
  .messaging-trigger,
  .topbar-user-card {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .topbar-user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  .topbar-nav {
    padding: 0.05rem 0.55rem 0.24rem;
  }

  .sidebar-toggle-nav {
    width: 1.85rem;
    min-width: 1.85rem;
    height: 1.85rem;
    min-height: 1.85rem;
  }
}

/* Compact contextual navigation */
.page-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(214, 221, 233, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.page-context-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}

.page-context-section {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: fit-content;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: rgba(237, 243, 255, 0.94);
  color: var(--accent-deep);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.15;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.breadcrumb-list::-webkit-scrollbar {
  display: none;
}

.breadcrumb-item {
  gap: 0.28rem;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}

.breadcrumb-item:not(:last-child)::after {
  margin-left: 0.05rem;
}

.breadcrumb-item a,
.breadcrumb-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-item a {
  font-weight: 600;
}

.breadcrumb-item.is-current {
  font-weight: 800;
}

.page-context-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.42rem;
  flex: 0 0 auto;
}

.page-context-actions > * {
  width: auto;
}

.page-context-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  min-height: 32px;
  padding: 0.38rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(211, 219, 231, 0.92);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  box-shadow: none;
}

.page-context-link-icon {
  font-size: 0.92rem;
  line-height: 1;
  flex-shrink: 0;
}

.page-context-link:hover {
  border-color: rgba(37, 99, 235, 0.18);
  background: var(--gray-soft);
  color: var(--accent-deep);
}

.page-context-link-muted {
  color: #53667d;
}

@media (max-width: 1024px) {
  .page-context-bar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
    padding: 0.48rem 0.68rem;
  }

  .page-context-actions {
    width: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .page-context-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.46rem 0.62rem;
  }

  .page-context-copy {
    gap: 0.28rem 0.45rem;
  }

  .page-context-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-context-link {
    min-height: 30px;
    padding: 0.34rem 0.58rem;
    font-size: 0.74rem;
  }
}

@media (max-width: 480px) {
  .page-context-section {
    font-size: 0.6rem;
  }

  .breadcrumb-item {
    font-size: 0.78rem;
  }
}

/* Desktop/notebook spacing compaction */
@media (min-width: 1025px) {
  :root {
    --layout-gutter: clamp(0.78rem, 1.25vw, 1.1rem);
    --sidebar-gap: clamp(0.62rem, 0.9vw, 0.8rem);
    --responsive-surface-padding: 1rem;
  }

  html {
    scroll-padding-top: calc(var(--topbar-offset) + 0.65rem);
  }

  .app-body,
  .auth-body {
    padding-top: calc(var(--topbar-offset) + 0.65rem);
  }

  .layout {
    gap: var(--sidebar-gap);
    padding: 0 var(--layout-gutter) 1.3rem;
  }

  .content,
  .auth-layout {
    gap: 0.72rem;
  }

  .panel,
  .detail-header,
  .hero {
    padding: 1rem 1.08rem;
  }

  .filters,
  .form-meta,
  .form-section {
    padding: 0.88rem 0.96rem;
  }

  .page-context-bar {
    gap: 0.55rem 0.72rem;
    padding: 0.42rem 0.68rem;
    margin-bottom: 0;
  }

  .panel-header {
    gap: 0.78rem;
    margin-bottom: 0.88rem;
  }

  .panel-header h1,
  .detail-header h1,
  .hero h1 {
    margin-bottom: 0.36rem;
    line-height: 1;
  }

  .panel-header h2,
  .detail-header h2,
  .hero h2 {
    margin-bottom: 0.28rem;
    line-height: 1.04;
  }

  .panel-header p,
  .hero p,
  .detail-header p {
    margin: 0.18rem 0 0;
    line-height: 1.5;
  }

  .filters {
    gap: 0.82rem;
    margin-bottom: 0.92rem;
  }

  .form-grid,
  .form-section-grid,
  .settings-form-grid-columns,
  .user-report-filter-grid,
  .task-form-panel .task-form-section-grid {
    gap: 0.88rem;
  }
}

/* Desktop/notebook unified topbar band */
@media (min-width: 1025px) {
  :root {
    --topbar-offset: 118px;
  }

  .topbar {
    gap: 0;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.035);
    backdrop-filter: blur(16px);
  }

  .topbar-main,
  .topbar-nav {
    --topbar-band-bg: rgba(255, 255, 255, 0.94);
  }

  .topbar-main.topbar-surface,
  .topbar-nav.topbar-surface {
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .topbar-main {
    min-height: 52px;
    padding: 0.34rem 0.9rem 0.3rem;
    gap: 0.72rem;
  }

  .topbar-leading {
    gap: 0.6rem;
  }

  .brand-lockup {
    width: clamp(110px, 8.6vw, 132px);
  }

  .topbar-actions,
  .topbar-actions-compact {
    --topbar-control-height: 38px;
    gap: 0.5rem;
  }

  .topbar-greeting {
    max-width: min(29rem, 38vw);
    font-size: 0.79rem;
  }

  .topbar-greeting-secondary {
    font-size: 0.76rem;
  }

  .topbar-button,
  .notification-trigger,
  .sidebar-toggle,
  .topbar-user-card {
    border-radius: 12px;
  }

  .topbar-user-card {
    padding: 0 0.58rem 0 0.42rem;
    border-radius: 14px;
  }

  .topbar-nav {
    gap: 0;
    min-height: 0;
    padding: 0.12rem 0.82rem 0.22rem;
    border-top: 0;
    background: transparent;
  }

  .topbar-nav-link,
  .sidebar-toggle-nav,
  .topbar-button,
  .notification-trigger,
  .topbar-user-card {
    border-color: var(--topbar-band-bg);
    background: var(--topbar-band-bg);
    box-shadow: none;
  }

  .topbar-nav-link:not(.is-active):not([aria-current="page"]) {
    background: var(--topbar-band-bg);
    border-color: var(--topbar-band-bg);
  }

  .topbar-nav-link {
    min-height: 36px;
    padding: 0.46rem 0.84rem;
    gap: 0.5rem;
    border-radius: 10px;
  }

  .topbar-nav-text {
    font-size: 0.85rem;
  }

  .topbar-nav-icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .sidebar-toggle-nav {
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    min-height: 2rem;
    margin-right: 0.18rem;
    border-radius: 10px;
  }

  .topbar-nav-link:hover,
  .sidebar-toggle-nav:hover,
  .topbar-button:hover,
  .notification-trigger:hover,
  .topbar-user-card:hover {
    border-color: var(--topbar-band-bg);
    background: var(--topbar-band-bg);
    color: var(--accent-deep);
  }

  .sidebar-toggle-nav:hover {
    transform: none;
  }

  .topbar-nav-link.is-active,
  .topbar-nav-link[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: none;
  }
}

@media (min-width: 1025px) {
  body[data-theme="dark"] .topbar-main.topbar-surface,
  body[data-theme="dark"] .topbar-nav.topbar-surface {
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  body[data-theme="dark"] .topbar-nav,
  body[data-theme="dark"] .topbar-nav-link,
  body[data-theme="dark"] .sidebar-toggle-nav {
    background: transparent;
  }

  body[data-theme="dark"] .topbar-nav-link,
  body[data-theme="dark"] .sidebar-toggle-nav,
  body[data-theme="dark"] .topbar-button,
  body[data-theme="dark"] .notification-trigger,
  body[data-theme="dark"] .topbar-user-card {
    border-color: var(--topbar-band-bg);
    background: var(--topbar-band-bg);
    box-shadow: none;
  }

  body[data-theme="dark"] .topbar-nav-link:not(.is-active):not([aria-current="page"]) {
    background: var(--topbar-band-bg);
    border-color: var(--topbar-band-bg);
  }

  body[data-theme="dark"] .topbar-nav-link:hover,
  body[data-theme="dark"] .sidebar-toggle-nav:hover,
  body[data-theme="dark"] .topbar-button:hover,
  body[data-theme="dark"] .notification-trigger:hover,
  body[data-theme="dark"] .topbar-user-card:hover {
    border-color: var(--topbar-band-bg);
    background: var(--topbar-band-bg);
    color: #E7EEF5;
  }

  body[data-theme="dark"] .sidebar-toggle-nav:hover {
    transform: none;
  }

body[data-theme="dark"] .topbar-nav-link:hover .topbar-nav-icon,
body[data-theme="dark"] .topbar-nav-link.is-active .topbar-nav-icon,
body[data-theme="dark"] .topbar-nav-link[aria-current="page"] .topbar-nav-icon {
  background: transparent;
}
}

.table-pagination {
  gap: 0.7rem 1rem;
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
}

.table-pagination-summary {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.table-pagination-links {
  margin-left: auto;
  justify-content: flex-end;
  gap: 0.35rem;
}

.table-pagination-status {
  color: #7b8799;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  margin-right: 0.1rem;
}

.table-pagination-link,
.table-pagination-ellipsis {
  min-width: 34px;
  min-height: 34px;
  padding: 0.42rem 0.68rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1;
  box-shadow: none;
}

.table-pagination-link-nav {
  min-width: auto;
  padding-inline: 0.78rem;
}

.table-pagination-link-current {
  box-shadow: none;
}

.table-pagination-link-disabled,
.table-pagination-ellipsis {
  background: #f8fafc;
}

@media (max-width: 640px) {
  .table-pagination {
    padding: 0.7rem 0.8rem;
  }

  .table-pagination-links {
    width: 100%;
    justify-content: flex-start;
  }

  .table-pagination-status {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.1rem;
  }

  .table-pagination-link,
  .table-pagination-ellipsis {
    min-width: 32px;
    min-height: 32px;
    padding: 0.4rem 0.6rem;
  }
}

:root {
  --color-linea-seccion: rgba(214, 221, 233, 0.46);
  --color-linea-seccion-suave: rgba(214, 221, 233, 0.28);
  --color-linea-tabla: rgba(214, 221, 233, 0.72);
  --color-linea-tabla-hover: rgba(var(--accent-rgb), 0.14);
}

/* Neutraliza lineas divisorias estructurales para mantener una interfaz limpia
   sin tocar bordes funcionales de controles o acciones. */
.panel,
.sidebar,
.detail-header,
.filters,
.settings-modal-card,
.modal-content,
.notification-panel,
.user-menu-panel,
.page-context-bar,
.form-meta,
.form-section,
.table-wrap,
.empty-state,
.empty-state-inline,
.message,
.stat-card,
.filter-layout-advanced,
.messaging-drawer-thread-pane,
.messaging-reference-picker {
  border-color: var(--color-linea-seccion);
}

.notification-item,
.sidebar-note,
.table-pagination,
.task-history-collapsible[open] .task-history-summary,
.messaging-drawer-header {
  border-color: var(--color-linea-seccion-suave);
}

.data-table th,
.data-table td {
  border-color: var(--color-linea-tabla);
}

.data-table tbody tr:hover td {
  border-bottom-color: var(--color-linea-tabla-hover);
}

@media (min-width: 1025px) {
  .topbar {
    border-bottom-color: var(--color-linea-seccion-suave);
  }
}
