/* ═══════════════════════════════════════════════════
   Patient Funnel Manager - Design System
   ═══════════════════════════════════════════════════ */

@keyframes pulseHint {
  0%, 100% { box-shadow: 0 8px 30px rgba(15, 118, 110, 0.25); transform: scale(1); }
  50% { box-shadow: 0 12px 40px rgba(20, 184, 166, 0.55); transform: scale(1.015); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── 3분 환영 투어 (First-time User Tour) ─── */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease both;
  padding: 20px;
}
.tour-card {
  background: white;
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  padding: 0;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  overflow: hidden;
  animation: slideUp .4s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.tour-header {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: white;
  padding: 28px 28px 24px;
  position: relative;
}
.tour-header::before {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.tour-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.tour-header h3 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}
.tour-header p {
  font-size: 13px;
  opacity: 0.92;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}
.tour-body { padding: 24px 28px; }
.tour-feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.tour-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.tour-feature-emoji { font-size: 22px; flex-shrink: 0; }
.tour-feature-text { flex: 1; }
.tour-feature-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 2px;
  letter-spacing: -0.2px;
}
.tour-feature-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  letter-spacing: -0.2px;
}
.tour-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.tour-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all .3s;
}
.tour-progress-dot.active { background: #0f766e; width: 24px; border-radius: 4px; }
.tour-progress-dot.done { background: #a7f3d0; }
.tour-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 20px 28px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}
.tour-skip {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 500;
}
.tour-skip:hover { color: #64748b; text-decoration: underline; }
.tour-spacer { flex: 1; }
.tour-prev, .tour-next {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all .2s;
}
.tour-prev {
  background: white;
  color: #0f766e;
  border: 1.5px solid #0f766e;
}
.tour-prev:hover { background: #f0fdfa; }
.tour-next {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}
.tour-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.35);
}
.tour-next .arrow { margin-left: 6px; transition: transform .2s; display: inline-block; }
.tour-next:hover .arrow { transform: translateX(3px); }

/* ─── Sample Data Welcome Banner (Aha Moment) ─── */
.sample-banner {
  display: flex;
  gap: 20px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #5eead4 100%);
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(15, 118, 110, 0.25);
  animation: fadeIn .4s ease both;
}
.sample-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,0.15) 0%, transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(255,255,255,0.08) 0%, transparent 40%);
  pointer-events: none;
}
.sample-banner-icon {
  font-size: 52px;
  flex-shrink: 0;
  align-self: flex-start;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  animation: sparkle 2s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-5deg) scale(1.08); }
  75% { transform: rotate(5deg) scale(1.08); }
}
.sample-banner-content { flex: 1; min-width: 0; position: relative; z-index: 1; }
.sample-banner-content h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  line-height: 1.4;
}
.sample-banner-content h3 u {
  background: rgba(255,255,255,0.22);
  padding: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 900;
}
.sample-banner-content p {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.95;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}
.sample-banner-content strong { color: #fef08a; }
.sample-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: -0.2px;
}
.sample-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.btn-sample-inject {
  background: white;
  color: #0f766e;
  border: none;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.btn-sample-inject:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.btn-sample-inject:active:not(:disabled) { transform: scale(0.97); }
.btn-sample-inject:disabled { opacity: 0.7; cursor: wait; }
.btn-sample-skip {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
  white-space: nowrap;
}
.btn-sample-skip:hover { background: rgba(255,255,255,0.12); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) {
  .sample-banner { flex-direction: column; padding: 20px; gap: 16px; }
  .sample-banner-icon { font-size: 40px; align-self: center; }
  .sample-banner-actions { flex-direction: row; justify-content: center; align-self: stretch; }
  .btn-sample-inject, .btn-sample-skip { flex: 1; }
  .sample-banner-content { text-align: center; }
  .sample-banner-meta { justify-content: center; }
}

:root {
  --primary: #0f766e;
  --primary-light: #14b8a6;
  --primary-dark: #0d5f59;
  --primary-bg: #f0fdfa;
  --secondary: #6366f1;
  --secondary-light: #818cf8;
  --accent: #f59e0b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: rgba(20, 184, 166, 0.15);
  
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #14b8a6;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --sidebar-width: 260px;
  --header-height: 60px;
  --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

body.app-loaded {
  overflow: hidden;
  height: 100vh;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Auth Screen ─── */
.auth-screen {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f766e 0%, #0d5f59 50%, #134e4a 100%);
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  position: relative;
}
.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(20,184,166,0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(15,118,110,0.2) 0%, transparent 40%);
  pointer-events: none;
}
.auth-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  max-width: 1080px;
  width: 100%;
  align-items: center;
  position: relative;
  z-index: 1;
}
.auth-story { color: white; padding: 24px; }
.auth-story-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.2);
}
.auth-story h2 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.8px;
  margin-bottom: 12px;
}
.auth-story h2 .highlight {
  background: linear-gradient(135deg, #5eead4 0%, #a7f3d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* ═══ A안 v2: 깔끔한 SaaS 리디자인 (거대한 SVG 제거) ═══ */
.auth-wordmark-v2 {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  position: relative;
  z-index: 2;
}
.auth-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5eead4 0%, #14b8a6 100%);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(94, 234, 212, 0.35);
  box-sizing: border-box;
}
.auth-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
  white-space: nowrap;
  opacity: 0.95;
}
.auth-story-headline {
  font-size: 56px;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -2px;
  margin: 0 0 24px;
  color: #ffffff !important;
  position: relative;
  z-index: 2;
}
.auth-story-headline .highlight {
  background: linear-gradient(135deg, #5eead4 0%, #a7f3d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-story-sub {
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 40px;
  letter-spacing: -0.2px;
  position: relative;
  z-index: 2;
}
.auth-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  position: relative;
  z-index: 2;
}
.auth-feature-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 14px;
  transition: all 0.2s ease;
}
.auth-feature-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(94, 234, 212, 0.3);
  transform: translateY(-2px);
}
.auth-feature-emoji {
  font-size: 22px;
  margin-bottom: 8px;
  line-height: 1;
}
.auth-feature-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.auth-feature-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: -0.1px;
  line-height: 1.4;
}
.auth-story .subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  margin-bottom: 28px;
  letter-spacing: -0.2px;
}
.auth-story-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.auth-metric {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.auth-metric-value {
  font-size: 22px;
  font-weight: 800;
  color: #5eead4;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.auth-metric-label {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  letter-spacing: -0.2px;
}
.auth-story-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  letter-spacing: -0.2px;
}
.auth-feature-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(94,234,212,0.2);
  border: 1px solid rgba(94,234,212,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #5eead4;
  flex-shrink: 0;
  font-weight: 800;
}
.auth-quote {
  background: rgba(255,255,255,0.06);
  border-left: 3px solid #5eead4;
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,0.9);
  font-style: italic;
}
.auth-quote-author {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: #5eead4;
  font-style: normal;
  font-weight: 600;
}
.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  position: relative;
  z-index: 1;
}
.auth-trust-bar {
  margin-top: 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 100%);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  font-size: 11px;
  color: #0f766e;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.auth-trust-bar .trust-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.auth-demo-banner {
  margin-top: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fbbf24;
  border-radius: 10px;
  font-size: 12px;
  color: #92400e;
  text-align: center;
  line-height: 1.5;
}
.auth-demo-banner strong { color: #78350f; }
.auth-demo-banner .demo-creds {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fbbf24;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #78350f;
}
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; gap: 24px; max-width: 480px; }
  .auth-story { text-align: center; padding: 16px 8px 0; }
  .auth-story h2 { font-size: 26px; }
  .auth-wordmark-v2 { margin-bottom: 24px; justify-content: center; }
  .auth-story-headline { font-size: 40px; letter-spacing: -1.4px; margin-bottom: 18px; }
  .auth-story-sub { font-size: 14px; margin-bottom: 28px; }
  .auth-feature-grid { max-width: 460px; margin: 0 auto; }
  .auth-story-features { max-width: 420px; margin: 0 auto 24px; }
  .auth-story-metrics { max-width: 420px; margin: 0 auto 20px; }
  .auth-quote { text-align: left; max-width: 420px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .auth-story h2 { font-size: 22px; }
  .auth-story-headline { font-size: 32px; letter-spacing: -1px; }
  .auth-brand-name { font-size: 14px; }
  .auth-feature-grid { grid-template-columns: 1fr; gap: 8px; }
  .auth-feature-card { padding: 12px; }
  .auth-story .subtitle { font-size: 13px; }
  .auth-metric-value { font-size: 18px; }
  .auth-metric-label { font-size: 10px; }
  .auth-story-metrics { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .auth-metric { padding: 10px 6px; }
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.auth-logo-icon svg { color: white; }
.auth-logo h1 {
  font-size: 38px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 8px 0 0;
}
.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
  font-weight: 500;
}
@media (max-width: 768px) {
  .auth-logo h1 { font-size: 30px; }
}
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  border: none;
  background: transparent;
}
.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #0a4f49); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-full { width: 100%; }
.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
}
.auth-error.show { display: block; }

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease;
  z-index: 100;
}
.sidebar-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--header-height);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo svg { width: 20px; height: 20px; color: white; }
.sidebar-title {
  overflow: hidden;
}
.sidebar-title h2 {
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}
.sidebar-title small {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}
.nav-section {
  margin-bottom: 4px;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-sidebar);
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: white;
}
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }
.nav-item-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.nav-group-toggle {
  margin-left: auto;
  transition: transform 0.2s;
}
.nav-group-toggle.open { transform: rotate(180deg); }
.nav-group-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  position: relative;
  margin: 2px 0 4px 22px; /* 왼쪽 들여쓰기 + 위아래 간격 */
  padding-left: 10px;
  border-left: 1.5px solid rgba(255,255,255,0.12); /* 트리 구분선 */
}
.nav-group-children.open { max-height: 500px; }
.nav-group-children .nav-item {
  padding-left: 14px;       /* 구분선에서 살짝 띄움 */
  font-size: 12px;          /* 하위는 약간 작게 */
  font-weight: 400;
  opacity: 0.85;
  position: relative;
}
.nav-group-children .nav-item:hover { opacity: 1; }
.nav-group-children .nav-item.active {
  opacity: 1;
  font-weight: 600;
}
/* active 하위 항목 앞에 밝은 점 표시 */
.nav-group-children .nav-item.active::before {
  content: '';
  position: absolute;
  left: -11.5px;
  top: 50%;
  width: 2.5px;
  height: 16px;
  background: var(--primary, #4f46e5);
  border-radius: 2px;
  transform: translateY(-50%);
}
.nav-group-children .nav-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.55;
}
.nav-group-children .nav-item.active svg { opacity: 0.95; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-user:hover { background: var(--bg-sidebar-hover); }
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
}
#userMenuChevron {
  transition: transform 0.2s ease;
}
#userMenuChevron svg { width: 16px; height: 16px; }

