:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-2: #fbfcff;
  --ink: #111216;
  --muted: #6d7078;
  --soft: #8f939c;
  --line: rgba(17, 18, 22, 0.1);
  --line-soft: rgba(17, 18, 22, 0.065);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --violet: #7d5cff;
  --violet-2: #a58cff;
  --violet-soft: rgba(125, 92, 255, 0.12);
  --gold: #c7a062;
  --cyan: #00a6a6;
  --green: #30d158;
  --red: #ff3b30;
  --shadow: 0 34px 100px rgba(36, 42, 58, 0.14);
  --soft-shadow: 0 18px 54px rgba(36, 42, 58, 0.1);
  --radius-xl: 36px;
  --radius-lg: 30px;
  --radius-md: 24px;
  --radius-sm: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

body.night-mode {
  color-scheme: dark;
  --bg: #101018;
  --bg-2: #151521;
  --ink: #f7f5ff;
  --muted: #a9a7b6;
  --soft: #858394;
  --line: rgba(247, 245, 255, 0.12);
  --line-soft: rgba(247, 245, 255, 0.075);
  --glass: rgba(24, 24, 36, 0.7);
  --glass-strong: rgba(31, 31, 46, 0.92);
  --violet-soft: rgba(125, 92, 255, 0.18);
  --shadow: 0 34px 100px rgba(0, 0, 0, 0.32);
  --soft-shadow: 0 18px 54px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 8%, rgba(125, 92, 255, 0.16), transparent 26%),
    radial-gradient(circle at 6% 16%, rgba(0, 166, 166, 0.08), transparent 24%),
    radial-gradient(circle at 76% 86%, rgba(199, 160, 98, 0.1), transparent 25%),
    linear-gradient(90deg, rgba(125, 92, 255, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 18, 22, 0.038) 1px, transparent 1px),
    linear-gradient(160deg, var(--bg-2), var(--bg));
  background-size: auto, auto, auto, 48px 48px, 48px 48px, auto;
}

body.night-mode {
  background:
    radial-gradient(circle at 78% 8%, rgba(125, 92, 255, 0.2), transparent 26%),
    radial-gradient(circle at 6% 16%, rgba(0, 166, 166, 0.1), transparent 24%),
    radial-gradient(circle at 76% 86%, rgba(199, 160, 98, 0.09), transparent 25%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(160deg, var(--bg-2), var(--bg));
  background-size: auto, auto, auto, 48px 48px, 48px 48px, auto;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

.cosmos-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aura {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.35;
}

.aura-violet {
  top: -90px;
  right: 10%;
  background: rgba(125, 92, 255, 0.38);
}

.aura-cyan {
  bottom: 12%;
  left: -120px;
  background: rgba(0, 166, 166, 0.16);
}

.aura-gold {
  right: 16%;
  bottom: -120px;
  background: rgba(199, 160, 98, 0.16);
}

.app-shell {
  min-height: 100vh;
  padding: 16px 30px 34px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 30;
  display: flex;
  width: min(1480px, calc(100vw - 60px));
  min-height: 58px;
  margin: 0 auto 42px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: 0 18px 50px rgba(36, 42, 58, 0.09);
  backdrop-filter: blur(24px) saturate(160%);
}

.brand,
.nav-list,
.top-actions,
.auth-actions,
.auth-status,
.hero-actions,
.home-chip-row,
.status-grid,
.spatial-top,
.traffic,
.dock,
.role-strip,
.composer-actions,
.signal-row,
.memory-card-meta,
.memory-card-foot,
.memory-detail-head,
.section-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  text-decoration: none;
}

.brand-mark,
.seal,
.dao-mark,
.dock-icon,
.role-avatar,
.role-avatar-large,
.saved-role span,
.report-grid article > span {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--violet), var(--violet-2));
  box-shadow: 0 14px 30px rgba(125, 92, 255, 0.24);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  font-weight: 900;
}

.logo-mark {
  overflow: hidden;
  background: #08090d;
  box-shadow:
    0 14px 30px rgba(125, 92, 255, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seal.logo-mark {
  border-radius: 15px;
}

.dao-mark.logo-mark {
  padding: 0;
  border-radius: 24px;
  background: #08090d;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  font-weight: 820;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-list {
  gap: clamp(18px, 3.2vw, 44px);
}

.nav-item {
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
}

.top-actions {
  justify-content: flex-end;
  gap: 10px;
}

.model-picker,
.auth-status {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

body.night-mode .model-picker,
body.night-mode .auth-status,
body.night-mode .secondary-button,
body.night-mode .icon-button,
body.night-mode .home-chip-row span,
body.night-mode .home-chip,
body.night-mode .status-grid span,
body.night-mode .module-chip,
body.night-mode .auth-tabs,
body.night-mode .memory-mini-item {
  background: rgba(31, 31, 46, 0.72);
}

.model-picker {
  display: grid;
  grid-template-columns: auto minmax(92px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.model-picker select {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 780;
  outline: 0;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
}

.icon-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 8px var(--violet-soft);
}

.auth-actions,
.account-actions {
  gap: 8px;
}

.credit-chip,
.account-entry {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(31, 36, 58, 0.06);
}

.credit-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--ink);
}

.credit-chip b {
  font-size: 13px;
  font-weight: 860;
}

.credit-chip small {
  color: var(--violet);
  font-size: 11px;
  font-weight: 820;
}

.credit-dot {
  width: 18px;
  height: 18px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--violet), #9a7bff);
  box-shadow: 0 0 0 5px var(--violet-soft);
}

.account-entry {
  display: grid;
  width: 44px;
  place-items: center;
  color: #fff;
}

.account-entry span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--violet), #4d88ff);
  font-weight: 900;
}

body.night-mode .credit-chip,
body.night-mode .account-entry {
  background: rgba(31, 31, 46, 0.72);
}

.auth-status {
  gap: 10px;
  padding: 0 8px 0 12px;
}

.auth-status span {
  color: var(--violet);
  font-size: 13px;
  font-weight: 780;
}

.auth-status button {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(17, 18, 22, 0.07);
  color: var(--muted);
}

.main {
  width: min(1480px, calc(100vw - 60px));
  margin: 0 auto;
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.home-hero {
  display: grid;
  min-height: calc(100vh - 120px);
  grid-template-columns: minmax(410px, 0.88fr) minmax(680px, 1.12fr);
  gap: 32px;
  align-items: center;
}

.home-copy {
  padding: 20px 0 30px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--violet);
  font-size: 13px;
  font-weight: 820;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(58px, 6.6vw, 104px);
  line-height: 0.98;
  font-weight: 840;
}

.lead,
.section-copy,
.report-grid p,
.source-card p,
.mini-stack span,
.message p,
.memory-card-select > span:not(.memory-card-meta):not(.memory-card-foot),
.memory-detail-panel p,
.memory-detail-panel li,
.memory-mini-list p,
.memory-mini-item span,
.profile-summary p {
  color: var(--muted);
  line-height: 1.72;
}

