:root {
  --bg: #f4f7f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f4f2;
  --border: rgba(60, 84, 68, 0.1);
  --border-strong: rgba(60, 84, 68, 0.18);
  --text: #18201b;
  --muted: #6b7b72;
  --accent: #34b36b;
  --accent-dim: #278752;
  --accent-glow: rgba(52, 179, 107, 0.16);
  --ok: #2fb36f;
  --warn: #d79b45;
  --err: #d96f6f;
  --input-bg: #f8fbf9;
  --stroke: #dbe4de;
  --hover-surface: #edf3ef;
  --active-surface: #e2ece5;
  --accent-surface: #e6f5eb;
  /* Texto sobre fondos de acento (mejor contraste que --text sobre verde) */
  --btn-on-accent: #f4fffa;
  --font-display: "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --header-pad-x: clamp(1rem, 4vw, 1.75rem);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-enter: 0.42s;
  --duration-micro: 0.2s;
}

/* Bootstrap 5 (base.html): tema claro alineado con la app; `app.css` va después del CSS de Bootstrap. */
[data-bs-theme="light"] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--stroke);
  --bs-primary: #278752;
  --bs-primary-rgb: 39, 135, 82;
  --bs-link-color: var(--accent-dim);
  --bs-link-hover-color: var(--accent);
}

* { box-sizing: border-box; }

.site-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-optical-sizing: auto;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  position: relative;
}

.site-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 120% 80% at 10% -20%, rgba(52, 179, 107, 0.08), transparent 50%),
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(39, 135, 82, 0.06), transparent 45%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(52, 179, 107, 0.05), transparent 55%);
  opacity: 1;
}

.site-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--header-pad-x);
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 6px;
  transition: top 0.2s var(--ease-out-expo);
}

.skip-link:focus {
  top: 0.75rem;
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ═══════════════════════════════════════════
   Site header — sticky glass bar
   ═══════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.25rem;
  padding: 0 var(--header-pad-x);
  height: 3.6rem;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(244, 247, 246, 0.9) 100%
  );
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow:
    0 1px 0 rgba(24, 40, 32, 0.04),
    0 4px 24px -8px rgba(24, 40, 32, 0.06);
  animation: header-rise var(--duration-enter) var(--ease-out-expo) both;
}

@keyframes header-rise {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--accent-dim);
  flex-shrink: 0;
  transition:
    color var(--duration-micro) ease,
    transform 0.28s var(--ease-out-expo);
}

.logo:hover {
  color: var(--accent);
  transform: translateX(2px);
}

/* Símbolo Cerasyn: SVG negro teñido con mask para seguir el color del tema */
.logo__mark {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
  flex-shrink: 0;
  background-color: var(--accent-dim);
  -webkit-mask: url("cerasyn_logo_black.b2754e795074.svg") center/contain no-repeat;
          mask: url("cerasyn_logo_black.b2754e795074.svg") center/contain no-repeat;
  transition:
    background-color var(--duration-micro) ease,
    transform 0.5s var(--ease-out-expo);
}

.logo:hover .logo__mark {
  background-color: var(--accent);
  transform: rotate(18deg) scale(1.06);
}

.logo__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, var(--text) 20%, var(--accent-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo:hover .logo__text {
  background: linear-gradient(105deg, var(--accent) 0%, #5ccc8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.logo__wordmark {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.logo__tagline {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  margin-top: 0.1rem;
}

/* ── Mobile burger ── */

.site-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2rem;
  height: 2rem;
  padding: 0.3rem;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--duration-micro) ease;
}

.site-header__burger:hover {
  background: var(--hover-surface);
}

.site-header__burger-line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
  transition:
    transform 0.25s var(--ease-out-expo),
    opacity 0.2s ease;
  transform-origin: center;
}

.site-header--open .site-header__burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.site-header--open .site-header__burger-line:nth-child(2) {
  opacity: 0;
}
.site-header--open .site-header__burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Navigation container ── */

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
  justify-content: flex-end;
}

.site-nav__divider {
  width: 1px;
  height: 1.2rem;
  background: var(--border-strong);
  margin: 0 0.35rem;
  flex-shrink: 0;
}

/* ── Espacio de trabajo: desplegable ── */

.site-nav__item {
  position: relative;
  display: flex;
  align-items: center;
}

.site-nav__dropdown {
  position: relative;
}

.site-nav__link--dropdown {
  padding-right: 0.45rem;
}

.site-nav__dropdown-chevron {
  flex-shrink: 0;
  margin-left: 0.1rem;
  opacity: 0.45;
  transition:
    transform 0.32s var(--ease-out-expo),
    opacity 0.22s ease;
}

.site-nav__dropdown.is-open .site-nav__dropdown-chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}

.site-nav__dropdown.is-open .site-nav__link--dropdown {
  color: var(--text);
  background: var(--hover-surface);
  border-color: var(--border);
}

.site-nav__dropdown.is-open .site-nav__link--dropdown.site-nav__link--active {
  color: var(--accent-dim);
  background: var(--accent-surface);
  border-color: rgba(52, 179, 107, 0.22);
}

.site-nav__dropdown-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: min(18rem, calc(100vw - 2.5rem));
  max-width: 20rem;
  padding: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-0.5rem) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 0.28s var(--ease-out-expo),
    transform 0.34s var(--ease-out-expo),
    visibility 0.28s;
}

.site-nav__dropdown.is-open .site-nav__dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.site-nav__dropdown-surface {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(244, 247, 246, 0.96) 100%
  );
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 12px 40px -18px rgba(24, 40, 32, 0.35),
    0 4px 16px -6px rgba(39, 135, 82, 0.12);
  padding: 0.4rem;
  overflow: hidden;
}

.site-nav__dropdown-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(52, 179, 107, 0.09), transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 100%, rgba(39, 135, 82, 0.06), transparent 50%);
}

.site-nav__dropdown-heading {
  position: relative;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.35rem 0.55rem 0.2rem;
  padding: 0;
}

.site-nav__dropdown-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.18s ease,
    transform 0.22s var(--ease-out-expo);
}

.site-nav__dropdown-row:hover {
  background: var(--hover-surface);
  color: var(--text);
}

.site-nav__dropdown-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-nav__dropdown-row-icon {
  display: flex;
  flex-shrink: 0;
  color: var(--accent-dim);
  opacity: 0.85;
}

.site-nav__dropdown-row-text {
  flex: 1;
  min-width: 0;
}

.site-nav__dropdown-row-text--truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav__dropdown-row--create {
  background: linear-gradient(
    135deg,
    rgba(52, 179, 107, 0.12) 0%,
    rgba(230, 245, 235, 0.85) 100%
  );
  border: 1px solid rgba(52, 179, 107, 0.2);
  color: var(--accent-dim);
  margin-bottom: 0.15rem;
}

.site-nav__dropdown-row--create:hover {
  background: linear-gradient(
    135deg,
    rgba(52, 179, 107, 0.18) 0%,
    rgba(230, 245, 235, 0.95) 100%
  );
  transform: translateX(2px);
}

.site-nav__dropdown-row--space {
  font-weight: 500;
  color: var(--text);
}

.site-nav__dropdown-row--space.is-current {
  background: var(--accent-surface);
  color: var(--accent-dim);
  font-weight: 600;
}

.site-nav__dropdown-row--space.is-current:hover {
  background: rgba(52, 179, 107, 0.16);
}

.site-nav__dropdown-pill {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(52, 179, 107, 0.2);
  color: var(--accent-dim);
}

.site-nav__dropdown-form {
  margin: 0;
}

.site-nav__dropdown-divider {
  height: 1px;
  margin: 0.35rem 0.5rem;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(60, 84, 68, 0.12) 20%,
    rgba(60, 84, 68, 0.12) 80%,
    transparent
  );
}

.site-nav__dropdown-row--manage {
  color: var(--muted);
  font-size: 0.84rem;
}

.site-nav__dropdown-row--manage:hover {
  color: var(--accent-dim);
}

.site-nav__dropdown.is-open .site-nav__dropdown-surface > .site-nav__dropdown-row--create {
  animation: nav-workspace-row-in 0.4s var(--ease-out-expo) 0.05s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-heading {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.1s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(1) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.14s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(2) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.17s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(3) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.2s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(4) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.23s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(5) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.26s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-form:nth-of-type(n + 6) {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.29s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-divider {
  animation: nav-workspace-row-in 0.35s var(--ease-out-expo) 0.28s both;
}

.site-nav__dropdown.is-open .site-nav__dropdown-row--manage {
  animation: nav-workspace-row-in 0.38s var(--ease-out-expo) 0.32s both;
}

@keyframes nav-workspace-row-in {
  from {
    opacity: 0;
    transform: translateX(-0.45rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav__dropdown-panel,
  .site-nav__dropdown.is-open .site-nav__dropdown-panel {
    transition: none;
    transform: none;
  }

  .site-nav__dropdown.is-open .site-nav__dropdown-surface > * {
    animation: none !important;
  }

  .site-nav__dropdown-chevron {
    transition: none;
  }
}

/* ── Nav links ── */

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-nav__end {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.15rem;
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

/* keep legacy selectors working for reduced-motion block */
.site-nav a { margin-right: 0; }
.site-nav .link-button { margin-right: 0; }

.site-nav__link-icon {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.18s ease;
}

.site-nav__link:hover .site-nav__link-icon,
.site-nav__link--active .site-nav__link-icon {
  opacity: 0.85;
}

.site-nav__link:hover {
  color: var(--text);
  background: var(--hover-surface);
  border-color: var(--border);
}

.site-nav__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Active indicator */
.site-nav__link--active {
  color: var(--accent-dim);
  background: var(--accent-surface);
  border-color: rgba(52, 179, 107, 0.18);
}

.site-nav__link--active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.4rem;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  animation: nav-active-in 0.3s var(--ease-out-expo) both;
}

@keyframes nav-active-in {
  from { width: 0; opacity: 0; }
  to   { width: 1.4rem; opacity: 1; }
}

.site-nav__link--active:hover {
  color: var(--accent-dim);
  background: var(--accent-surface);
}

/* Quiet variant for secondary links */
.site-nav__link--quiet {
  font-weight: 500;
  opacity: 0.75;
}

.site-nav__link--quiet:hover {
  opacity: 1;
}

.site-nav__link--quiet.site-nav__link--active {
  opacity: 1;
}

/* Exit link hover: warm warning color */
.site-nav__link--exit:hover {
  color: var(--err);
  background: rgba(217, 111, 111, 0.06);
  border-color: rgba(217, 111, 111, 0.12);
}

/* CTA variant for unauthenticated */
.site-nav__link--cta {
  color: var(--btn-on-accent);
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(39, 135, 82, 0.2);
}

.site-nav__link--cta:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5ccc8a);
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(52, 179, 107, 0.22);
  transform: translateY(-1px);
}

/* Logout form */
.site-nav__logout-form {
  display: flex;
  align-items: center;
  margin: 0;
}

/* ── Mobile responsive ── */

@media (max-width: 860px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    min-height: 3.4rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .site-header__burger {
    display: flex;
    order: 1;
  }

  .logo {
    order: 0;
  }

  .logo__tagline {
    display: none;
  }

  .site-nav {
    order: 2;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
    transition:
      max-height 0.35s var(--ease-out-expo),
      opacity 0.25s ease,
      padding 0.25s ease;
  }

  .site-header--open .site-nav {
    max-height: min(92vh, 56rem);
    opacity: 1;
    padding: 0.65rem 0 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.55rem;
    overflow-y: auto;
  }

  .site-nav__links,
  .site-nav__end {
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
  }

  .site-nav__link {
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
  }

  .site-nav__link--active::after {
    display: none;
  }

  .site-nav__link--active {
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
  }

  .site-nav__divider {
    width: 100%;
    height: 1px;
    margin: 0.25rem 0;
  }

  .site-nav__item {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .site-nav__link--dropdown {
    width: 100%;
    justify-content: flex-start;
  }

  .site-nav__dropdown-panel {
    position: static;
    right: auto;
    min-width: 0;
    max-width: none;
    width: 100%;
    margin-top: 0.2rem;
    transform: none !important;
    transform-origin: top center;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      max-height 0.42s var(--ease-out-expo),
      opacity 0.28s ease,
      visibility 0.28s;
  }

  .site-nav__dropdown.is-open .site-nav__dropdown-panel {
    max-height: min(70vh, 34rem);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: none;
  }

  .site-nav__dropdown-surface {
    max-height: min(62vh, 30rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.session-detail-container { max-width: 1400px; }

.session-detail--review {
  max-width: min(1680px, 100vw - 2rem);
}

.site-main {
  position: relative;
  z-index: 1;
  flex: 1;
  animation: main-fade var(--duration-enter) 0.08s var(--ease-out-expo) both;
}

@keyframes main-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 1.5rem var(--header-pad-x) 2rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(219, 228, 222, 0.45) 0%, transparent 100%);
}

.site-footer__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
}

.site-footer__links {
  margin: 0.6rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
}

.site-footer__link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: var(--accent-dim);
  border-bottom-color: currentColor;
  outline: none;
}

/* ─── Page-level elements ──────────────────────────────── */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
}

.page-header__text { flex: 1; min-width: 200px; }

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  background: linear-gradient(115deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  max-width: 44rem;
}

.breadcrumb {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.breadcrumb a {
  color: var(--accent-dim);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ─── Session cards (list page) ────────────────────────── */

.session-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.session-card {
  animation: card-in var(--duration-enter) calc(var(--i, 1) * 42ms) var(--ease-out-expo) both;
}

.session-card__link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s var(--ease-out-expo),
    transform 0.2s var(--ease-out-expo);
}

.session-card__link:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 20px rgba(24, 40, 32, 0.08);
  transform: translateY(-1px);
}

.session-card__body { flex: 1; min-width: 0; }

.session-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-card__date {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
}

.session-card__arrow {
  font-size: 1.15rem;
  color: var(--accent-dim);
  transition: transform 0.2s var(--ease-out-expo), color 0.15s ease;
}

.session-card__link:hover .session-card__arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* ─── Empty state ──────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
  margin: 1rem 0;
  background: var(--surface);
  border: 1px dashed var(--stroke);
  border-radius: 12px;
}

.empty-state--compact {
  padding: 1.5rem 1rem;
}

.empty-state__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin-bottom: 1rem;
  background: radial-gradient(circle at 35% 35%, #d8f5e4, var(--accent) 60%, var(--accent-dim));
  opacity: 0.4;
}

.empty-state__text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.empty-state__hint {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

.empty-state__hint a {
  color: var(--accent-dim);
}

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

/* ─── Form page (new session, etc.) ────────────────────── */

.form-page {
  max-width: 480px;
}

.form-page--centered {
  margin: 0 auto;
}

.form-page__header {
  margin-bottom: 1.5rem;
}

.form-card {
  padding: 1.25rem;
  background: var(--bg-elevated);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.06);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ─── Session detail toolbar ───────────────────────────── */

.session-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-start;
  margin: 1rem 0 0.25rem;
  padding: 1rem;
  background: var(--bg-elevated);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.06);
}

.session-toolbar__mutable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.session-toolbar__mutable[inert] {
  opacity: 0.55;
}

/* ─── Session detail: new SD components ───────────────── */

/* Page header */
.sd-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0 0;
}

.sd-page-header__left { flex: 1; min-width: 0; }

