/* ══════════════════════════════════════════════════════════════
   GeroAge — 프론트엔드 디자인 시스템
   Pretendard · 골드 액센트 · 라운드 카드 · 부드러운 모션
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-elevated: #f5f5f7;
  --border: #e8e8ec;
  --text-primary: #0a0a0f;
  --text-secondary: #52525b;
  --text-tertiary: #8e8e93;
  --accent: #B8860B;
  --accent-2: #d4a017;
  --accent-bg: #fff8e1;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --purple: #7c3aed;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 1px 3px rgba(15,15,30,.06), 0 1px 2px rgba(15,15,30,.04);
  --shadow-md: 0 4px 16px rgba(15,15,30,.08), 0 2px 6px rgba(15,15,30,.05);
  --shadow-lg: 0 18px 50px rgba(15,15,30,.14), 0 6px 18px rgba(15,15,30,.08);
  --sidebar-w: 248px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-soft);
  color: var(--text-primary);
  line-height: 1.55;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-bg); }

/* ── 전역 아이콘 크기 상한 (거대 아이콘 버그 방지) ────────────── */
/* 모든 인라인 SVG는 .icon 을 달고 나온다. 기본 20px, 컨테이너 규칙이 있으면 그쪽이 우선. */
svg.icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px !important; height: 16px !important; }
.icon-lg { width: 34px !important; height: 34px !important; }
.icon-xl { width: 40px !important; height: 40px !important; }
/* 어떤 SVG도 부모를 넘지 않도록 안전망 */
svg { max-width: 100%; max-height: 100%; }

/* ── 런치 스플래시 (PWA/부팅) — 매니페스트 배경(#0f0a03)과 이어지는 다크 애니메이션 ── */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-content: center; justify-items: center; gap: 20px;
  background: radial-gradient(125% 95% at 50% 34%, #251804 0%, #150e04 44%, #0f0a03 100%);
  overflow: hidden;
  transition: opacity .55s ease, transform .55s cubic-bezier(.4, 0, .2, 1);
  will-change: opacity, transform;
}
.splash--out { opacity: 0; transform: scale(1.05); pointer-events: none; }
/* 천천히 도는 오로라 글로우 */
.splash__aura {
  position: absolute; width: 150vmax; height: 150vmax; left: 50%; top: 36%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(212, 160, 23, .20), transparent 70%),
    conic-gradient(from 0deg, rgba(212, 160, 23, .12), rgba(124, 58, 237, .10), rgba(96, 120, 220, .10), rgba(212, 160, 23, .12));
  filter: blur(26px); opacity: .85; animation: splashAura 20s linear infinite;
}
@keyframes splashAura { to { transform: translate(-50%, -50%) rotate(360deg); } }
/* 로고 + 소나 링 */
.splash__logo { position: relative; width: 134px; height: 134px; display: grid; place-items: center;
  animation: splashLogoIn .9s cubic-bezier(.2, .8, .25, 1) both; }
.splash__logo img { width: 120px; height: auto;
  filter: drop-shadow(0 6px 24px rgba(212, 160, 23, .45)); animation: splashGlow 2.6s ease-in-out infinite; }
