:root {
  --bg: #0d1420;
  --bg-soft: #121d2d;
  --panel: rgba(20, 29, 45, 0.78);
  --panel-strong: rgba(16, 23, 37, 0.9);
  --panel-ghost: rgba(255, 255, 255, 0.05);
  --text: #f4ede4;
  --muted: #a2afc4;
  --line: rgba(255, 255, 255, 0.08);
  --teal: #0f7c76;
  --teal-deep: #0a5a56;
  --gold: #d6b877;
  --rose: #cf7f73;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
  --radius: 28px;
  --radius-small: 18px;
  --display: "Aptos Display", "Segoe UI Variable Display", "Bahnschrift", sans-serif;
  --sans: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 124, 118, 0.26), transparent 26%),
    radial-gradient(circle at 85% 10%, rgba(214, 184, 119, 0.18), transparent 18%),
    radial-gradient(circle at 50% 100%, rgba(207, 127, 115, 0.14), transparent 22%),
    linear-gradient(145deg, #09111a, var(--bg));
}

.ambient {
  position: fixed;
  inset: auto;
  pointer-events: none;
  filter: blur(24px);
  opacity: 0.65;
}

.ambient-a {
  top: 4%;
  left: 4%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(15, 124, 118, 0.12);
}

.ambient-b {
  right: 3%;
  bottom: 6%;
  width: 320px;
  height: 320px;
  border-radius: 38% 62% 40% 60%;
  background: rgba(214, 184, 119, 0.1);
}

.app-frame {
  position: relative;
  width: min(1480px, calc(100% - 28px));
  margin: 18px auto 28px;
}

.glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hidden {
  display: none !important;
}

.auth-view {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 18px;
  min-height: calc(100vh - 56px);
}

.auth-hero,
.auth-panel,
.sidebar,
.chat-pane,
.inspector {
  animation: rise 420ms ease both;
}

.auth-hero,
.auth-panel,
.sidebar,
.chat-pane,
.inspector {
  padding: 28px;
}

