:root {
  --bg: #060a0c;
  --panel: #0b1215;
  --panel-soft: #111a1e;
  --line: #202e34;
  --line-bright: #3b5057;
  --text: #f0f6f3;
  --muted: #8d9b98;
  --muted-strong: #bbc7c3;
  --accent: #c3f77f;
  --accent-2: #80e8bd;
  --accent-soft: rgba(195, 247, 127, 0.13);
  --accent-dim: #84a952;
  --sans: "Aptos", "Segoe UI Variable Text", "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei UI", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

html {
  scrollbar-color: #3a4b50 transparent;
}

body {
  background:
    radial-gradient(1100px 620px at 82% -12%, rgba(100, 224, 174, 0.1), transparent 57%),
    radial-gradient(760px 520px at 8% 104%, rgba(195, 247, 127, 0.055), transparent 55%),
    #060a0c;
  letter-spacing: 0.005em;
}

button,
a,
input,
textarea,
select {
  accent-color: var(--accent);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid rgba(195, 247, 127, 0.65);
  outline-offset: 2px;
}

::selection {
  background: rgba(195, 247, 127, 0.25);
  color: #fff;
}

.brand-mark {
  border-color: #49605f;
  background: radial-gradient(circle, rgba(195, 247, 127, 0.09), transparent 68%);
  box-shadow: 0 0 26px rgba(195, 247, 127, 0.08);
}

.brand-name {
  color: #f2f7f4;
  letter-spacing: 0.17em;
}

.brand-subtitle,
.eyebrow {
  color: #8dae63;
}

.eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.17em;
}

/* Chat shell */

.sidebar {
  border-right-color: rgba(58, 78, 84, 0.7);
  background:
    linear-gradient(180deg, rgba(15, 24, 28, 0.96), rgba(6, 11, 13, 0.98)),
    #080d0f;
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.16);
}

.new-chat {
  position: relative;
  overflow: hidden;
  border-color: rgba(195, 247, 127, 0.3);
  border-radius: 13px;
  background:
    linear-gradient(110deg, rgba(195, 247, 127, 0.12), rgba(128, 232, 189, 0.035)),
    #0d1518;
  padding: 13px 15px;
  font-weight: 520;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.new-chat::after {
  position: absolute;
  top: -30px;
  right: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(195, 247, 127, 0.08);
  filter: blur(24px);
  content: "";
}

.new-chat:hover {
  border-color: rgba(195, 247, 127, 0.55);
  background:
    linear-gradient(110deg, rgba(195, 247, 127, 0.17), rgba(128, 232, 189, 0.06)),
    #10191c;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.plus {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(195, 247, 127, 0.5);
}

.sidebar-label {
  margin-top: 30px;
  color: #71807c;
  font-size: 9.5px;
}

.topic-item {
  margin-bottom: 4px;
  border: 1px solid transparent;
  padding: 12px 12px 11px 14px;
}

.topic-item:hover {
  border-color: rgba(61, 80, 85, 0.46);
  background: rgba(17, 27, 31, 0.74);
}

.topic-item.active {
  border-color: rgba(195, 247, 127, 0.13);
  background:
    linear-gradient(90deg, rgba(195, 247, 127, 0.105), rgba(17, 27, 31, 0.55));
}

.topic-item.active::before {
  width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(195, 247, 127, 0.35);
}

.topic-name {
  font-size: 13.5px;
  font-weight: 470;
}

.topic-meta {
  color: #74827e;
  font-size: 9.5px;
}

.sidebar-footer {
  padding-top: 20px;
}

.sidebar-admin-link {
  display: none;
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
}

.sidebar-admin-link:hover {
  color: var(--accent);
}

#install-app {
  display: none;
  margin-top: 9px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-dim);
  font-size: 10px;
}

#install-app:hover {
  color: var(--accent);
}

.status-dot.online {
  box-shadow:
    0 0 0 4px rgba(195, 247, 127, 0.1),
    0 0 18px rgba(195, 247, 127, 0.28);
}

.main-panel {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(800px 500px at 76% -8%, rgba(114, 232, 180, 0.055), transparent 64%),
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

.main-panel::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(3, 6, 7, 0.18));
  pointer-events: none;
  content: "";
}

.main-panel > * {
  position: relative;
  z-index: 1;
}

