/* =========================================================================
   MMSx Graphs Authority v6 — stylesheet
   Author: MMSx Authority Institute · Dr Neeraj Mehta, PhD
   Design system: navy #0a1628 / #0f2341 · cream #f8f6f0 · gold #c9a84c · amber #FFC107
   Typography: Source Serif 4 (display) · DM Sans (UI) · JetBrains Mono (data)
   Mobile-first. Hardcoded hex preferred over CSS variables for portability.
   ========================================================================= */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: #0a1628;
  color: #f8f6f0;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(255, 193, 7, 0.10), transparent 60%),
    radial-gradient(700px 500px at 110% 10%, rgba(93, 226, 193, 0.08), transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(201, 168, 76, 0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- animated EMG waveform background ---------- */
.bg-wave {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}
.bg-wave svg { width: 100%; height: 100%; }
.wave {
  stroke-dasharray: 1600 4000;
  stroke-dashoffset: 0;
}
.wave.w1 { animation: waveDrift 22s linear infinite; }
.wave.w2 { animation: waveDrift 30s linear infinite reverse; }
.wave.w3 { animation: waveDrift 45s linear infinite; }

@keyframes waveDrift {
  0%   { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -3200; }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 22, 40, 0.78);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}
.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f2341, #1a3358);
  border: 1px solid rgba(255, 193, 7, 0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(255, 193, 7, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f8f6f0;
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px;
  color: #8a9bb4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 3px;
}
.topbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.live-pill, .cite-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: #cbd5e1;
}
.cite-pill strong { color: #c9a84c; font-weight: 600; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #FFC107;
  box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
  animation: pulseLive 1.8s ease-out infinite;
}
@keyframes pulseLive {
  0%   { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* ---------- layout shell ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(15, 35, 65, 0.85), rgba(10, 22, 40, 0.95)),
    radial-gradient(800px 400px at 100% 0%, rgba(255, 193, 7, 0.10), transparent 60%);
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 28px;
  padding: 28px 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  animation: heroIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes heroIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hero::after {
  content: '';
  position: absolute;
  right: -120px; top: -120px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.22), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
}

.hero-tag { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #c9a84c, #d4b566);
  color: #0a1628;
  border-radius: 999px;
}
.tag-chip.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.85rem, 4.6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  color: #f8f6f0;
  font-variation-settings: 'opsz' 48;
}
.hero h1::first-line { color: #f8f6f0; }
.hero-lede {
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  line-height: 1.65;
  color: #b8c5d6;
  max-width: 760px;
  margin: 0 0 22px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.hs {
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.hs::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #FFC107, #c9a84c);
  opacity: 0.7;
}
.hs b {
  display: block;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  color: #FFC107;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hs span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a9bb4;
  margin-top: 6px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #f8f6f0;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.09); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, #FFC107, #c9a84c);
  color: #0a1628;
  border-color: transparent;
  box-shadow: 0 8px 24px -8px rgba(255, 193, 7, 0.55);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #FFCD3A, #d4b566);
  box-shadow: 0 12px 30px -10px rgba(255, 193, 7, 0.7);
}
.btn-ghost { background: transparent; }

.hero-visual {
  position: relative;
  height: 220px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 35, 65, 0.6), rgba(10, 22, 40, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.hero-visual canvas { width: 100% !important; height: 100% !important; }
.hero-visual-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hv-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a9bb4;
}
.hv-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #c9a84c;
}
.hv-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #FFC107;
  box-shadow: 0 0 8px #FFC107;
  animation: pulseLive 1.5s ease-out infinite;
}

/* ---------- workbench grid ---------- */
.workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

