@charset "UTF-8";

:root {
  --chat-bg: #ffffff;
  --chat-surface: #ffffff;
  --chat-soft: #f6f8fb;
  --chat-soft-2: #eef3f8;
  --chat-line: #e5eaf1;
  --chat-text: #111827;
  --chat-muted: #667085;
  --chat-primary: #5fa8ff;
  --chat-primary-dark: #356fb8;
  --chat-danger: #d9464f;
  --chat-shadow: 0 18px 42px rgba(17, 24, 39, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --chat-bg: #101114;
    --chat-surface: #16181d;
    --chat-soft: #1d2027;
    --chat-soft-2: #232833;
    --chat-line: #2b303a;
    --chat-text: #f3f4f6;
    --chat-muted: #a8afba;
    --chat-shadow: none;
  }
}

body.chat-hub-page.amoled,
body.chat-hub-page[data-theme="amoled"] {
  --chat-bg: #000000;
  --chat-surface: #050608;
  --chat-soft: #0b0d10;
  --chat-soft-2: #10151b;
  --chat-line: #171b22;
  --chat-text: #f3f4f6;
  --chat-muted: #a8afba;
  --chat-shadow: none;
}

body.chat-hub-page {
  min-height: 100vh;
  margin: 0;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--chat-bg);
  color: var(--chat-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", Arial, sans-serif;
}

.chat-hub-page a { color: inherit; text-decoration: none; }
.chat-hub-page button { font: inherit; cursor: pointer; }

.chat-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--chat-surface);
  border-bottom: 1px solid var(--chat-line);
  backdrop-filter: blur(18px);
}

.chat-header-inner {
  max-width: 1180px;
  min-height: calc(62px + env(safe-area-inset-top));
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.chat-back-link,
.chat-icon-btn {
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--chat-line);
  background: var(--chat-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-text);
}
.chat-back-link { gap: 4px; padding: 0 12px; font-size: .86rem; font-weight:600; }
.chat-icon-btn { width: 40px; font-size: 1.08rem; }
.chat-title-block { text-align: center; min-width: 0; }
.chat-title-block strong { display: block; font-size: 1.1rem; font-weight:700; letter-spacing: -.035em; }
.chat-title-block span { display: block; margin-top: 2px; color: var(--chat-muted); font-size: .76rem; font-weight:600; }

.chat-shell { max-width: 1180px; margin: 0 auto; padding: 20px; }
.chat-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}
.chat-hero-copy {
  min-height: 270px;
  border-radius: 20px;
  border: 1px solid var(--chat-line);
  background:
    radial-gradient(circle at 16% 15%, rgba(0,166,178,.24), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(217,70,79,.18), transparent 28%),
    linear-gradient(135deg, var(--chat-surface), var(--chat-soft));
  padding: 34px;
  box-shadow: var(--chat-shadow);
}
.chat-hero-copy span { display: inline-flex; color: var(--chat-primary-dark); font-size: .72rem; font-weight:700; letter-spacing: .1em; }
.chat-hero-copy h1 { margin: 10px 0 12px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.08; letter-spacing: -.055em; }
.chat-hero-copy p { max-width: 620px; margin: 0; color: var(--chat-muted); line-height: 1.65; }
.chat-hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.chat-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--chat-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  font-weight:700;
  background: var(--chat-surface);
  color: var(--chat-text);
}
.chat-btn.primary { background: #0b1e38; color: #fff; border-color: transparent; }
.chat-btn.ghost { background: var(--chat-surface); }
.chat-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chat-metrics article { border: 1px solid var(--chat-line); border-radius: 18px; background: var(--chat-surface); padding: 20px; box-shadow: var(--chat-shadow); }
.chat-metrics strong { display: block; font-size: 2rem; font-weight:700; color: var(--chat-primary-dark); }
.chat-metrics span { display: block; margin-top: 4px; color: var(--chat-muted); font-size: .84rem; font-weight:600; }

.chat-login-panel {
  margin: 18px 0;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--chat-line);
  border-radius: 18px;
  background: var(--chat-surface);
  box-shadow: var(--chat-shadow);
}
.chat-login-panel span { color: var(--chat-muted); font-size: .68rem; font-weight:700; letter-spacing: .1em; }
.chat-login-panel strong { display: block; margin-top: 5px; font-size: 1rem; letter-spacing: -.025em; }
.chat-login-panel p { margin: 5px 0 0; color: var(--chat-muted); font-size: .82rem; line-height: 1.5; }

