/* ==========================================================================
   RECROSS STUDIO — Apple / iOS inspired design system
   Neutral, spacious, glassy. Single accent (iOS blue).
   ========================================================================== */

:root {
  /* Neutral, sophisticated palette (Apple grays) */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --hairline: rgba(0, 0, 0, 0.07);
  --hairline-strong: rgba(0, 0, 0, 0.1);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);

  /* Elevation scale — soft, cool-tinted, single light source */
  --shadow-sm: 0 1px 3px rgba(29, 29, 31, 0.05), 0 1px 2px rgba(29, 29, 31, 0.03);
  --shadow-md: 0 8px 20px -8px rgba(29, 29, 31, 0.16), 0 2px 6px rgba(29, 29, 31, 0.05);
  --shadow-lg: 0 18px 40px -18px rgba(29, 29, 31, 0.22), 0 6px 14px rgba(29, 29, 31, 0.06);
  --shadow-glass: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 30px -18px rgba(29, 29, 31, 0.22);

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.3, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", "Helvetica Neue", Arial, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;

  /* ARC motion tokens (kept for button system) */
  --arc-ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --arc-spring-snappy: cubic-bezier(0.2, 0.9, 0.3, 1);
  --arc-duration-instant: 100ms;
  --arc-duration-fast: 160ms;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
* { -webkit-tap-highlight-color: transparent; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Ambient aurora: subtle, non-flat, single palette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(0, 113, 227, 0.07), transparent 60%),
    radial-gradient(900px 520px at 102% -4%, rgba(175, 82, 222, 0.05), transparent 55%),
    radial-gradient(820px 620px at 50% 118%, rgba(48, 199, 89, 0.045), transparent 62%),
    var(--bg);
}

.font-mono,
.font-mono * { font-family: var(--font-mono); }

/* KaTeX conserva SIEMPRE su tipografía matemática.
   El selector utilitario `.font-mono *` (especificidad 0,1,1) pisaba la fuente
   base de KaTeX (0,1,0) y también la de cada nodo interno sin regla propia
   (.mord, .mbin, .base, .katex-html), por lo que las fórmulas de las pestañas
   de Losa y de Viga se veían en monoespaciada. Esta guarda (0,2,0) restituye
   KaTeX_Main en todo el subárbol de la fórmula; las variantes internas de
   KaTeX (KaTeX_Math, KaTeX_Size*, KaTeX_AMS, ...) se declaran a 0,2,0 o más y
   siguen ganando por orden de carga de katex.min.css. */
.font-mono .katex,
.font-mono .katex * { font-family: KaTeX_Main, "Times New Roman", Times, serif; }

::selection {
  background: rgba(0, 113, 227, 0.18);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Refined, minimal scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.32);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(120, 120, 128, 0.5); background-clip: padding-box; }

/* --------------------------------------------------------------------------
   Chrome: floating glass top bar & iOS segmented navigation
   -------------------------------------------------------------------------- */
.rc-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 247, 249, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--hairline);
}

.rc-topbar-inner { position: relative; z-index: 1; }

.rc-topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.rc-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.rc-brand:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.rc-brand:active {
  transform: scale(0.98);
}