.topbar {
  min-height: 82px;
  border-bottom-color: rgba(49, 66, 71, 0.68);
  background: rgba(6, 11, 13, 0.74);
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.08);
}

.conversation-heading h1 {
  font-size: 17px;
  font-weight: 520;
}

.route-control,
.memory-button,
.admin-button {
  font-size: 11.5px;
}

.route-control select,
.memory-button,
.admin-button {
  border-color: rgba(53, 70, 76, 0.8);
  border-radius: 10px;
  background: rgba(11, 18, 21, 0.84);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.018);
}

.route-control select {
  padding-top: 9px;
  padding-bottom: 9px;
}

.memory-button,
.admin-button {
  min-height: 35px;
  padding: 8px 11px;
}

.admin-button {
  min-width: 92px;
  justify-content: center;
  gap: 7px;
  font-weight: 520;
}

.admin-button span {
  line-height: 1;
  letter-spacing: 0.025em;
  white-space: nowrap;
  transform: translateY(0.5px);
}

.admin-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.memory-button:hover,
.admin-button:hover {
  border-color: rgba(195, 247, 127, 0.4);
  background: rgba(195, 247, 127, 0.07);
  box-shadow: 0 0 22px rgba(195, 247, 127, 0.05);
}

.memory-count {
  min-width: 19px;
  height: 19px;
  background: rgba(195, 247, 127, 0.12);
}

.chat-viewport {
  padding-top: 38px;
}

.welcome {
  position: relative;
  margin-top: clamp(20px, 5vh, 54px);
  border: 1px solid rgba(55, 74, 79, 0.58);
  border-radius: 25px;
  background:
    radial-gradient(650px 240px at 50% -20%, rgba(121, 227, 177, 0.1), transparent 68%),
    linear-gradient(145deg, rgba(16, 25, 29, 0.82), rgba(8, 14, 16, 0.76));
  padding: clamp(30px, 4.2vw, 48px);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.22),
    inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
}

.welcome::before {
  position: absolute;
  top: -1px;
  left: 20%;
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(195, 247, 127, 0.55), transparent);
  content: "";
}

.welcome-orbit {
  width: 112px;
  height: 112px;
  margin-bottom: 30px;
}

.core-light {
  box-shadow:
    0 0 24px rgba(195, 247, 127, 0.55),
    0 0 64px rgba(128, 232, 189, 0.32);
}

.welcome h2 {
  color: #f5f8f6;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 440;
  letter-spacing: -0.045em;
}

.welcome > p {
  color: #95a39f;
  font-size: 13.5px;
  line-height: 1.9;
}

.capability-grid {
  margin-top: 38px;
}

.capability {
  position: relative;
  overflow: hidden;
  border-color: rgba(47, 65, 69, 0.76);
  border-radius: 14px;
  background: rgba(8, 14, 16, 0.7);
  padding: 18px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.capability:hover {
  border-color: rgba(195, 247, 127, 0.25);
  background: rgba(16, 26, 29, 0.84);
  transform: translateY(-2px);
}

.capability::after {
  position: absolute;
  top: -26px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(195, 247, 127, 0.055);
  filter: blur(20px);
  content: "";
}

.capability strong {
  font-size: 12.5px;
}

.capability p {
  color: #8b9995;
  font-size: 10.5px;
  line-height: 1.75;
}

.message-list {
  gap: 30px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-color: rgba(72, 93, 98, 0.75);
  background: rgba(9, 15, 17, 0.76);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.13);
}

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

.message.assistant .message-body {
  align-items: flex-start;
  border: 1px solid rgba(43, 60, 65, 0.7);
  border-radius: 5px 18px 18px 18px;
  background:
    linear-gradient(145deg, rgba(16, 25, 29, 0.88), rgba(8, 14, 16, 0.78));
  padding: 15px 17px 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
}

.message.user .message-body {
  align-items: flex-end;
}

.message-meta {
  color: #71807c;
  font-size: 9.5px;
}

.message-text {
  font-size: 14.5px;
  line-height: 1.82;
}

.message.assistant .message-text {
  padding-top: 0;
}

.message.user .message-text {
  max-width: 82%;
  border-color: rgba(195, 247, 127, 0.18);
  background:
    linear-gradient(135deg, rgba(195, 247, 127, 0.12), rgba(128, 232, 189, 0.045)),
    #111a1e;
  padding: 13px 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.1);
}

