:root {
  --brand-primary: #101828;
  --brand-accent: #f0b429;
  --brand-surface: #f8fafc;
  --ink: #162033;
  --muted: #667085;
  --line: #e4e7ec;
  --panel: #ffffff;
  --sidebar-width: 318px;
  --radius: 18px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--brand-surface); color: var(--ink); overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.app-shell { min-height: 100%; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar { height: 100vh; display: flex; flex-direction: column; background: var(--brand-primary); color: #fff; padding: 26px 18px 18px; box-shadow: 8px 0 30px rgb(15 23 42 / 10%); z-index: 3; }
.brand-block { display: flex; align-items: center; gap: 13px; padding: 0 8px 24px; }
.brand-mark, .access-logo { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: var(--brand-accent); color: var(--brand-primary); font-weight: 900; letter-spacing: -.04em; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 20%); }
.brand-block h1 { margin: 2px 0 0; font-size: 17px; line-height: 1.15; letter-spacing: -.015em; }
.eyebrow { margin: 0; color: var(--brand-accent); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.new-chat { border: 1px solid rgb(255 255 255 / 14%); border-radius: 12px; background: rgb(255 255 255 / 8%); color: #fff; padding: 11px 13px; text-align: left; transition: .2s ease; }
.new-chat:hover { background: rgb(255 255 255 / 14%); border-color: rgb(255 255 255 / 23%); }
.new-chat span { color: var(--brand-accent); font-weight: 800; margin-right: 8px; }
.search-box { margin: 14px 0 22px; }
.search-box input { width: 100%; border: 1px solid rgb(255 255 255 / 12%); border-radius: 11px; outline: none; background: rgb(2 6 23 / 20%); color: #fff; padding: 10px 12px; }
.search-box input::placeholder { color: rgb(255 255 255 / 48%); }
.search-box input:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 20%, transparent); }
.team-heading { display: flex; justify-content: space-between; padding: 0 8px 9px; color: rgb(255 255 255 / 48%); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.team-count { color: var(--brand-accent); }
.team-list { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / 18%) transparent; padding-right: 3px; }
.team-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; width: 100%; border: 0; border-radius: 12px; background: transparent; color: #fff; padding: 9px; text-align: left; transition: .16s ease; }
.team-item:hover { background: rgb(255 255 255 / 7%); }
.team-item.active { background: rgb(255 255 255 / 12%); box-shadow: inset 3px 0 var(--brand-accent); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgb(255 255 255 / 10%); color: var(--brand-accent); font-size: 13px; font-weight: 850; }
.team-item.active .avatar { background: var(--brand-accent); color: var(--brand-primary); }
.team-copy { min-width: 0; }
.team-copy strong, .team-copy span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-copy strong { font-size: 13px; }
.team-copy span { margin-top: 2px; color: rgb(255 255 255 / 48%); font-size: 11px; }
.online { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgb(74 222 128 / 10%); }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid rgb(255 255 255 / 9%); padding: 15px 8px 1px; color: rgb(255 255 255 / 60%); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; }
.status-dot.ready { background: #4ade80; }

.workspace { height: 100vh; display: grid; grid-template-rows: 74px 1fr auto; min-width: 0; background: radial-gradient(circle at 75% 8%, color-mix(in srgb, var(--brand-accent) 8%, transparent), transparent 28%), var(--brand-surface); }
.workspace-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 82%); backdrop-filter: blur(14px); padding: 0 28px; }
.active-agent { display: flex; align-items: center; gap: 11px; }
.avatar-active { background: var(--brand-primary); color: var(--brand-accent); }
.active-agent strong, .active-agent span { display: block; }
.active-agent strong { font-size: 14px; }
.active-agent span { max-width: min(50vw, 560px); margin-top: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; gap: 8px; }
.icon-button, .mobile-team-toggle { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 38px; height: 38px; }
.icon-button:hover, .mobile-team-toggle:hover { border-color: var(--brand-accent); }
.mobile-team-toggle { display: none; }
.conversation { overflow-y: auto; padding: 42px max(24px, calc((100% - 840px) / 2)); scroll-behavior: smooth; }
.welcome-card { border: 1px solid var(--line); border-radius: 24px; background: rgb(255 255 255 / 86%); padding: 34px; box-shadow: 0 20px 60px rgb(15 23 42 / 7%); }
.welcome-card h2 { margin: 8px 0 10px; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.045em; }
.welcome-card > p:not(.eyebrow) { max-width: 600px; color: var(--muted); line-height: 1.65; }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.starter { border: 1px solid var(--line); border-radius: 13px; background: var(--brand-surface); color: var(--ink); padding: 14px; text-align: left; font-size: 12px; font-weight: 700; }
.starter:hover { border-color: var(--brand-accent); transform: translateY(-1px); }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; margin: 0 0 26px; animation: rise .22s ease-out; }
.message.user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message-bubble { max-width: 760px; border: 1px solid var(--line); border-radius: 6px 18px 18px; background: #fff; padding: 15px 17px; box-shadow: 0 8px 24px rgb(15 23 42 / 4%); }
.message.user .message-bubble { border: 0; border-radius: 18px 18px 6px; background: var(--brand-primary); color: #fff; }
.message-meta { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.message-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.65; }
.message-receipt { margin-top: 10px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent); color: var(--muted); font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.typing .message-text::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--brand-accent); animation: pulse 1s infinite; }
.composer { padding: 16px max(24px, calc((100% - 840px) / 2)) 20px; background: linear-gradient(transparent, var(--brand-surface) 18%); }
.composer-box { display: grid; grid-template-columns: 1fr 42px; align-items: end; gap: 10px; border: 1px solid #d0d5dd; border-radius: 18px; background: #fff; padding: 11px 11px 11px 17px; box-shadow: 0 14px 40px rgb(15 23 42 / 9%); }
.composer-box:focus-within { border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 14%, transparent), 0 14px 40px rgb(15 23 42 / 9%); }
.composer textarea { min-height: 24px; max-height: 180px; resize: none; border: 0; outline: none; color: var(--ink); line-height: 1.5; }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--brand-accent); color: var(--brand-primary); font-size: 21px; font-weight: 850; }
.send-button:disabled { opacity: .45; cursor: wait; }
.composer-note { margin: 8px 0 0; color: var(--muted); text-align: center; font-size: 10px; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(430px, 92vw); z-index: 10; background: #fff; box-shadow: -20px 0 60px rgb(15 23 42 / 18%); padding: 28px; transform: translateX(105%); transition: transform .25s ease; }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer h2 { margin: 6px 0; font-size: 22px; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 9; background: rgb(15 23 42 / 32%); }
.empty-state { margin-top: 80px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto; border-radius: 18px; background: color-mix(in srgb, var(--brand-accent) 18%, white); color: var(--brand-primary); font-size: 24px; }

.access-dialog { width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 24px; padding: 0; box-shadow: 0 30px 100px rgb(15 23 42 / 28%); }
.access-dialog::backdrop { background: rgb(15 23 42 / 72%); backdrop-filter: blur(7px); }
.access-dialog form { padding: 34px; }
.access-dialog h2 { margin: 14px 0 8px; font-size: 27px; letter-spacing: -.03em; }
.access-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.access-logo { margin-bottom: 22px; }
.access-dialog label { display: grid; gap: 7px; margin-top: 22px; font-size: 12px; font-weight: 750; }
.access-dialog input { border: 1px solid #d0d5dd; border-radius: 11px; padding: 12px; outline: none; }
.access-dialog input:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 16%, transparent); }
.primary-button { width: 100%; margin-top: 14px; border: 0; border-radius: 11px; background: var(--brand-primary); color: #fff; padding: 13px; font-weight: 750; }
.form-error { min-height: 18px; margin: 8px 0 0 !important; color: #b42318 !important; font-size: 11px; }

@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
@keyframes pulse { 50% { opacity: .25; transform: scale(.75); } }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .workspace { width: 100vw; }
  .workspace-header { padding: 0 15px; }
  .mobile-team-toggle { display: block; }
  .starter-grid { grid-template-columns: 1fr; }
  .conversation { padding: 24px 16px; }
  .composer { padding: 12px 14px 16px; }
  .welcome-card { padding: 25px; }
  .active-agent span { max-width: 45vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
