:root {
  /* Adealia palette — cool off-white / navy / blue (Apple-inspired).
     Navy is kept as the brand/primary color; the peach accent is retired in
     favour of a single Apple blue. Token NAMES are unchanged so the swap
     cascades through every rule below untouched. */
  --navy: #1a2547;
  --navy-soft: #2a335a;
  --navy-deep: #11173a;
  --peach: #0071E3;
  --peach-soft: #AFD5F5;
  --peach-deep: #0058B0;
  --ink-1: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #86868B;
  --ink-4: #AEAEB2;
  --cream: #F5F5F7;
  --sunken: #ECECEF;
  --white: #ffffff;
  --line: #D2D2D7;
  --line-2: #E5E5EA;
  --line-3: #C7C7CC;
  --okA-fg: #085041;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgba(26, 37, 71, 0.04), 0 2px 6px rgba(26, 37, 71, 0.05);
  --shadow-md: 0 4px 12px rgba(26, 37, 71, 0.06), 0 18px 48px rgba(26, 37, 71, 0.09);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink-1);
  background: var(--cream);
  display: flex;
  flex-direction: row;
  -webkit-font-smoothing: antialiased;
}
.main-col {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- sidebar ---- */
.sidebar {
  width: 262px;
  flex: none;
  height: 100vh;
  background: var(--sunken);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 9px;
  overflow: hidden;
}
.new-chat {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s;
}
.new-chat:hover { border-color: var(--peach-deep); transform: translateY(-1px); }
.new-chat .plus { font-size: 17px; font-weight: 700; color: var(--peach-deep); }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background 0.15s;
}
.conv-item:hover { background: rgba(26, 37, 71, 0.05); }
.conv-item.active { background: var(--white); color: var(--ink-1); font-weight: 600; box-shadow: var(--shadow-sm); }
.conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-del {
  border: 0;
  background: none;
  color: var(--ink-4);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { color: #c0392b; }
/* workspace header (R1) */
.workspace {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.ws-logo { max-width: 100%; max-height: 40px; height: auto; display: block; margin: 0 auto 5px; object-fit: contain; }
.ws-sub { font-size: 10.5px; color: var(--ink-3); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }

/* logged-in agent + powered-by */
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--navy-soft), var(--navy-deep));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.user-name { font-size: 13px; font-weight: 700; color: var(--ink-1); line-height: 1.25; }
.user-role { font-size: 11.5px; color: var(--ink-3); }
.powered { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.powered img { height: 14px; width: auto; }
/* user chip relocated to the header top-right */
.header-user { gap: 10px; }
.header-user .user-text { text-align: right; line-height: 1.2; }

/* login screen (demo opener) */
#login {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, var(--cream) 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}
#login.hide { opacity: 0; }
.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 38px 34px 30px;
  width: min(90vw, 380px);
  text-align: center;
}
.login-logo { max-width: 200px; height: auto; display: block; margin: 0 auto 24px; }
.login-title { font-size: 20px; font-weight: 800; color: var(--navy); margin: 0 0 6px; letter-spacing: -0.01em; }
.login-sub { font-size: 13.5px; color: var(--ink-2); margin: 0 0 24px; }
.login-btn {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line-3);
  background: var(--white);
  color: var(--ink-1);
  cursor: pointer;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: border-color 0.18s, transform 0.18s;
}
.login-btn:hover { border-color: var(--navy); transform: translateY(-1px); }
.login-btn.ghost { color: var(--ink-2); }
.login-btn .g { font-weight: 800; color: #4285f4; }
.login-foot {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.login-foot img { height: 15px; width: auto; }
.brand-mark.small { width: 20px; height: 20px; border-radius: 6px; box-shadow: none; }
.brand-mark.small::after { width: 7px; height: 7px; }
@media (max-width: 760px) { .sidebar { display: none; } }

/* chat/resources nav — flat list items */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 9px;
  border: 0;
  background: none;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--white); }
.nav-item.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow-sm); }

/* uniform monochrome line icons across the sidebar */
.ico {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink-3);
}
.nav-item.active .ico { color: var(--navy); }
.side-link:hover .ico, .product-link:hover .ico { color: var(--ink-2); }
.ico.ext { width: 13px; height: 13px; color: var(--ink-4); }
.product-link.current .ico { color: var(--navy); }

