/* ═══════ 기본 · 검은 돌 + 다크 버건디 (확정) ═══════ */
:root {
  --bg: #0B0B0D;           /* 검은 돌 배경 */
  --bg-deep: #060607;      /* 사이드바 (더 깊은 검정) */
  --panel: #16151a;        /* 카드 — 살짝 따뜻한 차콜 */
  --panel-2: #1d1c22;
  --panel-3: #27262e;

  --border: #2a2830;
  --border-2: #3a3742;
  --hairline: #1a191f;

  --text: #EFEBE3;         /* 크림 텍스트 */
  --text-2: #b9b3a8;
  --muted: #827d77;
  --text-dim: #5a554f;

  --accent: #6E1423;       /* 다크 버건디 (버튼 배경) */
  --accent-2: #8a2030;
  --accent-dim: #5a2530;
  --accent-text: #E6A9B0;  /* 텍스트용 파스텔 로즈-버건디 (어두운 배경 가독성) */
  --on-accent: #ffffff;
  --accent-glow: rgba(110,20,35,0.22);

  --danger: #e5544b;
  --danger-2: #ff7a70;
  --warn: #e0a13c;
  --ok: #4ec98a;

  --claude: #cc785c;
  --gpt: #10a37f;
  --gemini: #4285f4;
  --synth: #a8434f;        /* 종합 = 밝은 버건디 (어두운 배경 가독성) */
  --user: #5b9bf5;
  --cos: #9b8cf0;

  --sidebar-text: var(--text);
  --sidebar-muted: var(--muted);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-pop: 0 10px 40px rgba(0,0,0,0.6);
  --ring-accent: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-glow);
  --grain-opacity: 0.07;
  --stone-opacity: 0.6;
  --inset-hi: rgba(255,255,255,0.05);

  /* ── 타이포 스케일 (1.20 modular) ── */
  --fs-micro: 11px;   --fs-xs: 12px;   --fs-sm: 13px;
  --fs-base: 14.5px;  --fs-md: 16px;   --fs-lg: 19px;
  --fs-xl: 23px;      --fs-2xl: 30px;  --fs-data: 34px;
  --lh-tight: 1.25;   --lh-snug: 1.45; --lh-body: 1.68;
  --tracking-eyebrow: 0.14em;  --tracking-tight: -0.01em;

  /* ── 간격 스케일 (4px base) ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --gutter: 24px; --pad-panel: 24px;

  /* ── 황동(브라스) 프레이밍 — 고급 질감 (1px 라인 전용, 채움 금지) ── */
  --metal: #6b5a3e; --metal-2: #a8895c;
  --metal-line: rgba(168,137,92,0.28);
  --metal-line-strong: rgba(168,137,92,0.55);
  --metal-glow: rgba(168,137,92,0.10);

  /* ── 데이터(계기판) 모노 색 ── */
  --data: #8fb6c9; --data-dim: #5f7c8a;
  --grid-line: rgba(168,137,92,0.05);
  --live: #4ec98a; --idle: #827d77;

  /* ── 엘리베이션 (top-highlight + drop) ── */
  --el-1: 0 1px 0 rgba(255,255,255,0.025) inset, 0 2px 8px rgba(0,0,0,0.35);
  --el-2: 0 1px 0 rgba(255,255,255,0.035) inset, 0 8px 24px rgba(0,0,0,0.45);
  --el-3: 0 1px 0 rgba(255,255,255,0.045) inset, 0 18px 50px rgba(0,0,0,0.55);
  --ring-metal: 0 0 0 1px var(--metal-line);

  font-family: "Pretendard", "Pretendard Variable", -apple-system, "SF Pro Text", "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

/* ═══════ 2안 · 몰입 (와인 사이드바 + 흰 본문 + 크림슨 버튼) ═══════ */
html[data-theme="immersive"] {
  --bg: #ffffff;
  --bg-deep: #722F37;      /* 사이드바 = 와인 */
  --panel: #ffffff;
  --panel-2: #faf7f7;
  --panel-3: #f2eaeb;

  --border: #ecdfe0;
  --border-2: #d8c2c4;
  --hairline: #f0e7e8;

  --text: #2C2C2C;
  --text-2: #574d4e;
  --muted: #968a8b;
  --text-dim: #b8acad;

  --accent: #8A1538;       /* 크림슨 버튼 */
  --accent-text: #8A1538;  /* 라이트 배경 — 어두운 버건디가 읽힘 */
  --accent-2: #a82147;
  --accent-dim: #d8b7c0;
  --on-accent: #ffffff;
  --accent-glow: rgba(138,21,56,0.12);

  --danger: #b3242a;
  --danger-2: #d8413f;
  --warn: #b5791a;
  --ok: #2f8f5e;

  --synth: #8A1538;
  --user: #2f6fd0;
  --cos: #6d4fb0;

  --sidebar-text: #ffffff;
  --sidebar-muted: rgba(255,255,255,0.72);

  --shadow-card: 0 1px 2px rgba(40,30,20,0.06), 0 3px 12px rgba(40,30,20,0.07);
  --shadow-pop: 0 10px 40px rgba(40,30,20,0.18);
}

