:root {
  color-scheme: light;
  --cobalt: #1537c8;
  --cobalt-deep: #0b1f78;
  --cobalt-light: #e8edff;
  --paper: #f4f5ef;
  --paper-bright: #fbfcf7;
  --ink: #141716;
  --muted: #666d68;
  --line: #d4d8d1;
  --proof: #d84532;
  --success: #17724a;
  --warning: #9a5b00;
  --shadow: 0 22px 70px rgba(20, 23, 22, 0.1);
  --radius-control: 10px;
  --radius-strip: 12px;
  --radius-panel: 14px;
  --radius-sheet: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(216, 69, 50, 0.45);
  outline-offset: 3px;
}
::selection { color: #fff; background: var(--cobalt); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #aeb5ad; border: 3px solid var(--paper-bright); border-radius: 10px; }
::-webkit-scrollbar-track { background: var(--paper-bright); }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  overflow: hidden;
}

.method-rail {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 24px;
  color: #fff;
  background: var(--cobalt);
  overflow: hidden;
}
.method-rail::after {
  content: "稿";
  position: absolute;
  right: -30px;
  bottom: 46px;
  color: rgba(255, 255, 255, 0.05);
  font-size: 210px;
  font-weight: 900;
  line-height: 0.8;
  pointer-events: none;
}
.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.04em;
}
.brand > span:last-child { display: grid; gap: 5px; }
.brand strong { font-size: 17px; letter-spacing: 0.08em; }
.brand small { color: rgba(255, 255, 255, 0.8); font-size: 11px; letter-spacing: 0.14em; }

.rail-disclosure { position: relative; z-index: 1; }
.mobile-nav-toggle { display: none; }
.mobile-nav-panel { display: contents; }
.mode-disclosure { margin-top: 38px; }
.rail-summary { display: none; }
.mode-list { position: relative; z-index: 1; display: grid; gap: 7px; }
.mode-button {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 13px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-panel);
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.mode-button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.mode-button[aria-selected="true"] { color: var(--ink); background: #fff; border-color: #fff; }
.mode-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}
.mode-button > span:last-child { display: grid; }
.mode-button strong { font-size: 14px; }

