:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(10, 16, 29, 0.76);
  --panel-strong: rgba(14, 23, 41, 0.92);
  --line: rgba(120, 202, 255, 0.18);
  --line-hot: rgba(64, 232, 255, 0.48);
  --text: #f4f8ff;
  --muted: #9caabe;
  --cyan: #40e8ff;
  --violet: #9a6cff;
  --blue: #3b7cff;
  --green: #74ffb2;
  --red: #ff6370;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 76% 6%, rgba(64, 232, 255, 0.18), transparent 30rem),
    radial-gradient(circle at 12% 34%, rgba(154, 108, 255, 0.14), transparent 34rem),
    linear-gradient(180deg, #0a0e19, var(--bg) 46%, #070a11);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

textarea,
pre {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--cyan);
  color: #021217;
  font-weight: 900;
}

.skip-link:focus {
  top: 1rem;
}

.app-frame {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  height: 100vh;
  padding: 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(4, 7, 13, 0.82);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  min-height: 52px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-hot);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(64, 232, 255, 0.22), rgba(154, 108, 255, 0.16));
  color: var(--cyan);
  font-weight: 950;
  box-shadow: 0 0 28px rgba(64, 232, 255, 0.2);
}

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

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 0.35rem;
}

.nav-list a {
  padding: 0.8rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c9d4e5;
  font-weight: 800;
}

.nav-list a:hover,
.nav-list a.active {
  border-color: rgba(64, 232, 255, 0.26);
  background: rgba(64, 232, 255, 0.1);
  color: #fff;
}

.rail-status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  margin-top: auto;
  padding: 0.9rem;
  border: 1px solid rgba(255, 99, 112, 0.26);
  border-radius: 8px;
  background: rgba(255, 99, 112, 0.08);
}

.rail-status p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.pulse {
  width: 10px;
  height: 10px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 18px rgba(255, 99, 112, 0.72);
}

.pulse.online {
  background: var(--green);
  box-shadow: 0 0 18px rgba(116, 255, 178, 0.68);
}

.rail-account {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.account-state strong,
.account-state p {
  display: block;
  margin: 0.2rem 0 0;
}

.account-state p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-form {
  display: grid;
  gap: 0.5rem;
}

.auth-form label {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.auth-form input,
.rail-account button,
.conversation-tools select,
.conversation-tools button,
.conversation-actions input,
.conversation-actions button,
.recent-conversations button,
.conversation-list button,
.inline-create input,
.inline-create select,
.inline-create button,
.memory-search,
.memory-fields input,
.memory-fields select,
.memory-filters input,
.memory-filters select,
.profile-form input,
.profile-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.5);
  color: var(--text);
  outline: none;
}

.auth-form input {
  min-height: 38px;
  padding: 0 0.7rem;
}

.auth-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid rgba(64, 232, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.4);
}