.sd-page-header__title {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(115deg, var(--text) 0%, var(--accent-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sd-page-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.35rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.sd-page-header__meta span + span::before {
  content: "·";
  margin-right: 0.35rem;
  color: var(--border-strong);
}

.sd-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sd-status-tag--closed {
  background: rgba(120, 130, 125, 0.14);
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.sd-page-header--compact {
  align-items: flex-start;
  padding: 0.5rem 0 0.35rem;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 0.35rem;
}

.sd-page-header__title--compact {
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}

.sd-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sd-toolbar__locked-notice--inline {
  margin: 0;
}

.sd-actions-dropdown__panel {
  min-width: min(100vw - 2rem, 320px);
  padding: 0.5rem 0;
  border-radius: 10px;
  border: 1px solid var(--stroke);
}

.sd-actions-dropdown__section {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sd-actions-dropdown__section:last-child {
  border-bottom: none;
}

.sd-actions-dropdown__section--danger {
  background: rgba(252, 234, 234, 0.35);
}

.sd-actions-dropdown__label {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sd-actions-dropdown__toggle {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

/* Prominent variant: make "Acciones de sesión" pop visually
   (accent border, subtle glow, settings-gear icon). */
.sd-actions-dropdown__toggle--prominent {
  position: relative;
  padding: 0.5rem 0.95rem 0.5rem 0.8rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text, #0f1a14);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent, #2d6a4f) 9%, var(--surface, #fff)) 0%,
    var(--surface, #fff) 60%
  );
  border: 1.5px solid color-mix(in srgb, var(--accent, #2d6a4f) 40%, var(--stroke, #dee2e6));
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 14px color-mix(in srgb, var(--accent, #2d6a4f) 10%, transparent);
}

.sd-actions-dropdown__toggle--prominent::after {
  margin-left: 0.15rem;
  border-top-color: currentColor;
  opacity: 0.75;
}

.sd-actions-dropdown__toggle--prominent:hover,
.sd-actions-dropdown__toggle--prominent:focus-visible {
  color: var(--accent-dim, #1b4332);
  border-color: color-mix(in srgb, var(--accent, #2d6a4f) 70%, var(--stroke, #dee2e6));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent, #2d6a4f) 14%, var(--surface, #fff)) 0%,
    color-mix(in srgb, var(--accent, #2d6a4f) 4%, var(--surface, #fff)) 70%
  );
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 22px color-mix(in srgb, var(--accent, #2d6a4f) 20%, transparent);
  outline: none;
}

.sd-actions-dropdown__toggle--prominent[aria-expanded="true"] {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dim, #1b4332), var(--accent, #2d6a4f));
  border-color: var(--accent-dim, #1b4332);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    0 6px 18px color-mix(in srgb, var(--accent, #2d6a4f) 35%, transparent);
}

.sd-actions-dropdown__toggle-icon {
  flex-shrink: 0;
  transition: transform 0.35s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}

.sd-actions-dropdown__toggle--prominent:hover .sd-actions-dropdown__toggle-icon {
  transform: rotate(45deg);
}

.sd-actions-dropdown__toggle--prominent[aria-expanded="true"] .sd-actions-dropdown__toggle-icon {
  transform: rotate(90deg);
}

.sd-actions-dropdown__stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sd-upload-form--stacked {
  flex-direction: column;
  align-items: stretch;
}

.sd-session-team__form--dropdown {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* En columna, .sd-session-team__select tiene flex:1 1 12rem (pensado para fila):
   sin override el select crece en altura y llena el dropdown. */
.sd-session-team__form--dropdown select.sd-session-team__select,
.sd-session-team__form--dropdown select {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: auto;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  font-size: 0.8rem;
  padding: 0.28rem 1.8rem 0.28rem 0.5rem;
  line-height: 1.35;
  background-color: var(--input-bg);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7b72' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 10px 8px;
}

.sd-session-team__form--dropdown .sd-btn--primary {
  margin-top: 0.45rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

/* Asignación de equipo en detalle de sesión */
.sd-session-team {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

.sd-session-team__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.sd-session-team__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.sd-session-team__label svg {
  opacity: 0.75;
  color: var(--accent-dim);
}

.sd-session-team__select {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 22rem;
  border-radius: 8px;
  border-color: var(--stroke);
}

.sd-session-team__submit {
  flex-shrink: 0;
  padding: 0.32rem 0.65rem;
  font-size: 0.82rem;
}

.sd-session-team__hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Toolbar */
.sd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(24, 40, 32, 0.05);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sd-toolbar--locked {
  background: rgba(240, 244, 242, 0.6);
  border-color: rgba(215, 155, 69, 0.2);
}

.sd-toolbar__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sd-toolbar__group--primary {
  flex: 1 1 auto;
  min-width: 0;
}

.sd-toolbar__group--secondary {
  flex-shrink: 0;
}

.sd-toolbar__sep {
  display: inline-block;
  width: 1px;
  height: 1.15rem;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 0.1rem;
  align-self: center;
}

.sd-toolbar__locked-notice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #7a5218;
  padding: 0.2rem 0.55rem;
  background: rgba(215, 155, 69, 0.1);
  border: 1px solid rgba(215, 155, 69, 0.25);
  border-radius: 6px;
  white-space: nowrap;
}

/* SD buttons */
.sd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.38rem 0.7rem;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.18s ease,
    transform 0.15s var(--ease-out-expo),
    color 0.15s ease;
}

.sd-btn:hover { transform: translateY(-1px); }
.sd-btn:active { transform: translateY(0); }

.sd-btn svg { flex-shrink: 0; }

.sd-btn--upload {
  background: var(--accent-surface);
  color: var(--accent-dim);
  border-color: rgba(52, 179, 107, 0.28);
  cursor: pointer;
}
.sd-btn--upload:hover {
  background: rgba(52, 179, 107, 0.16);
  border-color: rgba(52, 179, 107, 0.45);
  box-shadow: 0 2px 10px rgba(52, 179, 107, 0.12);
  color: var(--accent-dim);
}

.sd-btn--confirm {
  background: var(--accent);
  color: var(--text);
  border-color: transparent;
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.sd-btn--confirm:hover {
  background: #3dc877;
  box-shadow: 0 3px 14px rgba(52, 179, 107, 0.28);
  color: var(--text);
}

.sd-btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.sd-btn--primary:hover {
  background: #3dc877;
  box-shadow: 0 3px 14px rgba(52, 179, 107, 0.28);
  color: #fff;
}

.sd-btn--quiet {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--stroke);
}
.sd-btn--quiet:hover {
  background: var(--hover-surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.sd-btn--ghost-danger {
  background: transparent;
  color: var(--err);
  border-color: rgba(217, 111, 111, 0.25);
}
.sd-btn--ghost-danger:hover {
  background: rgba(217, 111, 111, 0.07);
  border-color: rgba(217, 111, 111, 0.42);
}

.sd-btn--danger-ghost {
  background: transparent;
  color: #b04444;
  border-color: rgba(217, 111, 111, 0.22);
}
.sd-btn--danger-ghost:hover {
  background: rgba(217, 111, 111, 0.07);
  border-color: rgba(217, 111, 111, 0.38);
  color: #8e2020;
}

/* Upload form */
.sd-upload-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sd-upload-form__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Image count badge */
.sd-image-count {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

/* Upload file count feedback */
.sd-upload-count {
  display: none;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-dim);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-surface);
  border: 1px solid rgba(52, 179, 107, 0.25);
}
.sd-upload-count:not([hidden]) { display: inline-flex; }

.sd-inline-form { display: inline-flex; }

/* Drag-and-drop overlay */
.sd-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 179, 107, 0.06);
  backdrop-filter: blur(3px);
  transition: opacity 0.18s ease;
}

.sd-drop-overlay[data-active] {
  opacity: 1;
  pointer-events: none;
}

.sd-drop-overlay__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2.5rem 3.5rem;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 2px dashed rgba(52, 179, 107, 0.5);
  box-shadow:
    0 0 0 6px rgba(52, 179, 107, 0.06),
    0 24px 64px rgba(12, 24, 18, 0.14);
}

.sd-drop-overlay__box svg {
  color: var(--accent);
  animation: sd-drop-float 0.9s ease-in-out infinite alternate;
}

@keyframes sd-drop-float {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

.sd-drop-overlay__label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-dim);
}

.sd-drop-overlay__hint {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Session closed inline banner */
.sd-closed-banner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  background: rgba(215, 155, 69, 0.08);
  border: 1px solid rgba(215, 155, 69, 0.25);
  font-size: 0.88rem;
  color: #7a5218;
  animation: ws-flash-in 0.3s var(--ease-out-expo) both;
}

/* Image list empty state */
.sd-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem;
  gap: 0.4rem;
  min-height: 160px;
}

.sd-list-empty__icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-surface);
  color: var(--accent-dim);
  opacity: 0.65;
  margin-bottom: 0.35rem;
}

.sd-list-empty__text {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.sd-list-empty__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Detail panel empty placeholder */
.sd-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  gap: 0.5rem;
  color: var(--muted);
}

.sd-panel-empty svg {
  opacity: 0.3;
  margin-bottom: 0.5rem;
}

.sd-panel-empty__text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.sd-panel-empty__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 22rem;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .sd-drop-overlay__box svg { animation: none; }
  .sd-btn { transition-duration: 0.01ms; }
  .sd-btn:hover { transform: none; }
  .ws-btn-classify--pulse { animation: none; }
}

.session-toolbar__upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.session-toolbar__saved-count {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

.upload-selection-count {
  font-size: 0.86rem;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #2d6a4f) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #2d6a4f) 35%, var(--stroke));
  max-width: 100%;
}

.upload-selection-count:not([hidden]) {
  display: inline-block;
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .upload-selection-count {
    background: var(--hover-surface);
    border-color: var(--border-strong);
  }
}

.session-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.session-toolbar__divider {
  width: 1px;
  height: 1.4rem;
  background: var(--border);
  flex-shrink: 0;
}

.file-input {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.file-input__label {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.92rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.file-input:hover .file-input__label {
  border-color: var(--border-strong);
  color: var(--text);
}

/* ─── Workspace polish ─────────────────────────────────── */

.image-list__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.image-list__item:hover { background: var(--hover-surface); }
.image-list__item.active {
  background: var(--active-surface);
  border-left-color: var(--accent);
}

.image-list__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-weight: 500;
}

.image-list__meta {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.image-list__meta .review-status {
  margin-left: 0;
}

.image-list__empty {
  padding: 1rem 0.5rem;
  text-align: center;
  font-size: 0.88rem;
}

.detail-panel__figure {
  margin: 0 0 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.detail-panel__preview {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  display: block;
  object-fit: contain;
}

.detail-panel__split > .detail-panel__image-col.col-lg-7 .detail-panel__preview {
  max-height: min(560px, 58vh);
}

.workspace-image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.workspace-image-preview .detail-panel__figure {
  margin-bottom: 0;
  width: 100%;
}

.workspace-image-preview__open {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
}

.workspace-image-preview__open-icon {
  flex-shrink: 0;
}

/* ── Inline annotations overlay (read-only) ────────────────── */
.workspace-image-preview__stage {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  line-height: 0;
}

.workspace-image-preview__img {
  display: block;
  max-width: 100%;
}

.workspace-image-preview__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.workspace-image-preview__overlay[data-empty] { display: none; }

.workspace-image-preview__overlay .inline-ann__line,
.workspace-image-preview__overlay .inline-ann__cap {
  fill: none;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}

.workspace-image-preview__overlay .inline-ann__label-bg {
  fill: rgba(12, 18, 16, 0.72);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.workspace-image-preview__overlay .inline-ann__label,
.workspace-image-preview__overlay .inline-ann__text {
  font-family: var(--font-body, system-ui, sans-serif);
  font-weight: 600;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.workspace-image-preview__ann-count {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(12, 18, 16, 0.82);
  color: #e7fff1;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.workspace-image-preview__ann-count::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #4be28f;
  box-shadow: 0 0 6px rgba(75, 226, 143, 0.8);
}

/* ============================================================
   Image viewer (iv-*) — consola de microscopio digital
   Dark lab theme. Tools on left rail. Contextual inspector.
   ============================================================ */
.iv-dialog {
  --iv-bg: #0b100e;
  --iv-surface: #141b18;
  --iv-surface-2: #1b2421;
  --iv-surface-3: #243030;
  --iv-border: rgba(255, 255, 255, 0.08);
  --iv-border-strong: rgba(255, 255, 255, 0.16);
  --iv-text: #e7f2eb;
  --iv-text-dim: rgba(231, 242, 235, 0.62);
  --iv-text-muted: rgba(231, 242, 235, 0.42);
  --iv-accent: #4be28f;
  --iv-accent-dim: #2fa368;
  --iv-accent-soft: rgba(75, 226, 143, 0.14);
  --iv-warn: #ffd47a;
  --iv-err: #ff9a9a;
  --iv-rail-w: 4.75rem;
  --iv-inspector-w: 19rem;
  --iv-topbar-h: 3.25rem;

  width: min(100vw - 1rem, 110rem);
  height: min(100vh - 1rem, 100%);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--iv-border);
  border-radius: 14px;
  background: var(--iv-bg);
  color: var(--iv-text);
  overflow: hidden;
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  font-family: var(--font-body, "IBM Plex Sans", system-ui, sans-serif);
}

.iv-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.iv-dialog:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border: none;
}

.iv {
  display: grid;
  grid-template-rows: var(--iv-topbar-h) 1fr;
  height: 100%;
  min-height: min(70vh, 520px);
}

/* ─────────────── Top bar ─────────────── */
.iv__topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem 0 1.15rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 70%),
    var(--iv-surface);
  border-bottom: 1px solid var(--iv-border);
  min-width: 0;
}

.iv__titleblock {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.iv__eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--iv-text-muted);
  font-weight: 600;
}

.iv__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--iv-text);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iv__topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.iv__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--iv-surface-2);
  border: 1px solid var(--iv-border);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--iv-text);
  font-weight: 500;
}

.iv__chip--muted {
  color: var(--iv-text-dim);
}

.iv__chip-icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--iv-text-dim);
}

.iv__topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.iv__btn {
  --_bg: var(--iv-surface-2);
  --_color: var(--iv-text);
  --_border: var(--iv-border);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--_bg);
  color: var(--_color);
  border: 1px solid var(--_border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.14s;
  font-family: inherit;
}

.iv__btn:hover:not(:disabled) {
  --_bg: var(--iv-surface-3);
  --_border: var(--iv-border-strong);
}

.iv__btn:active:not(:disabled) {
  transform: translateY(1px);
}

.iv__btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.iv__btn-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.iv__btn--primary {
  --_bg: linear-gradient(180deg, rgba(75, 226, 143, 0.22), rgba(75, 226, 143, 0.12));
  --_border: rgba(75, 226, 143, 0.45);
  --_color: #d6ffe7;
  position: relative;
  box-shadow: 0 0 0 0 rgba(75, 226, 143, 0);
}

.iv__btn--primary:hover:not(:disabled) {
  --_bg: linear-gradient(180deg, rgba(75, 226, 143, 0.32), rgba(75, 226, 143, 0.18));
  --_border: rgba(75, 226, 143, 0.65);
}

.iv__btn--primary.is-dirty {
  animation: iv-pulse 2.6s ease-out infinite;
  --_border: rgba(75, 226, 143, 0.75);
}

@keyframes iv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(75, 226, 143, 0.0); }
  50%      { box-shadow: 0 0 0 6px rgba(75, 226, 143, 0.08); }
}

.iv__btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(7, 12, 10, 0.5);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--iv-accent);
  border: 1px solid rgba(75, 226, 143, 0.35);
}

.iv__btn--ghost {
  --_bg: transparent;
  --_border: transparent;
  --_color: var(--iv-text-dim);
}

.iv__btn--ghost:hover:not(:disabled) {
  --_bg: var(--iv-surface-2);
  --_border: var(--iv-border);
  --_color: var(--iv-text);
}

.iv__btn--icon {
  padding: 0.45rem;
  width: 2.1rem;
  height: 2.1rem;
  justify-content: center;
}

.iv__btn--icon svg {
  width: 1rem;
  height: 1rem;
}

.iv__btn--close:hover:not(:disabled) {
  --_bg: rgba(255, 154, 154, 0.14);
  --_color: #ffd9d9;
}

/* Visibility toggle: cross-fade del par de iconos */
[data-image-viewer-toggle-visibility] .iv__eye-off { display: none; }
[data-image-viewer-toggle-visibility][aria-pressed="true"] .iv__eye-on { display: none; }
[data-image-viewer-toggle-visibility][aria-pressed="true"] .iv__eye-off { display: block; }
[data-image-viewer-toggle-visibility][aria-pressed="true"] {
  --_color: var(--iv-warn);
  --_bg: rgba(255, 212, 122, 0.1);
  --_border: rgba(255, 212, 122, 0.28);
}

/* ─────────────── Body grid ─────────────── */
.iv__body {
  display: grid;
  grid-template-columns: var(--iv-rail-w) minmax(0, 1fr) 0;
  min-height: 0;
  position: relative;
}

.iv__body:has(.iv__inspector[data-open="true"]) {
  grid-template-columns: var(--iv-rail-w) minmax(0, 1fr) var(--iv-inspector-w);
}

/* ─────────────── Tool rail ─────────────── */
.iv__rail {
  background: var(--iv-surface);
  border-right: 1px solid var(--iv-border);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.iv__rail-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.iv__rail-divider {
  height: 1px;
  margin: 0.35rem 0.4rem;
  background: var(--iv-border);
}

.iv__tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.55rem 0.25rem 0.45rem;
  background: transparent;
  color: var(--iv-text-dim);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.iv__tool:hover {
  background: var(--iv-surface-2);
  color: var(--iv-text);
}

.iv__tool.is-active {
  background: var(--iv-accent-soft);
  color: #d6ffe7;
  border-color: rgba(75, 226, 143, 0.35);
  box-shadow: inset 0 0 0 1px rgba(75, 226, 143, 0.08);
}

.iv__tool.is-active::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 0.55rem;
  bottom: 0.55rem;
  width: 2px;
  border-radius: 2px;
  background: var(--iv-accent);
  box-shadow: 0 0 8px rgba(75, 226, 143, 0.55);
}

.iv__tool-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.iv__tool-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.iv__tool-kbd {
  position: absolute;
  top: 0.28rem;
  right: 0.35rem;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.58rem;
  color: var(--iv-text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--iv-border);
}

.iv__tool--compact {
  padding: 0.55rem;
}

.iv__tool--compact svg {
  width: 1.05rem;
  height: 1.05rem;
}

.iv__tool--tight .iv__tool-text {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ─────────────── Stage ─────────────── */
.iv__stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, #1a2420 0%, #0b100e 72%),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, 0.018) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(255, 255, 255, 0.018) 23px 24px);
}

.iv__stage.is-dragging { cursor: grabbing; }
.iv__stage[data-mode="measure"] { cursor: crosshair; }
.iv__stage[data-mode="text"] { cursor: text; }

.iv__asset {
  position: relative;
  transform-origin: center center;
  will-change: transform;
}

.iv__img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.iv__overlay {
  position: absolute;
  inset: 0;
  overflow: visible;
  transition: opacity 0.18s;
}

.iv__stage[data-annotations-hidden="true"] .iv__overlay {
  opacity: 0;
  pointer-events: none;
}

/* Annotations — el color real (stroke/fill) viene inline por atributo SVG
   para que cada anotación pueda tener su propio color. El estado "selected"
   solo agrega un halo sin sobreescribir el color elegido. */
.iv__overlay .annotation-measure {
  stroke-linecap: round;
  cursor: pointer;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
  transition: filter 0.14s;
}

.iv__overlay .annotation-measure.is-selected {
  filter:
    drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.35));
}

.iv__overlay .annotation-handle {
  fill: #ffd47a;
  stroke: #1a2420;
  stroke-width: 1.4;
  cursor: grab;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.iv__overlay .annotation-handle:active { cursor: grabbing; }

.iv__overlay .annotation-label-bg {
  fill: rgba(7, 12, 10, 0.78);
  stroke: rgba(231, 242, 235, 0.18);
}

.iv__overlay .annotation-label {
  font-weight: 600;
  pointer-events: none;
  font-family: "IBM Plex Mono", "Courier New", monospace;
}

.iv__overlay .annotation-text {
  font-weight: 600;
  cursor: move;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.72);
  stroke-width: 0.9;
  stroke-linejoin: round;
  transition: filter 0.14s;
}

.iv__overlay .annotation-text.is-selected {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}

/* ─────────────── Color swatches ─────────────── */
.iv__swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
}