.rc-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(160deg, #1d1d1f 0%, #3a3a3c 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 6px 16px -8px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.rc-logo svg { color: #64a8ff; }

/* Logo estilo imagen: icono oscuro con brillo + RECROSS en degradado azul */
.rc-logo-new {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(160deg, #0b0b0d 0%, #232326 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 16px rgba(90, 169, 255, 0.40), 0 6px 16px -8px rgba(0, 0, 0, 0.6);
}
.rc-wordmark.rc-wordmark-new {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  display: inline;
  /* PRUEBA TEMPORAL: aurora azul/morada dentro de las letras, lenta, con glow gaussiano */
  background: linear-gradient(100deg, #1e40af 0%, #2f6df0 22%, #7c5cf6 48%, #4aa8ff 72%, #1e40af 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px rgba(90, 130, 255, 0.45));
  animation: rc-aurora-text 6s ease-in-out infinite alternate;
}
@keyframes rc-aurora-text {
  0% { background-position: 0% 0; }
  100% { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rc-wordmark.rc-wordmark-new { animation: none; }
}
.rc-byline.rc-byline-new { margin-top: 0; font-size: 14px; font-weight: 500; color: #6e6e73; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.rc-byline-new .rc-live {
  width: 8px; height: 8px; border-radius: 9999px;
  background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18);
}
.rc-brand-text.rc-brand-text-new { display: flex; flex-direction: row; align-items: center; gap: 12px; min-width: 0; }

.rc-brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rc-wordmark {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.rc-wordmark .rc-dot { color: var(--accent); }
.rc-wordmark .rc-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.rc-byline {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rc-byline .rc-live {
  width: 6px; height: 6px; border-radius: 9999px;
  background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
}

.rc-module {
  margin-left: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--glass-strong);
  border: 1px solid var(--hairline);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.rc-module b { color: var(--text-primary); }

.rc-actions { display: flex; align-items: center; gap: 12px; }

.rc-preset-wrap { display: flex; align-items: center; gap: 10px; }
.rc-preset-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.rc-preset-track {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: rgba(120, 120, 128, 0.12);
  border: 1px solid var(--hairline);
}
.rc-preset-track .btn-arc {
  border: none;
  box-shadow: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
}
.rc-preset-track .btn-arc:hover { background: rgba(255, 255, 255, 0.5); color: var(--text-primary); }
.rc-preset-track .btn-arc.bg-white {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.1), 0 3px 8px -4px rgba(29, 29, 31, 0.18);
}

/* Export button */
#btn-export-pdf {
  border: 1px solid var(--hairline);
  background: var(--glass-strong);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
#btn-export-pdf:hover { background: #ffffff; box-shadow: var(--shadow-md); }

/* Segmented tab bar (nav) */
.rc-tabbar {
  position: sticky;
  top: 64px;
  z-index: 30;
  background: rgba(245, 245, 247, 0.62);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--hairline);
}
.rc-tabbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow-x: auto;
}
.rc-tabbar-track {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(120, 120, 128, 0.12);
  border: 1px solid var(--hairline);
  min-width: max-content;
}
.rc-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--glass-strong);
  border: 1px solid var(--hairline);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.rc-status .rc-live {
  width: 7px; height: 7px; border-radius: 9999px; background: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
}

/* --------------------------------------------------------------------------
   Segmented / tab button (JS toggles .active + Tailwind classes)
   -------------------------------------------------------------------------- */
.supabase-tab-btn {
  position: relative;
  border-bottom: none !important;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: background-color var(--arc-duration-fast) ease,
              color var(--arc-duration-fast) ease,
              box-shadow var(--arc-duration-fast) ease,
              transform var(--arc-duration-instant) var(--ease);
}
.supabase-tab-btn:active { transform: scale(0.975); }
.supabase-tab-btn:not(.active):hover {
  background-color: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
}
.supabase-tab-btn svg { color: var(--text-tertiary) !important; transition: color 0.16s ease; }
.supabase-tab-btn:not(.active):hover svg { color: var(--text-secondary) !important; }

.supabase-tab-btn.active {
  background-color: #ffffff;
  color: var(--accent) !important;
  box-shadow: 0 1px 2px rgba(29, 29, 31, 0.1), 0 4px 12px -6px rgba(29, 29, 31, 0.2);
}
.supabase-tab-btn.active svg { color: var(--accent) !important; }

/* --------------------------------------------------------------------------
   Surfaces — frosted glass cards, generous radius
   -------------------------------------------------------------------------- */
.supabase-card {
  background-color: var(--glass-strong) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow-glass);
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.supabase-card:hover { border-color: var(--hairline-strong); }

/* Preserve intentional tinted/gradient backgrounds inside cards */
.supabase-card[class*="bg-gradient"] { background-color: transparent !important; }

.supabase-header-title {
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text-primary);
}

