:root {
  --bg: #071019;
  --bg-2: #0b1621;
  --panel: rgba(10, 20, 31, 0.92);
  --panel-strong: rgba(11, 24, 38, 0.96);
  --panel-soft: rgba(16, 28, 41, 0.88);
  --line: rgba(187, 211, 229, 0.08);
  --line-strong: rgba(108, 226, 210, 0.18);
  --text: #eff6fb;
  --muted: #98aec0;
  --accent: #6ce2d2;
  --accent-2: #4aa8ff;
  --warning: #ffb95c;
  --danger: #ff6d74;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; height: 100%; overflow-x: hidden; }
body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(108, 226, 210, 0.1), transparent 24%),
    radial-gradient(circle at 100% 0%, rgba(74, 168, 255, 0.1), transparent 18%),
    linear-gradient(180deg, #071019 0%, #0a131d 46%, #0c1620 100%);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.landing-body, .app-body { padding: 14px; }

.landing-shell {
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.78fr);
  gap: 14px;
}

.hero-panel,
.auth-panel,
.sidebar,
.workspace-header,
.panel-card,
.metric-card {
  background: linear-gradient(180deg, rgba(10, 21, 33, 0.96), rgba(10, 20, 31, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-panel,
.auth-panel { padding: 24px; }

.hero-panel {
  position: relative;
  overflow: hidden;
}

.hero-topline {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.98fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 0;
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -12%;
  bottom: -18%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(89, 224, 195, 0.18), transparent 68%);
  pointer-events: none;
}

.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-visual-frame {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    radial-gradient(circle at 20% 10%, rgba(108, 226, 210, 0.16), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(255, 86, 205, 0.16), transparent 38%),
    rgba(7, 18, 28, 0.92);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.22);
  aspect-ratio: 0.88 / 1;
}

.hero-visual-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 12, 18, 0.02), rgba(5, 12, 18, 0.1)),
    radial-gradient(circle at 75% 12%, rgba(117, 96, 255, 0.08), transparent 26%),
    radial-gradient(circle at 10% 80%, rgba(255, 89, 201, 0.05), transparent 24%);
  pointer-events: none;
}

.hero-visual-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-visual-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 10, 17, 0.01), rgba(3, 10, 17, 0.18)),
    radial-gradient(circle at 12% 82%, rgba(255, 82, 197, 0.08), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(74, 168, 255, 0.1), transparent 24%);
}

.hero-visual-fallback {
  display: grid;
  place-items: end start;
  padding: 24px;
}

.hero-fallback-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 6px;
}

.hero-fallback-copy strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 34px;
  line-height: 0.95;
}

.hero-fallback-copy span {
  color: var(--muted);
  font-size: 14px;
}

.hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.9;
}

.hero-orb-a {
  width: 120px;
  height: 120px;
  right: 18px;
  top: 18px;
  background: rgba(81, 172, 255, 0.34);
}

.hero-orb-b {
  width: 150px;
  height: 150px;
  left: 18px;
  top: 72px;
  background: rgba(255, 83, 204, 0.22);
}

.hero-orb-c {
  width: 180px;
  height: 180px;
  right: 42px;
  bottom: 28px;
  background: rgba(108, 226, 210, 0.18);
}

.hero-badge,
.auth-topline,
.topbar-caption,
.profile-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

h1, h2 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 56px);
  line-height: 0.95;
  margin-top: 10px;
  max-width: 9ch;
}

h2 {
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.12;
}

.hero-copy,
.auth-copy,
.auth-footnote,
.feature-card p,
.panel-head span,
.brand-subtitle,
.profile-level,
.status-pill.muted,
.stack-item small,
.user-meta,
.upload-box small,
.text-result,
.callout-copy {
  color: var(--muted);
}

.hero-copy,
.auth-copy {
  font-size: 16px;
  line-height: 1.56;
  max-width: 45ch;
}

.hero-notes {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  max-width: 44ch;
}