.iv__swatch {
  --iv-swatch: var(--iv-accent);
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 1.6rem;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--iv-swatch);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.14s, box-shadow 0.14s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.iv__swatch:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

.iv__swatch:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.2),
    0 0 0 2px var(--iv-bg),
    0 0 0 4px var(--iv-swatch);
}

.iv__swatch[aria-checked="true"],
.iv__swatch.is-active {
  border-color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    0 0 0 2px var(--iv-bg),
    0 0 0 3.5px var(--iv-swatch);
}

.iv__swatch[aria-checked="true"]::after,
.iv__swatch.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  mix-blend-mode: difference;
}

.iv__swatch:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.iv__swatch--custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    conic-gradient(
      from 0deg,
      #ff6b6b 0deg,
      #ffb259 60deg,
      #fff2b8 120deg,
      #4be28f 180deg,
      #6be1ff 240deg,
      #ff7bd5 300deg,
      #ff6b6b 360deg
    );
}

.iv__swatch--custom input[type="color"] {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: transparent;
}

.iv__swatch-custom-ring {
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  background: var(--iv-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.iv__swatch-custom-ring::before {
  content: "+";
  color: var(--iv-text-dim);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
}

.iv__swatch--custom.is-active .iv__swatch-custom-ring {
  background: transparent;
}
.iv__swatch--custom.is-active .iv__swatch-custom-ring::before {
  content: "";
}

@media (max-width: 820px) {
  .iv__swatches { grid-template-columns: repeat(4, 1fr); }
}

/* Coach (empty hint) */
.iv__coach {
  position: absolute;
  left: 50%;
  top: 1.15rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.95rem;
  background: rgba(20, 27, 24, 0.92);
  border: 1px solid var(--iv-border);
  border-radius: 999px;
  color: var(--iv-text-dim);
  font-size: 0.78rem;
  max-width: min(90%, 32rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

.iv__coach[data-visible="true"] { opacity: 1; }
.iv__coach svg { width: 0.95rem; height: 0.95rem; flex-shrink: 0; color: var(--iv-accent); }
.iv__coach p { margin: 0; }
.iv__coach strong { color: var(--iv-text); font-weight: 600; }

/* Toast */
.iv__toast {
  position: absolute;
  left: 50%;
  bottom: 3.1rem;
  transform: translateX(-50%) translateY(0.5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  background: rgba(10, 16, 13, 0.95);
  color: var(--iv-text);
  border: 1px solid var(--iv-border-strong);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 5;
}

.iv__toast[data-visible="true"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.iv__toast[data-kind="ok"]    { border-color: rgba(75, 226, 143, 0.55); }
.iv__toast[data-kind="err"]   { border-color: rgba(255, 154, 154, 0.6); color: #ffd9d9; }
.iv__toast[data-kind="info"]  { border-color: var(--iv-border-strong); }

.iv__toast::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--iv-accent);
}

.iv__toast[data-kind="err"]::before { background: var(--iv-err); }
.iv__toast[data-kind="info"]::before { background: var(--iv-text-dim); }

/* Shortcuts footer */
.iv__shortcuts {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 0.4rem 0.75rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
  color: var(--iv-text-muted);
  font-size: 0.68rem;
  pointer-events: none;
}

.iv__shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.iv__shortcuts kbd,
.iv__tool-kbd,
.iv__shortcuts + .iv__toast kbd {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.6rem;
}

.iv__shortcuts kbd {
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--iv-text-dim);
  border: 1px solid var(--iv-border);
}

/* ─────────────── Inspector ─────────────── */
.iv__inspector {
  background: var(--iv-surface);
  border-left: 1px solid var(--iv-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.28s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)), opacity 0.2s;
}

.iv__inspector[data-open="true"] {
  transform: translateX(0);
  opacity: 1;
}

.iv__inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--iv-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.iv__inspector-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.iv__inspector-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--iv-accent);
  box-shadow: 0 0 8px var(--iv-accent);
}

.iv__inspector[data-kind="text"] .iv__inspector-dot {
  background: var(--iv-warn);
  box-shadow: 0 0 8px rgba(255, 212, 122, 0.6);
}

.iv__inspector-kind {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--iv-text);
  text-transform: uppercase;
}

.iv__inspector-delete {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  color: var(--iv-text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.iv__inspector-delete:hover:not(:disabled) {
  background: rgba(255, 154, 154, 0.1);
  color: var(--iv-err);
  border-color: rgba(255, 154, 154, 0.28);
}

.iv__inspector-delete svg { width: 1rem; height: 1rem; }

.iv__inspector-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.iv__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.iv__field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--iv-text-dim);
  font-weight: 600;
}

.iv__field-hint {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--iv-text-muted);
  font-weight: 500;
}

.iv__input {
  appearance: none;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--iv-bg);
  color: var(--iv-text);
  border: 1px solid var(--iv-border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.iv__input::placeholder { color: var(--iv-text-muted); }

.iv__input:focus {
  outline: none;
  border-color: var(--iv-accent);
  box-shadow: 0 0 0 3px var(--iv-accent-soft);
}

.iv__readout {
  display: block;
  padding: 0.5rem 0.7rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed var(--iv-border-strong);
  border-radius: 8px;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--iv-accent);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.iv__range {
  appearance: none;
  width: 100%;
  height: 1.25rem;
  background: transparent;
  cursor: pointer;
}

.iv__range::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, var(--iv-accent-dim), var(--iv-accent));
  border-radius: 999px;
}

.iv__range::-moz-range-track {
  height: 3px;
  background: linear-gradient(90deg, var(--iv-accent-dim), var(--iv-accent));
  border-radius: 999px;
}

.iv__range::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: -6.5px;
  border-radius: 999px;
  background: #f0fff7;
  border: 2px solid var(--iv-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: grab;
}

.iv__range::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #f0fff7;
  border: 2px solid var(--iv-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: grab;
}

.iv__inspector-foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--iv-border);
  background: rgba(0, 0, 0, 0.18);
}

.iv__inspector-tip {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--iv-text-muted);
}

/* ─────────────── Responsive ─────────────── */
@media (max-width: 820px) {
  .iv-dialog {
    --iv-rail-w: 3.5rem;
    --iv-inspector-w: 15.5rem;
    --iv-topbar-h: 3rem;
  }
  .iv__title { font-size: 0.85rem; }
  .iv__tool-label { display: none; }
  .iv__tool-kbd { display: none; }
  .iv__shortcuts { display: none; }
  .iv__eyebrow { display: none; }
}

@media (max-width: 640px) {
  .iv-dialog {
    --iv-inspector-w: 100vw;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .iv__body:has(.iv__inspector[data-open="true"]) {
    grid-template-columns: var(--iv-rail-w) 0 100%;
  }
  .iv__body:has(.iv__inspector[data-open="true"]) .iv__stage { display: none; }
  .iv__chip--muted { display: none; }
}

.detail-panel__image-title {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-panel__status-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.detail-panel__status-row .review-status {
  margin-left: 0;
}

.detail-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--stroke);
}

.detail-panel__image-tabs {
  flex-wrap: nowrap;
}

.detail-panel__image-tabs .nav-link {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.detail-panel__image-tabs .nav-link:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.detail-panel__image-tabs .nav-link.active {
  color: var(--text);
  background: var(--accent-surface);
  border-color: rgba(52, 179, 107, 0.35);
}

.detail-panel__image-tab-panels {
  min-height: 0;
}

.detail-panel__actions--tabbed {
  flex-direction: column;
  flex-wrap: nowrap;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.detail-panel__actions--tabbed form {
  width: 100%;
  margin: 0;
}

.detail-panel__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

/* Panel simple (imagen pendiente): scroll en la vista previa, acciones siempre visibles abajo */
.detail-panel > .detail-panel__simple {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.detail-panel__simple {
  max-width: 640px;
  width: 100%;
}

.detail-panel__simple-top {
  flex-shrink: 0;
}

.detail-panel__simple-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
  margin-right: -0.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

.detail-panel__simple-scroll::-webkit-scrollbar {
  width: 5px;
}

.detail-panel__simple-scroll::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 999px;
}

.detail-panel__actions--docked {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--bg-elevated) 28%);
  box-shadow: 0 -10px 28px rgba(24, 40, 32, 0.07);
  gap: 0.55rem;
}

.detail-panel__action-form {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

.detail-panel__actions--docked > .btn--ghost-danger {
  flex: 1 1 0;
  min-width: 0;
}

.detail-panel__actions--docked .detail-panel__action-form .btn {
  width: 100%;
}

/* Clasificar: acento + pulso cuando la imagen aún no está clasificada */
.ws-btn-classify {
  background: var(--accent);
  color: var(--btn-on-accent);
  border: none;
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.ws-btn-classify:hover {
  color: var(--btn-on-accent);
  background: #3dc877;
}

.ws-btn-classify__icon {
  flex-shrink: 0;
  opacity: 0.95;
}

@keyframes ws-classify-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px var(--accent-glow),
      0 0 0 0 rgba(52, 179, 107, 0.42);
  }
  55% {
    box-shadow:
      0 0 0 1px var(--accent-glow),
      0 0 0 12px rgba(52, 179, 107, 0);
  }
}

.ws-btn-classify--pulse {
  animation: ws-classify-pulse 2.1s ease-in-out infinite;
}

.ws-btn-classify--pulse:hover {
  animation: none;
}

/* Bootstrap «success» en el workspace: alinear con acento y texto claro */
.detail-panel .btn.btn-success {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--btn-on-accent) !important;
}

.detail-panel .btn.btn-success:hover {
  background: #3dc877 !important;
  border-color: #3dc877 !important;
  color: var(--btn-on-accent) !important;
}

.results-section {
  margin-top: 1.25rem;
}

.results-section__title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.results-section__intro {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  max-width: 52rem;
}

.messages-region:empty { display: none; }
.messages { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.message { padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 0.5rem; }
.message.success { background: #dff5e8; color: #1a5c38; }
.message.error { background: #fceaea; color: #8f2f2f; }
.message.warning { background: #fdf6e9; color: #7a5218; }
.message.info { background: var(--accent-surface); color: var(--accent-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--btn-on-accent);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 0 1px var(--accent-glow);
  transition: transform var(--duration-micro) var(--ease-out-expo), box-shadow var(--duration-micro) ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
  color: var(--btn-on-accent);
}

.btn.secondary { background: var(--stroke); color: var(--text); box-shadow: none; }
.btn.secondary:hover { box-shadow: 0 2px 12px rgba(24, 40, 32, 0.1); color: var(--text); }
.btn.danger { background: var(--err); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--sm {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.btn--ghost-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--err);
  border: 1px solid rgba(217, 111, 111, 0.35);
  box-shadow: none;
}

.btn--ghost-danger:hover {
  background: rgba(217, 111, 111, 0.1);
  border-color: rgba(217, 111, 111, 0.45);
  box-shadow: none;
  transform: none;
  color: #a83838;
}

.inline-form { display: inline; }
.link-button {
  background: none;
  border: none;
  color: var(--accent-dim);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

.form-row { margin-bottom: 0.75rem; }

.form-row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  max-width: 440px;
}
@media (max-width: 520px) {
  .form-row--two {
    grid-template-columns: 1fr;
  }
}

.form-section-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 0.35rem;
}

label { display: block; margin-bottom: 0.25rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="file"], input[type="number"] {
  width: 100%; max-width: 420px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
}

/* Workspace: altura acoplada al viewport; el scroll principal de resultados va dentro de .genus-cards */
.session-workspace-root {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace-inline-messages {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.workspace-inline-messages__item {
  margin: 0 0 0.35rem;
}

.workspace-inline-messages__item:last-child {
  margin-bottom: 0;
}

@media (min-width: 721px) {
  .session-workspace-root {
    min-height: calc(100vh - 12.5rem);
    max-height: calc(100vh - 12.5rem);
  }

  .session-detail--review .session-workspace-root {
    min-height: calc(100vh - 9.5rem);
    max-height: calc(100vh - 9.5rem);
  }
}

.workspace-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

@media (max-width: 720px) {
  .session-workspace-root {
    max-height: none;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .session-detail--review .session-workspace-root {
    max-height: none;
    min-height: 0;
  }
}

/* ─── Review workspace (3 columnas: lista / imagen / modelo + decisión) ─── */
.rw-readonly-strip {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-bottom: 0.45rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #7a5218;
  background: rgba(215, 155, 69, 0.12);
  border: 1px solid rgba(215, 155, 69, 0.28);
  border-radius: 8px;
}

.rw-readonly-strip svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Bootstrap .btn queda anulado por .btn global del tema; restaurar variantes en el workspace */
.session-workspace-root .btn.btn-sm {
  font-size: 0.8125rem;
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  font-weight: 600;
  transform: none;
}

.session-workspace-root .btn.btn-sm:hover {
  transform: none;
}

.session-workspace-root .btn-outline-secondary {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--stroke) !important;
  box-shadow: none !important;
}

.session-workspace-root .btn-outline-secondary:hover {
  background: var(--hover-surface) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
  box-shadow: none !important;
}

.session-workspace-root .btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--btn-on-accent) !important;
  box-shadow: 0 0 0 1px var(--accent-glow) !important;
}

.session-workspace-root .btn-primary:hover {
  background: #3dc877 !important;
  border-color: #3dc877 !important;
  color: var(--btn-on-accent) !important;
}

.session-workspace-root .btn-outline-success {
  background: transparent !important;
  color: #1a5c38 !important;
  border: 1px solid rgba(52, 179, 107, 0.45) !important;
  box-shadow: none !important;
}

.session-workspace-root .btn-outline-success:hover {
  background: rgba(52, 179, 107, 0.1) !important;
  color: #145a32 !important;
}

.session-workspace-root .btn-outline-danger {
  background: transparent !important;
  color: var(--err) !important;
  border: 1px solid rgba(217, 111, 111, 0.4) !important;
  box-shadow: none !important;
}

.session-workspace-root .btn-outline-danger:hover {
  background: rgba(217, 111, 111, 0.08) !important;
}

.rw-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}

.rw-context-bar__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text);
}