/* ---------- side panel (database) ---------- */
.panel {
  background: rgba(15, 35, 65, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 14px 50px -20px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.side {
  padding: 18px;
  position: relative;
  animation: panelIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.side h2, .card h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  letter-spacing: -0.01em;
  color: #f8f6f0;
}
.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

.search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.search-ico {
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  color: #8a9bb4;
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 12px 36px 12px 38px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #f8f6f0;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus {
  border-color: #FFC107;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15);
}
.search-clear {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #8a9bb4;
  font-size: 20px;
  width: 24px; height: 24px;
  cursor: pointer;
  border-radius: 50%;
  display: none;
}
.search-clear:hover { background: rgba(255, 255, 255, 0.06); color: #f8f6f0; }
.search-wrap.has-text .search-clear { display: block; }

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.filters select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f8f6f0;
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a9bb4' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.statgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat b {
  display: block;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #FFC107;
  line-height: 1;
}
.stat small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a9bb4;
  margin-top: 4px;
}

.ds-version {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  font-size: 11px;
}
.ds-version span { color: #8a9bb4; letter-spacing: 0.05em; text-transform: uppercase; }
.ds-version code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #c9a84c;
}

.list {
  display: grid;
  gap: 6px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.list::-webkit-scrollbar-track { background: transparent; }

.item {
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  position: relative;
}
.item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 193, 7, 0.25);
}
.item.active {
  background: rgba(255, 193, 7, 0.08);
  border-color: #FFC107;
}
.item.active::before {
  content: '';
  position: absolute;
  left: -1px; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 2px;
  background: #FFC107;
}
.item b {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  color: #f8f6f0;
  margin-bottom: 3px;
  line-height: 1.25;
}
.item small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #8a9bb4;
  letter-spacing: 0.02em;
}

/* ---------- main column ---------- */
.main {
  display: grid;
  gap: 18px;
}

.card { padding: 22px 20px; animation: panelIn 0.5s ease-out both; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #8a9bb4;
  line-height: 1.5;
}

/* Title card */
.title-card {
  background: linear-gradient(135deg, rgba(15, 35, 65, 0.75), rgba(10, 22, 40, 0.6));
  border-color: rgba(201, 168, 76, 0.18);
}
.title-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
.title-left { min-width: 0; }
.uid-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #8a9bb4;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.uid-line span { display: inline; }
.dot-sep { color: rgba(255, 255, 255, 0.25); }
.claim-pill {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.4);
  color: #FFC107;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#exerciseTitle {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: #f8f6f0;
}

.title-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 11.5px;
  color: #cbd5e1;
  font-weight: 500;
}
.badge.gold {
  background: rgba(201, 168, 76, 0.12);
  border-color: rgba(201, 168, 76, 0.35);
  color: #c9a84c;
}

.title-right {
  display: flex;
  justify-content: flex-start;
}
.evidence-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 130px;
}
.ev-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a9bb4;
  margin-bottom: 4px;
}
.ev-grade {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: #FFC107;
  letter-spacing: -0.02em;
}
.ev-conf {
  margin-top: 4px;
  font-size: 11px;
  color: #b8c5d6;
}

