:root {
  --rail: #1b2436;
  --rail-soft: #243049;
  --rail-active: #2f3d5c;
  --bg: #eef1f6;
  --panel: #ffffff;
  --text: #1c2434;
  --muted: #6b7589;
  --line: #e4e8ef;
  --primary: #f07a2a;
  --primary-press: #d96518;
  --ok: #1f9d63;
  --warn: #c98918;
  --danger: #c4453c;
  --shadow: 0 10px 30px rgba(24, 36, 58, 0.06);
  --radius: 14px;
  --font: 'DM Sans', 'Noto Sans SC', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(240, 122, 42, 0.08), transparent 55%),
    linear-gradient(180deg, #f5f7fb 0%, var(--bg) 100%);
}

button, input, select, textarea { font: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.9rem; }
em { color: var(--danger); font-style: normal; }

.shell {
  display: grid;
  grid-template-columns: 68px 1fr;
  min-height: 100vh;
}

.rail {
  background: linear-gradient(180deg, #151d2d 0%, var(--rail) 100%);
  color: #d7deea;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.55rem;
  gap: 1rem;
}
.rail__brand {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #f39a4e, var(--primary));
  color: #fff; font-weight: 700; text-decoration: none;
  letter-spacing: 0.02em; box-shadow: 0 8px 18px rgba(240, 122, 42, 0.35);
}
.rail__nav { display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.rail__item {
  width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: transparent; color: #9aa6bd; display: grid; place-items: center;
  cursor: pointer; text-decoration: none;
}
.rail__item:hover, .rail__item.is-active {
  background: var(--rail-active); color: #fff;
}
.rail__foot { margin-top: auto; padding-bottom: 0.4rem; }
.rail__dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: block; background: #6b7589;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}
.rail__dot.is-ok { background: var(--ok); }
.rail__dot.is-bad { background: var(--danger); }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.35rem 0.85rem;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 0.75rem; }
.topbar__title {
  margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em;
}
.project-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.7rem; color: var(--muted); font-size: 0.88rem;
  box-shadow: var(--shadow);
}
.project-chip__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.lang-switch__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.lang-select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7589' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.2 0 2.3z'/%3E%3C/svg%3E")
    no-repeat right 0.65rem center;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.38rem 1.85rem 0.38rem 0.7rem;
  min-width: 7.5rem;
  cursor: pointer;
}
.lang-select:hover,
.lang-select:focus {
  border-color: var(--primary);
  outline: none;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { background: #f7f9fc; }

.btn {
  border: 0; border-radius: 10px; padding: 0.65rem 1.1rem;
  cursor: pointer; font-weight: 600; transition: transform 0.15s ease, background 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 10px 22px rgba(240, 122, 42, 0.28);
}
.btn--primary:hover:not(:disabled) { background: var(--primary-press); transform: translateY(-1px); }
.btn--ghost {
  background: #fff; color: var(--text); border: 1px solid var(--line);
}
.btn--ghost:hover { background: #f7f9fc; }
.btn--sm { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
label.btn { display: inline-flex; align-items: center; }

.main {
  display: grid;
  /* 左：选择文献 PDF 30%；右：分析结果 / 上下文 70% */
  grid-template-columns: minmax(260px, 3fr) minmax(0, 7fr);
  gap: 1rem;
  padding: 0 1.35rem 1.35rem;
  min-height: 0;
  flex: 1;
}
.main--result { grid-template-columns: 1fr; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(228, 232, 239, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.2rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.8rem; margin-bottom: 0.9rem;
}
.panel__head h2 { margin: 0; font-size: 1.05rem; }
.panel__actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: end;
  margin-bottom: 0.85rem;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.86rem; color: var(--muted); font-weight: 500; }
.field--inline { min-width: 160px; }
.field--grow { flex: 1; min-width: 180px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.7rem; background: #fff; color: var(--text);
}
.input:focus { outline: 2px solid rgba(240, 122, 42, 0.25); border-color: #f0a56a; }
.input--area { resize: vertical; min-height: 120px; line-height: 1.5; }
.input--area.input--result {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  white-space: pre-wrap;
}
.qa-box {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.qa-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.input--qa { min-height: 72px; }
.input--qa-answer {
  min-height: 140px;
  background: #f8fafc;
  white-space: pre-wrap;
}
.check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--muted); font-size: 0.88rem; user-select: none;
}
.check--block { margin-top: 0.75rem; }

.analyze-status {
  margin: 0 0 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(240, 122, 42, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(240, 122, 42, 0.08), transparent 55%),
    #fffaf5;
}
.analyze-status__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.analyze-status__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.analyze-status__clock {
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary-press);
  flex-shrink: 0;
}
.analyze-status__track {
  margin-top: 0.5rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(240, 122, 42, 0.14);
  overflow: hidden;
}
.analyze-status__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f39a4e, var(--primary));
  transition: width 0.4s linear;
}
.analyze-status__hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
}