.rw-context-bar__metrics-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.rw-context-bar__sess-settings {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  margin-left: 0.2rem;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.rw-context-bar__sess-settings:hover {
  color: var(--accent-dim);
  border-color: rgba(52, 179, 107, 0.35);
  background: rgba(52, 179, 107, 0.08);
}

.rw-metric strong {
  font-variant-numeric: tabular-nums;
}

.rw-metric--pending {
  color: #7a5218;
  font-weight: 600;
}

.rw-context-bar__cta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rw-context-bar__empty {
  white-space: nowrap;
}

.rw-layout {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr) minmax(17.5rem, 24rem);
  gap: 0.65rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.rw-layout--no-aside {
  grid-template-columns: 11rem minmax(0, 1fr);
}

.rw-rail {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.05);
}

.rw-rail__list {
  overflow-y: auto;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

/* ── Rail: carpetas + explorador (debajo de subir) ─────────────────── */

.rw-rail__folders-toolbar {
  flex-shrink: 0;
  padding: 0.35rem 0.4rem 0.45rem;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rw-rail__folder-form-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}

.rw-rail__folder-form-row {
  display: flex;
  gap: 0.25rem;
  align-items: stretch;
}

.rw-rail__folder-form-row .form-control {
  min-width: 0;
}

.rw-rail__hint-btn {
  flex-shrink: 0;
  line-height: 1;
  min-width: 1.25rem;
}

.rw-rail__hint-btn svg {
  display: block;
}

.tooltip.rw-rail-hint-tooltip .tooltip-inner {
  max-width: min(20rem, calc(100vw - 2rem));
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.45;
}

.rw-rail__explorer {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

.rw-rail__folder {
  position: relative;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: visible;
}

.rw-rail__folder > summary {
  list-style: none;
}

.rw-rail__folder > summary::-webkit-details-marker {
  display: none;
}

.rw-rail__folder-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.35rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.12s ease;
  border-radius: 7px 7px 0 0;
  overflow: hidden;
}

.rw-rail__folder:not([open]) .rw-rail__folder-head {
  border-radius: 7px;
}

.rw-rail__folder-head:hover {
  background: rgba(52, 179, 107, 0.06);
}

.rw-rail__folder-head--droppable.rw-rail__folder-head--dropping,
.rw-rail__folder-body--droppable.rw-rail__folder-body--dropping {
  background: rgba(52, 179, 107, 0.14);
  outline: 1px dashed rgba(52, 179, 107, 0.55);
  outline-offset: -1px;
}

.rw-rail__folder-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-right: 0.05rem;
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.15s ease;
}

.rw-rail__folder:not([open]) .rw-rail__folder-chevron {
  transform: rotate(45deg);
}

.rw-rail__folder-icon {
  flex-shrink: 0;
  display: flex;
  opacity: 0.75;
}

.rw-rail__folder-label {
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
}

.rw-rail__folder-count {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.08rem 0.28rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rw-rail__folder-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  flex-shrink: 0;
  margin-left: auto;
}

.rw-rail__folder-menu-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0.45;
  cursor: pointer;
  transition:
    color 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    opacity 0.12s ease;
}

.rw-rail__folder-head:hover .rw-rail__folder-menu-btn,
.rw-rail__folder-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.rw-rail__folder-menu-btn:hover,
.rw-rail__folder-menu-btn[aria-expanded="true"] {
  background: rgba(52, 179, 107, 0.1);
  color: var(--accent-dim) !important;
  border-color: rgba(52, 179, 107, 0.22);
}


.rw-rail__folder-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.42rem 0.5rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rw-rail__folder-menu-item svg {
  flex-shrink: 0;
  opacity: 0.55;
}

.rw-rail__folder-menu-item:hover {
  background: rgba(52, 179, 107, 0.07);
  color: var(--accent-dim);
}

.rw-rail__folder-menu-item:hover svg {
  opacity: 1;
}

.rw-rail__folder-loc-btn {
  flex-shrink: 0;
  line-height: 1;
  color: var(--muted);
  opacity: 0.85;
}

.rw-rail__folder-loc-btn:hover {
  opacity: 1;
  color: var(--fg);
}

.rw-rail__folder-loc-btn svg {
  display: block;
}

.rw-rail__folder-body {
  padding: 0.15rem 0.25rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 1.5rem;
  transition: background 0.12s ease;
  border-radius: 0 0 7px 7px;
  overflow: hidden;
}

.rw-rail__folder-empty {
  padding: 0.25rem 0.2rem 0.35rem;
}

.rw-rail__empty--footer {
  flex-shrink: 0;
  padding: 0.45rem 0.35rem 0.35rem;
  border-top: 1px solid var(--stroke);
}

.rw-rail__item--dragging {
  opacity: 0.45;
}

.rw-rail__row {
  display: flex;
  align-items: stretch;
  gap: 0.12rem;
}

.rw-rail__pick {
  flex-shrink: 0;
  align-self: center;
  width: 0.85rem;
  height: 0.85rem;
  margin: 0 0 0 0.1rem;
  cursor: pointer;
}

.rw-rail__item--grow {
  flex: 1 1 auto;
  min-width: 0;
}

.rw-rail__bulk-move {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem 0.35rem;
  border-radius: 8px;
  background: rgba(52, 179, 107, 0.08);
  border: 1px solid rgba(52, 179, 107, 0.28);
}

.rw-rail__bulk-move-top {
  display: flex;
  align-items: baseline;
  gap: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.rw-rail__bulk-count {
  font-variant-numeric: tabular-nums;
  color: var(--accent-dim);
}

.rw-rail__bulk-move-row {
  display: flex;
  gap: 0.3rem;
  align-items: stretch;
}

.rw-rail__bulk-move-row .form-select {
  flex: 1 1 auto;
  min-width: 0;
}

.rw-rail__bulk-clear {
  align-self: flex-start;
  text-decoration: none;
}

.rw-rail__item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}

.rw-rail__item:hover {
  background: var(--surface-2);
}

.rw-rail__item--active {
  background: var(--accent-surface);
  border-color: rgba(52, 179, 107, 0.35);
  box-shadow: 0 0 0 1px rgba(52, 179, 107, 0.12);
}

.rw-rail__item--alert {
  border-color: rgba(217, 111, 111, 0.35);
}

.rw-rail__thumb-wrap {
  flex-shrink: 0;
}

.rw-rail__thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  display: block;
  background: var(--surface-2);
}

.rw-rail__thumb--empty {
  display: block;
  width: 40px;
  height: 40px;
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-2),
    var(--surface-2) 4px,
    var(--stroke) 4px,
    var(--stroke) 5px
  );
  border-radius: 6px;
  border: 1px solid var(--stroke);
}

.rw-rail__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.rw-rail__name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.rw-rail__state {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.rw-rail__state--rev-validated {
  color: #1a5c38;
}

.rw-rail__state--rev-rejected {
  color: #a83838;
}

.rw-rail__state--rev-in_review {
  color: #7a5218;
}

.rw-rail__state--rev-reviewed {
  color: var(--accent-dim);
}

.rw-rail__state--rev-pending {
  color: var(--muted);
}

.rw-rail__empty {
  padding: 0.75rem 0.5rem;
}

/* ── Rail upload strip ─────────────────────────────── */

.rw-rail__upload {
  flex-shrink: 0;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--stroke);
}

.rw-rail__upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rw-rail__upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.38rem 0.4rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px dashed var(--stroke);
  color: var(--muted);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  user-select: none;
}

.rw-rail__upload-btn:hover {
  background: var(--accent-surface);
  border-color: rgba(52, 179, 107, 0.45);
  color: var(--accent-dim);
}

.rw-rail__upload-count {
  font-size: 0.68rem;
  text-align: center;
}

.rw-rail__upload-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0.32rem 0.4rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 7px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--btn-on-accent);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rw-rail__upload-submit:hover {
  background: #3dc877;
  border-color: #3dc877;
}

.rw-stage {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.05);
}

.rw-stage__header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.rw-stage__header-text {
  flex: 1;
  min-width: 0;
}

.rw-stage__title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
}

.rw-stage__viz {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.rw-hero-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rw-hero-preview .detail-panel__preview {
  max-height: min(45vh, 480px);
  max-width: 100%;
  width: auto;
}

.rw-hero-preview .workspace-image-preview {
  width: 100%;
}

.rw-stage__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.rw-stage__quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.rw-stage__quick-hint {
  text-align: center;
  max-width: 36rem;
}

.rw-stage__placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.rw-stage__placeholder-title {
  font-weight: 600;
  color: var(--text);
}

.rw-stage__docked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.rw-aside {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.65rem 0.75rem 0.85rem;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.05);
}

.rw-aside__section {
  flex-shrink: 0;
}

.rw-aside__section--grow {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rw-aside__heading {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Predictions wrap: rotating gradient border ─── */

@property --rw-spin {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.rw-predictions-wrap {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: 12px;
  border: 4px solid transparent;
  background:
    linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    conic-gradient(
      from var(--rw-spin),
      transparent 0%,
      transparent 60%,
      rgba(52, 179, 107, 0.0) 67%,
      rgba(52, 179, 107, 0.55) 74%,
      #5ccc8a 80%,
      rgba(92, 204, 138, 0.9) 83%,
      rgba(52, 179, 107, 0.45) 87%,
      transparent 93%,
      transparent 100%
    ) border-box;
  animation: rw-border-spin 2s linear infinite;
  padding: 0.35rem 0;
}

@keyframes rw-border-spin {
  to { --rw-spin: 360deg; }
}

/* ─── Top-1 Hero prediction ──────────────────────────── */

.rw-top1-section {
  padding-bottom: 0.5rem;
}

.rw-top1 {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  background:
    linear-gradient(135deg, rgba(52, 179, 107, 0.07) 0%, rgba(52, 179, 107, 0.02) 100%);
  border: 1px solid rgba(52, 179, 107, 0.22);
  border-radius: 10px;
  overflow: hidden;
  animation: rw-top1-in 0.5s var(--ease-out-expo) both;
}

@keyframes rw-top1-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.rw-top1__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #f4fffa;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  user-select: none;
  flex-shrink: 0;
}

.rw-top1__body {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rw-top1__genus-card .genus-rank-row.genus-card {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  animation: none;
}

.rw-top1__genus-card .genus-rank-row.genus-card:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.rw-top1__genus-card .genus-card__rank-band { display: none; }
.rw-top1__genus-card .genus-card__body { padding: 0; }
.rw-top1__genus-card .genus-card__header { margin: 0; align-items: center; }
.rw-top1__genus-card .genus-card__name {
  font-size: 1.08rem;
  font-style: italic;
  font-weight: 700;
}
.rw-top1__genus-card .genus-card__score { display: none; }

.rw-top1__conf {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rw-top1__conf-track {
  flex: 1;
  height: 5px;
  background: rgba(52, 179, 107, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.rw-top1__conf-fill {
  height: 100%;
  width: calc(var(--w, 0) * 100%);
  background: linear-gradient(90deg, var(--accent) 0%, #5ccc8a 100%);
  border-radius: 999px;
  animation: rw-bar-grow 0.7s 0.2s var(--ease-out-expo) both;
}

@keyframes rw-bar-grow {
  from { width: 0; }
  to   { width: calc(var(--w, 0) * 100%); }
}

.rw-top1__conf-val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Alternatives horizontal slider (ranks 2–N) ──── */

.rw-alts-section {
  border-top: 1px solid var(--stroke);
  padding-top: 0.5rem;
  flex-shrink: 0;
}

.rw-alts-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.rw-alts-hint {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Positioned wrapper (injected by JS) so the nav arrows align with the slider */
.rw-alts-slider-wrap {
  position: relative;
}

/* The scroll container */
.rw-alts-slider {
  display: flex;
  flex-direction: row;
  gap: 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}

.rw-alts-slider:focus-visible {
  outline: 2px solid var(--accent, #4be28f);
  outline-offset: 2px;
  border-radius: 6px;
}

.rw-alts-slider::-webkit-scrollbar { height: 4px; }
.rw-alts-slider::-webkit-scrollbar-track { background: transparent; }
.rw-alts-slider::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 999px;
}

/* Prev / next navigation arrows (injected by inline_annotations.js) */
.rw-alts-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-55%);
  z-index: 2;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface, rgba(20, 20, 24, 0.92));
  color: var(--text, inherit);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.rw-alts-nav:hover {
  background: var(--surface-hover, rgba(40, 40, 46, 0.96));
  transform: translateY(-55%) scale(1.05);
}

.rw-alts-nav:focus-visible {
  outline: 2px solid var(--accent, #4be28f);
  outline-offset: 2px;
}

.rw-alts-nav[hidden] {
  display: none !important;
}

.rw-alts-nav--prev { left: -6px; }
.rw-alts-nav--next { right: -6px; }

/* Each tile wrapper */
.rw-alt-tile {
  flex-shrink: 0;
  width: 5.25rem;
  scroll-snap-align: start;
  animation: rw-alt-in 0.3s calc(var(--i, 0) * 50ms) var(--ease-out-expo) both;
}

@keyframes rw-alt-in {
  from { opacity: 0; transform: scale(0.88) translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.rw-alt-tile .genus-rank-item { margin: 0; height: 100%; }

/* Override the genus-card to be a vertical tile */
.rw-alt-tile .genus-rank-row.genus-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 5.25rem;
  min-height: 6rem;
  height: 100%;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.2s var(--ease-out-expo),
    transform 0.2s var(--ease-out-expo);
}

.rw-alt-tile .genus-rank-row.genus-card:hover {
  background: var(--bg-elevated);
  border-color: rgba(52, 179, 107, 0.45);
  box-shadow: 0 4px 14px rgba(24, 40, 32, 0.1), 0 0 0 1px rgba(52, 179, 107, 0.12);
  transform: translateY(-2px);
}

/* Rank band → top horizontal strip */
.rw-alt-tile .genus-card__rank-band {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-width: unset;
  width: 100%;
  height: 1.75rem;
  padding: 0;
  background: var(--surface-2);
  border-right: none;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.rw-alt-tile .genus-card__rank-num {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.rw-alt-tile:hover .genus-card__rank-num { color: var(--accent-dim); }

/* Confidence-tinted rank band for high scores */
.rw-alt-tile[style*="--conf: 0.9"] .genus-card__rank-band,
.rw-alt-tile[style*="--conf: 0.8"] .genus-card__rank-band {
  background: rgba(52, 179, 107, 0.1);
  border-bottom-color: rgba(52, 179, 107, 0.2);
}
.rw-alt-tile[style*="--conf: 0.9"] .genus-card__rank-num,
.rw-alt-tile[style*="--conf: 0.8"] .genus-card__rank-num { color: var(--accent-dim); }

/* Card body → vertical, centered */
.rw-alt-tile .genus-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.4rem 0.45rem 0.4rem;
  min-width: 0;
}

.rw-alt-tile .genus-card__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  gap: 0.25rem;
}

.rw-alt-tile .genus-card__titles { min-width: 0; }

.rw-alt-tile .genus-card__name {
  font-size: 0.72rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
}

.rw-alt-tile .genus-card__id { display: none; }

.rw-alt-tile .genus-card__badges {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: nowrap;
  margin: 0;
}

.rw-alt-tile .genus-card__score {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
}

/* Thin confidence bar at very bottom */
.rw-alt-tile .genus-rank-item::after {
  content: '';
  display: block;
  height: 3px;
  width: calc(var(--conf, 0) * 100%);
  background: linear-gradient(90deg, var(--stroke), var(--accent-dim));
  border-radius: 0 0 10px 10px;
  transition: width 0.5s var(--ease-out-expo);
}

/* Toxic badge stays compact */
.rw-alt-tile .badge--toxic {
  font-size: 0.58rem;
  padding: 0.1em 0.25em;
}

/* Legacy classes – kept for backward-compat, not used in slider */
.rw-alt { display: none; }
.rw-alts-list { display: none; }
.rw-alt__bar-track { display: none; }
.rw-alt__bar-fill { display: none; }

/* Old predictions-list kept for backward-compat */
.rw-predictions-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

.rw-aside__section--decision {
  border-top: 1px solid var(--stroke);
  padding-top: 0.65rem;
}

.rw-aside__tools {
  border-top: 1px solid var(--stroke);
  padding-top: 0.65rem;
}

.rw-ai-analyze-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(77, 154, 228, 0.42);
  background:
    linear-gradient(135deg, rgba(77, 154, 228, 0.18), rgba(52, 179, 107, 0.22));
  color: var(--text);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.32rem 0.72rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow:
    0 4px 12px rgba(45, 117, 194, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.rw-ai-analyze-btn:hover,
.rw-ai-analyze-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(77, 154, 228, 0.68);
  box-shadow:
    0 6px 16px rgba(45, 117, 194, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.rw-ai-analyze-btn:focus-visible {
  outline: 2px solid rgba(77, 154, 228, 0.35);
  outline-offset: 1px;
}

.rw-ai-analyze-btn--header {
  margin-top: 0.1rem;
}

.rw-ai-analyze-btn__content {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
}

.rw-ai-analyze-btn__icon {
  width: 0.88rem;
  height: 0.88rem;
  animation: rwAiNudge 1.6s ease-in-out infinite;
}

.rw-ai-analyze-btn__glow {
  position: absolute;
  inset: -42%;
  background:
    radial-gradient(circle at 25% 30%, rgba(255, 255, 255, 0.32), transparent 45%),
    linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.18) 48%, transparent 72%);
  animation: rwAiSweep 2.6s linear infinite;
  pointer-events: none;
}

@keyframes rwAiSweep {
  from { transform: translateX(-32%); }
  to { transform: translateX(32%); }
}

@keyframes rwAiNudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

@media (prefers-reduced-motion: reduce) {
  .rw-ai-analyze-btn__icon,
  .rw-ai-analyze-btn__glow {
    animation: none !important;
  }
}

.rw-aside .btn.btn-success {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--btn-on-accent) !important;
}

.rw-aside .btn.btn-success:hover {
  background: #3dc877 !important;
  border-color: #3dc877 !important;
  color: var(--btn-on-accent) !important;
}

@media (max-width: 1199px) {
  .rw-layout,
  .rw-layout--no-aside {
    grid-template-columns: 1fr;
  }

  .rw-rail {
    max-height: 11rem;
  }

  .rw-rail__list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.4rem 0.35rem;
  }

  .rw-rail__explorer {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.35rem 0.3rem;
  }

  .rw-rail__folder {
    min-width: 10rem;
    flex: 0 0 auto;
    max-height: 100%;
    display: flex;
    flex-direction: column;
  }

  .rw-rail__folder-body {
    overflow-y: auto;
    max-height: 6.5rem;
  }

  .rw-rail__item {
    min-width: 9.5rem;
  }

  .rw-aside {
    max-height: none;
  }

  .rw-alts-slider {
    padding-bottom: 0.65rem;
  }

  .rw-alt-tile {
    width: 5.75rem;
  }

  .rw-alt-tile .genus-rank-row.genus-card {
    width: 5.75rem;
  }
}

.min-h-0 {
  min-height: 0 !important;
}

.image-list {
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 10px;
  padding: 0.35rem;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--stroke);
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.05);
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

.image-list::-webkit-scrollbar {
  width: 5px;
}

.image-list::-webkit-scrollbar-track {
  background: transparent;
}

.image-list::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 999px;
}

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--stroke);
  color: var(--muted);
}
.status-pending { background: var(--surface-2); color: var(--muted); }
.status-queued { background: var(--accent-surface); color: var(--accent-dim); }
.status-processing { background: #faf5e9; color: #8a5f18; }
.status-completed { background: #dff5e8; color: #1a5c38; }
.status-error { background: #fceaea; color: #8f2f2f; }

.review-status { margin-left: 0.35rem; }
.review-status-unclassified {
  background: rgba(120, 130, 125, 0.2);
  color: var(--muted);
}
.review-status-in_progress {
  background: rgba(215, 155, 69, 0.18);
  color: #7a5218;
}
.review-status-classified {
  background: rgba(52, 179, 107, 0.15);
  color: var(--accent-dim);
}

.review-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

.review-summary__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.review-summary__count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.review-summary__pill--unclassified {
  background: rgba(120, 130, 125, 0.2);
  color: var(--muted);
}

.review-summary__pill--in-progress {
  background: rgba(215, 155, 69, 0.18);
  color: #7a5218;
}

.review-summary__pill--classified {
  background: rgba(52, 179, 107, 0.15);
  color: var(--accent-dim);
}

.session-workspace-root > .review-summary {
  flex-shrink: 0;
}

.detail-panel {
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 10px;
  padding: 1.15rem;
  flex: 1 1 auto;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(24, 40, 32, 0.06);
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
}

/* Split: Bootstrap row; imagen + revisión/acciones a la izquierda (columna ancha), Top 10 a la derecha */
.detail-panel > .detail-panel__split.row {
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
}

.detail-panel__split {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}

@media (min-width: 992px) {
  .detail-panel__split.row > [class*="col-lg"] {
    min-height: 0;
  }
}

.detail-panel__image-col {
  position: sticky;
  top: 0.5rem;
  align-self: flex-start;
  max-height: 100%;
}

@media (min-width: 992px) {
  .detail-panel__image-col {
    max-height: min(100%, calc(100vh - 11rem));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--stroke) transparent;
  }
}

.detail-panel__results-col {
  min-height: 0;
  overflow: hidden;
  max-height: 100%;
}

.detail-panel__results-col .genus-cards {
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
  padding-right: 0.25rem;
}

.detail-panel__results-col .genus-cards::-webkit-scrollbar {
  width: 6px;
}

.detail-panel__results-col .genus-cards::-webkit-scrollbar-track {
  background: transparent;
}

.detail-panel__results-col .genus-cards::-webkit-scrollbar-thumb {
  background: var(--stroke);
  border-radius: 999px;
}

@media (max-width: 991px) {
  .detail-panel {
    overflow: visible;
    height: auto;
  }
  .detail-panel__image-col {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .detail-panel__results-col .genus-cards {
    overflow: visible !important;
    max-height: none;
  }
}

/* Nombre editable bajo la etiqueta (Bootstrap form-control-lg + tipografía marca) */
.detail-panel__title-input {
  width: 100%;
  max-width: 100% !important;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  background-color: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--stroke) !important;
}

.detail-panel__title-input:focus {
  border-color: var(--border-strong) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-glow);
}

.detail-panel .form-control,
.detail-panel .form-select {
  max-width: 100%;
}
.prediction-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
.prediction-table th, .prediction-table td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--stroke);
}

.genus-cards-intro { font-size: 0.9rem; margin: 0.25rem 0 0.75rem; max-width: 52rem; }

.genus-cards {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.real-classification-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface-2);
}

