/* ============================================================
   Patient Factory — Design System v3 "Aurora Workspace"
   젠스파크/마누스급 워크스페이스 룩앤필
   ============================================================ */

:root {
  --pf-blue: #2b7fff;
  --pf-indigo: #6366f1;
  --pf-violet: #8b5cf6;
  --pf-mint: #0dbf9e;
  --ink: #0f172a;
  --sidebar-w: 248px;
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ---------- 오로라 배경 ---------- */
.aurora-bg {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(99,102,241,.10), transparent 60%),
    radial-gradient(1000px 700px at -10% 20%, rgba(43,127,255,.10), transparent 55%),
    radial-gradient(900px 900px at 60% 110%, rgba(13,191,158,.08), transparent 55%),
    linear-gradient(180deg, #f6f8fc 0%, #eef2f9 100%);
}
.aurora-bg::before, .aurora-bg::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
  animation: orbFloat 18s ease-in-out infinite alternate;
}
.aurora-bg::before {
  width: 520px; height: 520px; top: -160px; right: -120px;
  background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(43,127,255,.16));
}
.aurora-bg::after {
  width: 460px; height: 460px; bottom: -180px; left: -140px;
  background: linear-gradient(135deg, rgba(13,191,158,.18), rgba(43,127,255,.12));
  animation-delay: -9s;
}
@keyframes orbFloat {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(-40px, 30px) scale(1.08); }
}

/* ---------- 글래스 ---------- */
.glass {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 8px 32px rgba(15,23,42,.06);
}
.glass-strong {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 16px 48px rgba(15,23,42,.10);
}

/* ---------- 사이드바 (다크) ---------- */
.pf-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 50;
  background: linear-gradient(180deg, #0d1424 0%, #111a30 60%, #0f1830 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.32,.72,.28,1);
}
.pf-sidebar.open { transform: translateX(0); box-shadow: 24px 0 64px rgba(2,6,23,.5); }
@media (min-width: 1024px) {
  .pf-sidebar { transform: none !important; box-shadow: none; }
  .pf-main { margin-left: var(--sidebar-w); }
}
.pf-sidebar::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px 260px at 20% 0%, rgba(43,127,255,.16), transparent 65%);
}

