:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-soft: #0d1219;
  --panel: #111823;
  --panel-2: #151e2b;
  --line: #233042;
  --line-soft: #1a2433;
  --text: #e9eef6;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --accent: #7c8cff;
  --accent-2: #22d3ee;
  --accent-ink: #0a0f18;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-soft: #eceef2;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --line: #e2e6ee;
  --line-soft: #edf0f5;
  --text: #131820;
  --muted: #5c6979;
  --muted-2: #8a97a8;
  --accent: #4f5bd5;
  --accent-2: #0ea5c6;
  --accent-ink: #ffffff;
  --ok: #0f9f6e;
  --warn: #b77900;
  --danger: #d84a4a;
  --shadow: 0 16px 50px rgba(17, 24, 39, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

button { cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

#app {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  height: 100dvh;
}

/* ── 사이드바 ─────────────────────────────── */
#sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.22), rgba(34, 211, 238, 0.16));
  border: 1px solid rgba(124, 140, 255, 0.35);
}

.brand strong { display: block; font-size: 14.5px; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.brand .icon-btn { margin-left: auto; }

.room-topic {
  margin: 4px 14px 16px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.room-topic b { color: var(--text); font-weight: 600; display: block; margin-bottom: 3px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11.5px;
  padding: 2px 4px;
  border-radius: 6px;
}
.link-btn:hover { background: rgba(124, 140, 255, 0.1); }

#agent-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
  min-height: 0;
}

.agent-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 9px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.agent-card:hover { background: var(--panel); border-color: var(--line-soft); }
.agent-card.selected { background: var(--panel); border-color: var(--line); }
.agent-card.off { opacity: 0.5; }

.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: color-mix(in srgb, var(--ac) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ac) 34%, transparent);
  position: relative;
}

.avatar .status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-soft);
  background: var(--muted-2);
}
.status-dot.thinking { background: var(--warn); animation: pulse 1s infinite; }
.status-dot.waiting { background: var(--accent-2); }
.status-dot.error { background: var(--danger); }
.status-dot.idle { background: var(--ok); }

.agent-meta { min-width: 0; flex: 1; }
.agent-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.agent-tag { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.agent-badges { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

.badge {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.demo { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.wait { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }

.switch {
  flex: none;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 8px;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch.on { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.switch.on::after { transform: translateX(12px); background: var(--accent); }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
}
.sidebar-foot button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  width: 100%;
}
.sidebar-foot button:hover { border-color: var(--line); background: var(--panel-2); }
.server-line { font-size: 10.5px; color: var(--muted-2); text-align: center; font-family: var(--mono); }

/* ── 메인 ─────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(124, 140, 255, 0.08), transparent 60%),
    var(--bg);
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  z-index: 5;
}

.head-title { min-width: 0; }
.head-title h1 {
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head-title p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, border-color 0.14s, background 0.14s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted-2); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 700;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.icon { padding: 8px 10px; }
.btn.small { padding: 5px 9px; font-size: 11.5px; border-radius: 8px; }

.banner {
  margin: 10px 18px 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--warn);
  display: flex;
  gap: 8px;
  align-items: center;
}
.banner.blue { border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); background: color-mix(in srgb, var(--accent-2) 8%, transparent); color: var(--accent-2); }
.banner button { margin-left: auto; background: none; border: none; color: inherit; text-decoration: underline; font-size: 11.5px; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 8px;
  min-height: 0;
  scroll-behavior: smooth;
}

.stream {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  margin: 18px 0 10px;
}
.date-divider::before, .date-divider::after { content: ""; height: 1px; background: var(--line-soft); flex: 1; }

.msg { display: flex; gap: 10px; padding: 7px 0; animation: rise 0.18s ease both; }
.msg.user { flex-direction: row-reverse; }
.msg .body { max-width: min(680px, 84%); min-width: 0; }
.msg .meta { display: flex; align-items: center; gap: 6px; margin: 0 0 4px 2px; font-size: 11px; color: var(--muted); }
.msg.user .meta { justify-content: flex-end; margin: 0 2px 4px 0; }
.msg .meta b { color: var(--text); font-weight: 600; font-size: 12px; }
.msg .meta .demo-tag { color: var(--warn); font-size: 9.5px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); padding: 1px 5px; border-radius: 999px; }

.bubble {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  padding: 11px 14px;
  border-radius: 3px 14px 14px 14px;
  font-size: 14px;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: var(--accent-ink);
  border: none;
  border-radius: 14px 3px 14px 14px;
  font-weight: 500;
}
[data-theme="dark"] .msg.user .bubble { color: #0b1020; }
.bubble p { margin: 0 0 0.6em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 1px 5px;
  border-radius: 5px;
}
.bubble pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 0.4em 0 0.7em;
}
.bubble pre code { background: none; padding: 0; }
.bubble a { color: var(--accent-2); }
.msg.user .bubble a { color: inherit; text-decoration: underline; }
.bubble ul, .bubble ol { margin: 0.2em 0 0.6em; padding-left: 1.3em; }
.bubble li { margin: 0.15em 0; }
.bubble blockquote { margin: 0.3em 0; padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); }

.system {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  animation: rise 0.18s ease both;
}
.system span {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  padding: 5px 11px;
  border-radius: 999px;
  max-width: 80%;
  text-align: center;
  line-height: 1.5;
}
.system.error span { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 6px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  font-size: 11.5px;
  color: var(--muted);
  min-height: 26px;
}
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  animation: bounce 1.1s infinite;
}
.typing .dots i:nth-child(2) { animation-delay: 0.15s; }
.typing .dots i:nth-child(3) { animation-delay: 0.3s; }

/* ── 입력 ─────────────────────────────────── */
#composer {
  position: relative;
  padding: 8px 18px 16px;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
}
.composer-inner { max-width: 860px; margin: 0 auto; position: relative; }
.composer-box {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  padding: 10px 10px 8px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }

#input {
  width: 100%;
  border: none;
  background: none;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.55;
  max-height: 180px;
  padding: 3px 2px 6px;
}
#input::placeholder { color: var(--muted-2); }

.composer-bar { display: flex; align-items: center; gap: 8px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.chip {
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip:hover { color: var(--text); border-color: var(--line); }
.hint { font-size: 10.5px; color: var(--muted-2); margin-right: 6px; }
.send-group { display: flex; align-items: center; flex: none; }

.mention-pop {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 12px;
  width: 320px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  text-align: left;
  font-size: 12.5px;
}
.mention-item:hover, .mention-item.active { background: var(--panel-2); }
.mention-item .avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 13px; }
.mention-item small { color: var(--muted); margin-left: auto; font-size: 10.5px; }

/* ── 빈 상태 ─────────────────────────────── */
.empty {
  max-width: 640px;
  margin: 6vh auto 0;
  text-align: center;
  animation: rise 0.25s ease both;
}
.empty .hero {
  font-size: 40px;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 20px rgba(124, 140, 255, 0.3));
}
.empty h2 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.02em; }
.empty p { color: var(--muted); font-size: 13.5px; line-height: 1.65; margin: 0 auto 20px; max-width: 480px; }
.empty .steps { display: grid; gap: 8px; text-align: left; margin: 0 auto 20px; max-width: 460px; }
.empty .step {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line-soft);
  padding: 10px 12px; border-radius: 11px; font-size: 12.5px; color: var(--muted);
}
.empty .step b { color: var(--text); }
.empty .num {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.empty .cta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── 모달·드로어 ─────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 12, 0.62);
  backdrop-filter: blur(6px);
  animation: fade 0.15s ease both;
}
.modal-card {
  width: min(760px, 100%);
  max-height: min(84dvh, 900px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.16s ease both;
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 94vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 55;
  display: flex;
  flex-direction: column;
  animation: slide 0.18s ease both;
}
.drawer .modal-head { border-bottom: 1px solid var(--line-soft); }
.drawer .modal-body { flex: 1; }
.drawer .modal-foot { border-top: 1px solid var(--line-soft); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.01em; }
.field input[type="text"], .field input[type="number"], .field input[type="password"], .field textarea, .field select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12.5px;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 68px; line-height: 1.55; }
.field .help { font-size: 10.5px; color: var(--muted-2); margin-top: 4px; line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.checkline input { width: 15px; height: 15px; accent-color: var(--accent); }

.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: none; background: none; color: var(--muted);
  font-size: 12px; padding: 6px 8px; border-radius: 6px;
}
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

