:root {
  color-scheme: light;
  --korika-ink: #071017;
  --korika-deep: #06131d;
  --korika-red: #c9284b;
  --korika-red-dark: #79152f;
  --korika-pink: #ed4f88;
  --korika-violet: #7d3cff;
  --korika-teal: #1d9e9a;
  --korika-lime: #c8f23a;
  --korika-paper: #f5f7f1;
  --korika-muted: #67747d;
  --korika-line: rgba(7, 16, 23, .14);
  --ink: var(--korika-ink);
  --muted: var(--korika-muted);
  --paper: var(--korika-paper);
  --panel: #fff;
  --line: var(--korika-line);
  --shadow: 0 14px 50px rgba(7, 16, 23, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { height: 100%; margin: 0; overflow: hidden; background: var(--paper); color: var(--ink); font-size: 14px; }
.shell { width: 100%; height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; }
.sidebar { position: relative; z-index: 2; display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; padding: 24px 16px 15px; background: var(--panel); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 32px; color: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: -.04em; text-decoration: none; }
.brand b { font-weight: 450; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; color: #fff; background: var(--korika-red); border-radius: 50%; font: 15px ui-monospace, monospace; }
.new-chat { height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: #fff; background: var(--korika-red); border: 0; border-radius: 9px; text-align: left; font-size: 13px; font-weight: 700; cursor: pointer; }
.new-chat:hover { color: var(--korika-ink); background: var(--korika-pink); }
.new-chat:first-letter { font-size: 19px; }
.agent-label, .conversation-label { margin: 26px 8px 8px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
select { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.conversation-label { margin-top: 28px; }
.conversation-list { display: grid; align-content: start; gap: 3px; overflow: auto; }
.conversation-entry { display: flex; align-items: center; min-width: 0; border-radius: 7px; }
.conversation-item { flex: 1; min-width: 0; padding: 10px 11px; overflow: hidden; color: #515c62; background: transparent; border: 0; border-radius: 7px; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-family: inherit; font-size: 12px; cursor: pointer; }
.conversation-rename { padding: 8px; color: var(--muted); background: transparent; border: 0; cursor: pointer; opacity: .45; }
.conversation-entry:hover .conversation-rename { opacity: 1; }
.conversation-item:hover, .conversation-item.active { color: var(--ink); background: #e8edf0; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 13px 8px 0; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.status-dot { width: 7px; height: 7px; background: var(--korika-teal); border-radius: 50%; }
.workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: 74px minmax(0, 1fr); overflow: hidden; }
.topbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 5vw, 70px); background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.topbar h1 { margin: 0; font-size: 16px; letter-spacing: -.025em; }
.account { display: flex; align-items: center; gap: 15px; color: #515e65; font-size: 12px; }
.account button { padding: 7px 10px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 7px; font: inherit; cursor: pointer; }
.account button:hover { color: var(--korika-red-dark); border-color: var(--korika-red); }
.chat-panel { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.messages { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 38px clamp(18px, 8vw, 120px) 28px; scroll-behavior: smooth; }
.welcome { max-width: 540px; margin: 11vh auto 0; text-align: center; }
.welcome-mark { width: 48px; height: 48px; margin: 0 auto 22px; display: grid; place-items: center; color: #fff; background: var(--korika-red); border-radius: 50%; font-size: 22px; }
.welcome .eyebrow { color: var(--korika-violet); }
.welcome h2, .login-card h2 { margin: 7px 0 10px; font-size: 28px; letter-spacing: -.055em; }
.welcome > p:last-child, .login-card > p:not(.eyebrow) { color: #515e65; line-height: 1.65; }
.message { max-width: 800px; margin: 0 auto 20px; display: flex; gap: 12px; align-items: flex-start; }
.message.user { justify-content: flex-end; }
.message-content { max-width: min(78%, 700px); padding: 12px 15px; color: #29363d; background: var(--panel); border: 1px solid var(--line); border-radius: 4px 13px 13px 13px; line-height: 1.65; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.message-content p { margin: 0 0 .8em; white-space: pre-wrap; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 { margin: 1em 0 .45em; line-height: 1.3; }
.message-content h1:first-child, .message-content h2:first-child, .message-content h3:first-child { margin-top: 0; }
.message-content ul, .message-content ol { margin: .55em 0; padding-left: 1.5em; }
.message-content li + li { margin-top: .3em; }
.message-content blockquote { margin: .7em 0; padding: .15em .8em; color: var(--muted); border-left: 3px solid var(--korika-red); }
.message-content pre { margin: .7em 0; padding: 12px; overflow-x: auto; color: #e9eef2; background: #111d25; border-radius: 8px; white-space: pre; }
.message-content pre code { padding: 0; color: inherit; background: transparent; }
.message-content :not(pre) > code { padding: .12em .38em; color: #9b3435; background: #f5eeee; border-radius: 4px; font-size: .92em; }
.message-content a { color: #a52c31; text-decoration: underline; text-underline-offset: 2px; }
.message-content hr { margin: 1em 0; border: 0; border-top: 1px solid var(--line); }
.message.user .message-content { color: var(--ink); background: #eaf3c9; border-color: #d5e69a; border-radius: 13px 4px 13px 13px; }
.message-label { margin: 0 0 5px; color: var(--korika-red-dark); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.composer-wrap { width: min(850px, calc(100% - 36px)); margin: 0 auto; padding: 15px 0 16px; }
.composer { display: flex; align-items: end; gap: 10px; padding: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 8px 30px rgba(7, 16, 23, .05); }
.composer:focus-within { border-color: var(--korika-teal); box-shadow: 0 0 0 3px rgba(29, 158, 154, .16); }
.composer textarea { width: 100%; max-height: 180px; min-height: 40px; padding: 10px 8px; resize: vertical; color: var(--ink); background: transparent; border: 0; outline: 0; font: inherit; font-size: 13px; line-height: 1.5; }
.composer button { width: 39px; height: 39px; flex: 0 0 auto; color: #fff; background: var(--korika-ink); border: 0; border-radius: 9px; font-size: 21px; cursor: pointer; }
.composer button:hover:not(:disabled) { background: var(--korika-red); }
.composer button:disabled { opacity: .4; cursor: default; }
.fine-print { margin: 8px 0 0; color: var(--muted); text-align: center; font-size: 9px; }
.notice { color: #7c4b17; font-size: 12px; line-height: 1.5; }
.notice.error { padding: 10px 12px; color: #79152f; background: #fae8e9; border: 1px solid #eebfc8; border-radius: 8px; }
.composer-wrap > .notice { margin: 0 0 9px; }
.login-panel { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 37px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.login-mark { width: 43px; height: 43px; margin-bottom: 25px; display: grid; place-items: center; color: #fff; background: var(--korika-red); border-radius: 50%; font: 20px ui-monospace, monospace; }
.login-card h2 { font-size: 30px; }
.login-card > p:not(.eyebrow) { margin: 0 0 22px; font-size: 13px; }
#google-login { min-height: 42px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid var(--korika-pink); outline-offset: 3px; }
.composer:focus-within { outline: 2px solid var(--korika-pink); outline-offset: 2px; }

@media (max-width: 700px) {
  .shell { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar { padding: 18px 9px; }
  .brand { justify-content: center; margin: 0 0 25px; }
  .brand > span:last-child, .new-chat span, .agent-label, .sidebar select, .conversation-label, .conversation-list, .sidebar-footer { display: none; }
  .new-chat { justify-content: center; padding: 0; font-size: 20px; }
  .workspace { grid-template-rows: 66px minmax(0, 1fr); }
  .topbar { padding: 0 17px; }
  .messages { padding: 25px 14px; }
  .message-content { max-width: 88%; }
  .welcome { margin-top: 8vh; }
  .welcome h2 { font-size: 24px; }
  .composer-wrap { width: calc(100% - 24px); padding-bottom: 10px; }
  .login-card { padding: 27px 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .message { animation: appear .18s ease-out; }
  @keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
}
