/* ==========================================================================
   OMNIUNIT DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors - Dark Theme (Default) */
  --bg-main: #090d16;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(22, 34, 60, 0.9);
  --bg-input: #0d1527;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 210, 255, 0.45);

  --accent-cyan: #00d2ff;
  --accent-blue: #3a86ff;
  --accent-emerald: #00e599;
  --accent-purple: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --gradient-brand: linear-gradient(135deg, #00d2ff 0%, #3a86ff 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --glass-blur: blur(14px);
  --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Mode Overrides */
body.light-theme {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: #0088cc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
}

/* Background Atmosphere */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}
.bg-glow-1 {
  top: -100px;
  right: -50px;
  background: rgba(0, 210, 255, 0.25);
}
.bg-glow-2 {
  bottom: -100px;
  left: -50px;
  background: rgba(139, 92, 246, 0.2);
}
.bg-grid {
  position: fixed;
  inset: 0;
  background-size: 36px 36px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}
body.light-theme .bg-grid {
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

/* Container */
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.25rem;
  position: relative;
  z-index: 1;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}

.font-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent-cyan); }
.text-success { color: var(--accent-emerald); }
.text-dim { color: var(--text-dim); }

/* ==========================================================================
   HEADER & MAIN MODE SWITCHER
   ========================================================================== */
.header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.7);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 100;
}
body.light-theme .header {
  background: rgba(241, 245, 249, 0.85);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  color: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.35);
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-version {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 210, 255, 0.3);
}

.brand-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Mode Switcher */
.main-mode-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
}
body.light-theme .main-mode-switcher {
  background: rgba(0, 0, 0, 0.05);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--accent-cyan);
  color: #090d16;
  box-shadow: 0 2px 10px rgba(0, 210, 255, 0.3);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
}

.vps-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(0, 229, 153, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 229, 153, 0.25);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* View Panels */
.main-content {
  padding: 2rem 1.25rem 4rem;
  flex: 1;
}

.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* ==========================================================================
   CONVERTER SECTION
   ========================================================================== */