/* ─── User Popup Menu ─── */
.user-menu-chevron,
#userMenuChevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
#userMenuChevron svg { width: 16px; height: 16px; }
.user-popup-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px;
  right: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 999;
}
.user-popup-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s;
}
.user-popup-item:hover {
  background: var(--bg-hover);
}
.user-popup-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.user-popup-danger { color: var(--danger); }
.user-popup-danger svg { color: var(--danger); }
.user-popup-danger:hover { background: rgba(239, 68, 68, 0.08); }
.user-popup-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.main-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.main-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.main-header-title svg { color: var(--primary); }
.main-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.breadcrumb span { color: var(--text-secondary); }

.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Dashboard ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon svg { width: 24px; height: 24px; }
.stat-card-icon.teal { background: linear-gradient(135deg, #ccfbf1, #99f6e4); color: var(--primary); }
.stat-card-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--info); }
.stat-card-icon.amber { background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--accent); }
.stat-card-icon.purple { background: linear-gradient(135deg, #ede9fe, #c4b5fd); color: var(--secondary); }
.stat-card-body { flex: 1; }
.stat-card-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.stat-card-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.2; margin-top: 4px; }
.stat-card-sub { font-size: 11px; color: var(--success); font-weight: 500; margin-top: 4px; }

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title svg { color: var(--primary); width: 20px; height: 20px; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.quick-link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}
.quick-link-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.quick-link-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.quick-link-icon.teal-bg { background: var(--primary-bg); }
.quick-link-icon.blue-bg { background: #eff6ff; }
.quick-link-icon.amber-bg { background: #fffbeb; }
.quick-link-icon.purple-bg { background: #f5f3ff; }
.quick-link-text h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.quick-link-text p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Module Pages ─── */
.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.module-header .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-input {
  position: relative;
}
.search-input input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.search-input input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }
.search-input svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}
.category-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
  color: var(--text-secondary);
}
.category-tab:hover { border-color: var(--primary); color: var(--primary); }
.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ─── Cards Grid ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.content-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.content-card-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 36px;
}
.content-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.content-card-body {
  padding: 14px;
}
.content-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-card-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary);
}

/* ─── Pricing Table ─── */
.pricing-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pricing-table thead { background: var(--bg); }
.pricing-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.pricing-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-table tr:hover td { background: var(--bg); }
.price-value {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
}

/* ─── Case Detail ─── */
.case-detail-header {
  margin-bottom: 24px;
}
.case-detail-header h2 { font-size: 20px; font-weight: 700; }
.case-meta-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.meta-pill {
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.case-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.case-image-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.case-image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.case-image-type {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: white;
}
.case-image-type.before { background: var(--info); }
.case-image-type.during { background: var(--accent); }
.case-image-type.after { background: var(--success); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  overscroll-behavior: contain;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close-btn { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-light); padding: 4px 8px; border-radius: 6px; }
.modal-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 -4px 8px -4px rgba(0,0,0,0.06);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .form-group.full { grid-column: 1 / -1; }

/* ─── Presentation Mode ─── */
.presentation-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.presentation-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.presentation-content img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}
.presentation-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  transition: var(--transition);
}
.presentation-close:hover { background: rgba(255,255,255,0.3); }
.presentation-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  transition: var(--transition);
}
.presentation-nav:hover { background: rgba(255,255,255,0.25); }
.presentation-nav.prev { left: 16px; }
.presentation-nav.next { right: 16px; }
.presentation-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  z-index: 2001;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

/* ─── Loading ─── */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── File upload area ─── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-bg); }
.upload-area svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.upload-area p { color: var(--text-secondary); font-size: 13px; }
.upload-preview {
  margin-top: 12px;
  max-width: 200px;
  border-radius: var(--radius-sm);
}