/* split middle: links (top half) + chat history (bottom half) */
.sidebar-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.links-section {
  flex: 0 0 auto;
  padding: 6px 0 16px;
  border-bottom: 1px solid var(--line);
}
.history-section {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  gap: 6px;
  overflow: hidden;
}
.history-section .conv-list { flex: 1; }
.hist-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; }
.new-chat-mini {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--peach-deep);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.new-chat-mini:hover { border-color: var(--peach-deep); transform: translateY(-1px); }

.side-group { margin-bottom: 20px; }
.side-group-label {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 0 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hist-label { margin-bottom: 0; }
.lbl-logo { height: 13px; width: auto; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.side-link:hover { background: var(--white); color: var(--ink-1); }
.side-ico { font-size: 13px; width: 18px; text-align: center; flex: none; }

.product-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.product-link:hover { background: var(--white); }
.prod-badge {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: linear-gradient(150deg, #fff, var(--sunken));
  border: 1px solid var(--line);
}
.prod-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-1);
}
.prod-sub { font-size: 10px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
.prod-arr { color: var(--ink-4); font-size: 13px; flex: none; }
.product-link.current { background: var(--white); box-shadow: var(--shadow-sm); cursor: default; }
.product-link.current .prod-sub { color: var(--peach-deep); }

/* ---- resources library ---- */
#library { flex: 1; overflow-y: auto; display: none; flex-direction: column; }
.lib-head {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 22px clamp(16px, 5vw, 40px) 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#libSearch {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line-3);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  color: var(--ink-1);
}
#libSearch:focus { outline: none; border-color: var(--peach-deep); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15); }
.lib-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.lib-list { max-width: 1040px; width: 100%; margin: 0 auto; padding: 10px clamp(16px, 5vw, 40px) 48px; }
.lib-folder { margin-bottom: 24px; }
.lib-folder-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin: 0 2px 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-2);
}
.lib-count { color: var(--ink-4); }
.lib-cards { display: flex; flex-direction: column; gap: 8px; }
.lib-empty { text-align: center; color: var(--ink-3); padding: 48px 20px; }

/* library accordion item */
.lib-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.lib-item-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink-1);
}
.lib-item-head:hover { background: rgba(26, 37, 71, 0.02); }
.lib-item-name { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--ink-4); font-size: 19px; line-height: 1; transition: transform 0.2s; flex: none; }
.lib-item.open .chev { transform: rotate(90deg); }
.lib-item-body { display: none; padding: 0 15px 15px; }
.lib-item.open .lib-item-body { display: block; }
.lib-note { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.lib-note.muted { color: var(--ink-4); font-style: italic; }
.lib-note p { margin: 0 0 8px; }
.lib-note p:last-child { margin-bottom: 0; }
.lib-note ul, .lib-note ol { margin: 6px 0; padding-left: 20px; }
.lib-note li { margin: 2px 0; }
.lib-note a { color: var(--peach-deep); text-decoration: underline; }
.lib-contact {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink-2);
}
.lib-actions { margin-top: 13px; flex-wrap: wrap; }

/* ---- header ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px clamp(16px, 5vw, 40px);
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-r1 {
  height: 30px;
  width: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 11px;
  box-shadow: var(--shadow-sm);
  box-sizing: content-box;
}
.brand-sep { color: var(--ink-4); font-size: 17px; font-weight: 300; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--navy), var(--navy-deep));
  position: relative;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--peach);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; color: var(--navy); }
.brand-thin { font-weight: 500; color: var(--ink-2); }
.brand-logo { height: 30px; width: auto; display: block; }

.header-right { display: flex; align-items: center; gap: 10px; }
.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.conn-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1d9e75;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.16);
}

.welcome-logo { height: 60px; width: auto; display: block; margin: 0 auto 18px; }
.foot-logo { height: 22px; width: auto; }

.status {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--sunken);
  border: 1px solid var(--line-2);
  padding: 6px 11px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ---- chat ---- */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0 16px;
}
.msg {
  max-width: 1040px;
  margin: 0 auto 18px;
  padding: 0 clamp(16px, 5vw, 40px);
  display: flex;
  flex-direction: column;
}
.msg.user { align-items: flex-end; }
.msg.assistant { align-items: flex-start; }