.real-classification-box__title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.review-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.review-form-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.18rem;
}

.review-form__save {
  font-size: 0.85rem;
  width: 100%;
}

.real-classification-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}

@media (max-width: 680px) {
  .real-classification-grid { grid-template-columns: 1fr; }
}

/* ─── Genus card base ─────────────────────────────────── */

.genus-card {
  position: relative;
  display: flex;
  gap: 0;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    box-shadow 0.3s var(--ease-out-expo),
    transform 0.25s var(--ease-out-expo);
  animation: card-in var(--duration-enter) calc(var(--rank-delay, 1) * 48ms) var(--ease-out-expo) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.genus-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 24px rgba(24, 40, 32, 0.1), 0 0 0 1px var(--border);
  transform: translateY(-1px);
}

/* Rank band — vertical strip on the left */
.genus-card__rank-band {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.9rem 0.5rem 0;
  min-width: 2.75rem;
  background: linear-gradient(180deg, rgba(52, 179, 107, 0.1) 0%, transparent 100%);
  border-right: 1px solid var(--stroke);
}

.genus-card__rank-num {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent-dim);
  line-height: 1;
  opacity: 0.75;
  user-select: none;
}

.genus-card--toxic .genus-card__rank-band {
  background: linear-gradient(180deg, rgba(215, 155, 69, 0.15) 0%, transparent 100%);
  border-right-color: rgba(215, 155, 69, 0.25);
}

.genus-card--toxic .genus-card__rank-num {
  color: var(--warn);
}

/* Card body */
.genus-card__body {
  flex: 1;
  padding: 0.8rem 1rem 0.9rem;
  min-width: 0;
}

/* Header row */
.genus-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.55rem;
}

.genus-card__titles { flex: 1; min-width: 140px; }

.genus-card__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.03em;
  color: var(--text);
}

.genus-card--toxic .genus-card__name {
  color: #7a5218;
}

.genus-card__id {
  font-size: 0.78rem;
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Badges */
.genus-card__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.badge--toxic {
  background: rgba(215, 155, 69, 0.18);
  color: #7a5218;
  border: 1px solid rgba(215, 155, 69, 0.35);
}

.genus-card__score {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ok);
  background: rgba(52, 179, 107, 0.12);
  border: 1px solid rgba(52, 179, 107, 0.25);
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
}

/* Confidence bar */
.genus-card__confidence {
  height: 3px;
  background: var(--stroke);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.genus-card__confidence-bar {
  height: 100%;
  width: calc(var(--score, 0) * 100%);
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 999px;
  transition: width 0.48s 0.1s var(--ease-out-expo);
}

.genus-card--toxic .genus-card__confidence-bar {
  background: linear-gradient(90deg, #b87820, var(--warn));
}

/* Fields grid */
.genus-card__fields {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.6rem 1.25rem;
}

.genus-card__field { margin: 0; }

.genus-card__field dt {
  margin: 0 0 0.18rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.genus-card__field dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.45;
}

.genus-card__empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.genus-card__meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.genus-card__real-label {
  font-size: 0.78rem;
}

.genus-card__timestamps {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.badge--review {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge--review-pending {
  background: rgba(120, 130, 125, 0.2);
  color: var(--muted);
  border-color: var(--stroke);
}

.badge--review-completed {
  background: rgba(52, 179, 107, 0.15);
  color: var(--accent-dim);
  border-color: rgba(52, 179, 107, 0.28);
}

.badge--review-error {
  background: rgba(217, 111, 111, 0.15);
  color: #a33a3a;
  border-color: rgba(217, 111, 111, 0.3);
}

.genus-card__review {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--stroke);
}

.genus-card__review-title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.genus-card__review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}

@media (max-width: 560px) {
  .genus-card__review-grid { grid-template-columns: 1fr; }
}

.genus-card__field-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.genus-card__field-group--full {
  grid-column: 1 / -1;
}

.genus-card__field-group--grow {
  min-width: 0;
}

.genus-card__select,
.genus-card__textarea {
  width: 100%;
  max-width: none;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.genus-card__textarea {
  resize: vertical;
  min-height: 2.5rem;
}

.genus-card__save-btn {
  margin-top: 0.15rem;
  font-size: 0.85rem;
}

.genus-card__form-errors {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  color: var(--err);
  font-size: 0.85rem;
}

.field-error {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--err);
}

/* ─── Library variant (no rank band, no score bar) ───── */
/* Base .genus-card es flex row (banda + body). En biblioteca no hay banda:
   los hijos directos son header + dl → forzar columna para no ponerlos en fila. */
.library-genus-card {
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 1.15rem 1.05rem;
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  animation: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s var(--ease-out-expo);
}

.library-genus-card.genus-card--toxic {
  border-left-color: var(--warn);
}

.library-genus-card:hover {
  border-color: var(--border-strong);
  border-left-color: var(--accent);
  box-shadow: 0 4px 20px rgba(24, 40, 32, 0.09);
  transform: translateY(-1px);
}

.library-genus-card.genus-card--toxic:hover {
  border-left-color: var(--warn);
}

.library-genus-card .genus-card__header {
  margin-bottom: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--stroke);
  align-items: center;
}

.library-genus-card .genus-card__name {
  font-size: 1.08rem;
  line-height: 1.25;
  word-break: break-word;
}

/* Ficha en columna: mejor lectura que rejilla apretada dentro de la tarjeta */
.library-genus-card .genus-card__fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.85rem;
  padding-top: 0;
}

.library-genus-card .genus-card__field {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--stroke);
}

.library-genus-card .genus-card__field:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.library-genus-card .genus-card__field dd {
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

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

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }

/* Biblioteca (catálogo) */
.library-catalog {
  margin-top: 0.25rem;
}

.library-lead { max-width: 42rem; margin-top: 0.35rem; }

.library-search {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--stroke);
}
.library-search__label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.library-search__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.library-search__input {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
}

.letter-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.25rem;
  margin: 0.75rem 0 0.5rem;
  padding: 0.5rem 0;
}
.letter-nav__label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 0.25rem;
}
.letter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--hover-surface);
  border: 1px solid transparent;
}
.letter-pill:hover {
  background: var(--active-surface);
  color: var(--accent);
}
.letter-pill--active {
  background: var(--accent-surface);
  border-color: var(--accent);
  color: var(--accent-dim);
}

.library-results-meta {
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}
.library-filter-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--hover-surface);
  font-size: 0.85rem;
}

.library-genus-cards {
  margin-top: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.5rem), 1fr));
  gap: 1rem;
}

/* Manual de usuario */
.manual-page {
  max-width: 44rem;
  margin-bottom: 2rem;
}
.manual-page__intro {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.55;
  margin: 0;
}
.manual-section {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--stroke);
}
.manual-section h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.manual-section p,
.manual-section li {
  line-height: 1.55;
  margin: 0.5rem 0;
  color: var(--text);
}
.manual-section ul,
.manual-section ol {
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}
.manual-section a { color: var(--accent); }
.manual-section a:hover { text-decoration: underline; }
.manual-tip {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: var(--accent-surface);
  border-left: 3px solid var(--accent);
  color: var(--accent-dim);
}
.manual-steps { padding-left: 1.25rem; }
.manual-steps li { margin: 0.65rem 0; }
.manual-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--stroke);
  font-size: 1.05rem;
}
.manual-footer p { margin: 0; }

/* Session ranking row (workspace): compact + modal */
.genus-rank-item {
  min-width: 0;
}

.genus-rank-row.genus-card {
  width: 100%;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.genus-rank-row.genus-card:hover {
  border-color: rgba(52, 179, 107, 0.45);
  box-shadow:
    0 8px 28px rgba(24, 40, 32, 0.12),
    0 0 0 1px rgba(52, 179, 107, 0.22);
  transform: translateY(-2px);
}

.genus-rank-row.genus-card:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(24, 40, 32, 0.08);
}

.genus-rank-row.genus-card--toxic:hover {
  border-color: rgba(215, 155, 69, 0.5);
  box-shadow:
    0 8px 28px rgba(90, 60, 20, 0.12),
    0 0 0 1px rgba(215, 155, 69, 0.28);
}

.genus-rank-row.genus-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.genus-rank-row.genus-card .genus-card__body {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.genus-rank-row.genus-card .genus-card__header {
  margin-bottom: 0;
  align-items: center;
}

@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes dialog-backdrop-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes dialog-panel-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dialog-panel-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
}

.genus-detail-dialog {
  padding: 1.25rem;
  border: none;
  background: transparent;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100vh;
  margin: 0;
  box-sizing: border-box;
}

.genus-detail-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialog-backdrop-in 0.2s ease both;
}