.splash__ring { position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(212, 160, 23, .55); opacity: 0; animation: splashRing 2.8s ease-out infinite; }
.splash__ring--d { animation-delay: 1.4s; border-color: rgba(124, 58, 237, .5); }
@keyframes splashRing { 0% { transform: scale(.7); opacity: .7; } 80%, 100% { transform: scale(1.72); opacity: 0; } }
@keyframes splashLogoIn { 0% { opacity: 0; transform: scale(.68); filter: blur(6px); } 100% { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes splashGlow { 0%, 100% { filter: drop-shadow(0 6px 18px rgba(212, 160, 23, .35)); } 50% { filter: drop-shadow(0 10px 34px rgba(212, 160, 23, .7)); } }
/* 워드마크 · 태그라인 */
.splash__word { font-size: 30px; font-weight: 800; letter-spacing: .01em;
  background: linear-gradient(92deg, #f6d98c, #d4a017 58%, #f6d98c);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #f4d585;
  animation: splashUp .7s .22s var(--ease) both; }
.splash__tag { font-size: 13px; color: #b9a98a; letter-spacing: .04em; margin-top: -8px;
  animation: splashUp .7s .38s var(--ease) both; }
@keyframes splashUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
/* 로딩 바 스윕 */
.splash__bar { width: 170px; height: 3px; border-radius: 3px; overflow: hidden;
  background: rgba(255, 255, 255, .08); margin-top: 6px; animation: splashUp .7s .5s var(--ease) both; }
.splash__bar i { display: block; width: 40%; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #d4a017, #f6d98c, #d4a017, transparent);
  animation: splashBar 1.25s cubic-bezier(.5, 0, .4, 1) infinite; }
@keyframes splashBar { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) {
  .splash__aura, .splash__ring, .splash__logo, .splash__logo img,
  .splash__word, .splash__tag, .splash__bar, .splash__bar i { animation: none !important; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.98); } 50% { opacity: 1; transform: scale(1); } }

/* ══════════════════════════ 레이아웃 ══════════════════════════ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
  transition: transform .32s var(--ease);
}
.brand { display: flex; align-items: center; gap: 13px; padding: 4px 8px 20px; cursor: pointer; white-space: nowrap; }
.brand img { width: 48px; height: 48px; border-radius: 12px; object-fit: contain; flex: none; transition: transform .25s var(--ease-spring); }
.brand:hover img { transform: scale(1.06) rotate(-3deg); }
.brand__name { font-weight: 900; font-size: 25px; letter-spacing: -.035em; line-height: 1.05; }
.brand__name span { color: var(--accent); }
.brand__tag { font-size: 11px; color: var(--text-tertiary); font-weight: 700; margin-top: 1px; letter-spacing: .01em; }

/* 사이드바 접기 토글 */
.sidebar__collapse { position: absolute; top: 20px; right: -13px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer;
  display: grid; place-content: center; box-shadow: var(--shadow); z-index: 2; transition: transform .3s var(--ease), background .2s; }
.sidebar__collapse:hover { background: var(--accent-bg); color: var(--accent); }
.sidebar__collapse svg { transition: transform .32s var(--ease); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 600; font-size: 14.5px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav__link svg { width: 19px; height: 19px; flex: none; stroke-width: 1.9; }
.nav__link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav__link.active { background: var(--accent-bg); color: var(--accent); }
.nav__link.active::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px; background: var(--accent);
  animation: growbar .3s var(--ease-spring);
}
@keyframes growbar { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.sidebar__footer { padding: 14px 10px 4px; font-size: 11px; color: var(--text-tertiary); }
.sidebar__footer b { color: var(--text-secondary); }

.nav-admin { margin-top: 8px; padding: 10px 13px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--text-tertiary); border-radius: var(--radius-sm); cursor: pointer; transition: background .2s, color .2s; }
.nav-admin:hover { background: var(--bg-elevated); color: var(--accent); }

/* ── 접힌 사이드바 (아이콘 레일) ── */
.layout.collapsed { --sidebar-w: 74px; }
.layout.collapsed .sidebar { padding: 22px 12px; }
.layout.collapsed .brand { justify-content: center; padding: 4px 0 20px; }
.layout.collapsed .brand__text { display: none; }
.layout.collapsed .brand img { width: 40px; height: 40px; }
.layout.collapsed .nav__link { justify-content: center; padding: 11px 0; }
.layout.collapsed .nav__link span { display: none; }
.layout.collapsed .nav-admin span, .layout.collapsed .sidebar__footer, .layout.collapsed .kst-clock__time, .layout.collapsed .kst-clock__tz { display: none; }
.layout.collapsed .nav-admin { justify-content: center; }
.layout.collapsed .kst-clock { justify-content: center; padding: 9px 0; }
.layout.collapsed .sidebar__collapse svg { transform: rotate(180deg); }

.main {
  flex: 1; margin-left: var(--sidebar-w); min-width: 0;
  display: flex; flex-direction: column;
}

/* 모바일 상단바 */
.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar img { width: 44px; height: 44px; border-radius: 10px; }
.topbar__name { font-weight: 900; font-size: 21px; letter-spacing: -.02em; }
.hamburger {
  margin-left: auto; width: 40px; height: 40px; border: 1px solid var(--border);
  background: var(--bg); border-radius: 10px; display: grid; place-content: center; cursor: pointer;
}
.hamburger svg { width: 20px; height: 20px; }
.scrim {
  display: none; position: fixed; inset: 0; background: rgba(10,10,15,.4);
  z-index: 35; opacity: 0; transition: opacity .3s var(--ease);
}
.scrim.show { display: block; opacity: 1; }

.view { padding: 32px 24px 80px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* 라우트 전환 */
.view-enter { animation: viewIn .42s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════ 타이포 ══════════════════════════ */
.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.page-head p { color: var(--text-secondary); margin: 0; font-size: 15px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--text-tertiary); text-transform: uppercase; margin: 0 0 14px; }

/* ══════════════════════════ 카드 ══════════════════════════ */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.card--pad-lg { padding: 28px; }
.card-hover { transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dcdce2; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }

/* ══════════════════════════ 히어로 (배너 배경 + 신비로운 애니메이션) ══════════════════════════ */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--radius-lg);
  padding: 54px 48px;
  color: #fff;
  background: #17100a;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
}
/* 배경 이미지 — 느린 켄번스 줌/팬 */
.hero__bg { position: absolute; inset: -8%; z-index: 0; pointer-events: none;
  background: url("/static/assets/banner_background.jpg") center center / cover no-repeat;
  animation: kenburns 34s ease-in-out infinite alternate;
  will-change: transform; transform: translateZ(0) scale(1.16);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; }
/* 스케일은 고정하고 translate 만 애니메이션 → GPU 재래스터라이즈로 인한 떨림 제거 */
@keyframes kenburns {
  0%   { transform: translateZ(0) scale(1.16) translate(1.2%, 0.8%); }
  100% { transform: translateZ(0) scale(1.16) translate(-1.8%, -1.4%); }
}
/* 가독성 스크림 */
.hero__scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(112deg, rgba(15,10,3,.9) 0%, rgba(34,24,6,.68) 42%, rgba(70,50,12,.34) 100%); }
/* 떠다니는 오로라 글로우 */
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: 1; border-radius: 50%; filter: blur(10px);
  background: radial-gradient(circle, rgba(212,160,23,.5), transparent 68%);
  mix-blend-mode: screen; pointer-events: none;
}
.hero::before { width: 460px; height: 460px; top: -180px; right: -120px; animation: floaty 11s var(--ease) infinite; }
.hero::after { width: 340px; height: 340px; bottom: -170px; left: -90px; background: radial-gradient(circle, rgba(124,58,237,.4), transparent 70%); animation: floaty 15s var(--ease) infinite reverse; }
@keyframes floaty { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-24px, 20px) scale(1.1); } }
.hero__aurora { position: absolute; inset: -20%; z-index: 1; pointer-events: none; mix-blend-mode: screen; opacity: .5;
  background: radial-gradient(38% 55% at 22% 32%, rgba(212,160,23,.55), transparent 62%),
              radial-gradient(42% 52% at 78% 68%, rgba(96,120,220,.42), transparent 62%);
  animation: aurora 18s ease-in-out infinite alternate; will-change: transform; }
@keyframes aurora { 0% { transform: translate(0,0) rotate(0); } 50% { transform: translate(3%,-3%) rotate(3deg); } 100% { transform: translate(-3%,2%) rotate(-2deg); } }
/* 은은한 샤이머 스윕 */
.hero__shimmer { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(255,255,255,.13) 48%, transparent 60%);
  background-size: 260% 100%; animation: heroShimmer 8s linear infinite; }
