/* ===================================================
   DCMGChat — Main Stylesheet
   DC인사이드 BI 컬러 기반 다크 테마
   Primary Blue: #1E5CAD  Accent Orange: #F04E23
   =================================================== */

:root {
  --dc-blue: #1E5CAD;
  --dc-blue-light: #2D7DD2;
  --dc-blue-dim: #1a4f99;
  --dc-orange: #F04E23;
  --dc-orange-light: #FF6B3D;

  --bg: #0A0E1A;
  --surface: #111827;
  --surface2: #1A2235;
  --surface3: #1F2A40;
  --border: #1F2D45;
  --border-light: #2A3A55;

  --text: #F0F4FC;
  --text-muted: #7A8FAE;
  --text-dim: #4A5E7A;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

  --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--dc-blue-light); text-decoration: none; }
a:hover { color: var(--dc-blue); }

/* ── Navbar ── */
.navbar {
  height: 60px;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.logo-dc { color: var(--dc-blue-light); }
.logo-mg { color: var(--dc-orange); }
.logo-chat { color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.credits-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.nav-btn {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.nav-btn-ghost {
  color: var(--text-muted);
  background: transparent;
}
.nav-btn-ghost:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-btn-primary {
  background: var(--dc-blue);
  color: #fff;
}
.nav-btn-primary:hover {
  background: var(--dc-blue-light);
  color: #fff;
}

/* ── Main / Footer ── */
.main-content { flex: 1; }

.footer {
  padding: 20px 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--dc-blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--dc-blue-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30, 92, 173, 0.4);
}

.btn-ghost {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface3);
  color: var(--text);
}

.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-full { width: 100%; }

/* ── Flash Messages ── */
.flash-messages { padding: 0 24px; margin-top: 16px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.flash-error { background: rgba(240, 78, 35, 0.15); border: 1px solid rgba(240, 78, 35, 0.3); color: #ff7a5a; }
.flash-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #4ade80; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.875rem; }
.alert-error { background: rgba(240, 78, 35, 0.15); border: 1px solid rgba(240, 78, 35, 0.3); color: #ff7a5a; }

/* ── Page Container ── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}
.page-narrow { max-width: 640px; }

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

/* ── Hero Section ── */
.hero-section {
  background: radial-gradient(ellipse at 60% 0%, rgba(30, 92, 173, 0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 40% 80%, rgba(240, 78, 35, 0.08) 0%, transparent 50%);
  padding: 80px 24px 60px;
  text-align: center;
}

.hero-inner { max-width: 700px; margin: 0 auto; }

.hero-badge {
  display: inline-block;
  background: rgba(30, 92, 173, 0.2);
  border: 1px solid rgba(30, 92, 173, 0.4);
  color: var(--dc-blue-light);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--dc-blue-light) 0%, var(--dc-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 36px;
}

.search-form { margin-top: 8px; }

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--dc-blue-light); }

.search-prefix {
  padding: 0 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  border-right: 1px solid var(--border);
  line-height: 48px;
  background: var(--surface2);
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0 16px;
  height: 48px;
  font-family: var(--font);
}

.search-input-wrap input::placeholder { color: var(--text-dim); }

.search-input-wrap .btn {
  border-radius: 0;
  height: 48px;
  padding: 0 24px;
  flex-shrink: 0;
}

.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Admin Bar ── */
.admin-bar {
  background: rgba(30, 92, 173, 0.08);
  border-bottom: 1px solid rgba(30, 92, 173, 0.2);
  padding: 10px 24px;
}
.admin-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-bar-label {
  font-size: 0.78rem;
  color: var(--dc-blue-light);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.admin-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.admin-uid-prefix {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: monospace;
  white-space: nowrap;
}
.admin-add-form input {
  flex: 1;
  min-width: 120px;
  max-width: 240px;
  background: var(--surface2);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.admin-add-form input:focus { outline: none; border-color: var(--dc-blue-light); }

/* ── Home Hero ── */
.home-hero {
  background: radial-gradient(ellipse at 60% 0%, rgba(30, 92, 173, 0.18) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 100%, rgba(240, 78, 35, 0.08) 0%, transparent 50%);
  padding: 72px 24px 56px;
  text-align: center;
}
.home-hero-inner { max-width: 660px; margin: 0 auto; }
.home-hero-title {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 18px;
}
.home-hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 32px;
}
.home-hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Section Header ── */
.section-header { margin-bottom: 24px; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.section-desc { font-size: 0.875rem; color: var(--text-muted); }

/* ── Gallery Grid ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.gallery-card-active:hover {
  border-color: var(--dc-blue-light);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(30, 92, 173, 0.18);
  color: var(--text);
}
.gallery-card-pending { cursor: default; opacity: 0.65; }

.gallery-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.gallery-uid-badge {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: monospace;
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 6px;
}
.gallery-status-chip {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
}
.chip-done { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.chip-scraping { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.chip-pending { background: var(--surface2); color: var(--text-muted); }

/* 기존 호환 */
.gallery-status { font-size: 0.7rem; font-weight: 600; padding: 3px 8px; border-radius: 10px; }
.status-done { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.status-scraping { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.status-error { background: rgba(240, 78, 35, 0.15); color: #ff7a5a; }
.status-pending { background: var(--surface2); color: var(--text-muted); }

.gallery-uid { font-size: 0.75rem; color: var(--text-dim); font-family: monospace; }
.gallery-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.gallery-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.gallery-card-stats { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.gallery-stat {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.gallery-stat-active { color: #4ade80; }
.gallery-card-cta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dc-blue-light);
  margin-top: 4px;
}
.gallery-card-active:hover .gallery-card-cta { color: var(--dc-orange-light); }
.gallery-pending-msg { font-size: 0.8rem; color: var(--text-dim); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-icon-wrap { margin-bottom: 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.empty-sub { font-size: 0.875rem; color: var(--text-dim); margin-top: 8px; }

/* ── Auth ── */
.auth-wrapper {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-card-wide { max-width: 480px; }

.auth-logo {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 32px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
  width: 100%;
}
.form-group input:focus { border-color: var(--dc-blue-light); background: var(--surface3); }
.form-group input::placeholder { color: var(--text-dim); }

.terms-checkbox-wrap { padding: 4px 0; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.checkbox-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--dc-blue); }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--dc-blue-light); font-weight: 500; }

/* ── Terms ── */
.terms-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.terms-section:last-of-type { border-bottom: none; }
.terms-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--dc-blue-light); }
.terms-section p, .terms-section li { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; }
.terms-section ul { padding-left: 20px; margin-top: 8px; }
.terms-section li { margin-bottom: 4px; }
.terms-warn { margin-top: 10px; color: var(--dc-orange) !important; font-weight: 500; }
.terms-actions { display: flex; gap: 12px; margin-top: 32px; align-items: center; }

/* ── Gallery Hero ── */
.gallery-hero {
  background: linear-gradient(180deg, rgba(30, 92, 173, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 0;
}
.gallery-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 32px;
}
.back-link, .back-link a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-decoration: none;
}
.back-link:hover, .back-link a:hover { color: var(--text); }
.gallery-stats-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; }
.gallery-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Notice Bar ── */
.notice-bar {
  max-width: 1200px;
  margin: 24px auto;
  padding: 12px 24px;
  background: rgba(240, 78, 35, 0.08);
  border: 1px solid rgba(240, 78, 35, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #ff9a7a;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── User Cards ── */
.users-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s;
}
.user-card:hover {
  border-color: var(--dc-blue-light);
  box-shadow: 0 8px 24px rgba(30, 92, 173, 0.12);
  transform: translateY(-2px);
}

.user-card-header { display: flex; align-items: flex-start; gap: 12px; }

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dc-blue-dim), var(--dc-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}
.user-badges { display: flex; gap: 4px; flex-wrap: wrap; }

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.badge-fixed { background: rgba(30, 92, 173, 0.2); color: var(--dc-blue-light); }
.badge-semi { background: rgba(240, 78, 35, 0.15); color: #ff9060; }
.badge-gallery { background: var(--surface2); color: var(--text-dim); }

.user-stats { display: flex; gap: 16px; }
.user-stat { text-align: center; }
.stat-val { display: block; font-size: 1rem; font-weight: 700; color: var(--text); }
.stat-lbl { display: block; font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }

.user-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--dc-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  margin-top: auto;
}
.user-chat-btn:hover { background: var(--dc-blue-light); color: #fff; }
.user-chat-btn-disabled { background: var(--surface2); color: var(--text-dim); cursor: not-allowed; }
.user-chat-btn-disabled:hover { background: var(--surface2); color: var(--text-dim); }

/* ── Scraping Status ── */
.scraping-card { text-align: center; }
.scraping-header { margin-bottom: 32px; }
.scraping-anim { font-size: 2.5rem; margin-bottom: 16px; }
.scraping-dots { display: flex; gap: 8px; justify-content: center; }
.scraping-dots span {
  width: 12px; height: 12px;
  background: var(--dc-blue-light);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}
.scraping-dots span:nth-child(2) { animation-delay: 0.2s; }
.scraping-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

.scraping-uid { color: var(--text-muted); font-size: 0.9rem; font-family: monospace; margin-top: 6px; }

.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dc-blue), var(--dc-blue-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}
.progress-pct { font-size: 0.85rem; color: var(--text-muted); min-width: 36px; text-align: right; }
.scraping-message { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; min-height: 24px; }

.scraping-info { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.info-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.complete-section { padding-top: 16px; }

/* ── Profile ── */
.profile-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.profile-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.profile-label { font-size: 0.875rem; color: var(--text-muted); }
.profile-value { font-weight: 500; }
.credits-highlight { color: var(--dc-orange); font-size: 1.1rem; font-weight: 700; }
.profile-actions { margin-top: 8px; }

/* ── Chat Layout ── */
.chat-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chat-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.back-link-sidebar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}
.back-link-sidebar:hover { color: var(--text); }

.chat-profile {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.chat-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dc-blue-dim), var(--dc-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 12px;
}

.chat-profile-name { font-weight: 600; margin-bottom: 8px; }
.chat-profile-badges { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.chat-profile-stats { font-size: 0.75rem; color: var(--text-dim); }

.credits-panel {
  padding: 20px;
  background: var(--surface2);
  margin: 16px 12px;
  border-radius: var(--radius);
  text-align: center;
}
.credits-label { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 4px; }
.credits-value { font-size: 1.5rem; font-weight: 700; color: var(--dc-orange); }
.credits-sub { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-topbar {
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-topbar-info { display: flex; align-items: center; gap: 12px; }
.chat-topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dc-blue-dim), var(--dc-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.chat-topbar-name { font-weight: 600; font-size: 0.95rem; }
.chat-topbar-status { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.chat-topbar-actions { margin-left: auto; }
.btn-reset-chat {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.78rem; padding: 5px 10px;
  border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.btn-reset-chat:hover { border-color: #e74c3c; color: #e74c3c; background: rgba(231,76,60,0.08); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  box-shadow: 0 0 6px #4ade80;
}
.status-offline { background: var(--text-dim); box-shadow: none; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dc-blue-dim), var(--dc-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 auto 12px;
}
.welcome-sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; }

.msg-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 70%;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg-assistant { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dc-blue-dim), var(--dc-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.msg-body { display: flex; flex-direction: column; gap: 4px; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}
.msg-bubble-ai {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-bubble-user {
  background: var(--dc-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-time { font-size: 0.7rem; color: var(--text-dim); }
.msg-time-right { text-align: right; }

/* 타이핑 인디케이터 */
.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 12px 16px; }
.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

.chat-error-msg {
  text-align: center;
  font-size: 0.8rem;
  color: #ff7a5a;
  padding: 8px 16px;
  background: rgba(240, 78, 35, 0.1);
  border-radius: var(--radius-sm);
}

/* ── Chat Input ── */
.chat-input-area {
  padding: 16px 24px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s;
}
.chat-form:focus-within { border-color: var(--dc-blue-light); }

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}
#chat-input::placeholder { color: var(--text-dim); }

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--dc-blue);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.send-btn:hover:not(:disabled) {
  background: var(--dc-blue-light);
  transform: scale(1.05);
}
.send-btn:disabled { background: var(--surface3); color: var(--text-dim); cursor: not-allowed; }

.chat-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ── Credits Toast ── */
.credits-toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: rgba(240, 78, 35, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 200;
}
.credits-toast.toast-show { opacity: 1; transform: none; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .chat-sidebar { display: none; }
  .search-prefix { display: none; }
  .hero-title { font-size: 1.8rem; }
  .users-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .msg-wrap { max-width: 90%; }
}
