:root {
  --bg: #f4f1ec;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf9;
  --line: #e7e0d5;
  --accent: #0f766e;
  --err: #b91c1c;
  --term-bg: #0c0a09;
  --term-fg: #d6d3d1;
  --term-ok: #6ee7b7;
  --term-err: #fca5a5;
  --term-warn: #fcd34d;
  --term-info: #93c5fd;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  /* room for sticky terminal */
  padding-bottom: 0;
}
body.has-term {
  padding-bottom: min(22vh, 160px);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.top-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  margin: 0 !important;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}
.lang-switch select {
  display: inline-block !important;
  width: auto !important;
  min-width: 6.75rem;
  margin: 0 !important;
  margin-top: 0 !important;
  padding: 6px 10px !important;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.quota-bar {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}
.quota-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px 8px;
  color: var(--ink);
}
.offboard-banner {
  flex-basis: 100%;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #d9a84b;
  background: #fff6e5;
  color: #5c3d00;
}
.quota-chip.is-low {
  border-color: #f59e0b;
  background: #fffbeb;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.asset-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}
.asset-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  word-break: break-all;
}
.asset-card .story { margin-top: 0; font-size: 13px; }
.brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  min-width: 0;
}
.brand-logo {
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-logo:empty {
  display: none;
}
.brand-product {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 1px;
}
.brand-tagline {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.site-footer {
  max-width: 1100px;
  margin: 8px auto 0;
  padding: 18px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.site-footer-line { margin: 0; }
.site-footer-name {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.site-footer-sep { margin: 0 6px; opacity: 0.55; }
.site-footer-ver {
  margin-left: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.75;
  font-weight: 600;
}
.home-view { margin: 0; }
.home-hero-banner {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  background: #0b1220;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: min(52vh, 520px);
}
.home-hero-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.home-hero-copy {
  margin: 0 0 18px;
  padding: 2px 2px 4px;
}
.home-hero-copy h1 {
  margin: 4px 0 10px;
  font-size: clamp(1.7rem, 2.6vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.home-hero-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.home-hero-lead {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 42rem;
}
.home-hero-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.home-hero-caps li {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid #99d6cb;
  background: #f0faf8;
  color: var(--ink);
}
.auth-shell {
  display: grid;
  /* 参考 150% 缩放观感：左约 65% / 右约 35%，右栏随屏宽封顶 */
  grid-template-columns: minmax(0, 1fr) clamp(380px, 34vw, 450px);
  height: 100%;
  min-height: 0;
  gap: 0;
  align-items: stretch;
}
.auth-visual {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
  min-height: 0;
  height: 100%;
  padding: 12px 20px;
}
.auth-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
}
.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 32px;
  background: var(--card);
  border-left: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.auth-card {
  margin: 0;
  width: 100%;
  max-width: 400px;
  padding: 32px 32px 26px;
  box-shadow: 0 10px 32px rgba(28, 25, 23, 0.07);
}
.auth-card h1 {
  margin: 0 0 18px;
  font-size: 1.625rem;
}
.auth-card label {
  margin: 11px 0;
  font-size: 16px;
}
.auth-card input {
  padding: 11px 13px;
  font-size: 16px;
}
.auth-card button.primary {
  margin-top: 16px;
  padding: 11px 16px;
  font-size: 16px;
  width: 100%;
}
body.mode-auth {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.mode-auth .top {
  flex-shrink: 0;
  position: static;
  padding: 8px 18px;
}
body.mode-auth .brand-logo {
  font-size: clamp(17px, 2.1vw, 22px);
}
body.mode-auth .brand-product {
  font-size: 12px;
}
body.mode-auth .brand-tagline {
  font-size: 11px;
}
body.mode-auth .wrap,
body.mode-auth main.wrap.mode-auth {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.mode-auth .auth-shell:not(.hidden) {
  flex: 1;
  min-height: 0;
}
body.mode-auth .site-footer {
  display: none;
}
body.mode-auth .auth-mini-footer {
  display: block;
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}
.auth-mini-footer {
  display: none;
}
.home-hero-eyebrow { display: none; }
.home-console-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.home-console-head h2 { margin: 0; }
@media (max-width: 640px) {
  body.mode-auth {
    height: auto;
    overflow: auto;
  }
  body.mode-auth .wrap {
    overflow: visible;
  }
  .auth-shell {
    grid-template-columns: 1fr;
    height: auto;
  }
  .auth-visual {
    order: 1;
    height: 32vh;
    min-height: 180px;
    max-height: 240px;
  }
  .auth-visual img { height: 100%; }
  .auth-panel {
    order: 2;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 20px 16px 28px;
    overflow: visible;
  }
  .home-hero-banner { max-height: 280px; }
}
.nav button {
  margin-left: 6px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 6px 10px;
  cursor: pointer;
}
.nav button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.wrap { max-width: 1100px; margin: 28px auto; padding: 0 16px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 22px;
}
.hidden { display: none !important; }
label { display: block; margin: 10px 0; font-size: 14px; }
input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
button {
  margin-top: 10px;
  margin-right: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.btn-danger {
  background: #fff5f5;
  color: #b91c1c;
  border-color: #fca5a5;
}
button.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
}
button.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.muted { color: var(--muted); font-size: 13px; }

/* current-config strip — visual block, not mixed with help text */
.now-box {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 1px solid #99d6cb;
  border-left: 4px solid var(--accent);
  background: #f0faf8;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.now-box .now-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.now-box .now-value {
  font-weight: 600;
  word-break: break-word;
}
.now-box .now-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.now-box.is-empty {
  border-color: #e7d5a8;
  border-left-color: #d97706;
  background: #fffbeb;
}
.now-box.is-error {
  border-color: #f5c2c2;
  border-left-color: var(--err);
  background: #fef2f2;
  color: var(--err);
}

.check { display: flex; align-items: flex-start; gap: 8px; }
.check input { width: auto; margin-top: 3px; }

.dow-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}
.dow-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.dow-row label:has(input:checked) {
  border-color: var(--accent);
  background: #f0faf8;
  color: var(--accent);
}
.dow-row input {
  width: auto;
  margin: 0;
  padding: 0;
}

/* password show/hide */
.pw-wrap {
  position: relative;
  display: block;
  margin-top: 4px;
}
.pw-wrap > input {
  display: block;
  width: 100%;
  margin-top: 0;
  padding-right: 40px;
}
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 4px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.pw-toggle:hover,
.pw-toggle[aria-pressed="true"] {
  color: var(--ink);
}
.pw-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

.err { color: var(--err); min-height: 1.2em; }
.setup-steps {
  margin: 12px 0 18px;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.setup-steps b { color: var(--ink); }
.code {
  background: #1c1917;
  color: #f5f5f4;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  margin-top: 10px;
  max-height: 220px;
}
h1 { font-size: 22px; margin-top: 0; margin-bottom: 6px; }
h2 { font-size: 16px; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
h3 { font-size: 14px; margin-top: 18px; }
.ws-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.ws-bar-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.ws-bar-actions button { margin-top: 0; }
.story {
  margin: 12px 0 8px;
  padding: 10px 12px;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  color: #115e59;
  font-size: 14px;
  line-height: 1.45;
}
.funnel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.funnel .step {
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px 10px;
  text-align: center;
}
.funnel .step .n {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.funnel .step .l {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.home-explain p { margin: 0; font-size: 14px; line-height: 1.55; }
.home-step-h {
  margin-top: 22px;
}
.home-create-ws {
  margin-top: 14px;
  padding-top: 4px;
}
.admin-create-org {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  background: #fafaf9;
}
.admin-create-org h3 {
  margin-top: 0;
}
.org-item, .admin-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.org-item.is-selected {
  background: #f0faf8;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
  border-bottom-color: transparent;
}
.org-item.is-selected .org-pick-btn {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.sender-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sender-enable-check {
  flex-shrink: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}
.sender-enable-check input {
  width: auto;
  margin: 0 4px 0 0;
  vertical-align: middle;
}
.sender-row-meta {
  min-width: 0;
  word-break: break-all;
}
.sender-row.is-disabled .sender-row-meta {
  opacity: 0.55;
}
.sender-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.sender-row-actions button {
  margin-top: 0;
}
.warmup-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.warmup-badge.is-ready { background: #dcfce7; color: #166534; }
.warmup-badge.is-warming { background: #fef3c7; color: #92400e; }
.warmup-badge.is-recovery { background: #fee2e2; color: #991b1b; }
.warmup-badge.is-paused { background: #e5e7eb; color: #374151; }
.warmup-badge.is-unlinked { background: #f4f4f5; color: #71717a; }
.warmup-table-wrap { overflow: auto; margin-top: 10px; }
.warmup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.warmup-table th,
.warmup-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 8px;
  text-align: left;
  white-space: nowrap;
}
.warmup-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.warmup-table td.num { font-variant-numeric: tabular-nums; }
.warmup-score {
  font-weight: 700;
  font-size: 16px;
}
.warmup-score.is-low { color: #b91c1c; }
.warmup-score.is-mid { color: #b45309; }
.warmup-score.is-high { color: #15803d; }
.catalog-list {
  margin: 8px 0 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fafaf9;
  min-height: 48px;
}
.catalog-list:empty::before {
  content: "加载中…";
  display: block;
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
}
.catalog-list .catalog-empty {
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
}
.catalog-row-meta {
  min-width: 0;
  word-break: break-word;
  font-size: 14px;
}
.catalog-row-meta .cat-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.catalog-row-meta .cat-badge.ws {
  background: #ccfbf1;
  color: #0f766e;
}
.catalog-row-meta .cat-badge.pl {
  background: #e7e5e4;
  color: #57534e;
}
.catalog-row-meta .cat-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.geo-wizard {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid #99d6cb;
  border-left: 4px solid var(--accent);
  background: #f0faf8;
}
.geo-wizard .now-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.geo-wizard label { margin-bottom: 0; }
.geo-wizard button { margin-top: 18px; }
.sender-limit-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}
.sender-limit-inline input {
  width: 72px;
  margin-top: 0;
  display: inline-block;
  padding: 6px 8px;
}

/* ---- probe modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  max-width: 520px;
  width: 100%;
  max-height: min(84vh, 640px);
  overflow: auto;
  padding: 18px 20px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.modal-actions button {
  margin-top: 0;
}
.modal-card.modal-wide {
  max-width: min(960px, 96vw);
  max-height: min(88vh, 820px);
}
.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  margin: 6px 0 4px;
  color: var(--ink);
}
.preview-meta span {
  background: #f5f0e8;
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 4px;
}
.preview-table-wrap {
  overflow: auto;
  max-height: min(48vh, 420px);
  border: 1px solid var(--line);
  margin-top: 8px;
}
.preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.preview-table th,
.preview-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-table th {
  position: sticky;
  top: 0;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}
.preview-table tr:hover td {
  background: #faf7f2;
}
.preview-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 2px;
}
.preview-filters button {
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
}
.preview-filters button.is-on {
  background: #1c1917;
  color: #faf7f2;
  border-color: #1c1917;
}
.preview-table tr.is-sent td {
  background: #eef6ee;
}
.preview-table tr.is-failed td {
  background: #f8ecec;
}
.probe-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 12px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.probe-row .probe-from {
  font-size: 13px;
  font-weight: 600;
}
.probe-row input[type="email"] {
  margin-top: 2px;
}

/* ---- sticky terminal ---- */
.term-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  border-top: 2px solid var(--accent);
  background: var(--term-bg);
  box-shadow: 0 -4px 16px rgba(0,0,0,.18);
  max-height: min(22vh, 160px);
  display: flex;
  flex-direction: column;
}
.term-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  border-bottom: 1px solid #292524;
  color: var(--term-fg);
  font-size: 12px;
  flex-shrink: 0;
}
.term-title { font-weight: 700; color: #fff; }
.term-sub { color: #a8a29e; flex: 1; }
.term-clear,
.term-stop {
  margin: 0;
  padding: 2px 8px;
  font-size: 11px;
  background: #292524;
  color: #e7e5e4;
  border-color: #44403c;
}
.term-stop {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}
.term-stop:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.terminal {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 12px 10px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--term-fg);
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal .line { margin: 0 0 4px; }
.terminal .line.ok { color: var(--term-ok); }
.terminal .line.err { color: var(--term-err); }
.terminal .line.warn { color: var(--term-warn); }
.terminal .line.info { color: var(--term-info); }
.terminal .line.muted { color: #a8a29e; }
.terminal .ts { color: #78716c; margin-right: 8px; }
