:root {
  --bg: #e8f2ef;
  --bg2: #f7fbfa;
  --ink: #0b2f2b;
  --muted: #5a736e;
  --teal: #0a5c54;
  --teal-deep: #064039;
  --accent: #1a8a7a;
  --line: #c5d8d3;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #146c2e;
  --warn-bg: #fff6e8;
  --warn-ink: #7a4a12;
  --shadow: 0 18px 50px rgba(6, 64, 57, 0.10);
  --radius: 16px;
  --serif: "IBM Plex Serif", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --sans: "IBM Plex Sans", "Source Han Sans SC", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #cfe8e2 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #d9efe8 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg2) 42%, #f4f8f7);
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; }

/* —— Sticky top bar (align ChemRxn / NMR) —— */
.top, .topnav {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: rgba(247, 251, 250, 0.9);
  border-bottom: 1px solid var(--line);
}
.topnav {
  display: block;
  margin: 0;
  padding: 0;
}
.top__inner, .topnav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.4vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand:hover { text-decoration: none; color: inherit; }
.brand > span {
  color: var(--accent);
}
.brand__mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #fff;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 10px 24px rgba(6, 64, 57, 0.22);
}
.brand__text { display: grid; gap: 2px; min-width: 0; }
.brand__name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.45rem, 2.3vw, 1.85rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand__name em {
  font-style: normal;
  color: var(--accent);
}
.brand__sub {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 1px;
  letter-spacing: 0.01em;
}
.top__right, .navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.navlinks {
  gap: 4px;
  font-size: 0.9rem;
}
.navlinks a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.navlinks a:hover {
  color: var(--teal);
  background: rgba(10, 92, 84, 0.06);
  text-decoration: none;
}
.navlinks a.active {
  color: var(--teal-deep);
  background: rgba(10, 92, 84, 0.1);
}
.nav-account {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
}
.nav-account:hover {
  color: var(--teal);
  background: rgba(10, 92, 84, 0.06);
  text-decoration: none;
}
.auth-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}
.user-label {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— Page shell —— */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}
.shell--app { max-width: 1360px; }
.shell--review { max-width: 1480px; }

.app-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.app-main { min-width: 0; display: grid; gap: 16px; }

/* —— History rail —— */
.history-rail {
  position: sticky;
  top: 76px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-rail__head h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.history-rail__head p { margin: 0; font-size: 0.78rem; line-height: 1.45; }
.history-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
  min-height: 100px;
  flex: 1;
}
.history-empty {
  padding: 22px 12px;
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.history-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7fbfa;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.history-card:hover {
  border-color: var(--accent);
  background: #fff;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(6, 64, 57, 0.06);
}
.history-card--active {
  border-color: var(--teal);
  background: rgba(10, 92, 84, 0.08);
}
.history-card__thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.history-card__thumb--empty {
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--muted);
}
.history-card__meta { display: grid; gap: 2px; min-width: 0; }
.history-card__meta strong {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-card__stats { font-size: 0.75rem; color: var(--muted); }
.history-rail__foot {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.history-rail__foot .btn {
  text-align: center;
  justify-content: center;
}
.history-rail__foot .btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* —— Hero / panels —— */
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  margin: 0;
  display: grid;
  gap: 8px;
}
.hero h1, .hero h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}
.hero p, .hero__desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 68ch;
  font-size: 0.95rem;
}
.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.hero__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f3faf8;
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 600;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.drop {
  border: 1.5px dashed #9ebdb5;
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(180deg, #f7fbfa, #eef7f4);
  transition: border-color .15s, background .15s, box-shadow .15s;
  cursor: pointer;
}
.drop:hover, .drop.drag {
  border-color: var(--accent);
  background: rgba(26, 138, 122, 0.06);
  box-shadow: inset 0 0 0 1px rgba(26, 138, 122, 0.12);
}
.drop strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--teal-deep);
}
.drop .hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 56ch;
  margin: 0 auto;
}