.upload-progress {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.upload-progress__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.upload-progress__label {
  font-size: 0.86rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.upload-progress__pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.upload-progress__track {
  height: 8px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}
.upload-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f39a4e, var(--primary));
  transition: width 0.12s ease-out;
}

.table-wrap {
  border: 1px solid var(--line); border-radius: 12px; overflow: auto; flex: 1;
}
.file-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.file-table th, .file-table td {
  padding: 0.78rem 0.85rem; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
.file-table th {
  position: sticky; top: 0; background: #f8fafc; color: var(--muted);
  font-weight: 600; font-size: 0.82rem;
}
.file-table tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover { background: #fafbfd; }
.file-table tbody tr.is-viewing { background: #f0f6ff; }
.col-check { width: 42px; }
.col-status { width: 7.5rem; }
.empty-row td { color: var(--muted); text-align: center; padding: 2.4rem 1rem; }
.file-name {
  display: flex; align-items: center; gap: 0.55rem; font-weight: 500;
}
.file-name--link {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  text-align: left; color: inherit; font: inherit; width: 100%;
}
.file-name--link:hover .file-name__text { color: var(--accent, #2563eb); text-decoration: underline; }
.file-name--link:disabled { cursor: default; opacity: 0.85; }
.file-name--link:disabled:hover .file-name__text { color: inherit; text-decoration: none; }
.file-ico {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(160deg, #ffe1c8, #ffd0a8);
  color: #b85a12; display: grid; place-items: center;
  font-size: 0.68rem; font-weight: 800; flex: none;
}
.tag {
  display: inline-flex; padding: 0.15rem 0.45rem; border-radius: 999px;
  background: #f1f4f9; color: var(--muted); font-size: 0.75rem;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; max-width: 100%;
  appearance: none; -webkit-appearance: none;
  font-family: inherit; color: inherit;
}
.status-pill--pending { background: #f1f4f9; color: var(--muted); }
.status-pill--running {
  background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe;
}
.status-pill--analyzed {
  background: #ecfdf5; color: #047857; border-color: #a7f3d0;
  cursor: pointer;
}
button.status-pill--analyzed,
button.status-pill--failed { cursor: pointer; }
.status-pill--analyzed:hover { background: #d1fae5; }
.status-pill--failed {
  background: #fef2f2; color: #b91c1c; border-color: #fecaca;
  cursor: pointer;
}
.status-pill--failed:hover { background: #fee2e2; }
.status-pill__dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.row-del {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.85rem;
}
.row-del:hover { color: var(--danger); }

.config-form { display: flex; flex-direction: column; gap: 0.85rem; }

.result-list { display: flex; flex-direction: column; gap: 0.9rem; }
.result-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem;
  background: #fcfdff;
}
.result-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.result-card .meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.6rem; }
.result-card pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  background: #f6f8fb; border-radius: 10px; padding: 0.75rem;
  font-size: 0.86rem; line-height: 1.55; max-height: 280px; overflow: auto;
}
.result-card.is-error { border-color: #f0c4c0; background: #fff8f7; }

.field-label-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.field-label { font-size: 0.86rem; font-weight: 600; color: var(--ink, #1a2333); }
.result-cards-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.result-cards {
  display: flex; flex-direction: column; gap: 1rem;
  /* Let the page scroll — a short clipped box hid later reaction sections */
  max-height: none;
  overflow: visible;
  padding-right: 0;
  padding-bottom: 0.5rem;
}
.rxn-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  overflow: visible; scroll-margin-top: 0.5rem;
}
.rxn-card__details { margin: 0; }
.rxn-card__summary {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "badge file" "title title";
  gap: 0.2rem 0.65rem;
  align-items: baseline;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  list-style: none;
}
.rxn-card__summary::-webkit-details-marker { display: none; }
.rxn-card__summary::after {
  content: "";
  grid-column: 1 / -1;
  width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  justify-self: end;
  margin-top: -1.35rem;
  opacity: 0.65;
}
.rxn-card__details[open] > .rxn-card__summary::after {
  transform: rotate(-135deg);
  margin-top: -1.15rem;
}
.rxn-card__badge {
  grid-area: badge;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: #1f4e79;
  background: #e8f0f8; border-radius: 999px; padding: 0.14rem 0.45rem;
}
.rxn-card__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem;
  margin-bottom: 0.55rem; padding: 0.85rem 0.95rem 0;
}
.rxn-card__title {
  grid-area: title; margin: 0; font-size: 0.95rem; font-weight: 650;
  line-height: 1.35; padding-right: 1.1rem;
}
.rxn-card__file {
  grid-area: file; color: var(--muted); font-size: 0.78rem;
  justify-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rxn-card__body {
  padding: 0.15rem 0.9rem 1.15rem;
  border-top: 1px solid #eef2f7;
  overflow: visible;
}
.result-cards-actions {
  display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.55rem;
}
.rxn-card__eq {
  margin: 0 0 0.65rem; padding: 0.55rem 0.7rem;
  border-radius: 8px; background: #eef3f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem; line-height: 1.45; word-break: break-word;
}
.rxn-scheme {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0 0 0.7rem;
}
@media (max-width: 720px) {
  .rxn-scheme { grid-template-columns: 1fr; }
  .rxn-arrow { transform: rotate(90deg); justify-self: center; }
}
.rxn-side {
  border-radius: 10px; padding: 0.65rem 0.75rem; min-height: 4.2rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.rxn-side--react { background: linear-gradient(160deg, #eaf2fb, #f7fafc); border: 1px solid #c9daf0; }
.rxn-side--prod { background: linear-gradient(160deg, #e8f5ef, #f7fcf9); border: 1px solid #b9dfcd; }
.rxn-side__label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.rxn-side__text { font-size: 0.9rem; font-weight: 600; line-height: 1.4; word-break: break-word; }
.rxn-structs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.rxn-mol {
  margin: 0;
  text-align: center;
  max-width: 100%;
}
.rxn-mol img {
  display: block;
  width: min(100%, 240px);
  height: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
}
.rxn-mol figcaption {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
  word-break: break-word;
}
.rxn-scheme-fig {
  margin: 0 0 0.7rem;
  text-align: center;
}
.rxn-scheme-fig figcaption {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-align: left;
}
.rxn-scheme-fig {
  overflow: visible;
  max-width: 100%;
}
.rxn-scheme-fig img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center top;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: zoom-in;
}
.rxn-arrow {
  align-self: center; color: #c45c26; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-width: 2.6rem;
}
.rxn-arrow svg { width: 36px; height: 16px; }
.rxn-arrow span { font-size: 0.65rem; letter-spacing: 0.04em; }
.rxn-cond-bar {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.65rem 0.6rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fafc, #eef3f8);
  border: 1px solid #d7e2ee;
}
.rxn-cond-bar__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.rxn-loc-row { margin: 0 0 0.45rem; }
.rxn-loc {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3d5670;
  background: #e8f0f8;
  border: 1px solid #c9d9ea;
  border-radius: 6px;
  padding: 0.18rem 0.45rem;
  line-height: 1.35;
  cursor: help;
  max-width: 100%;
  word-break: break-word;
}
.rxn-kv .rxn-loc {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.66rem;
  font-weight: 550;
  background: #f3f7fb;
}
.rxn-cond-bar > .rxn-loc { margin: 0 0 0.4rem; }
.rxn-cond-bar .rxn-chips { margin-top: 0.35rem; }
.rxn-sec { margin: 0.7rem 0 0; }
.rxn-sec:first-child { margin-top: 0.65rem; }
.rxn-sec:last-child { margin-bottom: 0; }
.rxn-sec__title,
.rxn-sec__label {
  display: block; margin: 0 0 0.35rem; padding-bottom: 0.25rem;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid #e8eef5;
}
.rxn-kv {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.35rem 0.6rem;
  margin: 0; padding: 0; list-style: none;
}
.rxn-kv li {
  font-size: 0.84rem; line-height: 1.35;
  padding: 0.35rem 0.45rem; border-radius: 7px; background: #f3f6fa;
}
.rxn-kv strong { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.rxn-list { margin: 0; padding-left: 1.15rem; font-size: 0.86rem; line-height: 1.45; }
.rxn-list li + li { margin-top: 0.2rem; }
.rxn-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rxn-chip {
  font-size: 0.78rem; padding: 0.2rem 0.45rem; border-radius: 6px;
  background: #e8eef6; color: #2a3a52;
}
.rxn-notes { margin: 0; font-size: 0.84rem; color: var(--muted); line-height: 1.4; }
.rxn-empty {
  margin: 0; padding: 0.75rem; border-radius: 10px; border: 1px dashed var(--line);
  color: var(--muted); font-size: 0.86rem;
}

.dialog {
  border: 0; border-radius: 16px; padding: 0; max-width: 440px; width: calc(100% - 2rem);
  box-shadow: 0 24px 60px rgba(20, 30, 50, 0.25);
}
.dialog::backdrop { background: rgba(18, 26, 40, 0.45); }
.dialog__card { margin: 0; padding: 1.15rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 0.75rem; }
.dialog__card h3 { margin: 0 0 0.2rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.35rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel, .topbar { animation: rise 0.35s ease both; }
.panel--config { animation-delay: 0.06s; }

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    flex-direction: row; justify-content: space-between;
    padding: 0.55rem 0.75rem; position: sticky; top: 0; z-index: 20;
  }
  .rail__nav { flex-direction: row; flex: 0; }
  .rail__foot { margin: 0; }
}

/* Auth / account modals (aligned with ChemRxn / NMR) */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(18, 26, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal__panel {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin: auto;
}
.modal__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.login-gate__msg {
  margin: 8px 0 16px;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}
.login-gate__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: #f7f9fc;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}
.chip--on { background: var(--primary); color: #fff; border-color: var(--primary); }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.captcha-row, .code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.captcha-input, .code-input { flex: 1; min-width: 0; }
.captcha-btn {
  flex: 0 0 128px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6fa;
  cursor: pointer;
  overflow: hidden;
}
.captcha-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 42px;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}
.captcha-img svg,
.captcha-img img {
  width: 128px;
  height: 42px;
  display: block;
}
.code-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 7.5rem;
}
.tip { margin: 10px 0 0; font-size: 0.8rem; }
.error { color: var(--danger); margin: 0; font-size: 0.88rem; min-height: 1.2em; }
.btn--block { width: 100%; }
.profile-user { margin: 0 0 0.35rem; font-weight: 600; }