.auth-mode button {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.auth-mode button.active {
  border-color: rgba(64, 232, 255, 0.34);
  background: rgba(64, 232, 255, 0.1);
  color: #fff;
}

body[data-auth-mode="login"] .register-only {
  display: none;
}

.auth-actions {
  display: grid;
}

.rail-account button,
.conversation-tools button,
.inline-create button {
  min-height: 36px;
  cursor: pointer;
  font-weight: 950;
}

.primary-action {
  border-color: rgba(64, 232, 255, 0.38) !important;
  background: rgba(64, 232, 255, 0.14) !important;
  color: #e9fbff !important;
}

.form-note {
  margin: 0;
  color: #b9c7d8;
  font-size: 0.78rem;
  line-height: 1.42;
}

.signed-in-card {
  padding: 0.72rem;
  border: 1px solid rgba(116, 255, 178, 0.22);
  border-radius: 8px;
  background: rgba(116, 255, 178, 0.07);
}

.signed-in-card span,
.signed-in-card strong,
.signed-in-card p {
  display: block;
}

.signed-in-card span {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.signed-in-card strong {
  margin-top: 0.18rem;
}

.signed-in-card p {
  margin: 0.18rem 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
}

.sign-out {
  border-color: rgba(255, 99, 112, 0.34) !important;
  background: rgba(255, 99, 112, 0.1) !important;
  color: #ffdbe0 !important;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.58;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hero,
.workspace,
.module {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 0.82fr);
  align-items: center;
  gap: 2rem;
  min-height: 720px;
  padding: 4rem 0 3rem;
}

.eyebrow,
.tag {
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

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

h1 {
  max-width: 11ch;
  margin-bottom: 1.05rem;
  font-size: clamp(3.3rem, 8vw, 7.4rem);
  line-height: 0.88;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.hero-copy p,
.section-head p,
.module-copy p,
.status-card p,
.draft-surface p {
  color: #c8d5e6;
  line-height: 1.62;
}

.hero-copy p {
  max-width: 690px;
  font-size: 1.12rem;
}

.stack-copy {
  color: #afbbce;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.78rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 950;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover,
.launcher-grid a:hover,
.workflow-grid button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: linear-gradient(135deg, var(--cyan), #a2f6ff);
  color: #021217;
}

.button.secondary {
  border-color: rgba(154, 108, 255, 0.45);
  background: rgba(154, 108, 255, 0.13);
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: min(520px, 100%);
  margin-top: 1.3rem;
  padding: 0.35rem;
  border: 1px solid rgba(64, 232, 255, 0.2);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.48);
}

.mode-switch button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #cbd8e8;
  cursor: pointer;
  font-weight: 950;
}

.mode-switch button.active {
  border-color: rgba(64, 232, 255, 0.36);
  background: linear-gradient(135deg, rgba(64, 232, 255, 0.18), rgba(154, 108, 255, 0.12));
  color: #fff;
}

.mode-switch span {
  display: block;
  margin-top: 0.12rem;
  color: var(--green);
  font-size: 0.66rem;
  text-transform: uppercase;
}

body[data-mode="user"] .developer-mode-panel,
body[data-mode="user"] [data-mode-link="developer"],
body[data-mode="developer"] .user-mode-panel,
body[data-mode="developer"] [data-mode-link="user"] {
  display: none !important;
}

.model-orbit,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 24, 43, 0.82), rgba(7, 11, 20, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.model-orbit {
  position: relative;
  min-height: 510px;
  overflow: hidden;
}

.model-orbit::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, #000 20%, transparent 92%);
}

.orbit-top {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  color: #e3f6ff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.orbit-top strong {
  color: var(--green);
}

.neural-core {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 350px;
}

.ring {
  position: absolute;
  border: 1px solid rgba(64, 232, 255, 0.34);
  border-radius: 50%;
}

.ring-a {
  width: 280px;
  height: 280px;
}

.ring-b {
  width: 390px;
  height: 170px;
  transform: rotate(-16deg);
  border-color: rgba(154, 108, 255, 0.42);
}

.ring-c {
  width: 190px;
  height: 390px;
  transform: rotate(28deg);
  border-color: rgba(59, 124, 255, 0.32);
}

.neural-core strong {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border: 1px solid rgba(64, 232, 255, 0.76);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(64, 232, 255, 0.3), rgba(5, 7, 13, 0.94) 68%);
  font-size: 2rem;
  box-shadow: 0 0 52px rgba(64, 232, 255, 0.34);
}

.orbit-metrics {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.orbit-metrics article,
.status-grid article {
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.orbit-metrics span,
.status-grid span,
.small-card span,
.status-card span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.workspace,
.module {
  padding: 4.4rem 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.25rem;
}

.section-head p {
  max-width: 620px;
  margin-bottom: 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 1rem;
}

.chat-panel {
  grid-row: span 2;
  min-height: 560px;
  padding: 1rem;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.badge {
  padding: 0.34rem 0.56rem;
  border-radius: 999px;
  border: 1px solid rgba(64, 232, 255, 0.28);
  color: #dff8ff;
  font-size: 0.72rem;
  font-weight: 950;
  white-space: nowrap;
}

.badge.warn,
.badge.danger {
  border-color: rgba(255, 99, 112, 0.35);
  color: #ffd5da;
}

.thread {
  display: grid;
  gap: 0.8rem;
  min-height: 390px;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.46);
}

.message {
  max-width: 82%;
  padding: 0.85rem;
  border-radius: 8px;
}

.message.assistant {
  background: rgba(64, 232, 255, 0.09);
}

.message.user {
  justify-self: end;
  background: rgba(154, 108, 255, 0.12);
}

.message span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.message p {
  margin-bottom: 0;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.composer input,
.composer button {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.composer input {
  padding: 0 0.9rem;
}

.composer button {
  padding: 0 1rem;
  font-weight: 950;
}

.stack-panel,
.launcher-panel {
  padding: 1rem;
}

.status-grid,
.launcher-grid,
.card-grid,
.workflow-grid,
.training-grid {
  display: grid;
  gap: 1rem;
}

.user-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
}

.user-chat-panel {
  grid-row: span 3;
  min-height: 600px;
  padding: 1rem;
}

.user-thread {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  min-height: 438px;
  max-height: 52vh;
  overflow: auto;
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.46);
}

.user-message {
  max-width: 84%;
  padding: 0.9rem;
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.09);
}

.user-message.user {
  justify-self: end;
  background: rgba(154, 108, 255, 0.13);
}

.user-message span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.user-message p {
  margin-bottom: 0;
  color: #dce8f8;
  line-height: 1.5;
}

.conversation-manager {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.conversation-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
}

.conversation-actions input,
.conversation-actions button,
.recent-conversations button,
.conversation-list button {
  min-height: 38px;
  padding: 0 0.7rem;
}

.conversation-actions button,
.recent-conversations button,
.conversation-list button {
  width: auto;
  background: rgba(64, 232, 255, 0.08);
}

.recent-conversations {
  display: flex;
  min-height: 38px;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.recent-conversations button,
.recent-conversations span {
  flex: 0 0 auto;
  max-width: 190px;
}

.recent-conversations button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-conversations button.active,
.conversation-list article.active {
  border-color: rgba(64, 232, 255, 0.5);
  background: rgba(64, 232, 255, 0.12);
}

.recent-conversations span {
  align-self: center;
  color: #aebdd0;
  font-size: 0.82rem;
}

.conversation-list {
  display: grid;
  gap: 0.5rem;
  max-height: 210px;
  overflow: auto;
  padding-right: 0.15rem;
}

.conversation-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.34);
  padding: 0.45rem;
}

.conversation-load {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  text-align: left;
}

.conversation-load strong,
.conversation-load span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-load strong {
  color: var(--text);
}

.conversation-load span {
  color: #aebdd0;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.conversation-row-actions {
  display: flex;
  gap: 0.35rem;
}

.conversation-row-actions button {
  min-width: 64px;
}

.save-line {
  min-height: 20px;
  margin: -0.25rem 0 0.75rem;
  color: #aebdd0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.user-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.user-composer input {
  min-height: 48px;
  padding: 0 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

.user-composer input:focus {
  border-color: rgba(64, 232, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(64, 232, 255, 0.1);
}

.user-actions-panel,
.user-tool-panel,
.user-workflow-panel,
.user-knowledge-panel,
.user-memory-panel,
.user-activity-panel {
  padding: 1rem;
}

.quick-action-grid {
  display: grid;
  gap: 0.7rem;
}

.quick-action-grid button {
  min-height: 74px;
  padding: 0.9rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(64, 232, 255, 0.08), rgba(154, 108, 255, 0.06)),
    rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease;
}

.quick-action-grid button:hover {
  transform: translateY(-2px);
  border-color: rgba(64, 232, 255, 0.4);
}

.tool-runner {
  display: grid;
  gap: 0.7rem;
}

.tool-runner select,
.tool-runner textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.5);
  color: var(--text);
  outline: none;
}

