/* ==========================================================================
   Keifa Soil Classification Suite - Geotechnical CSS Design System
   Brand: Keifa Tools (keifa.net)
   ========================================================================== */

:root {
  /* Geotechnical Architectural Studio (Premium Light / Warm Precision) */
  --bg: #f6f8f7;
  --bg-2: #edf2ef;
  --bg-3: #e2e8e4;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --soft: #1e293b;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(15, 23, 42, 0.09);
  --line: rgba(15, 23, 42, 0.08);
  --line-focus: rgba(13, 148, 136, 0.5);

  /* Earth & Laboratory Precision Accents */
  --teal: #0d9488;
  --teal-soft: rgba(13, 148, 136, 0.1);
  --teal-glow: rgba(13, 148, 136, 0.22);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --amber-ink: #78350f;
  --coral: #ea580c;
  --coral-soft: rgba(234, 88, 12, 0.1);
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --purple: #6366f1;
  --purple-soft: rgba(99, 102, 241, 0.1);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 3px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 35px -6px rgba(15, 23, 42, 0.1), 0 8px 16px -4px rgba(15, 23, 42, 0.04);

  --canvas-bg: #ffffff;
  --canvas-border: rgba(15, 23, 42, 0.1);

  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-pill: 6px;
  --trans: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Midnight Slate Dark Mode Override */
[data-theme="dark"] {
  --bg: #071311;
  --bg-2: #0b1a17;
  --bg-3: #102420;
  --ink: #f7fbf4;
  --ink-secondary: #d1ded7;
  --muted: #8fa49a;
  --soft: #e2ece3;
  --panel: rgba(11, 26, 23, 0.85);
  --panel-solid: #102521;
  --panel-glass: rgba(14, 32, 28, 0.72);
  --panel-border: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.1);
  --line-focus: rgba(115, 199, 223, 0.6);

  --teal: #73c7df;
  --teal-soft: rgba(115, 199, 223, 0.16);
  --teal-glow: rgba(115, 199, 223, 0.32);
  --amber: #f0bf63;
  --amber-soft: rgba(240, 191, 99, 0.15);
  --amber-ink: #211604;
  --coral: #e9755f;
  --coral-soft: rgba(233, 117, 95, 0.15);
  --green: #4db888;
  --green-soft: rgba(77, 184, 136, 0.16);
  --purple: #aa88ff;
  --purple-soft: rgba(170, 136, 255, 0.16);

  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.5);

  --canvas-bg: rgba(5, 14, 12, 0.75);
  --canvas-border: var(--line);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(13, 148, 136, 0.08), transparent 50%),
    radial-gradient(circle at 90% 30%, rgba(217, 119, 6, 0.05), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, #edf2ef 50%, var(--bg) 100%);
  font-family: Cairo, Inter, system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 50% 0%, rgba(115, 199, 223, 0.12), transparent 48%),
    linear-gradient(180deg, var(--bg) 0%, #091714 45%, #0c1815 100%);
}

/* LTR Body Override when English is active */
html[dir="ltr"] body {
  font-family: Inter, Cairo, system-ui, -apple-system, sans-serif;
}

/* Background Engineering Blueprint Grid Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 65%, transparent 95%);
}

[data-theme="dark"] body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 25%, #000 40%, transparent 85%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(217, 119, 6, 0.04), transparent 45%),
    radial-gradient(ellipse at 15% 75%, rgba(5, 150, 105, 0.04), transparent 45%);
}

[data-theme="dark"] body::after {
  background:
    radial-gradient(ellipse at 85% 15%, rgba(240, 191, 99, 0.06), transparent 45%),
    radial-gradient(ellipse at 15% 75%, rgba(77, 184, 136, 0.06), transparent 45%);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin-inline: auto;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

.hidden-mobile {
  display: inline-flex;
}

@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

/* ==========================================================================
   Header, Sticky Topbar & World-Class App Navigation
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 40;
  background: var(--bg);
  transition: background 0.3s ease;
}

/* Sticky High-End Navigation Bar */
.app-nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 16px;
  margin-top: 4px;
  margin-bottom: 8px;
  background: var(--panel-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.25s ease;
}

[data-theme="dark"] .app-nav-bar {
  background: rgba(11, 26, 23, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-tab-btn:hover {
  color: var(--ink);
  background: var(--bg-2);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal), #0f766e);
  box-shadow: 0 4px 15px var(--teal-glow);
}

[data-theme="dark"] .nav-tab-btn.active {
  color: #041210;
  background: linear-gradient(135deg, #73c7df, #358ca5);
  box-shadow: 0 0 18px rgba(115, 199, 223, 0.45);
}

.nav-badge-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  animation: pulse 2.5s infinite;
}

.nav-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: #ffffff;
  font-weight: 900;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px var(--teal-glow);
  flex-shrink: 0;
}