@keyframes heroShimmer { 0% { background-position: 170% 0; } 100% { background-position: -70% 0; } }
/* 반짝이는 파티클 */
.hero__sparkles { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hero__sparkles i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 1px rgba(255,238,196,.95); opacity: 0; animation: sparkle 4.5s ease-in-out infinite; }
@keyframes sparkle { 0%,100% { opacity: 0; transform: scale(.4); } 45% { opacity: .95; transform: scale(1.25); } }
.hero__grain { position: absolute; inset: 0; z-index: 2; opacity: .05; mix-blend-mode: overlay;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0); background-size: 22px 22px; }
.hero__inner { position: relative; z-index: 3; max-width: 640px; }
.hero__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.035em; margin: 10px 0 12px; line-height: 1.12; }
.hero p { font-size: 16px; color: rgba(255,255,255,.82); margin: 0 0 26px; max-width: 520px; }

/* ══════════════════════════ 버튼 ══════════════════════════ */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14.5px; cursor: pointer;
  border: 1px solid transparent; background: var(--bg-elevated); color: var(--text-primary);
  transition: transform .12s var(--ease), box-shadow .22s var(--ease), background .2s, opacity .2s;
  white-space: nowrap; -webkit-user-select: none; user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: #fff; box-shadow: 0 4px 14px rgba(184,134,11,.32); }
.btn--primary:hover { box-shadow: 0 8px 22px rgba(184,134,11,.42); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-elevated); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: #fde3e3; }
.btn--light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.24); backdrop-filter: blur(4px); }
.btn--light:hover { background: rgba(255,255,255,.24); }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--lg { padding: 14px 26px; font-size: 15.5px; }
.btn--block { width: 100%; }

/* ripple */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.45); pointer-events: none; animation: ripple .6s var(--ease); }
.btn--ghost .ripple, .btn:not(.btn--primary):not(.btn--light) .ripple { background: rgba(120,120,130,.25); }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ══════════════════════════ 폼 ══════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field .hint { font-size: 12px; color: var(--text-tertiary); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 13px; font-size: 14.5px; font-family: inherit;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); transition: border-color .2s, box-shadow .2s; outline: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,134,11,.14); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.input { resize: vertical; min-height: 72px; }

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

/* 세그먼트 컨트롤 */
.segmented { display: inline-flex; background: var(--bg-elevated); border-radius: 12px; padding: 4px; gap: 2px; position: relative; }
.segmented button {
  position: relative; z-index: 2; border: none; background: transparent; cursor: pointer;
  padding: 8px 18px; border-radius: 9px; font-weight: 700; font-size: 14px;
  color: var(--text-secondary); transition: color .25s var(--ease);
}
.segmented button.active { color: var(--text-primary); }
.segmented__thumb {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; border-radius: 9px;
  background: var(--bg); box-shadow: var(--shadow);
  transition: transform .32s var(--ease-spring), width .32s var(--ease-spring);
}

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.switch input { display: none; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background .25s var(--ease); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .28s var(--ease-spring); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch__label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

/* 칩 입력 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px; min-height: 46px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  transition: border-color .2s, box-shadow .2s; }
.chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,134,11,.14); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 12px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent); font-size: 13px; font-weight: 600;
  animation: chipIn .3s var(--ease-spring);
}
@keyframes chipIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.chip button { border: none; background: rgba(184,134,11,.16); color: var(--accent); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; display: grid; place-content: center; font-size: 13px; line-height: 1; }
.chip button:hover { background: rgba(184,134,11,.3); }
.chips input { border: none; outline: none; background: transparent; flex: 1; min-width: 100px; font-size: 14px; padding: 4px; font-family: inherit; }

/* ══════════════════════════ 통계 카드 (카운트업) ══════════════════════════ */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat--click { cursor: pointer; transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease); }
.stat--click:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #dcdce2; }
.stat--click:active { transform: translateY(-1px) scale(.995); }
.stat__ico { position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 11px; display: grid; place-content: center; }
.stat__ico svg { width: 21px; height: 21px; }
.stat__label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.stat__value { font-size: 40px; font-weight: 800; letter-spacing: -.04em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat__value .unit { font-size: 17px; font-weight: 600; color: var(--text-tertiary); margin-left: 4px; }
.stat__sub { font-size: 13px; color: var(--text-tertiary); }
.stat__sub b.up { color: var(--danger); } .stat__sub b.down { color: var(--success); }

/* ══════════════════════════ 상태 pill ══════════════════════════ */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  animation: pillPop .34s var(--ease-spring) both;
}
@keyframes pillPop { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--high { background: var(--danger-bg); color: var(--danger); }
.pill--low { background: var(--blue-bg); color: var(--blue); }
.pill--watch { background: var(--warning-bg); color: var(--warning); }
.pill--normal { background: var(--success-bg); color: var(--success); }
.pill--na, .pill--info, .pill--unknown { background: var(--bg-elevated); color: var(--text-tertiary); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--bg-elevated); color: var(--text-secondary); }
.badge--rna { background: var(--blue-bg); color: var(--blue); }
.badge--accent { background: var(--accent-bg); color: var(--accent); }

/* ══════════════════════════ 리포트 리스트 ══════════════════════════ */
.report-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow);
}
.report-item__ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; flex: none; }
.report-item__ico svg { width: 22px; height: 22px; }
.report-item__body { flex: 1; min-width: 0; }
.report-item__title { font-weight: 700; font-size: 15px; }
.report-item__meta { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.report-item__actions { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); cursor: pointer; display: grid; place-content: center; transition: background .2s, color .2s, transform .1s; }
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn:active { transform: scale(.9); }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