/* ═══════ 3안 · 워룸 다크 (기존) ═══════ */
html[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-deep: #070910;
  --panel: #121620;
  --panel-2: #1a2030;
  --panel-3: #232b3d;
  --border: #232a39;
  --border-2: #2e3850;
  --hairline: #171c28;
  --text: #e9ecf3;
  --text-2: #aab3c5;
  --muted: #6b7488;
  --text-dim: #4d5872;
  --accent: #c79a4d;
  --accent-text: #e3bd6f;
  --accent-2: #e3bd6f;
  --accent-dim: #7a5f30;
  --on-accent: #0b0e14;
  --accent-glow: rgba(199,154,77,0.14);
  --danger: #e5544b;
  --danger-2: #ff7a70;
  --warn: #e0a13c;
  --ok: #4ec98a;
  --synth: #c79a4d;
  --user: #5b9bf5;
  --cos: #9b8cf0;
  --sidebar-text: var(--text);
  --sidebar-muted: var(--muted);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-pop: 0 10px 40px rgba(0,0,0,0.6);
  --grain-opacity: 0.07;
  --stone-opacity: 0.5;
  --inset-hi: rgba(255,255,255,0.05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  /* 앰비언트 글로우(좌상단·우하단 은은한 버건디 번짐) + 배경색 */
  background:
    radial-gradient(110% 70% at 8% -5%, var(--accent-glow), transparent 45%),
    radial-gradient(90% 60% at 100% 105%, var(--accent-glow), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;  /* 모바일 가로 스크롤 차단 */
}

/* 돌 질감 — 큰 얼룩(돌결) 레이어 + 미세 그레인 레이어 (어두운 배경에서 검은 돌 느낌) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--stone-opacity, 0.5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.016' numOctaves='5' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.6'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
/* 미세 필름 그레인 — 어두운 배경에서 질감으로 보임 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity, 0.05);
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ────────── 워룸 유틸리티 (eyebrow · mono · framed · status) ────────── */
.mono, .data {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.data { color: var(--data); }
.op-code { color: var(--metal-2); font-weight: 600; letter-spacing: 0.08em; }
.eyebrow {
  font: var(--fs-micro)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--metal-2);
  display: flex; align-items: center; gap: var(--sp-2);
}
.eyebrow::before {
  content: ""; width: 14px; height: 1px;
  background: var(--metal-line-strong); flex-shrink: 0;
}
/* 황동 코너 브래킷 (4 모서리) */
.framed { position: relative; }
.framed::before, .framed::after {
  content: ""; position: absolute; width: 13px; height: 13px;
  pointer-events: none; border: 1px solid var(--metal-line-strong);
  z-index: 2;
}
.framed::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.framed::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.framed > .tick-tr, .framed > .tick-bl {
  position: absolute; width: 13px; height: 13px;
  border: 1px solid var(--metal-line-strong); pointer-events: none; z-index: 2;
}
.framed > .tick-tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.framed > .tick-bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
/* 라이브 상태 점 */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(78,201,138,0.5); flex-shrink: 0;
  animation: pulse 2.4s ease-out infinite;
}
.idle-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); flex-shrink: 0; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(78,201,138,0.45); }
  70% { box-shadow: 0 0 0 7px rgba(78,201,138,0); }
  100% { box-shadow: 0 0 0 0 rgba(78,201,138,0); }
}