.lead {
  max-width: 650px;
  margin: 24px 0 28px;
  font-size: 18px;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.primary-button,
.secondary-button,
.mini-button,
.auth-tab,
.module-chip,
.home-chip,
.dock-item {
  border-radius: 999px;
  font-weight: 780;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border: 1px solid transparent;
  padding: 0 20px;
}

.primary-button {
  color: #fff;
  background: var(--violet);
  box-shadow: 0 16px 38px rgba(125, 92, 255, 0.28);
}

.secondary-button {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.secondary-button.danger {
  color: var(--red);
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 38px;
  padding: 0 14px;
}

.primary-button.small {
  min-width: 82px;
  min-height: 40px;
}

.primary-button.full,
.secondary-button.full {
  width: 100%;
}

.home-ask-card,
.glass-panel,
.spatial-board,
.main-window,
.float-card,
.dock,
.role-panel,
.modal {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(28px) saturate(150%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.home-ask-card {
  max-width: 650px;
  padding: 14px;
  border-radius: var(--radius-lg);
}

.prompt-composer {
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.prompt-composer:focus-within {
  border-color: rgba(125, 92, 255, 0.32);
  box-shadow: 0 0 0 5px rgba(125, 92, 255, 0.1), var(--soft-shadow);
}

.prompt-composer.is-dragging {
  border-color: rgba(125, 92, 255, 0.48);
  background: rgba(125, 92, 255, 0.08);
  box-shadow: 0 0 0 5px rgba(125, 92, 255, 0.12), var(--soft-shadow);
}

.home-ask-card textarea,
.ask-composer textarea,
.followup-box input,
.auth-form input,
.role-form input,
.role-form select,
.modal input,
.modal select,
.memory-toolbar input,
.memory-toolbar select {
  width: 100%;
  border: 1px solid rgba(17, 18, 22, 0.08);
  border-radius: 20px;
  background: rgba(251, 252, 255, 0.82);
  color: var(--ink);
  outline: 0;
}

body.night-mode .home-ask-card textarea,
body.night-mode .ask-composer textarea,
body.night-mode .followup-box input,
body.night-mode .auth-form input,
body.night-mode .role-form input,
body.night-mode .role-form select,
body.night-mode .modal input,
body.night-mode .modal select,
body.night-mode .memory-toolbar input,
body.night-mode .memory-toolbar select {
  background: rgba(17, 17, 27, 0.72);
}

.home-ask-card textarea {
  min-height: 84px;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  resize: none;
  line-height: 1.6;
}

.compact-composer .composer-foot {
  margin-top: 10px;
}

.home-chip-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.home-chip-row span,
.home-chip,
.status-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.home-chip-row span,
.home-chip {
  min-height: 34px;
  padding: 0 13px;
}

.home-chip {
  cursor: pointer;
}

.home-chip:hover,
.home-chip:focus-visible {
  border-color: rgba(125, 92, 255, 0.34);
  background: var(--violet-soft);
  color: var(--violet);
}

.status-grid {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.status-grid span {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

.spatial-board {
  position: relative;
  min-height: 720px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(90deg, rgba(17, 18, 22, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 18, 22, 0.032) 1px, transparent 1px),
    rgba(255, 255, 255, 0.48);
  background-size: 44px 44px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

body.night-mode .spatial-board {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.038) 1px, transparent 1px),
    rgba(25, 25, 38, 0.46);
  background-size: 44px 44px;
}

.spatial-board::before,
.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spatial-board::before {
  background:
    radial-gradient(circle at 68% 20%, rgba(125, 92, 255, 0.14), transparent 28%),
    radial-gradient(circle at 26% 78%, rgba(0, 166, 166, 0.08), transparent 30%),
    radial-gradient(ellipse at 58% 48%, rgba(255, 255, 255, 0.72), transparent 46%);
}

body.night-mode .spatial-board::before {
  background:
    radial-gradient(circle at 68% 20%, rgba(125, 92, 255, 0.18), transparent 28%),
    radial-gradient(circle at 26% 78%, rgba(0, 166, 166, 0.08), transparent 30%),
    radial-gradient(ellipse at 58% 48%, rgba(255, 255, 255, 0.06), transparent 46%);
}

.spatial-top {
  position: relative;
  z-index: 2;
  min-height: 70px;
  justify-content: space-between;
  padding: 0 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.traffic {
  gap: 8px;
}

.traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.traffic i:nth-child(1) {
  background: #ff5f57;
}

.traffic i:nth-child(2) {
  background: #ffbd2e;
}

.traffic i:nth-child(3) {
  background: #28c840;
}

.live {
  color: var(--violet);
}

.main-window,
.float-card,
.dock,
.role-panel {
  position: absolute;
  z-index: 3;
}

.main-window {
  left: 50%;
  top: 50%;
  display: grid;
  width: min(650px, 76%);
  min-height: 330px;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 24px;
  align-items: center;
  padding: 34px;
  border-radius: var(--radius-lg);
  transform: translate(-50%, -50%);
  background: var(--glass-strong);
}

.seal {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 900;
}

.window-copy h2 {
  margin: 12px 0 0;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.02;
  font-weight: 840;
}

.window-copy p {
  margin: 16px 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.mini-button {
  min-height: 38px;
  border: 0;
  padding: 0 15px;
  color: #fff;
  background: var(--violet);
}

.chart-preview {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(125, 92, 255, 0.18);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(125, 92, 255, 0.14) 1px, transparent 1px),
    linear-gradient(0deg, rgba(125, 92, 255, 0.14) 1px, transparent 1px),
    rgba(255, 255, 255, 0.62);
  background-size: 22px 22px;
  overflow: hidden;
}

.chart-preview::before,
.chart-preview::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(125, 92, 255, 0.24);
  border-radius: 50%;
}

.chart-preview::before {
  width: 132px;
  height: 132px;
}

.chart-preview::after {
  width: 78px;
  height: 78px;
}

.dao-mark {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 42px;
  font-weight: 900;
}

.float-card {
  display: grid;
  min-width: 190px;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
}

.float-card b {
  font-size: 15px;
}

.float-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.float-card.one {
  left: 6%;
  top: 20%;
}

.float-card.two {
  right: 6%;
  top: 22%;
}

.float-card.three {
  left: 10%;
  bottom: 22%;
}

.role-panel {
  right: 8%;
  bottom: 21%;
  width: 220px;
  padding: 16px;
  border-radius: var(--radius-md);
}

.role-panel b {
  display: block;
  margin-bottom: 8px;
}

.role-strip {
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.role-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 14px;
  font-weight: 900;
}

.dock {
  left: 50%;
  bottom: 34px;
  justify-content: center;
  gap: 18px;
  width: min(430px, 58%);
  padding: 12px 16px;
  border-radius: 26px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.78);
}

body.night-mode .dock {
  background: rgba(31, 31, 46, 0.78);
}

.dock-item {
  display: grid;
  min-width: 72px;
  justify-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.dock-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(125, 92, 255, 0.1);
  color: var(--violet);
  box-shadow: none;
  font-weight: 900;
}

.dock-item.active .dock-icon,
.dock-item:hover .dock-icon {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 12px 26px rgba(125, 92, 255, 0.24);
}

.glass-panel {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

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

.glass-panel::before {
  background:
    linear-gradient(90deg, rgba(125, 92, 255, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 18, 22, 0.024) 1px, transparent 1px),
    radial-gradient(circle at 90% 8%, rgba(125, 92, 255, 0.08), transparent 28%);
  background-size: 40px 40px, 40px 40px, auto;
}

.system-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
}

.auth-panel,
.report-main,
.profile-panel,
.model-settings,
.knowledge-panel {
  min-height: calc(100vh - 122px);
  padding: clamp(30px, 5vw, 72px);
}

.side-panel,
.analysis-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px;
}

.auth-panel h2,
.report-main h2,
.profile-panel h2,
.model-settings h2,
.knowledge-panel h2,
.memory-panel h2 {
  max-width: 840px;
  margin: 0 0 18px;
  font-size: clamp(42px, 5.5vw, 76px);
  line-height: 1.04;
  font-weight: 840;
}

.side-panel h3 {
  margin: 0;
  font-size: 28px;
}

.section-copy {
  max-width: 760px;
  margin: 0 0 28px;
  font-size: 17px;
}

.auth-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 6px;
  margin: 4px 0 24px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--violet);
  color: #fff;
}

.auth-form {
  display: grid;
  max-width: 640px;
  gap: 16px;
}

.auth-form label,
.role-form label,
.memory-toolbar label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.auth-form input,
.role-form input,
.role-form select,
.modal input,
.modal select {
  min-height: 48px;
  padding: 0 14px;
}

.auth-form input:focus,
.role-form input:focus,
.role-form select:focus,
.home-ask-card textarea:focus,
.ask-composer textarea:focus,
.followup-box input:focus,
.modal input:focus,
.modal select:focus,
.memory-toolbar input:focus,
.memory-toolbar select:focus {
  border-color: rgba(125, 92, 255, 0.5);
  box-shadow: 0 0 0 4px var(--violet-soft);
}

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

.auth-consent {
  margin-top: 2px;
}

.auth-submit-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.mini-stack {
  display: grid;
  gap: 12px;
}

.mini-stack article,
.source-card,
.model-card,
.model-route-card,
.fact-card,
.progress-card,
.verdict-card,
.report-grid article,
.provider-card,
.knowledge-grid article,
.profile-summary,
.memory-list-panel,
.memory-detail-panel,
.memory-feedback,
.brain-status-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
}

body.night-mode .mini-stack article,
body.night-mode .source-card,
body.night-mode .model-card,
body.night-mode .model-route-card,
body.night-mode .fact-card,
body.night-mode .progress-card,
body.night-mode .verdict-card,
body.night-mode .report-grid article,
body.night-mode .provider-card,
body.night-mode .knowledge-grid article,
body.night-mode .profile-summary,
body.night-mode .memory-list-panel,
body.night-mode .memory-detail-panel,
body.night-mode .memory-feedback,
body.night-mode .brain-status-grid article,
body.night-mode .memory-card,
body.night-mode .memory-detail-grid div {
  background: rgba(31, 31, 46, 0.58);
}

.mini-stack article {
  display: grid;
  gap: 5px;
  padding: 16px;
}

.ask-system {
  display: grid;
  min-height: calc(100vh - 122px);
  grid-template-columns: 310px minmax(520px, 1fr) 340px;
  gap: 18px;
}

.role-board,
.chat-panel,
.analysis-panel {
  min-height: calc(100vh - 122px);
}

.role-board,
.chat-panel {
  padding: 24px;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
  font-weight: 840;
}

.small-heading h2 {
  font-size: 28px;
}

.role-avatar-large {
  width: 96px;
  height: 96px;
  margin: 24px 0;
  border-radius: 30px;
  font-size: 42px;
  font-weight: 900;
}

.role-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.saved-roles {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.saved-role-list {
  display: grid;
  gap: 10px;
}

.section-row {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.section-row button {
  border: 0;
  background: transparent;
  color: var(--violet);
  font-weight: 780;
}

.saved-role {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  text-align: left;
}

body.night-mode .saved-role {
  background: rgba(31, 31, 46, 0.56);
}

.saved-role span {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  box-shadow: none;
}

.saved-role b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-role.active {
  border-color: rgba(125, 92, 255, 0.32);
  box-shadow: 0 0 0 4px var(--violet-soft);
}

.saved-role-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.52);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body.night-mode .saved-role-row {
  background: rgba(31, 31, 46, 0.56);
}

.saved-role-row .saved-role {
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
}

.saved-role-row.active {
  border-color: rgba(125, 92, 255, 0.32);
  box-shadow: 0 0 0 4px var(--violet-soft);
}

.role-delete-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 75, 94, 0.16);
  border-radius: 13px;
  background: rgba(255, 75, 94, 0.07);
  color: #d7384b;
  font-size: 12px;
  font-weight: 900;
}