.hero-note {
  display: grid;
  gap: 2px;
  padding-left: 16px;
  position: relative;
}

.hero-note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 6px rgba(108, 226, 210, 0.07);
}

.hero-note strong {
  font-size: 14px;
}

.hero-note span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hero-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 16px;
}

.hero-strip span,
.status-pill,
.mini-btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.hero-strip span {
  padding: 8px 12px;
  color: #c8edf8;
  font-size: 13px;
}

.auth-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.auth-checklist {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.auth-check {
  position: relative;
  padding: 11px 12px 11px 36px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02);
  color: #d8e8f3;
  font-size: 13px;
  line-height: 1.45;
}

.auth-check::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(108, 226, 210, 0.08);
}

.auth-status,
.auth-warning,
.dev-login-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.auth-status {
  background: rgba(89, 224, 195, 0.08);
  border-color: var(--line-strong);
}

.auth-warning {
  background: rgba(255, 109, 116, 0.08);
  border-color: rgba(255, 109, 116, 0.18);
}

.auth-warning.compact {
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}

.login-widget-wrap {
  min-height: 58px;
  display: flex;
  align-items: center;
}

.dev-login-box {
  background: rgba(255, 255, 255, 0.02);
}

.dev-login-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  margin-bottom: 8px;
}

.dev-login-box p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.dev-login-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.dev-login-row input,
.input-select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.input-select {
  min-height: 48px;
}

.dev-login-row input:focus,
.input-select:focus,
textarea:focus {
  border-color: rgba(89, 224, 195, 0.42);
  box-shadow: 0 0 0 4px rgba(89, 224, 195, 0.1);
}

.app-shell {
  max-width: 1460px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 28px);
  min-height: calc(100vh - 28px);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 22px;
  align-self: start;
  min-height: calc(100vh - 44px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-top { display: grid; gap: 16px; }

.brand-block {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  color: #03253c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(183, 221, 245, 0.04);
  background: rgba(255,255,255,0.012);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 11px;
  display: grid;
  gap: 4px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  box-shadow: none;
}

.nav-item span {
  font-size: 15px;
  font-weight: 700;
}

.nav-item small {
  font-size: 11px;
  color: var(--muted);
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(180deg, rgba(108, 226, 210, 0.11), rgba(74, 168, 255, 0.07));
  border-color: rgba(89, 224, 195, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.nav-item.admin-only span {
  color: var(--warning);
}

.profile-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
}

.profile-card strong {
  display: block;
  font-size: 16px;
  margin: 6px 0 4px;
}

.ghost-btn,
.primary-btn,
.mobile-menu-btn,
.mobile-tab,
.quick-card,
.mini-btn {
  border: 0;
}

.ghost-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(89, 224, 195, 0.24);
  background: rgba(89, 224, 195, 0.06);
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: calc(100vh - 28px);
  overflow: hidden;
}

.workspace-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 20, 31, 0.74);
}

.workspace-header h1 {
  margin-top: 4px;
  max-width: none;
  font-size: clamp(17px, 2vw, 24px);
}

.workspace-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 6px 11px;
  font-size: 12px;
}