/* ────────── 상단 커맨드 스트립 ────────── */
.cmd-strip {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: var(--sp-5);
  height: 36px; padding: 0 var(--sp-5);
  background: linear-gradient(180deg, #0e0d11, #090809);
  border-bottom: 1px solid var(--metal-line);
  font: var(--fs-micro)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--data-dim); text-transform: uppercase;
  user-select: none;
}
.cmd-strip .seg { display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.cmd-strip .seg b { color: var(--data); font-weight: 600; letter-spacing: 0.06em; }
.cmd-strip .seg.live b { color: var(--live); }
.cmd-strip .seg.op b { color: var(--metal-2); }
.cmd-strip .sep { width: 1px; height: 14px; background: var(--metal-line); flex-shrink: 0; }
.cmd-strip .spacer { margin-left: auto; }
.cmd-strip .seg.clock { color: var(--data-dim); }
.cmd-strip .seg.clock b { color: var(--data); }
.cmd-strip .usage-link {
  text-decoration: none; cursor: pointer; color: var(--metal-2);
  transition: color 0.12s;
}
.cmd-strip .usage-link b { color: var(--metal-2); }
.cmd-strip .usage-link:hover, .cmd-strip .usage-link:hover b { color: var(--metal-line-strong); filter: brightness(1.4); }

/* ────────── API 사용량 모달 ────────── */
.usage-modal[hidden] { display: none; }
.usage-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.usage-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(3px);
}
.usage-panel {
  position: relative; z-index: 1;
  width: 560px; max-width: 100%;
  background: linear-gradient(180deg, #1a1013, var(--panel) 30%);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: var(--pad-panel);
  box-shadow: var(--el-3);
  max-height: 86vh; overflow-y: auto; overflow-x: hidden;
}
.usage-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--sp-3); }
.usage-head h3 { margin: 6px 0 0; font-size: var(--fs-lg); color: var(--text); }
.usage-close {
  background: transparent; border: 1px solid var(--border-2); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.usage-close:hover { color: var(--text); border-color: var(--accent-2); }
.usage-note {
  font-size: var(--fs-xs); color: var(--text-2); line-height: var(--lh-snug);
  background: rgba(224,161,60,0.08); border: 1px solid rgba(224,161,60,0.25);
  border-radius: 8px; padding: 9px 11px; margin-bottom: var(--sp-4);
}
.usage-note b { color: var(--warn); }
.usage-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.usage-loading { grid-column: 1/-1; color: var(--muted); text-align: center; padding: 24px; }
.usage-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px;
}
.usage-card-head { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; }
.usage-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.usage-name { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.usage-cost {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px; font-weight: 700; color: var(--accent-text); line-height: 1;
  margin-bottom: 10px;
}
.usage-cost small { font-size: var(--fs-micro); color: var(--muted); font-weight: 500; margin-left: 3px; }
.usage-rows { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); }
.usage-rows > div { display: flex; justify-content: space-between; }
.usage-rows span { color: var(--muted); }
.usage-rows b {
  color: var(--text-2); font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
}
.usage-unit { margin-top: 9px; font-size: 10px; color: var(--text-dim); line-height: 1.4; }
.usage-total {
  margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-2); text-align: right;
}
.usage-total b { color: var(--accent-text); font-family: ui-monospace, monospace; }
.usage-links {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4);
}
.usage-links a {
  flex: 1; min-width: 140px; text-align: center;
  font-size: var(--fs-xs); color: var(--data); text-decoration: none;
  border: 1px solid var(--border-2); border-radius: 8px; padding: 9px 10px;
  transition: all 0.12s;
}
.usage-links a:hover { border-color: var(--accent-2); color: var(--accent-text); background: rgba(110,20,35,0.12); }
@media (max-width: 560px) {
  .usage-cards { grid-template-columns: 1fr; }
}

/* ────────── 레이아웃 ────────── */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 36px);
  overflow: hidden;
}