.role-delete-button:hover:not(:disabled),
.role-delete-button:focus-visible:not(:disabled) {
  border-color: rgba(255, 75, 94, 0.34);
  background: rgba(255, 75, 94, 0.11);
}

.role-delete-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.ask-composer {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
}

body.night-mode .ask-composer {
  background: rgba(31, 31, 46, 0.52);
}

.ask-composer textarea {
  min-height: 132px;
  max-height: 320px;
  border: 0;
  padding: 14px 14px 8px;
  background: transparent;
  resize: none;
  line-height: 1.7;
  font-size: 16px;
}

.module-catalog {
  margin-top: 10px;
}

.module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.module-chip:hover,
.module-chip.active {
  border-color: rgba(125, 92, 255, 0.34);
  background: var(--violet-soft);
  color: var(--violet);
}

.composer-foot,
.modal-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.composer-foot {
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding-top: 10px;
  border-top: 1px solid rgba(17, 18, 22, 0.06);
}

.composer-foot > span,
.composer-tools span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.composer-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-button,
.upload-button,
.send-button {
  border: 1px solid var(--line);
  font-weight: 820;
}

.tool-button,
.upload-button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.tool-button:hover,
.upload-button:hover {
  border-color: rgba(125, 92, 255, 0.3);
  color: var(--violet);
  background: rgba(125, 92, 255, 0.08);
}

.send-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 16px;
  background: var(--violet);
  color: #fff;
  box-shadow: 0 14px 30px rgba(125, 92, 255, 0.26);
  font-size: 22px;
  line-height: 1;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(125, 92, 255, 0.3);
}

.send-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.vision-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  border: 1px solid rgba(125, 92, 255, 0.18);
  border-radius: 22px;
  padding: 12px 14px;
  background: rgba(125, 92, 255, 0.06);
}

.vision-upload[hidden] {
  display: none;
}

.vision-upload strong,
.vision-upload span {
  display: block;
}

.vision-upload strong {
  font-size: 14px;
}

.vision-upload span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 4px 2px;
}

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

.attachment-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  width: min(100%, 280px);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.attachment-card img {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  object-fit: cover;
}

.attachment-card strong,
.attachment-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card small {
  margin-top: 3px;
  color: var(--muted);
}

.attachment-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 11px;
  background: rgba(17, 18, 22, 0.06);
  color: var(--muted);
  font-weight: 900;
}

.attachment-remove:hover {
  background: rgba(125, 92, 255, 0.1);
  color: var(--violet);
}

.message-list {
  display: grid;
  gap: 12px;
  max-height: 430px;
  margin-top: 18px;
  overflow: auto;
  padding: 4px;
}

.message {
  display: grid;
  max-width: 86%;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

body.night-mode .message {
  background: rgba(31, 31, 46, 0.58);
}

.message.user {
  justify-self: end;
  background: var(--violet);
  color: #fff;
}

.message.user p {
  color: rgba(255, 255, 255, 0.9);
}

.message.master {
  justify-self: start;
}

.message.loading p::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: ""; }
}

.message span {
  color: var(--violet);
  font-size: 12px;
  font-weight: 820;
}