.genus-detail-dialog[open] .genus-detail-dialog__panel {
  animation: dialog-panel-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.genus-detail-dialog.is-closing {
  animation: dialog-backdrop-out 0.18s ease both;
}

.genus-detail-dialog.is-closing .genus-detail-dialog__panel {
  animation: dialog-panel-out 0.18s ease both;
}

.genus-detail-dialog::backdrop {
  background: rgba(22, 32, 28, 0.45);
  backdrop-filter: blur(3px);
  animation: dialog-backdrop-in 0.2s ease both;
}

.genus-detail-dialog.is-closing::backdrop {
  animation: dialog-backdrop-out 0.18s ease both;
}

.genus-detail-dialog__panel {
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(88vh, 42rem);
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(12, 24, 18, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.genus-detail-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem 1.15rem;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.genus-detail-dialog__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.genus-detail-dialog__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.genus-detail-dialog__close:hover {
  background: var(--stroke);
  color: var(--text);
}

.genus-detail-dialog__body {
  padding: 1rem 1.15rem 1.15rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* —— Configuración de sesión (modal con pestañas) —— */
/* El <dialog> debe ocupar el viewport para que flex de .genus-detail-dialog centre el panel. */
.genus-detail-dialog.session-settings-dialog {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100vh;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  box-sizing: border-box;
}

.session-settings-dialog__panel {
  width: min(44rem, calc(100vw - 2rem));
  max-height: min(92vh, 46rem);
}

.session-settings-dialog__tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 0;
}

.session-settings-dialog__tabs .nav-link {
  border-radius: 8px 8px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.session-settings-dialog__tabs .nav-link.active {
  color: var(--text);
  background: var(--surface-2);
}

.session-settings-dialog__body {
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.session-settings-dialog__pane {
  padding: 1rem 1.15rem 1.15rem;
  overflow: auto;
  max-height: min(62vh, 28rem);
}

.session-settings-dialog__section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.session-settings-dialog__map {
  min-height: 200px;
}

.genus-detail-modal-inner__fields {
  margin-top: 0.25rem;
}

/* —— Imagen de referencia en tarjetas de género —— */
.library-genus-card__figure {
  margin: 0 0 0.75rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-genus-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.genus-card__thumb {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.genus-card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rw-top1__genus-card .genus-card__thumb {
  width: 48px;
  height: 48px;
}

.rw-alt-tile .genus-card__thumb {
  width: 34px;
  height: 34px;
}

.genus-detail-modal-inner__figure {
  margin: 0 0 0.9rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
}

.genus-detail-modal-inner__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-delete-dialog .genus-detail-dialog__panel {
  width: min(24rem, calc(100vw - 2rem));
  max-height: none;
}

/* —— Folder settings dialog (fsd) —— */

@keyframes fsd-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fsd-panel-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fsd-section-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fsd-dialog::backdrop {
  animation: fsd-backdrop-in 0.2s ease both;
}

.fsd-dialog[open] .fsd-panel {
  animation: fsd-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.fsd-dialog[open] .fsd-header {
  animation: fsd-section-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
}

.fsd-dialog[open] .fsd-section:nth-child(1) {
  animation: fsd-section-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.fsd-dialog[open] .fsd-section:nth-child(2) {
  animation: fsd-section-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.13s both;
}

.fsd-dialog[open] .fsd-section:nth-child(3) {
  animation: fsd-section-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.17s both;
}

.fsd-dialog .genus-detail-dialog__panel,
.fsd-panel {
  width: min(28rem, calc(100vw - 1.5rem));
  max-height: min(92vh, 46rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 24px 56px rgba(8, 18, 12, 0.32);
}

.fsd-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem 0.85rem 1rem;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
  background: var(--surface-2);
}

.fsd-header__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: rgba(52, 179, 107, 0.12);
  color: var(--accent-dim);
  border: 1px solid rgba(52, 179, 107, 0.22);
}

.fsd-header__text {
  flex: 1 1 auto;
  min-width: 0;
}

.fsd-header__eyebrow {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dim);
  opacity: 0.75;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.fsd-header__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.fsd-header__badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fsd-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin-left: 0.25rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fsd-close:hover {
  background: var(--surface-2);
  border-color: var(--stroke);
  color: var(--text);
}

/* Back button (in sub-dialogs: loc, micro) */
.fsd-back-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin-right: 0.15rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fsd-back-btn:hover {
  background: rgba(52, 179, 107, 0.08);
  border-color: rgba(52, 179, 107, 0.3);
  color: var(--accent-dim);
}

.fsd-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}

.fsd-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--stroke);
}

.fsd-section:last-child {
  border-bottom: none;
}

.fsd-section__label {
  margin: 0 0 0.55rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.65;
}

/* Action rows */
.fsd-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.fsd-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-align: left;
}

.fsd-action-row:hover {
  background: rgba(52, 179, 107, 0.06);
  border-color: rgba(52, 179, 107, 0.3);
}

.fsd-action-row__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fsd-action-row__icon--loc {
  background: rgba(59, 130, 246, 0.08);
  color: #4e8ef7;
  border-color: rgba(59, 130, 246, 0.22);
}

.fsd-action-row__icon--micro {
  background: rgba(168, 85, 247, 0.08);
  color: #a78bfa;
  border-color: rgba(168, 85, 247, 0.22);
}

.fsd-action-row:hover .fsd-action-row__icon--loc {
  background: rgba(59, 130, 246, 0.14);
}

.fsd-action-row:hover .fsd-action-row__icon--micro {
  background: rgba(168, 85, 247, 0.14);
}

.fsd-action-row__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.fsd-action-row__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.fsd-action-row__desc {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

.fsd-action-row__arrow {
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.45;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.fsd-action-row:hover .fsd-action-row__arrow {
  opacity: 0.9;
  transform: translateX(2px);
}

/* Rename form */
.fsd-rename-form__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.fsd-rename-form__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.fsd-rename-form__input:focus {
  border-color: rgba(52, 179, 107, 0.5);
  box-shadow: 0 0 0 3px rgba(52, 179, 107, 0.12);
}

.fsd-rename-form__btn {
  flex-shrink: 0;
  padding: 0.42rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(52, 179, 107, 0.4);
  border-radius: 8px;
  background: rgba(52, 179, 107, 0.12);
  color: var(--accent-dim);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.fsd-rename-form__btn:hover {
  background: rgba(52, 179, 107, 0.2);
  border-color: rgba(52, 179, 107, 0.6);
}

/* Danger zone */
.fsd-section--danger {
  background: transparent;
}

.fsd-danger-details {
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  overflow: hidden;
}

.fsd-danger-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e87070;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.12s ease;
}

.fsd-danger-summary::-webkit-details-marker {
  display: none;
}

.fsd-danger-summary:hover {
  background: rgba(220, 38, 38, 0.06);
}

.fsd-danger-summary__chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: #e87070;
  opacity: 0.55;
  transition: transform 0.18s ease;
}

.fsd-danger-details[open] .fsd-danger-summary__chevron {
  transform: rotate(180deg);
}

.fsd-danger-form {
  padding: 0.75rem;
  border-top: 1px solid rgba(220, 38, 38, 0.15);
  background: rgba(220, 38, 38, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.fsd-danger-form__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.fsd-danger-form__select {
  width: 100%;
  padding: 0.38rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
}

.fsd-danger-form__select:focus {
  border-color: rgba(220, 38, 38, 0.45);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.fsd-danger-form__hint,
.fsd-danger-form__empty {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
  line-height: 1.4;
}

.fsd-danger-form__check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
  cursor: pointer;
}

.fsd-danger-form__check input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.1rem;
  width: 0.9rem;
  height: 0.9rem;
  cursor: pointer;
  accent-color: #e87070;
}

.fsd-danger-form__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(220, 38, 38, 0.12);
}

.fsd-danger-form__cancel {
  padding: 0.38rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease;
}

.fsd-danger-form__cancel:hover {
  background: var(--surface-2);
  color: var(--text);
}

.fsd-danger-form__submit {
  padding: 0.38rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: 7px;
  background: rgba(220, 38, 38, 0.1);
  color: #e87070;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fsd-danger-form__submit:hover {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.65);
}

/* —— Galería (imágenes por organización) —— */
.gallery-page__header {
  margin-bottom: 1.25rem;
}

.gallery-page__lead {
  max-width: 42rem;
}

.gallery-filters {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
}

.gallery-filters__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.gallery-filters__row + .gallery-filters__row {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--stroke);
}

.gallery-filters__row--search {
  align-items: flex-end;
}

.gallery-filters__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(100%, 9rem);
}

.gallery-filters__field--grow {
  flex: 1 1 12rem;
  min-width: min(100%, 14rem);
}

.gallery-filters__field--flex {
  flex: 1 1 16rem;
}

.gallery-filters__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--muted);
}

.gallery-filters__control,
.gallery-filters__input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg);
  color: var(--text);
  min-height: 2.35rem;
}

.gallery-filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.gallery-results-meta {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem 1.1rem;
}

.gallery-card {
  margin: 0;
}

.gallery-card__trigger {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card__trigger:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(22, 32, 28, 0.08);
}

.gallery-card__trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gallery-card__thumb-wrap {
  aspect-ratio: 4 / 3;
  background: var(--bg);
  overflow: hidden;
}

.gallery-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.gallery-card__body {
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gallery-card__title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text);
}

.gallery-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.gallery-card__chip {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--stroke);
  color: var(--muted);
}

.gallery-card__chip--pipeline {
  background: rgba(46, 125, 110, 0.12);
  color: var(--accent);
}

.gallery-card__pred,
.gallery-card__uploader {
  font-size: 0.78rem;
  line-height: 1.35;
}

.gallery-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--stroke);
}

.gallery-pagination__link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.gallery-pagination__link:hover {
  text-decoration: underline;
}

@keyframes gallery-detail-backdrop-in {
  from {
    background-color: rgba(22, 32, 28, 0);
  }
  to {
    background-color: rgba(22, 32, 28, 0.45);
  }
}

@keyframes gallery-detail-panel-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(0.65rem);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.gallery-detail-dialog::backdrop {
  background-color: rgba(22, 32, 28, 0);
  backdrop-filter: blur(3px);
  animation: gallery-detail-backdrop-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gallery-detail-dialog .genus-detail-dialog__panel {
  width: min(48rem, calc(100vw - 2rem));
  max-height: min(90vh, 56rem);
}

.gallery-detail-dialog[open] .genus-detail-dialog__panel {
  animation: gallery-detail-panel-in 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-detail-dialog::backdrop {
    animation: none;
    background-color: rgba(22, 32, 28, 0.45);
  }

  .gallery-detail-dialog[open] .genus-detail-dialog__panel {
    animation: none;
  }
}

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

.gallery-detail__figure {
  margin: 0 0 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--stroke);
}

.gallery-detail__img {
  display: block;
  width: 100%;
  max-height: min(40vh, 22rem);
  object-fit: contain;
}

.gallery-detail__actions {
  margin-bottom: 1rem;
}

.gallery-detail__dl {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.88rem;
  margin: 0 0 1rem;
}

.gallery-detail__dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.gallery-detail__dl dd {
  margin: 0;
}

.gallery-detail__error {
  color: #b42318;
  white-space: pre-wrap;
}

.gallery-detail__h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.gallery-detail__table-wrap {
  border-radius: 10px;
  border: 1px solid var(--stroke);
}

/* —— Login: tarjeta centrada, composición focal, inspiración en diatomeas —— */
.site-main.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem) 1rem;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  animation: login-appear 0.5s var(--ease-out-expo) both;
}

/* Avisos dentro de la tarjeta: no añaden un segundo bloque al flex del main (evita saltar el layout). */
.login-card__flash {
  width: 100%;
  margin-bottom: 1rem;
  animation: login-appear 0.4s var(--ease-out-expo) both;
}

.login-card__messages {
  margin: 0;
}

.login-card__messages .message {
  margin-bottom: 0;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
}

@keyframes login-appear {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

/* ───────── Login brand: composición orbital animada alrededor del símbolo Cerasyn ───────── */
.login-brand {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 1.25rem;
  color: var(--accent);
  animation: login-appear 0.55s var(--ease-out-expo) both;
  isolation: isolate;
}

/* Halo suave de fondo (aura verde) */
.login-brand__halo {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%,
      rgba(82, 212, 136, 0.32) 0%,
      rgba(52, 179, 107, 0.14) 38%,
      rgba(52, 179, 107, 0) 68%);
  filter: blur(4px);
  animation: login-halo-pulse 4.8s ease-in-out infinite;
  z-index: 0;
}

/* Anillos concéntricos */
.login-brand__rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform-box: fill-box;
}

.login-brand__ring {
  transform-origin: 80px 80px;
}

.login-brand__ring--outer {
  animation: login-ring-spin 28s linear infinite;
}

.login-brand__ring--inner {
  animation: login-ring-spin-reverse 18s linear infinite;
}

.login-brand__ring--mid {
  animation: login-ring-breath 6s ease-in-out infinite;
}

/* Satélites: 3 puntos orbitando con radios y fases distintos */
.login-brand__satellite {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(52, 179, 107, 0.55);
  z-index: 2;
}

.login-brand__satellite--a {
  animation: login-orbit-a 7.2s linear infinite;
}

.login-brand__satellite--b {
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  background: #d4a843;
  box-shadow: 0 0 10px rgba(212, 168, 67, 0.55);
  animation: login-orbit-b 11s linear infinite reverse;
}

.login-brand__satellite--c {
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  opacity: 0.75;
  animation: login-orbit-c 5.4s linear infinite;
}

/* Símbolo principal: SVG negro teñido al color accent con mask para poder animar color/sombra */
.login-brand__symbol {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  background-color: var(--accent-dim);
  -webkit-mask: url("cerasyn_logo_black.b2754e795074.svg") center/contain no-repeat;
          mask: url("cerasyn_logo_black.b2754e795074.svg") center/contain no-repeat;
  z-index: 3;
  filter: drop-shadow(0 4px 14px rgba(24, 40, 32, 0.14));
  animation:
    login-symbol-pop 0.9s var(--ease-out-expo) 0.15s both,
    login-symbol-float 7s ease-in-out 1.1s infinite;
}

@keyframes login-symbol-pop {
  0%   { opacity: 0; transform: scale(0.55) rotate(-12deg); filter: drop-shadow(0 0 0 rgba(52,179,107,0)); }
  60%  { opacity: 1; transform: scale(1.06) rotate(3deg);   filter: drop-shadow(0 0 18px rgba(82,212,136,0.45)); }
  100% { opacity: 1; transform: scale(1)    rotate(0);      filter: drop-shadow(0 4px 14px rgba(24,40,32,0.14)); }
}

@keyframes login-symbol-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-3px) rotate(-2deg); }
}

@keyframes login-halo-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

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

@keyframes login-ring-spin-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes login-ring-breath {
  0%, 100% { opacity: 0.22; transform: scale(1); }
  50%      { opacity: 0.4;  transform: scale(1.02); }
}

/* Órbitas: rotar un contenedor virtual con translate en el pseudo-frame.
   Como los satélites parten del centro, usamos un wrapper en ::before mediante trucos:
   aquí optamos por animar translate() directamente con keyframes radiales. */
@keyframes login-orbit-a {
  0%   { transform: rotate(0deg)   translate(64px) rotate(0deg); }
  100% { transform: rotate(360deg) translate(64px) rotate(-360deg); }
}

@keyframes login-orbit-b {
  0%   { transform: rotate(0deg)   translate(48px) rotate(0deg); }
  100% { transform: rotate(360deg) translate(48px) rotate(-360deg); }
}

@keyframes login-orbit-c {
  0%   { transform: rotate(0deg)   translate(36px) rotate(0deg); }
  100% { transform: rotate(360deg) translate(36px) rotate(-360deg); }
}

.login-card__header {
  text-align: center;
  margin-bottom: 1.75rem;
  animation: login-appear 0.48s var(--ease-out-expo) 0.08s both;
}

.login-card__eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.login-card__title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 600;
  font-variation-settings: "opsz" 72;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
}

.login-card__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-dim);
}

.login-form {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 16px 48px rgba(24, 40, 32, 0.07),
    0 2px 8px rgba(52, 179, 107, 0.06);
  animation: login-appear 0.5s var(--ease-out-expo) 0.12s both;
}

.login-form__alert {
  margin-bottom: 1.1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fceaea;
  border: 1px solid rgba(217, 111, 111, 0.3);
  color: #8f2f2f;
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-field {
  margin-bottom: 1.1rem;
}

.login-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.login-field__error {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--err);
  font-weight: 500;
}

.login-submit {
  width: 100%;
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 12px;
  margin-top: 0.35rem;
  justify-content: center;
  box-shadow:
    0 0 0 1px var(--accent-glow),
    0 4px 18px rgba(52, 179, 107, 0.2);
  transition:
    transform var(--duration-micro) var(--ease-out-expo),
    box-shadow var(--duration-micro) ease;
}

.login-submit:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--accent-glow),
    0 8px 28px rgba(52, 179, 107, 0.3);
}

.login-card__footer {
  margin-top: 1.1rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  animation: login-appear 0.52s var(--ease-out-expo) 0.18s both;
}

.login-card__footer p {
  margin: 0;
}

.login-card__footer a {
  font-weight: 600;
  color: var(--accent-dim);
}

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

/* —— Registro: flujo humano y legible (Fraunces solo en esta página vía signup-page) —— */
.site-main.signup-page {
  max-width: 36rem;
  padding-top: clamp(1rem, 3vw, 2rem);
  padding-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.signup-shell__intro {
  margin-bottom: 1.75rem;
  animation: signup-rise var(--duration-enter) var(--ease-out-expo) both;
}

.signup-shell__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.signup-shell__title {
  margin: 0 0 0.65rem;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 4.5vw, 2.25rem);
  font-weight: 600;
  font-variation-settings: "opsz" 72;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

.signup-shell__lede {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--muted);
}

.signup-form {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 12px 40px rgba(24, 40, 32, 0.06);
  animation: signup-rise var(--duration-enter) var(--ease-out-expo) 0.06s both;
}

.signup-form__messages {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.signup-section {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--stroke);
}