[data-theme="dark"] .logo {
  background: linear-gradient(135deg, var(--teal), #358ca5);
  color: #041210;
  box-shadow: 0 0 20px var(--teal-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text b {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  border: 1px solid rgba(13, 148, 136, 0.25);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--panel-border);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
  white-space: nowrap;
}

.action-btn:hover {
  background: var(--bg-2);
  border-color: var(--teal);
  transform: translateY(-1px);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--trans);
  border: 1px solid var(--panel-border);
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  transform: rotate(15deg) scale(1.06);
  border-color: var(--teal);
  box-shadow: 0 0 12px var(--teal-glow);
}

.language-picker select {
  padding: 7px 12px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
}

.language-picker select:focus,
.language-picker select:hover {
  border-color: var(--teal);
}

@media (max-width: 768px) {
  .topbar {
    padding: 10px 0;
    gap: 8px;
  }
  .brand {
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
  }
  .logo {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }
  .brand-text {
    min-width: 0;
    overflow: hidden;
  }
  .brand-text b {
    font-size: 0.96rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .brand-text small {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .top-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .action-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
  }
  .theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
  }
  .language-picker select {
    padding: 6px 8px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 16px);
  }
  .brand-text b {
    font-size: 0.88rem;
  }
  .brand-text small {
    display: none;
  }
  .print-top-btn .btn-text {
    display: none;
  }
  .print-top-btn {
    padding: 6px 9px;
  }
  .top-actions {
    gap: 4px;
  }
}

/* ==========================================================================
   Ad Banner Wrapper
   ========================================================================== */

.ad-wrapper {
  margin: 16px auto 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Hero & Soil Presets
   ========================================================================== */

.hero {
  padding: 28px 0 20px;
}

.hero-copy {
  max-width: 950px;
}

.hero-top-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-spec-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.6px;
}

.eyebrow {
  display: inline-block;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--teal-soft);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.hero h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.7rem);
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--ink) 45%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, #ffffff 40%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  line-height: 1.65;
  margin: 0 0 20px;
}

/* Hero Action CTAs */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.primary-hero-btn {
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: #ffffff;
  border: 1px solid rgba(13, 148, 136, 0.3);
  box-shadow: 0 4px 16px var(--teal-glow);
}

[data-theme="dark"] .primary-hero-btn {
  background: linear-gradient(135deg, #73c7df, #2a7994);
  color: #041210;
  box-shadow: 0 4px 20px rgba(115, 199, 223, 0.4);
}

.primary-hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--teal-glow);
}

.accent-hero-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(234, 88, 12, 0.12));
  color: var(--amber-ink);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .accent-hero-btn {
  background: linear-gradient(135deg, rgba(240, 191, 99, 0.18), rgba(233, 117, 95, 0.18));
  color: #f0bf63;
  border-color: rgba(240, 191, 99, 0.4);
}

.accent-hero-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(234, 88, 12, 0.22));
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}

.hero-btn-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: #ea580c;
  color: #fff;
  font-weight: 800;
}

.secondary-hero-btn {
  background: var(--panel-solid);
  color: var(--ink);
  border: 1px solid var(--panel-border);
}

.secondary-hero-btn:hover {
  background: var(--bg-2);
  border-color: var(--teal);
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .hero-btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    padding: 11px 16px;
  }
}

/* Presets Bar */
.presets-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.presets-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.presets-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--amber);
}

.presets-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 600px) {
  .presets-container {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }
  .preset-chip {
    padding: 7px 11px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
  }
}

.preset-chip:hover,
.preset-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--teal-glow);
}

.preset-chip:hover .preset-code,
.preset-chip.active .preset-code {
  color: #ffffff;
}

.preset-chip .preset-code {
  color: var(--teal);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

/* ==========================================================================
   Smart Workspace Mode Switcher & Inputs vs Outputs Flow
   ========================================================================== */

.workspace-mode-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: -4px;
  padding: 8px 14px;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.mode-switcher-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-2);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.mode-tab-btn .mode-icon {
  font-size: 1rem;
}

.mode-tab-btn:hover {
  color: var(--ink);
  background: rgba(13, 148, 136, 0.08);
}

.mode-tab-btn.active {
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--panel-border);
}

[data-theme="dark"] .mode-tab-btn.active {
  background: var(--panel-solid);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.16);
}

.mode-tab-btn#viewModeInputs.active {
  color: var(--teal);
}

.mode-tab-btn#viewModeResults.active {
  color: var(--amber);
}

.mode-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--teal-soft);
  color: var(--teal);
}

.mode-live-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: var(--radius-xs);
  background: var(--amber-soft);
  color: var(--amber-ink);
  letter-spacing: 0.5px;
}

[data-theme="dark"] .mode-live-pill {
  color: var(--amber);
}

.smart-flow-hint {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  padding-inline: 8px;
}

@media (max-width: 768px) {
  .workspace-mode-toolbar {
    border-radius: var(--radius-md);
    padding: 6px;
    margin-top: 16px;
  }
  .mode-switcher-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 3px;
  }
  .mode-tab-btn {
    min-width: 0;
    padding: 8px 4px;
    font-size: 0.74rem;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
    flex-direction: column;
    gap: 3px;
    border-radius: var(--radius-xs);
  }
  .mode-tab-btn .mode-icon {
    font-size: 1.1rem;
  }
  .mode-badge, .mode-live-pill {
    display: none;
  }
}