.sidebar {
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main { overflow-y: auto; padding: 0; }
.view { max-width: none; margin: 0; padding: 24px 36px 200px; }

/* ────────── 사이드바 ────────── */
.sidebar-head { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
/* 로고 2단: ◆ DOYA / MKT WAR ROOM */
.logo { margin: 0 0 14px; display: flex; flex-direction: column; gap: 3px; }
.logo-mark { color: var(--metal-2); font-size: 13px; }
.logo-main {
  font-size: 19px; font-weight: 700; letter-spacing: 0.05em; color: var(--text);
  display: inline-flex; align-items: center;
}
.logo .logo-mark { display: inline; margin-right: 7px; }
.logo-main::before { content: none; }
.logo-sub {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--metal-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* ◆와 DOYA를 한 줄에 */
.logo { position: relative; }
.logo .logo-mark { position: absolute; top: 1px; left: 0; }
.logo .logo-main { padding-left: 20px; }
.logo .logo-sub { padding-left: 20px; }

.new-btn {
  width: 100%; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.new-btn:hover { background: var(--accent-2); }

.filter { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filter label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.filter select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 8px; font-size: 13px;
}

.meetings-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.meetings-list .empty { color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }

.meeting-item {
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.12s;
}
.meeting-item:hover { background: var(--panel); }
.meeting-item.active { background: var(--panel-3); border-left: 3px solid var(--accent); padding-left: 13px; }
.meeting-item .date { font-family: ui-monospace, "SF Mono", monospace; color: var(--data-dim); font-variant-numeric: tabular-nums; }

.item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 14px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.meeting-item:hover .item-delete { opacity: 1; }
.item-delete:hover { background: rgba(244,114,114,0.15); color: var(--danger); }
.item-delete { right: 32px; } /* 별 왼쪽으로 */

/* 즐겨찾기 별 (항상 표시) */
.item-fav {
  position: absolute; top: 8px; right: 8px;
  background: transparent; border: none; cursor: pointer;
  width: 22px; height: 22px; padding: 0; line-height: 1;
  font-size: 15px; color: var(--text-dim); z-index: 2;
  transition: color 0.12s, transform 0.1s;
}
.item-fav:hover { transform: scale(1.18); color: var(--metal-2); }
.item-fav.on { color: #e3bd6f; }

/* 즐겨찾기만 보기 필터 버튼 */
.fav-filter {
  width: 100%; margin-bottom: 10px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  color: var(--text-2); border-radius: 8px; padding: 8px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.12s;
}
.fav-filter:hover { border-color: var(--metal-line-strong); color: var(--metal-2); }
.fav-filter.on { background: rgba(199,154,77,0.14); border-color: var(--metal-2); color: var(--metal-2); }
.meeting-item .date { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.meeting-item .title {
  font-size: 13px; line-height: 1.45; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.meeting-item .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip {
  font-size: 10px; background: var(--panel-2); color: var(--muted);
  padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border);
}

/* ────────── 새 회의 입력 (composeView) ────────── */
.topbar { padding: 8px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.composer {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--pad-panel);
  box-shadow: var(--el-2);
}
.composer-eyebrow { margin-bottom: var(--sp-4); }
.composer textarea {
  width: 100%; background: var(--bg-deep); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; font-size: var(--fs-md); line-height: var(--lh-body);
  resize: vertical; font-family: inherit; min-height: 132px;
}
.composer textarea::placeholder { color: var(--text-dim); }
.composer textarea:focus {
  outline: none; border-color: var(--accent-dim);
  box-shadow: var(--ring-accent); caret-color: var(--accent-text);
}
.row { display: flex; gap: 12px; margin-top: 12px; align-items: flex-end; }
.ctx { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ctx span { font-size: 12px; color: var(--muted); }
.ctx input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px;
}
.ctx input:focus { outline: none; border-color: var(--accent); }

#askBtn {
  background: var(--accent); color: var(--on-accent); border: none;
  border-radius: 10px; padding: 12px 22px;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
#askBtn:hover { opacity: 0.92; }
#askBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ────────── thread 헤더 ────────── */
.thread-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.thread-head .head-main { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

.icon-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(244,114,114,0.08);
}
.thread-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-micro); padding: 4px 10px; border-radius: 6px;
  letter-spacing: 0.06em;
  background: rgba(78,201,138,0.12); color: var(--live);
  border: 1px solid rgba(78,201,138,0.4); font-weight: 600;
}
.status-badge.open::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--live); box-shadow: 0 0 0 0 rgba(78,201,138,0.5);
  animation: pulse 2.4s ease-out infinite;
}
.status-badge.closed {
  background: rgba(130,125,119,0.12); color: var(--muted);
  border-color: var(--border-2);
}
.round-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro); padding: 4px 10px; border-radius: 6px;
  background: rgba(143,182,201,0.1); color: var(--data);
  border: 1px solid rgba(143,182,201,0.28); letter-spacing: 0.04em;
}
.tags-inline { display: flex; gap: 4px; flex-wrap: wrap; }
.thread-head h2 {
  font-size: var(--fs-md); line-height: 1.4; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}
.thread-head h2 .thread-op { color: var(--metal-2); font-weight: 700; }
.thread-head h2 .thread-date { color: var(--data-dim); font-variant-numeric: tabular-nums; }

/* ────────── thread 타임라인 ────────── */
.thread { display: flex; flex-direction: column; gap: 14px; }

.thread-block {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.prompt-block { border-color: var(--accent); }
.block-head {
  font-size: 12px; color: var(--accent-text); font-weight: 600;
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.prompt-body {
  font-size: 15px; line-height: 1.65; white-space: pre-wrap;
  max-width: 95ch; /* 와이드 모니터에서 긴 안건도 읽기 좋은 줄길이 유지 */
}
.ctx-line {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}

.round-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: var(--sp-7) 0 var(--sp-4);
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-micro);
  text-transform: uppercase;
  color: var(--metal-2);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  border-bottom: none;
}
.round-heading::before {
  content: "◆";
  font-size: 9px;
  color: var(--metal-2);
  flex-shrink: 0;
  line-height: 1;
}
.round-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--metal-line-strong), var(--metal-line) 40%, transparent);
}
.round-heading.synth-heading { color: var(--accent-text); }
.round-heading.synth-heading::before { content: "◆"; color: var(--accent-text); }
.round-heading.synth-heading::after { background: linear-gradient(90deg, var(--accent-dim), transparent); }
.round-heading.redteam-heading { color: var(--danger); }
.round-heading.redteam-heading::before { content: "▲"; color: var(--danger); }
.round-heading.redteam-heading::after { background: linear-gradient(90deg, rgba(229,84,75,0.5), transparent); }

