:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #68736e;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f1f3f4;
  --line: #e2e5e7;
  --rail: #ffffff;
  --rail-soft: #f0f4f3;
  --signal: #e9633b;
  --signal-dark: #c64a27;
  --moss: #3d5b50;
  --blue-soft: #e7eef7;
  --shadow: 0 18px 52px rgb(35 38 31 / 12%);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Aptos", "Microsoft YaHei UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.kicker { margin: 0; color: var(--signal); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.65; }
.rail-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .04em; }
.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: white;
  background: var(--signal);
  font-weight: 900;
}

.auth-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 50% 12%, rgb(233 99 59 / 9%), transparent 28%),
    #f6f4ee;
}
.auth-panel {
  width: min(100%, 520px);
  padding: clamp(34px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgb(255 253 250 / 92%);
  box-shadow: var(--shadow);
}
.auth-stack { width: 100%; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 900; letter-spacing: .02em; }
.auth-brand img { width: 42px; height: 42px; }
.auth-heading { margin-top: 48px; }
.auth-heading h1 { margin: 0; font-family: "Rockwell", "STZhongsong", serif; font-size: 38px; }
.auth-heading p { margin: 12px 0 0; color: var(--muted); line-height: 1.6; }
.remembered-accounts { display: grid; gap: 8px; margin-top: 24px; }
.remembered-account, .session-account {
  display: grid;
  width: 100%;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.remembered-account:hover, .session-account:hover { border-color: #a9afa8; background: #fff; }
.remembered-account span, .session-account span { min-width: 0; }
.remembered-account strong, .remembered-account small, .session-account strong, .session-account small { display: block; }
.remembered-account small, .session-account small { margin-top: 3px; color: var(--muted); }
.remembered-account b, .session-account b { color: var(--signal-dark); font-size: 12px; }
.session-account { margin-top: 8px; border-color: rgb(230 95 53 / 42%); }
.auth-card { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
label { display: grid; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 13px; font-weight: 700; }
.secret-field {
  position: relative;
  display: flex;
  align-items: center;
}
.secret-field input {
  padding-right: 84px;
}
.secret-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 58px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  padding: 0 10px;
  color: var(--moss);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}
.secret-toggle:hover {
  background: #eef3f1;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  padding: 13px 14px;
  color: var(--ink);
  background: white;
}
input:focus, textarea:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgb(230 95 53 / 11%); }
.primary-action, .secondary-action {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 800;
}
.primary-action { color: white; background: var(--signal); }
.primary-action:hover { background: var(--signal-dark); }
.secondary-action { color: var(--ink); border-color: var(--line); background: transparent; }
.auth-card .primary-action { width: 100%; margin-top: 8px; }
.form-error { min-height: 20px; margin: 8px 0 0; color: #aa321f; font-size: 13px; }
.form-message { min-height: 18px; color: var(--moss); font-size: 13px; }

.app-view { display: grid; height: 100vh; grid-template-columns: 360px minmax(0, 1fr); overflow: hidden; background: #fff; }
.app-view.rail-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app-view.rail-collapsed .rail { visibility: hidden; width: 0; padding: 0; border: 0; overflow: hidden; }
.rail {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 18px 12px 14px;
  color: var(--ink);
  border-right: 1px solid var(--line);
  background: var(--rail);
  overflow: visible;
}
.rail-brand { display: flex; justify-content: space-between; padding: 2px 8px 24px; }
.rail-brand > div { display: flex; align-items: center; gap: 11px; }
.rail-brand img { width: 34px; height: 34px; }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #3c4043;
  background: transparent;
  font-size: 25px;
}
.icon-button:hover { background: var(--surface-soft); }
.rail-actions { display: grid; gap: 3px; }
.rail-action {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: #202124;
  background: transparent;
  text-align: left;
  font-weight: 650;
}
.rail-action:hover { background: var(--surface-soft); }
.rail-action.active { background: #e7efed; }
.action-icon { display: grid; width: 24px; place-items: center; font-size: 22px; font-weight: 400; }
.search-panel { padding: 9px 8px 0; }
.search-panel input { border-radius: 18px; padding: 10px 13px; background: #f6f8f8; }
.conversation-section { min-height: 0; margin-top: 24px; flex: 1; overflow: hidden; }
.rail-label { margin: 0 10px 10px; color: #70757a; font-size: 12px; font-weight: 600; }
.conversation-list { display: grid; max-height: 100%; gap: 2px; overflow-y: auto; scrollbar-width: thin; }
.conversation-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 12px;
}
.conversation-row:hover, .conversation-row.active { background: #edf2f1; }
.conversation-item {
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  padding: 10px 11px;
  color: #202124;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-row:hover .conversation-item, .conversation-row.active .conversation-item { color: #202124; }
.conversation-delete {
  width: 34px;
  height: 34px;
  margin-right: 3px;
  border: 0;
  border-radius: 9px;
  color: #5f6368;
  background: transparent;
  opacity: 0;
}
.conversation-row:hover .conversation-delete, .conversation-row:focus-within .conversation-delete { opacity: 1; }
.conversation-delete:hover { color: #202124; background: #dfe5e3; }
.conversation-menu {
  position: fixed;
  z-index: 30;
  width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 16px 44px rgb(30 35 32 / 16%);
}
.conversation-menu button {
  display: flex;
  width: 100%;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: #202124;
  background: transparent;
  text-align: left;
}
.conversation-menu button:hover { background: #f0f1f1; }
.conversation-menu button.danger:hover { background: #fbe9e7; color: #b3261e; }
.conversation-rename {
  width: calc(100% - 8px);
  margin: 4px;
  border-radius: 9px;
  padding: 8px 9px;
}
.rail-account {
  display: grid;
  width: 100%;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 14px 10px 4px;
  color: #202124;
  background: white;
  text-align: left;
}
.rail-account > span:first-child { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: white; background: var(--moss); }
.rail-account strong, .rail-account small { display: block; }
.rail-account small { margin-top: 2px; color: #70757a; }
.rail-account b { color: #5f6368; }
.rail-account:hover { background: #f6f8f8; }
.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  color: #aebcb5;
  background: transparent;
  text-align: left;
}
.nav-item:hover, .nav-item.active { color: white; background: var(--rail-soft); }
.rail-footer { display: flex; align-items: center; gap: 8px; margin: 18px 8px 0; color: #83968d; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #71ba94; box-shadow: 0 0 0 4px rgb(113 186 148 / 12%); }

.workspace { display: grid; min-width: 0; min-height: 0; grid-template-rows: 72px minmax(0, 1fr); background: #fff; }
.workspace-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  border-bottom: 0;
  background: #fff;
}
.workspace-header h1 { margin: 0; font-family: "Rockwell", "STZhongsong", serif; font-size: 26px; }
.device-switcher {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}
.device-switcher select {
  min-width: 190px;
  max-width: min(360px, 34vw);
  min-height: 34px;
  border-radius: 999px;
  padding: 0 30px 0 12px;
  color: #34473e;
  background: #f4faf7;
  font-size: 12px;
  font-weight: 750;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 7px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.user-chip:hover { background: var(--surface-soft); }
.user-chip > span:first-child { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: white; background: var(--moss); }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { margin-top: 2px; color: var(--muted); }
.view { display: none; min-height: 0; }
.view.active { display: block; }

.chat-view.active { display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.chat-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat-scroll.switching { opacity: .48; }
.chat-stream { display: flex; width: min(100%, 940px); flex-direction: column; gap: 26px; margin: 0 auto; padding: 42px 28px 34px; }
.message { display: flex; width: 100%; }
.message.assistant { justify-content: flex-start; }
.message.user { justify-content: flex-end; }
.message-card { display: grid; max-width: min(76%, 720px); grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
.message.user .message-card { display: block; max-width: min(68%, 620px); }
.message-avatar { width: 34px; height: 34px; border-radius: 11px; }
.message-content { padding: 2px 0; line-height: 1.78; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-content { padding: 13px 17px; border-radius: 20px 20px 4px 20px; background: var(--blue-soft); }
.message-meta { margin-top: 8px; color: #8c948f; font-size: 10px; }
.message.user .message-meta { text-align: right; }
.hardware-control-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  width: fit-content;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #d9e6df;
  border-radius: 16px;
  background: #f4faf7;
  color: #33443b;
  font-size: 12px;
}
.hardware-control-card strong { color: var(--signal-dark); }
.hardware-control-card span { color: var(--muted); }
.empty-chat {
  display: grid;
  width: min(100%, 760px);
  height: 100%;
  margin: 0 auto;
  place-items: center;
  align-content: center;
  padding: 36px;
  text-align: center;
}
.empty-chat h2 { margin: 20px 0 8px; font-family: "Rockwell", "STZhongsong", serif; font-size: clamp(28px, 4vw, 44px); }
.empty-chat p { max-width: 560px; color: var(--muted); line-height: 1.7; }
.empty-mark { width: 58px; height: 58px; }
.composer {
  position: relative;
  z-index: 3;
  width: min(calc(100% - 48px), 900px);
  margin: 0 auto 22px;
  padding: 12px 76px 9px 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 24px rgb(42 45 38 / 12%);
}
.composer textarea { min-height: 48px; max-height: 170px; resize: none; border: 0; border-radius: 0; padding: 11px 8px 7px; background: transparent; }
.composer textarea:focus { box-shadow: none; }
.composer > button {
  position: absolute;
  top: 13px;
  right: 14px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 17px;
  color: white;
  background: var(--signal);
  font-weight: 800;
}
.composer > button:disabled { opacity: .55; cursor: wait; }
.composer-meta { display: flex; justify-content: space-between; gap: 12px; padding: 0 4px; color: #909791; font-size: 10px; }
.composer-state {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.chat-model-select {
  display: inline-block;
  max-width: min(360px, 36vw);
  min-height: 26px;
  border: 1px solid #d9e6df;
  border-radius: 999px;
  padding: 0 26px 0 10px;
  color: #34473e;
  background: #f4faf7;
  font-size: 11px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-model-select:disabled { opacity: .72; cursor: wait; }

.scrollable-view { height: 100%; overflow-y: auto; padding: 42px clamp(24px, 5vw, 72px) 64px; }
.section-intro { max-width: 760px; margin-bottom: 34px; }
.section-intro h2, .account-card h2 { margin: 9px 0; font-family: "Rockwell", "STZhongsong", serif; font-size: clamp(29px, 4vw, 44px); }
.section-intro > p:last-child { color: var(--muted); line-height: 1.7; }
.knowledge-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.knowledge-item, .signal-card, .account-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.knowledge-item { padding: 22px; }
.knowledge-item strong { display: block; margin-bottom: 10px; overflow-wrap: anywhere; }
.knowledge-item span { color: var(--muted); font-size: 12px; }
.signal-list { display: grid; gap: 18px; }
.signal-overview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 18px;
  border: 1px solid #dfe7e3;
  border-radius: 14px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 13px;
}
.signal-overview div { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.signal-overview strong { font-weight: 850; }
.status-dot-mini {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a8b1ad;
  box-shadow: 0 0 0 4px rgb(168 177 173 / 15%);
}
.status-dot-mini.online { background: #4c9a6a; box-shadow: 0 0 0 4px rgb(76 154 106 / 14%); }
.status-dot-mini.waiting { background: #b58a31; box-shadow: 0 0 0 4px rgb(181 138 49 / 14%); }
.status-dot-mini.offline { background: #b95a45; box-shadow: 0 0 0 4px rgb(185 90 69 / 14%); }
.signal-error {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #f0c8c0;
  border-radius: 12px;
  background: #fff6f4;
  color: #a23b29;
  font-size: 13px;
}
.signal-card { padding: clamp(22px, 4vw, 38px); }
.signal-head { display: flex; justify-content: space-between; gap: 20px; }
.signal-head h3 { margin: 6px 0 0; font-family: "Rockwell", serif; font-size: 30px; }
.signal-status-stack {
  display: grid;
  justify-items: end;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid #d6ded9;
  border-radius: 999px;
  padding: 0 10px;
  color: #53615b;
  background: #f4f7f5;
  font-size: 12px;
  font-weight: 800;
}
.status-pill.online { border-color: #cbe4d4; color: #276c42; background: #effaf3; }
.status-pill.offline { border-color: #f0c8c0; color: #a23b29; background: #fff6f4; }
.status-pill.waiting { border-color: #ead9ac; color: #81621d; background: #fffaf0; }
.signal-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.signal-wire { padding: 18px; border-radius: 14px; color: white; background: var(--moss); }
.signal-wire strong, .signal-wire span { display: block; }
.signal-wire span { margin-top: 7px; color: #c2d0c9; font-size: 12px; }
.signal-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.signal-structure-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid #e1e8e4;
  border-radius: 12px;
  background: #f7faf8;
  color: #52615a;
  line-height: 1.65;
}
.endpoint-section {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.endpoint-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.endpoint-section-head strong {
  font-size: 14px;
}
.endpoint-section-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.endpoint-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #dde6e1;
  border-radius: 8px;
  background: #fbfcfb;
}
.endpoint-card-bus {
  background: #fcfaf2;
  border-color: #eadfbe;
}
.endpoint-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.endpoint-title strong, .endpoint-title span { display: block; }
.endpoint-title strong { font-size: 17px; }
.endpoint-title div > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.endpoint-kind {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  margin-bottom: 8px;
  border-radius: 999px;
  padding: 0 8px;
  color: #7a6020;
  background: #f7edd1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.reading-item {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: #eef4f1;
}
.reading-item span { display: block; color: var(--muted); font-size: 12px; }
.reading-item strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 22px; }
.capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.capability-row span {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #52615a;
  background: #edf2f0;
  font-size: 11px;
  font-weight: 750;
}
.endpoint-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.binding-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbe4df;
  border-radius: 10px;
  background: #f6faf7;
}
.binding-panel.pending {
  border-color: #ead9ac;
  background: #fffaf0;
}
.binding-summary {
  display: grid;
  gap: 4px;
}
.binding-summary strong {
  font-size: 13px;
}
.binding-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.binding-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}
.binding-controls select {
  min-height: 40px;
}
.binding-controls .secondary-action {
  min-height: 40px;
  white-space: nowrap;
}
.binding-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.endpoint-note { margin: 22px 0 0; color: var(--muted); }
.model-config-shell { display: grid; gap: 18px; }
.model-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.model-hero h2 {
  margin: 9px 0 0;
  font-family: "Rockwell", "STZhongsong", serif;
  font-size: clamp(29px, 4vw, 44px);
}
.active-model-badge {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid #dbe7e1;
  border-radius: 14px;
  background: #f5faf7;
  color: var(--muted);
  font-size: 12px;
}
.active-model-badge strong { color: var(--ink); font-size: 14px; }
.model-config-list { display: grid; gap: 12px; }
.model-profile-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.model-form-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.model-form-head h3 { margin: 6px 0 0; font-size: 22px; }
.model-form-head select { width: min(100%, 260px); }
.model-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
}
.model-form-grid label { margin-top: 0; }
.model-form-grid .wide { grid-column: 1 / -1; }
.model-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.model-option.active { border-color: #bdd9cc; background: #f4faf7; }
.model-option-main { min-width: 0; }
.model-provider {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--signal-dark);
  background: #fff1eb;
  font-size: 11px;
  font-weight: 850;
}
.model-option strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 19px;
}
.model-option p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.model-tags span {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #52615a;
  background: #edf2f0;
  font-size: 11px;
  font-weight: 750;
}
.model-option button { min-width: 92px; }
.model-option .model-delete { min-width: 76px; }
.model-option button:disabled { opacity: .7; cursor: default; }
.provision-shell { display: grid; gap: 18px; }
.provision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 18px;
}
.provision-grid .wide { grid-column: 1 / -1; }
.provision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.danger-soft {
  color: #b3261e;
  border-color: #f4c7c3;
  background: #fff6f5;
}
.danger-soft:hover { background: #fbe9e7; }
.provision-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.provision-panel h3 { margin: 6px 0 0; font-size: 22px; }
.wifi-network-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.wifi-network-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.wifi-network-item strong {
  display: block;
  overflow-wrap: anywhere;
}
.wifi-network-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.wifi-network-item button { min-width: 70px; }
.wifi-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.wifi-item-actions button { min-width: 64px; }
.wifi-band-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.provision-log {
  min-height: 150px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #dbe7e1;
  border-radius: 8px;
  background: #f5faf7;
  color: #31433b;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.account-card { padding: 28px; }
.password-card { padding-top: 38px; }
.password-card .primary-action { margin-top: 28px; }
.account-card.wide { grid-column: 1 / -1; }
.account-card h2 { font-size: 30px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.user-list { margin-top: 20px; border-top: 1px solid var(--line); }
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 96px minmax(140px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.user-row strong, .user-row span { overflow-wrap: anywhere; }
.user-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.user-actions {
  display: flex;
  justify-content: flex-end;
}

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgb(23 32 29 / 58%); backdrop-filter: blur(5px); }
.dialog-card { width: min(92vw, 460px); padding: 34px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.dialog-card h2 { margin: 10px 0 0; font-family: "Rockwell", serif; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@media (max-width: 820px) {
  .auth-view { padding: 0; background: var(--surface); }
  .auth-panel { min-height: 100vh; border: 0; border-radius: 0; padding: 36px 24px; box-shadow: none; }
  .app-view { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { min-height: auto; padding: 10px 12px; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; }
  .rail-brand strong, .conversation-section, .rail-account, .search-panel { display: none; }
  .rail-brand { padding: 0; }
  .rail-brand .icon-button { display: none; }
  .rail-actions { display: flex; }
  .rail-action { min-width: max-content; min-height: 40px; }
  .workspace { grid-template-rows: 72px minmax(0, 1fr); }
  .workspace-header { padding: 0 16px; gap: 10px; }
  .workspace-header .kicker, .user-chip small { display: none; }
  .device-switcher select { min-width: 0; max-width: 46vw; }
  .message-card { max-width: 90%; }
  .message.user .message-card { max-width: 86%; }
  .composer-meta { align-items: flex-start; }
  .composer-state { max-width: 52%; }
  .chat-model-select { max-width: 100%; }
  .model-hero, .model-option, .model-form-grid, .provision-grid { grid-template-columns: 1fr; align-items: stretch; }
  .model-hero { display: grid; }
  .model-form-head { display: grid; }
  .model-form-head select { width: 100%; }
  .model-form-grid .wide, .provision-grid .wide { grid-column: auto; }
  .active-model-badge { justify-items: start; min-width: 0; }
  .model-option button { width: 100%; }
  .chat-stream { padding: 28px 16px; }
  .composer { width: calc(100% - 24px); margin-bottom: 12px; }
  .account-grid, .signal-pair, .reading-grid { grid-template-columns: 1fr; }
  .signal-head, .endpoint-title { flex-direction: column; }
  .signal-status-stack { justify-items: start; text-align: left; }
  .account-card.wide { grid-column: auto; }
  .user-row { grid-template-columns: 1fr; gap: 8px; }
  .user-actions { justify-content: flex-start; }
}
.expand-rail { margin-right: 10px; }

/* Vela login: a lightweight CSS 3D scene with a static fallback. */
.auth-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(430px, .85fr);
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(24px, 4vw, 64px);
  background:
    radial-gradient(circle at 74% 18%, rgb(255 255 255 / 96%), transparent 30%),
    radial-gradient(circle at 18% 24%, rgb(233 99 59 / 11%), transparent 31%),
    linear-gradient(135deg, #f7f4ed 0%, #f3f5f1 52%, #ecefea 100%);
}
.auth-view::before {
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image: radial-gradient(rgb(31 47 42 / 15%) .7px, transparent .7px);
  background-size: 22px 22px;
  content: "";
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}
.auth-atmosphere {
  position: relative;
  z-index: -1;
  min-width: 0;
  height: min(76vh, 740px);
  perspective: 1200px;
  transform-style: preserve-3d;
}
#authCanvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.auth-grid-plane {
  position: absolute;
  left: 3%;
  bottom: -25%;
  width: 88%;
  height: 76%;
  border-radius: 50%;
  opacity: .32;
  background-image:
    linear-gradient(rgb(61 91 80 / 16%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(61 91 80 / 16%) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(ellipse, #000 0%, transparent 68%);
  transform: rotateX(68deg) translateZ(-90px);
  transform-origin: center bottom;
}
.auth-scene {
  position: absolute;
  inset: 3% 2% 5%;
  transform-style: preserve-3d;
  will-change: transform;
}
.auth-object {
  position: absolute;
  top: 45%;
  left: 49%;
  width: clamp(220px, 24vw, 340px);
  aspect-ratio: 1 / 1.12;
  transform: translate(-50%, -50%) rotateX(9deg) rotateY(-14deg);
  transform-style: preserve-3d;
  will-change: transform;
}
.object-slab {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 32px;
  box-shadow: 0 34px 70px rgb(30 43 38 / 16%);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: auto;
}
.slab-back {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 25px;
  color: rgb(255 255 255 / 74%);
  background: linear-gradient(150deg, #304c42, #14251f);
  transform: translate3d(-52px, 32px, -100px) rotateZ(-12deg);
}
.slab-back span, .slab-back b, .slab-mid em {
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .18em;
}
.slab-mid {
  padding: 29px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 85%), rgb(255 255 255 / 42%)),
    #b9c6be;
  transform: translate3d(40px, -22px, -48px) rotateZ(9deg);
}
.slab-line {
  display: block;
  width: 52%;
  height: 6px;
  margin-bottom: 10px;
  border-radius: 9px;
  background: rgb(32 51 44 / 22%);
}
.slab-line.short { width: 31%; }
.slab-mid em { position: absolute; right: 25px; bottom: 24px; color: rgb(32 51 44 / 48%); }
.slab-front {
  background: linear-gradient(155deg, rgb(255 255 255 / 97%), rgb(248 247 241 / 82%)), #fff;
  transform: translate3d(0, 0, 32px);
}
.slab-front::after {
  position: absolute;
  inset: 18px;
  border: 1px solid rgb(23 32 29 / 9%);
  border-radius: 23px;
  content: "";
}
.slab-front > img {
  position: absolute;
  top: 47%;
  left: 50%;
  width: 82px;
  height: 82px;
  filter: drop-shadow(0 15px 24px rgb(34 50 44 / 18%));
  transform: translate(-50%, -50%);
}
.object-index { position: absolute; top: 34px; left: 36px; color: #7c8882; font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.object-status {
  position: absolute;
  right: 35px;
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #5f6c66;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18em;
}
.object-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 5px rgb(233 99 59 / 12%); }
.object-shadow {
  position: absolute;
  right: 4%;
  bottom: -18%;
  left: 4%;
  height: 22%;
  border-radius: 50%;
  background: rgb(25 39 34 / 18%);
  filter: blur(28px);
  transform: translateZ(-120px) rotateX(72deg);
}
.scene-orbit {
  position: absolute;
  top: 50%;
  left: 48%;
  border: 1px solid rgb(48 75 65 / 15%);
  border-radius: 50%;
  contain: layout paint;
  transform-style: preserve-3d;
}
.orbit-one { width: min(48vw, 650px); aspect-ratio: 1; transform: translate(-50%, -50%) rotateX(66deg) rotateZ(-11deg); }
.orbit-two { width: min(37vw, 500px); aspect-ratio: 1; transform: translate(-50%, -50%) rotateY(70deg) rotateZ(24deg); }
.scene-orbit i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 7px rgb(233 99 59 / 10%);
}
.scene-orbit i:nth-child(1) { top: 12%; left: 25%; }
.scene-orbit i:nth-child(2) { right: 7%; bottom: 34%; background: var(--moss); }
.scene-orbit i:nth-child(3) { bottom: 5%; left: 38%; width: 5px; height: 5px; }
.scene-coordinate {
  position: absolute;
  color: rgb(49 69 61 / 52%);
  font: 700 9px/1 "Consolas", monospace;
  letter-spacing: .16em;
}
.coordinate-a { top: 14%; left: 8%; }
.coordinate-b { right: 7%; bottom: 12%; }
.auth-panel {
  position: relative;
  z-index: 2;
  width: min(100%, 510px);
  justify-self: center;
  padding: clamp(34px, 4vw, 54px);
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 34px;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 28px 90px rgb(37 48 42 / 14%), inset 0 1px 0 rgb(255 255 255 / 80%);
  backdrop-filter: blur(24px) saturate(1.08);
  transform-style: preserve-3d;
  will-change: transform;
}
.auth-brand i { width: 5px; height: 5px; margin-left: auto; border-radius: 50%; background: #65a480; box-shadow: 0 0 0 5px rgb(101 164 128 / 12%); }
.auth-heading { margin-top: 54px; }
.auth-eyebrow { margin: 0 0 10px !important; color: var(--signal) !important; font-size: 10px; font-weight: 900; letter-spacing: .2em; text-transform: uppercase; }
.auth-heading h1 { font-size: clamp(36px, 4vw, 48px); letter-spacing: -.04em; }
.remembered-account, .session-account { transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.remembered-account:hover, .session-account:hover {
  border-color: #a9afa8;
  background: #fff;
  box-shadow: 0 10px 28px rgb(31 46 40 / 8%);
  transform: translateY(-2px);
}
.auth-view input { transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.auth-view input:focus { box-shadow: 0 0 0 4px rgb(230 95 53 / 10%); }
.auth-view .primary-action {
  box-shadow: 0 10px 24px rgb(198 74 39 / 18%);
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.auth-view .primary-action:hover { box-shadow: 0 14px 30px rgb(198 74 39 / 24%); transform: translateY(-1px); }
.auth-view .primary-action:active { transform: translateY(1px) scale(.99); }

@media (max-width: 820px) {
  .auth-view { display: grid; grid-template-columns: 1fr; align-items: center; padding: 18px; background: #f6f5f0; }
  .auth-atmosphere { position: absolute; inset: 0; height: 100%; opacity: .58; }
  .auth-grid-plane { display: none; }
  .auth-scene { inset: 0; }
  .auth-object { top: 18%; left: 83%; width: 210px; opacity: .42; }
  .scene-orbit { top: 18%; left: 83%; }
  .orbit-one { width: 360px; }
  .orbit-two, .scene-coordinate { display: none; }
  .auth-panel {
    width: min(100%, 520px);
    min-height: auto;
    border: 1px solid rgb(255 255 255 / 82%);
    border-radius: 28px;
    padding: 34px 24px;
    box-shadow: 0 24px 70px rgb(37 48 42 / 13%);
  }
  .auth-heading { margin-top: 44px; }
}

@media (max-width: 480px) {
  .auth-view { padding: 10px; }
  .auth-panel { padding: 28px 20px; border-radius: 24px; backdrop-filter: blur(18px); }
  .auth-brand img { width: 38px; height: 38px; }
  .auth-heading { margin-top: 34px; }
  .auth-heading h1 { font-size: 36px; }
  .remembered-accounts { margin-top: 18px; }
  .auth-card { margin-top: 18px; }
  .auth-view label { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .auth-scene, .auth-panel, .auth-object, .object-slab { will-change: auto; }
}