.chat-filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 16px; }
.chat-filter-row::-webkit-scrollbar { display: none; }
.chat-filter-row button { min-height: 36px; border-radius: 10px; border: 1px solid var(--chat-line); background: var(--chat-surface); color: var(--chat-muted); padding: 0 12px; font-size: .8rem; font-weight:700; white-space: nowrap; }
.chat-filter-row button.active { background: #111827; color: #fff; border-color: #111827; }

.chat-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.chat-room-list,
.chat-preview-panel,
.chat-action-grid button {
  border: 1px solid var(--chat-line);
  background: var(--chat-surface);
  box-shadow: var(--chat-shadow);
}
.chat-room-list,
.chat-preview-panel { border-radius: 18px; padding: 18px; }
.chat-list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.chat-list-head h2 { margin: 0; font-size: 1.2rem; font-weight:700; letter-spacing: -.035em; }
.chat-list-head p { margin: 5px 0 0; color: var(--chat-muted); font-size: .8rem; }
.chat-list-head button { min-height: 34px; border-radius: 10px; border: 1px solid var(--chat-line); background: var(--chat-soft); color: var(--chat-text); padding: 0 10px; font-size: .76rem; font-weight:700; }
.chat-thread-card {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--chat-line);
  border-radius: 14px;
  background: var(--chat-surface);
  color: var(--chat-text);
  text-align: left;
}
.chat-thread-card + .chat-thread-card { margin-top: 10px; }
.chat-thread-card.is-active { border-color: rgba(0,166,178,.5); background: var(--chat-soft); }
.thread-avatar,
.preview-avatar { width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: #e6fffb; color: #356fb8; font-weight:700; }
.thread-avatar.secondary { background: #fff7e6; color: #b45309; }
.thread-avatar.green { background: #ecfdf3; color: #047857; }
.thread-avatar.dark { background: #111827; color: #fff; }
.thread-body { min-width: 0; }
.thread-body strong { display: block; font-size: .94rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-body em { display: block; margin-top: 4px; color: var(--chat-muted); font-size: .78rem; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { display: grid; justify-items: end; gap: 5px; }
.thread-meta b { min-width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--chat-danger); color: #fff; font-size: .72rem; }
.thread-meta small { color: var(--chat-muted); font-size: .68rem; white-space: nowrap; }

.chat-preview-head { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--chat-line); }
.chat-preview-head strong { display: block; font-size: 1.06rem; font-weight:700; }
.chat-preview-head p { margin: 5px 0 0; color: var(--chat-muted); font-size: .8rem; }
.chat-message-stack { display: grid; gap: 10px; padding: 18px 0; }
.chat-message { max-width: 82%; }
.chat-message span { display: block; color: var(--chat-muted); font-size: .68rem; font-weight:600; margin-bottom: 4px; }
.chat-message p { margin: 0; padding: 11px 12px; border-radius: 14px; background: var(--chat-soft); font-size: .84rem; line-height: 1.45; }
.chat-message.me { justify-self: end; text-align: right; }
.chat-message.me p { background: #0b1e38; color: #fff; }
.chat-composer-preview { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; border-top: 1px solid var(--chat-line); padding-top: 14px; }
.chat-composer-preview input { min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--chat-line); background: var(--chat-soft); color: var(--chat-muted); padding: 0 12px; }
.chat-composer-preview button { width: 42px; border-radius: 12px; border: none; background: var(--chat-primary); color: #fff; }

.chat-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.chat-action-grid button { min-height: 114px; border-radius: 16px; padding: 16px; text-align: left; color: var(--chat-text); }
.chat-action-grid i { font-size: 1.45rem; color: var(--chat-primary-dark); }
.chat-action-grid strong { display: block; margin-top: 10px; font-size: .94rem; }
.chat-action-grid span { display: block; margin-top: 5px; color: var(--chat-muted); font-size: .76rem; line-height: 1.45; }

.chat-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-line);
  backdrop-filter: blur(18px);
}
.nav-item { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--chat-muted); font-size: .66rem; font-weight:600; }
.nav-item i { font-size: 1.2rem; }
.nav-item.active { color: var(--chat-primary-dark); }

@media (max-width: 960px) {
  .chat-shell { padding: 14px; }
  .chat-hero,
  .chat-workspace { grid-template-columns: 1fr; }
  .chat-hero-copy { min-height: 236px; padding: 24px; border-radius: 18px; }
  .chat-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chat-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-preview-panel { display: none; }
  .chat-bottom-nav { display: grid; }
}

@media (max-width: 520px) {
  .chat-header-inner { min-height: calc(54px + env(safe-area-inset-top)); padding-left: 12px; padding-right: 12px; gap: 8px; }
  .chat-back-link span { display: none; }
  .chat-back-link,
  .chat-icon-btn { width: 38px; height: 38px; padding: 0; }
  .chat-title-block strong { font-size: 1rem; }
  .chat-title-block span { font-size: .7rem; }
  .chat-hero-copy h1 { font-size: 1.72rem; }
  .chat-hero-copy p { font-size: .86rem; }
  .chat-hero-actions .chat-btn { flex: 1 1 auto; }
  .chat-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-metrics article { padding: 16px; border-radius: 16px; }
  .chat-login-panel { align-items: flex-start; flex-direction: column; }
  .chat-login-panel .chat-btn { width: 100%; }
  .chat-room-list { padding: 14px; border-radius: 16px; }
  .chat-thread-card { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 12px; }
  .thread-avatar { width: 44px; height: 44px; border-radius: 13px; }
  .chat-action-grid button { min-height: 104px; }
}

.thread-avatar.board{background:#ede9fe;color:#6d28d9;}
.chat-action-grid a{
  min-height:114px;
  border:1px solid var(--chat-line);
  border-radius:16px;
  padding:16px;
  text-align:left;
  color:var(--chat-text);
  background:var(--chat-surface);
  box-shadow:var(--chat-shadow);
}
.chat-bottom-nav{grid-template-columns:repeat(6,minmax(0,1fr));}
@media (max-width:520px){.chat-action-grid a{min-height:104px;}}

.chat-bottom-nav{grid-template-columns:repeat(7,minmax(0,1fr));}
.chat-action-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
@media (max-width:960px){.chat-action-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

/* v210 common app bottom nav */
.chat-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))!important;}

/* App WebView shell: native bottom navigation owns the bottom area. */
body.chat-hub-page.is-app-shell.has-native-bottom {
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

body.chat-hub-page.is-app-shell .chat-bottom-nav {
  display: none !important;
}

body.chat-hub-page.is-app-shell .chat-header {
  position: sticky;
}

body.chat-hub-page.is-app-shell .chat-header-inner {
  max-width: none;
}

body.chat-hub-page.is-app-shell .chat-shell {
  max-width: none;
}