.message.user span {
  color: rgba(255, 255, 255, 0.86);
}

.message p {
  margin: 0;
  white-space: pre-line;
}

.followup-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.46);
}

body.night-mode .followup-box {
  background: rgba(31, 31, 46, 0.48);
}

.followup-box input {
  min-height: 42px;
  padding: 0 14px;
}

.model-card,
.model-route-card,
.fact-card,
.progress-card,
.source-card {
  padding: 16px;
}

.model-card h3,
.model-route-card h3,
.fact-card h3,
.progress-card h3,
.source-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.model-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

dl {
  margin: 0;
}

.model-route-card dl,
.fact-card dl {
  display: grid;
  gap: 10px;
}

.model-route-card dl div,
.fact-card dl div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(125, 92, 255, 0.24);
}

.check-list li.done,
.check-list li.active {
  color: var(--ink);
}

.check-list li.done::before,
.check-list li.active::before {
  background: var(--violet);
}

.signal-row {
  flex-wrap: wrap;
  gap: 8px;
}

.signal,
.memory-status,
.status-pending,
.status-authorized,
.status-revoked,
.status-deleted {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 820;
}

.signal.strong {
  background: rgba(48, 209, 88, 0.14);
  color: #16803a;
}

.signal.weak {
  background: rgba(199, 160, 98, 0.16);
  color: #8c6225;
}

.signal.verify {
  background: var(--violet-soft);
  color: var(--violet);
}

.flow-actions {
  display: grid;
  gap: 10px;
}

.report-layout,
.profile-layout,
.model-layout {
  align-items: stretch;
}

.verdict-card {
  max-width: 920px;
  padding: 26px;
}

.verdict-card h3 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
}

.verdict-card p {
  margin: 0;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 980px;
  margin-top: 18px;
}

.report-grid article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 200px;
  padding: 18px;
}

.report-grid article > span {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  box-shadow: none;
  font-weight: 900;
}

.report-grid h3 {
  margin: 0;
  font-size: 20px;
}

.report-grid p {
  margin: 0;
}

.profile-summary {
  display: flex;
  max-width: 680px;
  gap: 18px;
  align-items: center;
  margin: 24px 0;
  padding: 22px;
}

.profile-summary small,
.profile-summary p {
  color: var(--muted);
}

.profile-summary strong {
  display: block;
  margin: 4px 0;
  font-size: 32px;
}

.profile-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 980px;
}

.profile-role-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.45fr) minmax(300px, 0.82fr);
  gap: 24px;
  align-items: start;
}

.profile-role-dock,
.profile-panel,
.profile-role-layout > .side-panel {
  min-height: calc(100vh - 122px);
}

.profile-role-dock {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px;
}

.role-dock-list {
  gap: 12px;
}

.profile-role-editor {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.48);
}

body.night-mode .profile-role-editor {
  background: rgba(31, 31, 46, 0.5);
}

.profile-role-editor-inner {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 18px;
}

.profile-role-editor .role-avatar-large {
  margin: 0;
}

.profile-role-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
}

.memory-panel {
  min-height: calc(100vh - 122px);
  padding: clamp(28px, 4vw, 56px);
}

.brain-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 760px;
  margin: 26px 0;
}

.brain-status-grid article {
  padding: 18px;
}

.brain-status-grid strong {
  display: block;
  font-size: 36px;
  line-height: 1;
}

.brain-status-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.memory-toolbar {
  display: grid;
  grid-template-columns: 180px 160px minmax(220px, 1fr);
  gap: 12px;
  max-width: 980px;
  margin: 24px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.52);
}

body.night-mode .memory-toolbar {
  background: rgba(31, 31, 46, 0.52);
}

.memory-toolbar select,
.memory-toolbar input {
  min-height: 42px;
  padding: 0 12px;
}

.memory-feedback {
  max-width: 980px;
  margin: 0 0 14px;
  padding: 12px 14px;
  color: var(--violet);
  font-size: 14px;
  font-weight: 780;
}

.memory-feedback.error {
  border-color: rgba(255, 59, 48, 0.26);
  background: rgba(255, 59, 48, 0.08);
  color: var(--red);
}

.memory-console {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
  max-width: 1120px;
}

.memory-list-panel,
.memory-detail-panel {
  min-height: 520px;
  padding: 18px;
}

.compact-heading {
  margin-bottom: 14px;
}

.compact-heading h3 {
  margin: 0;
  font-size: 24px;
}

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

.memory-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.memory-card.selected {
  border-color: rgba(125, 92, 255, 0.36);
  box-shadow: 0 0 0 4px var(--violet-soft);
}

.memory-card.empty {
  padding: 18px;
  border-style: dashed;
}

.memory-card-select {
  display: grid;
  width: 100%;
  gap: 9px;
  border: 0;
  padding: 16px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.memory-card-select strong,
.memory-card-select span {
  min-width: 0;
}

.memory-card-meta,
.memory-card-foot,
.memory-detail-head {
  justify-content: space-between;
  gap: 12px;
}

.memory-card-foot em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.status-pending {
  background: rgba(199, 160, 98, 0.15);
  color: #8c6225;
}

.status-authorized {
  background: rgba(48, 209, 88, 0.14);
  color: #16803a;
}

.status-revoked,
.status-deleted {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.memory-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.memory-detail-empty {
  display: grid;
  min-height: 420px;
  place-content: center;
  text-align: center;
}

.memory-detail-panel h3 {
  margin: 14px 0 16px;
  font-size: 26px;
}

.memory-detail-panel h4 {
  margin: 18px 0 8px;
  font-size: 14px;
}

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

.memory-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.48);
}

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

.memory-detail-grid dd {
  margin: 5px 0 0;
  word-break: break-word;
}

.detail-actions {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.memory-mini-list {
  display: grid;
  gap: 10px;
}

.memory-mini-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.46);
}

.memory-mini-item strong {
  font-size: 14px;
}

.provider-grid,
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 980px;
}

.provider-card,
.knowledge-grid article {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 18px;
}

.provider-card {
  grid-template-columns: auto 1fr;
  align-content: center;
  cursor: pointer;
}

.provider-card strong,
.provider-card small {
  grid-column: 2;
}

.provider-card small {
  color: var(--muted);
}

.provider-card.selected {
  border-color: rgba(125, 92, 255, 0.36);
  box-shadow: 0 0 0 4px var(--violet-soft);
}

.provider-card:focus-visible {
  outline: 3px solid rgba(125, 92, 255, 0.28);
  outline-offset: 3px;
}

.provider-card.available .status-dot {
  background: var(--green);
}

.status-dot {
  grid-row: 1 / span 2;
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--soft);
}

.knowledge-panel {
  min-height: calc(100vh - 122px);
}

.knowledge-grid article .seal {
  width: 46px;
  height: 46px;
}

.knowledge-grid h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.knowledge-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.knowledge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.app-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 44px));
  border: 1px solid rgba(125, 92, 255, 0.18);
  border-radius: 18px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: var(--soft-shadow);
  font-size: 14px;
  font-weight: 780;
  line-height: 1.5;
  backdrop-filter: blur(24px) saturate(150%);
}

.app-toast.error {
  border-color: rgba(255, 59, 48, 0.22);
  background: rgba(255, 245, 245, 0.92);
  color: var(--red);
}

body.night-mode .app-toast {
  background: rgba(31, 31, 46, 0.9);
}

.mobile-nav {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 25;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--glass-strong);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(160%);
}