.signup-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.signup-section--soft {
  background: var(--surface-2);
  margin: 0 -0.25rem;
  padding: 1.25rem 1rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.signup-section__title {
  margin: 0 0 0.4rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  font-variation-settings: "opsz" 60;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.signup-section__required {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: var(--accent-surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  font-variation-settings: normal;
}

.signup-section__hint {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

.signup-field {
  margin-bottom: 1rem;
}

.signup-field:last-child {
  margin-bottom: 0;
}

.signup-field--nested {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--stroke);
}

.signup-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.signup-label--small {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
}

.signup-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  transition:
    border-color var(--duration-micro) ease,
    box-shadow var(--duration-micro) ease;
}

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

.signup-field__help {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.45;
}

.signup-field__help ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.signup-field__error {
  margin: 0.45rem 0 0;
  font-size: 0.875rem;
  color: var(--err);
  font-weight: 500;
}

.signup-fieldset {
  margin: 0 0 1.35rem;
  padding: 0;
  border: none;
}

.signup-fieldset:last-child {
  margin-bottom: 0;
}

.signup-legend {
  display: block;
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text);
  float: none;
}

.signup-radio-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.signup-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  cursor: pointer;
  transition:
    background var(--duration-micro) ease,
    border-color var(--duration-micro) ease,
    box-shadow var(--duration-micro) ease;
}

.signup-choice:hover {
  background: var(--hover-surface);
  border-color: var(--border-strong);
}

.signup-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.signup-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-surface);
  box-shadow: 0 0 0 1px rgba(52, 179, 107, 0.2);
}

.signup-choice input.signup-radio,
.signup-choice input[type="radio"] {
  margin: 0.2rem 0 0;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  accent-color: var(--accent-dim);
  cursor: pointer;
}

.signup-choice__text {
  flex: 1;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--text);
}

.signup-captcha img {
  display: block;
  margin: 0.25rem 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: #f5f7fa;
  max-width: 100%;
  height: auto;
}

.signup-captcha .captcha-refresh,
.signup-captcha a[href="#refresh"] {
  display: inline-block;
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted, #5f6b7a);
  text-decoration: underline;
}

.signup-consent-card {
  position: relative;
  padding: 1.1rem 1.15rem 1.1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--stroke) 78%, white 22%);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.94)),
    radial-gradient(circle at top left, rgba(52, 179, 107, 0.14), transparent 55%);
  box-shadow: 0 12px 28px rgba(18, 31, 24, 0.06);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.signup-consent-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  opacity: 0.55;
  transition: opacity 0.2s ease, width 0.2s ease;
}

.signup-consent-card:has(.signup-checkbox:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow:
    0 12px 30px rgba(18, 31, 24, 0.08),
    0 0 0 4px var(--accent-glow);
}

.signup-consent-card:has(.signup-checkbox:checked)::before {
  opacity: 1;
  width: 5px;
}

.signup-consent-card:has(.signup-field__error) {
  border-color: color-mix(in srgb, #c0392b 45%, var(--stroke));
  box-shadow:
    0 12px 28px rgba(192, 57, 43, 0.12),
    0 0 0 3px rgba(192, 57, 43, 0.12);
  animation: signupConsentShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.signup-consent-card:has(.signup-field__error)::before {
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  opacity: 1;
}

@keyframes signupConsentShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.signup-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.signup-checkbox {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  margin: 0.1rem 0 0;
  width: 1.45rem;
  height: 1.45rem;
  border: 1.5px solid color-mix(in srgb, var(--stroke) 70%, var(--accent-dim) 30%);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f8f5 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(18, 31, 24, 0.06);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.12s ease;
}

.signup-checkbox:hover:not(:checked) {
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(52, 179, 107, 0.18);
}

.signup-checkbox:active {
  transform: scale(0.94);
}

.signup-checkbox:checked {
  border-color: var(--accent-dim);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 10px rgba(52, 179, 107, 0.35);
}

.signup-checkbox::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 10.5 8 14.5 16 6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 78%;
  opacity: 0;
  transform: scale(0.55) rotate(-8deg);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.signup-checkbox:checked::after {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.signup-checkbox:focus-visible {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px var(--accent-glow);
}

.signup-consent__text {
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--text);
}

.signup-consent__text a {
  color: var(--accent-dim);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.signup-consent__text a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.signup-consent-card .signup-field__error {
  margin: 0.75rem 0 0;
  padding-left: 2.35rem;
  color: #c0392b;
  font-size: 0.9rem;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .signup-consent-card,
  .signup-consent-card::before,
  .signup-checkbox,
  .signup-checkbox::after {
    transition: none;
    animation: none;
  }
}

.signup-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--stroke);
}

.signup-submit {
  width: 100%;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 12px;
}

.workspace-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.workspace-create-actions .signup-submit {
  width: auto;
  flex: 1 1 8rem;
}

.workspace-create-actions__secondary {
  flex: 0 0 auto;
  text-decoration: none;
  text-align: center;
  padding: 0.65rem 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1.5px solid var(--stroke);
  color: var(--muted);
  background: var(--surface-2);
}

.workspace-create-actions__secondary:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.signup-footnote {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.95rem;
}

.signup-footnote a {
  font-weight: 500;
}

@keyframes signup-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estilos del listado /sessions/ + dashboard: static/core/session-dashboard.css (carga session_list.html). */

/* --- Espacio de trabajo (gestión org / equipos / miembros) --- */
.workspace-hub-main.site-main {
  max-width: 1200px;
}

.workspace-hub {
  --ws-ink: #0f1a14;
  --ws-paper: rgba(255, 255, 253, 0.94);
  --ws-ink-muted: #3d5248;
  --ws-accent: #1a6b4a;
  --ws-accent-hot: #0d8f5c;
  --ws-signal: #c45c2a;
  --ws-display: "Fraunces", "Georgia", serif;
  --ws-serif: "Newsreader", "Georgia", serif;
  position: relative;
  padding-bottom: 3rem;
}

.workspace-hero {
  position: relative;
  margin: 0 0 2.25rem;
  padding: 2rem 1.75rem 2.25rem;
  border-radius: 4px 32px 20px 4px;
  background: var(--ws-paper);
  border: 1px solid rgba(26, 107, 74, 0.2);
  box-shadow:
    0 18px 40px -24px rgba(15, 26, 20, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
  animation: workspace-hero-in 0.75s var(--ease-out-expo) both;
}

.workspace-hero__slant {
  position: absolute;
  top: -40%;
  right: -15%;
  width: 58%;
  height: 180%;
  background: linear-gradient(
    145deg,
    rgba(26, 107, 74, 0.12) 0%,
    rgba(196, 92, 42, 0.06) 45%,
    transparent 70%
  );
  transform: rotate(-12deg);
  pointer-events: none;
}

.workspace-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 38rem;
}

.workspace-hero__eyebrow {
  font-family: var(--ws-serif);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ws-signal);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.workspace-hero__title {
  font-family: var(--ws-display);
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 700;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  line-height: 1.12;
  color: var(--ws-ink);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.workspace-hero__subtitle {
  font-family: var(--ws-serif);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ws-ink-muted);
  margin: 0;
}

.workspace-hero__org-name {
  font-weight: 500;
  color: var(--ws-accent);
}

.workspace-hub__grid {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 992px) {
  .workspace-hub__grid {
    grid-template-columns: 1fr minmax(320px, 1fr);
  }

  .workspace-hub__col--secondary {
    position: sticky;
    top: 1rem;
  }
}

.workspace-panel {
  background: var(--ws-paper);
  border: 1px solid rgba(26, 107, 74, 0.14);
  border-radius: 6px 22px 6px 18px;
  padding: 1.35rem 1.4rem 1.5rem;
  margin-bottom: 1.35rem;
  box-shadow: 0 12px 32px -22px rgba(15, 26, 20, 0.4);
  animation: workspace-panel-in 0.65s var(--ease-out-expo) both;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.workspace-panel:hover {
  border-color: rgba(26, 107, 74, 0.22);
  box-shadow: 0 18px 44px -20px rgba(15, 26, 20, 0.35);
}

.workspace-panel--org {
  animation-delay: 0.06s;
}

.workspace-panel--teams {
  animation-delay: 0.12s;
}

.workspace-panel--members {
  animation-delay: 0.1s;
}

.workspace-panel--orgs {
  animation-delay: 0.09s;
}

.workspace-org-switch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.workspace-org-switch-list__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(26, 107, 74, 0.06);
  border: 1px solid rgba(26, 107, 74, 0.1);
}

.workspace-org-switch-list__name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ws-ink);
  min-width: 0;
  word-break: break-word;
}

.workspace-org-switch-list__badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ws-accent);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(26, 107, 74, 0.12);
}

.workspace-org-switch-list__form {
  margin: 0;
}

.workspace-org-switch-list__btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

.workspace-org-switch-list__footer {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(26, 107, 74, 0.12);
}

.workspace-org-switch-list__create-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--ws-serif);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ws-accent);
  text-decoration: none;
}

.workspace-org-switch-list__create-link:hover {
  text-decoration: underline;
}

.workspace-panel__head {
  margin-bottom: 1rem;
}

.workspace-panel__title {
  font-family: var(--ws-display);
  font-variation-settings: "SOFT" 30, "WONK" 0.5;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ws-ink);
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.workspace-panel__lede {
  font-family: var(--ws-serif);
  font-size: 0.98rem;
  color: var(--ws-ink-muted);
  margin: 0;
  line-height: 1.45;
}

.workspace-flash {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  margin: 0 0 1rem;
  animation: ws-flash-in 0.35s var(--ease-out-expo) both;
}

.workspace-flash--success {
  background: rgba(52, 179, 107, 0.12);
  color: var(--accent-dim);
  border: 1px solid rgba(52, 179, 107, 0.25);
}

.workspace-flash--error {
  background: rgba(217, 111, 111, 0.1);
  color: #9a3a3a;
  border: 1px solid rgba(217, 111, 111, 0.28);
}

.workspace-form--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.workspace-form__field--grow {
  flex: 1 1 14rem;
}

.workspace-form__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.workspace-form__actions--baseline {
  align-items: flex-end;
}

.workspace-form--stack .workspace-form__field {
  margin-bottom: 0.75rem;
}

.workspace-subhead {
  font-family: var(--ws-serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--ws-ink);
}

.workspace-divider-b {
  border-bottom: 1px dashed rgba(26, 107, 74, 0.2);
}

.workspace-empty-hint {
  font-family: var(--ws-serif);
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  font-style: italic;
}

.workspace-btn {
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  transition:
    transform 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo),
    background 0.18s ease;
}

.workspace-btn--primary {
  background: var(--ws-accent);
  color: #fff;
  border-color: rgba(15, 26, 20, 0.12);
}

.workspace-btn--primary:hover {
  background: var(--ws-accent-hot);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(26, 107, 74, 0.55);
  color: #fff;
}

.workspace-btn--accent {
  background: linear-gradient(135deg, var(--ws-accent) 0%, #15805a 100%);
  color: #fff;
}

.workspace-btn--accent:hover {
  color: #fff;
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.workspace-btn--quiet {
  background: transparent;
  border-color: rgba(26, 107, 74, 0.25);
  color: var(--ws-accent);
}

.workspace-btn--quiet:hover {
  background: rgba(26, 107, 74, 0.06);
  color: var(--ws-accent-hot);
}

.workspace-btn--ghost-danger {
  background: transparent;
  border-color: rgba(217, 111, 111, 0.35);
  color: #b04444;
}

.workspace-btn--ghost-danger:hover {
  background: rgba(217, 111, 111, 0.08);
  color: #8e2020;
}

.workspace-input {
  border-radius: 10px;
  border-color: rgba(26, 107, 74, 0.2);
}

.workspace-input:focus {
  border-color: var(--ws-accent);
  box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.15);
}

.workspace-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.workspace-team-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(26, 107, 74, 0.1);
}

.workspace-team-list__item:last-child {
  border-bottom: none;
}

.workspace-team-list__name {
  font-family: var(--ws-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ws-ink);
  display: block;
}

.workspace-team-list__desc {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.workspace-team-list__item--block {
  flex-direction: column;
  align-items: stretch;
}

.workspace-team-list__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.workspace-team-members {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  width: 100%;
}

.workspace-team-members__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-top: 1px solid rgba(26, 107, 74, 0.08);
  font-size: 0.88rem;
}

.workspace-team-members__email {
  word-break: break-all;
  color: var(--ws-ink-muted);
}

.workspace-team-members__empty {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.workspace-form--add-team-member {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(26, 107, 74, 0.15);
}

.workspace-form__field--inline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.workspace-member-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(26, 107, 74, 0.12);
}

.workspace-member-table {
  font-size: 0.92rem;
  --bs-table-bg: transparent;
}

.workspace-member-table thead th {
  font-family: var(--ws-serif);
  font-weight: 600;
  color: var(--ws-ink-muted);
  border-bottom-color: rgba(26, 107, 74, 0.15);
}

.workspace-member-email {
  font-weight: 500;
  word-break: break-all;
}

.workspace-membership-form__grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 20rem;
}

.workspace-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.workspace-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(26, 107, 74, 0.06);
  border: 1px solid rgba(26, 107, 74, 0.12);
  font-size: 0.8rem;
  cursor: pointer;
  margin: 0;
}

.workspace-cap-pill input {
  margin: 0;
}

.workspace-hub__footnote {
  font-family: var(--ws-serif);
  margin: 2rem 0 0;
}

.workspace-hub__footnote a {
  color: var(--ws-accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.workspace-spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--stroke);
  border-top-color: var(--ws-accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  vertical-align: middle;
}

.workspace-spinner--sm {
  width: 1rem;
  height: 1rem;
}

.htmx-request.workspace-spinner {
  opacity: 1;
  animation: workspace-spin 0.55s linear infinite;
}

.workspace-spinner--active {
  opacity: 1;
  animation: workspace-spin 0.55s linear infinite;
}

.rw-classify-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--ws-accent, #34b36b) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ws-accent, #34b36b) 35%, var(--stroke, #dee2e6));
  color: var(--text, inherit);
  font-size: 0.875rem;
  font-weight: 500;
}

.rw-classify-loading__text {
  line-height: 1.2;
}

.rw-classify-form--pending button[type="submit"] {
  pointer-events: none;
  position: relative;
}

.rw-classify-form--pending button[type="submit"] .rw-classify-submit-label {
  visibility: hidden;
}

.rw-classify-form--pending button[type="submit"] .rw-classify-submit-spinner {
  display: inline-block !important;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  opacity: 1;
  animation: workspace-spin 0.55s linear infinite;
}

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

@keyframes workspace-hero-in {
  from {
    opacity: 0;
    transform: translateY(12px) skewY(-0.5deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) skewY(0);
  }
}

@keyframes workspace-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Workspace: hero cells (decorative) ──────────────── */

.workspace-hero__cells {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.workspace-hero__cell {
  position: absolute;
  border-radius: 50%;
}

.workspace-hero__cell--1 {
  width: 110px;
  height: 110px;
  right: 6%;
  top: -12%;
  background: radial-gradient(circle at 40% 38%, rgba(26, 107, 74, 0.22), transparent 68%);
  border: 1px solid rgba(26, 107, 74, 0.08);
  animation: ws-cell-float 20s ease-in-out infinite;
}

.workspace-hero__cell--2 {
  width: 70px;
  height: 70px;
  right: 20%;
  bottom: 8%;
  background: radial-gradient(circle at 35% 35%, rgba(196, 92, 42, 0.14), transparent 62%);
  border: 1px solid rgba(196, 92, 42, 0.06);
  animation: ws-cell-float 24s -6s ease-in-out infinite reverse;
}

.workspace-hero__cell--3 {
  width: 44px;
  height: 44px;
  right: 38%;
  top: 25%;
  background: radial-gradient(circle at 45% 35%, rgba(26, 107, 74, 0.16), transparent 58%);
  border: 1px solid rgba(26, 107, 74, 0.05);
  animation: ws-cell-float 16s -10s ease-in-out infinite;
}

@keyframes ws-cell-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(8px, -10px) scale(1.06); }
  66% { transform: translate(-5px, 6px) scale(0.96); }
}

/* ─── Workspace: panel icon ───────────────────────────── */

.workspace-panel__icon {
  flex-shrink: 0;
  color: var(--ws-accent);
  opacity: 0.65;
}

/* ─── Workspace: team dot decorator ───────────────────── */

.workspace-team-list__name::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ws-accent), var(--ws-accent-hot));
  margin-right: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(26, 107, 74, 0.3);
}

/* ─── Workspace: add member form ──────────────────────── */

.workspace-form--add-member {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding-bottom: 1.15rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px dashed rgba(26, 107, 74, 0.15);
}

