:root {
  color-scheme: dark;
  --page: #080a10;
  --sidebar: #0c1019;
  --panel: #111722;
  --panel-2: #151d2a;
  --line: rgba(159, 177, 206, .12);
  --text: #f5f6fa;
  --muted: #9da9b9;
  --red: #fb3c49;
  --red-soft: rgba(251, 60, 73, .14);
  --blue: #20a9ff;
  --purple: #bf67ff;
  --orange: #ff9a43;
  --green: #2dd883;
  --gold: #f5c64c;
  font-family: "Segoe UI", "Arial", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 360px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 70% -30%, rgba(52, 33, 40, .25), transparent 50%),
    var(--page);
  color: var(--text);
}

button, select, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid #ff7781;
  outline-offset: 2px;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  display: flex;
  width: 218px;
  flex-direction: column;
  padding: 21px 13px 15px;
  background: linear-gradient(180deg, #0d111a, #0a0e16);
  border-right: 1px solid rgba(165, 182, 206, .09);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 21px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid #ff5964; border-radius: 9px; color: #ff5964; font-size: 19px; text-shadow: 0 0 14px #ff4454; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.brand-copy strong { white-space: nowrap; font-size: 13px; letter-spacing: .025em; }
.brand-copy em, .mobile-brand em { color: var(--red); font-style: normal; }
.brand-copy small { color: #a7afbe; font-size: 7px; letter-spacing: .11em; }

.main-nav { display: grid; gap: 5px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 41px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #ccd2dc;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.nav-item span { width: 20px; color: #aeb9ca; text-align: center; font-size: 15px; font-weight: 700; }
.nav-item:hover { background: rgba(255,255,255,.04); color: white; }
.nav-item.active { border-color: rgba(255, 74, 84, .82); background: linear-gradient(110deg, #971e2a, #46131c); box-shadow: 0 0 16px rgba(248, 47, 60, .28), inset 0 0 12px rgba(255, 110, 117, .08); color: white; }
.nav-item.active span { color: #ffd5d8; }

.sidebar-bottom { margin-top: auto; }
.local-card { display: flex; align-items: flex-start; gap: 9px; margin: 0 2px 10px; padding: 11px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.local-dot, .connection-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(45,216,131,.72); }
.local-card strong, .local-card small { display: block; }
.local-card strong { font-size: 10px; }
.local-card small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.install-sidebar { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 1px solid rgba(50, 163, 255, .27); border-radius: 9px; background: linear-gradient(105deg, rgba(28, 106, 175, .19), rgba(38, 35, 83, .23)); cursor: pointer; text-align: left; }
.install-sidebar > span:first-child { color: #66bdff; font-size: 19px; }
.install-sidebar > span:nth-child(2) { flex: 1; }
.install-sidebar strong, .install-sidebar small { display: block; }
.install-sidebar strong { font-size: 10px; }
.install-sidebar small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.install-sidebar b { color: #78c6ff; font-size: 17px; }
.sidebar-footer { padding-top: 14px; color: #707c8d; text-align: center; font-size: 8px; letter-spacing: .12em; }
.sidebar-footer span { color: var(--red); }

.main-content { width: min(100% - 218px, 1440px); max-width: 1440px; margin-left: 218px; padding: 0 22px 26px; }
.topbar { display: flex; height: 67px; align-items: center; justify-content: space-between; gap: 14px; }
.mobile-brand { display: none; }
.connection-pill { display: inline-flex; min-height: 30px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid rgba(45,216,131,.22); border-radius: 999px; background: rgba(19, 110, 67, .13); color: #b6f3d0; font-size: 10px; white-space: nowrap; }
.connection-pill[data-state="off"] { border-color: rgba(255,93,105,.24); background: rgba(132,29,39,.14); color: #ff9aa1; }
.connection-pill[data-state="off"] .connection-dot { background: #fa5968; box-shadow: 0 0 9px rgba(250,89,104,.45); }
.connection-pill[data-state="checking"] { color: #f3cb73; border-color: rgba(245,198,76,.22); background: rgba(147,102,17,.12); }
.connection-pill[data-state="checking"] .connection-dot { background: var(--gold); box-shadow: 0 0 8px rgba(245,198,76,.55); }
.top-actions { display: flex; align-items: center; gap: 11px; }
.model-picker { display: grid; gap: 2px; min-width: 140px; }
.model-picker span, .mode-select-wrap > span { color: #768396; font-size: 8px; letter-spacing: .12em; }
.model-picker select { max-width: 230px; padding: 2px 18px 2px 0; border: 0; background: transparent; color: #d7dce5; font-size: 10px; }
.model-picker select:disabled { color: #777f8d; }
.top-icon, .avatar-button { display: grid; width: 33px; height: 33px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #131925; cursor: pointer; }
.top-icon { color: #cad2df; font-size: 20px; }
.avatar-button { border-color: rgba(255, 76, 87, .4); background: linear-gradient(140deg, #511a26, #20131e); color: #ffd9dc; font-size: 9px; font-weight: 800; }

.hero {
  position: relative;
  display: flex;
  min-height: clamp(230px, 30vw, 350px);
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid rgba(255, 134, 91, .21);
  border-radius: 13px;
  background: #18111a url("/assets/hero-scene.jpg") center 48% / cover no-repeat;
  box-shadow: 0 18px 42px rgba(0,0,0,.26), inset 0 0 55px rgba(0,0,0,.16);
}
.hero::before { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,7,13,.83), rgba(4,7,13,.46) 45%, rgba(4,7,13,.06) 80%), linear-gradient(0deg, rgba(5,7,12,.64), transparent 55%); content: ""; }
.hero-content { position: relative; z-index: 1; max-width: 620px; padding: 25px 30px 27px; }
.hero-kicker { color: #ff9fa4; font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.spark { color: #ffba52; font-size: 15px; }
.hero h1 { margin: 13px 0 9px; font-size: clamp(26px, 4vw, 43px); line-height: 1.09; letter-spacing: -.04em; text-shadow: 0 3px 20px #000; }
.hero h1 span { color: #fff0ef; font-style: italic; }
.hero p { max-width: 440px; margin: 0 0 17px; color: #d2d3d9; font-size: 12px; }
.hero-button { display: inline-flex; min-height: 35px; align-items: center; gap: 16px; padding: 0 13px; border: 1px solid rgba(255, 99, 108, .8); border-radius: 7px; background: linear-gradient(100deg, #c12839, #6e1d2b); box-shadow: 0 0 15px rgba(247, 47, 62, .24); cursor: pointer; font-size: 10px; font-weight: 700; }
.hero-button span { font-size: 16px; }

.quick-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.action-card { display: flex; min-height: 87px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px 4px; border: 1px solid currentColor; border-radius: 10px; background: linear-gradient(155deg, rgba(255,255,255,.06), rgba(255,255,255,.018)); box-shadow: 0 0 15px color-mix(in srgb, currentColor 18%, transparent); cursor: pointer; transition: transform .18s ease, filter .18s ease; }
.action-card:hover { transform: translateY(-2px); filter: brightness(1.2); }
.action-card .action-icon { font-size: 21px; font-weight: 800; }
.action-card strong { color: #fff; font-size: 10px; }
.action-card small { color: #aeb6c4; font-size: 8px; text-align: center; }
.action-card.red { color: #ff5361; background-color: rgba(105,20,30,.24); }
.action-card.blue { color: #36b8ff; background-color: rgba(16,71,122,.24); }
.action-card.purple { color: #ca70ff; background-color: rgba(81,31,119,.24); }
.action-card.orange { color: #ff9a43; background-color: rgba(118,58,18,.24); }
.action-card.green { color: #31e68b; background-color: rgba(18,97,57,.24); }
.action-card.gold { color: #f5c64c; background-color: rgba(112,82,20,.24); }

.capability-note { display: flex; align-items: center; gap: 8px; margin: 12px 1px 0; color: #8995a5; font-size: 9px; line-height: 1.5; }
.capability-note > span { display: grid; width: 15px; height: 15px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(74,169,255,.38); border-radius: 50%; color: #66bdff; font-size: 9px; }

.chat-section { margin-top: 20px; }
.chat-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.eyebrow { color: #e88386; font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.chat-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.02em; }
.mode-select-wrap { display: grid; gap: 4px; }
.mode-select-wrap select { min-width: 175px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #111722; color: #e6e9ef; font-size: 10px; }

.chat-messages { display: flex; min-height: 83px; max-height: 300px; flex-direction: column; gap: 12px; overflow-y: auto; padding: 12px 14px; border: 1px solid rgba(155,173,201,.09); border-radius: 10px; background: linear-gradient(130deg, rgba(18,24,36,.88), rgba(12,16,24,.92)); }
.welcome-message, .message { display: flex; align-items: flex-start; gap: 10px; }
.welcome-avatar, .assistant-avatar { display: grid; width: 29px; height: 29px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,83,98,.38); border-radius: 9px; background: linear-gradient(145deg, #64212d, #241720); color: #ffdadd; font-size: 9px; font-weight: 800; }
.welcome-copy { min-width: 0; }
.welcome-copy strong { font-size: 10px; }
.welcome-copy strong span { color: var(--green); font-size: 8px; font-weight: 500; }
.welcome-copy p { margin: 5px 0 0; color: #b6becb; font-size: 10px; line-height: 1.55; }
.message.user { justify-content: flex-end; }
.message-bubble { max-width: min(82%, 730px); padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: #171e2b; color: #e9edf4; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.user .message-bubble { border-color: rgba(255,79,91,.24); background: linear-gradient(120deg, rgba(94,24,34,.5), rgba(35,21,30,.7)); }
.message.assistant .message-bubble { flex: 1; }
.message-meta { margin-bottom: 5px; color: #f19aa0; font-size: 8px; font-weight: 700; letter-spacing: .05em; }
.typing { color: #b0bac8; font-size: 10px; }
.typing::after { display: inline-block; width: 14px; overflow: hidden; vertical-align: bottom; animation: dots 1s steps(4, end) infinite; content: "..."; }
@keyframes dots { from { width: 0; } to { width: 14px; } }

.composer { margin-top: 9px; padding: 9px 10px 8px; border: 1px solid rgba(255, 67, 82, .67); border-radius: 11px; background: linear-gradient(120deg, rgba(38,17,26,.98), rgba(18,15,23,.98)); box-shadow: 0 0 18px rgba(248,47,62,.13), inset 0 0 12px rgba(248,47,62,.05); }
.composer textarea { display: block; width: 100%; min-height: 38px; max-height: 115px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; line-height: 1.55; }
.composer textarea::placeholder { color: #858b99; }
.composer textarea:focus-visible { outline: none; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-hint { color: #7d8795; font-size: 8px; }
kbd { padding: 2px 4px; border: 1px solid rgba(168,181,203,.15); border-radius: 4px; background: rgba(255,255,255,.04); color: #aab4c2; font-family: inherit; font-size: 8px; }
.composer-hint > span { padding: 0 3px; color: #566273; }
.send-button { display: inline-flex; min-height: 30px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #ff6972; border-radius: 7px; background: linear-gradient(120deg, #f44550, #a82131); box-shadow: 0 0 12px rgba(248,47,62,.28); cursor: pointer; font-size: 9px; font-weight: 800; }
.send-button:disabled { opacity: .46; cursor: not-allowed; }
.send-button b { font-size: 13px; }

.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.suggestions button { min-height: 27px; padding: 0 9px; border: 1px solid rgba(163,180,205,.14); border-radius: 7px; background: #101620; color: #c4ccd7; cursor: pointer; font-size: 8px; }
.suggestions button:hover { border-color: rgba(255,100,110,.48); color: white; }

.login-dialog { width: min(420px, calc(100vw - 28px)); padding: 0; border: 1px solid rgba(255,96,106,.35); border-radius: 16px; background: #10151f; color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.72), 0 0 40px rgba(208,42,55,.12); }
.login-dialog::backdrop { background: rgba(3,5,9,.76); backdrop-filter: blur(7px); }
.login-card { position: relative; display: flex; flex-direction: column; padding: 31px; }
.dialog-close { position: absolute; top: 12px; right: 13px; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: #9aa5b5; cursor: pointer; font-size: 19px; }
.login-logo { margin-bottom: 21px; font-size: 14px; font-weight: 800; }
.login-logo > span { color: #ff5662; }
.login-logo em { color: var(--red); font-style: normal; }
.login-eyebrow { color: #ed838b; font-size: 8px; font-weight: 700; letter-spacing: .14em; }
.login-card h2 { margin: 8px 0 6px; font-size: 23px; }
.login-card > p { margin: 0 0 20px; color: #9ba6b6; font-size: 10px; line-height: 1.55; }
.login-card label { margin: 11px 0 6px; color: #c6cfdb; font-size: 9px; font-weight: 600; }
.login-card input { height: 39px; padding: 0 11px; border: 1px solid rgba(160,178,204,.18); border-radius: 7px; background: #0b1018; color: var(--text); font-size: 11px; }
.login-card input::placeholder { color: #606b79; }
.login-error { min-height: 18px; padding-top: 7px; color: #ff8f98; font-size: 9px; }
.login-submit { display: flex; min-height: 41px; align-items: center; justify-content: space-between; margin-top: 4px; padding: 0 12px; border: 1px solid rgba(255,97,106,.7); border-radius: 7px; background: linear-gradient(110deg,#b12738,#6c1a28); cursor: pointer; font-size: 10px; font-weight: 700; }
.login-submit:disabled { opacity: .6; cursor: wait; }
.login-foot { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: #8c98a8; font-size: 8px; }
.login-foot .local-dot { width: 6px; height: 6px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(400px, calc(100vw - 40px)); padding: 11px 14px; transform: translateY(15px); border: 1px solid rgba(255,99,110,.35); border-radius: 9px; background: #19141b; color: #f6e5e6; box-shadow: 0 12px 38px rgba(0,0,0,.38); opacity: 0; pointer-events: none; font-size: 10px; line-height: 1.5; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }

@media (min-width: 1500px) {
  .main-content { margin-right: auto; }
  .hero { min-height: 350px; }
  .action-card { min-height: 94px; }
}

@media (max-width: 1020px) {
  .sidebar { width: 190px; }
  .main-content { width: calc(100% - 190px); margin-left: 190px; padding-right: 15px; padding-left: 15px; }
  .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-card { min-height: 73px; }
}

@media (max-width: 720px) {
  body { min-width: 360px; }
  .sidebar { position: static; width: 55px; min-height: 100vh; align-items: center; padding: 13px 5px; }
  .brand { justify-content: center; padding: 2px 0 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy { display: none; }
  .nav-item:not(.active)::after, .nav-item { font-size: 0; }
  .main-nav { width: 100%; gap: 5px; }
  .nav-item { width: 43px; height: 42px; min-height: 42px; justify-content: center; padding: 0; }
  .nav-item span { width: auto; font-size: 16px; }
  .nav-item.active { font-size: 0; }
  .sidebar-bottom { display: grid; justify-items: center; width: 100%; }
  .local-card, .sidebar-footer { display: none; }
  .install-sidebar { width: 42px; height: 40px; justify-content: center; padding: 0; }
  .install-sidebar > span:nth-child(2), .install-sidebar b { display: none; }
  .install-sidebar > span:first-child { font-size: 16px; }
  .main-content { width: calc(100% - 55px); margin-left: 0; padding: 0 10px 16px; }
  .topbar { height: 57px; gap: 6px; }
  .mobile-brand { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 10px; }
  .mobile-brand .brand-mark { width: 23px; height: 23px; border-radius: 7px; font-size: 14px; }
  .connection-pill { min-height: 25px; gap: 5px; padding: 0 7px; font-size: 8px; }
  .connection-dot { width: 6px; height: 6px; }
  .model-picker { display: none; }
  .top-actions { gap: 6px; }
  .top-icon, .avatar-button { width: 28px; height: 28px; }
  .hero { min-height: 236px; background-position: 54% center; }
  .hero-content { padding: 17px 14px 18px; }
  .hero-kicker { max-width: 290px; font-size: 7px; }
  .hero h1 { font-size: clamp(22px, 6vw, 31px); }
  .hero p { max-width: 280px; font-size: 10px; }
  .quick-actions { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin-top: 8px; }
  .action-card { min-height: 69px; gap: 3px; border-radius: 8px; }
  .action-card .action-icon { font-size: 18px; }
  .action-card strong { font-size: 8px; }
  .action-card small { font-size: 7px; }
  .capability-note { align-items: flex-start; margin-top: 9px; font-size: 8px; }
  .chat-section { margin-top: 14px; }
  .chat-heading { align-items: flex-start; }
  .chat-heading h2 { font-size: 14px; }
  .mode-select-wrap > span { font-size: 7px; }
  .mode-select-wrap select { min-width: 126px; max-width: 145px; padding: 6px 5px; font-size: 8px; }
  .chat-messages { min-height: 79px; padding: 9px; }
  .message-bubble { max-width: 90%; }
  .composer { padding: 8px; }
  .composer-hint { font-size: 7px; }
  .suggestions { gap: 5px; }
  .suggestions button { min-height: 25px; padding: 0 6px; font-size: 7px; }
  .login-card { padding: 26px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