/* iOS-like table header */
.supabase-table-header th {
  background-color: rgba(120, 120, 128, 0.08);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
}

.supabase-code-badge {
  font-family: var(--font-mono);
  background-color: rgba(120, 120, 128, 0.1);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 0.125rem 0.4rem;
  font-size: 0.75rem;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Buttons — ARC system, iOS proportions
   -------------------------------------------------------------------------- */
.btn-arc {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  border-radius: 12px;
  padding: 0.5rem 0.9rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: transform var(--arc-duration-instant) var(--ease),
              background-color var(--arc-duration-fast) ease,
              border-color var(--arc-duration-fast) ease,
              box-shadow var(--arc-duration-fast) ease,
              opacity var(--arc-duration-fast) ease;
}
.btn-arc:active:not(:disabled) { transform: scale(0.965); }

.btn-arc-primary {
  background: var(--text-primary);
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: var(--shadow-sm);
}
.btn-arc-primary:hover:not(:disabled) { background: #2c2c2e; box-shadow: var(--shadow-md); }

.btn-arc-brand {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-hover);
  box-shadow: 0 1px 3px rgba(0, 113, 227, 0.28);
}
.btn-arc-brand:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 6px 16px -6px rgba(0, 113, 227, 0.45); }

.btn-arc-secondary {
  background: var(--glass-strong);
  color: var(--text-primary);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}
.btn-arc-secondary:hover:not(:disabled) { background: #fff; border-color: var(--hairline-strong); }

.btn-arc-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-arc-ghost:hover:not(:disabled) { background: rgba(120, 120, 128, 0.12); color: var(--text-primary); }

.btn-arc-danger {
  background: rgba(255, 59, 48, 0.08);
  color: #e5322a;
  border: 1px solid rgba(255, 59, 48, 0.22);
}
.btn-arc-danger:hover:not(:disabled) { background: rgba(255, 59, 48, 0.14); border-color: rgba(255, 59, 48, 0.34); }

.btn-arc-icon { padding: 0.4rem 0.55rem; border-radius: 11px; }

/* Info Button (ℹ) & Arc Popover */
.btn-info-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 113, 227, 0.2);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  outline: none;
  transition: all 0.15s var(--ease);
}
.btn-info-circle:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px -3px rgba(0, 113, 227, 0.5);
}
.btn-info-circle:active { transform: scale(0.92); }

/* Modal / Popover de Info Técnica */
.arc-popover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, 0.28);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}
.arc-popover-overlay.active { opacity: 1; pointer-events: auto; }
.arc-popover-card {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-radius: 26px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  max-width: 32rem;
  width: 92%;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.26s var(--ease-spring), opacity 0.2s ease;
  overflow: hidden;
  opacity: 0;
}
.arc-popover-overlay.active .arc-popover-card { transform: scale(1) translateY(0); opacity: 1; }

/* --------------------------------------------------------------------------
   KaTeX formulas
   -------------------------------------------------------------------------- */