/* Station Banners & Badges */
.station-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.station-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.input-station-tag {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.output-station-tag {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .output-station-tag {
  color: var(--amber);
}

.panel-footer-actions {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: flex-end;
}

.jump-action-btn {
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: #fff;
  border: 1px solid rgba(13, 148, 136, 0.3);
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px var(--teal-glow);
  cursor: pointer;
  transition: var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .jump-action-btn {
  background: linear-gradient(135deg, #73c7df, #2a7994);
  color: #041210;
}

.jump-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--teal-glow);
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Workspace Layout: Inputs (Left) & Results (Right) & Smart View Modes
   ========================================================================== */

.workspace-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
  transition: all 0.35s ease;
}

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Focus Inputs Mode */
.workspace-grid[data-workspace-mode="inputs"] {
  grid-template-columns: 1fr;
}

.workspace-grid[data-workspace-mode="inputs"] .results-panel {
  display: none !important;
}

.workspace-grid[data-workspace-mode="inputs"] .input-panel {
  max-width: 960px;
  width: 100%;
  margin-inline: auto;
  animation: fadeIn 0.3s ease;
}

/* Focus Results Mode */
.workspace-grid[data-workspace-mode="results"] {
  grid-template-columns: 1fr;
}

.workspace-grid[data-workspace-mode="results"] .input-panel {
  display: none !important;
}

.workspace-grid[data-workspace-mode="results"] .results-panel {
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
  animation: fadeIn 0.3s ease;
}

.workspace-grid[data-workspace-mode="results"] .standards-cards-grid {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
  .workspace-grid[data-workspace-mode="results"] .standards-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel {
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}

@media (max-width: 600px) {
  .panel {
    padding: 16px;
    border-radius: var(--radius-md);
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .results-header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-icon {
  font-size: 1.5rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
}

.panel-desc {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 2px 0 0;
}

.text-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: var(--trans);
}

.text-btn:hover {
  background: var(--teal-soft);
}

/* ==========================================================================
   Input Form Styles
   ========================================================================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.input-section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.badge-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.section-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.grid-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 600px) {
  .grid-inputs {
    grid-template-columns: 1fr;
  }
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.unit-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.badge-calc {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.input-field input {
  padding: 10px 14px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  outline: none;
  transition: var(--trans);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.input-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
  background: var(--panel-solid);
}

.highlight-field input {
  border-color: rgba(13, 148, 136, 0.4);
  background: var(--teal-soft);
}

.computed-field input {
  background: var(--green-soft);
  border-color: rgba(5, 150, 105, 0.35);
  color: var(--green);
  font-weight: 700;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.gradation-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

@media (max-width: 600px) {
  .gradation-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Soil Fractions Live Bar */
.fractions-meter-card {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.fractions-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.fractions-bar {
  display: flex;
  height: 14px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
}

.frac-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.gravel-seg { background: linear-gradient(90deg, #f0bf63, #d97706); }
.sand-seg   { background: linear-gradient(90deg, #0d9488, #0f766e); }
.fines-seg  { background: linear-gradient(90deg, #ea580c, #c2410c); }

.fractions-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.gravel-dot { background: var(--amber); }
.sand-dot   { background: var(--teal); }
.fines-dot  { background: var(--coral); }

/* Switches row */
.switches-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
  user-select: none;
}

.toggle-pill input {
  display: none;
}

.toggle-switch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  transition: var(--trans);
}

.toggle-pill input:checked + .toggle-switch {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}

.toggle-pill:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

/* Collapsible sections */
.collapsible-section details {
  width: 100%;
}

.section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.summary-toggle-icon {
  font-size: 1.1rem;
  color: var(--teal);
  transition: transform 0.2s ease;
}

details[open] .summary-toggle-icon {
  transform: rotate(180deg);
}

.collapsible-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.section-note {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
}

.small-outline-btn {
  margin-top: 12px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--teal);
  color: var(--teal);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  width: 100%;
}

.small-outline-btn:hover {
  background: var(--teal);
  color: #ffffff;
}

.panel-header .small-outline-btn {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

/* Sieve Table */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.sieve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: center;
}

.sieve-table th {
  background: var(--bg-2);
  color: var(--teal);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.sieve-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.sieve-table input {
  width: 75px;
  padding: 4px 6px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  text-align: center;
  font-size: 0.85rem;
}

.sieve-table input:focus {
  border-color: var(--teal);
}

/* ==========================================================================
   Results Panel & 4 Standards Cards Grid
   ========================================================================== */

.standards-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 650px) {
  .standards-cards-grid {
    grid-template-columns: 1fr;
  }
}

.standard-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  position: relative;
  overflow: hidden;
  transition: var(--trans);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
  .standard-card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }
}

.standard-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.uscs-card {
  border-top: 3px solid var(--teal);
}

.aashto-card {
  border-top: 3px solid var(--amber);
}

.usda-card {
  border-top: 3px solid var(--green);
}

.iso-card {
  border-top: 3px solid var(--purple);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.standard-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.standard-badge {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.uscs-tag   { background: var(--teal-soft); color: var(--teal); }
.aashto-tag { background: var(--amber-soft); color: var(--amber); }
.usda-tag   { background: var(--green-soft); color: var(--green); }
.iso-tag    { background: var(--purple-soft); color: var(--purple); }

.standard-spec {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.card-type-label {
  font-size: 0.75rem;
  color: var(--ink-secondary);
}

.card-hero-result {
  margin-bottom: 12px;
}

.symbol-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.result-symbol {
  font-family: "JetBrains Mono", monospace;
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.uscs-card .result-symbol   { color: var(--teal); }
.aashto-card .result-symbol { color: var(--amber); }
.usda-card .result-symbol   { font-size: 1.5rem; color: var(--green); }
.iso-card .result-symbol    { color: var(--purple); }

.text-symbol {
  font-family: Cairo, Inter, sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
}

.borderline-flag {
  padding: 2px 8px;
  background: var(--coral-soft);
  color: var(--coral);
  border: 1px solid rgba(234, 88, 12, 0.3);
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 700;
}

.gi-badge {
  padding: 3px 10px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
}

.result-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.card-criteria {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.card-criteria ul {
  margin: 4px 0 0;
  padding-inline-start: 16px;
}

.card-criteria li {
  margin-bottom: 3px;
}

/* Engineering Properties Guide */
.engineering-guide-panel {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  padding: 18px;
}

.guide-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.guide-icon {
  font-size: 1.25rem;
}

.guide-title h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--teal);
}

.properties-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 500px) {
  .properties-grid {
    grid-template-columns: 1fr;
  }
}

.prop-box {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prop-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.prop-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

/* ==========================================================================
   Interactive Geotechnical Charts Section
   ========================================================================== */

.charts-section {
  margin-top: 48px;
}

.section-headline {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 28px;
}

.section-headline h2 {
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 800;
  margin: 6px 0 10px;
  color: var(--ink);
}

.section-headline p {
  color: var(--ink-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.charts-tabs-header {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chart-tab {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  color: var(--ink-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.chart-tab:hover {
  background: var(--bg-2);
  border-color: var(--teal);
  color: var(--ink);
}

.chart-tab.active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 4px 14px var(--teal-glow);
}

.chart-container {
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.chart-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.chart-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--teal-soft);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.85rem;
}

.chart-status-badge b {
  color: var(--teal);
  font-family: "JetBrains Mono", monospace;
}

.chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.line-swatch {
  width: 14px;
  height: 4px;
  border-radius: 2px;
}

.a-line-swatch     { background: #e9755f; }
.u-line-swatch     { background: #f0bf63; }
.ll50-swatch       { background: #0d9488; }
.clay-swatch       { background: #e9755f; }
.silt-swatch       { background: #6366f1; }
.sand-swatch       { background: #0d9488; }
.gravel-swatch     { background: #d97706; }
.active-soil-swatch { background: #059669; }

.chart-actions-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  box-shadow: var(--shadow-sm);
}

.chart-action-btn:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--teal-glow);
}

.canvas-scroll-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  margin-top: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) var(--bg-2);
}

.canvas-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.canvas-scroll-container::-webkit-scrollbar-track {
  background: var(--bg-2);
  border-radius: var(--radius-xs);
}

.canvas-scroll-container::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: var(--radius-xs);
}

.canvas-wrapper {
  width: 100%;
  min-width: 820px;
  height: 520px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--canvas-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--canvas-border);
  padding: 14px;
  box-shadow: inset 0 0 24px rgba(15, 23, 42, 0.04);
}

.canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-x pan-y;
}

#usdaChartContainer .canvas-wrapper {
  height: 580px;
}

.canvas-mobile-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px dashed rgba(13, 148, 136, 0.3);
}

.canvas-mobile-hint .hint-icon {
  animation: bounceX 2s infinite ease-in-out;
}

@keyframes bounceX {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

@media (max-width: 900px) {
  .canvas-mobile-hint {
    display: flex;
  }
  .canvas-wrapper {
    min-width: 560px;
    height: 400px;
  }
  #usdaChartContainer .canvas-wrapper {
    min-width: 560px;
    height: 460px;
  }
}

@media (max-width: 768px) {
  .chart-container {
    padding: 14px 10px;
    border-radius: var(--radius-md);
  }
  .chart-tab {
    padding: 7px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
  }
  .charts-tabs-header {
    gap: 6px;
    margin-bottom: 12px;
  }
  .canvas-wrapper {
    min-width: 520px;
    height: 360px;
    padding: 8px;
    border-radius: var(--radius-sm);
  }
  #usdaChartContainer .canvas-wrapper {
    min-width: 520px;
    height: 420px;
  }
  .canvas-mobile-hint {
    font-size: 0.72rem;
    padding: 6px 10px;
  }
}

.chart-notes {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* Fullscreen Chart Modal */
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 14, 12, 0.82);
  backdrop-filter: blur(10px);
}

.chart-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(1200px, 96vw);
  max-height: 94vh;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { transform: scale(0.94) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

.chart-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-badge-icon {
  font-size: 1.4rem;
}

.chart-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.modal-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--trans);
}

.modal-close-btn:hover {
  background: var(--coral-soft);
  color: var(--coral);
  border-color: var(--coral);
  transform: rotate(90deg);
}

.chart-modal-body {
  padding: 18px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.modal-canvas-wrapper {
  width: 100%;
  max-width: 1140px;
  height: 620px;
  background: var(--canvas-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--canvas-border);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 24px rgba(15, 23, 42, 0.04);
}

.modal-canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 768px) {
  .chart-modal-dialog {
    width: 96vw;
    border-radius: var(--radius-md);
  }
  .chart-modal-header {
    padding: 12px 14px;
  }
  .chart-modal-body {
    padding: 10px;
  }
  .modal-canvas-wrapper {
    min-width: 540px;
    height: 400px;
  }
}

/* ==========================================================================
   Standards Comparison Guide Table
   ========================================================================== */

.standards-guide-section {
  margin-top: 48px;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.reference-table th {
  background: var(--bg-2);
  color: var(--teal);
  font-weight: 700;
  text-align: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.reference-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-secondary);
}

.reference-table tr:hover td {
  background: var(--bg-2);
  color: var(--ink);
}

.symbol-pill {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Modern Geotechnical Footer & Trust Strip
   ========================================================================== */

.footer-features-section {
  margin-top: 64px;
  margin-bottom: 24px;
}

.footer-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .footer-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .footer-features-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.feature-badge-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  transition: var(--trans);
}

.feature-badge-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: var(--shadow-md);
}

.feat-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--teal-soft);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.feat-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.feat-info b {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

.feat-info span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Footer Container */
.footer {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding: 48px 0 28px;
  background: linear-gradient(180deg, transparent 0%, rgba(13, 148, 136, 0.03) 100%);
  position: relative;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.7fr 1.15fr 1.15fr 1.15fr;
  gap: 36px;
  margin-bottom: 40px;
}

@media (max-width: 1024px) {
  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

@media (max-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.footer-col-brand .brand {
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 16px;
}

.footer-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.verified-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.footer-col h4 {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--ink);
  position: relative;
  padding-bottom: 8px;
}

.footer-col h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 28px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--teal);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bullet-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--teal-soft);
  color: var(--teal);
  margin-inline-end: 6px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: var(--trans);
  display: inline-flex;
  align-items: center;
}

.footer-links a:hover,
.footer-links a.active-link {
  color: var(--teal);
  transform: translateX(-3px);
}

html[dir="ltr"] .footer-links a:hover,
html[dir="ltr"] .footer-links a.active-link {
  transform: translateX(3px);
}

.footer-action-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--trans);
  text-align: start;
}

.footer-action-link:hover {
  color: var(--teal);
  transform: translateX(-3px);
}

html[dir="ltr"] .footer-action-link:hover {
  transform: translateX(3px);
}

/* Footer Bottom Bar */
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.83rem;
  color: var(--muted);
}

.footer-copy-wrap p {
  margin: 0;
}

.footer-copy-wrap a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 700;
}