.mobile-brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.mobile-menu-btn {
  display: none;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

.mobile-nav {
  display: none;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.mobile-tab {
  white-space: nowrap;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mobile-tab.active {
  background: rgba(89, 224, 195, 0.14);
  border-color: rgba(89, 224, 195, 0.24);
}

.mobile-tab:hover {
  transform: translateY(-1px);
}

.view-panel { display: none; }
.view-panel.active {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.metric-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  padding: 10px;
}

.metric-card.soft {
  background: linear-gradient(180deg, rgba(12, 31, 47, 0.96), rgba(9, 24, 39, 0.9));
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
}

.overview-grid,
.tool-layout,
.admin-grid-top,
.admin-grid-bottom {
  display: grid;
  gap: 14px;
}

.overview-grid { grid-template-columns: 0.95fr 1.05fr; }
.tool-layout { grid-template-columns: 0.9fr 1.1fr; }
.admin-grid-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid-bottom { grid-template-columns: 1.15fr 0.85fr; }

.panel-card {
  padding: 10px;
  min-width: 0;
}

.panel-head {
  margin-bottom: 10px;
}

.panel-head.compact h2 {
  font-size: clamp(16px, 1.7vw, 20px);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  text-align: left;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 40, 60, 0.95), rgba(11, 28, 43, 0.82));
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: none;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: rgba(89, 224, 195, 0.22);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.quick-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.quick-card small { color: var(--muted); }

.toolbar,
.stack-form,
.upload-form,
.composer {
  display: grid;
  gap: 10px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.primary-btn {
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03233a;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  box-shadow: 0 18px 32px rgba(24, 130, 214, 0.18);
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
  box-shadow: 0 22px 38px rgba(24, 130, 214, 0.24);
}

.chat-feed,
.stack-list,
.admin-users,
.chart-box,
.image-result,
.text-result,
.chat-canvas,
.chat-history-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.13);
}

.chat-feed {
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  overscroll-behavior: contain;
}

.chat-composer {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  padding-top: 12px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(7, 16, 25, 0.08), rgba(7, 16, 25, 0.86) 16%, rgba(7, 16, 25, 0.98));
  backdrop-filter: blur(12px);
}

#chat-submit-btn {
  width: 148px;
  min-width: 148px;
  max-width: 148px;
  min-height: 52px;
  align-self: end;
  justify-self: end;
  padding: 10px 16px;
  border-radius: 18px;
}

.chat-composer textarea {
  min-height: 52px;
  max-height: 200px;
  padding: 14px 18px;
  border-radius: 18px;
  resize: none;
}

.chat-row {
  display: flex;
  width: 100%;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-row.bot {
  justify-content: flex-start;
}

.chat-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  max-width: min(68%, 680px);
  min-width: 0;
  padding: 12px 14px 10px;
  border-radius: 20px 20px 20px 12px;
  line-height: 1.52;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
}

.chat-bubble strong,
.chat-bubble-content {
  display: block;
}

.chat-bubble strong {
  margin-bottom: 6px;
  font-size: 12px;
  color: #d7e8f4;
}

.chat-bubble.user {
  border-radius: 20px 20px 12px 20px;
  background: linear-gradient(180deg, rgba(28, 71, 101, 0.62), rgba(22, 52, 76, 0.74));
  border-color: rgba(90, 170, 230, 0.14);
}

.chat-bubble.bot {
  background: linear-gradient(180deg, rgba(22, 49, 53, 0.84), rgba(16, 38, 42, 0.78));
  border-color: rgba(108, 226, 210, 0.12);
}

.chat-bubble.pending {
  border: 1px solid rgba(108, 226, 210, 0.14);
  background: linear-gradient(180deg, rgba(16, 46, 50, 0.76), rgba(13, 36, 39, 0.72));
}

.copy-answer-btn {
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #dff7f4;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.copy-answer-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108, 226, 210, 0.24);
  background: rgba(108, 226, 210, 0.1);
}

.typing-label {
  display: inline-block;
  margin-right: 10px;
  color: #d8eef0;
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  vertical-align: middle;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(108, 226, 210, 0.85);
  animation: liraTyping 1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.28s;
}

.image-result,
.text-result {
  min-height: 260px;
  padding: 14px;
}

.image-result.empty,
.text-result.empty {
  display: grid;
  place-items: center;
}

.image-result img {
  width: 100%;
  display: block;
  border-radius: 18px;
}