/* 빈 상태 */
.empty { text-align: center; padding: 64px 24px; }
.empty__ico { width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 22px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; animation: pulse 2.6s var(--ease) infinite; }
.empty__ico svg { width: 36px; height: 36px; }
.empty h3 { font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.empty p { color: var(--text-secondary); margin: 0 auto 22px; max-width: 380px; }

/* ══════════════════════════ 드롭존 ══════════════════════════ */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-soft);
  padding: 38px 24px; text-align: center; cursor: pointer; position: relative;
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .2s var(--ease);
}
.dropzone:hover { border-color: var(--accent-2); background: var(--accent-bg); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-bg); transform: scale(1.012); box-shadow: inset 0 0 0 3px rgba(184,134,11,.14); }
.dropzone__ico { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 15px; background: var(--bg); border: 1px solid var(--border); color: var(--accent); display: grid; place-content: center; transition: transform .3s var(--ease-spring); }
.dropzone.drag .dropzone__ico { transform: translateY(-6px) scale(1.08); }
.dropzone__ico svg { width: 26px; height: 26px; }
.dropzone h4 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; }
.dropzone p { margin: 0; font-size: 13px; color: var(--text-tertiary); }
.dropzone input[type=file] { display: none; }

.file-tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--success-bg); color: var(--success); border-radius: 999px; font-size: 13px; font-weight: 700; }

/* skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--bg-elevated); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-row { height: 40px; margin-bottom: 8px; }

.spinner-sm { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
.spinner-sm--dark { border-color: var(--border); border-top-color: var(--accent); }

/* ══════════════════════════ 바이오마커 테이블 ══════════════════════════ */
.bm-group { margin-bottom: 22px; }
.bm-group__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bm-group__head h4 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.bm-group__count { font-size: 11.5px; font-weight: 700; color: var(--text-tertiary); background: var(--bg-elevated); padding: 2px 8px; border-radius: 999px; }
.bm-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.bm-row { display: grid; grid-template-columns: 1.4fr 1fr 1.1fr auto; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--border); }
.bm-row:first-child { border-top: none; }
.bm-row:hover { background: var(--bg-soft); }
.bm-row__label { font-weight: 600; font-size: 14px; }
.bm-row__label small { display: block; color: var(--text-tertiary); font-weight: 500; font-size: 11.5px; }
.bm-row__value { display: flex; align-items: center; gap: 6px; }
.bm-row__value input { width: 88px; padding: 6px 9px; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); outline: none; transition: border-color .2s; }
.bm-row__value input:focus { border-color: var(--accent); }
.bm-row__value .unit { font-size: 12.5px; color: var(--text-tertiary); min-width: 30px; }
.bm-row__ref { font-size: 12.5px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* preview table (rnaseq) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { background: var(--bg-elevated); font-weight: 700; font-size: 12px; color: var(--text-secondary); position: sticky; top: 0; }
table.data td { font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: none; }

.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.qc-cell { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }
.qc-cell__label { font-size: 11.5px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.qc-cell__value { font-size: 22px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; }
.qc-cell__value.txt { font-size: 16px; }

.warn-box { background: var(--warning-bg); border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; color: #92400e; }
.warn-box ul { margin: 6px 0 0; padding-left: 18px; }

/* ══════════════════════════ 진행 바 컴포넌트 (화려) ══════════════════════════ */
.progress { display: block; animation: viewIn .3s var(--ease) both; }
.progress__head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.progress__spin { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--accent-bg); border-top-color: var(--accent); animation: spin .7s linear infinite; flex: none; }
.progress__label { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.progress__pct { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.progress__track {
  position: relative; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 2px rgba(15,15,30,.08);
}
.progress__fill {
  position: relative; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 42%, var(--blue) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(184,134,11,.5), 0 0 22px rgba(37,99,235,.28);
  transition: width .55s var(--ease);
  animation: progGradient 3s ease infinite;
}
@keyframes progGradient { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
/* 이동하는 반짝임(shimmer) 오버레이 */
.progress__fill::after {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.75) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: progShimmer 1.4s linear infinite;
}
@keyframes progShimmer { 0% { background-position: 140% 0; } 100% { background-position: -40% 0; } }
/* 미결정(indeterminate) 변형 */
.progress--indef .progress__fill { width: 42% !important; animation: progGradient 3s ease infinite, progSlide 1.35s var(--ease) infinite; }
@keyframes progSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(340%); } }
/* 완료 상태 */
.progress--done .progress__fill { background: linear-gradient(90deg, var(--success), #34d399); box-shadow: 0 0 12px rgba(5,150,105,.45); animation: none; }
.progress--done .progress__fill::after { animation: none; opacity: 0; }
.progress--fail .progress__fill { background: linear-gradient(90deg, var(--danger), #f87171); box-shadow: none; animation: none; }
.progress--fail .progress__fill::after { display: none; }

/* KST 시계 */
.kst-clock { display: flex; align-items: center; gap: 8px; margin: 2px 10px 14px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--border); }
.kst-clock svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.kst-clock__time { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; color: var(--text-primary); }
.kst-clock__tz { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--accent); background: var(--accent-bg); padding: 1px 5px; border-radius: 5px; margin-left: auto; }
.topbar .kst-clock { display: none; margin: 0 10px 0 0; padding: 6px 10px; }
@media (max-width: 900px) { .topbar .kst-clock { display: inline-flex; } .topbar .kst-clock__tz { display: none; } }

/* ══════════════════════════ 스텝퍼 (입력 뷰) ══════════════════════════ */
.stepper { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.step-pill { display: flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-tertiary); cursor: pointer; transition: all .25s var(--ease); }
.step-pill.done { color: var(--success); border-color: #a7f3d0; background: var(--success-bg); }
.step-pill.active { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 3px rgba(184,134,11,.1); }
.step-pill__num { width: 20px; height: 20px; border-radius: 50%; background: var(--bg-elevated); display: grid; place-content: center; font-size: 11.5px; }
.step-pill.active .step-pill__num { background: var(--accent); color: #fff; }
.step-pill.done .step-pill__num { background: var(--success); color: #fff; }

.form-section { scroll-margin-top: 20px; }
.form-section > .card { position: relative; }

.saju-note { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 15px; border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--accent-bg), #fffdf5); border: 1px solid #f0e2b8; font-size: 13px; color: #6b4e0c; line-height: 1.5; }
.saju-note svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.saju-note b { color: var(--accent); }

/* ══════════════════════════ 생성 뷰 (SSE) ══════════════════════════ */
.gen-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.timeline { position: relative; padding-left: 6px; }
.tl-step { display: flex; gap: 14px; padding-bottom: 24px; position: relative; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step__dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg); flex: none; display: grid; place-content: center; z-index: 2; transition: all .35s var(--ease-spring); }
.tl-step__dot svg { width: 14px; height: 14px; opacity: 0; transition: opacity .3s; }
.tl-step:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--border); z-index: 1; }
.tl-step.active .tl-step__dot { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(184,134,11,.14); }
.tl-step.active .tl-step__dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.tl-step.done .tl-step__dot { border-color: var(--success); background: var(--success); }
.tl-step.done .tl-step__dot svg { opacity: 1; color: #fff; }
.tl-step__label { font-weight: 700; font-size: 14px; padding-top: 3px; color: var(--text-tertiary); transition: color .3s; }
.tl-step.active .tl-step__label, .tl-step.done .tl-step__label { color: var(--text-primary); }

.gen-progressbar { height: 8px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-bottom: 6px; }
.gen-progressbar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0%; transition: width .5s var(--ease); }
.gen-log { max-height: 180px; overflow-y: auto; font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.gen-log__line { animation: viewIn .3s var(--ease) both; }
.gen-log__line b { color: var(--accent); }

.narrative { font-size: 15px; line-height: 1.7; color: var(--text-primary); }
.narrative h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 20px 0 8px; }
.cursor { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ══════════════════════════ 리포트 뷰어 ══════════════════════════ */
.report-view { display: flex; flex-direction: column; height: calc(100vh - 40px); }
.report-view__bar { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; flex-wrap: wrap; }
.report-view__frame { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); background: #fff; min-height: 400px; }
.report-view__frame iframe { width: 100%; height: 100%; border: none; display: block; }

/* ══════════════════════════ 토스트 ══════════════════════════ */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: var(--text-primary); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .4s var(--ease-spring); max-width: 90vw; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--success { background: #064e3b; } .toast--success svg { color: #34d399; }
.toast--error { background: #7f1d1d; } .toast--error svg { color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* 연결 테스트 결과 */
.test-result { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; animation: viewIn .35s var(--ease) both; }
.test-result--ok { background: var(--success-bg); color: var(--success); }
.test-result--fail { background: var(--danger-bg); color: var(--danger); }
.test-result__ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-content: center; flex: none; }
.test-result--ok .test-result__ico { background: rgba(5,150,105,.16); }
.test-result--fail .test-result__ico { background: rgba(220,38,38,.14); }

.divider { height: 1px; background: var(--border); border: none; margin: 4px 0; }
.mut { color: var(--text-secondary); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ══════════════════════════ 로컬 보안 배지 ══════════════════════════ */
.local-badge { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; animation: viewIn .4s var(--ease) both; }
.local-badge svg { color: currentColor; }
.local-badge--secure { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.local-badge--warn { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.privacy-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-tertiary); margin-top: 16px; }
.privacy-line svg { color: var(--success); }

/* ══════════════════════════ 관리자 로그인 ══════════════════════════ */
.admin-lock { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; }
.admin-lock svg { width: 28px; height: 28px; }

/* ══════════════════════════ 챗봇 ══════════════════════════ */
/* 히스토리 + 대화 2단 레이아웃 */
.chat-shell { position: relative; display: grid; grid-template-columns: 0 1fr; gap: 0; transition: grid-template-columns .3s var(--ease); }
.chat-shell.hist-open { grid-template-columns: 250px 1fr; gap: 22px; }
.chat-history { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.chat-shell:not(.hist-open) .chat-history { opacity: 0; pointer-events: none; }
.chat-history__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.chat-history__head b { flex: 1; font-size: 14px; }
.chat-history__list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 120px); }
.hist-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; }
.hist-item:hover { border-color: var(--accent-2); background: var(--bg-soft); }
.hist-item.on { border-color: var(--accent); background: var(--accent-bg); }
.hist-item__body { flex: 1; min-width: 0; }
.hist-item__title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item__time { font-size: 11.5px; color: var(--text-tertiary); margin-top: 1px; }
.hist-item__del { width: 30px; height: 30px; opacity: 0; transition: opacity .2s; }
.hist-item:hover .hist-item__del { opacity: 1; }
.chat-scrim { display: none; }
.chat-shell .chat-wrap { max-width: 860px; margin: 0 auto; width: 100%; }

.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 40px); max-width: 860px; margin: 0 auto; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 82%; animation: msgIn .35s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg__ava { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-content: center; }
.msg__ava svg { width: 18px; height: 18px; }
.msg__bubble { padding: 12px 16px; border-radius: 16px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.msg--bot { align-self: flex-start; }
.msg--bot .msg__ava { background: var(--accent-bg); color: var(--accent); }
.msg--bot .msg__bubble { background: var(--bg); border: 1px solid var(--border); border-top-left-radius: 5px; box-shadow: var(--shadow); }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg--user .msg__ava { background: var(--text-primary); color: #fff; }
.msg--user .msg__bubble { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-top-right-radius: 5px; }

/* 챗봇 마크다운 렌더링 */
.msg__bubble.md { white-space: normal; }
.msg__bubble.md > *:first-child { margin-top: 0; }
.msg__bubble.md > *:last-child { margin-bottom: 0; }
.msg__bubble.md p { margin: 0 0 8px; }
.msg__bubble.md strong { font-weight: 800; color: var(--text-primary); }
.msg__bubble.md em { font-style: italic; }
.msg__bubble.md h4, .msg__bubble.md h5, .msg__bubble.md h6 { margin: 12px 0 6px; font-weight: 800; line-height: 1.3; }
.msg__bubble.md h4 { font-size: 16px; } .msg__bubble.md h5 { font-size: 15px; } .msg__bubble.md h6 { font-size: 14px; color: var(--text-secondary); }
.msg__bubble.md ul, .msg__bubble.md ol { margin: 6px 0 10px; padding-left: 20px; }
.msg__bubble.md li { margin: 3px 0; }
.msg__bubble.md ul li::marker { color: var(--accent); }
.msg__bubble.md code { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.msg__bubble.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 8px 8px 0; }
.msg__bubble.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg__bubble.md a { color: var(--blue); text-decoration: underline; }
.msg--bot .msg__bubble.md strong { color: var(--accent); }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); animation: typing 1.2s var(--ease) infinite; }
.typing span:nth-child(2) { animation-delay: .18s; } .typing span:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.suggest-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all .2s var(--ease); }
.suggest-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }
.chat-followups { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px 45px; animation: msgIn .35s var(--ease) both; }
.chat-followups .fu-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); }
.chat-followups .fu-label svg { width: 15px; height: 15px; }
.chat-followups .suggest-chip { font-size: 12.5px; padding: 6px 12px; }
.chat-followups .fu-loading { display: inline-flex; }
@media (max-width: 640px){ .chat-followups { margin-left: 0; } }
.chat-input { display: flex; gap: 10px; align-items: flex-end; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.chat-input textarea { flex: 1; border: none; outline: none; resize: none; font-family: inherit; font-size: 14.5px; line-height: 1.5; max-height: 140px; background: transparent; color: var(--text-primary); }
.chat-send { width: 44px; height: 44px; border-radius: 12px; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; cursor: pointer; display: grid; place-content: center; flex: none; transition: transform .12s, box-shadow .2s; box-shadow: 0 4px 12px rgba(184,134,11,.3); }
.chat-send:hover { box-shadow: 0 6px 18px rgba(184,134,11,.42); }
.chat-send:active { transform: scale(.92); }
.chat-send:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════ 모달 다이얼로그 (범용) ══════════════════════════ */
.modal-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: rgba(10,10,15,.5); opacity: 0; transition: opacity .22s var(--ease); backdrop-filter: blur(2px); }
.modal-overlay[hidden] { display: none; }
.modal-overlay.open { opacity: 1; }
.modal { width: 100%; max-width: 440px; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.97); opacity: 0; transition: transform .26s var(--ease-spring), opacity .2s var(--ease); }
.modal-overlay.open .modal { transform: none; opacity: 1; }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal__title { flex: 1; font-size: 15px; }
.modal__body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
/* 모달 안에서는 삭제 버튼 항상 표시(터치 접근성) */
.modal .hist-item__del { opacity: 1; }