.footer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.status-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

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

.version-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.back-to-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  box-shadow: var(--shadow-sm);
}

.back-to-top-btn:hover {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--teal-glow);
}

.back-to-top-btn span {
  display: inline-block;
  transition: transform 0.2s ease;
}

.back-to-top-btn:hover span:first-child {
  transform: translateY(-2px);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  border: 1px solid rgba(13, 148, 136, 0.4);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  backdrop-filter: blur(12px);
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  text-align: center;
}

[data-theme="dark"] .toast {
  background: rgba(10, 24, 21, 0.96);
  border-color: rgba(115, 199, 223, 0.4);
}

.toast:empty {
  display: none !important;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Bridge CTA Banner: Classification ➔ Soil Mix Studio
   ========================================================================== */

.mix-bridge-cta-card {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(217, 119, 6, 0.08) 100%);
  border: 1px solid rgba(13, 148, 136, 0.25);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

[data-theme="dark"] .mix-bridge-cta-card {
  background: linear-gradient(135deg, rgba(115, 199, 223, 0.12) 0%, rgba(240, 191, 99, 0.1) 100%);
  border-color: rgba(115, 199, 223, 0.3);
}

.mix-bridge-cta-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: var(--shadow-md);
}

.bridge-cta-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bridge-cta-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.bridge-cta-text h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}