.mobile-item {
  min-height: 42px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.mobile-item.active {
  background: var(--violet);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(17, 18, 22, 0.22);
  backdrop-filter: blur(16px);
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  position: relative;
  width: min(720px, 100%);
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

body.night-mode .modal-close {
  background: rgba(31, 31, 46, 0.72);
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.step {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.step.active {
  background: var(--violet);
  color: #fff;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

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

.consent-row {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.modal .consent-row {
  margin-top: 16px;
}

.modal-actions {
  justify-content: flex-end;
}

.system-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 8%, rgba(125, 92, 255, 0.16), transparent 30%),
    rgba(247, 249, 255, 0.58);
  backdrop-filter: blur(22px) saturate(160%);
}

.system-overlay.open {
  display: grid;
}

.system-card {
  position: relative;
  width: min(1120px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 100px rgba(31, 36, 58, 0.16);
  backdrop-filter: blur(28px) saturate(170%);
}

body.night-mode .system-card {
  background: rgba(31, 31, 46, 0.94);
}

.system-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 18, 22, 0.08);
  color: var(--muted);
  font-size: 22px;
}

.auth-system-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.72fr);
}

.system-auth-main,
.system-auth-side,
.wallet-system-card {
  padding: clamp(26px, 4vw, 48px);
}

.system-auth-side {
  display: grid;
  align-items: stretch;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(125, 92, 255, 0.1), transparent 55%),
    rgba(255, 255, 255, 0.42);
}

.system-kicker {
  margin: 0 0 12px;
  color: var(--violet);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.system-auth-main h2,
.wallet-system-card h2 {
  margin: 0 0 12px;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 1.04;
  font-weight: 880;
}

.system-auth-main > p,
.wallet-top p {
  max-width: 620px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 680;
}

.system-tabs {
  margin-bottom: 16px;
}

.method-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.method-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
}

.method-button.active {
  border-color: rgba(125, 92, 255, 0.36);
  background: var(--violet-soft);
  color: var(--violet);
}

.system-auth-form {
  max-width: 560px;
}

.password-strength {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.password-strength i {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: rgba(17, 18, 22, 0.1);
}

.password-strength i.active {
  background: var(--violet);
}

.field-error {
  color: #d94a4a;
  font-size: 12px;
  font-weight: 760;
}

.system-profile-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.system-profile-hero small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.system-profile-hero strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
}

.system-profile-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.account-avatar-large {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--violet), #9a7bff);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 18px 44px rgba(125, 92, 255, 0.22);
}

.system-menu {
  display: grid;
  gap: 10px;
}

.system-menu button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  text-align: left;
}

.system-menu button span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  background: var(--violet-soft);
  color: var(--violet);
  font-weight: 900;
}

.system-menu button b {
  font-size: 15px;
}

.system-menu button em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.system-menu button.danger span {
  background: rgba(217, 74, 74, 0.12);
  color: #d94a4a;
}

.auth-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.auth-note i,
.wallet-rules i,
.ledger-row i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--violet);
}

.system-benefit-card {
  display: grid;
  align-content: space-between;
  gap: 26px;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.66);
}

.system-benefit-card strong {
  display: block;
  margin-top: 18px;
  font-size: 28px;
  line-height: 1.18;
}

.system-benefit-card ul {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 760;
  list-style: none;
}

.system-cost-example {
  border-radius: 24px;
  padding: 18px;
  background: #1f1b2d;
  color: #fff;
}

.system-cost-example small,
.system-cost-example span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 780;
}

.system-cost-example b {
  display: block;
  margin: 5px 0;
  font-size: 48px;
  line-height: 1;
}

.wallet-system-card {
  width: min(1040px, 100%);
}

.wallet-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 26px;
  align-items: stretch;
}

.wallet-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-rules span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-box {
  display: grid;
  align-content: center;
  min-height: 162px;
  border-radius: 28px;
  padding: 22px;
  background: linear-gradient(135deg, #111216, #272033);
  color: #fff;
}

.balance-box span,
.balance-box small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 780;
}

.balance-box strong {
  margin: 8px 0 10px;
  font-size: 54px;
  line-height: 1;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 26px 0;
}

.plan-card {
  display: grid;
  gap: 6px;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  text-align: left;
}

.plan-card.active {
  border-color: rgba(125, 92, 255, 0.5);
  background: var(--violet-soft);
}

.plan-card small,
.plan-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.plan-card b {
  font-size: 30px;
}

.wallet-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  align-items: end;
}

.ledger {
  display: grid;
  gap: 4px;
}

.ledger-title,
.ledger-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
}

.ledger-title {
  grid-template-columns: 1fr auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 840;
}