/* 레드팀 카드 — 붉은 강조, 전체 너비 */
.round-grid.redteam-grid { grid-template-columns: 1fr; }
.card.redteam-card { border-color: #e74c3c; background: linear-gradient(180deg, rgba(231,76,60,0.07), var(--panel)); }
.card.redteam-card header { background: linear-gradient(90deg, rgba(231,76,60,0.16), transparent); }
.card.redteam-card .body { font-size: 14.5px; }

/* 레드팀 추천 배너 */
.redteam-banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(231,76,60,0.10);
  border: 1px solid rgba(231,76,60,0.4);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #f0a0a0;
}
.redteam-banner b { color: #f87171; }

/* ────────── 합의도 진행 바 (지표 패널) ────────── */
.consensus-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad-panel);
  margin-bottom: var(--sp-3);
  box-shadow: var(--el-2);
}
.consensus-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--sp-4);
}
.consensus-left { display: flex; flex-direction: column; gap: var(--sp-3); }
.consensus-label { color: var(--metal-2); }
.consensus-score { font-size: var(--fs-data); font-weight: 700; line-height: 1; color: var(--data); }
.consensus-score.high { color: #5fce9a; }
.consensus-score.mid { color: var(--warn); }
.consensus-score.low { color: var(--danger-2); }
.consensus-score small { font-size: var(--fs-md); color: var(--data-dim); font-weight: 500; margin-left: 2px; }

.consensus-track {
  position: relative;
  height: 8px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
  background-image: linear-gradient(90deg, transparent 24.7%, var(--grid-line) 24.7%, var(--grid-line) 25.3%, transparent 25.3%, transparent 49.7%, var(--grid-line) 49.7%, var(--grid-line) 50.3%, transparent 50.3%, transparent 74.7%, var(--grid-line) 74.7%, var(--grid-line) 75.3%, transparent 75.3%);
}
.consensus-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}
.consensus-fill.high { background: linear-gradient(90deg, var(--ok), #38b87a); box-shadow: 0 0 12px rgba(78,201,138,0.5); }
.consensus-fill.mid  { background: linear-gradient(90deg, var(--warn), #c8862a); box-shadow: 0 0 12px rgba(224,161,60,0.45); }
.consensus-fill.low  { background: linear-gradient(90deg, var(--danger), #c0392b); box-shadow: 0 0 12px rgba(229,84,75,0.45); }

.consensus-tier {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: right;
  max-width: 45%;
  line-height: var(--lh-snug);
}
.consensus-tier.high { color: var(--ok); }
.consensus-tier.mid  { color: var(--warn); }
.consensus-tier.low  { color: var(--danger); }
.round-heading.loading-round::after {
  content: " ⏳";
}

.round-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.round-grid.synth-grid { grid-template-columns: 1fr; }
.round-grid.user-grid { grid-template-columns: 1fr; }

/* 전문가 선택 picker */
.advisor-picker {
  margin-top: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.picker-head > span:first-child { font-size: 15px; font-weight: 700; color: var(--text); }
.cost-hint { font-size: 12px; color: var(--text-2); font-weight: 600; }
.advisor-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 460px;
  overflow-y: auto;
  padding: 2px 8px 2px 2px;
}
.advisor-grid::-webkit-scrollbar { width: 9px; }
.advisor-grid::-webkit-scrollbar-track { background: transparent; }
.advisor-grid::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
.advisor-grid::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
.advisor-cat { }
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.01em;
}
.cat-label::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-text), var(--accent));
}
.cat-toggle {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.12s;
}
.cat-toggle:hover { color: var(--accent-text); border-color: var(--accent-2); background: rgba(110,20,35,0.16); }
.advisor-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}
.advisor-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13.5px;
  background: var(--panel);
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  user-select: none;
}
.advisor-chip:hover { border-color: var(--accent-2); background: var(--panel-3); }
/* 커스텀 체크박스 */
.advisor-chip input {
  appearance: none; -webkit-appearance: none;
  width: 19px; height: 19px; flex-shrink: 0; margin: 0;
  border: 1.5px solid var(--border-2);
  border-radius: 6px;
  background: var(--panel-3);
  cursor: pointer;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}
.advisor-chip input:checked { background: var(--accent); border-color: var(--accent-2); }
.advisor-chip input:checked::after {
  content: "✓";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--on-accent); font-size: 12px; font-weight: 800;
}
.advisor-chip:has(input:checked) {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(110,20,35,0.30), rgba(110,20,35,0.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 10px rgba(110,20,35,0.18);
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip-emoji { font-size: 17px; flex-shrink: 0; line-height: 1; }
.chip-label {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  white-space: normal;
  word-break: keep-all;
}
.chip-model {
  font-size: 10px;
  font-weight: 700;
  border: 1px solid;
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
  opacity: 0.95;
  letter-spacing: 0.02em;
}

/* 이미지 첨부 */
.img-attach { margin-top: 10px; }
.img-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  padding: 8px 12px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm);
  background: var(--panel-2); transition: border-color 0.12s, color 0.12s;
}
.img-btn:hover { border-color: var(--accent); color: var(--text); }
.img-hint { color: var(--muted); font-size: 11px; }
.img-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-thumb { position: relative; width: 76px; height: 76px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; border: none;
  font-size: 12px; cursor: pointer; line-height: 1; padding: 0;
}
.img-del:hover { background: var(--danger); }