.tool-runner select {
  min-height: 42px;
  padding: 0 0.8rem;
}

.tool-runner textarea {
  min-height: 120px;
  padding: 0.8rem;
  line-height: 1.45;
  resize: vertical;
}

.tool-save-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.tool-result {
  min-height: 140px;
  margin: 0.85rem 0;
  padding: 0.85rem;
  border: 1px solid rgba(64, 232, 255, 0.16);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.06);
  color: #dce8f8;
  overflow: auto;
  white-space: pre-wrap;
}

.workflow-search {
  width: 100%;
  min-height: 42px;
  margin-bottom: 0.8rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.5);
  color: var(--text);
  outline: none;
}

.workflow-new-button {
  width: 100%;
  margin-bottom: 0.85rem;
}

.knowledge-new-button {
  width: 100%;
  margin-bottom: 0.85rem;
}

.workflow-create-form,
.knowledge-form,
.model-control-form,
.advanced-workflow-editor {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
  padding: 0.85rem;
  border: 1px solid rgba(64, 232, 255, 0.14);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.34);
}

.workflow-create-form label,
.knowledge-form label,
.model-control-form label,
.advanced-workflow-editor label {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.workflow-create-form input,
.workflow-create-form select,
.workflow-create-form textarea,
.knowledge-form input,
.knowledge-form select,
.knowledge-form textarea,
.knowledge-search,
.model-control-form input,
.model-control-form select,
.advanced-workflow-editor select,
.advanced-workflow-editor textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.5);
  color: var(--text);
  outline: none;
}