.ledger-row {
  border-top: 1px solid rgba(17, 18, 22, 0.07);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.ledger-row b {
  color: var(--ink);
}

.wallet-actions {
  display: grid;
  gap: 10px;
}

.spend-confirm {
  position: fixed;
  z-index: 65;
  right: clamp(16px, 4vw, 48px);
  bottom: clamp(86px, 5vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  width: min(760px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 72px rgba(31, 36, 58, 0.16);
  backdrop-filter: blur(24px) saturate(160%);
}

.spend-confirm strong {
  display: block;
  font-size: 15px;
}

.spend-confirm span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.spend-confirm > b {
  display: grid;
  min-width: 72px;
  min-height: 48px;
  place-items: center;
  border-radius: 17px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 22px;
}

body.night-mode .system-overlay {
  background: rgba(9, 10, 16, 0.68);
}

body.night-mode .system-benefit-card,
body.night-mode .system-profile-hero,
body.night-mode .system-menu button,
body.night-mode .plan-card,
body.night-mode .wallet-rules span,
body.night-mode .method-button,
body.night-mode .spend-confirm {
  background: rgba(31, 31, 46, 0.72);
}

@media (max-width: 1280px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .spatial-board {
    min-height: 660px;
  }

  .ask-system {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .analysis-panel {
    grid-column: 1 / -1;
    min-height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .analysis-panel .panel-heading,
  .analysis-panel .signal-row,
  .analysis-panel .flow-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  .topbar {
    align-items: flex-start;
    border-radius: 28px;
    padding: 12px;
    flex-wrap: wrap;
  }

  .nav-list {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 18px;
    overflow-x: auto;
    padding: 4px 0;
  }

  .top-actions {
    margin-left: auto;
  }

  .system-layout,
  .memory-layout,
  .ask-system {
    grid-template-columns: 1fr;
  }

  .role-board,
  .chat-panel,
  .analysis-panel {
    min-height: auto;
  }

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

  .analysis-panel {
    grid-template-columns: 1fr 1fr;
  }

  .provider-grid,
  .knowledge-grid,
  .report-grid,
  .profile-cards {
    grid-template-columns: 1fr 1fr;
  }

  .memory-console {
    grid-template-columns: 1fr;
  }

  .memory-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px 12px 92px;
  }

  .main,
  .topbar {
    width: 100%;
  }

  .topbar {
    top: 12px;
    margin-bottom: 28px;
    border-radius: 24px;
  }

  .brand small,
  .model-picker,
  .auth-actions .secondary-button,
  .auth-status {
    display: none;
  }

  .nav-list {
    order: 3;
    display: flex;
    width: 100%;
    justify-content: flex-start;
    gap: 18px;
    overflow-x: auto;
    padding: 4px 6px 2px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .top-actions {
    gap: 8px;
  }

  .home-hero {
    min-height: auto;
    gap: 22px;
  }

  h1 {
    font-size: 48px;
    line-height: 1.04;
  }

  .lead,
  .section-copy {
    font-size: 15px;
  }

  .home-ask-card,
  .glass-panel,
  .spatial-board {
    border-radius: 28px;
  }

  .spatial-board {
    min-height: 620px;
  }

  .spatial-top {
    padding: 0 18px;
  }

  .spatial-top strong {
    display: none;
  }

  .float-card {
    min-width: 150px;
  }

  .float-card.one {
    left: 5%;
    top: 16%;
  }

  .float-card.two {
    right: 5%;
    top: 24%;
  }

  .float-card.three,
  .role-panel {
    display: none;
  }

  .main-window {
    top: 48%;
    width: calc(100% - 32px);
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .chart-preview {
    width: 170px;
    justify-self: center;
  }

  .dock {
    bottom: 18px;
    width: calc(100% - 28px);
    overflow-x: auto;
    justify-content: flex-start;
  }

  .composer-foot {
    align-items: stretch;
  }

  .composer-tools {
    width: 100%;
  }

  .vision-upload {
    grid-template-columns: 1fr;
  }

  .vision-upload .upload-button {
    justify-self: start;
  }

  .attachment-card {
    width: 100%;
  }

  .auth-panel,
  .report-main,
  .profile-panel,
  .model-settings,
  .knowledge-panel,
  .memory-panel,
  .role-board,
  .chat-panel,
  .analysis-panel,
  .side-panel {
    padding: 20px;
  }

  .auth-panel h2,
  .report-main h2,
  .profile-panel h2,
  .model-settings h2,
  .knowledge-panel h2,
  .memory-panel h2 {
    font-size: 42px;
  }

  .role-form,
  .analysis-panel,
  .provider-grid,
  .knowledge-grid,
  .report-grid,
  .profile-cards,
  .brain-status-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .message-list {
    max-height: none;
  }

  .message {
    max-width: 100%;
  }

  .followup-box,
  .code-row {
    grid-template-columns: 1fr;
  }

  .knowledge-actions,
  .knowledge-actions .primary-button,
  .knowledge-actions .secondary-button {
    width: 100%;
  }

  .app-toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  .memory-detail-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    display: none;
  }
}

/* V12 final overrides. Keep this block last. */
body {
  background:
    radial-gradient(circle at 8% 10%, rgba(10, 132, 255, 0.14), transparent 27%),
    radial-gradient(circle at 92% 8%, rgba(26, 182, 166, 0.14), transparent 26%),
    radial-gradient(circle at 52% 80%, rgba(125, 92, 255, 0.12), transparent 28%),
    linear-gradient(90deg, rgba(10, 132, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(18, 20, 28, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcff 0%, #f7f8fb 100%);
  background-size: auto, auto, auto, 56px 56px, 56px 56px, auto;
  color: #111216;
}

.cosmos-field {
  display: none;
}

.app-shell {
  width: min(1500px, calc(100% - clamp(24px, 5vw, 84px)));
  margin: 0 auto;
  padding: 18px 0 52px;
}

.topbar {
  position: sticky;
  top: 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 62px;
  margin: 0 auto 36px;
  border: 1px solid rgba(18, 20, 28, 0.095);
  border-radius: 999px;
  padding: 0 16px 0 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 20px 60px rgba(41, 47, 64, 0.09);
  backdrop-filter: blur(26px) saturate(160%);
}

.brand {
  color: #111216;
}

.brand-mark,
.role-avatar,
.role-avatar-large,
.seal,
.dock-icon,
.send-button {
  background: linear-gradient(135deg, #7d5cff, #a98dff);
  color: #fff;
}

.brand small,
.lead,
.section-copy,
.float-card span,
.main-window p,
.role-panel span,
.model-card p,
.model-route-card dd,
.fact-card dd,
.report-grid p,
.source-card p {
  color: #70747e;
}

.nav-list {
  justify-self: center;
  gap: clamp(20px, 4vw, 58px);
}

.nav-item {
  color: #70747e;
  font-size: 14px;
  font-weight: 760;
}

.nav-item.active {
  color: #111216;
}

.primary-button {
  background: #7d5cff;
  color: #fff;
  box-shadow: 0 18px 36px rgba(125, 92, 255, 0.26);
}

.secondary-button,
.home-chip,
.module-chip,
.tool-button,
.upload-button,
.auth-tab,
.mobile-item {
  border: 1px solid rgba(18, 20, 28, 0.095);
  background: rgba(255, 255, 255, 0.78);
  color: #111216;
}

.home-hero {
  display: block;
  min-height: auto;
}

.home-copy {
  max-width: 900px;
  margin: 0 auto 30px;
  padding-top: 58px;
  text-align: center;
}

.home-copy h1 {
  margin: 0 auto 20px;
  color: #111216;
  font-size: clamp(54px, 6.4vw, 92px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 0 auto 22px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.8;
}

.hero-actions,
.home-chip-row,
.status-grid {
  justify-content: center;
}

.home-ask-card {
  width: min(820px, 100%);
  margin: 30px auto 18px;
}

.prompt-composer,
.glass-panel,
.spatial-board,
.float-card,
.main-window,
.role-panel,
.process-panel,
.preview-chat-card,
.profile-mini-card,
.report-mini-card,
.module-switcher,
.verdict-card,
.report-grid article,
.source-card,
.provider-card,
.knowledge-grid article,
.memory-card,
.memory-detail-panel,
.modal {
  border: 1px solid rgba(18, 20, 28, 0.095);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 54px rgba(41, 47, 64, 0.09);
  backdrop-filter: blur(24px) saturate(150%);
}

.prompt-composer {
  border-radius: 34px;
  padding: 18px;
}

.prompt-composer textarea {
  min-height: 128px;
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1.7;
}

.composer-foot {
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(18, 20, 28, 0.07);
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 78px;
  height: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  gap: 8px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.send-button::after {
  content: "↗";
  font-size: 15px;
  line-height: 1;
  transform: translateY(-1px);
}

.module-chip.active,
.home-chip:hover,
.dock-item.active,
.auth-tab.active {
  border-color: rgba(125, 92, 255, 0.34);
  background: rgba(125, 92, 255, 0.11);
  color: #7d5cff;
}

.status-grid span,
.signal {
  min-height: 32px;
  border: 1px solid rgba(18, 20, 28, 0.095);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.66);
  color: #70747e;
  font-size: 12px;
  font-weight: 780;
}

.spatial-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(360px, 1.08fr) minmax(320px, 0.86fr);
  gap: 24px;
  min-height: 520px;
  overflow: hidden;
  border-radius: 34px;
  padding: 0 48px 42px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 34px 100px rgba(41, 47, 64, 0.13);
}

.spatial-board::before {
  content: "";
  position: absolute;
  inset: 62px 0 0;
  background:
    linear-gradient(90deg, rgba(10, 132, 255, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(18, 20, 28, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(#000, transparent 92%);
}

.spatial-board::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 25%;
  top: 19%;
  width: 54%;
  height: 58%;
  border: 1px solid rgba(125, 92, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(125, 92, 255, 0.035),
    inset 0 0 0 1px rgba(10, 132, 255, 0.06);
  transform: rotate(-7deg);
  pointer-events: none;
}

.spatial-top {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: 62px;
  margin: 0 -48px 18px;
  align-items: center;
  border-bottom: 1px solid rgba(18, 20, 28, 0.06);
  padding: 0 26px;
  color: #70747e;
}

.live {
  justify-self: end;
  color: #7d5cff;
}

.float-card,
.main-window,
.role-panel,
.dock,
.process-panel,
.preview-chat-card,
.profile-stack,
.profile-mini-card,
.report-mini-card,
.module-switcher {
  position: relative;
  z-index: 1;
}

.process-panel {
  grid-column: 1;
  align-self: center;
  border-radius: 28px;
  padding: 20px;
}

.panel-kicker {
  margin: 0 0 16px;
  color: #7d5cff;
  font-size: 13px;
  font-weight: 900;
}

.process-steps {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.process-steps::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: linear-gradient(180deg, rgba(125, 92, 255, 0.55), rgba(125, 92, 255, 0.05));
}

.process-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  min-height: 58px;
  align-items: center;
}

.process-steps li span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(125, 92, 255, 0.18);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
  color: #7d5cff;
  font-size: 12px;
  font-weight: 900;
}

.process-steps li.active span {
  border-color: transparent;
  background: #7d5cff;
  color: #fff;
  box-shadow: 0 12px 26px rgba(125, 92, 255, 0.22);
}

.process-steps b,
.profile-mini-card b,
.report-mini-card b,
.preview-card-head b {
  display: block;
  color: #111216;
  font-size: 15px;
  font-weight: 900;
}

.process-steps b {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.process-steps small,
.profile-mini-card small,
.preview-card-head small {
  display: block;
  margin-top: 3px;
  color: #70747e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.process-steps small {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.preview-chat-card {
  grid-column: 2;
  align-self: center;
  min-height: 315px;
  border-radius: 32px;
  padding: 26px;
}

.preview-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.mini-dialogue {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.bubble {
  max-width: 92%;
  margin: 0;
  border-radius: 20px;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 780;
  line-height: 1.55;
}

.user-bubble {
  justify-self: end;
  background: linear-gradient(135deg, #7d5cff, #9f82ff);
  color: #fff;
  box-shadow: 0 14px 32px rgba(125, 92, 255, 0.2);
}

.master-bubble {
  justify-self: start;
  border: 1px solid rgba(18, 20, 28, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: #363945;
}

.preview-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.preview-status-row span {
  min-height: 28px;
  border: 1px solid rgba(125, 92, 255, 0.16);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(125, 92, 255, 0.08);
  color: #6b53d8;
  font-size: 12px;
  font-weight: 850;
}

.profile-stack {
  grid-column: 3;
  display: grid;
  align-self: center;
  gap: 14px;
}

.profile-mini-card,
.report-mini-card {
  border-radius: 26px;
  padding: 18px;
}

.profile-mini-card .role-strip {
  margin-bottom: 16px;
}

.profile-mini-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-mini-card dl div {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
  font-weight: 780;
}

.profile-mini-card dt {
  color: #7b808a;
}

.profile-mini-card dd {
  color: #111216;
}

.report-mini-card p {
  margin: 10px 0 0;
  color: #70747e;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.55;
}

.module-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-radius: 26px;
  padding: 12px;
}

.module-switcher.dock {
  left: auto;
  bottom: auto;
  width: 100%;
  transform: none;
}

.profile-mini-card,
.report-mini-card {
  width: 100%;
}

.profile-mini-card dd,
.report-mini-card b {
  word-break: keep-all;
}

.float-card {
  min-height: 112px;
  border-radius: 26px;
  padding: 18px;
}

.float-card.one,
.float-card.two,
.float-card.three {
  grid-column: 1;
}

.main-window {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px);
  align-items: center;
  gap: 24px;
  align-self: center;
  min-height: 250px;
  border-radius: 30px;
  padding: 32px;
}

.main-window h2,
.window-copy h2 {
  margin: 12px 0 10px;
  color: #111216;
  font-size: clamp(40px, 4vw, 62px);
  line-height: 1.08;
  white-space: nowrap;
}

.chart-preview {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 32px;
  background:
    linear-gradient(90deg, rgba(10, 132, 255, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(10, 132, 255, 0.12) 1px, transparent 1px),
    rgba(255, 255, 255, 0.58);
  background-size: 28px 28px;
}

.dao-mark {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  border-radius: 30px;
  background: #7d5cff;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 54px;
  font-weight: 900;
}

.role-panel,
.dock {
  grid-column: 3;
}

.dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-self: end;
  border-radius: 28px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.ask-system,
.system-layout,
.memory-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
}

.view:not(#home) {
  padding-top: 42px;
}

.system-layout,
.report-layout,
.profile-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

.role-board,
.chat-panel,
.analysis-panel,
.report-main,
.profile-panel,
.side-panel,
.auth-panel,
.model-settings,
.knowledge-panel,
.memory-panel {
  border-radius: 30px;
  padding: 32px;
}

.panel-heading h2,
.report-main h2,
.profile-panel h2,
.auth-panel h2,
.model-settings h2,
.knowledge-panel h2,
.memory-panel h2 {
  margin: 0 0 14px;
  color: #111216;
  font-size: clamp(32px, 3vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.role-board .panel-heading h2 {
  font-size: clamp(30px, 2.6vw, 42px);
}

.role-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 30px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 54px;
}

.message {
  max-width: 78%;
  border: 1px solid rgba(18, 20, 28, 0.095);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 54px rgba(41, 47, 64, 0.09);
}

.message.user {
  background: #7d5cff;
  color: #fff;
}

.verdict-card {
  border-radius: 30px;
  padding: 34px;
  background:
    radial-gradient(circle at 82% 12%, rgba(125, 92, 255, 0.11), transparent 32%),
    rgba(255, 255, 255, 0.76);
}

.verdict-card h3 {
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.05;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr auto;
    border-radius: 28px;
    padding: 12px 14px;
  }

  .nav-list {
    grid-column: 1 / -1;
    justify-self: start;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
  }

  .spatial-board,
  .ask-system,
  .system-layout,
  .memory-layout,
  .report-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .spatial-board {
    padding: 0 28px 32px;
  }

  .spatial-top {
    margin: 0 -28px 18px;
  }

  .float-card.one,
  .float-card.two,
  .float-card.three,
  .main-window,
  .role-panel,
  .dock,
  .process-panel,
  .preview-chat-card,
  .profile-stack {
    grid-column: 1;
    grid-row: auto;
  }

  .spatial-board::after {
    left: 8%;
    top: 28%;
    width: 84%;
    height: 42%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 24px);
    padding: 12px 0 92px;
  }

  .brand small,
  .spatial-top strong,
  .live {
    display: none;
  }

  .home-copy h1 {
    font-size: 48px;
  }

  .lead {
    font-size: 15px;
  }

  .role-board,
  .chat-panel,
  .analysis-panel,
  .report-main,
  .profile-panel,
  .side-panel,
  .auth-panel,
  .model-settings,
  .knowledge-panel,
  .memory-panel,
  .main-window {
    padding: 22px;
  }

  .process-panel,
  .preview-chat-card,
  .profile-mini-card,
  .report-mini-card {
    border-radius: 22px;
    padding: 16px;
  }

  .process-steps {
    gap: 6px;
  }

  .process-steps li {
    min-height: 50px;
  }

  .preview-status-row span {
    font-size: 11px;
  }

  .module-switcher {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    overflow-x: auto;
  }

  .panel-heading h2,
  .report-main h2,
  .profile-panel h2,
  .auth-panel h2,
  .model-settings h2,
  .knowledge-panel h2,
  .memory-panel h2,
  .verdict-card h3 {
    font-size: 38px;
  }

  .message {
    max-width: 100%;
  }
}

/* V12 final layout tightening */
.home-copy h1 {
  font-size: clamp(48px, 5.4vw, 78px);
  line-height: 1.08;
}

.lead {
  margin-bottom: 16px;
  font-size: 17px;
}

.home-ask-card {
  margin: 18px auto 12px;
}

.home-ask-card textarea {
  min-height: 86px;
}

.home-ask-card .composer-foot > span {
  color: #5f6470;
  font-weight: 820;
}

.status-grid {
  margin-bottom: 22px;
}

.spatial-board {
  margin-top: 0;
  min-height: 470px;
}

.system-layout,
.ask-system,
.role-board,
.chat-panel,
.analysis-panel,
.report-main,
.profile-panel,
.side-panel {
  min-height: 0;
}

.report-layout,
.profile-layout {
  align-items: start;
}

.report-main,
.profile-panel,
.side-panel {
  align-self: start;
}

.profile-panel h2 {
  max-width: 720px;
  font-size: clamp(40px, 4.4vw, 58px);
}

@media (max-width: 640px) {
  .home-copy {
    padding-top: 26px;
  }

  .topbar {
    position: static;
    top: auto;
    margin-bottom: 22px;
  }

  .home-copy h1 {
    font-size: 44px;
  }

  .home-ask-card textarea {
    min-height: 78px;
  }
}

/* Unified account / credits system layer */
.account-actions[hidden],
.system-overlay[aria-hidden="true"],
.spend-confirm[hidden] {
  display: none !important;
}

.account-actions:not([hidden]) {
  display: flex;
  align-items: center;
}

.system-overlay.open {
  display: grid;
}

.system-overlay .auth-tab {
  border: 0;
  border-radius: 999px;
}

.system-overlay .auth-tab.active {
  border-color: transparent;
}

.system-overlay .primary-button,
.spend-confirm .primary-button {
  background: #7d5cff;
  color: #fff;
}

@media (max-width: 900px) {
  .auth-system-card,
  .wallet-top,
  .wallet-bottom {
    grid-template-columns: 1fr;
  }

  .system-auth-side {
    border-left: 0;
    border-top: 1px solid rgba(18, 20, 28, 0.095);
  }

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

  .spend-confirm {
    left: 18px;
    right: 18px;
    bottom: 18px;
    width: auto;
  }
}

@media (max-width: 640px) {
  .credit-chip {
    min-height: 40px;
    padding: 0 10px;
  }

  .credit-chip small {
    display: none;
  }

  .account-entry {
    width: 40px;
    min-height: 40px;
  }

  .account-entry span {
    width: 30px;
    height: 30px;
  }

  .system-overlay {
    align-items: start;
    padding: 12px;
    overflow-y: auto;
  }

  .system-card {
    max-height: none;
    border-radius: 28px;
  }

  .system-auth-main,
  .system-auth-side,
  .wallet-system-card {
    padding: 22px;
  }

  .system-auth-main h2,
  .wallet-system-card h2 {
    font-size: 42px;
  }

  .system-profile-hero,
  .system-benefit-card {
    border-radius: 22px;
  }

  .wallet-rules {
    display: grid;
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }

  .spend-confirm {
    grid-template-columns: 1fr auto;
    gap: 10px;
    bottom: 82px;
  }

  .spend-confirm .secondary-button,
  .spend-confirm .primary-button {
    width: 100%;
  }
}

.module-dock-panel {
  display: flex !important;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.module-dock-panel .dock-orbit {
  position: absolute;
  inset: 16% -38% auto;
  height: 360px;
  border: 1px solid rgba(125, 92, 255, 0.11);
  border-radius: 50%;
  transform: rotate(-16deg);
  pointer-events: none;
}

.module-dock-panel .dock-orbit::after {
  content: "";
  position: absolute;
  inset: 42px;
  border: 1px solid rgba(37, 132, 255, 0.08);
  border-radius: inherit;
}

.module-dock-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #70747e;
  font-size: 13px;
  font-weight: 820;
}

.module-dock-head span {
  color: #7d5cff;
}

.module-dock-head b {
  max-width: 160px;
  overflow: hidden;
  color: #111216;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-dock {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(18, 20, 28, 0.08);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 26px 70px rgba(62, 65, 84, 0.12);
  backdrop-filter: blur(24px);
}

.module-dock .dock-item {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 22px;
  padding: 9px 5px 8px;
  cursor: pointer;
  transform-origin: center bottom;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.module-dock .dock-item:hover,
.module-dock .dock-item:focus-visible {
  transform: translateY(-5px) scale(1.05);
  border-color: rgba(125, 92, 255, 0.2);
  background: rgba(125, 92, 255, 0.065);
}

.module-dock .dock-item.active {
  border-color: rgba(125, 92, 255, 0.26);
  background: rgba(125, 92, 255, 0.095);
  box-shadow: 0 16px 34px rgba(125, 92, 255, 0.13);
}

.module-dock .dock-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  margin: 0 auto;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(246, 242, 255, 0.72)),
    rgba(125, 92, 255, 0.1);
  color: #7d5cff;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(125, 92, 255, 0.12);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.module-dock .dock-item.active .dock-icon,
.module-dock .dock-item:hover .dock-icon,
.module-dock .dock-item:focus-visible .dock-icon {
  background: linear-gradient(145deg, #8e6cff, #6f4cff);
  color: #fff;
  box-shadow: 0 18px 34px rgba(125, 92, 255, 0.28);
}

.module-dock .dock-item b {
  display: block;
  max-width: 100%;
  overflow: hidden;
  margin-top: 7px;
  color: #5f6370;
  font-size: 11.5px;
  font-weight: 820;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-dock .dock-item.active b,
.module-dock .dock-item:hover b,
.module-dock .dock-item:focus-visible b {
  color: #7d5cff;
}

body.night-mode .module-dock {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(31, 31, 46, 0.72);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

body.night-mode .module-dock-head b,
body.night-mode .module-dock .dock-item b {
  color: rgba(255, 255, 255, 0.78);
}

body.night-mode .module-dock .dock-icon {
  background: rgba(125, 92, 255, 0.16);
}

@media (max-width: 1280px) {
  .module-dock-panel {
    grid-column: 1 / -1;
    min-height: auto;
    justify-content: flex-start;
  }

  .module-dock {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .profile-role-layout {
    grid-template-columns: minmax(260px, 0.74fr) minmax(0, 1.35fr);
  }

  .profile-role-layout > .side-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .module-dock-panel {
    padding: 18px;
  }

  .module-dock {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 12px;
    border-radius: 26px;
    scroll-snap-type: x proximity;
  }

  .module-dock .dock-item {
    flex: 0 0 76px;
    scroll-snap-align: start;
  }

  .module-dock .dock-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

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

  .profile-role-dock,
  .profile-panel,
  .profile-role-layout > .side-panel {
    min-height: auto;
  }

  .profile-role-editor-inner {
    grid-template-columns: 1fr;
  }

  .profile-role-form {
    grid-template-columns: 1fr;
  }
}