/* 비서실장 추천 */
.cos-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cos-btn {
  background: linear-gradient(135deg, #6d5bd0, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.cos-btn:hover { opacity: 0.92; }
.cos-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.cos-hint { font-size: 12px; color: var(--muted); }

.cos-result {
  margin-top: 12px;
  background: linear-gradient(180deg, rgba(139,92,246,0.08), var(--panel));
  border: 1px solid #8b5cf6;
  border-radius: 12px;
  padding: 14px 16px;
}
.cos-result[hidden] { display: none; }
.cos-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.cos-title { font-size: 13px; font-weight: 700; color: #a78bfa; }
.cos-summary { font-size: 13px; color: var(--text); line-height: 1.5; }
.cos-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.cos-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: help;
}
.cos-item.redteam { border-color: rgba(231,76,60,0.5); }
.cos-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cos-emoji { font-size: 14px; flex-shrink: 0; }
.cos-name { font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.cos-reason { color: var(--muted); font-size: 12px; line-height: 1.4; flex: 1; }
.cos-remove {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--muted);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: all 0.12s;
}
.cos-remove:hover { background: rgba(231,76,60,0.15); border-color: var(--danger); color: var(--danger); }
.cos-skipped { font-size: 11px; color: var(--muted); padding: 4px 2px; font-style: italic; }
.cos-actions { display: flex; gap: 8px; }
.cos-actions button {
  border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border);
}
.cos-actions .primary { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }
.cos-actions .ghost { background: transparent; color: var(--muted); }

/* API 범례 */
.api-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text);
}
.api-legend .leg { display: flex; align-items: center; gap: 5px; font-weight: 600; }
.api-legend .leg-dot { width: 9px; height: 9px; border-radius: 50%; }
.api-legend .leg-note { color: var(--muted); font-weight: 400; }

/* 전문가 자기소개 호버 카드 */
.advisor-chip { cursor: pointer; }
.advisor-popover {
  position: absolute;
  z-index: 100;
  width: 280px;
  max-width: 86vw;
  background: #1b1f2b;
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  pointer-events: none;
  animation: popfade 0.12s ease;
}
@keyframes popfade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.advisor-popover[hidden] { display: none; }
.advisor-popover .pop-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.advisor-popover .pop-emoji { font-size: 16px; }
.advisor-popover .pop-name { font-size: 14px; font-weight: 700; color: var(--text); }
.advisor-popover .pop-model {
  font-size: 10px; font-weight: 700;
  border: 1px solid; border-radius: 4px; padding: 1px 5px;
  margin-left: auto;
}
.advisor-popover .pop-body {
  font-size: 12.5px;
  line-height: 1.6;
  color: #c8d0e0;
}