.message-text.markdown-body {
  width: 100%;
  white-space: normal;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0 0 0.8em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.25em 0 0.55em;
  color: #f2f7f4;
  font-weight: 560;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.markdown-body h1 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4em;
  font-size: 1.55em;
}

.markdown-body h2 {
  border-bottom: 1px solid rgba(45, 62, 67, 0.72);
  padding-bottom: 0.35em;
  font-size: 1.3em;
}

.markdown-body h3 {
  font-size: 1.13em;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 1em;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.5em 0 0.9em;
  padding-left: 1.55em;
}

.markdown-body li {
  margin: 0.28em 0;
  padding-left: 0.15em;
}

.markdown-body li::marker {
  color: var(--accent-dim);
}

.markdown-body strong {
  color: #f4f8f6;
  font-weight: 650;
}

.markdown-body em {
  color: #c1cec9;
}

.markdown-body del {
  color: var(--muted);
}

.markdown-body a {
  color: var(--accent);
  text-decoration-color: rgba(195, 247, 127, 0.4);
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  text-decoration-color: var(--accent);
}

.markdown-body blockquote {
  margin: 0.9em 0;
  border-left: 2px solid var(--accent-dim);
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, rgba(195, 247, 127, 0.08), transparent);
  padding: 0.7em 0.95em;
  color: #b8c5c0;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body pre {
  overflow-x: auto;
  margin: 0.9em 0;
  border: 1px solid rgba(48, 67, 72, 0.9);
  border-radius: 10px;
  background: #060b0d;
  padding: 13px 14px;
  font: 11px/1.7 var(--mono);
  tab-size: 2;
}

.markdown-body pre code {
  border: 0;
  background: transparent;
  padding: 0;
  color: #d6e2dd;
  font-size: inherit;
}

.markdown-body code {
  border: 1px solid rgba(61, 83, 87, 0.58);
  border-radius: 4px;
  background: rgba(17, 27, 31, 0.9);
  padding: 0.12em 0.35em;
  color: #d7e9c1;
  font: 0.88em/1.5 var(--mono);
}

.markdown-body hr {
  margin: 1.2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.markdown-body table,
.report-markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.markdown-body th,
.markdown-body td,
.report-markdown th,
.report-markdown td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th,
.report-markdown th {
  background: rgba(195, 247, 127, 0.07);
  color: #e3ebe7;
  font-weight: 600;
}

.markdown-body tr:last-child td,
.report-markdown tr:last-child td {
  border-bottom: 0;
}

.task-list {
  padding-left: 1.1em;
  list-style: none;
}

.task-list input {
  margin-right: 0.35em;
  accent-color: var(--accent);
}

.composer-wrap {
  padding-top: 15px;
  background: linear-gradient(transparent, rgba(5, 9, 11, 0.97) 28%);
}

.composer {
  position: relative;
  overflow: hidden;
  border-color: rgba(60, 81, 87, 0.8);
  border-radius: 19px;
  background:
    linear-gradient(145deg, rgba(17, 27, 31, 0.97), rgba(8, 14, 16, 0.97));
  padding: 16px 15px 11px 18px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.3),
    inset 0 1px rgba(255, 255, 255, 0.03);
}

.composer::before {
  position: absolute;
  top: 0;
  left: 18%;
  width: 64%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(195, 247, 127, 0.38), transparent);
  content: "";
}

