:root {
  --navy: #00005c;
  --navy-soft: #1c1c6e;
  --purple: #551995;
  --magenta: #ad18ca;
  --cyan: #01adff;
  --bg: #f6f6fb;
  --panel: #ffffff;
  --panel-tint: #f1eefc;
  --text: #1b1b3a;
  --muted: #66667f;
  --border: #e6e4f2;
  --success: #1fa876;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 92, 0.18);
  --shadow-sm: 0 4px 14px -6px rgba(0, 0, 92, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  scroll-margin-top: 84px;
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

.nav-links a:hover {
  opacity: 1;
}

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

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  border-radius: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(120deg, var(--purple), var(--magenta));
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(173, 24, 202, 0.55);
}

.btn-primary:hover {
  box-shadow: 0 10px 26px -8px rgba(173, 24, 202, 0.65);
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.btn-cyan {
  background: var(--cyan);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(1, 173, 255, 0.6);
}

.btn-small {
  padding: 7px 16px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 64px;
  background: radial-gradient(900px circle at 8% -10%, #dfe0ff 0%, transparent 55%),
    radial-gradient(900px circle at 108% 10%, #ffe0f7 0%, transparent 55%);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-tint);
  color: var(--purple);
  border: 1px solid #e2d6f7;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(31, 168, 118, 0.18);
}

.hero h1 {
  font-size: clamp(2.1rem, 3.6vw, 3.1rem);
  line-height: 1.1;
  margin: 0 0 18px;
  color: var(--navy);
  font-weight: 800;
}

.hero h1 span {
  background: linear-gradient(120deg, var(--purple), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 46ch;
  margin: 0 0 30px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.hero-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-stat b {
  display: block;
  font-size: 1.4rem;
  color: var(--navy);
}

.hero-stat span {
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-visual {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-visual-badge {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(0, 0, 92, 0.72);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.hero-visual-ring {
  position: absolute;
  border: 2px solid #3D3D7E;
  border-radius: 50%;
  width: 74px;
  height: 74px;
  top: 70%;
  left: 20%;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.15);
  animation: pulse-ring 2.4s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 0.55; }
}

/* ---------- Sections ---------- */

.section {
  padding: 74px 0;
  border-top: 1px solid var(--border);
}

.section-alt {
  background: #fbfaff;
}

.section-head {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-kicker {
  color: var(--magenta);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.section-head h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  color: var(--navy);
  margin: 0 0 10px;
}

.section-head p {
  color: var(--muted);
  margin: 0;
}

/* ---------- Viewer ---------- */

.viewer-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 22px;
  align-items: start;
}

.viewer-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.viewer-case-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viewer-case-label b {
  color: var(--navy);
  font-size: 0.95rem;
}

.viewer-case-label span {
  font-size: 0.78rem;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-waiting { background: #e3f4ff; color: #01aeff; }
.status-ready { background: #ede2fb; color: var(--purple); }
.status-diagnosed { background: #f7e3fb; color: var(--magenta); }

#demo-viewer {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #0d0620;
}

.viewer-note {
  padding: 12px 18px;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: #fcfbff;
}

.case-switcher {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.case-switch-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.case-switch-btn img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.case-switch-btn .csb-meta b {
  display: block;
  font-size: 0.82rem;
  color: var(--navy);
}

.case-switch-btn .csb-meta span {
  font-size: 0.72rem;
  color: var(--muted);
}

.case-switch-btn:hover {
  border-color: var(--cyan);
}

.case-switch-btn.active {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(85, 25, 149, 0.12);
}

/* AOI overlay markers drawn by OpenSeadragon */

.aoi-marker {
  border: 2px solid #ffce54;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 206, 84, 0.22);
  animation: pulse-ring 2.2s ease-in-out infinite;
  cursor: help;
}

/* ---------- Diagnosis ---------- */

.diagnosis-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 1.05rem;
}

.panel .panel-sub {
  margin: 0 0 18px;
  font-size: 0.82rem;
  color: var(--muted);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.chip {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--cyan);
}

.chip.active {
  background: linear-gradient(120deg, var(--purple), var(--magenta));
  border-color: transparent;
  color: #fff;
}

textarea.report-input {
  width: 100%;
  min-height: 132px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 16px;
}

textarea.report-input:focus,
.chip:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.form-msg {
  font-size: 0.78rem;
  color: var(--magenta);
  margin: -8px 0 12px;
  min-height: 1em;
}

.report-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--panel-tint);
  border: 1px solid #e2d6f7;
  display: none;
}

.report-card.visible {
  display: block;
  animation: fade-in 0.3s ease;
}

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

.report-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.report-card-head b {
  color: var(--navy);
}

.report-card-head span {
  font-size: 0.75rem;
  color: var(--muted);
}

.report-codes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.report-codes span {
  background: #fff;
  border: 1px solid #e2d6f7;
  color: var(--purple);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.report-text {
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0;
}

.viewer-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viewer-history-list li {
  font-size: 0.82rem;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.viewer-history-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.viewer-history-list b {
  color: var(--navy);
  display: block;
  font-size: 0.85rem;
}

/* ---------- Queue ---------- */

.queue-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  justify-content: center;
}

.queue-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 26px;
  text-align: center;
  min-width: 130px;
  box-shadow: var(--shadow-sm);
}

.queue-stat b {
  display: block;
  font-size: 1.5rem;
  color: var(--navy);
}

.queue-stat span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.case-card {
  background: var(--panel);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}

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

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.case-card h4 {
  margin: 0 0 2px;
  font-size: 0.95rem;
  color: var(--navy);
}

.case-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #edecf7;
  overflow: hidden;
  margin: 12px 0 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
}

.case-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Network ---------- */

.network-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.colleague-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.colleague-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.colleague-meta {
  flex: 1;
  min-width: 0;
}

.colleague-meta b {
  display: block;
  font-size: 0.88rem;
  color: var(--navy);
}

.colleague-meta span {
  font-size: 0.75rem;
  color: var(--muted);
}

.share-toggle {
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.share-toggle.shared {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.activity-feed {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  max-height: 380px;
  overflow-y: auto;
}

.activity-feed h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--navy);
}

.activity-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.82rem;
  animation: fade-in 0.3s ease;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */

.footer {
  background: var(--navy);
  color: #cfd0f2;
  padding: 42px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-inner p {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.8;
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  text-decoration: none;
  color: #cfd0f2;
  font-size: 0.82rem;
  opacity: 0.85;
}

.footer-links a:hover {
  opacity: 1;
}

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  max-width: 320px;
}

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

.toast.leaving {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    order: -1;
  }

  .viewer-layout,
  .diagnosis-layout,
  .network-layout {
    grid-template-columns: 1fr;
  }

  .case-switcher {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .case-switch-btn {
    min-width: 220px;
  }
}

@media (max-width: 760px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .nav-actions .btn-ghost {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 56px 0 44px;
  }

  .section {
    padding: 54px 0;
  }
}