/* Mode bar */
.modebar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mode-btn {
  flex: 1;
  min-width: max-content;
  padding: 9px 14px;
  background: transparent;
  border: none;
  color: #8a9bb4;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.mode-btn:hover { color: #f8f6f0; }
.mode-btn.active {
  background: linear-gradient(135deg, #FFC107, #c9a84c);
  color: #0a1628;
  box-shadow: 0 4px 12px -4px rgba(255, 193, 7, 0.5);
}

.mode-note {
  font-size: 13px;
  color: #b8c5d6;
  margin: 0 0 10px;
  padding: 10px 14px;
  background: rgba(255, 193, 7, 0.05);
  border-left: 2px solid #FFC107;
  border-radius: 0 10px 10px 0;
  line-height: 1.55;
}
.detail-text {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0;
}

/* ---------- chart card ---------- */
.chart-card {}
.chart-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 999px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip-btn:hover { background: rgba(255, 255, 255, 0.1); }
.chip-btn.active {
  background: rgba(255, 193, 7, 0.15);
  border-color: #FFC107;
  color: #FFC107;
}

.chart-host {
  position: relative;
  height: 320px;
  background: linear-gradient(180deg, rgba(15, 35, 65, 0.4), rgba(10, 22, 40, 0.6));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
  margin-bottom: 14px;
}
.chart-host canvas { width: 100% !important; height: 100% !important; }

.upload-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.upload-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-box:hover { border-color: #FFC107; background: rgba(255, 193, 7, 0.04); }
.upload-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255, 193, 7, 0.1);
  color: #FFC107;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.upload-text { flex: 1; min-width: 0; }
.upload-text strong { display: block; font-size: 13.5px; color: #f8f6f0; margin-bottom: 2px; }
.upload-text span { display: block; font-size: 11.5px; color: #8a9bb4; line-height: 1.5; }
.upload-text code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #c9a84c;
  background: rgba(201, 168, 76, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}
.upload-text em {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #b8c5d6;
  font-style: normal;
}

.vscore {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}
.vscore-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a9bb4;
}
.vscore-ring {
  position: relative;
  width: 64px; height: 64px;
  flex-shrink: 0;
}
.vscore-ring svg { width: 100%; height: 100%; }
.vscore-ring span {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #FFC107;
}
#vRingFill { transition: stroke-dasharray 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.vscore-tier {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #b8c5d6;
  letter-spacing: 0.02em;
  flex: 1;
  line-height: 1.4;
}

/* ---------- dual card (BPIT + Risk) ---------- */
.dual-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.bpit-radar-host {
  position: relative;
  height: 220px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  margin-bottom: 14px;
}
.bpit-radar-host canvas { width: 100% !important; height: 100% !important; }
.bpit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.meter {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.meter b {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: #f8f6f0;
  text-transform: capitalize;
  margin-bottom: 8px;
  font-weight: 600;
}
.meter-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.meter-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5de2c1, #FFC107, #ff9bb3);
  border-radius: 999px;
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.meter small {
  display: block;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #8a9bb4;
  letter-spacing: 0.02em;
}
.meter .meter-val {
  position: absolute;
  top: 12px; right: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #FFC107;
}

/* ---------- phase model ---------- */
.phase-track {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.phase {
  position: relative;
  padding: 14px 16px 14px 50px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.phase-num {
  position: absolute;
  left: 14px; top: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFC107, #c9a84c);
  color: #0a1628;
  display: grid; place-items: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 13px;
}
.phase-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.phase-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 14.5px;
  color: #f8f6f0;
  letter-spacing: -0.01em;
}
.phase-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #c9a84c;
  background: rgba(201, 168, 76, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
}
.phase-q {
  font-size: 13px;
  color: #b8c5d6;
  margin: 0 0 4px;
  line-height: 1.5;
  font-style: italic;
}
.phase-mech {
  font-size: 12px;
  color: #8a9bb4;
  margin: 0;
  line-height: 1.5;
}

/* ---------- muscle grid ---------- */
.muscle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mtag {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  position: relative;
}
.mtag.primary { border-color: rgba(255, 193, 7, 0.35); background: rgba(255, 193, 7, 0.05); }
.mtag b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #f8f6f0;
  margin-bottom: 2px;
}
.mtag span {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #8a9bb4;
}
.mtag.primary span { color: #FFC107; }

/* ---------- references ---------- */
.ref-grid { display: grid; gap: 10px; margin-bottom: 16px; }
.ref {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.ref b {
  display: block;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 13.5px;
  color: #f8f6f0;
  margin-bottom: 4px;
  line-height: 1.4;
}
.ref-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #c9a84c;
  margin-bottom: 6px;
}
.ref p {
  font-size: 12.5px;
  color: #8a9bb4;
  margin: 0;
  line-height: 1.5;
}

.cite-block label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a9bb4;
  margin-bottom: 8px;
}
.cite-block label strong { color: #f8f6f0; font-weight: 600; }
.copy-btn {
  padding: 4px 12px;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #FFC107;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.copy-btn:hover { background: rgba(255, 193, 7, 0.18); }
.copy-btn.copied { background: rgba(93, 226, 193, 0.15); border-color: #5de2c1; color: #5de2c1; }
#citationText {
  width: 100%;
  background: rgba(10, 22, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #cbd5e1;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}

/* ---------- disclaimers ---------- */
.disclaim-card { border-color: rgba(255, 155, 100, 0.18); background: linear-gradient(135deg, rgba(50, 30, 20, 0.3), rgba(15, 35, 65, 0.4)); }
.disclaim-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.disclaim-list li {
  padding: 12px 14px 12px 36px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  font-size: 12.5px;
  color: #b8c5d6;
  line-height: 1.55;
  position: relative;
}
.disclaim-list li::before {
  content: '!';
  position: absolute;
  left: 12px; top: 13px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255, 193, 7, 0.18);
  color: #FFC107;
  display: grid; place-items: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 11px;
}
.disclaim-list strong { color: #f8f6f0; }

/* ---------- compare drawer ---------- */
.compare-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 460px;
  background: rgba(10, 22, 40, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(201, 168, 76, 0.2);
  z-index: 200;
  padding: 22px 18px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.6);
}
.compare-drawer.open { transform: translateX(0); }
.compare-drawer[hidden] { display: block; }
.cd-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.cd-head h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.2rem; font-weight: 600; margin: 0;
}
.cd-sub { font-size: 12.5px; color: #8a9bb4; margin: 0 0 14px; line-height: 1.5; }
.cd-search { margin-bottom: 12px; }
.cd-list {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 14px;
}
.cd-selected {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
  min-height: 32px;
}
.cd-selected .chip {
  padding: 5px 10px 5px 12px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: #FFC107;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cd-selected .chip button {
  background: transparent;
  border: none;
  color: #FFC107;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.cd-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.cd-result { padding: 14px; background: rgba(255, 255, 255, 0.03); border-radius: 14px; }
.cd-result canvas { width: 100% !important; height: 280px !important; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFC107, #c9a84c);
  color: #0a1628;
  border: none;
  box-shadow: 0 12px 30px -6px rgba(255, 193, 7, 0.55);
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 100;
  transition: transform 0.15s;
}
.fab:hover { transform: translateY(-2px) scale(1.05); }
.fab:active { transform: scale(0.95); }

/* ---------- PDF overlay ---------- */
.pdf-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: grid;
  place-items: center;
}
.pdf-overlay[hidden] { display: none; }
.pdf-card {
  background: rgba(15, 35, 65, 0.95);
  border: 1px solid rgba(255, 193, 7, 0.25);
  border-radius: 24px;
  padding: 36px 44px;
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  max-width: 90%;
}
.pdf-spinner {
  width: 48px; height: 48px;
  margin: 0 auto 18px;
  border: 3px solid rgba(255, 193, 7, 0.15);
  border-top-color: #FFC107;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8f6f0;
  margin-bottom: 6px;
}
.pdf-step {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #c9a84c;
  letter-spacing: 0.02em;
}

/* ---------- footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  background: rgba(10, 22, 40, 0.7);
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  padding: 28px 18px 22px;
  margin-top: 40px;
}
.foot-grid {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.foot-grid > div {
  font-size: 12px;
  color: #8a9bb4;
  line-height: 1.55;
}
.foot-grid strong {
  display: block;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 13px;
  color: #c9a84c;
  margin-bottom: 4px;
  letter-spacing: 0;
  text-transform: none;
}
.foot-grid p { margin: 0; font-size: 11.5px; }
.foot-grid a { color: #FFC107; text-decoration: none; }
.foot-grid a:hover { text-decoration: underline; }
.foot-bottom {
  max-width: 1480px;
  margin: 0 auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: #6b7a92;
  display: grid;
  gap: 4px;
}

/* ---------- hidden PDF stage ---------- */
#pdfStage {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px;   /* A4 width at 96dpi */
  background: white;
  color: #0a1628;
}

/* ============================================================
   RESPONSIVE — tablet and desktop
   ============================================================ */

@media (min-width: 720px) {
  .topbar-inner { padding: 14px 22px; }
  .brand-name { font-size: 16px; }
  .app { padding: 24px 22px 100px; }
  .hero { padding: 36px 32px; grid-template-columns: 1.4fr 1fr; gap: 28px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .hero-visual { height: 100%; min-height: 280px; }
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .dual-card { grid-template-columns: 1fr 1fr; }
  .muscle-grid { grid-template-columns: 1fr 1fr 1fr; }
  .upload-row { grid-template-columns: 1fr 200px; align-items: stretch; }
  .title-row { grid-template-columns: 1fr auto; }
  .foot-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 22px; }
  .foot-bottom { flex-direction: row; justify-content: space-between; display: flex; }
  .fab { display: none; }
}

@media (min-width: 1080px) {
  .workbench { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .side { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow-y: auto; }
  .side .list { max-height: calc(100vh - 480px); }
  .bpit-grid, .risk-grid { grid-template-columns: 1fr 1fr 1fr; }
  .chart-host { height: 380px; }
  .hero h1 { font-size: 3.4rem; }
}

@media (min-width: 1280px) {
  .bpit-grid { grid-template-columns: 1fr 1fr; }
  .risk-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ============================================================
   PRINT — used when user uses browser Print as fallback
   ============================================================ */

@media print {
  body { background: white !important; color: #0a1628 !important; }
  .topbar, .footer, .fab, .hero-actions, .modebar, .upload-row, .chart-controls,
  .side, .compare-drawer, .pdf-overlay, .bg-wave, .topbar-right, body::before {
    display: none !important;
  }
  .app { padding: 0; max-width: none; }
  .panel, .card, .hero { background: white !important; color: #0a1628 !important; border: 1px solid #cbd5e1 !important; box-shadow: none !important; backdrop-filter: none !important; page-break-inside: avoid; }
  .hero h1, #exerciseTitle, .card h3, .side h2 { color: #0a1628 !important; font-family: 'Source Serif 4', Georgia, serif !important; }
  .badge, .tag-chip, .claim-pill { background: #f3f4f6 !important; color: #0a1628 !important; border-color: #d1d5db !important; }
  .meter, .phase, .ref, .stat, .hs, .mtag { background: #f9fafb !important; border-color: #e5e7eb !important; }
  .meter b, .phase-name, .ref b, .mtag b { color: #0a1628 !important; }
  .meter small, .phase-mech, .ref p, .mtag span, .card-sub { color: #4b5563 !important; }
  .ev-grade, .stat b, .hs b { color: #0f2341 !important; }
  .meter-bar i { background: #c9a84c !important; }
  .uid-line, .ref-meta { color: #6b7280 !important; }
  .hero, .card { break-inside: avoid; margin-bottom: 14px; }
}

/* ========================================================================
   v6.1 — Multi-language (RTL) support, language switcher, brand pill,
   white-label branding modal, and off-screen print sheet.
   ======================================================================== */

/* --- Devanagari + Arabic typography overrides --- */
html[lang="hi"] body,
html[lang="hi"] .hero h1,
html[lang="hi"] .panel-h h3,
html[lang="hi"] .brand-meta,
html[lang="hi"] .modal-card,
html[lang="hi"] .site-footer {
  font-family: 'Noto Sans Devanagari', 'DM Sans', system-ui, sans-serif;
}
html[lang="hi"] .hero h1,
html[lang="hi"] .title-card h2,
html[lang="hi"] .panel-h h3 {
  font-family: 'Noto Sans Devanagari', 'Source Serif 4', serif;
  font-weight: 700;
}

html[lang="ar"] body,
html[lang="ar"] .hero h1,
html[lang="ar"] .panel-h h3,
html[lang="ar"] .brand-meta,
html[lang="ar"] .modal-card,
html[lang="ar"] .site-footer {
  font-family: 'Noto Naskh Arabic', 'DM Sans', system-ui, sans-serif;
}
html[lang="ar"] .hero h1,
html[lang="ar"] .title-card h2,
html[lang="ar"] .panel-h h3 {
  font-family: 'Noto Naskh Arabic', 'Source Serif 4', serif;
  font-weight: 700;
}

/* --- RTL layout flips --- */
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .topbar-inner,
html[dir="rtl"] .topbar-right,
html[dir="rtl"] .brand-block,
html[dir="rtl"] .hero,
html[dir="rtl"] .hero-tag,
html[dir="rtl"] .hero-stats,
html[dir="rtl"] .hero-actions,
html[dir="rtl"] .tc-row1,
html[dir="rtl"] .badges,
html[dir="rtl"] .evidence-block,
html[dir="rtl"] .mode-bar,
html[dir="rtl"] .chart-foot,
html[dir="rtl"] .modal-f,
html[dir="rtl"] .sf-grid,
html[dir="rtl"] .compare-drawer header {
  flex-direction: row-reverse;
}
html[dir="rtl"] .workbench { direction: rtl; }
html[dir="rtl"] .ex-list,
html[dir="rtl"] .refs-list,
html[dir="rtl"] .disclaim-list,
html[dir="rtl"] .phase-track { padding-right: 0; }
html[dir="rtl"] .panel,
html[dir="rtl"] .site-footer,
html[dir="rtl"] .modal-card { text-align: right; }
html[dir="rtl"] .compare-drawer { left: 0; right: auto; transform: translateX(-100%); }
html[dir="rtl"] .compare-drawer.open { transform: translateX(0); }
html[dir="rtl"] .fab { right: auto; left: 18px; }
html[dir="rtl"] .val-ring { transform: scaleX(-1); }
html[dir="rtl"] .val-ring text { transform: scaleX(-1); transform-origin: center; }
html[dir="rtl"] .live-pill .live-dot { margin-right: 0; margin-left: 8px; }

/* The canvas charts themselves do not flip — numeric x-axis 0→100 remains
   universal regardless of script direction. Only the surrounding chrome flips. */

/* --- Language switcher --- */
.lang-switcher {
  display: inline-flex;
  gap: 4px;
  background: rgba(15, 35, 65, .6);
  border: 1px solid rgba(201, 168, 76, .25);
  border-radius: 999px;
  padding: 3px;
}
.lang-pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c9c0a8;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: .01em;
  transition: background .18s ease, color .18s ease;
  min-width: 38px;
}
.lang-pill:hover { color: #f8f6f0; background: rgba(255, 193, 7, .08); }
.lang-pill.active {
  background: linear-gradient(135deg, #FFC107 0%, #c9a84c 100%);
  color: #0a1628;
  box-shadow: 0 1px 0 rgba(255, 193, 7, .35) inset, 0 4px 12px rgba(255, 193, 7, .18);
}

/* Hindi & Arabic glyphs need a touch more line-height in pills */
.lang-pill[data-lang="hi"],
.lang-pill[data-lang="ar"] { font-size: 13px; line-height: 1.1; }

/* --- Icon button (settings cog) --- */
.icon-btn {
  appearance: none;
  border: 1px solid rgba(201, 168, 76, .3);
  background: rgba(15, 35, 65, .5);
  color: #f8f6f0;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
.icon-btn:hover { background: rgba(255, 193, 7, .12); border-color: #FFC107; transform: rotate(20deg); }
.icon-btn:focus-visible { outline: 2px solid #FFC107; outline-offset: 2px; }

/* --- User brand pill in topbar --- */
.brand-pill-user {
  display: inline-block;
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(93, 226, 193, .15), rgba(255, 193, 7, .12));
  border: 1px solid rgba(93, 226, 193, .4);
  color: #5de2c1;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[dir="rtl"] .brand-pill-user { margin-left: 0; margin-right: 12px; }

/* --- Modal (white-label branding) --- */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: modal-fade .18s ease;
}
.modal[hidden] { display: none; }
@keyframes modal-fade { from { opacity: 0 } to { opacity: 1 } }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 22, 40, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f2341 0%, #0a1628 100%);
  border: 1px solid rgba(201, 168, 76, .35);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 193, 7, .08) inset;
  padding: 24px;
  color: #f8f6f0;
}
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(201, 168, 76, .2);
}
.modal-h h3 {
  margin: 0;
  font-family: 'Source Serif 4', serif;
  font-size: 22px;
  font-weight: 700;
  color: #FFC107;
  letter-spacing: -.01em;
}
.modal-intro {
  font-size: 13.5px;
  line-height: 1.55;
  color: #c9c0a8;
  margin: 12px 0 18px;
}
.modal-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 540px) {
  .modal-form { grid-template-columns: 1fr 1fr; }
  .modal-form .fld:nth-child(1),
  .modal-form .fld:nth-child(6) { grid-column: 1 / -1; }
}
.modal-form .fld { display: flex; flex-direction: column; gap: 4px; }
.modal-form .fld span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #c9a84c;
}
.modal-form input[type="text"],
.modal-form input[type="file"] {
  appearance: none;
  border: 1px solid rgba(201, 168, 76, .25);
  background: rgba(10, 22, 40, .6);
  color: #f8f6f0;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  transition: border-color .15s ease, background .15s ease;
}
.modal-form input[type="text"]:focus {
  border-color: #FFC107;
  background: rgba(15, 35, 65, .85);
  outline: 2px solid rgba(255, 193, 7, .25);
  outline-offset: 1px;
}
.logo-preview {
  margin-top: 8px;
  padding: 10px;
  background: #f8f6f0;
  border-radius: 8px;
  display: inline-flex;
}
.logo-preview img { max-height: 50px; max-width: 200px; display: block; }
.modal-f {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 168, 76, .2);
}
.modal-status {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(93, 226, 193, .12);
  border: 1px solid rgba(93, 226, 193, .3);
  border-radius: 8px;
  color: #5de2c1;
  font-size: 13px;
  min-height: 0;
}
.modal-status:empty { display: none; }

/* --- Off-screen print sheet for raster PDF (HI / AR) --- */
.print-sheet {
  position: fixed;
  top: -10000px; left: -10000px;
  width: 794px;            /* A4 width @ 96dpi */
  background: #ffffff;
  color: #0a1628;
  font-family: 'DM Sans', 'Noto Sans Devanagari', 'Noto Naskh Arabic', sans-serif;
  z-index: -1;
  pointer-events: none;
}
.print-sheet .ps-page {
  width: 794px;
  min-height: 1123px;       /* A4 height @ 96dpi */
  padding: 56px 64px;
  box-sizing: border-box;
  background: #ffffff;
  position: relative;
  page-break-after: always;
}
.print-sheet .ps-masthead {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid #0f2341;
  padding-bottom: 14px;
  margin-bottom: 22px;
}
.print-sheet .ps-org { font-family: 'Source Serif 4', serif; font-weight: 700; font-size: 22px; color: #0f2341; line-height: 1.15; max-width: 70%; }
.print-sheet .ps-org small { display: block; font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; color: #6a6657; margin-top: 4px; letter-spacing: .02em; }
.print-sheet .ps-logo img { max-height: 56px; max-width: 200px; }
.print-sheet h1 { font-family: 'Source Serif 4', serif; font-size: 26px; font-weight: 700; color: #0f2341; margin: 6px 0 8px; letter-spacing: -.01em; }
.print-sheet h2 { font-family: 'Source Serif 4', serif; font-size: 18px; font-weight: 600; color: #c9a84c; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid #e8e2d0; }
.print-sheet .ps-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.print-sheet .ps-pill { background: #f4eedb; border: 1px solid #c9a84c; color: #6e5a1d; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.print-sheet .ps-pill.dark { background: #0f2341; border-color: #0f2341; color: #FFC107; }
.print-sheet .ps-lead { font-size: 13px; line-height: 1.6; color: #2a2a26; margin: 14px 0; }
.print-sheet .ps-fig { width: 100%; background: #fafaf6; border: 1px solid #e8e2d0; border-radius: 6px; padding: 12px; box-sizing: border-box; }
.print-sheet .ps-fig img { width: 100%; height: auto; display: block; }
.print-sheet .ps-caption { font-size: 11.5px; color: #6a6657; margin-top: 8px; font-style: italic; }
.print-sheet .ps-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.print-sheet .ps-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.print-sheet .ps-risk-cell { background: #fafaf6; border: 1px solid #e8e2d0; border-radius: 6px; padding: 10px; }
.print-sheet .ps-risk-cell .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #6a6657; font-weight: 600; }
.print-sheet .ps-risk-cell .val { font-family: 'JetBrains Mono', monospace; font-size: 18px; color: #0f2341; font-weight: 700; }
.print-sheet .ps-risk-cell .bar { height: 4px; background: #e8e2d0; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.print-sheet .ps-risk-cell .bar > i { display: block; height: 100%; background: linear-gradient(90deg, #FFC107, #c9a84c); border-radius: 99px; }
.print-sheet .ps-phase { background: #fafaf6; border-left: 4px solid #c9a84c; padding: 12px 14px; margin: 8px 0; border-radius: 0 6px 6px 0; }
.print-sheet .ps-phase b { color: #0f2341; font-family: 'Source Serif 4', serif; font-size: 14px; }
.print-sheet .ps-phase p { margin: 4px 0; font-size: 12.5px; line-height: 1.5; color: #2a2a26; }
.print-sheet .ps-muscle-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }
.print-sheet .ps-muscle-list li { padding: 4px 0; border-bottom: 1px dotted #e8e2d0; }
.print-sheet .ps-disclaim { background: #fff5e6; border: 1px solid #e6c97a; border-radius: 6px; padding: 12px 14px; }
.print-sheet .ps-disclaim li { font-size: 11.5px; line-height: 1.55; margin: 4px 0; color: #5a4a1a; }
.print-sheet .ps-footer {
  position: absolute;
  bottom: 28px; left: 64px; right: 64px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid #e8e2d0;
  padding-top: 8px;
  font-size: 9.5px;
  color: #6a6657;
}
.print-sheet[dir="rtl"] { direction: rtl; }
.print-sheet[dir="rtl"] .ps-phase { border-left: 0; border-right: 4px solid #c9a84c; border-radius: 6px 0 0 6px; }
.print-sheet[dir="rtl"] .ps-footer { flex-direction: row-reverse; }