.composer:focus-within {
  border-color: rgba(195, 247, 127, 0.55);
  box-shadow:
    0 20px 64px rgba(0, 0, 0, 0.32),
    0 0 0 3px rgba(195, 247, 127, 0.05),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.composer textarea {
  font-size: 14.5px;
  pointer-events: auto;
  user-select: text;
}

.composer-hint {
  font-size: 9.5px;
}

.send-button {
  width: 37px;
  height: 37px;
  border-radius: 11px;
  background: linear-gradient(135deg, #c8fb84, #82e6b8);
  box-shadow: 0 8px 24px rgba(150, 235, 140, 0.16);
}

.send-button:hover {
  box-shadow: 0 10px 30px rgba(150, 235, 140, 0.28);
  transform: translateY(-2px);
}

.privacy-note {
  color: #5f6d69;
  font-size: 9.5px;
}

/* Drawers and dialogs */

.memory-drawer {
  border-left-color: rgba(57, 77, 82, 0.86);
  background:
    radial-gradient(420px 280px at 100% 0, rgba(195, 247, 127, 0.055), transparent 70%),
    rgba(7, 12, 14, 0.98);
  box-shadow: -32px 0 90px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(25px);
}

.memory-card {
  border-color: rgba(44, 61, 66, 0.8);
  background: linear-gradient(145deg, rgba(17, 27, 31, 0.9), rgba(10, 16, 19, 0.88));
  transition: border-color 150ms ease, transform 150ms ease;
}

.drawer-memory-group {
  margin-bottom: 16px;
}

.drawer-memory-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 8.5px/1 var(--mono);
  letter-spacing: 0.08em;
}

.drawer-memory-group-title span:last-child {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dim);
}

.memory-card:hover {
  border-color: rgba(195, 247, 127, 0.25);
  transform: translateY(-1px);
}

.memory-card p {
  font-size: 11.5px;
}

.dialog-card,
.admin-dialog-card {
  border-color: rgba(69, 89, 94, 0.85);
  background:
    radial-gradient(500px 260px at 50% -10%, rgba(195, 247, 127, 0.06), transparent 68%),
    #0b1215;
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.58);
}

.dialog-copy,
.dialog-description {
  font-size: 11.5px;
  line-height: 1.8;
}

.primary-button,
.admin-primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, #c8fb84, #82e6b8);
  color: #11200a;
  box-shadow: 0 8px 24px rgba(150, 235, 140, 0.12);
}

/* Admin */

.admin-sidebar {
  border-right-color: rgba(50, 69, 74, 0.72);
  background:
    radial-gradient(300px 220px at 0 0, rgba(195, 247, 127, 0.045), transparent 72%),
    linear-gradient(180deg, #0a1114, #060a0c);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.15);
}

.admin-nav-item {
  border: 1px solid transparent;
  padding: 14px 14px;
  font-size: 12.5px;
}

.admin-nav-item:hover {
  border-color: rgba(55, 73, 78, 0.52);
  background: rgba(17, 27, 31, 0.72);
}

.admin-nav-item.active {
  border-color: rgba(195, 247, 127, 0.15);
  background:
    linear-gradient(90deg, rgba(195, 247, 127, 0.13), rgba(195, 247, 127, 0.025));
}

.admin-main {
  background:
    radial-gradient(900px 540px at 88% -12%, rgba(93, 223, 169, 0.08), transparent 60%),
    radial-gradient(700px 460px at 20% 110%, rgba(195, 247, 127, 0.035), transparent 58%),
    linear-gradient(rgba(255, 255, 255, 0.011) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.011) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
}

.admin-topbar {
  min-height: 88px;
  border-bottom-color: rgba(48, 66, 71, 0.72);
  background: rgba(6, 11, 13, 0.76);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
}

.admin-topbar h1 {
  font-size: 21px;
  font-weight: 520;
  letter-spacing: -0.02em;
}

.admin-content {
  padding-top: 32px;
}

.stat-card {
  min-height: 136px;
  border-color: rgba(45, 64, 69, 0.78);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(17, 27, 31, 0.88), rgba(8, 14, 16, 0.86));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.11);
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.stat-card::before {
  position: absolute;
  top: 0;
  left: 18px;
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  content: "";
}

.stat-card::after {
  position: absolute;
  top: -45px;
  right: -35px;
  width: 125px;
  height: 125px;
  border-radius: 50%;
  background: rgba(195, 247, 127, 0.04);
  filter: blur(20px);
  content: "";
}

.stat-card:hover {
  border-color: rgba(195, 247, 127, 0.24);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.17);
  transform: translateY(-2px);
}

.stat-card.accent {
  border-color: rgba(195, 247, 127, 0.27);
  background:
    radial-gradient(circle at 100% 0, rgba(195, 247, 127, 0.14), transparent 54%),
    linear-gradient(145deg, rgba(19, 30, 32, 0.95), rgba(9, 16, 17, 0.9));
}

.stat-label {
  font-size: 9.5px;
}

.stat-card strong {
  margin-top: 20px;
  color: #f4f8f5;
  font-size: 34px;
}

