/* Kora AI — calm, chat-first workspace */
:root {
  --canvas: #0f1318;
  --surface: #151a20;
  --surface-raised: #1a2027;
  --surface-soft: #20272f;
  --sidebar: #12171d;
  --line: rgba(222, 233, 239, .09);
  --line-strong: rgba(222, 233, 239, .16);
  --text: #e7ecec;
  --muted: #9aa5a8;
  --muted-2: #6f7b80;
  --mint: #9fe7c5;
  --mint-strong: #72d5aa;
  --sky: #9ed9f2;
  --violet: #c6b3f7;
  --amber: #f1ca8b;
  --danger: #f3a5a5;
  --shadow: 0 28px 70px rgba(0, 0, 0, .22);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.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; }

.app-shell { min-height: 100vh; display: flex; background: var(--canvas); }
.sidebar { width: 264px; flex: 0 0 264px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-inner { height: 100vh; height: 100svh; position: sticky; top: 0; display: flex; flex-direction: column; padding: max(18px, env(safe-area-inset-top)) 14px max(15px, env(safe-area-inset-bottom)); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 23px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark, .welcome-mark { display: grid; place-items: center; background: linear-gradient(145deg, var(--mint), #87cbe3); color: #10221c; font-weight: 800; letter-spacing: -.08em; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 1.05rem; box-shadow: 0 8px 24px rgba(159, 231, 197, .11); }
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: .99rem; letter-spacing: -.02em; }
.brand-copy span { color: var(--muted-2); font-size: .7rem; margin-top: 3px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer; transition: background .18s, color .18s, border-color .18s; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { color: var(--text); background: var(--surface-raised); border-color: var(--line); }
.mobile-close, .menu-toggle { display: none; }
.new-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; text-align: left; transition: background .18s, border-color .18s, transform .18s; }
.new-chat svg { width: 17px; height: 17px; color: var(--mint); }
.new-chat span { font-weight: 600; font-size: .88rem; }
.new-chat kbd { margin-left: auto; color: var(--muted-2); font-size: .66rem; font-family: var(--mono); }
.new-chat:hover { background: var(--surface-soft); border-color: var(--line-strong); transform: translateY(-1px); }
.sidebar-nav { display: grid; gap: 4px; margin: 26px 0 28px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; color: var(--muted); border-radius: 9px; font-size: .86rem; transition: color .18s, background .18s; }
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover, .nav-item.active { color: var(--text); background: rgba(255, 255, 255, .055); }
.nav-item.active svg { color: var(--mint); }
.sidebar-section-label { padding: 0 11px 9px; color: var(--muted-2); font-size: .67rem; letter-spacing: .13em; text-transform: uppercase; }
.session-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 10px; text-align: left; cursor: pointer; transition: background .18s, border-color .18s; }
.session-card:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.session-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); background: var(--surface-raised); }
.session-icon svg { width: 15px; height: 15px; }
.session-copy { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.session-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 550; }
.session-copy small { margin-top: 3px; color: var(--muted-2); font-size: .7rem; }
.session-dot, .status-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--mint); box-shadow: 0 0 0 3px rgba(159,231,197,.08); }
.sidebar-spacer { flex: 1; min-height: 24px; }
.privacy-note { display: flex; gap: 9px; padding: 12px 10px; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.privacy-icon { flex: 0 0 auto; color: var(--mint); }
.privacy-icon svg { width: 17px; height: 17px; }
.privacy-note strong { display: block; color: var(--text); font-size: .76rem; font-weight: 600; }
.privacy-note p { margin: 3px 0 0; color: var(--muted-2); font-size: .7rem; line-height: 1.45; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 0; color: var(--muted-2); font-size: .68rem; }
.status-dot { background: var(--muted-2); }
.status-dot:not(.offline) { background: var(--mint); }
.sidebar-scrim { display: none; }

.workspace { min-width: 0; flex: 1; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 0 max(30px, env(safe-area-inset-right)) 0 max(30px, env(safe-area-inset-left)); background: rgba(15,19,24,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.topbar-left, .topbar-right, .breadcrumb { display: flex; align-items: center; }
.topbar-left { gap: 10px; }
.topbar-right { gap: 12px; }
.breadcrumb { gap: 9px; color: var(--muted-2); font-size: .8rem; }
.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb strong { color: var(--text); font-weight: 550; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 99px; font-size: .71rem; }
.status-chip i { width: 6px; height: 6px; border-radius: 99px; background: var(--muted-2); }
.status-chip.ready { color: var(--mint); border-color: rgba(159,231,197,.16); }
.status-chip.ready i { background: var(--mint); box-shadow: 0 0 9px rgba(159,231,197,.75); }
.status-chip.offline { color: var(--amber); }
.status-chip.offline i { background: var(--amber); }
.status-chip.checking i { background: var(--sky); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.main-content { min-height: calc(100vh - 62px); }
.chat-surface { min-height: calc(100vh - 62px); min-height: calc(100svh - 62px); padding: 66px 28px 36px; }
.chat-column { display: flex; flex-direction: column; min-height: calc(100vh - 164px); min-height: calc(100svh - 164px); max-width: 790px; margin: 0 auto; }
.welcome { margin: auto 0; padding: 6px 0 46px; animation: rise .35s ease both; }
.welcome.hidden { display: none; }
.welcome-mark { width: 49px; height: 49px; border-radius: 15px; font-size: 1.65rem; margin-bottom: 20px; box-shadow: 0 14px 30px rgba(159,231,197,.12); }
.eyebrow { margin: 0 0 9px; color: var(--mint); font-size: .67rem; letter-spacing: .18em; font-weight: 700; }
.welcome h1 { margin: 0; color: var(--text); font-size: clamp(2.05rem, 4vw, 3rem); letter-spacing: -.055em; line-height: 1.06; font-weight: 620; }
.welcome-copy { max-width: 44ch; margin: 13px 0 30px; color: var(--muted); font-size: .98rem; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-width: 680px; }
.suggestion { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 13px 13px; color: var(--text); background: rgba(255,255,255,.022); border: 1px solid var(--line); border-radius: 11px; text-align: left; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.suggestion:hover { background: rgba(255,255,255,.055); border-color: var(--line-strong); transform: translateY(-1px); }
.suggestion-icon { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 9px; }
.suggestion-icon svg { width: 16px; height: 16px; }
.suggestion-icon.mint { color: var(--mint); background: rgba(159,231,197,.1); }
.suggestion-icon.sky { color: var(--sky); background: rgba(158,217,242,.1); }
.suggestion-icon.violet { color: var(--violet); background: rgba(198,179,247,.1); }
.suggestion-icon.amber { color: var(--amber); background: rgba(241,202,139,.1); }
.suggestion > span:nth-child(2) { display: grid; min-width: 0; }
.suggestion strong { font-size: .78rem; font-weight: 600; }
.suggestion small { margin-top: 2px; color: var(--muted-2); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-arrow { width: 14px; height: 14px; flex: 0 0 14px; margin-left: auto; color: var(--muted-2); }
.log { display: flex; flex-direction: column; gap: 27px; padding: 6px 0 28px; }
.log:not(.has-messages) { display: none; }
.message { display: flex; gap: 12px; align-items: flex-start; max-width: 100%; animation: rise .22s ease both; }
.assistant-message { align-self: flex-start; margin-right: auto; }
.user-message { align-self: flex-end; width: fit-content; margin-left: auto; flex-direction: row-reverse; max-width: min(88%, 700px); }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.message-avatar { display: grid; place-items: center; flex: 0 0 29px; width: 29px; height: 29px; border-radius: 9px; font-size: .68rem; font-weight: 700; letter-spacing: -.04em; }
.assistant-avatar { color: #10221c; background: linear-gradient(145deg, var(--mint), #87cbe3); }
.user-avatar { color: var(--muted); background: var(--surface-soft); font-size: .62rem; font-weight: 600; }
.message-main { min-width: 0; flex: 1; padding-right: 2px; }
.message-meta { display: flex; align-items: baseline; gap: 8px; min-height: 20px; margin-bottom: 5px; }
.message-meta strong { font-size: .77rem; font-weight: 650; }
.message-meta span { color: var(--muted-2); font: .63rem var(--mono); }
.message-content { color: #d9e0e0; font-size: .94rem; line-height: 1.68; overflow-wrap: anywhere; }
.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: var(--text); font-weight: 650; }
.user-message .message-main { flex: 0 1 auto; max-width: 100%; }
.user-message .message-meta { justify-content: flex-end; }
.user-message .message-content { padding: 10px 14px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: 14px 4px 14px 14px; }
.user-message .message-action { align-self: flex-end; }
.message-content ul { margin: 7px 0 12px; padding-left: 20px; }
.message-content li { margin: 4px 0; }
.message-content code { padding: 2px 5px; color: var(--mint); background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 5px; font: .84em var(--mono); }
.message-content pre { margin: 12px 0; padding: 14px; overflow: auto; color: #dce8e6; background: #0b0f13; border: 1px solid var(--line); border-radius: 10px; font: .8rem/1.6 var(--mono); }
.message-content pre code { padding: 0; border: 0; background: none; color: inherit; }
.user-message .message-content { color: var(--text); }
.error-content { padding: 10px 13px; color: var(--danger); background: rgba(243,165,165,.06); border: 1px solid rgba(243,165,165,.18); border-radius: 10px; }
.retry-message { display: inline-flex; align-items: center; margin-top: 8px; padding: 5px 8px; color: var(--mint); background: transparent; border: 1px solid rgba(159,231,197,.2); border-radius: 7px; font-size: .7rem; cursor: pointer; }
.retry-message:hover { background: rgba(159,231,197,.08); border-color: rgba(159,231,197,.4); }
.message-action { display: inline-grid; place-items: center; width: 27px; height: 27px; margin-top: 8px; padding: 0; color: var(--muted-2); background: transparent; border: 1px solid transparent; border-radius: 7px; cursor: pointer; opacity: 0; transition: opacity .18s, color .18s, background .18s; }
.message:hover .message-action, .message-action:focus-visible { opacity: 1; }
.message-action svg { width: 14px; height: 14px; }
.message-action:hover { color: var(--text); background: var(--surface-raised); border-color: var(--line); }
.message-action.copied { color: var(--mint); opacity: 1; }
.thinking-bubble { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 10px; }
.thinking-bubble span { width: 4px; height: 4px; border-radius: 50%; background: var(--mint); animation: bounce .85s infinite; }
.thinking-bubble span:nth-child(2) { animation-delay: .12s; }
.thinking-bubble span:nth-child(3) { animation-delay: .24s; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .4; } 35% { transform: translateY(-4px); opacity: 1; } }

.composer-area { margin-top: auto; padding-top: 8px; }
.composer { padding: 11px 11px 9px 15px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 18px 45px rgba(0,0,0,.16); transition: border-color .18s, box-shadow .18s; }
.composer:focus-within { border-color: rgba(159,231,197,.42); box-shadow: 0 0 0 3px rgba(159,231,197,.07), 0 18px 45px rgba(0,0,0,.2); }
textarea { display: block; width: 100%; max-height: 180px; min-height: 25px; padding: 0 0 7px; resize: none; overflow-y: auto; color: var(--text); background: transparent; border: 0; outline: 0; font-size: .93rem; line-height: 1.5; }
textarea::placeholder { color: var(--muted-2); }
textarea:disabled { opacity: .65; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tool-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; font-size: .7rem; cursor: pointer; }
.tool-button:hover { color: var(--text); background: var(--surface-raised); }
.tool-button svg { width: 13px; height: 13px; }
.model-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.composer-hint { color: var(--muted-2); font-size: .68rem; }
.send-button { display: grid; place-items: center; width: 34px; height: 32px; flex: 0 0 34px; color: #10221c; background: var(--mint); border: 0; border-radius: 9px; cursor: pointer; transition: background .18s, transform .18s, opacity .18s; }
.send-button svg { width: 17px; height: 17px; stroke-width: 1.8; }
.send-button:hover { background: #b7f1d5; transform: translateY(-1px); }
.send-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; padding: 8px 2px 0; color: var(--muted-2); font-size: .66rem; }
.stop-button { padding: 3px 7px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 6px; font-size: .66rem; cursor: pointer; }
.stop-button:hover { color: var(--text); background: var(--surface-raised); }

.about-section { padding: 84px max(28px, calc((100vw - 790px) / 2)) 92px; border-top: 1px solid var(--line); background: rgba(255,255,255,.012); }
.about-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin: 0 auto 28px; max-width: 1040px; }
.about-heading h2 { margin: 0; color: var(--text); font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.045em; line-height: 1.1; font-weight: 620; }
.about-heading > p { max-width: 42ch; margin: 0; color: var(--muted); font-size: .86rem; }
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; max-width: 1040px; margin: 0 auto; }
.about-card { position: relative; min-height: 190px; padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.about-card.featured { background: linear-gradient(145deg, rgba(159,231,197,.07), rgba(255,255,255,.018)); border-color: rgba(159,231,197,.15); }
.about-number { display: block; margin-bottom: 34px; color: var(--muted-2); font: .68rem var(--mono); }
.about-card h3 { margin: 0 0 8px; font-size: .91rem; font-weight: 650; }
.about-card p { min-height: 70px; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.about-card code { color: var(--mint); font: .9em var(--mono); }
.about-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 11px; color: var(--mint); font-size: .68rem; }
.about-tag i { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); }
.text-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--mint); font-size: .72rem; }
.text-link span { transition: transform .18s; }
.text-link:hover span { transform: translate(2px, -2px); }

@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(284px, 86vw); transform: translateX(-102%); box-shadow: 20px 0 60px rgba(0,0,0,.35); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 15; display: block; padding: 0; border: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .sidebar-scrim.visible { opacity: 1; pointer-events: auto; }
  .mobile-close, .menu-toggle { display: inline-grid; }
  .menu-toggle { margin-left: -8px; }
  .topbar { padding: 0 max(19px, env(safe-area-inset-right)) 0 max(19px, env(safe-area-inset-left)); }
  .chat-surface { padding: 50px 24px 30px; }
  .about-section { padding-left: 24px; padding-right: 24px; }
  .about-heading { display: block; }
  .about-heading > p { margin-top: 16px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-card { min-height: auto; }
  .about-card p { min-height: 0; }
}

@media (max-width: 580px) {
  .topbar { min-height: 56px; }
  .topbar-right .icon-button { display: none; }
  .status-chip { padding: 5px 8px; font-size: .65rem; }
  .main-content { min-height: calc(100vh - 56px); }
  .chat-surface { min-height: calc(100vh - 56px); min-height: calc(100svh - 56px); padding: 34px 16px max(24px, env(safe-area-inset-bottom)); }
  .chat-column { min-height: calc(100vh - 114px); min-height: calc(100svh - 114px); }
  .welcome { padding-bottom: 28px; }
  .welcome h1 { font-size: 2rem; }
  .welcome-copy { margin-bottom: 23px; font-size: .9rem; }
  .suggestions { grid-template-columns: 1fr; gap: 7px; }
  .suggestion { padding: 11px; }
  .composer { padding-left: 12px; }
  .composer-hint { display: none; }
  .composer-tools { gap: 4px; }
  .message { gap: 9px; }
  .user-message { max-width: 92%; }
  .message-avatar { flex-basis: 27px; width: 27px; height: 27px; }
  .message-content { font-size: .9rem; }
  .about-section { padding: 61px 16px 70px; }
}

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