/* ─── Workspace: create team form ─────────────────────── */

.workspace-form--create-team {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed rgba(26, 107, 74, 0.15);
}

.workspace-form--create-team .workspace-form__field {
  margin-bottom: 0.75rem;
}

/* ─── Workspace: member cards ─────────────────────────── */

.workspace-member-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.workspace-member-card {
  position: relative;
  padding: 0.95rem 1.1rem;
  padding-right: 5.5rem;
  border-radius: 12px;
  border: 1px solid rgba(26, 107, 74, 0.1);
  background: rgba(255, 255, 253, 0.55);
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s var(--ease-out-expo),
    background 0.2s ease;
}

.workspace-member-card:hover {
  border-color: rgba(26, 107, 74, 0.22);
  background: rgba(255, 255, 253, 0.8);
  box-shadow: 0 6px 20px -10px rgba(15, 26, 20, 0.18);
}

.workspace-member-card__identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.workspace-member-card__avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ws-accent) 0%, #15805a 100%);
  color: #fff;
  font-family: var(--ws-display);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(26, 107, 74, 0.25);
}

.workspace-member-card__text {
  min-width: 0;
}

.workspace-member-card__email {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ws-ink);
  word-break: break-all;
  line-height: 1.3;
}

.workspace-member-card__name {
  display: block;
  font-family: var(--ws-serif);
  font-size: 0.82rem;
  color: var(--ws-ink-muted);
  margin-top: 0.1rem;
}

.workspace-member-card__role-form {
  margin: 0;
}

.workspace-member-card__role-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.workspace-member-card__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.workspace-member-card__remove {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.workspace-role-full-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(26, 107, 74, 0.1);
  color: var(--ws-accent);
  border: 1px solid rgba(26, 107, 74, 0.15);
}

@media (max-width: 480px) {
  .workspace-member-card {
    padding-right: 1.1rem;
  }
  .workspace-member-card__remove {
    position: static;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed rgba(26, 107, 74, 0.1);
  }
}

/* ─── Workspace: empty state ──────────────────────────── */

.workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(26, 107, 74, 0.15);
  background: rgba(26, 107, 74, 0.02);
}

.workspace-empty__icon {
  color: var(--ws-accent);
  opacity: 0.4;
  margin-bottom: 0.65rem;
}

.workspace-empty__text {
  margin: 0;
  font-family: var(--ws-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ws-ink);
}

.workspace-empty__hint {
  margin: 0.25rem 0 0;
  font-family: var(--ws-serif);
  font-size: 0.9rem;
  color: var(--ws-ink-muted);
}

/* ─── Workspace: flash icon + animation ───────────────── */

.workspace-flash__icon {
  flex-shrink: 0;
}

@keyframes ws-flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Workspace: hero stamp (diatom rings) ────────────── */

.workspace-hero__stamp {
  position: absolute;
  right: -1rem;
  bottom: -1.5rem;
  width: 9rem;
  height: 9rem;
  color: var(--ws-accent);
  opacity: 0.28;
  pointer-events: none;
  animation: ws-stamp-spin 80s linear infinite;
}

@keyframes ws-stamp-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── Workspace: org identity block ──────────────────── */

.workspace-org-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
  border-radius: 12px;
  background: rgba(26, 107, 74, 0.04);
  border: 1px solid rgba(26, 107, 74, 0.1);
}

.workspace-org-identity__monogram {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ws-accent) 0%, #15805a 100%);
  color: #fff;
  font-family: var(--ws-display);
  font-size: 1.3rem;
  font-weight: 700;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(26, 107, 74, 0.25);
}

.workspace-org-identity__info {
  min-width: 0;
}

.workspace-org-identity__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ws-ink-muted);
  opacity: 0.65;
  margin-bottom: 0.15rem;
}

.workspace-org-identity__current {
  display: block;
  font-family: var(--ws-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ws-ink);
  font-variation-settings: "SOFT" 30, "WONK" 0.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Workspace: team cards ───────────────────────────── */

.workspace-team-card {
  position: relative;
  padding: 0.95rem 1rem 0.95rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(26, 107, 74, 0.12);
  background: rgba(255, 255, 253, 0.5);
  margin-bottom: 0.7rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s var(--ease-out-expo);
  list-style: none;
}

.workspace-team-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16%;
  bottom: 16%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--ws-accent), var(--ws-accent-hot));
  opacity: 0.55;
}

.workspace-team-card:hover {
  border-color: rgba(26, 107, 74, 0.22);
  box-shadow: 0 6px 20px -10px rgba(15, 26, 20, 0.14);
}

.workspace-team-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.workspace-team-card__edit {
  flex: 1;
  min-width: 0;
  max-width: min(100%, 32rem);
}

.workspace-form--edit-team .workspace-form__field--compact {
  margin-bottom: 0.4rem;
}

.workspace-form--edit-team .workspace-form__actions--tight {
  margin-top: 0.15rem;
  margin-bottom: 0;
  gap: 0.4rem;
}

.workspace-team-card__meta {
  min-width: 0;
}

.workspace-team-card__name {
  font-family: var(--ws-serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ws-ink);
  display: block;
  line-height: 1.35;
}

.workspace-team-card__desc {
  display: block;
  font-size: 0.84rem;
  color: var(--ws-ink-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}

.workspace-team-card__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.workspace-team-card__count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(26, 107, 74, 0.07);
  color: var(--ws-accent);
  border: 1px solid rgba(26, 107, 74, 0.12);
}

.workspace-team-card__remove {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.workspace-team-card__members {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(26, 107, 74, 0.1);
}

.workspace-team-card__add-form {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(26, 107, 74, 0.1);
}

/* ─── Workspace: member card divider ─────────────────── */

.workspace-member-card__divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(26, 107, 74, 0.12) 0%,
    rgba(26, 107, 74, 0.03) 100%
  );
  margin: 0.65rem 0;
}

/* ─── Workspace: remove button icon variant ──────────── */

.workspace-member-card__remove .workspace-btn--ghost-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 8px;
}

/* ─── Workspace: flash layout + dismiss ──────────────── */

.workspace-flash__text {
  flex: 1;
}

.workspace-flash__dismiss {
  background: none;
  border: none;
  padding: 0.15rem;
  cursor: pointer;
  color: currentColor;
  opacity: 0.45;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: opacity 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.workspace-flash__dismiss:hover {
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.07);
}

/* ─── Workspace: subhead with icon ───────────────────── */

.workspace-subhead {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

@media (prefers-reduced-motion: reduce) {
  .site-main,
  .session-card,
  .genus-card,
  .signup-shell__intro,
  .signup-form,
  .login-card,
  .login-brand,
  .login-card__header,
  .login-form,
  .login-card__footer {
    animation: none;
  }

  .login-brand__halo,
  .login-brand__ring,
  .login-brand__ring--outer,
  .login-brand__ring--mid,
  .login-brand__ring--inner,
  .login-brand__satellite,
  .login-brand__satellite--a,
  .login-brand__satellite--b,
  .login-brand__satellite--c,
  .login-brand__symbol {
    animation: none;
  }

  .logo,
  .btn,
  .btn--ghost-danger,
  .session-card__link,
  .genus-card,
  .site-nav a,
  .site-nav .link-button,
  .site-nav__link,
  .site-header__burger-line,
  .image-list__item {
    transition-duration: 0.01ms;
  }

  .site-nav__link--active::after {
    animation: none;
  }

  .site-nav {
    transition: none;
  }

  .genus-card__confidence-bar {
    transition-duration: 0.01ms;
  }

  .genus-rank-row.genus-card:hover,
  .genus-rank-row.genus-card:active {
    transform: none;
  }

  .workspace-hero,
  .workspace-panel,
  .workspace-flash {
    animation: none;
  }

  .workspace-hero__cell,
  .workspace-hero__stamp {
    animation: none;
  }

  .workspace-panel:hover {
    box-shadow: 0 12px 32px -22px rgba(15, 26, 20, 0.4);
  }

  .htmx-request.workspace-spinner {
    animation: none;
    opacity: 0.7;
  }
}

/* —— Páginas de error (404 / 403) —— */
.site-main.error-page {
  max-width: 40rem;
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: clamp(2rem, 6vw, 4rem);
  position: relative;
  z-index: 1;
}

.error-shell {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 12px 40px rgba(24, 40, 32, 0.06);
}

.error-shell__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.error-shell__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.error-shell__lede {
  margin: 0 0 1.5rem;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--muted);
}

.error-shell__path {
  margin: 0 0 1.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2, rgba(60, 84, 68, 0.04));
  border: 1px dashed var(--stroke);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.error-shell__path-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.error-shell__path-value {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
}

.error-shell__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* ─────────────────────────────────────────────────────────────
   Autocompletado de etiqueta validada (combobox cliente)
   ───────────────────────────────────────────────────────────── */
.rw-label-combo {
  position: relative;
}

.rw-label-combo__input[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem var(--accent-glow, rgba(52, 179, 107, 0.16));
}

.rw-label-combo__list {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--surface, #ffffff);
  border: 1px solid var(--stroke, var(--border-strong, rgba(60, 84, 68, 0.18)));
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 12px 32px rgba(24, 40, 32, 0.12);
  scrollbar-width: thin;
  scrollbar-color: var(--stroke, rgba(60, 84, 68, 0.25)) transparent;
}

.rw-label-combo__list[hidden] {
  display: none;
}

.rw-label-combo__option {
  padding: 0.38rem 0.6rem;
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.25;
  color: var(--text, #1f2d24);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.rw-label-combo__option + .rw-label-combo__option {
  margin-top: 2px;
}

.rw-label-combo__option:hover,
.rw-label-combo__option.is-active {
  background: var(--accent-surface, rgba(52, 179, 107, 0.12));
  color: var(--accent-dim, #278752);
}

.rw-label-combo__match {
  background: transparent;
  color: var(--accent-dim, #278752);
  font-weight: 700;
  padding: 0;
}

.rw-label-combo__option.is-active .rw-label-combo__match {
  color: inherit;
}

.rw-label-combo__hint {
  margin-top: 0.3rem;
}

/* ── Leaflet (mapas de ubicación): acotar stacking y evitar que el lienzo tape la UI ── */
.leaflet-container img {
  max-width: none !important;
}

.session-location-map.leaflet-container,
.session-location-map .ol-viewport {
  position: relative;
  z-index: 1;
  border-radius: 8px;
  overflow: hidden;
  max-height: 320px;
}

.sd-actions-dropdown .dropdown-menu .session-location-map.leaflet-container,
.sd-actions-dropdown .dropdown-menu .session-location-map .ol-viewport {
  max-height: 260px;
}

/* ═══════════════════════════════════════════════════════════════
   MEJORAS DE DISEÑO — Sesión: workspace, analytics, modales
   ═══════════════════════════════════════════════════════════════ */

/* ── Context bar: barra de progreso visual ── */
.rw-context-bar {
  position: relative;
  overflow: hidden;
}

.rw-context-bar__track {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, #5ccc8a 100%);
  border-radius: 0 2px 8px 8px;
  transition: width 0.85s var(--ease-out-expo);
  min-width: 0;
  max-width: 100%;
}

/* ── Rail: puntos de estado con color semántico ── */
.rw-rail__state {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.rw-rail__state::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  opacity: 0.6;
}

.rw-rail__state--rev-validated::before { background: var(--ok); opacity: 1; }
.rw-rail__state--rev-rejected::before  { background: var(--err); opacity: 1; }
.rw-rail__state--rev-in_review::before { background: #5b8af0; opacity: 1; }
.rw-rail__state--rev-reviewed::before  { background: var(--warn); opacity: 1; }
.rw-rail__state--error::before         { background: var(--err); opacity: 1; }
.rw-rail__state--completed::before     { background: var(--muted); opacity: 0.55; }

/* ── Stage: botones de navegación más diferenciados ── */
.rw-stage__nav .btn.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem !important;
  border-radius: 99px !important;
  letter-spacing: 0.01em;
}

/* ── Quick actions: píldoras compactas ── */
.rw-stage__quick .btn.btn-sm {
  border-radius: 99px !important;
  font-size: 0.76rem !important;
  padding: 0.22rem 0.72rem !important;
  letter-spacing: 0.01em;
  font-weight: 600 !important;
}

/* ── Guardar decisión: botón primario elevado ── */
.rw-review-form > button[type="submit"].btn-success,
.rw-review-form button[type="submit"].btn.btn-success {
  position: relative;
  overflow: hidden;
  font-size: 0.88rem !important;
  padding: 0.55rem 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  border-radius: 10px !important;
  border: none !important;
  background: linear-gradient(135deg, #3dc877 0%, var(--accent-dim) 100%) !important;
  box-shadow:
    0 3px 14px rgba(52, 179, 107, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
}

.rw-review-form > button[type="submit"].btn-success::after,
.rw-review-form button[type="submit"].btn.btn-success::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 55%);
  pointer-events: none;
}

.rw-review-form > button[type="submit"].btn-success:hover,
.rw-review-form button[type="submit"].btn.btn-success:hover {
  transform: translateY(-1px) !important;
  box-shadow:
    0 5px 20px rgba(52, 179, 107, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

/* ── Settings modal: tabs con iconos ── */
.session-settings-dialog__tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.78rem !important;
  padding: 0.3rem 0.65rem !important;
  border-radius: 7px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease !important;
}

.session-settings-dialog__tabs .nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.session-settings-dialog__tabs .nav-link.active svg {
  opacity: 1;
}

/* ── Readonly strip: banner más prominente ── */
.rw-readonly-strip {
  align-items: center;
  border-left: 3px solid rgba(215, 155, 69, 0.6);
  border-radius: 0 8px 8px 0;
  background: linear-gradient(
    90deg,
    rgba(215, 155, 69, 0.14) 0%,
    rgba(215, 155, 69, 0.07) 100%
  );
}

.rw-readonly-strip svg {
  color: #b87c28;
  margin-top: 0;
}

.rw-readonly-strip strong {
  color: #7a5218;
}

/* ── Stage placeholder: estado vacío mejorado ── */
.rw-stage__placeholder {
  gap: 0.5rem;
}

.rw-stage__placeholder::before {
  content: '';
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.5rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(52, 179, 107, 0.12) 0%, transparent 70%);
  border: 1.5px dashed rgba(52, 179, 107, 0.3);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(52,179,107,0.4)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='12' cy='11' r='3'/%3E%3Cpath d='M3 19l4-4 3 3 4-5 4 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px;
}

/* ─────────────────────────────────────────────────────────────
   Analytics page
   ───────────────────────────────────────────────────────────── */

.analytics-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 0 3.5rem;
}

.analytics-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  color: var(--accent-dim);
  transition: color 0.15s ease;
}

.analytics-breadcrumb:hover {
  color: var(--accent);
}

.analytics-header {
  margin-bottom: 1.75rem;
}

.analytics-header__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  margin: 0 0 0.3rem;
  color: var(--text);
}

.analytics-header__sub {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  max-width: 56ch;
  line-height: 1.5;
}

.analytics-genera-box {
  margin-bottom: 1.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  animation: analytics-fade-up 0.4s var(--ease-out-expo) both;
}

.analytics-genera-box__title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.analytics-genera-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analytics-genera-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  background: var(--accent-surface);
  border: 1px solid rgba(52, 179, 107, 0.22);
  border-radius: 99px;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--accent-dim);
  font-weight: 600;
}

.analytics-table-section {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(24, 40, 32, 0.06);
  animation: analytics-fade-up 0.4s 0.08s var(--ease-out-expo) both;
}

@keyframes analytics-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.analytics-table-section__head {
  padding: 0.85rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.analytics-table-section__title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.analytics-table-section__count {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.analytics-table thead tr {
  background: var(--surface-2);
}

.analytics-table th {
  padding: 0.5rem 0.9rem;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.analytics-table td {
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid rgba(60, 84, 68, 0.055);
  color: var(--text);
  vertical-align: middle;
}

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

.analytics-table tbody tr:hover td {
  background: rgba(52, 179, 107, 0.025);
}

.analytics-genus-label {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  background: var(--accent-surface);
  border: 1px solid rgba(52, 179, 107, 0.2);
  border-radius: 99px;
  font-style: italic;
  font-weight: 600;
  color: var(--accent-dim);
  font-size: 0.79rem;
  white-space: nowrap;
}

.analytics-genus-label--plain {
  background: var(--surface-2);
  border-color: var(--stroke);
  color: var(--muted);
  font-style: normal;
}

.analytics-id {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.analytics-empty {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.analytics-empty__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.analytics-empty__title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 0.3rem;
}

.analytics-empty__sub {
  font-size: 0.83rem;
  margin: 0;
}