.stat-card p {
  color: #8a9995;
  font-size: 10.5px;
}

.admin-panel {
  border-color: rgba(44, 62, 67, 0.76);
  border-radius: 16px;
  background:
    radial-gradient(450px 220px at 100% 0, rgba(195, 247, 127, 0.028), transparent 70%),
    rgba(9, 15, 17, 0.88);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.1),
    inset 0 1px rgba(255, 255, 255, 0.018);
  backdrop-filter: blur(16px);
}

.panel-heading h2 {
  font-size: 17px;
  font-weight: 520;
}

.overview-topic-row {
  padding: 15px 3px;
}

.overview-topic-name {
  font-size: 13px;
}

.overview-topic-meta,
.overview-topic-counts {
  font-size: 9.5px;
}

.overview-memory-item {
  border-color: rgba(43, 60, 65, 0.76);
  background: linear-gradient(145deg, #111b1e, #0b1215);
}

.overview-memory-item p {
  font-size: 10.8px;
}

.admin-outline-button,
.admin-primary-button,
.admin-danger-button,
.text-button,
.admin-icon-button {
  font-size: 10.5px;
}

.admin-outline-button {
  border-color: rgba(58, 78, 83, 0.82);
  background: rgba(12, 19, 22, 0.72);
}

.admin-primary-button {
  padding: 10px 15px;
}

.admin-danger-button {
  padding: 10px 13px;
}

.admin-search {
  border-color: rgba(53, 72, 77, 0.78);
  background: rgba(10, 17, 20, 0.82);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
}

.admin-search input {
  font-size: 11.5px;
}

.topic-browser {
  background:
    linear-gradient(180deg, rgba(16, 25, 29, 0.88), rgba(8, 14, 16, 0.86));
}

.topic-browser-item {
  border: 1px solid transparent;
  padding: 12px 13px;
}

.topic-browser-item:hover {
  border-color: rgba(50, 68, 73, 0.58);
  background: rgba(17, 27, 31, 0.68);
}

.topic-browser-item.active {
  border-color: rgba(195, 247, 127, 0.14);
  background:
    linear-gradient(90deg, rgba(195, 247, 127, 0.1), rgba(17, 27, 31, 0.46));
}

.topic-browser-name {
  font-size: 11.8px;
}

.topic-browser-meta {
  font-size: 8.8px;
}

.topic-edit-form input,
.topic-edit-form textarea,
.dialog-form-grid input,
.dialog-form-grid select,
.dialog-full-field input,
.dialog-full-field textarea,
.memory-toolbar select {
  border-color: rgba(47, 65, 70, 0.8);
  background: #081013;
  font-size: 11.5px;
}

.topic-edit-form input:focus,
.topic-edit-form textarea:focus,
.dialog-form-grid input:focus,
.dialog-form-grid select:focus,
.dialog-full-field input:focus,
.dialog-full-field textarea:focus,
.memory-toolbar select:focus {
  border-color: rgba(195, 247, 127, 0.52);
  box-shadow: 0 0 0 3px rgba(195, 247, 127, 0.045);
}

.topic-metrics div {
  border-color: rgba(44, 62, 67, 0.76);
  background: linear-gradient(145deg, #111b1e, #0b1215);
}

.summary-box {
  border-color: rgba(44, 62, 67, 0.76);
  background: rgba(7, 13, 15, 0.8);
  font-size: 10.8px;
}

.topic-message p,
.memory-row-content {
  font-size: 10.8px;
}

.mini-report-row {
  border-color: rgba(44, 62, 67, 0.76);
  background: linear-gradient(145deg, #111b1e, #0b1215);
}

.admin-memory-list {
  border-color: rgba(44, 62, 67, 0.76);
  background: rgba(8, 14, 16, 0.82);
}

.admin-memory-row {
  padding: 17px;
  transition: background 150ms ease;
}

.admin-memory-row:hover {
  background: rgba(18, 29, 33, 0.5);
}

.memory-row-title strong {
  font-size: 11.8px;
}

.report-card {
  overflow: hidden;
  border-color: rgba(45, 64, 69, 0.8);
  border-radius: 15px;
  background:
    radial-gradient(330px 170px at 100% 0, rgba(195, 247, 127, 0.055), transparent 75%),
    linear-gradient(145deg, rgba(16, 26, 29, 0.94), rgba(8, 14, 16, 0.9));
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.1);
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.report-card::before {
  position: absolute;
  top: 0;
  left: 18px;
  width: 55px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  content: "";
}

.report-card:hover {
  border-color: rgba(195, 247, 127, 0.28);
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.17);
  transform: translateY(-2px);
}

.report-card h3 {
  font-size: 16px;
}

.report-card p {
  font-size: 10.8px;
}

.report-markdown {
  color: #d2dcd8;
  font-size: 12.5px;
  line-height: 1.86;
}

.report-markdown h1 {
  font-size: 28px;
}

.report-markdown h2 {
  font-size: 18px;
}

.report-markdown blockquote {
  border-radius: 0 8px 8px 0;
  background:
    linear-gradient(90deg, rgba(195, 247, 127, 0.11), rgba(128, 232, 189, 0.025));
}

.toast {
  border-color: rgba(63, 84, 89, 0.9);
  background: rgba(19, 29, 33, 0.97);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
  font-size: 11.5px;
  backdrop-filter: blur(18px);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    box-shadow: 28px 0 80px rgba(0, 0, 0, 0.45);
  }

  .welcome {
    margin-top: 18px;
    border-radius: 20px;
    padding: 28px 20px;
  }

  .capability {
    padding: 15px;
  }

  .message.assistant .message-body {
    padding: 13px 14px;
  }

  .admin-button {
    display: none;
  }

  .sidebar-admin-link {
    display: inline-block;
    margin-top: 11px;
  }

  #install-app.available {
    display: inline-block;
  }

  .topbar-actions {
    gap: 5px;
  }

  .memory-button {
    min-height: 40px;
  }

  .route-control select {
    min-height: 40px;
  }

  .composer textarea {
    min-height: 30px;
    font-size: 16px;
  }

  .send-button {
    width: 42px;
    height: 42px;
  }

  .message-text {
    font-size: 15px;
  }
}