.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 10px; border-radius: 12px;
  color: #8fa3c8; font-size: 13.5px; font-weight: 500;
  transition: all .16s ease; cursor: pointer; position: relative;
  border: 1px solid transparent; width: calc(100% - 20px); text-align: left;
}
.sb-item i { width: 18px; text-align: center; font-size: 14px; transition: transform .16s ease; }
.sb-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.sb-item:hover i { transform: scale(1.12); }
.sb-item.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, rgba(43,127,255,.22), rgba(99,102,241,.16));
  border-color: rgba(43,127,255,.30);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 4px 14px rgba(43,127,255,.14);
}
.sb-item.active::before {
  content: ''; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: linear-gradient(180deg, #2b7fff, #8b5cf6);
}
.sb-section {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #4b5d80; padding: 14px 22px 5px;
}

/* ---------- 모바일 하단 네비 ---------- */
.pf-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: rgba(13,20,36,.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
@media (min-width: 1024px) { .pf-bottomnav { display: none; } }
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #7d90b5; font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 12px;
  transition: color .15s;
}
.bn-item i { font-size: 16px; }
.bn-item.active { color: #7db4ff; }

/* ---------- 카드 & 버튼 ---------- */
.pf-card {
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.04);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pf-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15,23,42,.06), 0 16px 40px rgba(43,127,255,.10);
  border-color: rgba(43,127,255,.25);
}
.btn-primary {
  background: linear-gradient(135deg, #2b7fff, #5b5ef0);
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px rgba(43,127,255,.35), inset 0 1px 0 rgba(255,255,255,.25);
  transition: all .18s ease;
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 6px 20px rgba(43,127,255,.45), inset 0 1px 0 rgba(255,255,255,.25); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #cbd5e1; box-shadow: none; transform: none; filter: none; }

.grad-text {
  background: linear-gradient(120deg, #1e3a8a, #2b7fff 45%, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 애니메이션 ---------- */
.fade-in { animation: fadeIn .32s cubic-bezier(.21,.68,.32,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise-in { animation: riseIn .5s cubic-bezier(.21,.9,.3,1.1) both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.stagger > * { animation: riseIn .45s cubic-bezier(.21,.9,.3,1.05) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }

.spinner {
  width: 20px; height: 20px; border: 3px solid rgba(43,127,255,.22);
  border-top-color: #2b7fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 탭(구버전 호환) */
.tab-active { border-bottom: 2px solid #2b7fff; color: #1a6bec; font-weight: 600; }

.badge-pass { background:#dcfce7; color:#15803d; }
.badge-warn { background:#fef9c3; color:#a16207; }
.badge-fixed { background:#fee2e2; color:#b91c1c; }

.result-body { white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.result-body h2, .result-body strong { font-weight: 700; }

textarea:focus, input:focus, select:focus { outline: 2px solid rgba(43,127,255,.25); outline-offset: 1px; }

@media (max-width: 640px) { .result-body { font-size: 0.9rem; } }

/* 문서 팩토리 종이 느낌 */
.doc-paper {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  max-height: 60vh;
  overflow-y: auto;
}

/* ---------- AI 에이전트 ---------- */
.ag-spin { animation: agspin 0.8s linear infinite; }
@keyframes agspin { to { transform: rotate(360deg); } }
.ag-cursor { animation: agblink 1s step-end infinite; color: #2b7fff; }
@keyframes agblink { 50% { opacity: 0; } }

/* 에이전트 히어로 아이콘 글로우 */
.ag-hero-icon {
  position: relative;
  background: linear-gradient(135deg, #2b7fff, #7c3aed);
  box-shadow: 0 12px 36px rgba(43,127,255,.35), inset 0 1px 0 rgba(255,255,255,.35);
}
.ag-hero-icon::after {
  content: ''; position: absolute; inset: -8px; border-radius: inherit; z-index: -1;
  background: linear-gradient(135deg, rgba(43,127,255,.35), rgba(124,58,237,.3));
  filter: blur(18px); opacity: .7;
  animation: heroGlow 3s ease-in-out infinite alternate;
}
@keyframes heroGlow { from { opacity: .5; transform: scale(.96); } to { opacity: .9; transform: scale(1.05); } }

/* 에이전트 입력 독 */
.ag-dock {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1.5px solid rgba(226,232,240,1);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.05);
  transition: border-color .2s, box-shadow .2s;
}
.ag-dock:focus-within {
  border-color: rgba(43,127,255,.55);
  box-shadow: 0 12px 44px rgba(43,127,255,.18), 0 0 0 4px rgba(43,127,255,.08);
}

/* 제안 칩 */
.ag-chip {
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 16px;
  transition: all .18s ease;
}
.ag-chip:hover {
  border-color: rgba(43,127,255,.45);
  background: rgba(238,247,255,.95);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(43,127,255,.14);
}

/* 스크롤바 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.28); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.45); border: 2px solid transparent; background-clip: content-box; }

/* 사이드바 스크롤 */
.pf-sidebar nav::-webkit-scrollbar { width: 5px; }
.pf-sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }

/* 드로어 오버레이 */
.pf-overlay {
  position: fixed; inset: 0; z-index: 49; background: rgba(2,6,23,.5);
  backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s;
}
.pf-overlay.show { opacity: 1; pointer-events: auto; }

/* 모바일 콘텐츠 하단 여백 (바텀 네비 높이만큼) */
@media (max-width: 1023px) { .pf-content-pad { padding-bottom: 76px; } }

/* ============================================================
   v3.5 Super Upgrade — 커맨드 팔레트 / 스켈레톤 / 파이프라인 / 필탭
   ============================================================ */

/* ---------- 커맨드 팔레트 (⌘K) ---------- */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  animation: fadeIn .15s ease-out;
}
.cmdk-panel {
  width: 100%; max-width: 560px;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(226,232,240,1);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(2,6,23,.4);
  overflow: hidden;
  animation: cmdkPop .22s cubic-bezier(.21,.9,.3,1.15);
}
@keyframes cmdkPop { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
.cmdk-input {
  width: 100%; border: 0; outline: none !important; background: transparent;
  padding: 18px 20px; font-size: 15px;
}
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 6px; border-top: 1px solid #eef2f7; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 12px; font-size: 13.5px; text-align: left;
  color: #334155; cursor: pointer;
}
.cmdk-item .ci-ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  background: #f1f5f9; color: #64748b; transition: all .12s;
}
.cmdk-item.sel {
  background: linear-gradient(135deg, rgba(43,127,255,.10), rgba(124,58,237,.07));
  color: #0f172a;
}
.cmdk-item.sel .ci-ico { background: linear-gradient(135deg,#2b7fff,#6d5ef0); color: #fff; }
.cmdk-hint { font-size: 10.5px; color: #94a3b8; padding: 9px 16px; border-top: 1px solid #eef2f7; display: flex; gap: 14px; }
.cmdk-hint kbd {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; font-family: inherit; font-size: 10px;
}

/* ---------- 스켈레톤 시머 ---------- */
.skel {
  position: relative; overflow: hidden;
  background: #e9eef5; border-radius: 10px;
}
.skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 공장 파이프라인 ---------- */
.pipeline { display: flex; align-items: center; justify-content: center; gap: 0; }
.pipe-node { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 82px; }
.pipe-dot {
  width: 40px; height: 40px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: #eef2f7; color: #94a3b8; border: 1.5px solid #e2e8f0;
  transition: all .35s cubic-bezier(.34,1.4,.44,1);
}
.pipe-node.run .pipe-dot {
  background: linear-gradient(135deg,#2b7fff,#6d5ef0); color: #fff; border-color: transparent;
  box-shadow: 0 6px 20px rgba(43,127,255,.4);
  animation: pipePulse 1.2s ease-in-out infinite;
}
.pipe-node.done .pipe-dot { background: #ecfdf8; color: #0dbf9e; border-color: rgba(13,191,158,.4); }
@keyframes pipePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }
.pipe-label { font-size: 10.5px; font-weight: 600; color: #94a3b8; }
.pipe-node.run .pipe-label { color: #1a6bec; }
.pipe-node.done .pipe-label { color: #0aa387; }
.pipe-line { flex: 1; max-width: 60px; height: 2px; background: #e2e8f0; margin: 0 2px 24px; position: relative; overflow: hidden; border-radius: 2px; }
.pipe-line.flow::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, #2b7fff, transparent);
  animation: lineFlow 1s linear infinite;
}
@keyframes lineFlow { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.pipe-line.done { background: rgba(13,191,158,.45); }

/* ---------- 필 탭 ---------- */
.pill-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: rgba(241,245,249,.8); border-radius: 14px; }
.pill-tab {
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  color: #64748b; white-space: nowrap; transition: all .16s; border: 1px solid transparent;
}
.pill-tab:hover { color: #334155; }
.pill-tab.on {
  background: #fff; color: #1557c4; font-weight: 700;
  border-color: rgba(43,127,255,.2);
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
}

/* ---------- 채널 선택 카드 ---------- */
.chan-card {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid #e2e8f0; border-radius: 14px; padding: 12px 13px;
  cursor: pointer; background: rgba(255,255,255,.75); transition: all .16s ease;
  font-size: 13.5px; position: relative;
}
.chan-card:hover { border-color: #bcdcff; transform: translateY(-1px); }
.chan-card.on {
  border-color: rgba(43,127,255,.6);
  background: linear-gradient(135deg, rgba(238,247,255,.95), rgba(243,240,255,.85));
  box-shadow: 0 4px 14px rgba(43,127,255,.13);
}
.chan-card .chan-check {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid #cbd5e1; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: transparent; transition: all .16s; flex-shrink: 0;
}
.chan-card.on .chan-check { background: linear-gradient(135deg,#2b7fff,#6d5ef0); border-color: transparent; color: #fff; }

/* ---------- 액션 칩(톤 조절) ---------- */
.act-chip {
  font-size: 12px; padding: 8px 13px; border-radius: 999px; font-weight: 600;
  background: rgba(241,245,249,.9); color: #475569; border: 1px solid transparent;
  transition: all .15s;
}
.act-chip:hover { background: #eef7ff; color: #1a6bec; border-color: rgba(43,127,255,.3); transform: translateY(-1px); }

/* 결과 블록 */
.res-block { background: rgba(248,250,252,.9); border: 1px solid #eef2f7; border-radius: 12px; padding: 13px 14px; }