.katex-display {
  margin: 0.35rem 0 !important;
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 0.15rem 0;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.katex-display::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
.katex { font-size: 1.04em !important; color: inherit; line-height: 1.25; text-rendering: geometricPrecision; }
.katex-display > .katex { font-size: 1.08em !important; }
.katex .frac-line { border-bottom-width: 1.2px !important; }

.katex-scroll-container, [class*="overflow-x-auto"] {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
[class*="overflow-x-auto"]::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }

/* --------------------------------------------------------------------------
   Beam / SVG editor interactions
   -------------------------------------------------------------------------- */
.diagram-canvas-container {
  background-image: linear-gradient(to right, rgba(120, 120, 128, 0.08) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(120, 120, 128, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

.beam-segment-hover { transition: all 0.2s var(--ease); }
.beam-segment-hover:hover {
  stroke: var(--accent) !important;
  filter: drop-shadow(0 0 6px rgba(0, 113, 227, 0.35));
}

.support-interactive { cursor: ew-resize; transition: filter 0.18s ease; }
.support-interactive:hover { filter: drop-shadow(0 0 8px rgba(0, 113, 227, 0.45)); }
.support-dragging { cursor: grabbing !important; filter: drop-shadow(0 4px 14px rgba(0, 113, 227, 0.6)) !important; }

@keyframes supportPulse {
  0%, 100% { transform: scale(1); stroke-opacity: 0.85; }
  50% { transform: scale(1.18); stroke-opacity: 0.35; }
}
.support-selected-pulse { transform-origin: center; animation: supportPulse 1.6s ease-in-out infinite; }

.load-interactive { transition: all 0.2s ease; cursor: pointer; }
.load-interactive:hover { filter: drop-shadow(0 0 5px rgba(0, 113, 227, 0.4)); }

.q-load-interactive { cursor: ns-resize; transition: filter 0.18s ease; }
.q-load-interactive:hover { filter: drop-shadow(0 0 8px rgba(0, 113, 227, 0.55)); }

.point-load-interactive { cursor: ew-resize; transition: filter 0.18s ease; }
.point-load-interactive:hover { filter: drop-shadow(0 0 8px rgba(255, 59, 48, 0.5)); }
.point-load-dragging { cursor: grabbing !important; filter: drop-shadow(0 4px 14px rgba(255, 59, 48, 0.7)) !important; }

@keyframes selectRing { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 24; } }
.selection-animated-ring { stroke-dasharray: 4 4; animation: selectRing 1.5s linear infinite; }

.cota-group { transition: all 0.18s ease; cursor: pointer; }
.cota-group:hover .cota-badge {
  stroke: var(--accent) !important;
  filter: drop-shadow(0 2px 8px rgba(0, 113, 227, 0.35));
}
.cota-group:hover line { stroke: var(--accent) !important; }

/* --------------------------------------------------------------------------
   Hardy Cross interactive states
   -------------------------------------------------------------------------- */
@keyframes flowDash { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
.cross-flow-animated { stroke-dasharray: 6 3; animation: flowDash 1s linear infinite; }
.cross-spin-balance { display: none; }

@keyframes pulseGlowRing {
  0% { box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(0, 113, 227, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 113, 227, 0); }
}
.cross-active-cell-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  color: #0060c7;
  font-weight: 800;
  animation: pulseGlowRing 1.8s ease-in-out infinite;
}
.cross-active-box-card {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12), var(--shadow-md) !important;
  transition: all 0.25s ease;
}

.cross-badge-unbalance { /* estático */ }
.cross-badge-balance { /* estático */ }

.cross-bar-rose { transition: all 0.4s var(--ease); filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.35)); }
.cross-bar-emerald { transition: all 0.4s var(--ease); filter: drop-shadow(0 0 4px rgba(52, 199, 89, 0.35)); }

@keyframes crossArrowFlow { 0% { stroke-dashoffset: 36; } 100% { stroke-dashoffset: 0; } }
@keyframes pulseGlowAmber {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 159, 10, 0.4)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 8px rgba(255, 159, 10, 0.85)); transform: scale(1.02); }
}
@keyframes pulseGlowRed {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 59, 48, 0.4)); }
  50% { filter: drop-shadow(0 0 9px rgba(255, 59, 48, 0.9)); }
}
@keyframes pulseGlowGreen {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(52, 199, 89, 0.4)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 9px rgba(52, 199, 89, 0.85)); transform: scale(1.02); }
}

.cross-arrow-anim { stroke-dasharray: 6 4; animation: crossArrowFlow 1s linear infinite; }
.cross-arrow-pulse-red { animation: pulseGlowRed 1.8s ease-in-out infinite; }
.cross-arrow-pulse-blue { filter: drop-shadow(0 0 4px rgba(10, 132, 255, 0.55)); }