.upload-box {
  min-height: 140px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(183, 221, 245, 0.26);
  background: rgba(255,255,255,0.02);
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-box input { display: none; }

.upload-box:hover {
  border-color: rgba(89, 224, 195, 0.34);
  background: rgba(89, 224, 195, 0.04);
}

.stack-list,
.admin-users {
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.stack-list { min-height: 320px; max-height: 620px; }
.admin-users { min-height: 460px; max-height: 760px; }

.stack-item,
.user-row {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.stack-item.compact {
  padding: 12px 14px;
}

.stack-item.subtle {
  background: rgba(255,255,255,0.02);
  border-style: dashed;
}

.stack-item strong,
.user-row strong {
  display: block;
  margin-bottom: 6px;
}

.user-row {
  display: grid;
  gap: 12px;
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-btn {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mini-btn:hover {
  transform: translateY(-1px);
  background: rgba(89, 224, 195, 0.08);
  border-color: rgba(89, 224, 195, 0.2);
}

.mini-btn.danger {
  color: var(--danger);
}

.chart-box {
  min-height: 210px;
  padding: 14px;
  display: grid;
  align-items: end;
}

.chart {
  display: flex;
  gap: 10px;
  align-items: end;
  min-height: 180px;
}

.bar-group {
  flex: 1;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.bar {
  width: 100%;
  max-width: 58px;
  border-radius: 18px 18px 6px 6px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.bar.secondary {
  background: linear-gradient(180deg, var(--warning), var(--danger));
}

.bar-label,
.bar-value {
  font-size: 12px;
  color: var(--muted);
}

.audit-list { max-height: 860px; }

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 10px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.chat-main-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.chat-main-panel.is-empty-view {
  grid-template-rows: auto auto auto;
  align-content: start;
}

.chat-toolbar {
  display: grid;
  grid-template-columns: 132px 104px minmax(0, 1fr) 196px;
  gap: 8px;
  margin-bottom: 0;
}

.history-toggle-btn {
  display: none;
}

.history-toggle-btn.active {
  border-color: rgba(89, 224, 195, 0.26);
  background: rgba(89, 224, 195, 0.1);
}

.chat-status {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 13px;
}

.chat-status.error {
  color: #ffd6d8;
  border-color: rgba(255, 109, 116, 0.24);
  background: rgba(255, 109, 116, 0.08);
}

.chat-status.success {
  color: #d8fff1;
  border-color: rgba(89, 224, 195, 0.24);
  background: rgba(89, 224, 195, 0.08);
}

.chat-status.hidden {
  display: none;
}

.soft-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.soft-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(89, 224, 195, 0.24);
  background: rgba(89, 224, 195, 0.08);
}

.soft-btn.is-loading,
.primary-btn.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.mode-select {
  min-width: 0;
}

.chat-canvas {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-canvas.is-empty {
  grid-template-rows: auto auto;
  padding: 12px;
  align-content: start;
  height: auto;
}

.chat-canvas.is-empty .chat-feed {
  width: 100%;
  height: auto;
  min-height: 180px;
  max-height: 180px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top, rgba(108, 226, 210, 0.05), transparent 32%),
    rgba(0, 0, 0, 0.13);
  padding: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-canvas.is-empty .chat-composer {
  width: 100%;
  position: sticky;
  background: linear-gradient(180deg, rgba(7, 16, 25, 0.08), rgba(7, 16, 25, 0.86) 16%, rgba(7, 16, 25, 0.98));
  border: 0;
  border-radius: 0;
  padding: 12px 0 0;
  margin-top: 0;
  box-shadow: none;
}

.chat-canvas.is-empty .chat-composer textarea {
  min-height: 56px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
}

.chat-canvas.is-empty .chat-composer .primary-btn {
  min-height: 56px;
  border-radius: 20px;
}

.chat-empty-state {
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
  color: var(--muted);
  width: 100%;
}

.chat-empty-state strong {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  line-height: 1.05;
}

.chat-empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.chat-empty-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  color: #03253c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 30px rgba(24, 130, 214, 0.18);
}

.chat-history-panel {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-history-head strong {
  display: block;
  font-size: 15px;
  font-family: "Space Grotesk", sans-serif;
}

.chat-history-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.chat-sessions {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: auto;
  align-content: start;
}

.session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: start;
}

.session-group {
  display: grid;
  gap: 8px;
}

.session-group-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.session-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(183, 221, 245, 0.08);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 4px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.session-item:hover,
.session-item.active {
  transform: translateY(-1px);
  border-color: rgba(89, 224, 195, 0.18);
  background: rgba(89, 224, 195, 0.07);
}

.session-item strong {
  display: block;
  font-size: 12px;
}

.session-item small {
  color: var(--muted);
  line-height: 1.3;
  font-size: 11px;
}

.session-delete-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: rgba(255,255,255,0.62);
  font-size: 22px;
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.session-delete-btn:hover {
  transform: translateY(-1px);
  color: #ffd4d8;
  border-color: rgba(255, 109, 116, 0.2);
  background: rgba(255, 109, 116, 0.08);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 120;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 19, 29, 0.96);
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.toast.success {
  border-color: rgba(108, 226, 210, 0.22);
}

.toast.error {
  border-color: rgba(255, 109, 116, 0.22);
}

.toast.info {
  border-color: rgba(74, 168, 255, 0.18);
}

@keyframes liraTyping {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-2px); opacity: 1; }
}

@media (max-width: 1500px) {
  .history-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-history-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 82vw);
    z-index: 30;
    background: linear-gradient(180deg, rgba(10, 21, 33, 0.98), rgba(10, 20, 31, 0.96));
    box-shadow: -22px 0 36px rgba(0, 0, 0, 0.28);
    transform: translateX(calc(100% + 14px));
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .chat-layout.history-open .chat-history-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 1280px) {
  .overview-grid,
  .tool-layout,
  .admin-grid-top,
  .admin-grid-bottom,
  .metric-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-history-panel {
    min-height: 220px;
  }

  .hero-topline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .landing-shell,
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: min(88vw, 340px);
    min-height: auto;
    z-index: 50;
    transform: translateX(-120%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-btn,
  .mobile-nav {
    display: flex;
  }

  .mobile-nav {
    position: sticky;
    top: 102px;
    z-index: 18;
    padding: 8px 4px 10px;
    margin: -2px 0 4px;
    backdrop-filter: blur(16px);
  }

  .workspace-header {
    position: sticky;
    top: 14px;
    z-index: 20;
  }

  .workspace {
    min-height: auto;
    overflow: visible;
  }

  .view-panel.active,
  .chat-layout,
  .chat-main-panel,
  .chat-canvas,
  .chat-history-panel,
  .tool-layout,
  .overview-grid,
  .admin-grid-top,
  .admin-grid-bottom {
    min-height: auto;
    height: auto;
    overflow: visible;
  }

  .chat-toolbar {
    grid-template-columns: 1fr;
  }

  .chat-canvas {
    min-height: 58vh;
  }

  .chat-canvas.is-empty .chat-feed {
    min-height: 160px;
    max-height: 160px;
  }
}

@media (max-width: 820px) {
  .hero-topline,
  .hero-grid,
  .hero-points,
  .quick-actions,
  .metric-ribbon,
  .overview-grid,
  .tool-layout,
  .admin-grid-top,
  .admin-grid-bottom {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  #chat-submit-btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 48px;
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .workspace-meta {
    width: 100%;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-history-panel {
    order: 2;
    min-height: 200px;
  }

  .workspace {
    gap: 10px;
  }

  .workspace-header {
    padding: 14px 16px;
    border-radius: 18px;
    gap: 12px;
  }

  .workspace-header h1 {
    font-size: 28px;
    line-height: 1;
  }

  .topbar-caption {
    font-size: 11px;
  }

  .workspace-meta {
    gap: 8px;
  }

  .status-pill {
    padding: 7px 10px;
    font-size: 11px;
  }

  .panel-card,
  .metric-card {
    padding: 12px;
    border-radius: 18px;
  }

  .soft-btn,
  .input-select,
  .mobile-tab {
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .chat-feed {
    padding: 10px;
    gap: 8px;
  }

  .chat-bubble {
    padding: 10px 12px 9px;
    border-radius: 16px 16px 16px 10px;
    line-height: 1.45;
  }

  .chat-bubble.user {
    border-radius: 16px 16px 10px 16px;
  }

  .chat-bubble strong {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .copy-answer-btn {
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .chat-canvas,
  .chat-history-panel,
  .stack-list,
  .admin-users,
  .chart-box,
  .image-result,
  .text-result {
    border-radius: 16px;
  }

  .session-item {
    padding: 10px;
    border-radius: 12px;
  }

  .session-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .user-row,
  .stack-item {
    padding: 12px;
    border-radius: 14px;
  }
}

@media (max-width: 640px) {
  .landing-body,
  .app-body {
    padding: 8px;
  }

  .hero-panel,
  .auth-panel,
  .panel-card,
  .metric-card,
  .workspace-header {
    padding: 14px;
    border-radius: 16px;
  }

  h1 {
    font-size: 28px;
    max-width: 10ch;
  }

  .hero-copy,
  .auth-copy {
    font-size: 14px;
    line-height: 1.5;
  }

  .hero-visual-frame {
    border-radius: 18px;
  }

  .app-shell {
    min-height: auto;
  }

  .workspace-header h1 {
    font-size: 24px;
  }

  .dev-login-row {
    grid-template-columns: 1fr;
  }

  .status-pill {
    padding: 6px 9px;
    font-size: 10px;
  }

  .nav-item span {
    font-size: 16px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 18px;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-subtitle,
  .profile-level,
  .panel-head span,
  .chat-history-head span,
  .stack-item small,
  .user-meta {
    font-size: 12px;
  }

  .nav-item {
    padding: 9px 10px;
    border-radius: 10px;
  }

  .nav-item small {
    font-size: 10px;
  }

  .mobile-menu-btn {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .chat-feed,
  .image-result,
  .text-result,
  .admin-users,
  .stack-list {
    min-height: auto;
    max-height: none;
  }

  .chat-bubble {
    max-width: 100%;
    font-size: 14px;
  }

  .chat-canvas.is-empty .chat-composer {
    width: 100%;
    padding: 10px 0 0;
    border-radius: 0;
  }

  .chat-composer textarea,
  .chat-canvas.is-empty .chat-composer textarea {
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 15px;
  }

  #chat-submit-btn,
  .chat-canvas.is-empty .chat-composer .primary-btn {
    min-height: 48px;
    border-radius: 18px;
    font-size: 15px;
  }

  #chat-submit-btn {
    width: 100%;
  }

  .chat-canvas.is-empty .chat-feed {
    min-height: 140px;
    max-height: 140px;
    padding: 14px;
  }

  .chat-empty-state {
    max-width: 260px;
  }

  .chat-empty-state strong {
    font-size: 20px;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .chat-toolbar {
    grid-template-columns: 1fr;
  }

  .chat-canvas {
    min-height: auto;
    padding: 8px;
  }

  .chat-history-panel {
    padding: 8px;
    min-height: 180px;
  }

  .chat-layout,
  .tool-layout,
  .overview-grid,
  .admin-grid-top,
  .admin-grid-bottom,
  .metric-ribbon {
    gap: 10px;
  }

  .metric-card {
    padding: 10px;
  }

  .metric-card span {
    font-size: 12px;
  }

  .panel-head.compact h2,
  h2 {
    font-size: 17px;
  }

  .quick-card {
    padding: 10px;
    border-radius: 12px;
  }

  .quick-card strong {
    font-size: 14px;
  }

  .quick-card small {
    font-size: 12px;
  }

  .user-actions {
    gap: 8px;
  }

  .mini-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .landing-shell,
  .workspace,
  .view-panel.active,
  .chat-layout,
  .chat-main-panel {
    min-height: auto;
    height: auto;
    overflow: visible;
  }

  .chat-canvas,
  .chat-history-panel,
  .tool-layout,
  .overview-grid,
  .admin-grid-top,
  .admin-grid-bottom,
  .stack-list,
  .admin-users,
  .chart-box {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}