/* ══════════════════════════ 비교 / 순위 ══════════════════════════ */
.compare-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.compare-select { position: sticky; top: 20px; }
.rank-hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 34px 36px; color: #fff; background: #150f04; box-shadow: var(--shadow-lg); margin-bottom: 24px; }
.rank-hero__bg { position: absolute; inset: -8%; background: url('/static/assets/banner_background.jpg') center/cover no-repeat; opacity: .55; animation: rankKen 26s ease-in-out infinite alternate; z-index: 0; will-change: transform; transform: translateZ(0) scale(1.1); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rank-hero__scrim { position: absolute; inset: 0; z-index: 1; background: linear-gradient(120deg, rgba(20,12,4,.86), rgba(20,12,4,.5) 52%, rgba(122,90,14,.4)); }
.rank-hero__aurora { position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle at 82% 18%, rgba(212,160,23,.5), transparent 55%), radial-gradient(circle at 15% 90%, rgba(124,58,237,.28), transparent 50%); mix-blend-mode: screen; animation: rankAurora 13s ease-in-out infinite alternate; }
.rank-hero__shimmer { position: absolute; inset: 0; z-index: 1; background: linear-gradient(105deg, transparent 42%, rgba(255,255,255,.16) 50%, transparent 58%); transform: translateX(-120%); animation: rankShimmer 7s ease-in-out infinite; }
.rank-hero__inner { position: relative; z-index: 2; }
@keyframes rankKen { from { transform: translateZ(0) scale(1.1) translate(1.5%,1.5%); } to { transform: translateZ(0) scale(1.1) translate(-2%,-2.5%); } }
@keyframes rankAurora { 0% { opacity: .4; transform: translate(0,0); } 100% { opacity: .8; transform: translate(-4%,3%); } }
@keyframes rankShimmer { 0% { transform: translateX(-120%); } 55%,100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) {
  .rank-hero__bg, .rank-hero__aurora, .rank-hero__shimmer,
  .hero__bg, .hero__aurora, .hero__shimmer, .hero__sparkles i, .hero::before, .hero::after { animation: none !important; }
}
.rank-hero__ico { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.16); display: grid; place-content: center; margin-bottom: 14px; }
.rank-hero__ico svg { width: 24px; height: 24px; color: #ffd766; }
.rank-hero__big { font-size: 46px; font-weight: 900; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; margin: 6px 0; }
.rank-hero__sub { font-size: 15px; color: rgba(255,255,255,.85); }
.rank-hero__rank { font-size: 15px; margin-top: 10px; color: #ffd766; font-weight: 700; }
.select-list { display: flex; flex-direction: column; gap: 8px; }
.sel-item { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; }
.sel-item:hover { border-color: var(--accent-2); }
.sel-item.on { border-color: var(--accent); background: var(--accent-bg); }
.sel-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); flex: none; display: grid; place-content: center; color: #fff; transition: all .2s var(--ease-spring); }
.sel-item.on .sel-check { background: var(--accent); border-color: var(--accent); }
.sel-check svg { width: 14px; height: 14px; opacity: 0; }
.sel-item.on .sel-check svg { opacity: 1; }
.rank-row { display: grid; grid-template-columns: 1.3fr 1fr 2fr; gap: 14px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--border); }
.rank-row:first-child { border-top: none; }
.rank-bar { height: 9px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; position: relative; }
.rank-bar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width 1s var(--ease); }
/* 추세 그래프 (폰트 크기는 SVG 인라인 style 로 지정) */
svg.trend { width: 100%; height: auto; display: block; }
.trend .axlbl { fill: var(--text-tertiary); }
.trend .axval { font-weight: 700; fill: var(--text-secondary); }
.trend .axunit { fill: var(--text-tertiary); font-weight: 600; }
/* 각 차트가 카드 전체 폭을 쓰도록 — 넓은 화면 2열, 좁으면 1열 */
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 18px; }
.trend-grid .trend-card { padding: 16px 18px; }
/* 확대 버튼 (우상단) */
.trend-zoom { position: absolute; top: 12px; right: 12px; z-index: 2; width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); cursor: pointer;
  font-size: 16px; line-height: 1; display: grid; place-content: center; transition: all .18s var(--ease); }