.workflow-create-form textarea,
.knowledge-form textarea,
.advanced-workflow-editor textarea {
  min-height: 120px;
  padding: 0.8rem;
  line-height: 1.45;
  resize: vertical;
}

.workflow-form-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.workflow-library {
  display: grid;
  gap: 0.7rem;
  max-height: 420px;
  overflow: auto;
}

.knowledge-list {
  display: grid;
  gap: 0.7rem;
  max-height: 420px;
  overflow: auto;
}

.knowledge-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.knowledge-list article.favorite {
  border-color: rgba(64, 232, 255, 0.42);
  background: rgba(64, 232, 255, 0.09);
}

.knowledge-list strong {
  color: var(--text);
}

.knowledge-list span {
  display: block;
  margin-top: 0.2rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.knowledge-list p {
  margin: 0.35rem 0 0;
  color: #aebdd0;
  line-height: 1.45;
}

.knowledge-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.knowledge-actions button {
  min-height: 36px;
  padding: 0 0.7rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.knowledge-attach-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.knowledge-json,
.knowledge-rag-preview {
  max-height: 260px;
  font-size: 0.82rem;
}

.workflow-library article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.workflow-library article.favorite {
  border-color: rgba(64, 232, 255, 0.42);
  background: rgba(64, 232, 255, 0.09);
}

.workflow-library strong,
.workflow-history strong {
  display: block;
  color: var(--text);
}

.workflow-library span,
.workflow-history span {
  display: block;
  margin-top: 0.2rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.workflow-library p {
  margin: 0.35rem 0 0;
  color: #aebdd0;
  line-height: 1.45;
}

.workflow-actions,
.workflow-debug {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.workflow-actions button {
  min-height: 36px;
  padding: 0 0.7rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.workflow-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.workflow-debug {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0.9rem;
}

.workflow-debug article,
.workflow-history article {
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.workflow-debug span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.workflow-debug strong {
  display: block;
  margin-top: 0.25rem;
  color: #dce8f8;
}

.workflow-history {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.workflow-schema {
  min-height: 120px;
  font-size: 0.82rem;
}

.simple-list {
  display: grid;
  gap: 0.7rem;
}

.inline-create,
.profile-form {
  display: grid;
  gap: 0.65rem;
}

.inline-create {
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr) auto auto;
  margin-bottom: 0.85rem;
  align-items: center;
}

.inline-create input,
.inline-create select,
.memory-search,
.memory-fields input,
.memory-fields select,
.memory-filters input,
.memory-filters select {
  min-height: 42px;
  padding: 0 0.8rem;
}

.inline-create button {
  width: auto;
  min-width: 64px;
  padding: 0 0.85rem;
  background: rgba(64, 232, 255, 0.08);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  color: #dce8f8;
  font-size: 0.82rem;
  font-weight: 850;
}

.check-line input {
  width: auto;
  min-width: 18px;
}

.memory-search {
  width: 100%;
  margin-bottom: 0.75rem;
}

.memory-preview {
  min-height: 38px;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(64, 232, 255, 0.14);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.055);
  color: #aebdd0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.memory-fields,
.memory-filters {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.6fr) auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.memory-filters {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.35fr);
  margin-top: 0.8rem;
}

.memory-inspector {
  margin-top: 0.9rem;
}

.memory-json {
  max-height: 220px;
  overflow: auto;
}

.simple-list article {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.simple-list article strong {
  color: var(--green);
}

.simple-list article span {
  color: #dce8f8;
  line-height: 1.45;
}

.memory-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.memory-actions button {
  min-height: 34px;
  padding: 0 0.65rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.profile-form label {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-form input {
  min-height: 42px;
  padding: 0 0.8rem;
}

.profile-form textarea {
  min-height: 86px;
  resize: vertical;
  padding: 0.8rem;
  line-height: 1.5;
}

.persistence-line,
.empty-row {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.profile-form + .persistence-line {
  margin-top: 0.8rem;
}

.simple-list article {
  position: relative;
}

.simple-list article button {
  margin-top: 0.65rem;
  min-height: 32px;
  border: 1px solid rgba(255, 99, 112, 0.34);
  border-radius: 8px;
  background: rgba(255, 99, 112, 0.1);
  color: #ffdbe0;
  cursor: pointer;
  font-weight: 900;
}

.simple-list article {
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.simple-list strong,
.simple-list span {
  display: block;
}

.simple-list strong {
  color: #f4f8ff;
}

.simple-list span {
  margin-top: 0.28rem;
  color: var(--muted);
  line-height: 1.45;
}

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

.launcher-grid a {
  min-height: 112px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 950;
  transition: transform 180ms ease, border-color 180ms ease;
}

.launcher-grid span,
.small-card small,
.status-card p {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
}

.module.split,
.module.reverse {
  display: grid;
  grid-template-columns: minmax(260px, 0.38fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.2rem;
}

.module.reverse .module-copy {
  order: 2;
}

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

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

.small-card,
.status-card {
  min-height: 160px;
  padding: 1rem;
}

.small-card strong,
.status-card strong {
  display: block;
  line-height: 1.35;
}

.draft-surface {
  min-height: 290px;
  padding: 1rem;
}

.editor-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  color: #e4efff;
  font-weight: 900;
}

.editor-top strong {
  color: var(--green);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.editor-lines {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.editor-lines span {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(64, 232, 255, 0.28), rgba(154, 108, 255, 0.08));
}

.editor-lines span:nth-child(2) {
  width: 82%;
}

.editor-lines span:nth-child(3) {
  width: 68%;
}

.editor-lines span:nth-child(4) {
  width: 91%;
}

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

.workflow-grid button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease;
}

.workflow-grid button span {
  color: var(--green);
  font-size: 0.72rem;
  text-transform: uppercase;
}

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

.developer-console {
  border-top: 1px solid rgba(64, 232, 255, 0.12);
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 1rem;
}

.console-card {
  padding: 1rem;
}

.console-chat,
.contract-card {
  grid-column: span 2;
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.console-card label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.console-card textarea,
.console-card input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.5);
  color: var(--text);
  outline: none;
}

.console-card textarea {
  min-height: 120px;
  resize: vertical;
  padding: 0.85rem;
  line-height: 1.5;
}

.console-card input {
  min-height: 44px;
  padding: 0 0.85rem;
}

.console-card textarea:focus,
.console-card input:focus {
  border-color: rgba(64, 232, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(64, 232, 255, 0.1);
}

.console-form {
  display: grid;
  gap: 0.75rem;
}

.console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.console-history {
  display: grid;
  gap: 0.72rem;
  max-height: 330px;
  min-height: 190px;
  margin-bottom: 1rem;
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(3, 6, 12, 0.45);
}

.console-message {
  max-width: 88%;
  padding: 0.78rem;
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.08);
}

.console-message.user {
  justify-self: end;
  background: rgba(154, 108, 255, 0.13);
}

.console-message span,
.response-preview span,
.active-prompt span,
.contract-list span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.console-message p,
.response-preview p,
.active-prompt p {
  margin-bottom: 0;
  color: #dbe8f8;
  line-height: 1.5;
}

.response-preview,
.active-prompt,
.console-output {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(64, 232, 255, 0.16);
  border-radius: 8px;
  background: rgba(64, 232, 255, 0.06);
}

.memory-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.memory-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.memory-item p {
  margin-bottom: 0;
  color: #dce8f8;
}

.memory-item button {
  min-height: 34px;
  border: 1px solid rgba(255, 99, 112, 0.34);
  border-radius: 8px;
  background: rgba(255, 99, 112, 0.1);
  color: #ffdbe0;
  cursor: pointer;
  font-weight: 900;
}

.memory-item .memory-actions button {
  border-color: rgba(64, 232, 255, 0.18);
  background: rgba(64, 232, 255, 0.08);
  color: var(--text);
}

.console-workflows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.console-workflows button {
  min-height: 72px;
  padding: 0.85rem;
  border: 1px solid rgba(64, 232, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
}

.console-output {
  min-height: 170px;
  overflow: auto;
  color: #dce8f8;
  white-space: pre-wrap;
}

.contract-list,
.api-contract {
  display: grid;
  gap: 0.7rem;
}

.contract-list article,
.api-contract article {
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.contract-list strong,
.api-contract strong {
  display: block;
  color: #f2f8ff;
}

.api-contract p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(4, 7, 13, 0.9);
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .rail-status {
    display: none;
  }

  .hero,
  .workspace-grid,
  .user-grid,
  .module.split,
  .module.reverse {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .model-orbit {
    min-height: 460px;
  }

  .module.reverse .module-copy {
    order: 0;
  }

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

  .console-chat,
  .contract-card {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 86px;
  }

  .app-frame {
    display: block;
  }

  .rail {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: block;
    padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(64, 232, 255, 0.18);
    border-bottom: 0;
    background: rgba(4, 7, 13, 0.94);
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.45);
  }

  .rail .brand,
  .rail-status {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 0 0.15rem;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-list a {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0.72rem 0.85rem;
    white-space: nowrap;
  }

  .hero,
  .workspace,
  .module {
    width: min(100% - 28px, 1240px);
  }

  .hero {
    gap: 1rem;
    padding: 1.6rem 0 1rem;
  }

  h1 {
    max-width: 100%;
    font-size: 3rem;
    line-height: 0.94;
  }

  h2 {
    font-size: 1.9rem;
    line-height: 1.04;
  }

  h3 {
    font-size: 1rem;
  }

  .hero-copy p {
    font-size: 1rem;
  }

  .stack-copy {
    display: none;
  }

  .hero-actions {
    display: grid;
    gap: 0.65rem;
  }

  .mode-switch {
    position: sticky;
    top: 0.65rem;
    z-index: 30;
    width: 100%;
    background: rgba(3, 6, 12, 0.88);
    backdrop-filter: blur(16px);
  }

  .mode-switch button {
    min-height: 52px;
  }

  .workspace,
  .module {
    padding: 2.4rem 0;
  }

  .section-head,
  .status-grid,
  .launcher-grid,
  .four,
  .three,
  .workflow-grid,
  .console-grid,
  .console-workflows,
  .training-grid,
  .orbit-metrics {
    grid-template-columns: 1fr;
  }

  .console-chat,
  .contract-card {
    grid-column: span 1;
  }

  .section-head {
    display: grid;
    gap: 0.5rem;
  }

  .model-orbit {
    min-height: 330px;
  }

  .orbit-top {
    padding: 0.85rem;
  }

  .neural-core {
    min-height: 230px;
  }

  .ring-a {
    width: 170px;
    height: 170px;
  }

  .ring-b {
    width: 240px;
    height: 112px;
  }

  .ring-c {
    width: 118px;
    height: 240px;
  }

  .neural-core strong {
    width: 88px;
    height: 88px;
    font-size: 1.5rem;
  }

  .orbit-metrics {
    position: static;
    padding: 0 0.85rem 0.85rem;
  }

  .panel-head {
    display: grid;
    gap: 0.65rem;
  }

  .badge,
  .badge-stack {
    width: max-content;
    max-width: 100%;
  }

  .message {
    max-width: 100%;
  }

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

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

  .user-composer,
  .conversation-actions,
  .inline-create,
  .memory-fields,
  .memory-filters,
  .workflow-library article,
  .workflow-debug,
  .knowledge-list article,
  .knowledge-attach-grid,
  .tool-save-options,
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .conversation-list article {
    grid-template-columns: 1fr;
  }

  .conversation-row-actions {
    justify-content: stretch;
  }

  .conversation-row-actions button {
    flex: 1;
  }

  .user-chat-panel,
  .chat-panel {
    min-height: auto;
    padding: 0.85rem;
  }

  .user-thread {
    min-height: 320px;
    max-height: 58vh;
    padding: 0.75rem;
  }

  .thread,
  .console-history {
    min-height: 250px;
    max-height: 55vh;
    padding: 0.75rem;
  }

  .user-composer input,
  .console-card input,
  .composer input,
  .composer button {
    min-height: 50px;
  }

  .quick-action-grid button,
  .console-workflows button,
  .workflow-grid button {
    min-height: 58px;
    padding: 0.85rem;
  }

  .user-actions-panel,
  .user-memory-panel,
  .user-activity-panel,
  .console-card,
  .stack-panel,
  .launcher-panel,
  .small-card,
  .status-card,
  .draft-surface {
    padding: 0.85rem;
  }

  .console-card textarea {
    min-height: 150px;
    font-size: 1rem;
  }

  .console-output {
    min-height: 150px;
    overflow-wrap: anywhere;
    font-size: 0.86rem;
  }

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

  .memory-item button {
    min-height: 42px;
    width: 100%;
  }

  .developer-console {
    order: 2;
  }

  #planning {
    order: 3;
  }

  #drafting {
    order: 4;
  }

  #memory {
    order: 5;
  }

  #workflows {
    order: 6;
  }

  #training {
    order: 7;
  }

  .console-chat {
    order: 1;
  }

  .console-card[aria-labelledby="prompt-editor-title"] {
    order: 2;
  }

  .console-card[aria-labelledby="memory-tester-title"] {
    order: 3;
  }

  .console-card[aria-labelledby="workflow-tester-title"] {
    order: 4;
  }

  .console-card[aria-labelledby="improvement-notes-title"] {
    order: 5;
  }

  .console-card[aria-labelledby="console-model-status-title"] {
    order: 6;
  }

  .contract-card {
    order: 7;
  }

  .button {
    width: 100%;
  }

  .console-actions {
    display: grid;
  }
}

@media (max-width: 430px) {
  .hero,
  .workspace,
  .module {
    width: min(100% - 20px, 1240px);
  }

  h1 {
    font-size: 2.65rem;
  }

  h2 {
    font-size: 1.62rem;
  }

  .hero {
    padding-top: 1.15rem;
  }

  .model-orbit {
    min-height: 300px;
  }

  .neural-core {
    min-height: 200px;
  }

  .ring-a {
    width: 145px;
    height: 145px;
  }

  .ring-b {
    width: 204px;
    height: 94px;
  }

  .ring-c {
    width: 98px;
    height: 204px;
  }

  .orbit-metrics article,
  .status-grid article,
  .contract-list article,
  .api-contract article,
  .simple-list article {
    padding: 0.75rem;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 2.35rem;
  }

  h2 {
    font-size: 1.46rem;
  }

  .hero-copy p,
  .section-head p,
  .module-copy p,
  .status-card p,
  .draft-surface p,
  .simple-list span,
  .api-contract p {
    font-size: 0.94rem;
  }

  .mode-switch,
  .panel,
  .model-orbit {
    border-radius: 7px;
  }

  .nav-list a {
    min-height: 46px;
    padding: 0.68rem 0.76rem;
    font-size: 0.9rem;
  }
}