.cross-delta-box-green {
  border: 1.5px solid #34c759;
  background: linear-gradient(180deg, #f2fcf5 0%, #eafaf0 100%);
  color: #1d6e33;
}
.cross-delta-box-green.is-active {
  border: 2px solid #2aa94b !important;
  background: #d9f6e3 !important;
  animation: pulseGlowGreen 1.8s ease-in-out infinite;
}
.cross-delta-box-orange {
  border: 1.5px solid #ff9f0a;
  background: linear-gradient(180deg, #fffbf4 0%, #fff8ec 100%);
  color: #9d570d;
}
.cross-delta-box-orange.is-active {
  border: 2px solid #e8880a !important;
  background: #ffedd0 !important;
  animation: pulseGlowAmber 1.8s ease-in-out infinite;
}

.cross-trans-cell-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.4rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
}

.notebook-final-box {
  border: 2px solid #ff3b30;
  background-color: #fff0ef;
  color: #c42a23;
  font-weight: 800;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(255, 59, 48, 0.15);
}

@keyframes arrowDashFlow { to { stroke-dashoffset: -18; } }
.cross-active-arrow-path { stroke-dasharray: 6 3; animation: arrowDashFlow 1.2s linear infinite; }

/* --------------------------------------------------------------------------
   Support reaction animations
   -------------------------------------------------------------------------- */
@keyframes rxnPulseUp {
  0%, 100% { transform: translateY(0); opacity: 0.92; }
  50% { transform: translateY(-2px); opacity: 1; }
}
@keyframes rxnPulseHoriz {
  0%, 100% { transform: translateX(0); opacity: 0.92; }
  50% { transform: translateX(2px); opacity: 1; }
}
@keyframes rxnMomentPulse {
  0%, 100% { opacity: 0.9; filter: drop-shadow(0 0 0 rgba(220, 38, 38, 0)); }
  50% { opacity: 1; filter: drop-shadow(0 0 3px rgba(220, 38, 38, 0.45)); }
}
.rxn-arrow-up-anim { animation: rxnPulseUp 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.rxn-arrow-horiz-anim { animation: rxnPulseHoriz 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.rxn-moment-anim { animation: rxnMomentPulse 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* --------------------------------------------------------------------------
   Bento selection
   -------------------------------------------------------------------------- */
.bento-card-selectable { cursor: pointer; user-select: none; transition: all 0.2s var(--ease); }
.bento-card-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12), var(--shadow-md) !important;
  transform: translateY(-1px);
}
.bento-card-selected:hover { box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16), var(--shadow-lg) !important; }
.bento-card-unselected {
  opacity: 1 !important;
  border-color: var(--hairline) !important;
  box-shadow: var(--shadow-sm) !important;
  transform: translateY(0);
}
.bento-card-unselected:hover { border-color: var(--hairline-strong) !important; box-shadow: var(--shadow-md) !important; }

/* --------------------------------------------------------------------------
   Slab / beam reinforcement hover
   -------------------------------------------------------------------------- */
.rebar-element path { cursor: pointer; transition: stroke 0.2s ease, stroke-width 0.2s ease, filter 0.2s ease; }
.rebar-element:hover path { filter: drop-shadow(0 0 6px rgba(0, 113, 227, 0.5)); }
.bended-bar-element path { transition: opacity 0.2s ease, stroke-width 0.2s ease; }
.bended-bar-element:hover path {
  stroke-width: 3.2 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 5px rgba(255, 59, 48, 0.5));
}

/* --------------------------------------------------------------------------
   Vista Completa: modo solo lectura
   -------------------------------------------------------------------------- */
#main-tab-panel-beam.view-only-mode #toolbar-tools-loads,
#main-tab-panel-beam.view-only-mode #toolbar-tools-moments,
#main-tab-panel-beam.view-only-mode #btn-mode-loads,
#main-tab-panel-beam.view-only-mode #btn-mode-moments,
#main-tab-panel-beam.view-only-mode #btn-delete-element,
#main-tab-panel-beam.view-only-mode #btn-delete-element-moments,
#main-tab-panel-beam.view-only-mode #inspector-panel,
#main-tab-panel-beam.view-only-mode .beam-editor-action-btn,
#main-tab-panel-beam.view-only-mode .beam-edit-hint { display: none !important; }

