:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #f8faf9;
  --line: #dbe2e6;
  --line-strong: #bdc8ce;
  --text: #20272b;
  --muted: #65737c;
  --soft-text: #46555c;
  --green: #0f7b6c;
  --green-dark: #075f54;
  --green-soft: #e5f3ef;
  --blue: #335c81;
  --blue-soft: #eaf1f6;
  --amber: #9a5b16;
  --rose: #be123c;
  --code: #20242a;
  --bubble: #edf7f4;
  --shadow: 0 4px 8px rgba(30, 41, 59, 0.08);
  --shadow-soft: 0 1px 3px rgba(30, 41, 59, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button,
.secondary-link {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

button:hover,
.secondary-link:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(15, 123, 108, 0.24);
  outline-offset: 2px;
}

.secondary-button,
.secondary-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover,
.secondary-link:hover {
  background: #f1f4f6;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

textarea::placeholder,
input::placeholder {
  color: #5f6b74;
}

textarea {
  resize: vertical;
  min-height: 104px;
  max-height: 210px;
  line-height: 1.5;
}

label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  width: min(1160px, calc(100vw - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-content: start;
}

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 10px;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.brand-block {
  min-width: 180px;
  color: inherit;
  text-decoration: none;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #eef1f3;
  border-radius: 10px;
  background: #f7f9fa;
}

.site-nav a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a:hover {
  background: #edf2f4;
  color: var(--text);
}

.site-nav a.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.header-actions > span,
.chat-card-header > span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: #eef2f4;
  color: var(--muted);
  font-size: 13px;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.account-menu[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 110px));
  overflow: auto;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 30;
}

.account-popover-section {
  display: grid;
  gap: 10px;
}

.account-popover h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.menu-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.scope-control {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: #f0f3f5;
}

.scope-control span {
  min-height: 24px;
  padding: 0 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.scope-button {
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.scope-button:hover {
  background: #e6ebef;
}

.scope-button.active {
  border-color: #a7d3cb;
  background: var(--green-soft);
  color: var(--green-dark);
}

.scope-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.site-main,
.page-view {
  min-width: 0;
  min-height: 0;
}

.site-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-view {
  display: grid;
  gap: 16px;
}

.home-view {
  width: min(100%, 940px);
  margin: 0 auto;
}

.home-hero {
  width: min(100%, 720px);
  padding: 6px 2px 0;
}

.home-hero h2 {
  margin: 0;
  font-size: 48px;
  line-height: 1.03;
  letter-spacing: 0;
  text-wrap: balance;
}

.home-hero p:not(.eyebrow) {
  margin: 12px 0 0;
  max-width: 680px;
  color: var(--soft-text);
  font-size: 16px;
  line-height: 1.58;
  text-wrap: pretty;
}

.task-desk {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-desk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-desk-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  text-wrap: balance;
}

.task-desk-head p {
  margin: 6px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.task-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.task-status-row span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d7e8e4;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.session-notice {
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
}

.session-notice[hidden] {
  display: none;
}

.chat-card {
  height: clamp(210px, 28vh, 360px);
  min-height: 210px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid #e4eaee;
  border-radius: 10px;
  background: #fbfcfd;
  overflow: hidden;
}

.chat-card-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef1f3;
  background: #fbfcfd;
}

.chat-card-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.chat-card-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-log {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 22px;
  background: #fbfcfd;
}

.empty-state {
  height: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  line-height: 1.65;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.composer {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.composer.dragging {
  border-color: #60a5fa;
  background: #eff6ff;
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.attachment-tray[hidden] {
  display: none;
}

.composer textarea {
  min-height: 88px;
  border-color: var(--line-strong);
  border-radius: 10px;
  font-size: 16px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.composer-primary-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.composer-options {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.toggle {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
}

.toggle input {
  width: 16px;
  height: 16px;
}

.panel-section {
  min-height: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.panel-section h2 {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.strong-note {
  margin-bottom: 0;
  color: var(--text);
  font-weight: 650;
}

.product-summary {
  min-height: 62px;
  border: 1px solid #cfe4df;
  border-radius: 10px;
  padding: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  line-height: 1.45;
}

.product-summary strong {
  display: block;
  margin-bottom: 4px;
  color: #0f3f3a;
  font-size: 15px;
}

.account-summary {
  display: grid;
  gap: 6px;
}

.account-summary p {
  margin: 0;
  color: var(--green-dark);
}

.summary-label {
  display: block;
  margin-bottom: 4px;
  color: #3f766f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.usage-tile {
  min-height: 58px;
  padding: 10px;
  border: 1px solid #e3e8ed;
  border-radius: 10px;
  background: #fbfcfd;
}

.usage-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.usage-tile strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  line-height: 1.1;
}

.product-list {
  display: grid;
  gap: 8px;
}

.product-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.25;
}

.product-card p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.product-card .product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.feature-card {
  min-height: 224px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.feature-card h3 {
  margin: 0 0 5px;
  font-size: 14px;
  line-height: 1.25;
}

.feature-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.feature-description {
  min-height: 58px;
  color: var(--soft-text) !important;
  font-size: 13px !important;
}

.feature-card button {
  margin-top: auto;
  width: 100%;
}

.feature-card .product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.product-chip {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #f0f3f5;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.product-chip.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.product-chip.preview {
  background: #fff7ed;
  color: var(--amber);
}

.analysis-drawer {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.analysis-drawer > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.analysis-grid .debug-panel {
  grid-column: 1 / -1;
}

.page-heading {
  width: min(100%, 820px);
  padding: 34px 4px 4px;
}

.page-heading h2 {
  margin: 0;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

.page-heading p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.pricing-page,
.capabilities-page {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.pricing-layout {
  display: grid;
  gap: 16px;
}

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

.pricing-content {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.pricing-grid .product-card {
  min-height: 244px;
  display: flex;
  flex-direction: column;
  position: relative;
  border-color: #d5dde4;
  padding: 16px;
}

.pricing-grid .product-card h3 {
  font-size: 17px;
}

.pricing-grid .product-card p {
  font-size: 13px;
}

.pricing-grid .product-card .price {
  margin: 10px 0 8px;
  color: var(--text);
}

.pricing-grid .product-card .price span {
  font-size: 30px;
  font-weight: 760;
  letter-spacing: 0;
}

.plan-fit {
  min-height: 42px;
  color: var(--soft-text) !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

.plan-badge {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8f4f1;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.pricing-grid .product-card button {
  margin-top: auto;
  width: 100%;
}

.credit-section {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.credit-section h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.credit-section p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.credit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.credit-card {
  min-width: 0;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcfd;
}

.credit-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.credit-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.credit-card button {
  width: 100%;
}

.capability-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.capability-copy {
  border: 1px solid #cfe4df;
  border-radius: 12px;
  padding: 18px;
  background: #eef8f6;
  color: var(--green-dark);
}

.capability-copy h3 {
  margin: 0 0 8px;
  color: #0f3f3a;
  font-size: 18px;
}

.capability-copy p {
  margin: 0;
  line-height: 1.55;
}

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

.debug-panel summary,
.insight-panel summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.debug-panel[open],
.insight-panel[open] {
  display: flex;
  flex-direction: column;
}

.debug-tools,
.insight-grid {
  min-height: 0;
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.debug-tools {
  max-height: 420px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.debug-tools h3,
.insight-grid h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.panel-section form {
  display: grid;
  gap: 9px;
}

.mini-output,
.trace-output {
  margin: 10px 0 0;
  min-height: 52px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 9px;
  padding: 10px;
  background: var(--code);
  color: #f4f7fa;
  font-size: 12px;
  line-height: 1.45;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  background: #fffaf4;
}

.source-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.source-path,
.source-snippet {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.source-snippet {
  color: #4d5965;
}

.trace-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 10px;
  margin: 0;
}

.trace-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.trace-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.message {
  margin: 0 0 16px;
  display: grid;
  gap: 6px;
}

.message .role {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.message .message-meta {
  width: fit-content;
  max-width: min(760px, 100%);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.message .bubble {
  width: fit-content;
  max-width: min(780px, 100%);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.58;
  border-radius: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
}

.message.user {
  justify-items: end;
}

.message.user .message-meta {
  text-align: right;
}

.message.user .bubble {
  background: #fff7ed;
  border-color: #fed7aa;
}

.message.assistant .bubble {
  background: var(--bubble);
  border-color: #b6e2da;
}

.message.pending .bubble {
  border-style: dashed;
  color: var(--muted);
}

.message.failed .bubble {
  border-color: #fecdd3;
  background: #fff1f2;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: inherit;
  gap: 6px;
}

.attachment-chip {
  max-width: min(360px, 100%);
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd8df;
  border-radius: 8px;
  padding: 5px 9px;
  background: #f8fafc;
  color: #3f4954;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.attachment-chip.pending {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.attachment-remove {
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  font-size: 11px;
}

.attachment-remove:hover {
  background: #dbeafe;
}

.audit-card,
.thinking-card {
  width: min(780px, 100%);
  max-width: 100%;
  border: 1px solid #d6e6e3;
  border-radius: 10px;
  background: #fbfefd;
  color: var(--text);
}

.thinking-card {
  border-color: #d8dee4;
  background: #f8fafc;
  color: #3f4954;
}

.audit-card summary,
.thinking-card summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.audit-card[open] {
  padding-bottom: 8px;
  max-height: 360px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.audit-section {
  padding: 0 11px 7px;
}

.audit-section h3 {
  margin: 4px 0 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.audit-section ul {
  margin: 0;
  padding-left: 1.25em;
}

.audit-section li {
  margin: 0.22em 0;
  color: #3f4954;
  font-size: 12px;
  line-height: 1.45;
}

.audit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: flex-start;
}

.audit-action {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.audit-json {
  flex-basis: 100%;
  max-height: 260px;
  margin: 2px 0 0;
  overflow: auto;
  border-radius: 8px;
  padding: 9px;
  background: var(--code);
  color: #f4f7fa;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thinking-body {
  max-height: 260px;
  overflow: auto;
  padding: 0 11px 10px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.warning {
  color: var(--rose);
  font-weight: 700;
}

.markdown-body {
  overflow-wrap: anywhere;
}

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

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

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

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 0.85em 0 0.38em;
  line-height: 1.25;
  letter-spacing: 0;
}

.markdown-body h1 {
  font-size: 20px;
}

.markdown-body h2 {
  font-size: 17px;
}

.markdown-body h3 {
  font-size: 15px;
}

.markdown-body h4 {
  font-size: 14px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.35em 0 0.85em;
  padding-left: 1.35em;
}

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

.markdown-body li > p {
  margin: 0;
}

.markdown-body strong {
  font-weight: 750;
}

.markdown-body a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body code {
  border-radius: 5px;
  padding: 1px 5px;
  background: rgba(32, 36, 42, 0.08);
  color: #0f3f3a;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  margin: 0.75em 0;
  max-width: 100%;
  overflow: auto;
  border-radius: 8px;
  padding: 10px;
  background: var(--code);
  color: #f4f7fa;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.markdown-body blockquote {
  margin: 0.75em 0;
  padding: 0.55em 0.75em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fa;
  color: var(--soft-text);
}

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

.markdown-body.compact p {
  margin-bottom: 0.4em;
}

.markdown-body.compact ul,
.markdown-body.compact ol {
  margin-bottom: 0.45em;
}

.markdown-body.compact h1,
.markdown-body.compact h2,
.markdown-body.compact h3,
.markdown-body.compact h4 {
  margin-top: 0.55em;
}

.trace-output.trace-markdown {
  white-space: normal;
  font-family: inherit;
}

.trace-markdown.markdown-body code {
  background: rgba(244, 247, 250, 0.12);
  color: #f4f7fa;
}

.trace-markdown.markdown-body a {
  color: #7dd3fc;
}

.source-snippet.markdown-body h1,
.source-snippet.markdown-body h2,
.source-snippet.markdown-body h3,
.source-snippet.markdown-body h4 {
  margin: 0.35em 0 0.2em;
  font-size: 12px;
  line-height: 1.35;
}

.source-snippet.markdown-body p,
.source-snippet.markdown-body ul,
.source-snippet.markdown-body ol {
  margin-bottom: 0.32em;
}

@media (max-width: 1180px) {
  .app-shell {
    width: min(100vw - 24px, 1040px);
  }

  .credit-section {
    grid-template-columns: 1fr;
  }

  .capability-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .app-shell {
    width: calc(100vw - 20px);
    padding-top: 10px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    position: static;
    min-height: 0;
    gap: 10px;
    padding: 10px 12px;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .site-nav a {
    flex: 1;
    justify-content: center;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  #runtimeLine,
  #modelStatus {
    display: none;
  }

  .header-actions > button,
  .account-menu summary {
    min-height: 34px;
    padding-inline: 10px;
  }

  .account-popover {
    left: 0;
    right: auto;
    width: 100%;
  }

  .brand-block h1 {
    font-size: 24px;
  }

  .brand-block p:last-child {
    font-size: 13px;
  }

  .header-actions,
  .composer-primary-actions {
    justify-content: flex-start;
  }

  .home-hero {
    padding-top: 8px;
  }

  .home-hero h2,
  .page-heading h2 {
    font-size: 34px;
    line-height: 1.08;
  }

  .task-desk {
    padding: 12px;
  }

  .task-desk-head {
    flex-direction: column;
    gap: 8px;
  }

  .task-status-row {
    justify-content: flex-start;
    display: none;
  }

  .composer-primary-actions {
    width: 100%;
  }

  .composer-primary-actions button {
    flex: 1;
  }

  .pricing-grid,
  .credit-grid,
  .capability-grid,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .page-heading {
    padding-top: 14px;
  }

  .chat-card {
    height: clamp(160px, 22vh, 220px);
    min-height: 160px;
  }

  .composer {
    padding: 0;
  }

  .composer textarea {
    height: 78px;
    min-height: 78px;
  }

  .composer-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-options,
  .composer-actions .toggle {
    width: 100%;
  }
}

/* XiaojinPro dark chat redesign */
:root {
  --xjp-bg: #0b0d0e;
  --xjp-bg-elevated: #111315;
  --xjp-surface: rgba(22, 24, 27, 0.86);
  --xjp-surface-strong: rgba(31, 34, 38, 0.94);
  --xjp-surface-soft: rgba(255, 255, 255, 0.055);
  --xjp-border: rgba(255, 255, 255, 0.1);
  --xjp-border-strong: rgba(255, 255, 255, 0.16);
  --xjp-text: #f1f4f3;
  --xjp-text-soft: #c6cecb;
  --xjp-muted: #89928f;
  --xjp-teal: #8ee7d4;
  --xjp-teal-strong: #21b89e;
  --xjp-amber: #f0c36a;
  --xjp-red: #f0756b;
  --xjp-blue: #7da7ff;
  --xjp-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

html {
  background: var(--xjp-bg);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 52% 56%, rgba(26, 43, 112, 0.32) 0%, rgba(19, 27, 61, 0.18) 27%, rgba(11, 13, 14, 0) 55%),
    linear-gradient(180deg, #0b0d0e 0%, #0a0b0c 100%);
  color: var(--xjp-text);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent 0, black 20%, black 78%, transparent 100%);
  opacity: 0.18;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 0 26px 26px 84px;
  gap: 0;
}

.side-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 62px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: 20px 0 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 8, 9, 0.6);
  backdrop-filter: blur(18px);
}

.rail-brand,
.rail-nav a,
.rail-icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(241, 244, 243, 0.72);
  text-decoration: none;
}

.rail-brand {
  margin-bottom: 22px;
}

.spark-mark {
  width: 22px;
  height: 22px;
  display: block;
  background:
    conic-gradient(from 45deg, #6ca8ff, #8ee7d4, #ffd36b, #ff786b, #6ca8ff);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 12px rgba(125, 167, 255, 0.35));
}

.rail-nav {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
}

.rail-nav a svg,
.rail-icon-button svg,
.composer-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-nav a:hover,
.rail-icon-button:hover,
.rail-nav a.active {
  border-color: rgba(142, 231, 212, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--xjp-text);
}

.rail-nav a.active {
  color: var(--xjp-teal);
}

.rail-bottom {
  display: grid;
  gap: 12px;
}

.rail-icon-button {
  min-height: 38px;
  padding: 0;
  background: transparent;
}

.rail-icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.topbar {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 45;
  min-height: 46px;
  width: auto;
  max-width: calc(100vw - 112px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-block {
  position: fixed;
  top: 20px;
  left: 84px;
  min-width: 0;
  opacity: 0.86;
}

.brand-kicker {
  margin: 0;
  color: var(--xjp-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.topbar h1 {
  margin-top: 2px;
  color: var(--xjp-text);
  font-size: 16px;
  font-weight: 720;
}

.topbar p {
  display: none;
}

.site-nav {
  display: none;
}

.header-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

.header-actions > span,
.account-menu summary,
.secondary-button,
.secondary-link {
  min-height: 40px;
  border: 1px solid var(--xjp-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--xjp-text-soft);
  box-shadow: none;
}

.header-actions > span {
  padding: 0 13px;
  white-space: nowrap;
}

.account-menu summary:hover,
.secondary-button:hover,
.secondary-link:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: var(--xjp-text);
}

#loginButton,
.primary-button {
  background: rgba(142, 231, 212, 0.14);
  color: var(--xjp-teal);
}

#loginButton:hover,
.primary-button:hover {
  background: rgba(142, 231, 212, 0.2);
}

.account-popover {
  border-color: var(--xjp-border);
  background: rgba(15, 17, 19, 0.96);
  color: var(--xjp-text);
  box-shadow: var(--xjp-shadow);
}

.menu-note,
.account-summary p,
.usage-tile span,
.panel-note,
.page-heading p,
.pricing-page p,
.capabilities-page p {
  color: var(--xjp-muted);
}

.scope-control {
  background: rgba(255, 255, 255, 0.075);
}

.scope-control span,
.scope-button {
  color: var(--xjp-muted);
}

.scope-button:hover,
.scope-button.active {
  border-color: rgba(142, 231, 212, 0.26);
  background: rgba(142, 231, 212, 0.12);
  color: var(--xjp-teal);
}

.site-main {
  width: min(100%, 1260px);
  min-height: 100dvh;
  margin: 0 auto;
}

.page-view {
  min-height: 100dvh;
}

.home-view {
  width: min(100%, 980px);
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(122px, 1fr) auto minmax(110px, 0.82fr) auto;
  align-content: center;
  margin: 0 auto;
  padding: 96px 0 44px;
}

.home-hero {
  width: min(100%, 820px);
  align-self: end;
  justify-self: center;
  padding: 0 0 34px;
  text-align: center;
}

.home-hero .eyebrow,
.task-desk-head,
.task-status-row {
  display: none;
}

.home-hero h2 {
  margin: 0;
  color: rgba(241, 244, 243, 0.78);
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 360;
  line-height: 1.18;
  text-wrap: balance;
}

.home-hero p:not(.eyebrow) {
  width: min(100%, 680px);
  margin: 16px auto 0;
  color: rgba(198, 206, 203, 0.72);
  font-size: 15px;
}

.task-desk {
  width: min(100%, 780px);
  justify-self: center;
  display: grid;
  gap: 18px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.session-notice {
  width: min(100%, 780px);
  justify-self: center;
  border-color: rgba(125, 167, 255, 0.22);
  background: rgba(125, 167, 255, 0.09);
  color: #cddcff;
}

.composer {
  position: relative;
  z-index: 3;
  width: 100%;
}

.composer.dragging .composer-shell {
  border-color: rgba(125, 167, 255, 0.72);
  background: rgba(25, 35, 68, 0.9);
}

.composer-shell {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 999px;
  padding: 7px 8px 7px 10px;
  background: rgba(31, 32, 34, 0.95);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.composer-icon-button {
  width: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: rgba(241, 244, 243, 0.76);
}

.composer-icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--xjp-text);
}

.composer textarea {
  min-height: 36px;
  max-height: 150px;
  border: 0;
  border-radius: 0;
  padding: 8px 2px;
  background: transparent;
  color: var(--xjp-text);
  font-size: 16px;
  line-height: 1.38;
  resize: none;
}

.composer textarea:focus {
  outline: none;
}

.composer textarea::placeholder {
  color: rgba(198, 206, 203, 0.72);
}

.composer-options {
  gap: 8px;
  justify-content: flex-end;
}

.toggle {
  height: 32px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: rgba(198, 206, 203, 0.82);
  font-size: 12px;
  white-space: nowrap;
}

.toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.toggle input {
  accent-color: var(--xjp-teal-strong);
}

.composer-primary-actions {
  gap: 6px;
}

.model-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  color: rgba(241, 244, 243, 0.72);
  font-size: 13px;
  font-weight: 650;
}

#sendButton {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(142, 231, 212, 0.18);
  color: var(--xjp-teal);
}

#sendButton:hover {
  background: rgba(142, 231, 212, 0.26);
  color: var(--xjp-text);
}

.attachment-tray {
  margin: 0 0 10px;
  justify-content: center;
}

.attachment-chip {
  border-color: var(--xjp-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--xjp-text-soft);
}

.chat-card {
  width: min(100%, 920px);
  height: min(48dvh, 500px);
  min-height: 260px;
  justify-self: center;
  border-color: rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background: rgba(14, 16, 18, 0.58);
  box-shadow: none;
}

.chat-card:has(.empty-state) {
  display: none;
}

.chat-log {
  background: transparent;
  padding: 24px;
}

.empty-state {
  color: var(--xjp-muted);
}

.empty-state strong {
  color: var(--xjp-text-soft);
}

.message {
  margin-bottom: 20px;
}

.message .role {
  color: rgba(198, 206, 203, 0.65);
}

.message .bubble {
  border: 1px solid var(--xjp-border);
  background: rgba(255, 255, 255, 0.065);
  color: var(--xjp-text);
  box-shadow: none;
}

.message.assistant .bubble {
  border-color: rgba(142, 231, 212, 0.18);
  background: rgba(142, 231, 212, 0.075);
}

.message.user .bubble {
  border-color: rgba(240, 195, 106, 0.2);
  background: rgba(240, 195, 106, 0.09);
}

.message .message-meta {
  color: rgba(198, 206, 203, 0.62);
}

.thinking-card,
.audit-card {
  border-color: var(--xjp-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--xjp-text-soft);
}

.thinking-card summary,
.audit-card summary {
  color: rgba(198, 206, 203, 0.86);
}

.analysis-drawer {
  width: min(100%, 980px);
  justify-self: center;
  align-self: end;
  margin-top: 26px;
  border: 1px solid var(--xjp-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.analysis-drawer > summary {
  color: rgba(198, 206, 203, 0.86);
}

.analysis-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}

.analysis-controls .toggle {
  border: 1px solid var(--xjp-border);
  background: rgba(255, 255, 255, 0.05);
}

.analysis-grid {
  background: transparent;
}

.panel-section,
.product-card,
.credit-card,
.feature-card,
.capability-copy {
  border-color: var(--xjp-border);
  background: rgba(255, 255, 255, 0.055);
  color: var(--xjp-text);
  box-shadow: none;
}

.trace-output,
.mini-output {
  border-color: var(--xjp-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--xjp-text-soft);
}

.source-item {
  border-color: var(--xjp-border);
  background: rgba(255, 255, 255, 0.045);
  color: var(--xjp-text-soft);
}

.pricing-page,
.capabilities-page {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 120px 0 64px;
}

.page-heading h2,
.capability-copy h3,
.product-card h3,
.feature-card h3 {
  color: var(--xjp-text);
}

.page-heading .eyebrow,
.eyebrow {
  color: var(--xjp-teal);
}

.product-chip,
.plan-badge {
  background: rgba(142, 231, 212, 0.12);
  color: var(--xjp-teal);
}

input,
textarea {
  border-color: var(--xjp-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--xjp-text);
}

input::placeholder,
textarea::placeholder {
  color: rgba(198, 206, 203, 0.58);
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline-color: rgba(142, 231, 212, 0.36);
}

@media (max-width: 980px) {
  .app-shell {
    padding-left: 72px;
    padding-right: 18px;
  }

  .brand-block {
    left: 74px;
  }

  .home-view {
    padding-top: 112px;
  }

  .composer-shell {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    border-radius: 26px;
  }

  .composer-options {
    display: none;
  }
}

@media (max-width: 700px) {
  body {
    background:
      radial-gradient(ellipse at 52% 36%, rgba(26, 43, 112, 0.28) 0%, rgba(11, 13, 14, 0) 56%),
      #0b0d0e;
  }

  .app-shell {
    padding: 72px 14px 20px;
  }

  .side-rail {
    inset: 0 0 auto;
    width: 100%;
    height: 58px;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 1fr;
    padding: 0 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .rail-brand {
    margin: 0;
  }

  .rail-nav {
    grid-auto-flow: column;
    align-content: center;
    justify-content: center;
  }

  .rail-bottom {
    align-content: center;
  }

  .topbar {
    top: 66px;
    right: 14px;
    max-width: calc(100vw - 28px);
  }

  .brand-block {
    display: none;
  }

  .header-actions > span {
    display: none;
  }

  .home-view {
    min-height: calc(100dvh - 72px);
    padding: 68px 0 28px;
    grid-template-rows: minmax(70px, 0.75fr) auto minmax(90px, 0.65fr) auto;
  }

  .home-hero {
    padding-bottom: 24px;
  }

  .home-hero h2 {
    font-size: clamp(28px, 9vw, 38px);
  }

  .home-hero p:not(.eyebrow) {
    display: none;
  }

  .task-desk,
  .analysis-drawer {
    width: 100%;
  }

  .composer-shell {
    min-height: 54px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 6px;
  }

  .composer textarea {
    font-size: 15px;
  }

  .model-pill {
    display: none;
  }

  #sendButton {
    min-width: 58px;
    padding: 0 14px;
  }

  .chat-card {
    height: 44dvh;
    min-height: 220px;
  }

  .chat-log {
    padding: 16px;
  }

  .pricing-page,
  .capabilities-page {
    padding-top: 88px;
  }
}

/* Warm mint product theme override */
:root {
  --warm-page: #fbf6e9;
  --warm-page-2: #f4ead7;
  --warm-panel: rgba(255, 253, 246, 0.88);
  --warm-panel-solid: #fffdf6;
  --warm-cream: #fff8e8;
  --warm-mint: #dff5e9;
  --warm-mint-2: #c8eadb;
  --warm-green: #2f7a66;
  --warm-green-strong: #1f5f50;
  --warm-ink: #26332f;
  --warm-ink-soft: #51615b;
  --warm-muted: #7b897f;
  --warm-line: rgba(57, 88, 75, 0.18);
  --warm-line-strong: rgba(57, 88, 75, 0.28);
  --warm-shadow: 0 24px 70px rgba(87, 70, 37, 0.13);
}

html {
  background: var(--warm-page);
}

body {
  background:
    radial-gradient(ellipse at 52% 53%, rgba(200, 234, 219, 0.82) 0%, rgba(242, 232, 205, 0.5) 34%, rgba(251, 246, 233, 0) 62%),
    linear-gradient(180deg, #fffdf6 0%, var(--warm-page) 52%, #f7efdd 100%);
  color: var(--warm-ink);
}

body::after {
  background-image:
    linear-gradient(rgba(47, 122, 102, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 122, 102, 0.028) 1px, transparent 1px);
  opacity: 0.32;
}

.side-rail {
  border-right-color: rgba(47, 122, 102, 0.13);
  background: rgba(255, 253, 246, 0.7);
  box-shadow: 10px 0 28px rgba(87, 70, 37, 0.06);
}

.rail-brand,
.rail-nav a,
.rail-icon-button {
  color: rgba(38, 51, 47, 0.7);
}

.spark-mark {
  background:
    conic-gradient(from 45deg, #55b392, #f2cd85, #95d7bd, #e7896c, #55b392);
  filter: drop-shadow(0 5px 14px rgba(47, 122, 102, 0.18));
}

.rail-nav a:hover,
.rail-icon-button:hover,
.rail-nav a.active {
  border-color: rgba(47, 122, 102, 0.18);
  background: rgba(223, 245, 233, 0.72);
  color: var(--warm-green-strong);
}

.brand-kicker {
  color: var(--warm-muted);
}

.topbar h1 {
  color: var(--warm-ink);
}

.header-actions > span,
.account-menu summary,
.secondary-button,
.secondary-link {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.82);
  color: var(--warm-ink-soft);
  box-shadow: 0 8px 22px rgba(87, 70, 37, 0.06);
}

.account-menu summary:hover,
.secondary-button:hover,
.secondary-link:hover {
  border-color: var(--warm-line-strong);
  background: #fffdf6;
  color: var(--warm-ink);
}

#loginButton,
.primary-button {
  background: rgba(223, 245, 233, 0.78);
  color: var(--warm-green-strong);
}

#loginButton:hover,
.primary-button:hover {
  background: var(--warm-mint-2);
  color: #173f36;
}

.account-popover {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.96);
  color: var(--warm-ink);
  box-shadow: var(--warm-shadow);
}

.menu-note,
.account-summary p,
.usage-tile span,
.panel-note,
.page-heading p,
.pricing-page p,
.capabilities-page p {
  color: var(--warm-muted);
}

.scope-control {
  background: rgba(47, 122, 102, 0.07);
}

.scope-control span,
.scope-button {
  color: var(--warm-muted);
}

.scope-button:hover,
.scope-button.active {
  border-color: rgba(47, 122, 102, 0.22);
  background: rgba(223, 245, 233, 0.8);
  color: var(--warm-green-strong);
}

.home-hero h2 {
  color: rgba(38, 51, 47, 0.82);
  font-weight: 380;
}

.home-hero p:not(.eyebrow) {
  color: rgba(81, 97, 91, 0.78);
}

.session-notice {
  border-color: rgba(47, 122, 102, 0.18);
  background: rgba(223, 245, 233, 0.68);
  color: var(--warm-green-strong);
}

.composer-shell {
  border-color: rgba(47, 122, 102, 0.18);
  background: rgba(255, 253, 246, 0.94);
  box-shadow:
    0 24px 62px rgba(87, 70, 37, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.composer.dragging .composer-shell {
  border-color: rgba(47, 122, 102, 0.42);
  background: rgba(239, 250, 244, 0.96);
}

.composer-icon-button {
  color: rgba(38, 51, 47, 0.62);
}

.composer-icon-button:hover {
  background: rgba(47, 122, 102, 0.08);
  color: var(--warm-green-strong);
}

.composer textarea {
  color: var(--warm-ink);
}

.composer textarea::placeholder {
  color: rgba(81, 97, 91, 0.62);
}

.model-pill {
  color: rgba(81, 97, 91, 0.72);
}

#sendButton {
  background: rgba(47, 122, 102, 0.12);
  color: var(--warm-green-strong);
}

#sendButton:hover {
  background: rgba(47, 122, 102, 0.18);
  color: #173f36;
}

.attachment-chip {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.86);
  color: var(--warm-ink-soft);
}

.chat-card {
  border-color: rgba(47, 122, 102, 0.14);
  background: rgba(255, 253, 246, 0.52);
  box-shadow: 0 20px 56px rgba(87, 70, 37, 0.08);
}

.empty-state {
  color: var(--warm-muted);
}

.empty-state strong {
  color: var(--warm-ink);
}

.message .role {
  color: rgba(81, 97, 91, 0.66);
}

.message .bubble {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.86);
  color: var(--warm-ink);
}

.message.assistant .bubble {
  border-color: rgba(47, 122, 102, 0.18);
  background: rgba(223, 245, 233, 0.68);
}

.message.user .bubble {
  border-color: rgba(217, 149, 78, 0.2);
  background: rgba(255, 246, 226, 0.92);
}

.message .message-meta {
  color: rgba(81, 97, 91, 0.64);
}

.thinking-card,
.audit-card {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.66);
  color: var(--warm-ink-soft);
}

.thinking-card summary,
.audit-card summary {
  color: var(--warm-ink-soft);
}

.analysis-drawer {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.58);
  box-shadow: 0 14px 42px rgba(87, 70, 37, 0.08);
}

.analysis-drawer > summary {
  color: var(--warm-ink-soft);
}

.analysis-controls .toggle,
.panel-section,
.product-card,
.credit-card,
.feature-card,
.capability-copy {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.82);
  color: var(--warm-ink);
  box-shadow: 0 14px 34px rgba(87, 70, 37, 0.07);
}

.toggle {
  color: var(--warm-ink-soft);
}

.toggle:hover {
  background: rgba(47, 122, 102, 0.06);
}

.trace-output,
.mini-output {
  border-color: var(--warm-line);
  background: rgba(249, 241, 222, 0.72);
  color: var(--warm-ink-soft);
}

.source-item {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.7);
  color: var(--warm-ink-soft);
}

.page-heading h2,
.capability-copy h3,
.product-card h3,
.feature-card h3 {
  color: var(--warm-ink);
}

.page-heading .eyebrow,
.eyebrow {
  color: var(--warm-green-strong);
}

.product-chip,
.plan-badge {
  background: rgba(223, 245, 233, 0.8);
  color: var(--warm-green-strong);
}

input,
textarea {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.9);
  color: var(--warm-ink);
}

input::placeholder,
textarea::placeholder {
  color: rgba(81, 97, 91, 0.58);
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline-color: rgba(47, 122, 102, 0.26);
}

@media (max-width: 700px) {
  body {
    background:
      radial-gradient(ellipse at 52% 36%, rgba(200, 234, 219, 0.78) 0%, rgba(251, 246, 233, 0) 58%),
      linear-gradient(180deg, #fffdf6 0%, var(--warm-page) 100%);
  }

  .side-rail {
    border-bottom-color: rgba(47, 122, 102, 0.13);
    background: rgba(255, 253, 246, 0.78);
  }
}

/* Conversation layout states. Keep the existing XiaojinPro visual theme; only
   change where the same surfaces sit before and after the first user turn. */
body[data-route="home"].home-empty .home-view {
  grid-template-rows: minmax(122px, 1fr) auto minmax(110px, 0.72fr);
}

body[data-route="home"].home-empty .task-desk {
  align-self: start;
}

body[data-route="home"].home-empty .chat-card,
body[data-route="home"].home-empty .analysis-drawer {
  display: none;
}

body[data-route="home"].has-chat .home-view {
  width: min(100%, 1040px);
  min-height: 100dvh;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  padding-top: 88px;
  padding-bottom: 34px;
}

body[data-route="home"].has-chat .home-hero {
  display: none;
}

body[data-route="home"].has-chat .task-desk {
  width: min(100%, 920px);
  height: calc(100dvh - 150px);
  min-height: 520px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 22px;
}

body[data-route="home"].has-chat .chat-card {
  order: 1;
  height: auto;
  min-height: 0;
  align-self: stretch;
}

body[data-route="home"].has-chat .chat-log {
  height: 100%;
  padding-top: 40px;
  padding-bottom: 40px;
}

body[data-route="home"].has-chat .composer {
  order: 2;
  width: min(100%, 780px);
  justify-self: center;
  align-self: end;
  position: relative;
  bottom: auto;
}

body[data-route="home"].has-chat .message.user {
  justify-items: center;
  margin-bottom: 46px;
}

body[data-route="home"].has-chat .message.user .message-meta {
  text-align: center;
}

body[data-route="home"].has-chat .message.assistant {
  width: min(100%, 760px);
  margin-left: auto;
  margin-right: auto;
  justify-items: stretch;
}

body[data-route="home"].has-chat .message.assistant .bubble {
  width: 100%;
  max-width: 100%;
}

body[data-route="home"].has-chat .analysis-drawer {
  width: min(100%, 780px);
  margin-top: 10px;
}

.message.is-arriving {
  opacity: 0;
}

.message-flight-bubble {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.58;
  border: 1px solid rgba(217, 149, 78, 0.2);
  border-radius: 12px;
  padding: 12px 13px;
  background: rgba(255, 246, 226, 0.92);
  color: var(--warm-ink);
  box-shadow: 0 18px 42px rgba(87, 70, 37, 0.1);
}

@media (max-width: 700px) {
  body[data-route="home"].home-empty .home-view {
    grid-template-rows: minmax(84px, 0.82fr) auto minmax(72px, 0.52fr);
  }

  body[data-route="home"].has-chat .home-view {
    min-height: calc(100dvh - 72px);
    padding-top: 84px;
    padding-bottom: 24px;
  }

  body[data-route="home"].has-chat .task-desk {
    height: calc(100dvh - 132px);
    min-height: 460px;
    gap: 16px;
  }

  body[data-route="home"].has-chat .chat-log {
    padding: 24px 14px;
  }

  body[data-route="home"].has-chat .composer {
    bottom: auto;
  }

  body[data-route="home"].has-chat .message.user {
    margin-bottom: 32px;
  }
}

/* Expandable conversation rail. This keeps the existing warm XiaojinPro theme
   and changes only the app-shell layout and navigation density. */
:root {
  --side-rail-width: 62px;
  --side-rail-expanded: 276px;
  --rail-icon-size: 38px;
  --rail-icon-glyph: 20px;
  --rail-label-gap: 10px;
  --rail-avatar-size: 30px;
}

body.sidebar-expanded {
  --side-rail-width: var(--side-rail-expanded);
}

.app-shell {
  padding-left: calc(var(--side-rail-width) + 22px);
  transition: padding-left 220ms cubic-bezier(0.2, 0.78, 0.16, 1);
}

.side-rail {
  width: var(--side-rail-width);
  justify-items: stretch;
  align-items: stretch;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: visible;
  padding: 20px 12px 22px;
  transition:
    width 220ms cubic-bezier(0.2, 0.78, 0.16, 1),
    box-shadow 220ms ease;
}

body.sidebar-expanded .side-rail {
  box-shadow: 18px 0 42px rgba(87, 70, 37, 0.1);
}

.rail-brand,
.rail-nav a,
.rail-action,
.sidebar-avatar,
.side-account-menu summary,
.side-settings-menu summary {
  width: var(--rail-icon-size);
  min-height: var(--rail-icon-size);
  display: grid;
  grid-template-columns: var(--rail-icon-size) 0;
  align-items: center;
  justify-items: center;
  place-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 999px;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  transition:
    width 220ms cubic-bezier(0.2, 0.78, 0.16, 1),
    border-radius 220ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

body.sidebar-expanded .rail-brand,
body.sidebar-expanded .rail-nav a,
body.sidebar-expanded .rail-action,
body.sidebar-expanded .sidebar-avatar,
body.sidebar-expanded .side-account-menu summary,
body.sidebar-expanded .side-settings-menu summary {
  width: 100%;
  grid-template-columns: var(--rail-icon-size) minmax(0, 1fr);
  justify-content: stretch;
  justify-items: start;
  align-items: center;
  gap: var(--rail-label-gap);
  border-radius: 12px;
  padding-right: 12px;
}

.rail-brand {
  margin: 0 0 8px;
}

.rail-brand .spark-mark {
  grid-column: 1;
  justify-self: center;
}

.rail-brand > .spark-mark,
.rail-nav a > svg,
.rail-action > svg,
.sidebar-avatar > svg,
.side-account-menu summary > .avatar-mark,
.side-settings-menu summary > svg {
  grid-column: 1;
  place-self: center;
  margin: 0;
}

.rail-label {
  min-width: 0;
  justify-self: start;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity 150ms ease,
    transform 180ms ease;
}

body.sidebar-expanded .rail-label {
  opacity: 1;
  transform: translateX(0);
}

.rail-expand-button {
  position: absolute;
  top: 66px;
  right: -12px;
  z-index: 2;
  width: 24px;
  min-height: 24px;
  border: 1px solid var(--warm-line);
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 253, 246, 0.94);
  color: var(--warm-green-strong);
  box-shadow: 0 8px 22px rgba(87, 70, 37, 0.1);
}

.rail-expand-button span {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}

body.sidebar-expanded .rail-expand-button span {
  transform: rotate(135deg);
}

.rail-nav {
  gap: 7px;
  min-height: 0;
  align-content: start;
}

.rail-action {
  border: 1px solid rgba(47, 122, 102, 0.16);
  background: rgba(223, 245, 233, 0.72);
  color: var(--warm-green-strong);
  cursor: pointer;
}

.rail-action:hover {
  background: var(--warm-mint-2);
}

.rail-action svg,
.sidebar-avatar svg,
.side-settings-menu summary > svg {
  width: var(--rail-icon-glyph);
  height: var(--rail-icon-glyph);
  display: block;
  place-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conversation-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding-top: 4px;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 220ms cubic-bezier(0.2, 0.78, 0.16, 1);
}

body.sidebar-expanded .conversation-panel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.conversation-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  color: var(--warm-muted);
  font-size: 12px;
  font-weight: 750;
}

.conversation-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.conversation-item {
  width: 100%;
  min-height: 50px;
  display: grid;
  gap: 4px;
  justify-items: start;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  color: var(--warm-ink-soft);
  text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
  border-color: var(--warm-line);
  background: rgba(255, 253, 246, 0.72);
  color: var(--warm-ink);
}

.conversation-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item small,
.conversation-empty span {
  color: var(--warm-muted);
  font-size: 11px;
}

.conversation-empty {
  display: grid;
  gap: 5px;
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 253, 246, 0.56);
  color: var(--warm-ink-soft);
  font-size: 12px;
}

.rail-bottom {
  display: grid;
  align-content: end;
  justify-items: stretch;
  gap: 8px;
}

.sidebar-avatar,
.side-account-menu summary,
.side-settings-menu summary {
  border: 1px solid var(--warm-line);
  background: rgba(255, 253, 246, 0.82);
  color: var(--warm-ink-soft);
}

.sidebar-avatar:hover,
.side-account-menu summary:hover,
.side-settings-menu summary:hover {
  background: rgba(223, 245, 233, 0.72);
  color: var(--warm-green-strong);
}

.avatar-mark {
  width: var(--rail-avatar-size);
  min-width: var(--rail-avatar-size);
  height: var(--rail-avatar-size);
  min-height: var(--rail-avatar-size);
  display: grid;
  place-items: center;
  place-self: center;
  border-radius: 999px;
  background: var(--warm-mint);
  color: var(--warm-green-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.side-account-menu,
.side-settings-menu {
  width: 100%;
}

.side-account-menu summary,
.side-settings-menu summary {
  cursor: pointer;
}

.side-account-menu summary::after,
.side-settings-menu summary::after {
  display: none;
}

.account-summary-text {
  min-width: 0;
  display: grid;
  gap: 3px;
  justify-self: start;
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity 150ms ease,
    transform 180ms ease;
}

body.sidebar-expanded .account-summary-text {
  opacity: 1;
  transform: translateX(0);
}

.account-summary-text .rail-label {
  opacity: 1;
  transform: none;
  max-width: 170px;
  font-size: 13px;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.account-tier-label {
  max-width: 170px;
  overflow: hidden;
  color: var(--warm-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
}

.side-account-menu .account-popover,
.side-settings-menu .account-popover {
  top: auto;
  right: auto;
  bottom: 2px;
  left: calc(100% + 12px);
  width: min(340px, calc(100vw - var(--side-rail-width) - 38px));
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 253, 246, 0.96);
  box-shadow: 0 24px 60px rgba(87, 70, 37, 0.16);
}

.side-settings-menu .account-popover {
  bottom: 52px;
}

.account-popover-user {
  display: grid;
  grid-template-columns: var(--rail-icon-size) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 4px 10px;
}

.account-popover-user .avatar-mark {
  place-self: center;
}

.account-popover-user strong,
.account-popover-user span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-popover-user strong {
  color: var(--warm-ink);
  font-size: 14px;
}

.account-popover-user span {
  margin-top: 3px;
  color: var(--warm-muted);
  font-size: 12px;
  font-weight: 700;
}

.menu-action {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--warm-ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.menu-action:hover {
  background: rgba(47, 122, 102, 0.07);
  color: var(--warm-green-strong);
}

.menu-separator {
  height: 1px;
  margin: 8px 0;
  background: var(--warm-line);
}

.admin-only-notice {
  margin: 0 auto;
  width: min(100%, 880px);
}

.network-page.is-admin-locked > :not([data-admin-lock]) {
  display: none !important;
}

.account-page {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 120px 0 64px;
}

.account-page-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-usage-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.network-page {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 120px 0 64px;
}

.network-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.network-primary-panel {
  background: linear-gradient(180deg, rgba(255, 253, 246, 0.98), rgba(255, 255, 255, 0.96));
  border-color: var(--warm-line-strong, var(--line));
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h3 {
  margin: 0;
}

.section-title-row p {
  margin: 6px 0 0;
  color: var(--warm-muted, var(--muted));
  line-height: 1.5;
}

.network-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 122, 102, 0.18);
  border-radius: 999px;
  padding: 0 9px;
  background: var(--warm-mint, var(--green-soft));
  color: var(--warm-green-strong, var(--green-dark));
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.network-form,
.network-search-form,
.compact-form {
  display: grid;
  gap: 12px;
}

.network-form {
  margin-top: 14px;
}

.network-form label {
  color: var(--warm-ink-soft, var(--soft-text));
  font-weight: 680;
}

.network-form select {
  width: 100%;
  border: 1px solid var(--warm-line, var(--line));
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--warm-ink, var(--text));
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.network-search-panel {
  border: 1px solid var(--warm-line, var(--line));
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 253, 246, 0.94);
  box-shadow: var(--shadow-soft);
}

.network-search-form {
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.35fr) minmax(120px, 0.35fr) auto;
  align-items: end;
}

.network-card-grid,
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.network-card,
.knowledge-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--warm-line, var(--line));
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.network-card h3,
.knowledge-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.network-card p,
.knowledge-card p {
  margin: 0;
  color: var(--warm-ink-soft, var(--soft-text));
  line-height: 1.55;
}

.network-chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.network-chip-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(223, 245, 233, 0.8);
  color: var(--warm-green-strong, var(--green-dark));
  font-size: 12px;
  font-weight: 700;
}

.network-empty {
  border: 1px dashed rgba(47, 122, 102, 0.24);
  border-radius: 14px;
  padding: 18px;
  background: rgba(255, 253, 246, 0.82);
  color: var(--warm-ink-soft, var(--soft-text));
  line-height: 1.6;
}

.network-empty.compact {
  padding: 12px;
  font-size: 13px;
}

.network-empty h3 {
  margin: 0 0 8px;
  color: var(--warm-ink, var(--text));
}

.network-empty p {
  margin: 0 0 14px;
}

.network-draft {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.network-draft h4 {
  margin: 0;
  font-size: 15px;
}

.network-draft p {
  margin: 0;
  color: var(--warm-ink-soft, var(--soft-text));
  line-height: 1.5;
}

.network-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.network-row {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(47, 122, 102, 0.13);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.network-row strong {
  color: var(--warm-ink, var(--text));
}

.network-row span {
  color: var(--warm-muted, var(--muted));
  font-size: 12px;
}

.network-row p {
  margin: 0;
  color: var(--warm-ink-soft, var(--soft-text));
  line-height: 1.5;
}

.attestation-row {
  background: rgba(255, 253, 246, 0.74);
}

.network-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.network-stat-row span {
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--warm-mint, var(--green-soft));
  color: var(--warm-green-strong, var(--green-dark));
  font-size: 13px;
  font-weight: 760;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: var(--warm-ink-soft, var(--soft-text));
  line-height: 1.7;
}

.network-membership-card {
  align-items: start;
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .side-rail,
  .rail-brand,
  .rail-nav a,
  .rail-action,
  .sidebar-avatar,
  .side-account-menu summary,
  .side-settings-menu summary,
  .rail-label,
  .conversation-panel,
  .rail-expand-button span {
    transition: none;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding-left: calc(var(--side-rail-width) + 14px);
  }

  .brand-block {
    left: calc(var(--side-rail-width) + 12px);
    transition: left 220ms cubic-bezier(0.2, 0.78, 0.16, 1);
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 72px 14px 20px;
  }

  .side-rail {
    width: 100%;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 1fr;
    gap: 8px;
    overflow: visible;
    padding: 0 12px;
  }

  .rail-expand-button,
  .conversation-panel,
  .rail-label {
    display: none;
  }

  .rail-brand,
  .rail-nav a,
  .rail-action,
  .sidebar-avatar,
  .side-account-menu summary,
  .side-settings-menu summary {
    width: var(--rail-icon-size);
    grid-template-columns: var(--rail-icon-size) 0;
    gap: 0;
    padding: 0;
    border-radius: 999px;
  }

  .rail-nav {
    display: flex;
    align-items: center;
  }

  .side-account-menu .account-popover,
  .side-settings-menu .account-popover {
    left: auto;
    right: 0;
    bottom: auto;
    top: calc(100% + 10px);
    width: min(310px, calc(100vw - 24px));
  }

  .account-page {
    padding-top: 88px;
  }

  .account-page-grid,
  .settings-grid,
  .account-usage-grid,
  .network-layout,
  .network-search-form {
    grid-template-columns: 1fr;
  }

.network-page {
    padding-top: 88px;
  }
}

/* Internal diagnostics are available in /admin only. The public chat should
   read like a normal conversation, not like an execution trace. */
.analysis-drawer {
  display: none !important;
}

.admin-page {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 96px 0 64px;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: minmax(260px, 0.76fr) minmax(0, 1.6fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  border: 1px solid var(--warm-line);
  border-radius: 18px;
  background: rgba(255, 253, 246, 0.84);
  box-shadow: 0 18px 44px rgba(87, 70, 37, 0.08);
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--warm-line);
}

.admin-panel-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.admin-panel-head p {
  margin: 0;
  color: var(--warm-ink-soft);
  font-size: 13px;
}

.admin-turns-panel {
  max-height: calc(100dvh - 132px);
  overflow: hidden;
}

.admin-turn-list {
  max-height: calc(100dvh - 212px);
  overflow: auto;
  padding: 10px;
}

.admin-turn-item {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px;
  background: transparent;
  color: var(--warm-ink);
  cursor: pointer;
}

.admin-turn-item:hover,
.admin-turn-item.active {
  border-color: rgba(47, 122, 102, 0.22);
  background: rgba(221, 246, 235, 0.48);
}

.admin-turn-title {
  font-weight: 760;
  line-height: 1.35;
}

.admin-turn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--warm-ink-soft);
  font-size: 12px;
}

.admin-turn-meta span {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(70, 88, 82, 0.08);
}

.admin-detail-panel {
  min-width: 0;
}

.admin-users-panel {
  grid-column: 1 / -1;
}

.admin-turn-detail {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.admin-detail-card {
  border: 1px solid var(--warm-line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.admin-detail-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.admin-kv {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.admin-kv dt,
.admin-label {
  color: var(--warm-ink-soft);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-kv dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-transcript {
  display: grid;
  gap: 12px;
}

.admin-transcript .markdown-body {
  margin-top: 6px;
  border-radius: 12px;
  padding: 12px;
  background: rgba(247, 244, 232, 0.72);
  white-space: pre-wrap;
}

.admin-audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-timing-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-timing-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(221, 246, 235, 0.42);
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--warm-line);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--warm-line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--warm-ink-soft);
  font-weight: 760;
  background: rgba(247, 244, 232, 0.72);
}

.admin-table td span {
  display: block;
  margin-top: 3px;
  color: var(--warm-ink-soft);
  font-size: 12px;
}

.admin-debug-block {
  min-width: 0;
  border: 1px solid var(--warm-line);
  border-radius: 12px;
  background: rgba(255, 253, 246, 0.72);
}

.admin-debug-block summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--warm-green-strong);
  font-weight: 760;
  cursor: pointer;
}

.admin-debug-block pre {
  max-height: 340px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--warm-line);
  padding: 12px;
  color: var(--warm-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-model-call-details {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-empty {
  border: 1px dashed var(--warm-line);
  border-radius: 14px;
  padding: 18px;
  color: var(--warm-ink-soft);
  background: rgba(255, 253, 246, 0.52);
}

@media (max-width: 980px) {
  .admin-dashboard,
  .admin-audit-grid {
    grid-template-columns: 1fr;
  }

  .admin-turns-panel {
    max-height: none;
  }

  .admin-turn-list {
    max-height: 360px;
  }

  .admin-kv {
    grid-template-columns: 1fr;
  }
}

/* Final chat-surface pass: once a conversation starts, the page should behave
   like a full-screen chat surface. The card remains only as a structural scroll
   container, not as a visible framed panel. */
body[data-route="home"].has-chat .home-view {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 58px clamp(28px, 6vw, 86px) 24px;
}

body[data-route="home"].has-chat .task-desk {
  width: 100%;
  max-width: none;
  height: calc(100dvh - 92px);
  min-height: 540px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
}

body[data-route="home"].has-chat .task-desk-head {
  display: none;
}

body[data-route="home"].has-chat .chat-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

body[data-route="home"].has-chat .chat-log {
  width: min(100%, 920px);
  height: 100%;
  margin: 0 auto;
  padding: 38px 0 108px;
}

body[data-route="home"].has-chat .composer {
  width: min(100%, 860px);
  justify-self: center;
}

body[data-route="home"].has-chat .analysis-drawer {
  width: min(100%, 860px);
  justify-self: center;
}

.side-rail {
  cursor: pointer;
}

.side-rail .account-popover,
.side-rail .account-popover * {
  cursor: auto;
}

.side-rail .account-popover a,
.side-rail .account-popover button,
.side-rail .account-popover summary {
  cursor: pointer;
}

.rail-action,
.rail-brand,
.side-account-menu summary,
.side-settings-menu summary,
.rail-expand-button {
  cursor: pointer;
}

@media (max-width: 700px) {
  body[data-route="home"].has-chat .home-view {
    min-height: calc(100dvh - 72px);
    padding: 74px 14px 18px;
  }

  body[data-route="home"].has-chat .task-desk {
    height: calc(100dvh - 108px);
    min-height: 460px;
  }

  body[data-route="home"].has-chat .chat-log {
    width: 100%;
    padding: 22px 2px 96px;
  }

  body[data-route="home"].has-chat .composer,
  body[data-route="home"].has-chat .analysis-drawer {
    width: 100%;
  }
}

/* Gemini-aligned rail and chat polish. This layer is intentionally last so it
   can normalize older sidebar/message rules without changing non-chat pages. */
:root {
  --rail-expand-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M14 8l-8 8 8 8' fill='none' stroke='%232f7a66' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M18 8l8 8-8 8z' fill='%232f7a66'/%3E%3C/svg%3E") 16 16, pointer;
}

body:not(.sidebar-expanded) .side-rail {
  cursor: var(--rail-expand-cursor);
}

body.sidebar-expanded .side-rail {
  cursor: default;
}

.rail-action,
.rail-brand,
.side-account-menu summary,
.side-settings-menu summary,
.rail-expand-button {
  cursor: pointer;
}

.rail-expand-button {
  top: 18px;
  right: 12px;
  width: 44px;
  min-height: 44px;
  border: 0;
  background: rgba(47, 122, 102, 0.08);
  color: var(--warm-green-strong);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.94);
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

body.sidebar-expanded .rail-expand-button {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

body.sidebar-expanded .rail-brand {
  width: calc(100% - 50px);
}

.rail-expand-button:hover {
  background: rgba(47, 122, 102, 0.14);
  color: var(--warm-ink);
}

.rail-expand-button::after {
  content: "关闭边栏";
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  min-width: 72px;
  transform: translateY(-50%) translateX(-4px);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 253, 246, 0.96);
  color: var(--warm-ink);
  box-shadow: 0 14px 34px rgba(87, 70, 37, 0.14);
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 180ms ease;
}

.rail-expand-button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.rail-expand-button span {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 7px;
  transform: none !important;
  transition:
    border-color 160ms ease,
    border-radius 160ms ease;
}

.rail-expand-button span::before,
.rail-expand-button span::after {
  content: "";
  position: absolute;
  display: block;
  transition:
    opacity 140ms ease,
    transform 160ms ease,
    width 160ms ease,
    height 160ms ease;
}

.rail-expand-button span::before {
  top: 4px;
  bottom: 4px;
  left: 6px;
  border-left: 2px solid currentColor;
}

.rail-expand-button span::after {
  left: 11px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.rail-expand-button:hover span {
  border-color: transparent;
  border-radius: 999px;
}

.rail-expand-button:hover span::before {
  opacity: 0;
}

.rail-expand-button:hover span::after {
  left: 6px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-left-width: 2.5px;
  border-bottom-width: 2.5px;
}

.rail-bottom {
  position: relative;
}

.side-settings-menu summary {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.side-settings-menu summary:hover {
  background: rgba(47, 122, 102, 0.08);
}

body.sidebar-expanded .side-settings-menu {
  position: absolute;
  right: 4px;
  bottom: 6px;
  z-index: 3;
  width: auto;
}

body.sidebar-expanded .side-settings-menu summary {
  width: var(--rail-icon-size);
  min-height: var(--rail-icon-size);
  grid-template-columns: var(--rail-icon-size);
  justify-content: center;
  justify-items: center;
  gap: 0;
  border-radius: 999px;
  padding: 0;
}

body.sidebar-expanded .side-settings-menu summary .rail-label {
  display: none;
}

body.sidebar-expanded .side-account-menu summary {
  padding-right: 52px;
}

body.sidebar-expanded .side-settings-menu .account-popover {
  bottom: 50px;
}

#homeView .message .role {
  display: none;
}

body[data-route="home"].has-chat .message {
  gap: 0;
}

body[data-route="home"].has-chat .message.user {
  justify-items: end;
  margin-bottom: 34px;
}

body[data-route="home"].has-chat .message.user .bubble {
  max-width: min(620px, 74%);
  border: 1px solid rgba(217, 149, 78, 0.24);
  border-radius: 18px;
  padding: 12px 15px;
  background: rgba(255, 246, 226, 0.94);
  box-shadow: none;
}

body[data-route="home"].has-chat .message.assistant {
  width: min(100%, 760px);
  margin-left: auto;
  margin-right: auto;
  justify-items: stretch;
}

body[data-route="home"].has-chat .message.assistant .bubble {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body[data-route="home"].has-chat .message.assistant .bubble > :first-child {
  margin-top: 0;
}

body[data-route="home"].has-chat .message.assistant .bubble > :last-child {
  margin-bottom: 0;
}

/* Cozy-pixel product surfaces */
:root {
  --cozy-cream: #fff8e6;
  --cozy-parchment: #fffdf3;
  --cozy-mint: #dff5e9;
  --cozy-mint-strong: #9fdcbd;
  --cozy-sage: #557a66;
  --cozy-wood: #b67845;
  --cozy-wood-dark: #83532e;
  --cozy-ink: #25352f;
  --cozy-muted: #6c7d72;
  --cozy-line: rgba(91, 119, 99, 0.22);
  --cozy-shadow: 0 18px 44px rgba(117, 93, 50, 0.12);
}

body[data-cozy-theme="night"] {
  --cozy-cream: #17221e;
  --cozy-parchment: #1e2a25;
  --cozy-mint: #243a31;
  --cozy-mint-strong: #6aa98b;
  --cozy-sage: #c0ddc9;
  --cozy-wood: #c89a66;
  --cozy-wood-dark: #efd2a5;
  --cozy-ink: #edf7ef;
  --cozy-muted: #adc1b3;
  --cozy-line: rgba(201, 230, 210, 0.2);
  --cozy-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

.cozy-town-page {
  width: min(100%, 1180px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 92px 28px 72px;
  color: var(--cozy-ink);
}

.cozy-heading {
  max-width: 760px;
  margin: 0 0 28px;
}

.cozy-heading .eyebrow,
.cozy-eyebrow {
  margin: 0 0 8px;
  color: var(--cozy-sage);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.cozy-heading h2 {
  margin: 0 0 10px;
  color: var(--cozy-ink);
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.03;
  text-wrap: balance;
}

.cozy-heading p {
  max-width: 62ch;
  color: var(--cozy-muted);
  font-size: 16px;
  line-height: 1.7;
}

.cozy-layout,
.town-board {
  display: grid;
  gap: 18px;
}

.cozy-panel,
.town-card {
  border: 1px solid var(--cozy-line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 230, 0.64)),
    var(--cozy-parchment);
  box-shadow: var(--cozy-shadow);
}

body[data-cozy-theme="night"] .cozy-panel,
body[data-cozy-theme="night"] .town-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(154, 203, 172, 0.08)),
    var(--cozy-parchment);
}

.cozy-panel {
  padding: 20px;
}

.cozy-section-title,
.town-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cozy-section-title {
  margin-bottom: 16px;
}

.cozy-section-title h3,
.town-card h3,
.cozy-card h4,
.resident-title-card h3 {
  margin: 0;
  color: var(--cozy-ink);
  line-height: 1.25;
}

.cozy-section-title p,
.cozy-card p,
.town-card p,
.resident-title-card p,
.capacity-meter p {
  margin: 6px 0 0;
  color: var(--cozy-muted);
  line-height: 1.6;
}

.town-card {
  position: relative;
  padding: 20px;
  overflow: hidden;
}

.town-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(176, 120, 69, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(176, 120, 69, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.8;
}

.town-card > * {
  position: relative;
}

.town-card.is-pinned {
  border-color: rgba(182, 120, 69, 0.5);
}

.town-card footer {
  margin-top: 14px;
  color: var(--cozy-muted);
  font-size: 13px;
}

.cozy-token {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(85, 122, 102, 0.16);
  border-radius: 6px;
  padding: 0 9px;
  background: var(--cozy-mint);
  color: #25624d;
  font-size: 12px;
  font-weight: 800;
}

.cozy-token.warm {
  border-color: rgba(182, 120, 69, 0.2);
  background: #f7e4bd;
  color: var(--cozy-wood-dark);
}

body[data-cozy-theme="night"] .cozy-token {
  color: var(--cozy-ink);
}

.cozy-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.cozy-card-list {
  display: grid;
  gap: 12px;
}

.cozy-card,
.cozy-row {
  border: 1px solid var(--cozy-line);
  border-radius: 8px;
  padding: 15px;
  background: rgba(255, 253, 243, 0.72);
}

body[data-cozy-theme="night"] .cozy-card,
body[data-cozy-theme="night"] .cozy-row {
  background: rgba(255, 255, 255, 0.04);
}

.cozy-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.pixel-button {
  min-height: 39px;
  border: 1px solid rgba(64, 113, 89, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #e7f8ee, #d8f1e4);
  color: #2d6b55;
  box-shadow: inset 0 -2px 0 rgba(68, 116, 91, 0.14);
  font-weight: 800;
}

.pixel-button:hover {
  background: linear-gradient(180deg, #eefbf3, #ccebdc);
  color: #215642;
  transform: translateY(-1px);
}

.text-button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--cozy-sage);
  font-weight: 800;
}

.text-button:hover {
  background: transparent;
  color: var(--cozy-wood-dark);
}

.text-button.danger {
  color: #a44939;
}

.capacity-meter {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.capacity-meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--cozy-ink);
}

.capacity-meter-head span {
  color: var(--cozy-muted);
  font-size: 13px;
}

.capacity-track {
  height: 14px;
  border: 1px solid rgba(85, 122, 102, 0.22);
  border-radius: 4px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.66);
}

.capacity-fill {
  height: 100%;
  display: block;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    #8fd6ae 0,
    #8fd6ae 10px,
    #77c79d 10px,
    #77c79d 20px
  );
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 12px;
}

.inventory-slot {
  min-height: 196px;
  display: grid;
  grid-template-rows: 96px auto auto auto;
  gap: 8px;
  border: 1px solid var(--cozy-line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 253, 243, 0.82);
}

.inventory-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(159, 220, 189, 0.2), rgba(246, 224, 181, 0.25)),
    rgba(255, 255, 255, 0.74);
}

.inventory-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inventory-thumb span,
.resident-mini-avatar,
.resident-badge {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cozy-mint);
  color: #2d6b55;
  font-weight: 900;
}

.inventory-slot h4,
.inventory-slot p {
  margin: 0;
}

.inventory-slot h4 {
  overflow: hidden;
  color: var(--cozy-ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-slot p {
  color: var(--cozy-muted);
  font-size: 12px;
}

.resident-title-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.resident-badge {
  min-height: 76px;
  padding: 8px;
  text-align: center;
  box-shadow: inset 0 -3px 0 rgba(68, 116, 91, 0.12);
}

.cozy-form {
  display: grid;
  gap: 13px;
}

.cozy-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.cozy-form label {
  display: grid;
  gap: 7px;
  color: var(--cozy-muted);
  font-size: 13px;
  font-weight: 800;
}

.cozy-form input,
.cozy-form textarea,
.cozy-form select {
  border: 1px solid var(--cozy-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--cozy-ink);
}

body[data-cozy-theme="night"] .cozy-form input,
body[data-cozy-theme="night"] .cozy-form textarea,
body[data-cozy-theme="night"] .cozy-form select {
  background: rgba(255, 255, 255, 0.06);
}

.published-form textarea {
  min-height: 118px;
}

.cozy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.resident-mini-avatar {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
}

.cozy-empty {
  border: 1px dashed var(--cozy-line);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 253, 243, 0.62);
  color: var(--cozy-muted);
}

.cozy-empty.compact {
  padding: 13px;
}

.cozy-empty h3 {
  margin: 0 0 8px;
  color: var(--cozy-ink);
}

.cozy-empty p {
  margin: 0;
}

@media (max-width: 720px) {
  .cozy-town-page {
    padding: 72px 18px 120px;
  }

  .cozy-form-grid,
  .resident-title-card {
    grid-template-columns: 1fr;
  }

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

/* Cozy-pixel town skin: original assets, Stardew-like warmth. */
:root {
  --pixel-ink: #2e222f;
  --pixel-muted: #625565;
  --pixel-earth: #9e4539;
  --pixel-earth-dark: #45293f;
  --pixel-wood: #a45a4a;
  --pixel-wood-light: #cd683d;
  --pixel-paper: #f3e6c8;
  --pixel-paper-soft: #fff6df;
  --pixel-grass: #1ebc73;
  --pixel-grass-dark: #165a4c;
  --pixel-mint: #c7f1d4;
  --pixel-mint-deep: #73c48f;
  --pixel-sky: #8fd3ff;
  --pixel-water: #4d9be6;
  --pixel-gold: #f9c22b;
  --pixel-shadow: rgba(69, 41, 63, 0.2);
  --pixel-panel-shadow: 0 16px 0 rgba(69, 41, 63, 0.08), 0 26px 46px rgba(69, 41, 63, 0.12);
  --bg: #fff6df;
  --panel: #fffaf0;
  --panel-soft: #f3e6c8;
  --line: rgba(69, 41, 63, 0.2);
  --line-strong: rgba(69, 41, 63, 0.35);
  --text: var(--pixel-ink);
  --muted: var(--pixel-muted);
  --green: #239063;
  --green-dark: var(--pixel-grass-dark);
  --green-soft: #e6f6e8;
  --bubble: #fffaf0;
  --shadow: var(--pixel-panel-shadow);
  --shadow-soft: 0 4px 0 rgba(69, 41, 63, 0.08), 0 12px 22px rgba(69, 41, 63, 0.08);
}

body[data-cozy-theme="night"] {
  --bg: #171126;
  --panel: #241936;
  --panel-soft: #302042;
  --line: rgba(199, 220, 208, 0.18);
  --line-strong: rgba(199, 220, 208, 0.32);
  --text: #f3e6c8;
  --muted: #c4b7a6;
  --green: #73bed3;
  --green-dark: #8fd3ff;
  --green-soft: rgba(115, 190, 211, 0.16);
  --bubble: #241936;
  --pixel-paper: #241936;
  --pixel-paper-soft: #2f2442;
  --pixel-shadow: rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

html {
  background: var(--bg);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 62%, rgba(30, 188, 115, 0.2) 0 12%, transparent 29%),
    radial-gradient(circle at 78% 18%, rgba(249, 194, 43, 0.2) 0 5%, transparent 18%),
    linear-gradient(180deg, #fffdf0 0%, #fff6df 44%, #f4e7c6 100%);
  color: var(--text);
  font-family:
    "Nunito Sans", "Avenir Next", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
}

body[data-cozy-theme="night"] {
  background:
    radial-gradient(circle at 50% 60%, rgba(77, 155, 230, 0.18) 0 13%, transparent 31%),
    radial-gradient(circle at 78% 14%, rgba(249, 194, 43, 0.13) 0 4%, transparent 15%),
    linear-gradient(180deg, #100b1f 0%, #181229 48%, #231a35 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  opacity: 0.62;
  background:
    linear-gradient(90deg, rgba(69, 41, 63, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(69, 41, 63, 0.026) 1px, transparent 1px) 0 0 / 24px 24px;
  image-rendering: pixelated;
}

body::after {
  z-index: 0;
  top: auto;
  height: 176px;
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(35, 144, 99, 0.3) 48% 52%, transparent 52%) 0 32px / 46px 46px repeat-x,
    linear-gradient(0deg, #165a4c 0 16px, #239063 16px 44px, #91db69 44px 62px, transparent 62px),
    linear-gradient(90deg, rgba(69, 41, 63, 0.18) 1px, transparent 1px) 0 58px / 32px 32px;
  opacity: 0.22;
  image-rendering: pixelated;
}

body[data-cozy-theme="night"]::before {
  opacity: 0.36;
  background:
    radial-gradient(circle, rgba(243, 230, 200, 0.55) 0 1px, transparent 2px) 20px 26px / 116px 92px,
    linear-gradient(90deg, rgba(243, 230, 200, 0.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(243, 230, 200, 0.02) 1px, transparent 1px) 0 0 / 24px 24px;
}

body[data-cozy-theme="night"]::after {
  opacity: 0.18;
  filter: saturate(0.72) brightness(0.75);
}

.app-shell,
.topbar,
.site-main,
.side-rail,
.account-popover {
  position: relative;
  z-index: 1;
}

.topbar {
  display: none;
}

.app-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
}

body.sidebar-expanded .app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
}

.site-main {
  min-width: 0;
  padding: 0;
}

.side-rail {
  position: sticky;
  top: 0;
  width: 74px;
  height: 100dvh;
  padding: 22px 14px 18px;
  background:
    linear-gradient(90deg, rgba(255, 246, 223, 0.98), rgba(255, 246, 223, 0.9)),
    repeating-linear-gradient(0deg, rgba(164, 90, 74, 0.08) 0 2px, transparent 2px 10px);
  border-right: 3px solid rgba(69, 41, 63, 0.12);
  border-radius: 0;
  box-shadow: 8px 0 0 rgba(69, 41, 63, 0.04);
}

body[data-cozy-theme="night"] .side-rail {
  background:
    linear-gradient(90deg, rgba(22, 16, 35, 0.98), rgba(31, 23, 47, 0.94)),
    repeating-linear-gradient(0deg, rgba(143, 211, 255, 0.05) 0 2px, transparent 2px 10px);
  border-right-color: rgba(243, 230, 200, 0.12);
  box-shadow: 8px 0 0 rgba(0, 0, 0, 0.16);
}

body.sidebar-expanded .side-rail {
  width: 286px;
  padding-inline: 18px;
}

.spark-mark {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background:
    linear-gradient(45deg, transparent 0 36%, #f9c22b 36% 43%, #1ebc73 43% 58%, #4d9be6 58% 64%, transparent 64%),
    linear-gradient(135deg, transparent 0 35%, #f3e6c8 35% 47%, #239063 47% 58%, transparent 58%);
  box-shadow: 0 3px 0 rgba(69, 41, 63, 0.12);
  image-rendering: pixelated;
}

.rail-brand,
.rail-action,
.account-menu > summary {
  border-radius: 8px;
  color: var(--text);
}

.rail-brand,
.rail-action {
  min-height: 44px;
}

.rail-action {
  background: rgba(199, 241, 212, 0.52);
  border: 2px solid rgba(35, 144, 99, 0.18);
  box-shadow: inset 0 -3px 0 rgba(35, 144, 99, 0.08);
}

.rail-action:hover,
.rail-action.active,
.account-menu > summary:hover {
  background: rgba(199, 241, 212, 0.82);
  border-color: rgba(35, 144, 99, 0.36);
  transform: translateY(-1px);
}

body[data-cozy-theme="night"] .rail-action,
body[data-cozy-theme="night"] .rail-action:hover,
body[data-cozy-theme="night"] .account-menu > summary:hover {
  background: rgba(115, 190, 211, 0.14);
  border-color: rgba(143, 211, 255, 0.2);
}

.rail-action svg,
.rail-brand svg,
.account-menu svg,
.composer-icon-button svg {
  stroke-width: 2;
}

.rail-expand-button {
  top: 84px;
  right: 9px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(69, 41, 63, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 4px 0 rgba(69, 41, 63, 0.1);
}

body.sidebar-expanded .rail-expand-button {
  right: 12px;
}

.rail-expand-button:hover {
  background: #fff6df;
  box-shadow: 0 5px 0 rgba(69, 41, 63, 0.12);
}

.rail-expand-button::after {
  border-radius: 7px;
  background: var(--pixel-ink);
  color: var(--pixel-paper-soft);
  box-shadow: 0 4px 0 rgba(69, 41, 63, 0.16);
}

.rail-expand-button span::before,
.rail-expand-button span::after {
  background: var(--pixel-ink);
}

.conversation-panel-head {
  color: var(--muted);
  font-weight: 800;
}

.conversation-item,
.network-empty,
.conversation-empty {
  border: 2px solid rgba(69, 41, 63, 0.13);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
  box-shadow: inset 0 -3px 0 rgba(69, 41, 63, 0.05);
}

.conversation-item:hover,
.conversation-item.active {
  background: rgba(199, 241, 212, 0.86);
  border-color: rgba(35, 144, 99, 0.32);
}

.rail-bottom {
  gap: 10px;
}

.side-settings-menu > summary {
  width: 42px;
  height: 42px;
  margin: 0 auto 4px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.sidebar-expanded .side-settings-menu > summary {
  margin-left: auto;
  margin-right: 0;
}

.side-settings-menu > summary:hover {
  background: rgba(199, 241, 212, 0.72);
}

.side-account-menu > summary {
  min-height: 50px;
  border: 2px solid rgba(69, 41, 63, 0.14);
  background: rgba(255, 250, 240, 0.76);
  box-shadow: inset 0 -3px 0 rgba(69, 41, 63, 0.06);
}

.avatar-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(249, 194, 43, 0.18), rgba(199, 241, 212, 0.6)),
    #c7f1d4;
  border: 2px solid rgba(35, 144, 99, 0.18);
  color: #165a4c;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(35, 144, 99, 0.1);
}

.account-popover {
  border: 3px solid rgba(69, 41, 63, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.97), rgba(243, 230, 200, 0.96));
  box-shadow: 0 12px 0 rgba(69, 41, 63, 0.08), 0 28px 60px rgba(69, 41, 63, 0.22);
}

body[data-cozy-theme="night"] .account-popover {
  background:
    linear-gradient(180deg, rgba(36, 25, 54, 0.98), rgba(29, 22, 43, 0.98));
}

.menu-action,
.menu-button,
.secondary-button,
.pixel-button {
  border-radius: 8px;
  border: 2px solid rgba(69, 41, 63, 0.16);
  background: rgba(255, 250, 240, 0.72);
  color: var(--text);
  box-shadow: inset 0 -3px 0 rgba(69, 41, 63, 0.06);
}

.menu-action:hover,
.menu-button:hover,
.secondary-button:hover,
.pixel-button:hover {
  background: rgba(199, 241, 212, 0.8);
  color: var(--text);
  transform: translateY(-1px);
}

.home-view,
.pricing-page,
.capabilities-page,
.network-page,
.account-page,
.admin-page,
.cozy-town-page {
  min-height: 100dvh;
  padding: clamp(28px, 6vh, 90px) clamp(24px, 7vw, 116px) 128px;
}

.home-view {
  display: grid;
  align-content: center;
  gap: 22px;
}

body[data-route="home"].has-chat .home-view {
  align-content: stretch;
  padding-top: 38px;
}

.home-hero {
  max-width: 940px;
  margin-inline: auto;
  padding: 0;
  text-align: center;
}

.home-hero .eyebrow,
.page-heading .eyebrow,
.cozy-heading .eyebrow {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(249, 194, 43, 0.2);
  color: #165a4c;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: none;
  box-shadow: inset 0 -2px 0 rgba(249, 194, 43, 0.22);
}

.home-hero h2,
.page-heading h2,
.cozy-heading h2 {
  margin: 14px 0 8px;
  color: var(--text);
  font-family:
    "Trebuchet MS", "Avenir Next", "PingFang SC", system-ui, sans-serif;
  font-size: clamp(42px, 6.8vw, 84px);
  line-height: 1.03;
  font-weight: 900;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 4px 0 rgba(249, 194, 43, 0.16);
}

.home-hero p:not(.eyebrow),
.page-heading p,
.cozy-heading p {
  max-width: 760px;
  margin-inline: auto;
  color: var(--muted);
  font-size: clamp(16px, 1.9vw, 20px);
  font-weight: 700;
  line-height: 1.7;
}

.task-desk {
  width: min(960px, 100%);
  margin-inline: auto;
  display: grid;
  gap: 18px;
}

.task-desk-head {
  display: none;
}

.session-notice {
  width: min(900px, 100%);
  margin-inline: auto;
  border: 2px solid rgba(35, 144, 99, 0.24);
  border-radius: 8px;
  background: rgba(199, 241, 212, 0.72);
  color: #165a4c;
  box-shadow: inset 0 -3px 0 rgba(35, 144, 99, 0.08);
}

.composer {
  position: fixed;
  left: calc(74px + (100vw - 74px) / 2);
  right: auto;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: min(920px, calc(100vw - 132px));
  transform: translateX(-50%);
  padding: 0;
  z-index: 8;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.sidebar-expanded .composer {
  left: calc(286px + (100vw - 286px) / 2);
  width: min(920px, calc(100vw - 344px));
}

.composer-shell {
  min-height: 58px;
  border: 3px solid rgba(69, 41, 63, 0.14);
  border-radius: 13px;
  padding: 8px 9px 8px 12px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(255, 246, 223, 0.95));
  box-shadow: 0 8px 0 rgba(69, 41, 63, 0.08), 0 18px 42px rgba(69, 41, 63, 0.16);
  backdrop-filter: blur(12px);
}

body[data-cozy-theme="night"] .composer-shell {
  background:
    linear-gradient(180deg, rgba(36, 25, 54, 0.98), rgba(29, 22, 43, 0.96));
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2), 0 18px 42px rgba(0, 0, 0, 0.34);
}

.composer textarea {
  min-height: 36px;
  max-height: 120px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.composer textarea::placeholder {
  color: rgba(98, 85, 101, 0.72);
}

.composer-icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: rgba(98, 85, 101, 0.78);
  box-shadow: none;
}

.composer-icon-button:hover {
  background: rgba(199, 241, 212, 0.68);
  color: #165a4c;
}

.composer-primary-actions {
  align-items: center;
  gap: 8px;
}

.model-pill {
  color: rgba(98, 85, 101, 0.72);
  font-weight: 900;
}

#sendButton {
  min-width: 70px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #91db69, #1ebc73);
  color: #123d31;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(22, 90, 76, 0.16), 0 3px 0 rgba(69, 41, 63, 0.1);
}

#sendButton:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

#sendButton:disabled {
  background: #dfe7d7;
  color: rgba(98, 85, 101, 0.55);
}

.chat-card {
  min-height: 44vh;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-route="home"].home-empty .chat-card,
body[data-route="home"].has-chat .chat-card,
body[data-route="home"].home-empty .chat-card:has(.empty-state) {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.chat-log {
  width: min(940px, 100%);
  margin: 0 auto;
  padding-bottom: 118px;
}

body[data-route="home"].home-empty .chat-log {
  min-height: 20vh;
}

.empty-state {
  width: min(640px, 100%);
  margin: 0 auto;
  border: 2px solid rgba(35, 144, 99, 0.22);
  border-radius: 10px;
  background: rgba(255, 250, 240, 0.62);
  color: var(--muted);
  box-shadow: inset 0 -3px 0 rgba(69, 41, 63, 0.04);
}

.empty-state strong {
  color: var(--text);
}

.message {
  max-width: 100%;
  margin: 38px 0;
}

#homeView .message .role,
#homeView .message.assistant .message-meta {
  display: none;
}

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

.message.user .bubble {
  max-width: min(560px, 72vw);
  border: 2px solid rgba(249, 194, 43, 0.35);
  border-radius: 12px;
  background: rgba(255, 246, 223, 0.88);
  color: var(--text);
  box-shadow: inset 0 -3px 0 rgba(249, 194, 43, 0.12);
}

.message.assistant {
  align-items: flex-start;
}

.message.assistant .bubble,
body[data-route="home"].has-chat .message.assistant .bubble {
  width: min(880px, 100%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 17px;
  line-height: 1.85;
}

.message.pending .bubble {
  padding: 14px 18px;
  border: 2px solid rgba(35, 144, 99, 0.22);
  border-radius: 10px;
  background: rgba(199, 241, 212, 0.54);
}

.message.failed .bubble {
  padding: 14px 18px;
  border: 2px solid rgba(158, 69, 57, 0.28);
  border-radius: 10px;
  background: rgba(255, 228, 204, 0.7);
}

.message .message-meta {
  color: rgba(98, 85, 101, 0.7);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: var(--text);
}

.markdown-body code {
  border-radius: 4px;
  background: rgba(69, 41, 63, 0.08);
  color: var(--pixel-grass-dark);
}

.markdown-body pre {
  border: 2px solid rgba(69, 41, 63, 0.16);
  border-radius: 8px;
  background: rgba(46, 34, 47, 0.92);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.analysis-drawer {
  display: none;
}

.page-heading,
.cozy-heading {
  max-width: 1080px;
  margin: 0 auto 28px;
}

.pricing-layout,
.capability-layout,
.network-layout,
.account-page-grid,
.settings-grid,
.usage-grid,
.admin-dashboard,
.town-board,
.cozy-layout,
.knowledge-grid {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.pricing-card,
.feature-card,
.credit-card,
.network-card,
.knowledge-card,
.panel-section,
.admin-panel,
.cozy-panel,
.town-card,
.cozy-card,
.cozy-row,
.capacity-meter,
.resident-title-card,
.network-search-panel {
  border: 3px solid rgba(69, 41, 63, 0.16);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.97), rgba(243, 230, 200, 0.94));
  box-shadow: 0 6px 0 rgba(69, 41, 63, 0.08), 0 18px 40px rgba(69, 41, 63, 0.1);
}

body[data-cozy-theme="night"] .pricing-card,
body[data-cozy-theme="night"] .feature-card,
body[data-cozy-theme="night"] .credit-card,
body[data-cozy-theme="night"] .network-card,
body[data-cozy-theme="night"] .knowledge-card,
body[data-cozy-theme="night"] .panel-section,
body[data-cozy-theme="night"] .admin-panel,
body[data-cozy-theme="night"] .cozy-panel,
body[data-cozy-theme="night"] .town-card,
body[data-cozy-theme="night"] .cozy-card,
body[data-cozy-theme="night"] .cozy-row,
body[data-cozy-theme="night"] .capacity-meter,
body[data-cozy-theme="night"] .resident-title-card,
body[data-cozy-theme="night"] .network-search-panel {
  background:
    linear-gradient(180deg, rgba(36, 25, 54, 0.98), rgba(31, 23, 47, 0.95));
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.24), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.pricing-card::before,
.feature-card::before,
.credit-card::before,
.town-card::before,
.cozy-panel::before,
.panel-section::before,
.knowledge-card::before {
  content: "";
  display: block;
  height: 6px;
  margin: -1px -1px 14px;
  border-radius: 8px 8px 3px 3px;
  background:
    linear-gradient(90deg, #9e4539 0 16%, #cd683d 16% 26%, #9e4539 26% 46%, #a45a4a 46% 66%, #cd683d 66% 78%, #9e4539 78%);
  image-rendering: pixelated;
}

.pricing-card h3,
.feature-card h3,
.credit-card h3,
.cozy-card h4,
.panel-section h3,
.knowledge-card h3,
.town-card h3 {
  color: var(--text);
  font-weight: 900;
}

.pricing-card .price,
.credit-card strong {
  font-variant-numeric: tabular-nums;
}

.pricing-card button,
.feature-card button,
.credit-card button,
.network-card button,
.form-actions button {
  border-radius: 8px;
  border: 2px solid rgba(35, 144, 99, 0.22);
  background: rgba(199, 241, 212, 0.8);
  color: #165a4c;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(35, 144, 99, 0.1);
}

.pricing-card button:hover,
.feature-card button:hover,
.credit-card button:hover,
.network-card button:hover,
.form-actions button:hover {
  background: #c7f1d4;
}

.cozy-token,
.network-chip,
.task-status-row span {
  border-radius: 5px;
  background: rgba(199, 241, 212, 0.72);
  color: #165a4c;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 rgba(35, 144, 99, 0.08);
}

.town-board {
  display: grid;
  gap: 18px;
}

.town-card {
  position: relative;
  padding: 22px;
}

.town-card.pinned {
  border-color: rgba(249, 194, 43, 0.46);
}

.town-card.pinned::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 19px;
  width: 18px;
  height: 18px;
  background: #f9c22b;
  box-shadow: 0 4px 0 rgba(69, 41, 63, 0.12);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.inventory-grid {
  gap: 14px;
}

.inventory-slot,
.backpack-expansion-card {
  min-height: 148px;
  border: 3px solid rgba(69, 41, 63, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.93), rgba(243, 230, 200, 0.88)),
    repeating-linear-gradient(45deg, rgba(69, 41, 63, 0.04) 0 6px, transparent 6px 12px);
  box-shadow: inset 0 -5px 0 rgba(69, 41, 63, 0.06);
}

.capacity-track {
  border: 2px solid rgba(69, 41, 63, 0.16);
  background: rgba(69, 41, 63, 0.08);
  box-shadow: inset 0 2px 0 rgba(69, 41, 63, 0.06);
}

.capacity-fill {
  background:
    linear-gradient(90deg, #1ebc73, #91db69 56%, #f9c22b);
}

.cozy-form input,
.cozy-form textarea,
.cozy-form select,
.network-search-form input,
.network-search-form textarea,
.panel-section textarea {
  border: 2px solid rgba(69, 41, 63, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: inset 0 3px 0 rgba(69, 41, 63, 0.05);
}

body[data-cozy-theme="night"] .cozy-form input,
body[data-cozy-theme="night"] .cozy-form textarea,
body[data-cozy-theme="night"] .cozy-form select,
body[data-cozy-theme="night"] .network-search-form input,
body[data-cozy-theme="night"] .network-search-form textarea,
body[data-cozy-theme="night"] .panel-section textarea {
  background: rgba(24, 18, 41, 0.75);
}

.resident-title-card {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.friend-card,
.published-card {
  border: 2px solid rgba(69, 41, 63, 0.14);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
}

.admin-dashboard {
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.4fr) minmax(220px, 0.8fr);
}

body[data-route="admin"] .side-rail,
body[data-route="admin"] .topbar {
  z-index: 4;
}

@media (max-width: 980px) {
  .app-shell,
  body.sidebar-expanded .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: fixed;
    z-index: 20;
    width: 74px;
  }

  body.sidebar-expanded .side-rail {
    width: min(286px, calc(100vw - 18px));
  }

  .home-view,
  .pricing-page,
  .capabilities-page,
  .network-page,
  .account-page,
  .admin-page,
  .cozy-town-page {
    padding-left: 96px;
    padding-right: 18px;
  }

  .composer,
  body.sidebar-expanded .composer {
    left: calc(74px + (100vw - 74px) / 2);
    width: calc(100vw - 104px);
  }

  .home-hero h2,
  .page-heading h2,
  .cozy-heading h2 {
    font-size: clamp(38px, 9vw, 60px);
  }

  .admin-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-view,
  .pricing-page,
  .capabilities-page,
  .network-page,
  .account-page,
  .admin-page,
  .cozy-town-page {
    padding-left: 86px;
    padding-right: 14px;
  }

  .composer,
  body.sidebar-expanded .composer {
    width: calc(100vw - 96px);
  }

  .composer-primary-actions {
    gap: 4px;
  }

  .model-pill {
    display: none;
  }

  .message.user .bubble {
    max-width: min(80vw, 420px);
  }
}

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

/* Final sidebar hit-target normalization for the cozy skin. */
body:not(.sidebar-expanded) .rail-expand-button {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-expanded .rail-expand-button {
  top: 18px;
  right: 18px;
  z-index: 6;
  display: grid;
  width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  opacity: 1;
  pointer-events: auto;
}

.rail-expand-button::after {
  display: none;
}

body:not(.sidebar-expanded) .composer {
  left: calc(74px + (100vw - 74px) / 2) !important;
  width: min(920px, calc(100vw - 126px)) !important;
  max-width: calc(100vw - 126px) !important;
  transform: translateX(-50%) !important;
}

body.sidebar-expanded .composer {
  left: calc(286px + (100vw - 286px) / 2) !important;
  width: min(880px, calc(100vw - 334px)) !important;
  max-width: calc(100vw - 334px) !important;
  transform: translateX(-50%) !important;
}

.composer,
.composer-shell {
  box-sizing: border-box;
}

@media (max-width: 980px) {
  body:not(.sidebar-expanded) .composer,
  body.sidebar-expanded .composer {
    left: calc(74px + (100vw - 74px) / 2) !important;
    width: calc(100vw - 104px) !important;
    max-width: calc(100vw - 104px) !important;
  }
}

/* Chat mode uses the task desk grid, not the fixed landing composer. */
body[data-route="home"].has-chat .composer,
body.sidebar-expanded[data-route="home"].has-chat .composer {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: min(860px, 100%) !important;
  max-width: 100% !important;
  transform: none !important;
  justify-self: center;
  align-self: end;
}