.warn {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.86rem;
  line-height: 1.5;
  border: 1px solid #f0dfc0;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* —— Buttons —— */
.btn {
  appearance: none;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary, .btn--ghost, .btn--secondary {
  background: #fff;
  color: var(--teal-deep);
  border-color: var(--line);
}
.btn.secondary:hover, .btn--ghost:hover, .btn--secondary:hover {
  border-color: var(--teal);
  background: #f3faf8;
  filter: none;
}
.btn.accent, .btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--block { width: 100%; justify-content: center; display: inline-flex; }

/* —— Tables / badges —— */
.tasks-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
table.tasks { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.tasks .tasks__check {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}
table.tasks .tasks__check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
table.tasks th, table.tasks td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.tasks th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.tasks tr:hover td { background: #f7fbfa; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #d8f3dc;
  color: var(--ok);
}
.badge.queued, .badge.processing { background: #fff3cd; color: #7a5b00; }
.badge.failed { background: #f8d7da; color: var(--danger); }
.badge.partial { background: #ffe8c7; color: #8a5a12; }
.badge.ready { background: #d8f3dc; color: var(--ok); }

/* —— Account —— */
.account-card__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.account-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
}
.account-meta > div {
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.account-meta dt { font-size: 0.75rem; color: var(--muted); margin: 0 0 4px; font-weight: 700; }
.account-meta dd { margin: 0; font-size: 0.92rem; word-break: break-all; }
.account-records { display: grid; gap: 12px; }
.account-record {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7fbfa;
}
.account-record__thumb img, .account-record__empty {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.account-record__empty {
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.account-record__body h4 { margin: 0 0 6px; font-size: 1.02rem; }

/* —— Ketcher / review —— */
/* —— Guide —— */
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.guide-toc strong {
  color: var(--ink);
  margin-right: 4px;
}
.guide-toc a {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 4px 0;
}
.guide-step {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 14px;
}
.guide-step--flip .guide-step__fig { order: -1; }
.guide-step__num {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}
.guide-step h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.guide-step ol {
  margin: 0 0 12px;
  padding-left: 1.2em;
  display: grid;
  gap: 8px;
  line-height: 1.55;
}
.guide-step__fig {
  margin: 0;
}
.guide-step__fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #eef6f4;
  box-shadow: var(--shadow);
}
.guide-step__fig figcaption {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 900px) {
  .guide-step {
    grid-template-columns: 1fr;
  }
  .guide-step--flip .guide-step__fig { order: 0; }
}

.ketcher-panel { margin: 0; }
.review-toolbar {
  margin: 12px 0 14px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ketcher-panel__head {
  margin-bottom: 12px;
}
.ketcher-panel__head h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.15rem;
}
.ketcher-panel__head p { margin: 0; max-width: 62ch; }
.ketcher-panel__actions {
  margin-top: 12px;
  gap: 10px;
  align-items: center;
}
.ketcher-panel__status {
  font-size: 0.88rem;
  line-height: 1.35;
}
.ketcher-stage {
  position: relative;
  height: min(52vh, 520px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #eef7f4;
}
.ketcher-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.ketcher-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: rgba(247, 251, 250, 0.96);
  text-align: center;
}
.ketcher-loading.hidden { display: none; }
.ketcher-loading__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1rem;
}
.ketcher-loading__pct { margin: 0; font-size: 0.85rem; color: var(--muted); }
.ketcher-loading__detail { margin: 0; max-width: 42ch; }
.ketcher-progress {
  width: min(360px, 80%);
  height: 8px;
  border-radius: 999px;
  background: #d5e6e1;
  overflow: hidden;
}
.ketcher-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  transition: width .2s ease;
}
.ketcher-progress--indeterminate .ketcher-progress__bar {
  width: 35% !important;
  animation: ketcher-indeterminate 1.1s ease-in-out infinite;
}
@keyframes ketcher-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.review-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.review-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  min-height: 52vh;
}
.canvas-wrap {
  position: relative;
  overflow: auto;
  background: #10201d;
  border-radius: 14px;
  border: 1px solid #1d3a34;
  min-height: 520px;
  box-shadow: var(--shadow);
}
#stage {
  position: relative;
  display: inline-block;
  margin: 12px;
}
#stage img { display: block; max-width: none; user-select: none; }
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#overlay .box {
  position: absolute;
  border: 2px solid rgba(26, 180, 150, 0.95);
  background: rgba(26, 180, 150, 0.12);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  box-sizing: border-box;
}
#overlay .box:active { cursor: grabbing; }
#overlay .box.active {
  border-color: #e8a45a;
  background: rgba(232, 164, 90, 0.16);
  z-index: 2;
}
#overlay .box__handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #e8a45a;
  border-radius: 2px;
  box-sizing: border-box;
  z-index: 3;
}
#overlay .box__handle[data-handle="nw"] { left: -6px; top: -6px; cursor: nwse-resize; }
#overlay .box__handle[data-handle="n"]  { left: 50%; top: -6px; margin-left: -5px; cursor: ns-resize; }
#overlay .box__handle[data-handle="ne"] { right: -6px; top: -6px; cursor: nesw-resize; }
#overlay .box__handle[data-handle="e"]  { right: -6px; top: 50%; margin-top: -5px; cursor: ew-resize; }
#overlay .box__handle[data-handle="se"] { right: -6px; bottom: -6px; cursor: nwse-resize; }
#overlay .box__handle[data-handle="s"]  { left: 50%; bottom: -6px; margin-left: -5px; cursor: ns-resize; }
#overlay .box__handle[data-handle="sw"] { left: -6px; bottom: -6px; cursor: nesw-resize; }
#overlay .box__handle[data-handle="w"]  { left: -6px; top: 50%; margin-top: -5px; cursor: ew-resize; }
#overlay svg.mol {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ai-conclusion { margin: 0; }
.ai-conclusion__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.ai-conclusion h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.2rem;
}
.ai-conclusion__head p { margin: 0; max-width: 70ch; }
.ai-smiles {
  margin: 12px 0 0;
  padding: 12px 14px;
  min-height: 52px;
  border-radius: 12px;
  background: #f7fbfa;
  border: 1px solid var(--line);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.ai-smiles:empty { display: none; }
.ai-notes { margin: 8px 0 0; padding-left: 18px; color: var(--warn-ink); font-size: 0.85rem; }
.ai-notes:empty { display: none; }
.side h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.15rem;
}
.list { display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.list button {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
}
.list button.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
  background: #f3faf8;
}
.ai-list-smi { word-break: break-all; white-space: normal; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field label { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea,
.form .input, .input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
  width: 100%;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus,
.form .input:focus, .input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 138, 122, 0.12);
}
.file-list {
  margin-top: 14px;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.file-list label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.86rem;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7fbfa;
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--teal-deep);
  color: #fff;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  box-shadow: var(--shadow);
  z-index: 90;
}
.toast.show { opacity: 1; }

