:root {
  --bg: #f3efe6;
  --panel: #fffdf8;
  --ink: #1c1914;
  --muted: #6b6458;
  --line: #ddd4c4;
  --accent: #0f6e56;
  --accent-2: #c45c26;
  --danger: #a33b2b;
  --shadow: 0 10px 30px rgba(40, 30, 10, 0.06);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff8e8, transparent 40%),
    linear-gradient(180deg, #efe7d8, var(--bg));
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.top-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.instance-meta {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.logout-button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.78rem;
}

.signin-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.signin-shell {
  width: min(430px, calc(100% - 32px));
  margin: 32px auto;
}

.signin-card {
  padding: 30px;
}

.signin-brand {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.signin-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.signin-form[hidden] {
  display: none;
}

.signin-form label {
  display: grid;
  gap: 7px;
  font-weight: 650;
}

.signin-form input {
  width: 100%;
  box-sizing: border-box;
}

.signin-form button {
  width: 100%;
  margin-top: 4px;
}

.signin-message {
  min-height: 24px;
  margin-top: 18px;
  color: var(--muted);
}

.signin-message.bad {
  color: var(--bad);
}

.signin-message.good {
  color: var(--good);
}

.signin-help {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.sub,
.note,
.warn {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.warn {
  color: var(--danger);
  margin-top: 10px;
}

.status {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.status.busy {
  border-color: #b9a46a;
  background: #fff4d6;
}

.hint {
  background: #e7f3ee;
  border: 1px solid #b7d7cb;
  color: #214f42;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  line-height: 1.55;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-guide {
  padding: 20px;
  border-color: #b7d7cb;
  background:
    linear-gradient(135deg, rgba(231, 243, 238, 0.82), rgba(255, 253, 248, 0.96) 60%);
}

.customer-guide .panel-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.customer-guide h2 {
  font-size: 1.25rem;
}

.customer-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.customer-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.82rem;
}

.customer-step span {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #ece5d9;
  font-weight: 750;
}

.customer-step strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-step.done {
  border-color: #b7d7cb;
  background: #eff8f4;
  color: #0f6e56;
}

.customer-step.done span {
  background: var(--accent);
  color: #fff;
}

.customer-step.active {
  border-color: #d99c78;
  background: #fff7ef;
  color: #8f431e;
}

.customer-step.active span {
  background: var(--accent-2);
  color: #fff;
}

.customer-step.pending {
  opacity: 0.72;
}

.next-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(40, 30, 10, 0.05);
}

.next-action-card h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.next-action-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.next-action-card button {
  flex: 0 0 auto;
  min-width: 128px;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.compact-details > summary {
  list-style: none;
  margin: 0;
  cursor: pointer;
}

.compact-details > summary::-webkit-details-marker {
  display: none;
}

.compact-details > summary::after {
  content: "展开";
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.compact-details[open] > summary::after {
  content: "收起";
}

.compact-details[open] > summary {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.setup-panel > summary .note {
  margin-left: auto;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

button:hover {
  background: #f7f1e6;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  filter: brightness(1.05);
}

button.accent {
  background: #2f5d8a;
  border-color: #2f5d8a;
  color: #fff;
}

button.danger {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.account-item.active {
  border-color: #2f5d8a;
  background: #f3f7fb;
}

.account-item .acc-name {
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.account-item .acc-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.account-item .acc-actions {
  display: flex;
  gap: 6px;
}

.account-item .acc-actions button {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.account-add {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.account-add-actions {
  margin-bottom: 12px;
}

.acc-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #e8f0f8;
  color: #2f5d8a;
  font-size: 0.75rem;
  font-weight: 600;
}

.page-list {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.page-picker-panel .page-list {
  max-height: 390px;
}

.selection-count {
  max-width: 58%;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1ece3;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-count.ready {
  background: #e5f5ef;
  color: #0f6e56;
}

.selection-count.bad {
  background: #fff1ed;
  color: var(--danger);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.ok-title {
  margin: 0;
  font-size: 0.92rem;
  color: #0f6e56;
}

.bad-title {
  margin: 0;
  font-size: 0.92rem;
  color: var(--danger);
}

.warn-title {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: #8a6d1d;
}

.muted-list {
  background: #f7f2ea;
}

.page-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.page-item:last-child {
  border-bottom: none;
}

.page-item strong {
  display: block;
  color: var(--ink);
}

.page-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.page-item.disabled {
  opacity: 0.75;
  background: #f3eee6;
}

.page-item.disabled input {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
}

.btn-mini {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.btn-mini:hover {
  background: #f6f1ea;
}

.logs,
.results {
  margin: 0;
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  background: #1d1a16;
  color: #f3e8d5;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.results {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.result {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.result.ok {
  color: #0f6e56;
}

.result.bad {
  color: var(--danger);
}

.batch-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #b7d7cb;
  border-radius: 12px;
  background: #f0f8f5;
  color: #214f42;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.audience-editor {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9f6ef;
}

.essential-settings {
  margin-top: 2px;
}

.inline-advanced {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #faf7f1;
}

.inline-advanced > summary {
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 650;
}

.inline-advanced-body {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.compact-check {
  margin-top: 10px;
}

.page-exceptions {
  margin-top: 12px;
}

.audience-stats {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 14px 0;
}

.workflow-strip span {
  padding: 8px 10px;
  border-radius: 9px;
  background: #eef6f3;
  color: #215244;
  font-size: 0.82rem;
  text-align: center;
}

.formal-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.daily-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.daily-actions button {
  min-height: 48px;
  font-weight: 700;
}

.operator-actions,
.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.operator-actions:empty,
.install-actions:empty {
  display: none;
}

.advanced-tools {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f4ec;
}

.advanced-tools summary {
  padding: 11px 13px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.advanced-tools-body {
  padding: 2px 13px 13px;
  border-top: 1px solid var(--line);
}

.row.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.batch-preview.bad {
  border-color: #e0b7af;
  background: #fff5f2;
  color: var(--danger);
}

.batch-preview strong {
  color: var(--ink);
}

.batch-runs {
  display: grid;
  gap: 9px;
}

.batch-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.batch-run.completed {
  border-left: 4px solid var(--accent);
}

.batch-run.partial,
.batch-run.failed {
  border-left: 4px solid var(--accent-2);
}

.batch-run-main {
  min-width: 0;
  line-height: 1.5;
}

.batch-run-main code {
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.batch-error {
  color: var(--danger);
  font-size: 0.84rem;
}

.batch-run-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.batch-run-actions button,
.batch-run-actions a {
  padding: 6px 9px;
  font-size: 0.82rem;
}

.readiness-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
}

.runtime-details .runtime-grid {
  margin: 0;
}

.runtime-details .runtime-grid > section {
  min-width: 0;
}

.readiness-item {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f7f2ea;
  font-size: 0.84rem;
  line-height: 1.4;
}

.readiness-item.ok {
  background: #eaf6f1;
  color: #0f6e56;
}

.readiness-item.bad {
  background: #fff1ed;
  color: var(--danger);
}

.login-status {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

.login-status.pending {
  background: #fff1d6;
  color: #8a5a00;
}

.login-status.logged_in {
  background: #e5f5ef;
  color: #0f6e56;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 20, 0.45);
}

.modal-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.proxy-form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.proxy-form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.helper-app {
  max-width: 820px;
}

.helper-app .account-add {
  grid-template-columns: 1fr auto;
}

.sticky-confirm .primary:not([hidden]) {
  font-size: 1.05rem;
  padding: 12px 18px;
}

.helper-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
}

.helper-card.busy {
  border-color: #b9a46a;
  background: #fffaf0;
}

.helper-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.helper-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.proxy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.proxy-table th,
.proxy-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.proxy-table th {
  background: #f7f2ea;
  color: var(--muted);
  font-weight: 600;
  width: 7.5em;
}

.proxy-table code {
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

a.button-link {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

a.button-link:hover {
  background: #f7f1e6;
}

a.button-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

a.button-link.primary:hover {
  filter: brightness(1.05);
}

a.button-link.accent {
  background: #2f5d8a;
  border-color: #2f5d8a;
  color: #fff;
}

a.button-link.accent:hover {
  filter: brightness(1.05);
}

@media (max-width: 860px) {
  .grid,
  .row,
  .split,
  .account-add {
    grid-template-columns: 1fr;
  }

  .row.two-col {
    grid-template-columns: 1fr;
  }

  .batch-run {
    grid-template-columns: 1fr;
  }

  .readiness-checks {
    grid-template-columns: 1fr;
  }

  .workflow-strip {
    grid-template-columns: 1fr 1fr;
  }

  .customer-steps {
    grid-template-columns: 1fr 1fr;
  }

  .customer-guide .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .customer-step:last-child {
    grid-column: 1 / -1;
  }

  .next-action-card {
    align-items: stretch;
    flex-direction: column;
  }

  .next-action-card button,
  .daily-actions {
    width: 100%;
  }

  .daily-actions {
    grid-template-columns: 1fr;
  }

  .account-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .account-item .acc-name,
  .account-item .acc-meta {
    min-width: 0;
  }

  .account-item .acc-actions {
    flex: 1 0 100%;
    flex-wrap: wrap;
    padding-left: 24px;
  }
}
/* 账号主页管理的搜索框与主控表单保持一致。 */
#accountPagesSearch {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #ded6c6;
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