.bridge-cta-text p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.highlight-accent-btn {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #ffffff;
  border: none;
  font-weight: 800;
  padding: 10px 20px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  white-space: nowrap;
}

.highlight-accent-btn:hover {
  background: linear-gradient(135deg, #d97706, #c2410c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* ==========================================================================
   Soil Mix & Blending Studio (Comprehensive Pro Tool)
   ========================================================================== */

.soil-mix-section {
  padding: 48px 0 32px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.soil-mix-page .soil-mix-section {
  border-top: none;
  margin-top: 0;
  padding-top: 8px;
}

.headline-tag-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pro-tag {
  font-size: 0.76rem;
  font-weight: 800;
  color: #ea580c;
  background: rgba(234, 88, 12, 0.1);
  border: 1px solid rgba(234, 88, 12, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toolbar */
.mix-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 24px;
}

.primary-glass-btn {
  background: var(--panel-solid);
  color: var(--teal);
  border: 1px solid var(--teal);
  font-weight: 700;
}

.primary-glass-btn:hover {
  background: var(--teal-soft);
  transform: translateY(-1px);
}

/* ==========================================================================
   Soil Mix Studio Phase Separation (Inputs Zone vs Outputs Zone)
   ========================================================================== */

.mix-phase-zone {
  margin-bottom: 28px;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mix-inputs-zone {
  background: rgba(13, 148, 136, 0.02);
  border: 1px solid rgba(13, 148, 136, 0.12);
  padding: 24px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .mix-inputs-zone {
  background: rgba(115, 199, 223, 0.025);
  border-color: rgba(115, 199, 223, 0.14);
}

.mix-outputs-zone {
  background: rgba(217, 119, 6, 0.025);
  border: 1px solid rgba(217, 119, 6, 0.14);
  padding: 24px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .mix-outputs-zone {
  background: rgba(240, 191, 99, 0.03);
  border-color: rgba(240, 191, 99, 0.16);
}

.phase-zone-header {
  margin-bottom: 20px;
}

.phase-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.input-phase-badge {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.output-phase-badge {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .output-phase-badge {
  color: var(--amber);
}

.phase-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.mix-zone-bridge {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.jump-to-outputs-btn {
  background: linear-gradient(135deg, var(--teal), #0f766e);
  color: #fff;
  border: 1px solid rgba(13, 148, 136, 0.3);
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px var(--teal-glow);
  cursor: pointer;
  transition: var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}

[data-theme="dark"] .jump-to-outputs-btn {
  background: linear-gradient(135deg, #73c7df, #2a7994);
  color: #041210;
}

.jump-to-outputs-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px var(--teal-glow);
}

.mix-outputs-filter-bar {
  margin-top: 14px;
}

.filter-pills-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-pill-btn {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
}

.filter-pill-btn:hover {
  color: var(--ink);
  background: rgba(217, 119, 6, 0.08);
}

.filter-pill-btn.active {
  background: var(--amber);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .filter-pill-btn.active {
  background: var(--amber);
  color: #071311;
}

@media (max-width: 768px) {
  .mix-inputs-zone, .mix-outputs-zone {
    padding: 16px 12px;
  }
  .filter-pills-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .filter-pill-btn {
    padding: 6px 4px;
    font-size: 0.74rem;
    text-align: center;
  }
}

/* 3-Column Configuration Grid */
.mix-config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.mix-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.mix-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.header-icon-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.mix-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
}

.mix-card-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}

.mix-card-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.mix-status-pill {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.3);
  white-space: nowrap;
}

.target-pill {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.35);
}

[data-theme="dark"] .target-pill {
  color: #aa88ff;
  border-color: rgba(170, 136, 255, 0.35);
}

.additive-pill {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .additive-pill {
  color: #f0bf63;
}

.mix-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.stock-total-mass-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.stock-total-mass-note b {
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
}

.mini-grid-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mini-grid-inputs.atterberg-mini {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 650px) {
  .mini-grid-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .mini-grid-inputs.atterberg-mini {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.mini-grid-inputs .input-field {
  min-width: 0;
}

.mini-grid-inputs .input-field label {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.mini-grid-inputs input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-family: 'JetBrains Mono', monospace;
}

.preset-dropdown {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--trans);
}

.preset-dropdown:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.target-criteria-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
}

.criteria-box-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.target-limits-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.limit-pill {
  font-size: 0.76rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  color: var(--ink);
}

.target-goal-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.goal-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.goal-text b {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.stock-diagnosis-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.diag-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 4px;
}

.diag-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-secondary);
  margin: 0;
}

/* ==========================================================================
   Mix Slider Card
   ========================================================================== */

.mix-slider-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mix-slider-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.slider-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.slider-icon {
  font-size: 1.6rem;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
}

.slider-title-wrap h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.slider-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.solver-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 800;
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.3);
  color: var(--green);
  white-space: nowrap;
}

.solver-badge-status.fail {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(234, 88, 12, 0.35);
  color: var(--coral);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-indicator-dot.fail {
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
}

.ratio-values-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  margin-bottom: 16px;
}

.ratio-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ratio-side.stock-side .ratio-num {
  color: var(--teal);
}

.ratio-side.additive-side .ratio-num {
  color: var(--amber);
}

.ratio-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.ratio-num {
  font-size: 1.8rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.ratio-middle-divider {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--muted);
}

.ratio-slider-wrapper {
  position: relative;
  padding: 8px 0 24px;
}

.mix-range-slider {
  width: 100%;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal) calc(100% - var(--additive-pct, 35%)), var(--amber) calc(100% - var(--additive-pct, 35%)), var(--amber) 100%);
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mix-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--amber);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px var(--amber);
  cursor: grab;
  transition: transform 0.15s ease;
}

.mix-range-slider::-webkit-slider-thumb:hover,
.mix-range-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  cursor: grabbing;
}

.slider-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--muted);
  position: relative;
  margin-top: 6px;
}