/* —— Auth modal —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 40, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none !important; }
.modal__panel {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.modal__panel--sm { width: min(380px, 100%); }
.modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.chip--on {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(10, 92, 84, 0.08);
}
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 0.86rem; font-weight: 600; }
.captcha-row, .code-row { display: flex; gap: 8px; align-items: stretch; }
.captcha-input, .code-input { flex: 1; }
.captcha-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 132px;
  padding: 4px;
  cursor: pointer;
}
.captcha-img {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  font-size: 0.78rem;
  color: var(--muted);
}
.captcha-img img, .captcha-img svg { display: block; max-width: 128px; height: 42px; }
.code-btn { white-space: nowrap; }
.error { color: var(--danger); font-size: 0.86rem; margin: 0; min-height: 1.2em; }
.tip { font-size: 0.78rem; margin: 8px 0 0; }
.auth-tos {
  display: flex !important;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500 !important;
}
.auth-tos input { margin-top: 3px; }
.auth-tos a { color: var(--teal); }

@media (max-width: 960px) {
  .app-layout { grid-template-columns: 1fr; }
  .history-rail { position: static; max-height: none; }
  .history-list { max-height: 260px; }
  .review-grid { grid-template-columns: 1fr; }
  .ketcher-stage { height: 420px; min-height: 320px; }
  .account-record { grid-template-columns: 72px minmax(0, 1fr); }
  .top__inner, .topnav { padding: 10px 14px; }
  .brand__mark { width: 44px; height: 44px; border-radius: 12px; font-size: 0.82rem; }
  .brand__name { font-size: 1.28rem; }
  .brand__sub { display: none; }
}