#beam-readonly-indicator { display: none; }

#main-tab-panel-beam.view-only-mode .beam-toolbar { pointer-events: none !important; }
#main-tab-panel-beam.view-only-mode #beam-canvas-wrapper { cursor: default !important; }
#main-tab-panel-beam.view-only-mode #beam-readonly-indicator { display: inline-flex !important; }

/* --------------------------------------------------------------------------
   Easter eggs & micro-animations
   -------------------------------------------------------------------------- */
@keyframes catSlideDown {
  0% { transform: translateY(-100%) scale(0.8); opacity: 0; }
  70% { transform: translateY(8px) scale(1.03); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes catEarWiggle { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes catTailWag { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(14deg); } }
.animate-cat-peek { animation: catSlideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.cat-ear-anim { transform-origin: bottom center; animation: catEarWiggle 2.5s ease-in-out infinite; }
.cat-tail-anim { transform-origin: 10px 40px; animation: catTailWag 1.8s ease-in-out infinite; }

@keyframes googlePopUp {
  0% { transform: scale(0.7) translateY(40px); opacity: 0; }
  60% { transform: scale(1.03) translateY(-4px); opacity: 1; }
  85% { transform: scale(0.98) translateY(2px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.animate-googlePopUp { animation: googlePopUp 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

@keyframes pawStamp {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  40% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.65; }
}
.animate-pawStamp { animation: pawStamp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

@keyframes heartFloat {
  0% { transform: translateY(0) scale(0.8); opacity: 1; }
  100% { transform: translateY(-45px) scale(1.4); opacity: 0; }
}
.animate-heartFloat { animation: heartFloat 1s ease-out forwards; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-fadeIn { animation: fadeIn 0.25s ease-out forwards; }

/* --------------------------------------------------------------------------
   Estela brillante del cursor (no intercepta clics)
   -------------------------------------------------------------------------- */
#cursor-trail {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Scrollbar utilities
   -------------------------------------------------------------------------- */
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* --------------------------------------------------------------------------
   Minimalist PDF report
   -------------------------------------------------------------------------- */
#minimalist-pdf-report-wrapper {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 820px;
  background: #ffffff;
  z-index: -100;
  pointer-events: none;
}
#minimalist-pdf-report {
  font-family: var(--font-sans);
  color: #1d1d1f;
  background-color: #ffffff;
  line-height: 1.45;
}
#minimalist-pdf-report table { border-collapse: collapse; width: 100%; }
#minimalist-pdf-report th, #minimalist-pdf-report td { padding: 6px 10px; border: 1px solid #e5e5ea; }
#minimalist-pdf-report th {
  background-color: #f5f5f7;
  color: #48484a;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#minimalist-pdf-report td { font-size: 0.78rem; }

.print-only { display: none; }

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@media print {
  body { background: #ffffff !important; color: #000000 !important; font-size: 11pt !important; }
  header, nav, .rc-topbar, .rc-tabbar, #inspector-panel, .no-print, button, .arc-popover-overlay, #minimalist-pdf-report-wrapper, #shader-bg, .landing-aurora, #landing-menu { display: none !important; }
  .print-only { display: block !important; }
  .lg\:grid-cols-12 { display: block !important; }
  .lg\:col-span-7, .lg\:col-span-5, .xl\:col-span-7, .xl\:col-span-5 { width: 100% !important; max-width: 100% !important; }
  .shadow-clean, .shadow-2xs, .shadow-xs, .shadow-md, .shadow-elevated { box-shadow: none !important; }
  .border { border-color: #cbd5e1 !important; }
  .break-inside-avoid { break-inside: avoid; page-break-inside: avoid; }
}

@media print {
  body, .supabase-card, div, span, table, th, td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  canvas, svg {
    max-width: 100% !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .supabase-card, #support-reactions-panel, #main-diagrams-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   Responsive chrome
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .rc-preset-label { display: none; }
}
@media (max-width: 860px) {
  .rc-module { display: none; }
  .rc-preset-wrap { display: none; }
  .rc-topbar-inner { height: 58px; padding: 0 16px; }
  .rc-tabbar { top: 58px; }
  .rc-tabbar-inner { padding: 9px 16px; }
}
@media (max-width: 640px) {
  .rc-topbar-inner {
    height: 54px;
    padding: 0 10px;
    gap: 8px;
  }
  .rc-tabbar {
    top: 54px;
  }
  .rc-tabbar-inner {
    padding: 6px 10px;
  }
  .rc-brand {
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
  }
  .rc-logo-new {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .rc-logo-new svg {
    width: 20px;
    height: 20px;
  }
  .rc-wordmark.rc-wordmark-new {
    font-size: 18px;
    letter-spacing: 0.02em;
  }
  .rc-byline.rc-byline-new {
    display: none !important;
  }
  .rc-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  #btn-export-pdf {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  #user-session-container {
    gap: 4px;
    padding-left: 4px;
    border-left: 1px solid var(--hairline);
    flex-shrink: 0;
  }
  #user-session-pill {
    padding: 5px 8px;
    font-size: 11px;
    max-width: 110px;
  }
  #user-status-text {
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #user-tier-badge {
    font-size: 9px;
    padding: 1px 4px;
  }
  #btn-logout {
    padding: 4px;
  }
  #btn-logout svg {
    width: 14px;
    height: 14px;
  }
  main {
    padding-left: 10px !important;
    padding-right: 10px !important;
    padding-top: 14px !important;
    padding-bottom: 32px !important;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .supabase-card {
    border-radius: 16px;
    padding: 14px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
@media (max-width: 400px) {
  .rc-brand-text.rc-brand-text-new {
    display: none !important;
  }
  #user-status-text {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Indicador de deslizamiento para fórmulas / operaciones que desbordan
   -------------------------------------------------------------------------- */
.kx-scroll-wrap { position: relative; }

.kx-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid var(--hairline);
  box-shadow: 0 4px 14px -6px rgba(29, 29, 31, 0.3), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  cursor: pointer;
  z-index: 3;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity 0.22s ease, visibility 0.22s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}
.kx-hint:hover { background: #fff; box-shadow: 0 6px 18px -6px rgba(29, 29, 31, 0.36); }
.kx-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kx-hint svg { display: block; }
.kx-hint-left { left: 3px; }
.kx-hint-right { right: 3px; }
.kx-hint-right svg { animation: kxNudgeRight 1.5s var(--ease) infinite; }
.kx-hint-left svg { animation: kxNudgeLeft 1.5s var(--ease) infinite; }
.kx-hint.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes kxNudgeRight {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}
@keyframes kxNudgeLeft {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .kx-hint-right svg, .kx-hint-left svg { animation: none; }
}
@media print {
  .kx-hint { display: none !important; }
}

/* --------------------------------------------------------------------------
   Avisos flotantes del editor de estructuras
   (reglas de compatibilidad de cargas por tramo)
   -------------------------------------------------------------------------- */
#editor-notice-host {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 30rem);
  pointer-events: none;
}

.editor-notice {
  pointer-events: auto;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  backdrop-filter: blur(10px) saturate(180%);
  animation: editorNoticeIn 0.22s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.editor-notice.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes editorNoticeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .editor-notice { animation: none; }
}

@media print {
  #editor-notice-host { display: none !important; }
}

/* --------------------------------------------------------------------------
   RECROSS AVANZADO & ADMIN STYLING
   -------------------------------------------------------------------------- */
.pro-lock-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.08);
  white-space: nowrap;
}

#user-session-pill {
  transition: all 0.18s var(--ease);
}
#user-session-pill:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

#main-tab-panel-admin {
  animation: fadeIn 0.2s var(--ease) both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