.optimal-marker {
  position: absolute;
  transform: translateX(-50%);
  color: #10b981;
  font-weight: 800;
  white-space: nowrap;
}

html[dir="rtl"] .optimal-marker {
  transform: translateX(50%);
}

.slider-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.slider-hint-text {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Mix Results Dashboard
   ========================================================================== */

.mix-results-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.mix-quantities-card,
.mix-transformation-card {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.quantities-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-box.highlight-kpi {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.kpi-val {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
  line-height: 1.2;
}

.kpi-box.highlight-kpi .kpi-val {
  color: var(--amber);
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.recipe-banner-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.recipe-banner-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--teal);
  margin-bottom: 6px;
}

.recipe-banner-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-secondary);
  margin: 0;
}

/* Transformation Before ➔ After */
.transform-comparison-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

.transform-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transform-box.before-box {
  border-right: 4px solid var(--coral);
}

html[dir="ltr"] .transform-box.before-box {
  border-right: 1px solid var(--panel-border);
  border-left: 4px solid var(--coral);
}

.transform-box.after-box {
  border-right: 4px solid var(--green);
  background: rgba(5, 150, 105, 0.05);
}

html[dir="ltr"] .transform-box.after-box {
  border-right: 1px solid var(--panel-border);
  border-left: 4px solid var(--green);
}

