/* Duoback 톤 UI — 테마는 :root 변수 */

:root{
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --ink: #0e1b2b;
  --muted: #5b6b7e;
  --border: rgba(14, 27, 43, .12);

  --navy: #0b2a4a;
  --navy-2: #0a223c;
  --accent: #1c66d6;
  --accent-2: #0f4fb6;

  --success: #118a52;
  --danger: #c13232;

  --shadow: 0 12px 34px rgba(10, 34, 60, .10);
  --shadow-2: 0 8px 24px rgba(10, 34, 60, .08);

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

  --font: ui-sans-serif, system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", Segoe UI, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --sidebar-w: 320px;
  --topbar-h: 64px;
  --control-h: 44px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(1100px 700px at 40% -20%, rgba(28, 102, 214, .08), transparent 60%),
              radial-gradient(900px 650px at 110% 30%, rgba(11, 42, 74, .10), transparent 60%),
              var(--bg);
  overflow: hidden;
}

a{ color: inherit; }

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  border:0;
}

.skip-link{
  position: fixed;
  z-index: 9999;
  top: 12px;
  left: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  transform: translateY(-150%);
  transition: transform .2s ease;
}
.skip-link:focus{ transform: translateY(0); }

.app{
  height: 100%;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
}

.topbar{
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-text{ min-width: 0; }
.brand-title{
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions{
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  width: var(--control-h);
  height: var(--control-h);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--navy);
  box-shadow: 0 10px 18px rgba(10, 34, 60, .06);
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.icon-btn svg{
  width: 20px;
  height: 20px;
  display: block;
  overflow: visible;
}
.icon-btn:hover{ background: var(--surface-2); }
.icon-btn:active{ transform: translateY(1px); }
.icon-btn.subtle{
  box-shadow: none;
  background: transparent;
}
.icon-btn.subtle:hover{ background: rgba(14, 27, 43, .06); }

.pill-btn{
  appearance: none;
  border: 1px solid rgba(28, 102, 214, .22);
  background: linear-gradient(180deg, rgba(28, 102, 214, .10), rgba(28, 102, 214, .06));
  color: var(--navy);
  height: var(--control-h);
  padding: 0 14px 0 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  font-weight: 700;
}
.pill-btn:hover{
  border-color: rgba(28, 102, 214, .32);
  background: linear-gradient(180deg, rgba(28, 102, 214, .14), rgba(28, 102, 214, .08));
}
.pill-btn:active{ transform: translateY(1px); }
.pill-icon{
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.pill-icon svg{ width: 20px; height: 20px; }

.layout{
  height: calc(100vh - var(--topbar-h));
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  position: relative;
  min-height: 0;
}

.layout.sidebar-collapsed{
  grid-template-columns: 0 1fr;
}
.layout.sidebar-collapsed .sidebar{
  width: 0;
  padding: 0;
  border-right: 0;
  pointer-events: none;
}
.layout.sidebar-collapsed .sidebar > *{
  display: none;
}

.sidebar{
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  padding: 14px 12px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
}
.sidebar-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--control-h);
}
.sidebar-title{
  font-weight: 900;
  letter-spacing: -0.02em;
  height: var(--control-h);
  display: flex;
  align-items: center;
  line-height: 1;
}
.sidebar-actions{
  display: flex;
  gap: 8px;
  align-items: center;
}
.pill-mini{
  appearance: none;
  border: 1px solid rgba(14,27,43,.14);
  background: rgba(255,255,255,.72);
  height: var(--control-h);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  color: var(--navy);
  transition: background .15s ease, transform .08s ease, border-color .15s ease;
}
.pill-mini:hover{
  background: rgba(28,102,214,.08);
  border-color: rgba(28,102,214,.18);
}
.pill-mini:active{ transform: translateY(1px); }
.sidebar-tools{
  display: grid;
  gap: 10px;
  padding: 2px 2px 0;
}
.search{
  display: grid;
  grid-template-columns: var(--control-h) 1fr;
  align-items: center;
  border: 1px solid rgba(14,27,43,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 18px rgba(10,34,60,.05);
  overflow: hidden;
}
.search-icon{
  width: var(--control-h);
  height: var(--control-h);
  display: grid;
  place-items: center;
  color: rgba(14,27,43,.65);
}
.search-icon svg{ width: 18px; height: 18px; }
.search input{
  width: 100%;
  height: var(--control-h);
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-weight: 700;
  padding: 0 10px 0 0;
  color: var(--ink);
}
.tool-row{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 즐겨찾기 드롭다운 (검색창 아래) */
.favorites-panel{
  border: 1px solid rgba(14,27,43,.12);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 18px rgba(10,34,60,.05);
  overflow: hidden;
}
.favorites-summary{
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
  color: var(--navy);
}
.favorites-summary::-webkit-details-marker{ display: none; }
.favorites-summary-text{ flex: 1; min-width: 0; }
.favorites-chevron{
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(14,27,43,.45);
  border-bottom: 2px solid rgba(14,27,43,.45);
  transform: rotate(45deg);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.favorites-panel[open] .favorites-chevron{
  transform: rotate(225deg);
  margin-top: 2px;
}
.favorites-body{
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  min-height: 0;
}
.favorites-empty{
  padding: 10px 8px 6px;
  font-size: 13px;
  text-align: center;
}
.favorite-chat-item{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(255,255,255,.85);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.favorite-chat-item:hover{
  background: rgba(28,102,214,.07);
  border-color: rgba(28,102,214,.15);
}
.favorite-chat-item:active{ transform: translateY(1px); }
.favorite-chat-item.is-active{
  background: rgba(28,102,214,.12);
  border-color: rgba(28,102,214,.22);
}
.favorite-star{
  color: #e6a800;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.favorite-chat-title{
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-list{
  overflow: auto;
  padding-right: 4px;
  min-height: 0;
}
.chat-list::-webkit-scrollbar,
.messages::-webkit-scrollbar{ width: 10px; }
.chat-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb{
  background: rgba(14, 27, 43, .14);
  border-radius: 999px;
}
.chat-list::-webkit-scrollbar-thumb{ border: 3px solid rgba(255,255,255,.7); }
.messages::-webkit-scrollbar-thumb{ border: 3px solid rgba(246,248,251,1); }

.chat-item-row{
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.chat-row-actions{
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.mini-icon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(14, 27, 43, .10);
  background: rgba(255,255,255,.7);
  cursor: pointer;
  color: var(--navy);
  display: grid;
  place-items: center;
  transition: background .15s ease, transform .08s ease, border-color .15s ease;
}
.mini-icon:hover{ background: rgba(14, 27, 43, .06); }
.mini-icon:active{ transform: translateY(1px); }
.mini-icon svg{ width: 18px; height: 18px; }
/* 즐겨찾기 ON: 별(아이콘) 노란색 */
.mini-icon.pinned{
  color: #e6a800;
  border-color: rgba(230, 168, 0, 0.4);
  background: rgba(255, 250, 230, 0.95);
}
.mini-icon.pinned svg path:first-of-type{
  fill: currentColor;
  opacity: 0.42;
}
.mini-icon.pinned svg path:last-of-type{
  stroke: currentColor;
}
.rename-input{
  width: 100%;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(28,102,214,.22);
  outline: none;
  padding: 0 10px;
  font-family: var(--font);
  font-weight: 800;
}

.chat-item{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
  text-align: left;
}
.chat-item:hover{
  background: rgba(28, 102, 214, .07);
  border-color: rgba(28, 102, 214, .12);
}
.chat-item:active{ transform: translateY(1px); }
.chat-item.active{
  background: rgba(28, 102, 214, .12);
  border-color: rgba(28, 102, 214, .24);
}

.chat-check{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}
.chat-check input{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.chat-check-ui{
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid rgba(14, 27, 43, .22);
  background: rgba(255,255,255,.9);
  box-shadow: 0 8px 18px rgba(10,34,60,.06);
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
  position: relative;
}
.chat-check:hover .chat-check-ui{
  border-color: rgba(28, 102, 214, .35);
  background: rgba(28,102,214,.06);
}
.chat-check input:checked + .chat-check-ui{
  border-color: rgba(28, 102, 214, .45);
  background: rgba(28, 102, 214, .18);
}
.chat-check input:checked + .chat-check-ui::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 10px;
  border: solid var(--accent-2);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}
.chat-item-title{
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer{ padding-top: 6px; }
.help-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(11, 42, 74, .04), rgba(28, 102, 214, .06));
  padding: 12px;
}
.help-title{
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.help-list{
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.overlay{
  position: absolute;
  inset: 0;
  background: rgba(10, 34, 60, .35);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.main{
  overflow: hidden;
  display: grid;
  min-height: 0;
}

.chat{
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px 18px 14px;
  gap: 12px;
  min-height: 0;
}
.chat-header{
  background: rgba(255,255,255,.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px;
  box-shadow: var(--shadow-2);
}
.chat-title{
  font-weight: 900;
  letter-spacing: -0.02em;
}
.chat-meta{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.messages{
  overflow: auto;
  padding: 8px 4px 18px;
  scroll-behavior: smooth;
  min-height: 0;
}

.msg{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
  margin: 12px 0;
}

.msg.is-user{
  grid-template-columns: 1fr 40px;
}
.msg.is-user .bubble{
  justify-self: end;
  max-width: min(680px, 92%);
}
.msg.is-user .avatar{
  justify-self: end;
}

.msg.is-assistant .bubble{
  max-width: min(720px, 92%);
}
.avatar{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--navy);
  box-shadow: 0 10px 18px rgba(10,34,60,.06);
}
.avatar.user{
  background: linear-gradient(135deg, rgba(28, 102, 214, .12), rgba(28, 102, 214, .06));
  color: var(--accent-2);
}
.avatar.assistant{
  background: linear-gradient(135deg, rgba(11, 42, 74, .10), rgba(11, 42, 74, .04));
  color: var(--navy);
}
.avatar svg{ width: 20px; height: 20px; }

.bubble{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 22px rgba(10,34,60,.06);
  padding: 12px 14px;
  overflow: hidden;
}
.bubble.user{
  border-color: rgba(28,102,214,.20);
  background: linear-gradient(180deg, rgba(28,102,214,.10), rgba(255,255,255,.92));
}
.bubble-meta{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}
.bubble-meta-right{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bubble-meta-right .mini-icon{
  width: 30px;
  height: 30px;
  border-radius: 12px;
  box-shadow: none;
}
.bubble-meta-right .mini-icon svg{ width: 16px; height: 16px; }
.bubble-role{
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 13px;
}
.bubble-time{
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.bubble-text{
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 14px;
}

.typing{
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(14,27,43,.04);
  width: fit-content;
}
.typing .dot{
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(14,27,43,.55);
  animation: dot 1.1s infinite ease-in-out;
}
.typing .dot:nth-child(2){ animation-delay: .15s; }
.typing .dot:nth-child(3){ animation-delay: .3s; }
@keyframes dot{
  0%, 80%, 100%{ transform: translateY(0); opacity: .45; }
  40%{ transform: translateY(-3px); opacity: 1; }
}

.typing-status{
  font-size: 13px;
  color: rgba(14,27,43,.5);
  padding: 4px 2px;
  font-style: italic;
  animation: fade-pulse 1.5s ease-in-out infinite;
}
@keyframes fade-pulse{
  0%, 100%{ opacity: .5; }
  50%{ opacity: 1; }
}

/* ── 피드백 버튼 👍 / 👎 ──────────────────────────────── */
.msg-feedback{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.feedback-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  line-height: 1;
}
.feedback-btn:hover:not(:disabled){ background: rgba(14,27,43,.06); }
.feedback-btn:active:not(:disabled){ transform: scale(.92); }
.feedback-btn:disabled{ cursor: default; opacity: .6; }
.feedback-btn.selected-up{
  background: rgba(17, 138, 82, .12);
  border-color: rgba(17, 138, 82, .40);
}
.feedback-btn.selected-down{
  background: rgba(193, 50, 50, .10);
  border-color: rgba(193, 50, 50, .35);
}
.feedback-label{
  font-size: 12px;
  color: var(--success);
}
.feedback-label.muted{
  color: var(--muted);
}

.edit-wrap{ display: grid; gap: 10px; }
.edit-area{
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border-radius: 16px;
}
.edit-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.msg-attachments{
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.msg-attach{
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 16px;
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(255,255,255,.76);
  text-decoration: none;
}
.msg-attach-thumb{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(11,42,74,.06);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: rgba(14,27,43,.65);
}
.msg-attach-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.msg-attach-thumb svg{ width: 20px; height: 20px; }
.msg-attach-text{ min-width: 0; display: grid; gap: 2px; }
.msg-attach-name{
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-attach-meta{
  font-size: 12px;
  color: var(--muted);
}

.composer{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  padding: 12px;
}

.attach-preview{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.attach-chip{
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(14,27,43,.12);
  background: rgba(255,255,255,.76);
  max-width: 360px;
}
.attach-thumb{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(11,42,74,.06);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: rgba(14,27,43,.65);
}
.attach-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-name{
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-meta{
  font-size: 11px;
  color: var(--muted);
}
.attach-remove{
  width: 28px;
  height: 28px;
  border-radius: 12px;
  border: 1px solid rgba(14,27,43,.10);
  background: rgba(255,255,255,.8);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.attach-remove:hover{ background: rgba(14,27,43,.06); }
.attach-remove svg{ width: 16px; height: 16px; }

/* Markdown-ish styling inside bubbles */
.bubble-text :is(p, ul, ol, pre, blockquote){ margin: 8px 0; }
.bubble-text ul, .bubble-text ol{ padding-left: 18px; }
.bubble-text code{
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(14,27,43,.06);
  border: 1px solid rgba(14,27,43,.10);
}
.bubble-text pre{
  padding: 10px 12px;
  border-radius: 14px;
  overflow: auto;
  background: rgba(10,34,60,.06);
  border: 1px solid rgba(14,27,43,.10);
}
.bubble-text pre code{
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12.5px;
}
.bubble-text a{
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.composer-form{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}
.composer-field{
  min-width: 0;
}
textarea{
  width: 100%;
  resize: none;
  border: 1px solid rgba(14,27,43,.14);
  border-radius: 16px;
  background: rgba(255,255,255,.96);
  padding: 12px 12px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
  min-height: var(--control-h);
}
textarea:focus{
  border-color: rgba(28,102,214,.38);
  box-shadow: 0 0 0 4px rgba(28,102,214,.14);
}
.composer-hint{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.composer-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-actions .icon-btn{
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 16px;
}

.send-btn{
  height: var(--control-h);
  padding: 0 14px 0 12px;
  border-radius: 16px;
  border: 1px solid rgba(28,102,214,.26);
  background: linear-gradient(180deg, rgba(28,102,214,.92), rgba(15,79,182,.92));
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 16px 34px rgba(28,102,214,.18);
  transition: transform .08s ease, filter .15s ease;
}
.send-btn:hover{ filter: brightness(1.02); }
.send-btn:active{ transform: translateY(1px); }
.send-icon{ width: 18px; height: 18px; display: grid; place-items: center; }
.send-icon svg{ width: 18px; height: 18px; }

.composer-footer{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.badge{
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(14,27,43,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  color: var(--navy);
}
.divider{
  width: 1px;
  height: 14px;
  background: rgba(14,27,43,.18);
}
.muted{ color: var(--muted); }

/* 삭제 확인 모달 (버튼 순서: 왼쪽 확인 · 오른쪽 취소) */
.modal{
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal[hidden]{ display: none !important; }
.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(10, 34, 60, .45);
  backdrop-filter: blur(3px);
}
.modal-box{
  position: relative;
  width: min(400px, 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
}
.modal-title{
  margin: 0 0 8px;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 16px;
}
.modal-desc{
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}
.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-btn{
  appearance: none;
  min-width: 96px;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  border: 1px solid rgba(14,27,43,.14);
  transition: background .15s ease, transform .08s ease, border-color .15s ease;
}
.modal-btn.secondary{
  background: rgba(255,255,255,.95);
  color: var(--navy);
}
.modal-btn.secondary:hover{ background: var(--surface-2); }
.modal-btn.danger{
  background: linear-gradient(180deg, rgba(28,102,214,.92), rgba(15,79,182,.92));
  border-color: rgba(28,102,214,.35);
  color: #fff;
}
.modal-btn.danger:hover{ filter: brightness(1.03); }
.modal-btn:active{ transform: translateY(1px); }

/* Responsive */
@media (max-width: 980px){
  :root{ --sidebar-w: 300px; }
  .chat{ padding: 14px 14px 12px; }
}

@media (max-width: 820px){
  .layout{
    grid-template-columns: 1fr;
  }
  .sidebar{
    position: absolute;
    top: 0;
    left: 0;
    height: calc(100vh - var(--topbar-h));
    width: min(var(--sidebar-w), 86vw);
    z-index: 45;
    transform: translateX(-104%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open{ transform: translateX(0); }
}

@media (max-width: 520px){
  .topbar{ padding: 10px 12px; gap: 10px; }
  .pill-btn{ padding: 0 12px; }
  .composer-form{
    grid-template-columns: 1fr;
  }
  .composer-actions{
    justify-content: space-between;
  }
  .send-btn{ width: 100%; justify-content: center; }
}
