:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: #122027;
  --muted: #61717b;
  --line: #dce5ea;
  --accent: #0f8f8c;
  --accent-2: #d89524;
  --danger: #b33a3a;
  --shadow: 0 18px 50px rgba(18, 32, 39, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: rgba(246, 248, 251, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #102a33;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 156px;
  height: 42px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.nav a:hover {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 220px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

.btn:hover {
  border-color: #bfcbd1;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn.primary {
  background: #102a33;
  color: #fff;
}

.btn.primary:hover {
  background: #183a45;
  border-color: transparent;
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.hero {
  position: relative;
  min-height: min(740px, calc(100vh - 64px));
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #11222a;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(8, 24, 30, 0.93) 0%, rgba(8, 24, 30, 0.73) 40%, rgba(8, 24, 30, 0.18) 78%),
    url("./hero-dashboard.png");
  background-size: cover;
  background-position: center;
}

.hero-inner {
  position: relative;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 44px;
}

.hero-copy {
  width: min(650px, 100%);
  color: #fff;
}

.eyebrow {
  margin: 0 0 18px;
  color: #83c7c4;
  font-weight: 720;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  width: min(560px, 100%);
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.22);
}

.strip-item {
  min-height: 90px;
  padding: 18px;
  background: rgba(9, 27, 34, 0.72);
  color: #fff;
}

.strip-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.strip-value {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 760;
}

.section {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.section-head p {
  max-width: 620px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(18, 32, 39, 0.05);
}

.feature {
  padding: 22px;
}

.feature h3,
.plan h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.feature p,
.plan p {
  color: var(--muted);
}

.plan {
  padding: 24px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0;
}

.plan-price strong {
  font-size: 34px;
}

.plan ul {
  min-height: 118px;
  padding-left: 18px;
  color: var(--muted);
}

.account-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.auth-box {
  padding: 24px;
}

.auth-box h2 {
  margin-bottom: 8px;
}

.account-entry p {
  color: var(--muted);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd7dd;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.form-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-status[data-type="error"] {
  color: var(--danger);
}

.form-status[data-type="success"] {
  color: #0f7a42;
}

.tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-weight: 650;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(18, 32, 39, 0.1);
}

.notice {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.footer {
  padding: 30px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px;
  min-height: calc(100vh - 64px);
}

.sidebar-head {
  display: grid;
  margin-bottom: 16px;
}

.balance-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
}

.compact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.compact-card a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.balance-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.balance-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.compact-card strong {
  font-size: 20px;
}

.sidebar-section {
  margin-top: 18px;
  min-height: 0;
}

.sidebar-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

.session-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.session-item span,
.session-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item span {
  color: inherit;
  font-weight: 650;
}

.session-item small {
  color: var(--muted);
  font-size: 12px;
}

.session-item.active,
.session-item:hover {
  border-color: var(--line);
  background: #f6f8fb;
  color: var(--ink);
}

.sidebar-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-footer .btn {
  flex: 1;
}

.api-key-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 64px);
}

.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.9);
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-stream {
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(246, 248, 251, 0.92), rgba(246, 248, 251, 0.72)),
    #f6f8fb;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 100%;
}

.empty-panel {
  width: min(720px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 34px rgba(18, 32, 39, 0.06);
}

.empty-panel h2 {
  margin-bottom: 10px;
  font-size: 30px;
  line-height: 1.1;
}

.empty-panel p {
  color: var(--muted);
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.prompt-chip {
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfc;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font-weight: 650;
}

.prompt-chip:hover {
  border-color: #bfcbd1;
  background: #fff;
}

.message {
  display: grid;
  grid-template-columns: 42px minmax(0, 720px);
  gap: 12px;
  margin: 0 auto 18px;
  width: min(920px, 100%);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #102a33;
  color: #fff;
  font-weight: 750;
  font-size: 12px;
}

.message.user .avatar {
  background: var(--accent);
}

.bubble {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 22px rgba(18, 32, 39, 0.04);
}

.bubble strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.message.user .bubble {
  background: #f3fbfa;
  border-color: #cae5e3;
}

.image-result {
  display: grid;
  gap: 10px;
}

.image-frame {
  display: grid;
  place-items: end start;
  aspect-ratio: 16 / 10;
  border-radius: 7px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 143, 140, 0.9), rgba(16, 42, 51, 0.92)),
    url("./hero-dashboard.png");
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.image-frame span {
  margin: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  animation: typing-pulse 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer {
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-status {
  width: min(920px, 100%);
  min-height: 18px;
  margin: 0 auto 6px;
  color: var(--muted);
  font-size: 13px;
}

.composer-status[data-type="error"] {
  color: var(--danger);
}

.composer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: min(920px, 100%);
  margin: 0 auto;
}

.composer textarea {
  min-height: 54px;
  max-height: 150px;
  padding: 14px;
  border: 1px solid #cbd7dd;
  border-radius: 8px;
  resize: none;
  line-height: 1.45;
}

.composer textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 143, 140, 0.14);
}

.cost-line {
  width: min(920px, 100%);
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.danger {
  color: var(--danger);
}

@media (max-width: 900px) {
  .topbar {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .hero-inner,
  .hero-strip,
  .section {
    width: min(100% - 32px, 1180px);
  }

  .hero-strip,
  .grid.three,
  .grid.two,
  .account-panel,
  .stat-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .session-list {
    max-height: 220px;
  }

  .chat-toolbar,
  .chat-controls,
  .nav-actions,
  .footer-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .account-pill {
    max-width: none;
  }

  .chat-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .message {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .composer-inner {
    grid-template-columns: 1fr;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }
}