.trend-zoom:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.trend-zoom:active { transform: scale(.92); }
/* 확대 모달 */
.modal--chart { max-width: 1000px; width: 92vw; }
.modal--chart .modal__body { padding: 18px 20px 22px; overflow: auto; }
.trend-zoom-wrap { width: 100%; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }
.trend-legend .tl-item { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend .tl-dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.trend-legend .tl-band { width: 18px; height: 11px; border-radius: 3px; background: rgba(5,150,105,.18); border: 1px dashed rgba(5,150,105,.5); }

/* 접기/펼치기 (아코디언) */
.accordion__summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; -webkit-user-select: none; user-select: none; padding: 2px 0; }
.accordion__summary::-webkit-details-marker { display: none; }
.accordion__chev { margin-left: auto; color: var(--text-tertiary); display: inline-flex; transition: transform .25s var(--ease); }
.accordion[open] .accordion__chev { transform: rotate(90deg); }
.accordion__body { animation: viewIn .3s var(--ease) both; }

/* 클릭 가능한 바이오마커 */
.bm-clickable { cursor: pointer; }
.rank-row.bm-clickable { border-radius: var(--radius-sm); transition: background .2s var(--ease); }
.rank-row.bm-clickable:hover { background: var(--accent-bg); }
.trend-card.bm-clickable { transition: border-color .2s var(--ease), transform .14s var(--ease), box-shadow .2s var(--ease); }
.trend-card.bm-clickable:hover { border-color: var(--accent) !important; transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }
.bm-clickable b svg { color: var(--accent); vertical-align: -2px; opacity: .7; }

/* 바이오마커 분석 채팅 모달 */
.modal--chat { max-width: 580px; width: 100%; height: 82vh; max-height: 740px; }
.modal--chat .modal__body { flex: 1; padding: 14px; }
.modal--chat .chat-input { box-shadow: none; }
#bm-suggest { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#bm-suggest:empty { display: none; }
#bm-suggest .fu-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); }
/* AI 분석 로딩 바 */
.bm-loading { padding: 10px 6px 4px; animation: viewIn .25s var(--ease) both; }
.bm-suggest-loading { display: inline-block; min-width: 170px; }
.bm-suggest-loading .progress__track { height: 8px; }

.delta-up { color: var(--danger); font-weight: 700; } .delta-down { color: var(--success); font-weight: 700; } .delta-flat { color: var(--text-tertiary); }
.delta-good { color: var(--success); font-weight: 800; } .delta-bad { color: var(--danger); font-weight: 800; }

/* ══════════════════════════ 시뮬레이션 ══════════════════════════ */
.sim-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.sim-controls { position: sticky; top: 20px; }
.ctl-row { margin-bottom: 14px; }
.ctl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--bg-elevated); outline: none; margin-top: 8px; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); cursor: pointer; box-shadow: 0 2px 8px rgba(184,134,11,.45); border: 2px solid #fff; transition: transform .15s var(--ease-spring); }
.slider::-webkit-slider-thumb:active { transform: scale(1.2); }
.slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid #fff; }
.sup-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sup-chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all .2s var(--ease); }
.sup-chip:hover { border-color: var(--accent-2); }
.sup-chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 2px rgba(184,134,11,.12); }
.sup-chip.on::before { content: "✓ "; }
#c-months button { flex: 1; }