.t-badge {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.t-badge.before-badge {
  color: var(--coral);
}

.t-badge.after-badge {
  color: var(--green);
}

.t-symbols {
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-uscs {
  font-size: 1.5rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}

.t-aashto {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
}

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

.t-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.t-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.t-meta div {
  display: flex;
  justify-content: space-between;
}

.t-meta b {
  font-family: 'JetBrains Mono', monospace;
}

.text-success {
  color: var(--green) !important;
}

.status-warn {
  color: var(--coral) !important;
}

.transform-arrow {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--teal);
  display: grid;
  place-items: center;
}

html[dir="rtl"] .transform-arrow {
  transform: scaleX(-1);
}

/* ==========================================================================
   Sieve Verification Table & Gradation Chart
   ========================================================================== */

.mix-table-chart-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 24px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.mix-table-card,
.mix-chart-card {
  width: 100%;
  padding: 24px;
  border-radius: var(--radius-lg);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mix-verification-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.mix-verification-table th,
.mix-verification-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  white-space: nowrap;
}

.mix-verification-table th {
  background: var(--bg-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.2px;
}

.mix-verification-table td {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
}

.mix-verification-table td:first-child,
.mix-verification-table th:first-child {
  font-family: inherit;
  font-weight: 700;
  color: var(--ink);
  white-space: normal;
  min-width: 160px;
}

.status-pill-conform {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill-conform.pass {
  background: rgba(5, 150, 105, 0.12);
  color: var(--green);
}

.status-pill-conform.fail {
  background: rgba(234, 88, 12, 0.12);
  color: var(--coral);
}

.mix-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stock-swatch { background: #d97706; }
.add-swatch { background: #3b82f6; }
.blended-swatch { background: #10b981; }
.band-swatch { background: rgba(16, 185, 129, 0.25); border: 1px dashed #10b981; }

.mix-canvas-wrap {
  width: 100%;
  background: var(--canvas-bg);
  border: 1px solid var(--canvas-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mix-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

.mix-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
}

/* Responsive Overrides for Mix Studio */
@media (max-width: 1100px) {
  .mix-config-grid {
    grid-template-columns: 1fr;
  }
  .mix-results-dashboard,
  .mix-table-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-nav-bar {
    padding: 6px 10px;
  }
  .nav-tab-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  .quantities-kpi-grid {
    grid-template-columns: 1fr;
  }
  .transform-comparison-grid {
    grid-template-columns: 1fr;
  }
  .transform-arrow {
    transform: rotate(90deg) !important;
  }
  .mix-bridge-cta-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Floating Live Results HUD Dock (Fixed Bottom Bar)
   ========================================================================== */

.live-results-hud {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(140px);
  z-index: 95;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  width: min(1080px, calc(100% - 24px));
  max-width: 100%;
}

.live-results-hud.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.hud-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hud-inner {
  background: rgba(10, 24, 21, 0.94);
  border-color: rgba(115, 199, 223, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(115, 199, 223, 0.15);
}

.hud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 1.8s infinite;
}

.hud-chips-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.hud-chips-list::-webkit-scrollbar {
  display: none;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-chip-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.hud-chip-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86rem;
  font-weight: 800;
  color: #38bdf8;
}

.chip-aashto .hud-chip-val {
  color: #facc15;
}

.chip-usda .hud-chip-val {
  color: #4ade80;
}

.chip-cbr .hud-chip-val {
  color: #c084fc;
}

.hud-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.hud-results-btn {
  background: linear-gradient(135deg, #0d9488, #059669);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.hud-results-btn:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.45);
}

.hud-mix-btn {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.hud-mix-btn:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fef3c7;
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.hud-btn-arrow {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

html[dir="rtl"] .hud-btn-arrow {
  transform: scaleX(-1);
}

html[dir="rtl"] .hud-results-btn:hover .hud-btn-arrow {
  transform: scaleX(-1) translateX(3px);
}

html[dir="ltr"] .hud-results-btn:hover .hud-btn-arrow {
  transform: translateX(3px);
}

@media (max-width: 900px) {
  .live-results-hud {
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    width: calc(100% - 16px);
  }
  .hud-inner {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .hud-status {
    display: none;
  }
  .hud-chips-list {
    flex: 1 1 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: visible;
  }
  .hud-actions-group {
    width: 100%;
    display: flex;
    gap: 8px;
    justify-content: center;
  }
  .hud-actions-group .hud-action-btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 7px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hud-chip {
    padding: 3px 7px;
    font-size: 0.74rem;
  }
  .hud-chip-label {
    font-size: 0.66rem;
  }
  .hud-chip-val {
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   Print Geotechnical Laboratory Report Styling (Ad-Free PDF / Print)
   ========================================================================== */

.print-only {
  display: none !important;
}

@page {
  size: A4 portrait;
  margin: 12mm 15mm;
}

@media print {
  /* 1. Reset root formatting for crisp print output */
  html,
  body {
    background: #fff !important;
    color: #111 !important;
    font-family: Arial, "Segoe UI", Roboto, Helvetica, sans-serif !important;
    font-size: 11pt !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 100% !important;
    overflow: visible !important;
  }

  body::before,
  body::after {
    display: none !important;
  }

  /* 2. Hide all normal UI elements and any direct children of body except the report */
  body > *:not(#printReportContainer) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  header,
  nav,
  main,
  footer,
  aside,
  .topbar,
  .hero,
  .workspace-grid,
  .charts-section,
  .standards-guide-section,
  .footer,
  .toast {
    display: none !important;
    visibility: hidden !important;
  }

  /* 3. Comprehensive Google AdSense, Auto-Ads, Anchor Ads, Side Rails & Iframe removal */
  ins,
  ins.adsbygoogle,
  .adsbygoogle,
  .adsbygoogle-noablate,
  .google-auto-placed,
  [class*="google-auto-placed"],
  [class*="adsbygoogle"],
  iframe[id^="aswift"],
  iframe[name^="aswift"],
  iframe[id^="google_ads"],
  iframe[src*="googlesyndication"],
  iframe[src*="doubleclick"],
  iframe[src*="adservice"],
  div[id^="aswift"],
  div[id^="google_ads"],
  div[aria-label*="advertisement" i],
  div[aria-label*="إعلان" i],
  div[data-google-query-id],
  div[data-ad-client],
  div[data-ad-slot],
  .ad-wrapper,
  .ad-container,
  .ad-box {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
    max-width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    top: -99999px !important;
    left: -99999px !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    pointer-events: none !important;
    z-index: -9999 !important;
  }

  /* 4. Lab Report Clean Display */
  #printReportContainer,
  .print-only {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #111 !important;
  }

  .report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 18px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-title-block h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #000;
  }

  .report-title-block h3 {
    font-size: 0.95rem;
    color: #444;
    margin: 0 0 4px;
    font-weight: 600;
  }

  .report-title-block p {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
  }

  .report-meta-box {
    border: 1px solid #999;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.6;
    background: #fafafa;
  }

  .report-section {
    margin-bottom: 18px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 8px;
    background: #f0f0f0;
    padding: 6px 10px;
    border-left: 4px solid #222;
    color: #111;
  }

  html[dir="rtl"] .report-section h4 {
    border-left: none;
    border-right: 4px solid #222;
  }

  .rep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 8px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .rep-table th,
  .rep-table td {
    border: 1px solid #ccc;
    padding: 7px 10px;
    text-align: start;
    vertical-align: middle;
  }

  .rep-table th {
    background: #f8f9fa;
    font-weight: 600;
    width: 28%;
    color: #222;
  }

  .rep-remarks-box {
    border: 1px solid #ccc;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.6;
    background: #fdfdfd;
  }

  .rep-remarks-box p {
    margin: 4px 0;
  }

  .report-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid #ccc;
    font-size: 0.88rem;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