/* ────────── turn 카드 ────────── */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--el-1);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--border-2);
  box-shadow: var(--el-2);
  transform: translateY(-1px);
}
.card.synthesis {
  border-color: var(--accent-2); border-left: 2px solid var(--accent-2);
  background: linear-gradient(180deg, #1a1013, var(--panel) 40%);
  box-shadow: var(--el-2);
}
.card.synthesis header { background: linear-gradient(90deg, var(--accent-glow), transparent); }
.card.synthesis .body { font-size: var(--fs-md); }

.card header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.card header .title { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card header h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.card .model {
  font-size: var(--fs-micro); color: var(--data-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* 대표 발언 카드 (.round-grid.user-grid 는 위에서 정의됨) */
.card.user-card {
  border-color: #5b9bf5;
  background: linear-gradient(180deg, rgba(91,155,245,0.08), var(--panel));
}
.card.user-card header {
  background: linear-gradient(90deg, rgba(91,155,245,0.18), transparent);
}
.card.user-card .body { font-size: 15px; min-height: 0; }

/* 대표 첨언 입력창 */
.comment-box {
  background: var(--panel);
  border: 1px solid #5b9bf5;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.comment-label {
  display: block;
  font-size: 12px;
  color: #5b9bf5;
  font-weight: 600;
  margin-bottom: 8px;
}
.comment-box textarea {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  font-family: inherit;
}
.comment-box textarea:focus { outline: none; border-color: #5b9bf5; }
.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}
.comment-actions button {
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}
.comment-actions .primary { background: #5b9bf5; color: #fff; border-color: #5b9bf5; }
.comment-actions .ghost { background: transparent; color: var(--muted); }
.comment-actions .primary:hover { opacity: 0.92; }

.card .body {
  padding: 20px 22px;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  word-break: break-word;
  min-height: 90px;
  max-width: 68ch;
  color: var(--text-2);
}
.card .body.loading { color: var(--muted); font-style: italic; }
.card .body.error { color: var(--danger); }

/* 마크다운 */
.card .body strong { color: var(--accent-text); font-weight: 700; }
.card .body em { color: #c8d0e0; font-style: italic; }
.card .body ul { margin: 8px 0; padding-left: 22px; }
.card .body li { margin: 4px 0; }
.card .body h2, .card .body h3, .card .body h4 {
  margin: 12px 0 6px; font-weight: 700; color: var(--text);
}
.card .body h2 { font-size: 16px; }
.card .body h3 { font-size: 15px; }
.card .body h4 { font-size: 14px; color: var(--accent-text); }
.card .body code {
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.card .body pre {
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0;
}
.card .body pre code { background: transparent; border: none; padding: 0; }

/* ────────── 하단 컨트롤바 ────────── */
.thread-controls {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 60%, rgba(15,17,21,0.0));
  padding: 18px 0 14px;
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
  z-index: 10;
}
.thread-controls button {
  flex: 1;
  min-width: 180px;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity 0.15s, transform 0.05s;
}
.thread-controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.thread-controls button:not(:disabled):hover { opacity: 0.92; }
.thread-controls button:not(:disabled):active { transform: translateY(1px); }

.thread-controls .primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent); border-color: var(--accent-2);
}
.thread-controls .secondary {
  background: var(--panel-2); color: var(--text-2); border-color: var(--accent-2);
}
.thread-controls .secondary:hover { color: var(--accent-text); }
.thread-controls .ghost {
  background: transparent; color: var(--muted); flex: 0 0 auto; min-width: 100px;
}
.thread-controls .ghost:hover { color: var(--danger); border-color: var(--danger); }

/* ────────── 모바일 상단 바 ────────── */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  align-items: center;
  gap: 12px;
}
.mobile-bar .mobile-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.menu-btn, .mobile-new {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--text);
}
.menu-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
}
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.mobile-new {
  font-size: 22px;
  width: 38px;
  height: 38px;
  line-height: 1;
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 60;
  opacity: 0;
  transition: opacity 0.2s;
}

/* ────────── 반응형 (≤880) ────────── */
@media (max-width: 880px) {
  .cmd-strip { display: none; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .main { height: auto; }
  .mobile-bar { display: flex; }
  .view { padding: 16px 14px 160px; }

  /* 사이드바를 드로어로 — 기본 숨김, 오픈 시 좌측 슬라이드 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 84vw;
    max-width: 320px;
    height: 100vh;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; opacity: 1; }

  /* 카드·헤더 — 1열 + 컴팩트 */
  .round-grid { grid-template-columns: 1fr; gap: 10px; }
  /* 전문가 선택 — 모바일은 1열 (2열은 칩이 잘림) */
  .advisor-picker { padding: 14px 12px; }
  .advisor-row { grid-template-columns: 1fr; gap: 8px; }
  .advisor-grid { max-height: 320px; }
  .advisor-chip { min-height: 0; }
  /* picker 헤더 — 세로로 쌓아 줄바꿈 정리 */
  .picker-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .api-legend { font-size: 10.5px; gap: 8px 12px; }
  /* 이미지 첨부 라벨 — "이미지 첨부"는 한 줄, 설명은 아래로 */
  .img-btn { flex-wrap: wrap; }
  .img-btn .img-hint { flex-basis: 100%; margin-top: 2px; }
  .cos-item { flex-wrap: wrap; }
  .cos-reason { flex-basis: 100%; }
  .cos-actions { flex-direction: column; }
  .cos-actions button { width: 100%; }
  .row { flex-direction: column; align-items: stretch; }
  #askBtn { width: 100%; padding: 14px 22px; font-size: 15px; }

  /* thread 헤더 모바일 — 액션 버튼은 텍스트 줄이고 아래로 */
  .thread-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .thread-head h2 { font-size: 16px; word-break: keep-all; overflow-wrap: anywhere; }
  .head-actions { gap: 8px; display: flex; width: 100%; }
  .head-actions .icon-btn { flex: 1 1 0; min-width: 0; padding: 9px 6px; font-size: 12px; }

  /* 사이드바 칩/뱃지 줄바꿈 안전장치 */
  .thread-meta { flex-wrap: wrap; }

  /* 안건 텍스트 가독성 */
  .prompt-body { word-break: keep-all; overflow-wrap: anywhere; font-size: 14px; }
  .thread-head h2 { line-height: 1.5; }

  /* 입력창 */
  .composer { padding: 12px; }
  .composer textarea { font-size: 16px; /* iOS 줌 방지 */ }
  .ctx input { font-size: 16px; }

  /* 카드 본문 */
  .card .body { font-size: 14px; padding: 12px 14px; min-height: 80px; }
  .card header { padding: 10px 12px; }

  /* 하단 컨트롤바 — sticky 유지 */
  .thread-controls {
    flex-direction: column;
    margin-top: 18px;
    padding: 12px 0 18px;
    bottom: 0;
  }
  .thread-controls button { width: 100%; padding: 14px 16px; font-size: 14px; }
  .thread-controls .ghost { padding: 10px 14px; font-size: 13px; }

  /* 합의도 바 */
  .consensus-bar { padding: 12px 14px; }
  .consensus-score { font-size: 20px; }

  /* 입력창 안건 카드 */
  .topbar h2 { font-size: 17px; }
  .topbar .sub { font-size: 12px; }
}

/* 아주 작은 화면 (≤380) — 추가 컴팩션 */
@media (max-width: 380px) {
  .view { padding: 12px 10px 150px; }
  .card .body { font-size: 13px; }
  .thread-head h2 { font-size: 15px; }
}

/* ═══════ 테마 토글 + 2안 몰입 사이드바 흰글씨 ═══════ */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 10px 16px 4px;
}
.theme-toggle button {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--sidebar-muted);
  cursor: pointer;
}
.theme-toggle button.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* 2안: 와인 사이드바 위 흰 글씨 */
html[data-theme="immersive"] .sidebar { color: var(--sidebar-text); }
html[data-theme="immersive"] .logo-main,
html[data-theme="immersive"] .meeting-item .title { color: #fff; }
html[data-theme="immersive"] .logo-mark { color: #f0c0c8; }
html[data-theme="immersive"] .logo-sub,
html[data-theme="immersive"] .filter label,
html[data-theme="immersive"] .meeting-item .date,
html[data-theme="immersive"] .meetings-list .empty { color: rgba(255,255,255,0.72); }
html[data-theme="immersive"] .sidebar-head,
html[data-theme="immersive"] .filter { border-bottom-color: rgba(255,255,255,0.15); }
html[data-theme="immersive"] .filter select {
  background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.25);
}
html[data-theme="immersive"] .meeting-item { border-bottom-color: rgba(255,255,255,0.10); }
html[data-theme="immersive"] .meeting-item:hover { background: rgba(255,255,255,0.08); }
html[data-theme="immersive"] .meeting-item.active {
  background: rgba(255,255,255,0.15); border-left-color: #f0c0c8;
}
html[data-theme="immersive"] .meeting-item .tag-chip {
  background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.2);
}
html[data-theme="immersive"] .new-btn { background: #8A1538; color: #fff; }
html[data-theme="immersive"] .new-btn:hover { background: #a82147; }
html[data-theme="immersive"] .theme-toggle button {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.2);
}
html[data-theme="immersive"] .theme-toggle button.active {
  background: #fff; color: #722F37; border-color: #fff;
}
/* 2안 모바일바도 와인 */
html[data-theme="immersive"] .mobile-bar { background: #722F37; border-bottom-color: rgba(255,255,255,0.15); }
html[data-theme="immersive"] .mobile-title { color: #fff; }
html[data-theme="immersive"] .menu-btn span { background: #fff; }
html[data-theme="immersive"] .menu-btn, html[data-theme="immersive"] .mobile-new {
  border-color: rgba(255,255,255,0.3); color: #fff;
}

/* ═══════ 스레드마케팅 스타일 효과: 그라데이션 버튼 + shine + 큰 라운드 ═══════ */
@keyframes shineMove {
  0% { transform: translateX(-120%); }
  60%, 100% { transform: translateX(220%); }
}
/* 주요 버튼: 버건디 그라데이션 + 빛 흐름 */
#askBtn, .new-btn, .thread-controls .primary, .cos-actions .primary, .comment-actions .primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-radius: 12px;
}
#askBtn::after, .new-btn::after, .thread-controls .primary::after,
.cos-actions .primary::after, .comment-actions .primary::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 40%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: translateX(-120%);
  animation: shineMove 5s ease-in-out infinite;
  pointer-events: none;
}
#askBtn:hover, .new-btn:hover { filter: brightness(1.08); }

/* 큰 둥근 모서리 — 컴포저·추천·합의도 패널 */
.composer, .cos-result, .advisor-picker, .consensus-bar, .comment-box, .thread-block {
  border-radius: 16px;
}

/* 카드 헤더 상단 미세 하이라이트 라인 (입체감) */
.card header { position: relative; }

/* composer 포커스 글로우 강화 */
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px var(--accent-glow);
}

/* 사이드바 새 작전 버튼도 그라데이션 */
.new-btn { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 4px 16px var(--accent-glow); }

/* ═══════ 모션 — 카드 등장 스태거 (절제) ═══════ */
@media (prefers-reduced-motion: no-preference) {
  @keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
  .round-grid .card { animation: cardIn 0.45s cubic-bezier(.2,.8,.2,1) both; }
  .round-grid .card:nth-child(2) { animation-delay: 0.06s; }
  .round-grid .card:nth-child(3) { animation-delay: 0.12s; }
  .round-grid .card:nth-child(4) { animation-delay: 0.18s; }
  .round-grid .card:nth-child(5) { animation-delay: 0.24s; }
  .round-grid .card:nth-child(6) { animation-delay: 0.30s; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none !important; }
  .live-dot, .status-badge.open::before { animation: none !important; }
}