.bubble {
  padding: 15px 20px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 92%;
  font-size: 15px;
  line-height: 1.62;
}
.msg.assistant .bubble {
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
  color: var(--ink-1);
  max-width: 780px;
}
.msg.user .bubble {
  background: linear-gradient(150deg, var(--navy-soft), var(--navy));
  border-bottom-right-radius: 6px;
  color: #fff;
  box-shadow: 0 1px 1px rgba(17, 23, 58, 0.2), 0 8px 22px rgba(26, 37, 71, 0.18);
  max-width: 620px;
}
.bubble a { color: var(--peach-deep); font-weight: 600; }
.msg.user .bubble a { color: var(--peach-soft); }

.greeting-kicker {
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--peach-deep);
  margin-bottom: 8px;
}

.usage {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 6px;
  padding: 0 4px;
  letter-spacing: 0.01em;
}
.bubble.err { background: #faece7; border: 1px solid rgba(113, 43, 19, 0.18); color: #712b13; }

/* streaming cursor */
.blink::after {
  content: "▋";
  color: var(--peach-deep);
  animation: b 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes b { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ---- composer ---- */
#composer {
  background: rgba(245, 245, 247, 0.9);
  backdrop-filter: saturate(1.2) blur(8px);
  border-top: 1px solid var(--line);
  padding: 14px clamp(16px, 5vw, 40px) 18px;
}
.composer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
#input {
  flex: 1;
  resize: none;
  max-height: 168px;
  padding: 13px 16px;
  border: 1px solid var(--line-3);
  border-radius: var(--radius-sm);
  background: var(--white);
  font: inherit;
  font-size: 15px;
  color: var(--ink-1);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
#input:focus {
  outline: none;
  border-color: var(--peach-deep);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
#input::placeholder { color: var(--ink-4); }

#send {
  padding: 13px 26px;
  border: none;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(17, 23, 58, 0.2), 0 8px 22px rgba(26, 37, 71, 0.22);
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.22s, box-shadow 0.22s;
}
#send:hover:not(:disabled) {
  background: var(--navy-soft);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(17, 23, 58, 0.2), 0 14px 30px rgba(26, 37, 71, 0.28);
}
#send:active:not(:disabled) { transform: scale(0.97); }
#send:disabled { background: var(--ink-4); cursor: default; box-shadow: none; }

/* ---- welcome / empty state ---- */
#welcome {
  max-width: 720px;
  margin: 7vh auto 0;
  padding: 0 24px;
  text-align: center;
  animation: msgIn 0.35s ease;
}
.welcome-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  margin: 0 auto 20px;
  background: linear-gradient(150deg, var(--navy), var(--navy-deep));
  position: relative;
  box-shadow: var(--shadow-md);
}
.welcome-mark::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--peach);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#welcome .greeting-kicker { display: inline-block; }
.welcome-title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 6px 0 10px;
}
.welcome-sub { color: var(--ink-2); font-size: 15px; margin: 0 auto 28px; max-width: 520px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-1);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, border-color 0.18s;
}
.chip:hover { transform: translateY(-1px); border-color: var(--peach-deep); }

/* ---- message animation + markdown ---- */
.msg { animation: msgIn 0.25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble h4 { font-size: 15px; font-weight: 700; margin: 10px 0 6px; }
.bubble a { text-decoration: underline; text-underline-offset: 2px; }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--sunken);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 5px;
}
.msg.user .bubble code { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.25); }

/* typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-4);
  display: inline-block;
  animation: typing 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* per-message footer (copy + usage) */
.msg-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 0 2px; opacity: 0; transition: opacity 0.2s; }
.msg:hover .msg-foot { opacity: 1; }
.foot-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: 0;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.foot-btn:hover { color: var(--navy); background: var(--sunken); }
.msg-foot .usage { margin: 0; }

/* ---- action cards ---- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-width: 780px;
  align-self: flex-start;
}
.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 14px;
  box-shadow: var(--shadow-sm);
}
.card-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.card-icon { font-size: 15px; flex: none; }
.card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-actions { display: flex; gap: 6px; flex: none; }
.card-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}
.card-btn:hover { background: var(--navy-soft); transform: translateY(-1px); }
.card-btn.ghost {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--line-3);
}
.card-btn.ghost:hover { background: rgba(26, 37, 71, 0.04); border-color: var(--navy); transform: translateY(-1px); }
.card-btn.disabled {
  background: var(--sunken);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  cursor: default;
}

/* scrollbar */
#chat::-webkit-scrollbar { width: 10px; }
#chat::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 999px; border: 3px solid var(--cream); }