.guide-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 14px; }
.guide-tab {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--muted);
  padding: 5px 9px; border-radius: 999px; font-size: 11.5px;
}
.guide-tab.on { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.prompt-box {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  margin: 10px 0;
}
.prompt-box pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  max-height: 260px; overflow-y: auto; color: var(--text);
}
.prompt-box .copy { position: absolute; top: 8px; right: 8px; }

.facts { margin: 8px 0 0; padding-left: 16px; font-size: 12.5px; line-height: 1.62; color: var(--muted); }
.facts li { margin: 5px 0; }
.steps-list { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.62; color: var(--muted); }
.steps-list li { margin: 5px 0; }
.sources { display: flex; flex-direction: column; gap: 3px; font-size: 11px; margin-top: 8px; }
.sources a { color: var(--accent-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a:hover { text-decoration: underline; }

.note {
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px 12px;
}
.note.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 7%, transparent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid transparent; background: none; color: var(--muted);
  display: grid; place-items: center; font-size: 15px;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-soft); }

.mobile-only { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.985) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.6; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; width: 284px; z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  #sidebar.open { transform: none; }
  .mobile-only { display: grid; }
  .head-actions .btn span.label { display: none; }
  .head-actions { gap: 5px; }
  .messages { padding: 16px 12px 6px; }
  #composer { padding: 6px 12px 12px; }
  .hint { display: none; }
  .msg .body { max-width: 88%; }
  .modal { padding: 10px; }
  .modal-card { max-height: 90dvh; }
}

/* ── 승인 요청 (에이전트가 [승인 요청]을 올렸을 때) ─────────── */
.approval {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}
.approval.pending {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
  color: var(--text, inherit);
}
.approval.approved { color: var(--ok); }
.approval.pending span { margin-right: auto; }

/* ── 클라우드 판 추가: 로그인 · 사용량 · 응답 등급 · 알림 ── */
.login {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.login.hidden { display: none; }
.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .brand-mark { margin: 0 auto; }
.login-card h2 { margin: 4px 0 0; font-size: 18px; }
.login-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
}
.login-card .btn { justify-content: center; padding: 11px; }
.login-error { min-height: 18px; color: var(--danger); font-size: 12.5px; }

.usage-box {
  margin: 10px 12px 0;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.usage-box:empty { display: none; }
.usage-row { display: flex; justify-content: space-between; gap: 8px; }
.usage-bar { height: 4px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--ok); }
.usage-bar i.warn { background: var(--warn); }
.usage-bar i.over { background: var(--danger); }

.badge.tier-instant { color: var(--ok); }
.badge.tier-scheduled { color: var(--accent-2); }
.badge.tier-manual { color: var(--muted); }

.sidebar-foot .link-btn { margin-top: 6px; font-size: 11.5px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); }
.banner.danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.push-box { display: grid; gap: 8px; }
.push-box .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
