/* ============================================================
   FRNDBIS MEDICAL HEMP AI - STITCH MCP REDESIGN v3.1 (Fixes)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --bg-0: #040810;
  --bg-1: #070d1a;
  --green: #10b981; --cyan: #06b6d4;
  --purple: #8b5cf6; --amber: #f59e0b;
  --rose: #f43f5e; --blue: #3b82f6;
  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --headline: 'Sora', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background-color: var(--bg-0);
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 5%, rgba(16,185,129,0.07) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 95%, rgba(6,182,212,0.06) 0%, transparent 50%);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; background: none; font-family: var(--font); }

/* ── Glass Card ── */
.glass-card {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16,185,129,0.18);
  box-shadow: 0 4px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: border-color .25s, box-shadow .25s, transform .2s;
}
.glass-card:hover {
  border-color: rgba(16,185,129,0.4);
  box-shadow: 0 0 24px rgba(16,185,129,0.14), 0 4px 40px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

/* ── Text Gradient ── */
.text-gradient {
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 60%, #8b5cf6 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px; min-height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid rgba(16,185,129,0.1);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 200;
  padding: 1.5rem 0;
  transition: transform 0.3s ease;
  overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand { padding: 0 1.25rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 1rem; }
.brand-icon-wrap {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 0.6rem;
  box-shadow: 0 0 20px rgba(16,185,129,0.3);
}
.brand-title { font-family: var(--headline); font-size: 1.05rem; font-weight: 900; color: #10b981; }
.brand-subtitle { font-size: 0.63rem; color: rgba(255,255,255,0.28); font-family: var(--mono); }

.nav-section-label {
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.2);
  padding: 0.9rem 1.25rem 0.45rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem; margin: 0 0.5rem;
  border-radius: 10px; cursor: pointer;
  font-size: 0.82rem; font-weight: 500;
  color: rgba(255,255,255,0.5);
  transition: all 0.15s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: #10b981 !important;
  background: linear-gradient(90deg, rgba(16,185,129,0.12), transparent);
  border-right: 3px solid #10b981;
  font-weight: 600;
}
.nav-item i { width: 16px; text-align: center; font-size: 0.72rem; }

.sidebar-footer { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar-tag { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: rgba(255,255,255,0.45); }

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; right: 0;
  width: calc(100% - 260px); height: 58px; z-index: 100;
  background: rgba(4,8,16,0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
}
.topbar-left h2 { font-family: var(--headline); font-size: 0.92rem; font-weight: 700; color: #fff; }
.topbar-sub { font-size: 0.63rem; color: rgba(255,255,255,0.3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }

/* ── Main ── */
.main-content { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; overflow-y: auto; padding-top: 58px; width: calc(100% - 260px); }
.page { display: none; padding: 1.75rem; width: 100%; max-width: 100%; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Pulse ── */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981; display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge-green  { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-cyan   { background: rgba(6,182,212,0.15);  color: #22d3ee; border: 1px solid rgba(6,182,212,0.3); }
.badge-purple { background: rgba(139,92,246,0.15); color: #c084fc; border: 1px solid rgba(139,92,246,0.3); }
.badge-amber  { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-rose   { background: rgba(244,63,94,0.15);  color: #fb7185; border: 1px solid rgba(244,63,94,0.3); }
.badge-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }

/* ── Chips ── */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.chip-green { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #10b981; }
.chip-cyan  { background: rgba(6,182,212,0.12);  border: 1px solid rgba(6,182,212,0.3);  color: #06b6d4; }

/* ── Icon buttons ── */
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 0.85rem; transition: all 0.15s;
}
.icon-btn:hover { color: #fff; background: rgba(255,255,255,0.06); }

/* ── Hero Banner ── */
.hero-banner {
  position: relative; border-radius: 20px; overflow: hidden;
  padding: 2.5rem 3rem; min-height: 240px;
  display: flex; align-items: center;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  margin-bottom: 1.5rem;
}
.hero-subtitle { font-size: 0.78rem; font-weight: 600; color: rgba(52,211,153,0.85); margin-bottom: 0.6rem; }
.hero-title { font-family: var(--headline); font-size: 1.9rem; font-weight: 900; color: #fff; line-height: 1.2; margin-bottom: 0.75rem; }
.hero-desc { font-size: 0.82rem; color: rgba(255,255,255,0.58); max-width: 520px; line-height: 1.6; margin-bottom: 1.25rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── Buttons ── */
.btn-primary {
  padding: 0.55rem 1.2rem; border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #040810; font-weight: 700; font-size: 0.8rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  box-shadow: 0 0 20px rgba(16,185,129,0.35);
  transition: all 0.2s;
}
.btn-primary:hover { box-shadow: 0 0 30px rgba(16,185,129,0.55); transform: translateY(-1px); }
.btn-outline {
  padding: 0.55rem 1.2rem; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8); font-weight: 600; font-size: 0.8rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: all 0.2s;
}
.btn-outline:hover { border-color: rgba(16,185,129,0.5); background: rgba(16,185,129,0.05); }

/* ── Metrics ── */
.metrics-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.metric-card {
  padding: 1.2rem; border-radius: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(16,185,129,0.14);
  position: relative; overflow: hidden; transition: all 0.2s;
}
.metric-card:hover { border-color: rgba(16,185,129,0.35); transform: translateY(-2px); }
.mc-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.mc-label { font-size: 0.72rem; color: rgba(255,255,255,0.42); margin-bottom: 0.2rem; }
.mc-val { font-family: var(--headline); font-size: 2rem; font-weight: 900; color: #fff; line-height: 1; }
.mc-trend { font-size: 0.65rem; color: rgba(255,255,255,0.32); margin-top: 0.35rem; font-family: var(--mono); }

/* ── Section title ── */
.section-title { font-family: var(--headline); font-size: 1rem; font-weight: 800; color: rgba(255,255,255,0.82); margin-bottom: 1.25rem; }

/* ── Grid (반응형 유연화) ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; width: 100%; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; width: 100%; }

/* ── Card ── */
.card { background: rgba(255,255,255,0.03); border: 1px solid rgba(16,185,129,0.14); border-radius: 16px; transition: all 0.2s; max-width: 100%; overflow: hidden; }
.card:hover { border-color: rgba(16,185,129,0.3); }
.card-pad { padding: 1.25rem; }
.card-header-flex { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-title { font-size: 0.83rem; font-weight: 700; color: rgba(255,255,255,0.82); display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0; }
.scroll-hint { font-size: 0.68rem; color: #10b981; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); padding: 2px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

/* ── Table (개선: 스크롤 힌트 및 주관기관 열 확보) ── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
thead th { padding: 9px 13px; text-align: left; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.38); border-bottom: 1px solid rgba(255,255,255,0.05); white-space: nowrap; }
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.15s; }
tbody tr:hover { background: rgba(16,185,129,0.04); }
tbody td { padding: 9px 13px; font-size: 0.8rem; color: rgba(255,255,255,0.78); }

/* ── Score row (반응형 깨짐 방지) ── */
.score-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.55rem; width: 100%; }
.score-disease { width: 120px; font-size: 0.73rem; color: rgba(255,255,255,0.55); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-track { flex: 1; min-width: 60px; height: 20px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; position: relative; }
.score-fill { height: 100%; background: linear-gradient(90deg, #10b981, #06b6d4); border-radius: 4px; }
.score-val { width: 36px; font-size: 0.7rem; font-weight: 700; color: #34d399; font-family: var(--mono); text-align: right; flex-shrink: 0; }

/* ── Phase bars ── */
.phase-bars { margin-bottom: 0.75rem; }
.phase-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.7rem; }
.phase-lbl { width: 80px; font-size: 0.73rem; color: rgba(255,255,255,0.55); flex-shrink: 0; }
.phase-bar-track { flex: 1; min-width: 50px; height: 8px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; }
.phase-bar-fill { height: 100%; border-radius: 4px; }
.phase-num { width: 36px; font-size: 0.7rem; font-weight: 700; font-family: var(--mono); text-align: right; flex-shrink: 0; }

/* ── Mol card ── */
.mol-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(16,185,129,0.14);
  border-radius: 16px; padding: 1.25rem;
  transition: all 0.25s;
}
.mol-card:hover { border-color: rgba(16,185,129,0.4); transform: translateY(-2px); }
.mol-emoji { font-size: 1.8rem; display: block; margin-bottom: 0.45rem; }
.mol-name { font-size: 0.86rem; font-weight: 700; color: #fff; margin-bottom: 0.2rem; }
.mol-chembl { font-size: 0.63rem; color: rgba(255,255,255,0.28); font-family: var(--mono); margin-bottom: 0.65rem; }
.mol-props { margin-top: 0.7rem; }
.mol-prop { display: flex; justify-content: space-between; padding: 3.5px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.73rem; }
.mol-prop-key { color: rgba(255,255,255,0.38); }
.mol-prop-val { color: rgba(255,255,255,0.78); font-family: var(--mono); }

/* ── Timeline ── */
.tl-item { display: flex; gap: 1rem; margin-bottom: 1.4rem; }
.tl-line { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid; flex-shrink: 0; margin-top: 4px; }
.tl-stem { width: 2px; flex: 1; background: rgba(255,255,255,0.07); min-height: 34px; }
.tl-body { flex: 1; }
.tl-date { font-size: 0.62rem; color: rgba(255,255,255,0.38); font-family: var(--mono); font-weight: 600; margin-bottom: 2px; }
.tl-title { font-size: 0.86rem; font-weight: 700; color: #f0fdf4; margin-bottom: 3px; }
.tl-desc { font-size: 0.73rem; color: rgba(255,255,255,0.43); line-height: 1.5; }

/* ── Reg status (이슈 1 수정: 텍스트 및 상태 라벨 겹침 방지) ── */
.reg-status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.reg-status-info { flex: 1 1 200px; min-width: 0; }
.reg-status-right { flex: 0 0 auto; display: flex; align-items: center; gap: 0.65rem; margin-left: auto; }
.reg-status-bar:last-child { border-bottom: none; }
.reg-status-info { flex: 1; min-width: 0; }
.reg-status-name { font-size: 0.82rem; font-weight: 700; color: rgba(255,255,255,0.85); margin-bottom: 2px; }
.reg-status-desc { font-size: 0.72rem; color: rgba(255,255,255,0.42); line-height: 1.4; word-break: keep-all; }
.reg-status-right { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
.reg-pct { font-size: 0.72rem; color: rgba(255,255,255,0.45); font-weight: 500; white-space: nowrap; }

/* ── Pitch ── */
.pitch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.85rem; margin-bottom: 1.5rem; }
.pitch-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(16,185,129,0.13); border-radius: 14px; padding: 1.1rem; transition: all 0.2s; }
.pitch-card:hover { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.04); transform: translateY(-2px); }
.pitch-num { font-size: 0.58rem; font-weight: 800; color: rgba(16,185,129,0.43); font-family: var(--mono); letter-spacing: 0.1em; margin-bottom: 5px; }
.pitch-icon { font-size: 1.35rem; display: block; margin-bottom: 5px; }
.pitch-label { font-size: 0.8rem; font-weight: 700; color: #f0fdf4; margin-bottom: 4px; }
.pitch-desc { font-size: 0.68rem; color: rgba(255,255,255,0.43); line-height: 1.5; }

/* ── Rev split ── */
.rev-split { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.rev-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.77rem; color: rgba(255,255,255,0.63); margin-bottom: 0.5rem; }
.rev-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Sidebar toggle (mobile) ── */
.sidebar-toggle {
  position: fixed; bottom: 1.25rem; left: 1.25rem; z-index: 999;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #040810; font-size: 1rem;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
}

/* ── Scrollbar (이슈 2: 눈에 잘 띄는 스크롤바 디자인) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(16,185,129,0.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(16,185,129,0.7); }

/* ── 이슈 3 수정: 반응형 미디어 쿼리 세분화 ── */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
  .topbar { width: 100%; }
  .sidebar-toggle { display: flex; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .hero-banner { padding: 1.75rem 1.5rem; }
  .hero-title { font-size: 1.5rem; }
  .reg-status-bar { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
  .reg-status-right { align-self: flex-start; }
}

@media (max-width: 480px) {
  .metrics-row { grid-template-columns: 1fr; }
}

/* ── 표 (.table-wrap) 초록색 전용 스크롤바 ── */
.table-wrap::-webkit-scrollbar { height: 6px; width: 6px; }
.table-wrap::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb { background: #10b981; border-radius: 4px; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #34d399; }

/* ── 900px 이하 1열 전환 반응형 미디어쿼리 ── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}