@media (max-width: 820px) {
  .admin-sidebar {
    box-shadow: 28px 0 80px rgba(0, 0, 0, 0.5);
  }
}

@media (max-width: 620px) {
  .stat-grid {
    gap: 9px;
  }

  .stat-card {
    min-height: 112px;
    border-radius: 14px;
    padding: 15px;
  }

  .stat-card strong {
    margin-top: 15px;
    font-size: 27px;
  }

  .message-list {
    gap: 23px;
  }

  .message-text {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .new-chat:hover,
  .capability:hover,
  .stat-card:hover,
  .report-card:hover,
  .send-button:hover {
    transform: none;
  }
}

/* Fixed chat viewport with a permanently docked composer. */

.app-shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.main-panel {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-viewport {
  min-height: 0;
  margin: 14px 24px 0;
  border: 1px solid rgba(54, 74, 79, 0.7);
  border-radius: 18px;
  background:
    radial-gradient(700px 360px at 70% -12%, rgba(110, 225, 177, 0.045), transparent 66%),
    rgba(7, 12, 14, 0.54);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.018),
    0 18px 50px rgba(0, 0, 0, 0.1);
  overscroll-behavior: contain;
  scroll-padding-bottom: 32px;
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  z-index: 8;
  min-width: 0;
  padding: 14px max(24px, calc((100% - 860px) / 2)) calc(16px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(5, 9, 11, 0), rgba(5, 9, 11, 0.97) 30%),
    transparent;
}

.composer {
  margin: 0 auto;
}

@media (max-width: 860px) {
  .chat-viewport {
    margin: 10px 10px 0;
    border-radius: 15px;
  }

  .composer-wrap {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  .chat-viewport {
    margin: 8px 8px 0;
    border-radius: 13px;
  }

  .composer-wrap {
    padding-right: 9px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-left: 9px;
  }
}

@supports (padding: max(0px)) {
  @media (max-width: 860px) {
    .topbar {
      min-height: calc(68px + env(safe-area-inset-top));
      padding-top: calc(10px + env(safe-area-inset-top));
    }

    .sidebar {
      padding-top: calc(27px + env(safe-area-inset-top));
      padding-bottom: calc(19px + env(safe-area-inset-bottom));
    }

    .login-page {
      padding-top: calc(14px + env(safe-area-inset-top));
      padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
  }
}