/* ─── Responsive ─── */
/* ─── Responsive: Tablet ─── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -280px; height: 100vh; height: 100dvh; z-index: 200; transition: left 0.28s cubic-bezier(0.4,0,0.2,1); will-change: left; }
  .sidebar.open { left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    transition: opacity 0.25s;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .main-body { padding: 16px; }
  .main-header { padding: 0 12px; gap: 8px; }
  .main-header-title { font-size: 15px; }
  .main-header-title svg { width: 18px; height: 18px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { max-width: calc(100vw - 24px); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); margin: 12px; }
  .modal-body { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .auth-card { margin: 16px; padding: 32px 24px; }
  .kb-col { min-width: 200px !important; }
  .kb-board { gap: 10px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .kb-col { scroll-snap-align: start; }
  .stat-card { padding: 14px; }
  .btn { min-height: 44px; } /* 44px touch target */
  .btn-sm { min-height: 36px; padding: 8px 14px; }
  .btn-icon { width: 44px; height: 44px; }
  .nav-item { padding: 12px 14px; min-height: 44px; } /* touch-friendly nav */
  .chat-header-btn { width: 44px; height: 44px; }
  /* Table horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  thead, tbody, tr { display: table; width: 100%; table-layout: fixed; }
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 480px) {
  :root { --header-height: 52px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card-value { font-size: 20px; }
  .main-header { padding: 0 10px; height: var(--header-height); }
  .main-header-title { font-size: 14px; gap: 6px; }
  .main-body { padding: 10px; }
  .kb-col { min-width: 260px !important; max-width: 300px; }
  .auth-card { margin: 8px; padding: 24px 20px; max-width: 100%; }
  .modal { max-width: calc(100vw - 16px); border-radius: 12px; }
  .funnel-summary-grid { grid-template-columns: 1fr; }
  .btn { font-size: 13px; }
  /* Bottom safe area for iOS */
  .chat-input-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .sidebar-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* ─── Mobile Touch Optimization (#16) ─── */
@media (max-width: 768px) {
  /* All interactive elements: 44px min touch target */
  button, a, select, input[type="checkbox"], input[type="radio"],
  .ob-tag-remove, .ob-chip, .ob-tag-option, .choice-btn, .nps-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  /* Larger close/delete buttons on tags */
  .ob-tag-remove {
    min-width: 28px; min-height: 28px; font-size: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px;
  }
  .ob-tag { padding: 6px 8px 6px 10px; gap: 4px; }
  /* Larger dropdown options */
  .ob-tag-option { padding: 12px 14px; min-height: 44px; font-size: 14px; }
  /* Form inputs taller on mobile */
  .form-input, select.form-input, textarea.form-input { min-height: 44px; font-size: 16px; /* prevents iOS zoom */ }
  /* Table action buttons bigger */
  td .btn-sm, td .btn-icon { min-width: 36px; min-height: 36px; }
  /* Pagination touch targets */
  .pagination button, .pagination a { min-width: 40px; min-height: 40px; }
  /* Swipe-friendly cards */
  .stat-card, .post-card, .floor-card { touch-action: pan-y; }
  /* Prevent double-tap zoom on interactive elements */
  .sidebar .nav-item, .modal-footer button { touch-action: manipulation; }
  /* Larger checkboxes/radios */
  input[type="checkbox"], input[type="radio"] {
    min-width: 20px; min-height: 20px;
  }
  /* Tab buttons */
  .tab-btn, .auth-tab { min-height: 44px; padding: 10px 16px; }
}

@media (min-width: 1400px) {
  .kb-col { min-width: 280px; max-width: 360px; }
}

/* ─── Extra utilities ─── */
.is_active_0 { opacity: 0.5; }
textarea.form-input { resize: vertical; font-family: inherit; }
select.form-input { cursor: pointer; }
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
hr { border: none; border-top: 1px solid var(--border); }

/* ─── Scrollbar styling for kanban ─── */
.kb-board::-webkit-scrollbar { height: 8px; }
.kb-board::-webkit-scrollbar-track { background: var(--border-light); border-radius: 4px; }
.kb-board::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
.kb-board::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ─── Selection & Focus ─── */
::selection { background: var(--primary-bg); color: var(--primary-dark); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }

/* ─── Smooth transitions ─── */
.btn, .stat-card, .content-card, .post-card, .kb-card, .quick-link-card {
  transition: all 0.2s ease;
}

/* ─── Touch Active States ─── */
@media (hover: none) and (pointer: coarse) {
  .btn:active { transform: scale(0.97); opacity: 0.85; }
  .btn-primary:hover { transform: none; box-shadow: none; }
  .stat-card:hover, .post-card:hover, .kb-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .nav-item:active { background: var(--bg-sidebar-active); }
  .chat-room-item:active { background: #dcfce7; }
  .chat-user-item:active { background: #dcfce7; }
  .chat-quick-item:active { background: #f0fdf4; border-color: #0f766e; }
}

/* ─── Loading Spinner ─── */
.loading-spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Page Transition ─── */
.main-body > * { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Improved Scrolling ─── */
.main-body, .sidebar-nav, .chat-messages, .chat-room-list, .chat-user-list, .modal-body {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ─── Safe area (notch devices) ─── */
@supports (padding: env(safe-area-inset-bottom)) {
  .app-layout { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* ─── Status Colors (global) ─── */
.status-urgent { color: #ef4444; }
.status-high { color: #f59e0b; }
.status-normal { color: #6366f1; }
.status-low { color: #94a3b8; }

/* ─── Kanban Board ─── */
.kb-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 8px 14px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kb-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
  align-items: flex-start;
}
.kb-col {
  min-width: 260px;
  max-width: 320px;
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.kb-col.kb-drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
  background: #f0fdfa;
}
.kb-col-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  border-bottom: 3px solid var(--col-color, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-card);
}
.kb-col-count {
  font-size: 11px;
  font-weight: 700;
  color: white;
  padding: 1px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}
.kb-col-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}
.kb-col-empty {
  text-align: center;
  padding: 24px 8px;
  color: var(--text-muted);
  font-size: 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
}
.kb-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
  border-left: 4px solid var(--accent, var(--primary));
  position: relative;
}
.kb-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kb-card:active { cursor: grabbing; }
.kb-card.kb-dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none;
}
.kb-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}
.kb-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.kb-card-badge {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: color-mix(in srgb, var(--badge-color, #6366f1) 15%, transparent);
  /* WCAG AA 명암비 확보를 위해 원색 대신 어둡게 섞은 색상 사용 (밝은 배경 위 저대비 방지) */
  color: color-mix(in srgb, var(--badge-color, #6366f1) 60%, black);
}
/* 상태 뱃지 공용 클래스 (인터뷰/공고/체크리스트 등): --chip-color만 지정하면
   원색+22 hex-alpha 대신 색상혼합으로 WCAG AA 명암비를 보장 */
.status-chip {
  background: color-mix(in srgb, var(--chip-color, #6366f1) 15%, transparent);
  color: color-mix(in srgb, var(--chip-color, #6366f1) 60%, black);
}
[data-theme="dark"] .status-chip {
  background: color-mix(in srgb, var(--chip-color, #6366f1) 30%, transparent);
  color: color-mix(in srgb, var(--chip-color, #6366f1) 55%, white);
}

/* KPI 목표 이력 금액: 라이트/다크 테마에서 각각 var(--bg-card) 배경 위 충분한
   명암비를 갖도록 색상을 분리 지정 (기존 고정 #3b82f6은 다크 카드 배경에서
   측정 3.66:1로 위반, 라이트 카드 배경에서도 3.68:1로 근소하게 위반) */
.kpi-history-amount {
  color: #1e40af;
}
[data-theme="dark"] .kpi-history-amount {
  color: #60a5fa;
}
.kb-card-info {
  color: var(--text-muted);
  font-size: 11px;
}

/* ─── Hire Module ─── */
.hire-posting-card:hover, .hire-applicant-card:hover, .hire-interview-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.onboard-task:hover { background: var(--border-light) !important; }
#hireStatusFilter .active, #appStatusFilter .active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

/* ─── Treatment Board Extra ─── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.tb-summary { margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════
   Patient Funnel Analytics Styles
   ═══════════════════════════════════════════════════ */
.funnel-controls { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.funnel-tabs { display:flex; gap:2px; background:var(--bg); border-radius:var(--radius-sm); padding:3px; }
.funnel-tab-btn { padding:8px 16px; border:none; background:transparent; border-radius:4px; font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; color:var(--text-secondary); transition:var(--transition); }
.funnel-tab-btn.active { background:var(--bg-card); color:var(--primary); box-shadow:var(--shadow-sm); }
.funnel-tab-btn:hover:not(.active) { color:var(--text); }
.funnel-period-btns { display:flex; gap:4px; }
.funnel-loading { text-align:center; padding:60px 20px; }
.funnel-empty { text-align:center; padding:40px; color:var(--text-muted); }
.funnel-empty-small { text-align:center; padding:20px; color:var(--text-muted); font-size:13px; }

/* ═══════════════════════════════════════════════════
   v5.13.2 범용 서브탭 (관리/통계 통합 페이지 공용)
   ═══════════════════════════════════════════════════ */
.pfm-subtabs { display:flex; gap:2px; background:var(--bg); border-radius:var(--radius-sm); padding:3px; margin-bottom:16px; width:fit-content; }
.pfm-subtab-btn { padding:8px 18px; border:none; background:transparent; border-radius:4px; font-size:13px; font-weight:700; cursor:pointer; font-family:inherit; color:var(--text-secondary); transition:var(--transition); white-space:nowrap; }
.pfm-subtab-btn.active { background:var(--bg-card); color:var(--primary); box-shadow:var(--shadow-sm); }
.pfm-subtab-btn:hover:not(.active) { color:var(--text); }
@media (max-width:640px) { .pfm-subtabs { width:100%; overflow-x:auto; } }

/* Summary Cards */
.funnel-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; margin-bottom:20px; }
.funnel-summary-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; display:flex; align-items:center; gap:14px; transition:var(--transition); }
.funnel-summary-card:hover { box-shadow:var(--shadow-md); transform:translateY(-2px); }
.funnel-summary-icon { font-size:24px; width:48px; height:48px; border-radius:var(--radius); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.funnel-summary-body { flex:1; min-width:0; }
.funnel-summary-label { font-size:12px; color:var(--text-secondary); font-weight:500; }
.funnel-summary-value { font-size:24px; font-weight:800; line-height:1.2; margin-top:2px; }
.funnel-summary-sub { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* Funnel Visualization */
.funnel-viz-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; margin-bottom:20px; }
.funnel-viz-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.funnel-viz-title { font-size:18px; font-weight:800; }
.funnel-viz-subtitle { font-size:12px; color:var(--text-muted); margin-top:2px; }
.funnel-viz-container { max-width:100%; }
.funnel-stage-row { display:flex; align-items:center; gap:10px; padding:6px 0; cursor:pointer; transition:background .15s; border-radius:var(--radius-sm); }
.funnel-stage-row:hover { background:var(--border-light); }
.funnel-stage-info { display:flex; align-items:center; gap:8px; width:130px; flex-shrink:0; }
.funnel-stage-icon { font-size:20px; width:28px; text-align:center; }
.funnel-stage-label-wrap { display:flex; flex-direction:column; }
.funnel-stage-label { font-size:13px; font-weight:700; }
.funnel-stage-desc { font-size:10px; color:var(--text-muted); display:none; }
.funnel-stage-bar-area { flex:1; display:flex; flex-direction:column; gap:2px; position:relative; }
.funnel-stage-bar-track { height:30px; background:var(--border-light); border-radius:6px; position:relative; overflow:hidden; margin:0 auto; border:1px solid var(--border); transition:all .2s; }
.funnel-stage-bar-fill { height:100%; border-radius:5px; transition:width .6s ease-out; }
.funnel-stage-count { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:800; color:var(--text); z-index:1; }
.funnel-stage-arrow { font-size:11px; font-weight:700; text-align:center; line-height:1; }
.funnel-stage-metrics { display:flex; align-items:center; gap:6px; width:180px; flex-shrink:0; justify-content:flex-end; }
.funnel-metric-badge { padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; white-space:nowrap; }
.funnel-metric-time { font-size:10px; color:var(--text-muted); white-space:nowrap; }
.funnel-trend { font-size:11px; font-weight:600; }
.funnel-trend.up { color:#22c55e; }
.funnel-trend.down { color:#ef4444; }

/* Amounts Row */
.funnel-amounts-row { display:flex; gap:12px; margin-top:20px; padding-top:16px; border-top:1px solid var(--border-light); }
.funnel-amount-item { flex:1; text-align:center; }
.funnel-amount-label { font-size:11px; color:var(--text-muted); display:block; }
.funnel-amount-value { font-size:18px; font-weight:800; margin-top:2px; display:block; }

/* Bottleneck Card */
.funnel-bottleneck-card { background:linear-gradient(135deg,#fef2f2,#fff7ed); border:1px solid #fecaca; border-radius:var(--radius); padding:18px 20px; margin-bottom:20px; display:flex; gap:14px; }
.funnel-bottleneck-header { display:flex; align-items:center; gap:14px; }
.funnel-bottleneck-icon { font-size:28px; flex-shrink:0; }
.funnel-bottleneck-title { font-size:15px; font-weight:700; color:#dc2626; }
.funnel-bottleneck-desc { font-size:12px; color:#92400e; margin-top:2px; }

/* Actions Card */
.funnel-actions-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; margin-bottom:20px; }
.funnel-actions-title { font-size:16px; font-weight:800; margin-bottom:16px; }
.funnel-actions-list { display:flex; flex-direction:column; gap:10px; }
.funnel-action-item { display:flex; gap:14px; padding:14px 16px; border-radius:var(--radius); border:1px solid var(--border); transition:var(--transition); }
.funnel-action-item:hover { box-shadow:var(--shadow-sm); }
.funnel-action-item.priority-critical { border-left:4px solid #ef4444; background:#fef2f2; }
.funnel-action-item.priority-high { border-left:4px solid #f59e0b; background:#fffbeb; }
.funnel-action-item.priority-medium { border-left:4px solid #22c55e; background:#f0fdf4; }
.funnel-action-priority { font-size:11px; font-weight:700; white-space:nowrap; padding-top:2px; }
.funnel-action-body { flex:1; min-width:0; }
.funnel-action-title-text { font-size:14px; font-weight:700; margin-bottom:4px; }
.funnel-action-desc { font-size:12px; color:var(--text-secondary); line-height:1.6; margin-bottom:4px; }
.funnel-action-impact { font-size:11px; color:var(--primary); font-weight:600; }

/* Insight Grid */
.funnel-insight-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:16px; margin-bottom:20px; }
.funnel-insight-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; }
.funnel-insight-title { font-size:14px; font-weight:700; margin-bottom:14px; }
.funnel-source-list { display:flex; flex-direction:column; gap:8px; }
.funnel-source-row { display:flex; align-items:center; gap:8px; }
.funnel-source-rank { width:20px; height:20px; border-radius:50%; background:var(--bg); font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; color:var(--text-secondary); flex-shrink:0; }
.funnel-source-name { font-size:13px; font-weight:500; width:80px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.funnel-source-bar-wrap { flex:1; height:8px; background:var(--border-light); border-radius:4px; overflow:hidden; }
.funnel-source-bar { height:100%; background:var(--accent); border-radius:4px; transition:width .4s; }
.funnel-source-count { font-size:12px; font-weight:600; color:var(--text-secondary); white-space:nowrap; }

/* Patient Filter Tabs */
.funnel-filter-tabs { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:16px; }
.funnel-filter-tab { font-size:11px !important; }
.funnel-filter-tab.active { background:var(--primary) !important; color:white !important; border-color:var(--primary) !important; }

/* Patient Cards */
.funnel-patients-grid { display:grid; gap:8px; }
.funnel-patient-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; display:flex; align-items:center; gap:14px; cursor:pointer; transition:var(--transition); }
.funnel-patient-card:hover { box-shadow:var(--shadow-sm); }
.funnel-patient-icon { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.funnel-patient-info { flex:1; min-width:0; }
.funnel-patient-name { display:flex; align-items:center; gap:8px; font-weight:700; font-size:14px; flex-wrap:wrap; }
.funnel-patient-stage { font-size:10px; padding:2px 8px; border-radius:8px; font-weight:600; }
.funnel-patient-source { font-size:10px; color:var(--text-muted); }
.funnel-patient-meta { font-size:11px; color:var(--text-muted); margin-top:3px; }
.funnel-patient-progress { display:flex; gap:4px; }
.funnel-progress-dot { width:8px; height:8px; border-radius:50%; background:#e5e7eb; transition:background .2s; }
.funnel-progress-dot.active { }

/* Detail Progress */
.funnel-detail-progress { display:flex; gap:4px; margin-bottom:12px; }
.funnel-detail-step { flex:1; height:6px; border-radius:3px; background:#e5e7eb; }
.funnel-detail-step.done { }

/* Skeleton UI */
.skeleton { background:linear-gradient(90deg,var(--border-light) 25%,var(--border) 50%,var(--border-light) 75%); background-size:200% 100%; animation:skeleton-pulse 1.5s ease-in-out infinite; border-radius:var(--radius-sm); }
@keyframes skeleton-pulse { 0% { background-position:200% 0; } 100% { background-position:-200% 0; } }
.skeleton-text { height:14px; margin-bottom:8px; }
.skeleton-card { height:80px; border-radius:var(--radius); margin-bottom:12px; }
.skeleton-stat { height:100px; border-radius:var(--radius); }

/* Error Boundary */
.error-boundary { background:#fef2f2; border:1px solid #fecaca; border-radius:var(--radius); padding:20px; text-align:center; }
.error-boundary-icon { font-size:32px; margin-bottom:8px; }
.error-boundary-title { font-size:15px; font-weight:700; color:#dc2626; margin-bottom:4px; }
.error-boundary-msg { font-size:13px; color:#92400e; margin-bottom:12px; }
.error-boundary-btn { padding:8px 16px; background:#ef4444; color:white; border:none; border-radius:var(--radius-sm); font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; }
.error-boundary-btn:hover { background:#dc2626; }

@media (max-width: 768px) {
  .funnel-summary-grid { grid-template-columns: 1fr 1fr; }
  .funnel-stage-info { width:80px; }
  .funnel-stage-desc { display:none !important; }
  .funnel-stage-metrics { width:100px; }
  .funnel-insight-grid { grid-template-columns: 1fr; }
  .funnel-controls { flex-direction:column; align-items:stretch; }
  .funnel-stage-row { gap:6px; }
  .funnel-metric-time { display:none; }
}
@media (max-width: 480px) {
  .funnel-summary-grid { grid-template-columns: 1fr; }
  .funnel-stage-metrics { width:80px; }
}

/* ═══════════════════════════════════════════════════
   Common Utility Classes (replaces inline styles)
   ═══════════════════════════════════════════════════ */

/* Layout */
.flex { display:flex; }
.flex-1 { flex:1; }
.flex-col { display:flex; flex-direction:column; }
.flex-center { display:flex; align-items:center; justify-content:center; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.flex-wrap { flex-wrap:wrap; }
.items-center { align-items:center; }
.gap-4 { gap:4px; } .gap-6 { gap:6px; } .gap-8 { gap:8px; } .gap-10 { gap:10px; } .gap-12 { gap:12px; } .gap-14 { gap:14px; } .gap-16 { gap:16px; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

/* Spacing */
.mb-4 { margin-bottom:4px; } .mb-8 { margin-bottom:8px; } .mb-12 { margin-bottom:12px; } .mb-16 { margin-bottom:16px; } .mb-20 { margin-bottom:20px; } .mb-24 { margin-bottom:24px; }
.mt-4 { margin-top:4px; } .mt-8 { margin-top:8px; } .mt-12 { margin-top:12px; } .mt-16 { margin-top:16px; }
.p-14 { padding:14px; } .p-16 { padding:16px; } .p-20 { padding:20px; } .p-24 { padding:24px; }

/* Text */
.text-center { text-align:center; }
.text-right { text-align:right; }
.text-xs { font-size:10px; } .text-sm { font-size:11px; } .text-base { font-size:12px; } .text-md { font-size:13px; } .text-lg { font-size:14px; } .text-xl { font-size:16px; } .text-2xl { font-size:18px; } .text-3xl { font-size:24px; } .text-4xl { font-size:28px; }
.font-500 { font-weight:500; } .font-600 { font-weight:600; } .font-700 { font-weight:700; } .font-800 { font-weight:800; }
.text-muted { color:var(--text-muted); }
.text-secondary { color:var(--text-secondary); }
.text-primary { color:var(--primary); }
.text-success { color:#22c55e; }
.text-danger { color:#ef4444; }
.text-warning { color:#f59e0b; }
.text-info { color:#3b82f6; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.whitespace-nowrap { white-space:nowrap; }

/* Common Card */
.card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); }
.card-lg { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; }
.card-sm { background:var(--bg-card); border:1px solid var(--border); border-radius:12px; padding:14px; text-align:center; }
.card:hover, .card-lg:hover { box-shadow:var(--shadow-sm); }

/* Module header pattern */
.mod-title { margin:0 0 14px; font-size:14px; font-weight:800; }
.mod-label { font-size:12px; font-weight:700; display:block; margin-bottom:4px; }
.mod-label-sm { font-size:13px; font-weight:600; display:block; margin-bottom:4px; }
.mod-sub { color:var(--text-muted); display:block; font-size:10px; margin-bottom:2px; }
.mod-muted-xs { font-size:10px; color:var(--text-muted); }
.mod-muted-sm { font-size:11px; color:var(--text-muted); }
.mod-muted-sm-bold { font-size:11px; color:var(--text-muted); font-weight:600; }
.mod-muted-xs-bold { font-size:10px; color:var(--text-muted); font-weight:600; }
.mod-empty { text-align:center; padding:40px; color:var(--text-muted); }

/* Common Input */
.input-sm { padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-size:12px; background:var(--bg-card); font-family:inherit; outline:none; }
.input-md { width:100%; padding:10px; border:1px solid var(--border); border-radius:8px; font-size:13px; background:var(--bg-card); font-family:inherit; outline:none; }
.input-outline { width:100%; padding:10px; border:1px solid #d1d5db; border-radius:8px; font-family:inherit; outline:none; }
.input-sm:focus, .input-md:focus, .input-outline:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(15,118,110,0.1); }

/* Table styles */
.tbl-header { padding:10px 8px; text-align:left; font-weight:700; font-size:11px; color:var(--text-muted); }
.tbl-cell { padding:10px 8px; text-align:right; border-bottom:2px solid var(--border); }
.tbl-cell-center { padding:8px; text-align:center; }

/* Pill / Badge */
.pill { display:inline-flex; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.pill-sm { display:inline-flex; padding:1px 6px; border-radius:8px; font-size:10px; font-weight:600; }

/* Hidden */
.hidden { display:none; }

/* ═══════════════════════════════════════
   Chat Panel (원내 메신저)
   ═══════════════════════════════════════ */

/* Backdrop */
.chat-panel-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.3); z-index:999; opacity:0; pointer-events:none; transition:opacity 0.2s; }
.chat-panel-backdrop.open { opacity:1; pointer-events:auto; }

/* Panel */
.chat-panel { position:fixed; top:0; right:-400px; width:380px; height:100vh; height:100dvh; background:#fff; z-index:1000; display:flex; flex-direction:column; box-shadow:-4px 0 24px rgba(0,0,0,0.12); transition:right 0.25s cubic-bezier(0.4,0,0.2,1); border-left:1px solid #e2e8f0; will-change:right; }
.chat-panel.open { right:0; }
@media(max-width:480px) { .chat-panel { width:100vw; right:-100vw; } .chat-panel.open { right:0; } }
@media(max-width:768px) { .chat-panel { width:100vw; right:-100vw; } .chat-panel.open { right:0; } }

/* Header */
.chat-panel-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid #f1f5f9; background:#fafffe; min-height:52px; }
.chat-panel-header-title { display:flex; align-items:center; gap:8px; }
.chat-panel-header-title h3 { font-size:15px; font-weight:800; color:#0f766e; margin:0; }
.chat-panel-icon { font-size:20px; }
.chat-panel-header-actions { display:flex; align-items:center; gap:4px; }
.chat-btn-icon { width:36px; height:36px; border:none; background:transparent; border-radius:8px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:#64748b; transition:all 0.15s; min-width:36px; }
.chat-btn-icon:hover { background:#f1f5f9; color:#0f766e; }

/* Room List */
.chat-room-list { flex:1; overflow-y:auto; }
.chat-room-item { display:flex; align-items:center; padding:12px 16px; cursor:pointer; transition:background 0.12s; gap:12px; border-bottom:1px solid #f8fafc; }
.chat-room-item:hover { background:#f0fdf4; }
.chat-room-item.unread { background:#f0fdf4; }
.chat-room-avatar { width:42px; height:42px; border-radius:50%; background:#0f766e; color:white; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:16px; flex-shrink:0; }
.chat-room-avatar.group { background:#3b82f6; font-size:18px; }
.chat-room-info { flex:1; min-width:0; }
.chat-room-name { font-size:13px; font-weight:700; color:#1e293b; display:flex; align-items:center; gap:6px; }
.chat-room-count { font-size:10px; color:#94a3b8; font-weight:400; }
.chat-room-last-msg { font-size:12px; color:#94a3b8; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.chat-room-meta { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex-shrink:0; }
.chat-room-time { font-size:10px; color:#94a3b8; white-space:nowrap; }
.chat-room-badge { background:#ef4444; color:white; font-size:10px; font-weight:700; min-width:18px; height:18px; border-radius:9px; display:flex; align-items:center; justify-content:center; padding:0 5px; }

/* Chat Empty */
.chat-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:60px 20px; text-align:center; }

/* Messages */
.chat-messages { flex:1; overflow-y:auto; padding:12px 16px; background:#f8fafc; }

/* Date Divider */
.chat-date-divider { text-align:center; margin:16px 0 12px; position:relative; }
.chat-date-divider::before { content:''; position:absolute; top:50%; left:0; right:0; height:1px; background:#e2e8f0; }
.chat-date-divider span { position:relative; background:#f8fafc; padding:0 12px; font-size:11px; color:#94a3b8; font-weight:600; }

/* Message Bubbles */
.chat-msg { display:flex; gap:8px; margin-bottom:6px; }
.chat-msg.consecutive { margin-bottom:2px; }
.chat-msg.mine { justify-content:flex-end; }
.chat-msg.other { justify-content:flex-start; }

.chat-msg-avatar { width:32px; height:32px; border-radius:50%; color:white; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; flex-shrink:0; margin-top:4px; }
.chat-msg-avatar-spacer { width:32px; flex-shrink:0; }

.chat-msg-content { max-width:75%; }
.chat-msg-sender { display:flex; align-items:center; gap:6px; margin-bottom:2px; }
.chat-msg-sender-name { font-size:12px; font-weight:700; color:#1e293b; }
.chat-msg-sender-role { font-size:10px; color:#94a3b8; font-weight:500; }

.chat-bubble { padding:8px 12px; border-radius:16px; font-size:13px; line-height:1.5; word-break:break-word; }
.chat-bubble.mine { background:#0f766e; color:white; border-bottom-right-radius:4px; }
.chat-bubble.other { background:white; color:#1e293b; border:1px solid #e2e8f0; border-bottom-left-radius:4px; }

.chat-msg-meta { display:flex; align-items:center; gap:6px; margin-top:2px; }
.chat-msg-time { font-size:10px; color:#94a3b8; }
.chat-read-label { font-size:10px; color:#0f766e; font-weight:600; }
.chat-msg.mine .chat-msg-meta { justify-content:flex-end; }

.chat-msg-quick { background:rgba(255,255,255,0.2); padding:1px 6px; border-radius:4px; font-size:11px; }
.chat-bubble.other .chat-msg-quick { background:rgba(15,118,110,0.1); }

.chat-msg-board-link { margin-top:6px; padding:6px 10px; background:rgba(255,255,255,0.15); border-radius:8px; font-size:12px; cursor:pointer; transition:background 0.15s; }
.chat-msg-board-link:hover { background:rgba(255,255,255,0.25); }
.chat-bubble.other .chat-msg-board-link { background:#f0fdf4; }
.chat-bubble.other .chat-msg-board-link:hover { background:#dcfce7; }

/* Input Area */
.chat-input-area { display:flex; align-items:center; gap:8px; padding:12px 16px; border-top:1px solid #f1f5f9; background:white; }
.chat-input { flex:1; padding:10px 14px; border:1.5px solid #e2e8f0; border-radius:20px; font-size:13px; font-family:inherit; outline:none; transition:border-color 0.15s; }
.chat-input:focus { border-color:#0f766e; box-shadow:0 0 0 3px rgba(15,118,110,0.08); }
.chat-send-btn { width:44px; height:44px; border:none; background:#0f766e; color:white; border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background 0.15s; flex-shrink:0; }
.chat-send-btn:hover { background:#0d9488; }

/* Quick Message Bar */
.chat-quick-bar { border-top:1px solid #f1f5f9; background:#fafffe; max-height:200px; overflow-y:auto; }
.chat-quick-list { padding:8px 12px; }
.chat-quick-category { font-size:10px; font-weight:700; color:#94a3b8; text-transform:uppercase; padding:6px 4px 4px; }
.chat-quick-item { display:inline-flex; align-items:center; gap:4px; padding:6px 12px; margin:2px; border:1px solid #e2e8f0; background:white; border-radius:16px; font-size:12px; cursor:pointer; transition:all 0.12s; font-family:inherit; }
.chat-quick-item:hover { border-color:#0f766e; background:#f0fdf4; color:#0f766e; }
.chat-quick-item.emergency { border-color:#fca5a5; color:#ef4444; }
.chat-quick-item.emergency:hover { background:#fef2f2; border-color:#ef4444; }

/* Search Bar */
.chat-search-bar { padding:8px 16px; border-bottom:1px solid #f1f5f9; }
.chat-search-input { width:100%; padding:8px 12px; border:1.5px solid #e2e8f0; border-radius:10px; font-size:13px; font-family:inherit; outline:none; }
.chat-search-input:focus { border-color:#0f766e; }

/* User List */
.chat-user-list { flex:1; overflow-y:auto; }
.chat-user-item { display:flex; align-items:center; padding:10px 16px; gap:10px; cursor:pointer; transition:background 0.12s; border-bottom:1px solid #f8fafc; }
.chat-user-item:hover { background:#f0fdf4; }
.chat-user-avatar { width:36px; height:36px; border-radius:50%; color:white; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex-shrink:0; }
.chat-user-info { flex:1; min-width:0; }
.chat-user-name { font-size:13px; font-weight:600; color:#1e293b; }
.chat-user-role { font-size:11px; color:#94a3b8; }

/* Selected Members */
.chat-selected-members { display:flex; flex-wrap:wrap; gap:4px; }

/* Footer */
.chat-panel-footer { padding:12px 16px; border-top:1px solid #f1f5f9; background:white; }
.chat-create-group-btn { width:100%; padding:10px; background:#0f766e; color:white; border:none; border-radius:10px; font-size:13px; font-weight:700; cursor:pointer; font-family:inherit; }
.chat-create-group-btn:disabled { opacity:0.5; cursor:not-allowed; }
.chat-create-group-btn:not(:disabled):hover { background:#0d9488; }

/* Chat Nav Badge */
.chat-nav-badge { display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px; padding:0 4px; background:#ef4444; color:white; border-radius:8px; font-size:9px; font-weight:700; margin-left:auto; }

/* Header Chat Button */
.chat-header-btn { position:relative; width:36px; height:36px; border:none; background:#f0fdf4; border-radius:10px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:#0f766e; transition:all 0.15s; }
.chat-header-btn:hover { background:#dcfce7; }

/* ═══════════════════════════════════════════════════
   Onboarding Wizard
   ═══════════════════════════════════════════════════ */
.ob-wrapper { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 50%, #faf5ff 100%); padding:20px; overflow-y:auto; }
.ob-container { background:white; border-radius:24px; box-shadow:0 25px 60px rgba(0,0,0,0.08); max-width:680px; width:100%; padding:40px; animation:obFadeIn 0.4s ease; display:flex; flex-direction:column; max-height:calc(100vh - 40px); }
@keyframes obFadeIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

/* Progress */
.ob-progress { margin-bottom:32px; }
.ob-progress-bar { height:4px; background:#e2e8f0; border-radius:4px; overflow:hidden; margin-bottom:16px; }
.ob-progress-fill { height:100%; background:linear-gradient(90deg, var(--primary), #14b8a6); border-radius:4px; transition:width 0.5s cubic-bezier(0.4,0,0.2,1); }
.ob-steps { display:flex; justify-content:space-between; }
.ob-step-dot { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; border:2px solid #e2e8f0; color:#94a3b8; background:white; transition:all 0.3s; -webkit-tap-highlight-color:transparent; }
.ob-step-dot.done { cursor:pointer; }
.ob-step-dot.done:hover { transform:scale(1.1); box-shadow:0 0 0 4px rgba(34,197,94,0.15); }
.ob-step-dot.active { border-color:var(--primary); color:var(--primary); background:#f0fdfa; box-shadow:0 0 0 4px rgba(15,118,110,0.1); }
.ob-step-dot.done { border-color:var(--success); color:white; background:var(--success); }

/* Header */
.ob-header { text-align:center; margin-bottom:28px; }
.ob-icon { font-size:48px; margin-bottom:12px; display:inline-block; animation:obBounce 0.6s ease; }
@keyframes obBounce { 0%,100% { transform:scale(1); } 50% { transform:scale(1.15); } }
.ob-title { font-size:22px; font-weight:800; color:var(--text); margin:0 0 6px; }
.ob-desc { font-size:14px; color:var(--text-secondary); margin:0; }

/* Content */
.ob-content { min-height:200px; margin-bottom:24px; overflow-y:auto; max-height:calc(100vh - 380px); -webkit-overflow-scrolling:touch; flex-shrink:1; }

/* Actions */
.ob-actions { display:flex; justify-content:space-between; align-items:center; padding-top:20px; border-top:1px solid var(--border-light); flex-shrink:0; position:sticky; bottom:0; background:white; z-index:5; }
.ob-btn { padding:12px 28px; font-size:14px; font-weight:700; border-radius:12px; min-width:100px; min-height:44px; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.ob-btn:disabled { opacity:0.6; cursor:not-allowed; }
.ob-skip-btn { background:none; border:none; color:var(--text-muted); font-size:13px; cursor:pointer; padding:10px 14px; border-radius:8px; transition:all 0.15s; min-height:44px; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.ob-skip-btn:hover { background:#f1f5f9; color:var(--text-secondary); }
.ob-skip-btn:disabled { opacity:0.5; cursor:not-allowed; }

/* Hint */
.ob-hint { text-align:center; font-size:12px; color:var(--text-muted); margin-top:16px; padding:10px; background:#f8fafc; border-radius:10px; }

/* Tip inside steps */
.ob-tip { font-size:12px; color:var(--text-secondary); background:#f0fdfa; border-left:3px solid var(--primary); padding:10px 14px; border-radius:0 8px 8px 0; margin-top:16px; line-height:1.7; }

/* Welcome */
.ob-welcome-hero { text-align:center; margin-bottom:24px; }
.ob-welcome-hero h3 { font-size:18px; font-weight:700; margin:0 0 8px; }
.ob-feature-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; }
.ob-feature-card { background:#f8fafc; border:1px solid var(--border-light); border-radius:14px; padding:16px 12px; text-align:center; transition:all 0.2s; }
.ob-feature-card:hover { border-color:var(--primary-light); background:#f0fdfa; transform:translateY(-2px); }
.ob-feature-icon { font-size:28px; display:block; margin-bottom:8px; }
.ob-feature-card strong { display:block; font-size:13px; margin-bottom:2px; }
.ob-feature-card small { font-size:11px; color:var(--text-muted); }

/* Chips */
.ob-chip-grid { display:flex; flex-wrap:wrap; gap:10px; }
.ob-chip-sm { gap:8px; }
.ob-chip { display:inline-flex; align-items:center; gap:6px; padding:10px 16px; border:2px solid #e2e8f0; border-radius:12px; cursor:pointer; font-size:13px; font-weight:600; background:white; transition:all 0.2s; user-select:none; -webkit-tap-highlight-color:transparent; touch-action:manipulation; min-height:44px; }
.ob-chip:hover { border-color:var(--primary-light); background:#f0fdfa; }
.ob-chip.selected { border-color:var(--primary); background:#f0fdfa; color:var(--primary); box-shadow:0 0 0 3px rgba(15,118,110,0.08); }
.ob-chip-icon { font-size:18px; }
.ob-chip-small { padding:8px 14px; font-size:12px; border-radius:8px; min-height:38px; }
.ob-chip-small .ob-chip-icon { font-size:14px; }

/* Section */
.ob-section { margin-bottom:20px; }
.ob-label { display:block; font-size:14px; font-weight:700; color:var(--text); margin-bottom:10px; }
.ob-divider { height:1px; background:var(--border-light); margin:20px 0; }

/* Tag Input (Region Search) */
.ob-tag-input-wrap { position:relative; border:2px solid var(--border); border-radius:12px; background:white; padding:8px 10px; display:flex; flex-wrap:wrap; align-items:center; gap:6px; cursor:text; transition:border-color 0.2s; min-height:48px; }
.ob-tag-input-wrap:focus-within { border-color:var(--primary); box-shadow:0 0 0 3px rgba(15,118,110,0.08); }
.ob-tags { display:flex; flex-wrap:wrap; gap:6px; }
.ob-tag { display:inline-flex; align-items:center; gap:4px; padding:4px 8px 4px 10px; background:#f0fdfa; border:1px solid #b2dfdb; border-radius:8px; font-size:13px; font-weight:600; color:var(--primary-dark, #0f766e); animation:tagIn 0.2s ease; }
@keyframes tagIn { from { transform:scale(0.8); opacity:0; } to { transform:scale(1); opacity:1; } }
.ob-tag-label { white-space:nowrap; }
.ob-tag-remove { border:none; background:none; color:var(--primary); cursor:pointer; font-size:16px; font-weight:700; padding:0 2px; line-height:1; border-radius:4px; transition:all 0.15s; display:flex; align-items:center; justify-content:center; width:20px; height:20px; }
.ob-tag-remove:hover { background:var(--primary); color:white; }
.ob-tag-search { border:none; outline:none; flex:1; min-width:180px; font-size:14px; padding:4px 0; background:transparent; color:var(--text); }
.ob-tag-search::placeholder { color:var(--text-muted); }
.ob-tag-dropdown { display:none; position:absolute; left:0; right:0; top:calc(100% + 4px); background:white; border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.12); z-index:100; max-height:280px; overflow-y:auto; }
.ob-tag-option { display:flex; align-items:center; gap:8px; padding:10px 14px; cursor:pointer; font-size:13px; transition:background 0.1s; }
.ob-tag-option:first-child { border-radius:12px 12px 0 0; }
.ob-tag-option:last-child { border-radius:0 0 12px 12px; }
.ob-tag-option:hover { background:#f0fdfa; }
.ob-tag-option.disabled { opacity:0.45; cursor:default; pointer-events:none; }
.ob-tag-opt-sido { color:var(--text-secondary); font-weight:500; min-width:44px; }
.ob-tag-opt-gu { font-weight:700; color:var(--text); }
.ob-tag-opt-check { margin-left:auto; color:var(--primary); font-weight:700; }
.ob-tag-option-more { padding:8px 14px; font-size:12px; color:var(--text-muted); text-align:center; border-top:1px solid var(--border-light); }

/* Hours */
.ob-hours-grid { display:flex; flex-direction:column; gap:12px; }
.ob-hours-row { display:flex; align-items:center; gap:12px; padding:12px 16px; background:#f8fafc; border-radius:12px; }
.ob-hours-label { display:flex; align-items:center; gap:8px; min-width:160px; cursor:pointer; font-size:13px; }
.ob-hours-label input[type="checkbox"] { width:18px; height:18px; accent-color:var(--primary); cursor:pointer; }
.ob-hours-times { display:flex; align-items:center; gap:8px; flex:1; transition:opacity 0.2s; }
.ob-time-input { width:110px !important; font-size:13px !important; padding:6px 10px !important; }

/* Floors */
.ob-floor-card { background:#f8fafc; border:1px solid var(--border); border-radius:14px; padding:16px; margin-bottom:12px; }
.ob-floor-header { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.ob-floor-del { background:none; border:1px solid var(--border); color:var(--text-muted); width:36px; height:36px; border-radius:8px; padding:0; display:flex; align-items:center; justify-content:center; cursor:pointer; touch-action:manipulation; }
.ob-floor-del:hover { color:var(--danger); border-color:var(--danger); }
.ob-space-list { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.ob-space-row { display:flex; align-items:center; gap:8px; padding:8px 10px; background:white; border:1px solid var(--border-light); border-radius:10px; }
.ob-add-btn { width:100%; margin-top:8px; border-style:dashed; border-radius:12px; }
.ob-add-space { font-size:12px; border-style:dashed; }

/* Staff Counter */
.ob-staff-grid { display:flex; flex-direction:column; gap:10px; }
.ob-staff-row { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; background:#f8fafc; border-radius:12px; }
.ob-staff-info { display:flex; align-items:center; gap:8px; font-size:14px; font-weight:600; }
.ob-staff-icon { font-size:20px; }
.ob-counter { display:flex; align-items:center; gap:0; background:white; border:1px solid var(--border); border-radius:10px; overflow:hidden; }
.ob-counter-btn { width:44px; height:44px; border:none; background:none; font-size:20px; font-weight:700; cursor:pointer; color:var(--text-secondary); transition:all 0.15s; display:flex; align-items:center; justify-content:center; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.ob-counter-btn:hover { background:var(--primary); color:white; }
.ob-counter-btn:active { transform:scale(0.9); }
.ob-counter-val { width:40px; text-align:center; font-size:16px; font-weight:800; color:var(--text); }
.ob-staff-total { text-align:center; padding:14px; background:#f0fdfa; border-radius:12px; margin-top:16px; font-size:14px; }

/* Mobile */
@media (max-width: 640px) {
  .ob-container { padding:24px 16px; border-radius:16px; max-height:calc(100vh - 24px); }
  .ob-content { max-height:calc(100vh - 340px); }
  .ob-feature-grid { grid-template-columns:repeat(2, 1fr); }
  .ob-hours-row { flex-direction:column; align-items:flex-start; gap:8px; }
  .ob-hours-times { width:100%; }
  .ob-space-row { flex-wrap:wrap; }
  .ob-space-row .form-input { min-width:0; }
  .ob-step-dot { width:28px; height:28px; font-size:10px; }
  .ob-title { font-size:18px; }
  .ob-chip { padding:10px 14px; min-height:44px; }
  .ob-chip-small { padding:8px 12px; min-height:40px; }
  .ob-tag-search { min-width:120px; font-size:13px; }
  .ob-tag-dropdown { max-height:200px; }
  .ob-tag { font-size:12px; }
  .ob-btn { padding:12px 20px; min-height:48px; }
  .ob-counter-btn { width:48px; height:48px; font-size:22px; }
  .ob-counter-val { width:48px; font-size:18px; }
  .ob-add-btn { min-height:48px; }
  .ob-add-space { min-height:40px; }
}
.chat-header-badge { position:absolute; top:-2px; right:-2px; min-width:16px; height:16px; padding:0 4px; background:#ef4444; color:white; border-radius:8px; font-size:9px; font-weight:700; display:flex; align-items:center; justify-content:center; border:2px solid white; }

/* ═══════════════════════════════════════════════════
   v3.2 Retention Edition - Recall + PWA Styles
   ═══════════════════════════════════════════════════ */

/* Recall page */
.recall-page { padding: 4px 0; }
.recall-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:12px; }
.recall-summary-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.recall-kpi-card {
  background: white;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.recall-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.recall-kpi-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.recall-kpi-value { font-size: 28px; font-weight: 800; color: #0f172a; margin: 6px 0 2px; }
.recall-kpi-sub { font-size: 12px; color: #94a3b8; }

.recall-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.recall-tab {
  background: transparent;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s;
}
.recall-tab:hover { color: #0f766e; }
.recall-tab.active { color: #0f766e; border-bottom-color: #0f766e; }

.recall-task-list { display: flex; flex-direction: column; gap: 10px; }
.recall-task-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.recall-task-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.08); }
.recall-task-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.recall-priority-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.recall-patient-name { font-size: 16px; font-weight: 700; color: #0f172a; }
.recall-phone { color: #64748b; font-size: 13px; }
.recall-phone a { color: #0f766e; text-decoration: none; }
.recall-phone a:hover { text-decoration: underline; }
.recall-status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: auto;
}
.status-pending { background: #fef3c7; color: #ca8a04; }
.status-done { background: #d1fae5; color: #059669; }
.status-reserved { background: #dbeafe; color: #2563eb; }
.status-skipped { background: #f3f4f6; color: #6b7280; }
.status-failed { background: #fee2e2; color: #dc2626; }

.recall-task-body { margin: 8px 0; }
.recall-reason { font-size: 14px; color: #334155; font-weight: 500; }
.recall-script {
  background: #f8fafc;
  border-left: 3px solid #0f766e;
  padding: 8px 12px;
  font-size: 13px;
  color: #475569;
  border-radius: 6px;
  margin-top: 6px;
  font-style: italic;
}
.recall-result { font-size: 13px; color: #475569; margin-top: 6px; }
.recall-reservation { font-size: 13px; color: #2563eb; margin-top: 6px; font-weight: 600; }
.recall-task-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.recall-empty {
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border-radius: 12px;
  font-size: 14px;
}

/* Recall rules modal */
.recall-rules-list { display:flex; flex-direction:column; gap:10px; max-height:60vh; overflow-y:auto; }
.recall-rule-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
.recall-rule-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.recall-rule-meta { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.recall-rule-script {
  background: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  font-style: italic;
  margin-bottom: 8px;
}
.recall-rule-actions { display:flex; gap:6px; }
.switch-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.switch-mini input { cursor: pointer; }

/* PWA install banner */
.pfm-install-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: 360px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15,118,110,0.22);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9000;
  animation: slideInBanner 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(15,118,110,0.12);
}
@keyframes slideInBanner {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.pfm-install-icon { font-size: 32px; flex-shrink: 0; }
.pfm-install-text { flex: 1; display: flex; flex-direction: column; }
.pfm-install-text strong { font-size: 14px; color: #0f172a; }
.pfm-install-text span { font-size: 12px; color: #64748b; margin-top: 2px; }
.pfm-install-actions { display: flex; gap: 4px; flex-shrink: 0; }
/* 배너 배경은 테마와 무관하게 항상 흰색 고정인데, 다크 테마에서 .btn-ghost가
   글래스 다크 스타일(반투명 남색 배경 + 밝은 회색 글씨)을 그대로 물려받아
   흰 배경 위에서 명암비가 무너짐(2.69:1) → 배너 안 버튼은 항상 라이트 스타일로 고정 */
.pfm-install-actions .btn-ghost {
  background: transparent !important;
  color: #334155 !important;
  border: 1px solid transparent !important;
  backdrop-filter: none !important;
}
.pfm-install-actions .btn-ghost:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .recall-kpi-value { font-size: 24px; }
  .recall-task-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .recall-status-badge { margin-left: 0; }
  .pfm-install-banner {
    left: 8px; right: 8px; bottom: 8px; max-width: none;
  }
}

/* ═══ v3.3 Aha Moment: 탐험 가이드 카드 ═══ */
.explore-card {
  background: linear-gradient(135deg, #fff 0%, #f0fdfa 100%);
  border: 2px solid #14b8a6;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.12);
  animation: exploreSlideIn 0.5s ease;
}
@keyframes exploreSlideIn {
  from { opacity: 0; transform: translateY(-10px) }
  to { opacity: 1; transform: translateY(0) }
}
.explore-card-header {
  display: flex; justify-content: space-between; align-items: start;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.explore-card-header h3 {
  margin: 0 0 4px; font-size: 17px; font-weight: 800; color: #0f172a;
}
.explore-card-header p {
  margin: 0; font-size: 12px; color: #64748b;
}
.explore-progress {
  min-width: 140px; text-align: right;
}
.explore-progress-bar {
  width: 140px; height: 8px; background: #e2e8f0; border-radius: 4px;
  overflow: hidden; margin-bottom: 4px;
}
.explore-progress-bar > div {
  height: 100%; background: linear-gradient(90deg, #14b8a6, #0ea5e9);
  border-radius: 4px; transition: width 0.4s ease;
}
.explore-progress-text {
  font-size: 11px; font-weight: 700; color: #0f766e;
}
.explore-tasks {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}
.explore-task {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
  cursor: pointer; transition: all 0.18s; text-align: left; width: 100%;
  font-family: inherit;
}
.explore-task:hover {
  border-color: #14b8a6; transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(20,184,166,0.15);
}
.explore-task.done {
  background: #f0fdf4; border-color: #bbf7d0; opacity: 0.75;
}
.explore-check { font-size: 18px; flex-shrink: 0; }
.explore-icon { font-size: 22px; flex-shrink: 0; }
.explore-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.explore-title { font-weight: 700; font-size: 13px; color: #0f172a; }
.explore-desc { font-size: 11px; color: #64748b; line-height: 1.3; }
.explore-arrow {
  font-size: 18px; color: #94a3b8; flex-shrink: 0; transition: transform 0.2s;
}
.explore-task:hover .explore-arrow {
  color: #14b8a6; transform: translateX(3px);
}
@media (max-width: 600px) {
  .explore-tasks { grid-template-columns: 1fr; }
  .explore-progress { min-width: auto; width: 100%; text-align: left; }
  .explore-progress-bar { width: 100%; }
}

/* ═══ 웰컴 투어 개선 - 스킵 방지 경고 ═══ */
.tour-skip-warning {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #fef3c7; border: 2px solid #f59e0b; color: #92400e;
  padding: 10px 20px; border-radius: 12px; font-size: 13px; font-weight: 600;
  z-index: 100002; box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  animation: warningPulse 1s ease;
}
@keyframes warningPulse {
  0% { opacity: 0; transform: translate(-50%, 20px) }
  100% { opacity: 1; transform: translate(-50%, 0) }
}

/* ═══ Aha Moment CTA 펄스 강조 (v3.4) ═══ */
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7), 0 6px 20px rgba(245, 158, 11, 0.4); transform: scale(1) }
  50% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0), 0 10px 28px rgba(245, 158, 11, 0.5); transform: scale(1.03) }
}
.pfm-cta-pulse {
  animation: ctaPulse 1.5s ease-in-out infinite !important;
  position: relative;
  z-index: 10;
}
@keyframes bounceY {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-6px) }
}

/* ═══ 인사이트 카드 hover 강조 ═══ */
.aha-insight-card:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}
.aha-insight-card:active {
  transform: translateY(0) !important;
}

/* 대시보드 샘플 배너 자체를 더 눈에 띄게 */
.sample-banner {
  position: relative;
}
.sample-banner::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #f59e0b, #14b8a6, #0ea5e9);
  z-index: -1;
  opacity: 0.5;
  animation: gradBorder 6s ease infinite;
  background-size: 200% 200%;
}
@keyframes gradBorder {
  0%, 100% { background-position: 0% 50% }
  50% { background-position: 100% 50% }
}

/* ═══════════════════════════════════════════════════════════
 * 📱 모바일 반응형 글로벌 보강 (v5.3.0)
 * 인라인 grid/flex 스타일이 너무 좁은 화면에서 깨지는 것 방지
 * ═══════════════════════════════════════════════════════════ */

/* 태블릿 (≤900px): 헤더/사이드 컬럼이 좁아짐 */
@media (max-width: 900px) {
  /* 인라인 minmax(260px+) 그리드 → 1열 강제 */
  [style*="minmax(260px"],
  [style*="minmax(280px"],
  [style*="minmax(300px"] {
    grid-template-columns: 1fr !important;
  }
  /* 모달 가로 폭 100%로 */
  .modal-content { max-width: 95vw !important; margin: 12px auto !important; }
  /* 테이블 가로 스크롤 */
  .pfm-table-wrap, table[style*="width:100%"] { overflow-x: auto; }
}

/* 모바일 (≤640px): 본격 1단 레이아웃 */
@media (max-width: 640px) {
  /* 모든 인라인 multi-column grid를 1~2열로 */
  [style*="minmax(200px"],
  [style*="minmax(220px"],
  [style*="minmax(240px"],
  [style*="minmax(180px"] {
    grid-template-columns: 1fr !important;
  }
  [style*="minmax(110px"],
  [style*="minmax(130px"],
  [style*="minmax(140px"],
  [style*="minmax(150px"],
  [style*="minmax(160px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* repeat(3, 1fr) 같은 명시 3열 → 1열 */
  [style*="repeat(3,1fr)"],
  [style*="repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* repeat(2, 1fr)도 좁으면 1열 */
  [style*="repeat(2,1fr)"],
  [style*="repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* 7열(주간 캘린더 등)은 가로 스크롤 */
  [style*="repeat(7,1fr)"],
  [style*="repeat(7, 1fr)"] {
    overflow-x: auto;
    min-width: 0;
  }

  /* 헤더 액션 영역 줄바꿈 */
  .actions, [class*="action-bar"] {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .actions .btn, .actions button {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 페이지 본문 패딩 축소 */
  .page-body { padding: 12px !important; }
  
  /* 모달 풀스크린에 가깝게 */
  .modal-content {
    max-width: 100vw !important;
    width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-height: 100vh;
  }

  /* 폼 grid → 1열 */
  .form-grid, .grid-2col, .grid-3col {
    grid-template-columns: 1fr !important;
  }

  /* details 패딩 축소 */
  details summary { padding: 10px !important; }

  /* 큰 폰트 줄이기 */
  h1, .h1 { font-size: 22px !important; }
  h2, .h2 { font-size: 18px !important; }
  h3, .h3 { font-size: 16px !important; }

  /* 백업/시뮬레이션 진행률 박스 */
  #backupSection > div:first-child,
  #simulationSection > div:first-child {
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: left !important;
  }

  /* 사이드바 모바일 처리 (기존 .open 클래스 활용) */
  .sidebar:not(.open) { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; padding-left: 0 !important; }
}

/* 초소형 (≤400px): 거의 모든 그리드 1열 */
@media (max-width: 400px) {
  [style*="minmax(110px"],
  [style*="minmax(130px"],
  [style*="minmax(140px"],
  [style*="minmax(150px"],
  [style*="minmax(160px"] {
    grid-template-columns: 1fr !important;
  }
  .btn { padding: 8px 12px !important; font-size: 13px !important; }
  .btn-sm { padding: 6px 10px !important; font-size: 12px !important; }
}

/* 터치 디바이스: 버튼 최소 44x44px (Apple HIG 가이드) */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
  }
  /* 작은 아이콘 버튼은 터치 영역만 확보 */
  .btn-icon, .modal-close {
    min-width: 44px;
    min-height: 44px;
  }
}

/* 빈 상태 UI 일관 스타일 */
.pfm-empty-state .btn {
  margin: 0 auto;
}
@media (max-width: 480px) {
  .pfm-empty-state { padding: 40px 12px !important; }
  .pfm-empty-state > div:first-child { font-size: 44px !important; }
}