.sim-result { min-width: 0; }
.sim-inflight { margin-bottom: 14px; }
.sim-heroes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sim-hero { position: relative; overflow: hidden; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow); }
.sim-hero__ico { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 11px; display: grid; place-content: center; background: var(--bg-elevated); color: var(--text-tertiary); }
.sim-hero.good .sim-hero__ico { background: var(--success-bg); color: var(--success); }
.sim-hero.bad .sim-hero__ico { background: var(--danger-bg); color: var(--danger); }
.sim-hero__label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.sim-hero__val { font-size: 42px; font-weight: 800; letter-spacing: -.04em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.sim-hero__unit { font-size: 18px; font-weight: 600; color: var(--text-tertiary); margin-left: 3px; }
.sim-hero__delta { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 800; animation: deltaPop .45s var(--ease-spring); }
@keyframes deltaPop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.sim-hero .delta-good { background: var(--success-bg); color: var(--success); }
.sim-hero .delta-bad { background: var(--danger-bg); color: var(--danger); }
.sim-hero .delta-flat { background: var(--bg-elevated); color: var(--text-tertiary); }

.bm-sim-row { padding: 12px 14px; border-top: 1px solid var(--border); border-left: 3px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; transition: background .3s var(--ease); }
.bm-sim-row:first-child { border-top: none; }
.bm-sim-row--good { border-left-color: var(--success); background: linear-gradient(90deg, rgba(5,150,105,.06), transparent 55%); }
.bm-sim-row--bad { border-left-color: var(--danger); background: linear-gradient(90deg, rgba(220,38,38,.06), transparent 55%); }
.bm-sim-row--neutral { border-left-color: var(--border); }
.bm-sim-row__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bm-sim-row__pct { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta-neutral { color: var(--text-tertiary); font-weight: 700; }
/* 개선/악화 뱃지 */
.bm-verdict { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; animation: deltaPop .4s var(--ease-spring); }
.bm-verdict svg { width: 13px; height: 13px; }
.bm-verdict--good { background: var(--success-bg); color: var(--success); box-shadow: 0 0 0 2px rgba(5,150,105,.12); }
.bm-verdict--bad { background: var(--danger-bg); color: var(--danger); box-shadow: 0 0 0 2px rgba(220,38,38,.1); }
.bm-verdict--neutral { background: var(--bg-elevated); color: var(--text-tertiary); }
/* 마커가 트랙 끝에서도 카드를 벗어나지 않도록 좌우 여백 확보 */
.bmbar { position: relative; height: 12px; border-radius: 999px; background: var(--bg-elevated); margin: 2px 10px 0; }
.bmbar__band { position: absolute; top: 0; bottom: 0; background: rgba(5,150,105,.16); border-left: 1px dashed rgba(5,150,105,.5); border-right: 1px dashed rgba(5,150,105,.5); border-radius: 3px; max-width: 100%; }
.bmbar__link { position: absolute; top: 50%; height: 3px; transform: translateY(-50%); background: var(--text-tertiary); opacity: .55; border-radius: 3px; transition: left .7s var(--ease), width .7s var(--ease); }
.bmbar__marker { position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid #fff; box-shadow: var(--shadow); }
.bmbar__marker--cur { background: var(--text-tertiary); z-index: 2; }
.bmbar__marker--proj { background: var(--accent); z-index: 3; transition: left .7s var(--ease-spring); }
.bmbar__marker--proj.good { background: var(--success); } .bmbar__marker--proj.bad { background: var(--danger); }

.clocks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.clock-item { }
.clockbar { height: 9px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-bottom: 5px; }
.clockbar__fill { height: 100%; border-radius: 999px; transition: width .8s var(--ease); }
.clockbar__fill.base { background: var(--text-tertiary); opacity: .5; }
.clockbar__fill.proj { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.clockbar__fill.proj.good { background: linear-gradient(90deg, var(--success), #34d399); }
.reveal-now { animation: viewIn .4s var(--ease) both; }

/* 축하 컨페티 */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti-piece { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .9; animation: confettiFall 1.7s var(--ease) forwards; }
@keyframes confettiFall { 0% { transform: translateY(-10px) rotate(0); opacity: 1; } 100% { transform: translateY(102vh) rotate(540deg); opacity: 0; } }

/* ══════════════════════════ 반응형 ══════════════════════════ */
@media (max-width: 900px) {
  .layout, .layout.collapsed { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 268px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .layout.collapsed .sidebar { padding: 22px 16px; }        /* 모바일에서는 접힘 무시(드로어) */
  .layout.collapsed .brand__text, .layout.collapsed .nav__link span, .layout.collapsed .nav-admin span, .layout.collapsed .sidebar__footer { display: revert; }
  .layout.collapsed .nav__link, .layout.collapsed .nav-admin { justify-content: flex-start; }
  .sidebar__collapse { display: none; }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .view { padding: 24px 18px 60px; }
  .hero { padding: 34px 24px; } .hero h1 { font-size: 28px; }
  .form-grid, .grid-2, .grid-3, .stat-cards { grid-template-columns: 1fr; }
  .gen-wrap { grid-template-columns: 1fr; }
  .bm-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .bm-row__ref { grid-column: 1 / -1; }
  .page-head h1 { font-size: 24px; }
  .rank-row { grid-template-columns: 1fr; gap: 6px; }
  .trend-grid { grid-template-columns: 1fr; }
  .compare-layout { grid-template-columns: 1fr; gap: 16px; }
  .compare-select { position: static; }
  .compare-select .select-list { max-height: 260px; overflow-y: auto; padding-right: 4px; }
  .rank-hero__big { font-size: 38px; }
  .rank-row .rank-bar { width: 100%; }
  .msg { max-width: 92%; }
  .chat-wrap, .report-view { height: calc(100vh - 116px); }
  .report-view__bar { position: sticky; top: 0; }
  /* 시뮬레이션: 단일 컬럼 */
  .sim-layout { grid-template-columns: 1fr; }
  .sim-controls { position: static; }
  .sim-heroes, .clocks-grid { grid-template-columns: 1fr; }
  /* 챗봇 히스토리: 오프캔버스 드로어 */
  .chat-shell, .chat-shell.hist-open { grid-template-columns: 1fr; gap: 0; }
  .chat-history { position: fixed; top: 0; left: 0; bottom: 0; width: 270px; z-index: 45; background: var(--bg); border-right: 1px solid var(--border); padding: 18px 14px; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  .chat-shell.hist-open .chat-history { transform: translateX(0); opacity: 1; pointer-events: auto; }
  .chat-shell.hist-open .chat-scrim { display: block; position: fixed; inset: 0; background: rgba(10,10,15,.4); z-index: 44; }
}
@media (min-width: 901px) { .sidebar { transform: none !important; } }

@media (max-width: 480px) {
  .view { padding: 18px 14px 50px; }
  .hero { padding: 26px 18px; } .hero h1 { font-size: 23px; } .hero p { font-size: 14px; }
  .rank-hero { padding: 26px 20px; } .rank-hero__big { font-size: 34px; }
  .stat__value { font-size: 32px; }
  .report-item { flex-wrap: wrap; }
  .report-item__actions { width: 100%; justify-content: flex-end; }
  .btn--lg { padding: 12px 18px; font-size: 14.5px; }
  .segmented button { padding: 8px 12px; font-size: 13px; }
  .brand__name { font-size: 22px; }
  .page-head h1 { font-size: 21px; }
  .msg { max-width: 96%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

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

button.step-pill{font:inherit;cursor:pointer;}

body.modal-lock { overflow: hidden; }