.task-disclosure {
  min-height: 0;
  margin-top: 24px;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.task-history { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.task-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 8px;
}
.task-history-header h2 {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.task-history-header span { color: rgba(255, 255, 255, 0.82); font-size: 11px; font-variant-numeric: tabular-nums; }
.task-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
}
.task-list::-webkit-scrollbar { width: 5px; }
.task-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.34); border: 0; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-item {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.task-item:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.task-item[aria-current="true"] { color: #fff; background: rgba(5, 22, 105, 0.38); border-color: rgba(255, 255, 255, 0.24); }
.task-item > strong { overflow: hidden; font-size: 12px; font-weight: 650; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.task-item > span { min-width: 0; display: flex; align-items: center; gap: 7px; color: rgba(255, 255, 255, 0.8); font-size: 11px; }
.task-item b, .task-item i, .task-item time { min-width: 0; font: inherit; }
.task-item b { color: rgba(255, 255, 255, 0.9); }
.task-item i { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item time { margin-left: auto; font-variant-numeric: tabular-nums; }
.task-empty { margin: 3px 4px; color: rgba(255, 255, 255, 0.82); font-size: 11px; line-height: 1.65; }

.service-card {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 11px;
  align-items: center;
  padding: 14px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.service-card:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.service-card div { display: grid; gap: 4px; }
.service-card strong { font-size: 12px; }
.service-card small { color: rgba(255, 255, 255, 0.82); font-size: 11px; line-height: 1.45; }
.profile-entry-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.42); border-radius: 50%; }
.profile-entry-icon svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; }

.workspace {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(90deg, rgba(20, 23, 22, 0.03) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--paper);
  overflow: hidden;
}
.conversation-header {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 34px 18px;
  border-bottom: 1px solid rgba(212, 216, 209, 0.82);
}
.key-setup-notice {
  width: 100%;
  min-width: 0;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(154, 91, 0, 0.28);
  border-radius: var(--radius-control);
  color: #5f4108;
  background: #fff6df;
}
.key-setup-notice > div:first-child { min-width: 0; display: grid; gap: 3px; }
.key-setup-notice strong { font-size: 12px; line-height: 1.45; }
.key-setup-notice span { color: #735c2e; font-size: 10px; line-height: 1.5; }
.key-setup-actions { flex: none; display: flex; align-items: center; gap: 12px; }
.key-setup-actions button { border: 0; background: transparent; font-size: 11px; cursor: pointer; }
.key-setup-actions button:first-child { padding: 8px 11px; border-radius: 8px; color: #fff; background: var(--cobalt); font-weight: 700; }
.key-setup-actions button:first-child:hover { background: var(--cobalt-deep); }
.key-setup-actions button:last-child { padding: 6px 0; border-bottom: 1px solid currentColor; color: #735c2e; }
.conversation-heading { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.mode-badge {
  align-self: center;
  padding: 6px 9px;
  border: 1px solid rgba(21, 55, 200, 0.24);
  border-radius: 8px;
  color: var(--cobalt);
  background: var(--cobalt-light);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.conversation-heading h1 { min-width: 0; margin: 0; overflow: hidden; font-size: 18px; letter-spacing: -0.02em; text-overflow: ellipsis; white-space: nowrap; }
.new-task-button, .send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, border-color 150ms ease;
}
.new-task-button {
  padding: 10px 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper-bright);
  font-size: 11px;
  white-space: nowrap;
}
.new-task-button:hover { border-color: var(--cobalt); color: var(--cobalt); }
.new-task-button svg, .send-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.message-list {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 34px 44px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: #aeb5ad transparent;
}
.message {
  width: min(100%, 820px);
  margin: 0 0 20px;
  border-radius: var(--radius-panel);
  animation: message-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.message > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.message > header strong { font-size: 11px; }
.message > header time, .message > header span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.message-user > pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.92;
}
.message-assistant {
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: var(--paper-bright);
}
.message-opening { padding-block: 18px; background: rgba(251, 252, 247, 0.68); }
.message-opening .markdown-body { font-size: 14px; }
.markdown-body {
  max-width: 72ch;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.92;
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h2 {
  margin: 34px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 21px;
  font-weight: 760;
  line-height: 1.45;
  letter-spacing: -0.025em;
}
.markdown-body h3 {
  margin: 30px 0 12px;
  color: var(--cobalt-deep);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.55;
  letter-spacing: -0.015em;
}
.markdown-body h4 { margin: 24px 0 10px; font-size: 16px; line-height: 1.6; }
.markdown-body p { margin: 0; }
.message-assistant:not(.message-opening) .markdown-body > p { text-indent: 2em; }
.markdown-body strong { color: #0f235f; font-weight: 720; }
.markdown-body em { color: #4f5751; }
.markdown-body ul, .markdown-body ol { margin: 0 0 1.2em; padding-left: 1.55em; }
.markdown-body li { padding-left: 0.2em; }
.markdown-body li + li { margin-top: 0.42em; }
.markdown-body li::marker { color: var(--cobalt); font-weight: 750; }
.markdown-body blockquote {
  margin: 22px 0;
  padding: 4px 0 4px 18px;
  border-left: 1px solid var(--cobalt);
  color: #454d47;
}
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body hr { margin: 30px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-body code {
  padding: 0.15em 0.38em;
  border-radius: 4px;
  color: #10205e;
  background: var(--cobalt-light);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}
.markdown-body pre {
  margin: 20px 0;
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: var(--radius-control);
  color: #eef1ff;
  background: #101933;
  white-space: pre;
}
.markdown-body pre code { padding: 0; color: inherit; background: transparent; font-size: 13px; line-height: 1.75; }
.markdown-body table {
  width: 100%;
  margin: 20px 0;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}
.markdown-body th, .markdown-body td { min-width: 120px; padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.markdown-body th { color: var(--cobalt-deep); background: var(--cobalt-light); font-weight: 720; }
.markdown-body del { color: var(--muted); }
.message-user {
  width: min(72%, 620px);
  margin-left: auto;
  padding: 17px 20px;
  color: #10205e;
  background: var(--cobalt-light);
}
.message-user > header strong { color: var(--cobalt); }
.message > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--success);
  font-size: 11px;
}
.message-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid rgba(21, 55, 200, 0.32);
  color: var(--cobalt);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.message-copy svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.message-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e3c487;
  border-radius: 8px;
  color: #5d3a00;
  background: #fff4d8;
  font-size: 11px;
  line-height: 1.6;
}
.message-loading { min-height: 116px; }
.loading-lines { display: grid; gap: 9px; margin-top: 18px; }
.loading-lines span { height: 9px; border-radius: 5px; background: #e1e4dd; animation: proofing 900ms ease-in-out infinite alternate; }
.loading-lines span:nth-child(1) { width: 86%; }
.loading-lines span:nth-child(2) { width: 68%; animation-delay: 120ms; }
.loading-lines span:nth-child(3) { width: 48%; animation-delay: 240ms; }

.composer {
  position: relative;
  width: calc(100% - 68px);
  max-width: 912px;
  margin: 0 auto 24px;
  border-radius: var(--radius-sheet);
  background: var(--paper-bright);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.composer textarea {
  width: 100%;
  min-height: 112px;
  max-height: 220px;
  resize: vertical;
  padding: 18px 20px 66px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  line-height: 1.75;
  caret-color: var(--proof);
}
.composer textarea::placeholder { color: var(--muted); }
.send-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-width: 104px;
  padding: 11px 15px;
  border: 1px solid var(--cobalt);
  color: #fff;
  background: var(--cobalt);
  font-size: 12px;
  font-weight: 700;
}
.send-button:hover:not(:disabled) { background: var(--cobalt-deep); transform: translateY(-1px); }
.send-button:disabled { opacity: 0.42; cursor: not-allowed; }

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius-control);
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

.access-dialog {
  width: min(92vw, 500px);
  max-height: min(92vh, 760px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sheet);
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: 0 30px 100px rgba(11, 31, 120, 0.24);
  overflow: auto;
}
.access-dialog::backdrop { background: rgba(10, 18, 48, 0.62); backdrop-filter: blur(5px); }
.dialog-sheet { position: relative; padding: 34px; }
.dialog-heading { margin-bottom: 24px; }
#authDialog .dialog-sheet { padding-block: 28px; }
#authDialog .dialog-heading { margin-bottom: 18px; }
#registerForm { gap: 13px; }
.dialog-kicker { display: block; margin-bottom: 10px; color: var(--cobalt); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.dialog-heading h2 { margin: 0 0 9px; color: var(--cobalt-deep); font-size: 25px; line-height: 1.3; letter-spacing: -0.03em; }
.dialog-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.dialog-close { position: absolute; top: 18px; right: 20px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; }
.dialog-close svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.dialog-close:hover { color: var(--ink); background: #eceee8; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-control); background: #eceee8; }
.auth-tabs button { padding: 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { color: var(--cobalt-deep); background: var(--paper-bright); box-shadow: 0 2px 8px rgba(20, 23, 22, 0.08); }
.access-form { display: grid; gap: 17px; }
.access-form label { display: grid; gap: 7px; color: #2d332f; font-size: 12px; font-weight: 700; }
.access-form label > small { color: var(--muted); font-size: 10px; font-weight: 400; }
.access-form input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #c6cbc3; border-radius: var(--radius-control); color: var(--ink); background: #fff; outline: 0; }
.access-form input:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(21, 55, 200, 0.12); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.code-row button { min-width: 112px; border: 1px solid rgba(21, 55, 200, 0.34); border-radius: var(--radius-control); color: var(--cobalt); background: var(--cobalt-light); font-size: 11px; font-weight: 700; cursor: pointer; }
.code-row button:disabled { opacity: 0.55; cursor: wait; }
.primary-action { min-height: 48px; border: 1px solid var(--cobalt); border-radius: var(--radius-control); color: #fff; background: var(--cobalt); font-size: 13px; font-weight: 750; cursor: pointer; }
.primary-action:hover { background: var(--cobalt-deep); }
.form-status { min-height: 18px; margin: -4px 0; color: var(--proof); font-size: 11px; line-height: 1.55; }
.privacy-note { margin: -4px 0 0; padding: 11px 12px; border: 1px solid rgba(21, 55, 200, 0.16); border-radius: 8px; color: var(--muted); background: var(--cobalt-light); font-size: 11px; line-height: 1.65; }
.profile-dialog { width: min(92vw, 560px); }
.profile-heading { margin-bottom: 8px; padding-right: 48px; }
.profile-section { padding: 22px 0; border-top: 1px solid var(--line); }
.profile-section h3 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 750; }
.profile-data-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.profile-data-row + .profile-data-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(212, 216, 209, 0.72); }
.profile-data-row strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.connection-status { padding: 4px 8px; border: 1px solid #d7b873; border-radius: 8px; color: #73500a; background: #fff6df; font-size: 10px; font-weight: 700; }
.connection-status.is-connected { border-color: #9dceb7; color: var(--success); background: #edf8f2; }
.profile-form-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.quiet-action { padding: 7px 0; border: 0; border-bottom: 1px solid currentColor; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.profile-footer { display: flex; justify-content: flex-end; padding-top: 20px; border-top: 1px solid var(--line); }
.profile-footer button { padding: 7px 0; border: 0; border-bottom: 1px solid currentColor; color: var(--proof); background: transparent; font-size: 11px; cursor: pointer; }

@keyframes message-in { from { opacity: 0.45; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes proofing { from { opacity: 0.42; } to { opacity: 1; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .method-rail { padding-inline: 16px; }
  .mode-disclosure { margin-top: 28px; }
  .conversation-header, .message-list { padding-inline: 24px; }
  .composer { width: calc(100% - 48px); }
}

@media (max-width: 720px) {
  html { min-width: 0; }
  .app-shell { width: 100%; height: 100svh; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .method-rail { z-index: 20; width: 100%; min-width: 0; height: auto; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) 40px; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; overflow: visible; isolation: isolate; }
  .method-rail::after { display: none; }
  .brand { flex: none; gap: 8px; }
  .brand-mark { width: 36px; height: 36px; font-size: 12px; }
  .brand > span:last-child { gap: 0; }
  .brand strong { font-size: 14px; letter-spacing: 0.04em; }
  .brand small { display: none; }
  .mobile-nav-toggle { width: 100%; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 4px 8px; border: 0; border-radius: var(--radius-control); color: #fff; background: rgba(7, 22, 101, 0.24); cursor: pointer; }
  .mobile-nav-toggle > span { min-width: 0; display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
  .mobile-nav-toggle strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav-toggle small { color: rgba(255, 255, 255, 0.78); font-size: 11px; white-space: nowrap; }
  .mobile-nav-toggle svg { width: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; transition: transform 160ms ease; }
  .mobile-nav-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .mobile-nav-panel { position: absolute; z-index: 12; top: calc(100% + 6px); right: 8px; left: 8px; display: none; max-height: min(70svh, 540px); padding: 8px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: var(--radius-panel); background: var(--cobalt-deep); box-shadow: 0 20px 48px rgba(20, 23, 22, 0.28); overflow-y: auto; overscroll-behavior: contain; }
  .mobile-nav-panel.is-open { display: block; }
  .service-card { position: static; width: 40px; height: 40px; flex: none; display: grid; place-items: center; margin: 0; padding: 0; border: 1px solid rgba(255, 255, 255, 0.26); border-radius: 50%; }
  .service-card > div { display: none; }
  .service-card .profile-entry-icon { width: 28px; height: 28px; border: 0; }
  .rail-disclosure { display: block; margin: 0; }
  .rail-disclosure + .rail-disclosure { margin-top: 6px; }
  .rail-summary {
    min-height: 44px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 20px;
    gap: 10px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-control);
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
  }
  .rail-summary::-webkit-details-marker { display: none; }
  .rail-summary > span { font-size: 13px; font-weight: 700; }
  .rail-summary strong { overflow: hidden; color: rgba(255, 255, 255, 0.82); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
  .rail-summary svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform 160ms ease; }
  .rail-disclosure[open] > .rail-summary { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.38); }
  .rail-disclosure[open] > .rail-summary svg { transform: rotate(180deg); }
  .mode-list {
    position: static;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 6px 0 0;
  }
  .mode-button { min-height: 52px; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-control); }
  .mode-number { width: 24px; height: 24px; }
  .mode-button strong { font-size: 14px; line-height: 1.2; }
  .task-history {
    position: static;
    display: block;
    margin: 0;
    padding: 6px 0 0;
  }
  .task-history-header { display: none; }
  .task-list {
    max-height: min(46svh, 340px);
    display: grid;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 3px 0 0;
    scrollbar-width: thin;
  }
  .task-list::-webkit-scrollbar { display: block; width: 5px; }
  .task-item { min-height: 56px; padding: 9px 10px; background: rgba(255, 255, 255, 0.06); }
  .task-item > strong { font-size: 12px; }
  .task-item > span { gap: 5px; font-size: 11px; }
  .task-item i { display: none; }

  .workspace { width: 100%; min-width: 0; height: auto; min-height: 0; }
  .conversation-header { padding: 16px 14px 13px; }
  .key-setup-notice { display: grid; align-items: start; gap: 8px; padding: 11px 12px; }
  .key-setup-notice span { display: none; }
  .key-setup-actions { justify-content: flex-start; gap: 12px; }
  .conversation-heading { gap: 4px 8px; }
  .mode-badge { padding: 5px 7px; font-size: 11px; }
  .conversation-heading h1 { font-size: 15px; }
  .new-task-button { padding: 9px; }
  .new-task-button svg { width: 15px; }
  .new-task-button { font-size: 0; }

  .message-list { padding: 18px 14px 28px; }
  .message { margin-bottom: 14px; }
  .message-assistant { padding: 17px 16px; }
  .message-user { width: 88%; padding: 14px 15px; }
  .message-user > pre { font-size: 14px; line-height: 1.82; }
  .message-opening .markdown-body { font-size: 13px; }
  .markdown-body { font-size: 15px; line-height: 1.88; }
  .markdown-body h2 { margin-top: 28px; font-size: 19px; }
  .markdown-body h3 { margin-top: 25px; font-size: 16px; }
  .markdown-body table { font-size: 13px; }
  .composer { width: calc(100% - 20px); margin-bottom: max(10px, env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 14px 42px rgba(20, 23, 22, 0.18); }
  .composer:focus-within { box-shadow: 0 16px 48px rgba(20, 23, 22, 0.24); }
  .composer textarea { min-height: 116px; padding: 16px 16px 62px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1.7; }
  .composer textarea::placeholder { color: var(--muted); }
  .send-button { right: 10px; bottom: 10px; min-width: 88px; min-height: 44px; padding: 10px 14px; }
  .toast { right: 14px; bottom: 14px; }
  .dialog-sheet { padding: 26px 20px; }
  .dialog-heading h2 { font-size: 22px; }
  .profile-form-actions { grid-template-columns: 1fr; gap: 8px; }
  .quiet-action { justify-self: start; }
}

@media (max-width: 720px) and (pointer: coarse) {
  .rail-summary, .mode-button, .task-item { min-height: 48px; }
}

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