.auth-hero {
  display: grid;
  align-content: space-between;
  min-height: 720px;
  background:
    linear-gradient(135deg, rgba(15, 124, 118, 0.22), rgba(214, 184, 119, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    var(--panel);
}

.auth-panel {
  display: grid;
  align-content: start;
  gap: 20px;
}

.mode-switch,
.filter-row,
.hero-badges,
.meta-badges,
.button-grid,
.sidebar-actions,
.topbar-actions,
.composer-tools,
.composer-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-chip,
.filter-chip,
.meta-badge,
.status-pill,
.hero-badges span {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.mode-chip,
.filter-chip {
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-actions button {
  flex: 1 1 150px;
}

.mode-chip.is-active,
.filter-chip.is-active,
.status-pill {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  border-color: transparent;
  color: white;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(3.5rem, 7vw, 6.4rem);
  line-height: 0.92;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.18rem;
}

.lead,
.muted,
.section-copy p,
.feedback,
.empty-note,
.summary-list,
.conversation-meta,
.message-time,
.attachment-meta {
  color: var(--muted);
}

.lead {
  max-width: 56ch;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-badges span,
.meta-badge {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.section-copy {
  display: grid;
  gap: 8px;
}

.section-copy p {
  margin: 0;
  line-height: 1.6;
}

.section-copy-tight {
  gap: 6px;
}

.stack-form,
.stack-card,
.summary-list,
.account-list,
.conversation-list,
.message-thread,
.attachment-preview,
.peer-card,
.profile-card,
.status-grid,
.fingerprint-box {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.compact span {
  font-size: 0.86rem;
}

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

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: rgba(7, 12, 20, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-small);
  padding: 14px 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(162, 175, 196, 0.72);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(15, 124, 118, 0.82);
  box-shadow: 0 0 0 4px rgba(15, 124, 118, 0.14);
}

textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}

button,
.button-like {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  color: white;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  box-shadow: 0 12px 28px rgba(10, 90, 86, 0.26);
  transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
}

button:hover:not(:disabled),
.button-like:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

button.ghost,
.button-like.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.feedback {
  min-height: 1.2rem;
  margin: -2px 0 0;
  font-size: 0.92rem;
}

.feedback.is-error {
  color: #ff9f97;
}

.feedback.is-success {
  color: #88d8cc;
}

.startup-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(207, 127, 115, 0.24);
  border-radius: 24px;
  background: rgba(207, 127, 115, 0.08);
}

.startup-checks {
  display: grid;
  gap: 10px;
}

.startup-check {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(8, 14, 24, 0.3);
}

.startup-check p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.startup-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.startup-check-pill {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.startup-check-pill.is-ok {
  background: rgba(136, 216, 204, 0.14);
  color: #88d8cc;
  border-color: rgba(136, 216, 204, 0.22);
}

.startup-check-pill.is-warn {
  background: rgba(214, 184, 119, 0.14);
  color: #f0d9a4;
  border-color: rgba(214, 184, 119, 0.22);
}

.startup-check-pill.is-error {
  background: rgba(255, 159, 151, 0.14);
  color: #ffb0aa;
  border-color: rgba(255, 159, 151, 0.22);
}

.startup-check-pill.is-info {
  background: rgba(162, 175, 196, 0.14);
  color: #d5deeb;
  border-color: rgba(162, 175, 196, 0.18);
}

.local-accounts {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.account-list {
  max-height: 230px;
  overflow: auto;
}

.account-tile,
.conversation-item,
.status-line,
.message-card,
.storage-chip,
.peer-card,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.account-tile {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.account-tile strong,
.conversation-item strong,
.status-line strong,
.message-head strong,
.summary-key {
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: calc(100vh - 56px);
}

.sidebar,
.chat-pane,
.inspector {
  min-height: calc(100vh - 56px);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
}

.sidebar-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.sidebar-title {
  font-size: 1.6rem;
}

.profile-card {
  padding: 16px;
  align-items: center;
  grid-template-columns: auto 1fr auto;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(15, 124, 118, 0.9), rgba(214, 184, 119, 0.62));
  color: white;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  font-size: 1.08rem;
}

.conversation-list {
  overflow: auto;
  padding-right: 2px;
}

.conversation-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.conversation-item:hover,
.conversation-item.is-active {
  transform: translateY(-1px);
  border-color: rgba(15, 124, 118, 0.55);
  background: rgba(255, 255, 255, 0.07);
}

.conversation-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.conversation-meta,
.message-time,
.attachment-meta,
.summary-key,
.summary-value,
code {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.conversation-preview {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.conversation-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.mini-badge.is-accent {
  color: white;
  background: rgba(15, 124, 118, 0.82);
}

.chat-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.chat-topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-heading {
  display: flex;
  gap: 14px;
  align-items: center;
}

.chat-empty {
  align-self: center;
  justify-self: center;
  text-align: center;
  max-width: 42ch;
}

.chat-empty h3 {
  margin-bottom: 10px;
}

.chat-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.message-thread {
  overflow: auto;
  padding-right: 6px;
  align-content: start;
}

.day-separator {
  justify-self: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.message-card {
  padding: 14px 16px;
  max-width: min(74ch, 86%);
}

.message-card.self {
  justify-self: end;
  background: linear-gradient(135deg, rgba(15, 124, 118, 0.22), rgba(15, 124, 118, 0.1));
  border-bottom-right-radius: 8px;
}

.message-card.peer {
  justify-self: start;
  background: rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 8px;
}

.message-card.system {
  justify-self: center;
  max-width: 92%;
  background: rgba(214, 184, 119, 0.08);
}

.message-head,
.message-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-text {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.message-system {
  margin: 0;
  text-align: center;
  color: var(--text);
  line-height: 1.55;
}

.message-actions {
  display: flex;
  gap: 8px;
}

.message-icon {
  padding: 6px 10px;
  font-size: 0.76rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--muted);
  box-shadow: none;
}

.message-icon.is-starred {
  color: var(--gold);
  border-color: rgba(214, 184, 119, 0.32);
}

.attachment-preview,
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip,
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.attachment-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  box-shadow: none;
  padding: 0;
}

.composer {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.composer-footer {
  align-items: center;
  justify-content: space-between;
}

.file-label input {
  display: none;
}

.inspector {
  display: grid;
  align-content: start;
  gap: 16px;
  overflow: auto;
}

.stack-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.fingerprint-box,
.peer-card,
.status-line {
  padding: 14px 16px;
}

.label,
.summary-key {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold);
}

code {
  overflow-wrap: anywhere;
  color: #d6e9e6;
}

.summary-list {
  gap: 10px;
}

.storage-chip,
.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.storage-chip {
  padding: 12px 14px;
}

.helper-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.sidebar-tip {
  margin-top: -2px;
}

.guide-details {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.guide-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.guide-details[open] summary {
  margin-bottom: 2px;
}

.compact-details {
  gap: 14px;
}

.step-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.step-list li + li {
  margin-top: 6px;
}

.empty-note {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 290px minmax(0, 1fr);
  }

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

@media (max-width: 1060px) {
  .auth-view,
  .workspace {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: auto;
  }

  .sidebar,
  .chat-pane,
  .inspector {
    min-height: auto;
  }

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

@media (max-width: 760px) {
  .app-frame {
    width: min(100% - 16px, 1480px);
    margin: 8px auto 18px;
  }

  .auth-hero,
  .auth-panel,
  .sidebar,
  .chat-pane,
  .inspector {
    padding: 18px;
    border-radius: 24px;
  }

  .chat-topbar,
  .profile-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .chat-heading,
  .sidebar-top {
    align-items: start;
  }

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

  .composer-footer,
  .topbar-actions,
  .sidebar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  button,
  .button-like {
    width: 100%;
  }
}