.category-tabs {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.cat-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.cat-btn.active {
  background: var(--accent-cyan);
  color: #090d16;
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 18px rgba(0, 210, 255, 0.35);
}

.converter-card {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.converter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cat-heading {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cat-heading i { color: var(--accent-cyan); }

.auto-calc-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.input-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 0.9rem 2.8rem 0.9rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: all var(--transition);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.25);
}

.output-wrapper input {
  background: rgba(0, 210, 255, 0.04);
  color: var(--accent-cyan);
  border-color: rgba(0, 210, 255, 0.2);
}

.btn-clear, .btn-copy {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.btn-clear:hover { color: #ff5f56; }
.btn-copy:hover { color: var(--accent-cyan); }

.unit-select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.unit-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.swap-container {
  padding-top: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-swap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.btn-swap:hover {
  background: var(--accent-cyan);
  color: #090d16;
  border-color: var(--accent-cyan);
  transform: rotate(180deg);
}

.details-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.detail-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.detail-label { color: var(--text-dim); }
.detail-value { color: var(--accent-emerald); font-weight: 600; }

.quick-chips { display: flex; gap: 0.4rem; }
.chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}
.chip-btn:hover {
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(0, 210, 255, 0.3);
}

/* ==========================================================================
   PIPES & SCHEDULES COMMON CARDS
   ========================================================================== */
.pipes-hero-card {
  padding: 2rem;
  margin-bottom: 2rem;
}

.pipes-hero-content h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.pipes-hero-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.8rem;
}

.pipe-selector-card {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.pipe-selector-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}

.select-col {
  flex: 1;
  min-width: 250px;
}

.pipe-select {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.9rem 1.1rem;
}

.pipe-meta-box {
  display: flex;
  gap: 1.5rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.meta-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.schedules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.sch-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  transition: all var(--transition);
}

.sch-card:hover {
  border-color: rgba(0, 210, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.sch-card.is-std {
  border-color: rgba(0, 229, 153, 0.35);
  background: rgba(0, 229, 153, 0.04);
}

.sch-card.is-xs {
  border-color: rgba(58, 134, 255, 0.35);
  background: rgba(58, 134, 255, 0.04);
}

.sch-card.is-xxs {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.04);
}

.sch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sch-name {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.sch-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}
.badge-std { background: rgba(0, 229, 153, 0.15); color: var(--accent-emerald); }
.badge-xs { background: rgba(58, 134, 255, 0.15); color: var(--accent-blue); }
.badge-xxs { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.sch-values {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.sch-val-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.sch-val-row .val-label { color: var(--text-dim); }
.sch-val-row .val-data { font-weight: 700; }
.sch-val-row.highlight-thick .val-data {
  font-size: 1.2rem;
  color: var(--accent-cyan);
}

.btn-sch-copy {
  width: 100%;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all var(--transition);
}
.btn-sch-copy:hover {
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(0, 210, 255, 0.3);
}

/* Matriz Cañerías */
.full-pipe-matrix {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.matrix-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.matrix-top-bar h3 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.matrix-top-bar h3 i { color: var(--accent-cyan); }

.table-search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  width: 300px;
}

.table-search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  width: 100%;
}
.table-search-box input:focus { outline: none; }
.table-search-box i { color: var(--text-dim); }

.matrix-table-container {
  overflow-x: auto;
  max-height: 520px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  text-align: center;
}

.matrix-table th {
  background: #0d1527;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
body.light-theme .matrix-table th { background: #e2e8f0; }

.matrix-table td {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  color: var(--text-main);
  white-space: nowrap;
}

.matrix-table tr:hover td { background: rgba(0, 210, 255, 0.04); }

.sticky-col {
  position: sticky;
  left: 0;
  background: #0b1120 !important;
  z-index: 3;
  font-weight: 800;
}
.sticky-col-2 {
  position: sticky;
  left: 55px;
  background: #0b1120 !important;
  z-index: 3;
}
.sticky-col-3 {
  position: sticky;
  left: 110px;
  background: #0b1120 !important;
  z-index: 3;
  border-right: 2px solid var(--border-subtle) !important;
}

.matrix-table td.cell-empty { color: rgba(255, 255, 255, 0.15); }

.col-highlight-std, td.cell-std {
  color: var(--accent-emerald) !important;
  background: rgba(0, 229, 153, 0.08) !important;
  font-weight: 700;
}

.col-highlight-xs, td.cell-xs {
  color: var(--accent-blue) !important;
  background: rgba(58, 134, 255, 0.08) !important;
  font-weight: 700;
}

.col-highlight-xxs, td.cell-xxs {
  color: var(--accent-purple) !important;
  background: rgba(139, 92, 246, 0.08) !important;
  font-weight: 700;
}

.matrix-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.highlight-std { color: var(--accent-emerald); }
.highlight-xs { color: var(--accent-blue); }
.highlight-xxs { color: var(--accent-purple); }

/* ==========================================================================
   3. BRIDAS ASME B16.5 STYLES
   ========================================================================== */
.flange-controls-card {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.flange-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.8rem;
}

/* ==========================================================================
   3.B TORQUE MODULE STYLES (FLEXSEAL / ASME PCC-1)
   ========================================================================== */
.torque-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.8rem;
}

.torque-result-card {
  background: var(--bg-input);
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 1rem;
}

.tr-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tr-badge-condition {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.4rem;
}

.tr-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.tr-unit-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  gap: 0.2rem;
}

.unit-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.unit-toggle-btn.active {
  background: var(--accent-cyan);
  color: #090d16;
}

.tr-main-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.tr-val-box {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.tr-big-number {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent-emerald);
  letter-spacing: -0.03em;
  line-height: 1;
}

.tr-big-unit {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

.tr-alt-number {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-dim);
}

.tr-meta-specs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.tr-meta-specs span { color: var(--text-dim); }
.tr-meta-specs strong { color: var(--text-main); }

/* Desglose en Etapas */
.torque-breakdown-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tb-header h4 {
  font-size: 1.05rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tb-header h4 i { color: var(--accent-cyan); }
.tb-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.step-card.highlight-step {
  border-color: rgba(0, 229, 153, 0.4);
  background: rgba(0, 229, 153, 0.05);
}

.step-num {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.step-pct {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.step-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}
.step-card.highlight-step .step-val {
  color: var(--accent-emerald);
}

.step-note {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.tightening-pattern-box {
  background: rgba(0, 210, 255, 0.05);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.tp-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tp-label i { color: var(--accent-cyan); }

.tp-sequence {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
}

.flange-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.f-spec-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.f-spec-item .f-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.f-spec-item .f-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.f-spec-item .f-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ==========================================================================
   4. VELOCIDAD DE FLUJO (v = Q / A) STYLES
   ========================================================================== */
.velocity-calc-card {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.velocity-inputs-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.velocity-result-box {
  background: var(--bg-input);
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.vel-speed-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.vel-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.vel-unit {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.vel-secondary {
  font-size: 1.1rem;
  color: var(--text-dim);
}

.vel-gauge-bar {
  width: 100%;
  max-width: 480px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin: 0 auto 1.5rem;
  overflow: hidden;
}

.vel-bar-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background 0.4s ease;
}

.vel-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.vel-status-badge.status-optimo {
  background: rgba(0, 229, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 229, 153, 0.35);
}

.vel-status-badge.status-succion {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.vel-status-badge.status-alta {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.vel-status-badge.status-peligro {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.vel-meta-details {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.25rem;
  flex-wrap: wrap;
}

.vel-guide-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.vel-guide-box h4 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vel-criteria-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.crit-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.crit-range {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.crit-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ==========================================================================
   5. FACTOR CTL / API MPMS 11.1 STYLES
   ========================================================================== */
.api-calc-card {
  padding: 2.2rem;
  margin-bottom: 2rem;
}

.api-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.temp-unit-toggle {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.temp-unit-toggle input {
  margin-right: 0.3rem;
  accent-color: var(--accent-cyan);
}

.api-result-box {
  background: var(--bg-input);
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 2rem;
}

.ctl-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.8rem;
  margin-bottom: 1.5rem;
}

.ctl-tag {
  color: var(--accent-cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ctl-main-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.ctl-factor {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.ctl-grid-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
}

.ctl-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cd-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.cd-val {
  font-size: 1.1rem;
  font-weight: 700;
}

.guide-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   SIMULTANEOUS EQUIVALENCE TABLE & COMMON
   ========================================================================== */
.multi-results {
  padding: 2rem;
  margin-bottom: 2rem;
}

.multi-header { margin-bottom: 1.5rem; }
.multi-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.multi-header h3 i { color: var(--accent-cyan); }
.multi-subtitle { font-size: 0.82rem; color: var(--text-muted); }

.table-responsive { overflow-x: auto; }
.equiv-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.equiv-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}
.equiv-table td {
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.equiv-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.equiv-table tr.active-row td {
  background: rgba(0, 210, 255, 0.06);
  font-weight: 700;
}

.btn-table-copy {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}
.btn-table-copy:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-card { padding: 1.8rem; }
.info-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.info-card h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.6rem; }
.info-card p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.6; }

.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  background: rgba(5, 8, 14, 0.8);
}
body.light-theme .footer { background: rgba(226, 232, 240, 0.8); }

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET OPTIMIZATIONS)
   ========================================================================== */

/* Indicador visual de scroll táctil en tablas */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  position: relative;
}

@media (max-width: 992px) {
  .header-container {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .main-mode-switcher {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem;
  }
  .main-mode-switcher::-webkit-scrollbar {
    display: none;
  }
  .mode-btn {
    flex-shrink: 0;
  }
  .velocity-inputs-grid, .api-inputs-grid {
    grid-template-columns: 1fr;
  }
  .ctl-grid-details {
    grid-template-columns: repeat(2, 1fr);
  }
  .vel-criteria-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Contenedores y espaciados generales */
  .container {
    padding: 0 0.85rem;
  }
  .main-content {
    padding: 1.25rem 0;
  }
  .glass-card {
    padding: 1.25rem 1rem !important;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
  }

  /* Header en celulares */
  .brand-title {
    font-size: 1.15rem;
  }
  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }
  .vps-tag {
    display: none;
  }
  .mode-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  /* Hero Cards */
  .pipes-hero-card {
    padding: 1.4rem 1rem !important;
  }
  .pipes-hero-content h2 {
    font-size: 1.35rem;
    line-height: 1.3;
  }
  .pipes-hero-content p {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  /* 1. Conversor de unidades */
  .category-tabs {
    gap: 0.4rem;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .category-tabs::-webkit-scrollbar {
    display: none;
  }
  .cat-btn {
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }
  .converter-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .swap-container {
    padding: 0.2rem 0;
    display: flex;
    justify-content: center;
  }
  .btn-swap {
    transform: rotate(90deg);
  }
  .quick-chips {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 0.3rem;
  }
  .quick-chips::-webkit-scrollbar {
    display: none;
  }
  .chip-btn {
    flex-shrink: 0;
  }

  /* 2. Cañerías ASME */
  .pipe-selector-header {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }
  .select-col {
    min-width: 100%;
    width: 100%;
  }
  .pipe-meta-box {
    width: 100%;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
  }
  .schedules-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* 3. Bridas ASME B16.5 */
  .flange-controls-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .flange-specs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* 3.B Módulo de Torque (Flexseal / ASME PCC-1) */
  .torque-controls-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
  }
  .torque-result-card {
    padding: 1.25rem 1rem !important;
  }
  .tr-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .tr-unit-toggle {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
  .tr-main-value-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }
  .tr-big-number {
    font-size: 2.75rem;
  }
  .tr-big-unit {
    font-size: 1.25rem;
  }
  .tr-alt-number {
    font-size: 1.1rem;
  }
  .tr-meta-specs {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
  }

  /* Desglose de 5 etapas en mobile: grilla de 2 columnas con el paso 5 ocupando todo el ancho */
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .step-card {
    padding: 0.75rem 0.5rem;
  }
  .step-card:last-child {
    grid-column: span 2;
  }
  .step-num {
    font-size: 0.68rem;
  }
  .step-pct {
    font-size: 0.75rem;
  }
  .step-val {
    font-size: 1.15rem;
  }
  .step-note {
    font-size: 0.7rem;
  }

  .tightening-pattern-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.75rem 0.9rem;
  }
  .tp-sequence {
    font-size: 0.95rem;
    word-break: break-all;
  }

  .matrix-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .table-search-box {
    width: 100%;
  }

  /* 4. Velocidad y CTL */
  .vel-number {
    font-size: 2.6rem;
  }
  .ctl-factor {
    font-size: 2.5rem;
  }
  .ctl-grid-details {
    grid-template-columns: 1fr;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .schedules-grid {
    grid-template-columns: 1fr;
  }
  .flange-specs-grid {
    grid-template-columns: 1fr;
  }
  .tr-val-box {
    flex-wrap: wrap;
  }
  .tr-big-number {
    font-size: 2.4rem;
  }
  .f-spec-item .f-value {
    font-size: 1.25rem;
  }
}

