:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --ink: #1f2330;
  --muted: #8a8f9c;
  --line: #e6e8ee;
  --brand: #4f6ef7;
  --brand-d: #3a55d9;
  --ok-c: #16a34a;
  --err-c: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ===== 登录页 ===== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f6ef7 0%, #7b5cf0 100%);
}
.auth-card {
  width: 360px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  text-align: center;
}
.auth-logo { font-size: 46px; }
.auth-card h1 { margin: 8px 0 2px; font-size: 22px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.auth-form input {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; color: var(--ink);
}
.auth-form input:focus { outline: none; border-color: var(--brand); }
.auth-form button {
  margin-top: 6px; padding: 12px; border: none; border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 15px; cursor: pointer;
}
.auth-form button:hover { background: var(--brand-d); }
.auth-form button:disabled { opacity: .6; cursor: default; }
.auth-err { color: var(--err-c); font-size: 13px; min-height: 18px; }
.auth-tip { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ===== 后台布局 ===== */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 16px; }
.muted { color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.cards { display: flex; gap: 14px; padding: 20px 20px 0; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.stat { padding: 16px 20px; min-width: 150px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.stat-value.green { color: var(--ok-c); }
.stat-value.red { color: var(--err-c); }

.layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; padding: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; line-height: 1.6; }

.providers { display: grid; gap: 12px; }
.provider-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.provider-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.provider-name { font-weight: 600; font-size: 14px; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 20px; background: #f0f1f5; color: var(--muted); }
.badge.ok { background: #e7f6ec; color: var(--ok-c); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.field.grow { flex: 1; }
.field input, .field select, .test-input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--ink);
  font-family: inherit;
}
.field input:focus, .field select:focus, .test-input:focus { outline: none; border-color: var(--brand); }
.mask { color: var(--muted); font-weight: 400; }
.field-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

.actions { margin-top: 8px; display: flex; align-items: center; gap: 14px; }
.btn-primary {
  border: none; background: var(--brand); color: #fff; padding: 11px 22px; border-radius: 9px;
  font-size: 14px; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-d); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.save-msg { font-size: 13px; }
.save-msg.ok { color: var(--ok-c); }
.save-msg.err { color: var(--err-c); }

.test-input { width: 100%; min-height: 90px; resize: vertical; margin: 4px 0 12px; }
.test-output {
  margin-top: 14px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px;
  white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.7; min-height: 60px;
  background: #fafbfc;
}
.test-output.muted { color: var(--muted); }

/* ===== 抠图换底色工具 ===== */
.studio { max-width: 720px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.warn {
  background: #fff7e6; border: 1px solid #ffd591; color: #ad6800;
  padding: 12px 14px; border-radius: 10px; font-size: 13.5px;
}
.warn a { color: var(--brand); }
.drop {
  border: 2px dashed var(--line); border-radius: 12px; padding: 26px; text-align: center;
  cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--brand); background: #f5f7ff; }
.drop.small { padding: 16px; }
.drop-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.drop-icon { font-size: 30px; }
.orig { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thumb { max-width: 240px; max-height: 240px; border-radius: 10px; border: 1px solid var(--line); }
.thumb.small { max-width: 120px; max-height: 120px; }
.modes { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.mode { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.optbox { margin-top: 12px; }
.swatches { display: flex; gap: 10px; margin-bottom: 12px; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.checker {
  background-image:
    linear-gradient(45deg, #e9ebf0 25%, transparent 25%),
    linear-gradient(-45deg, #e9ebf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9ebf0 75%),
    linear-gradient(-45deg, transparent 75%, #e9ebf0 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: inline-block;
}
.result { max-width: 100%; max-height: 360px; display: block; border-radius: 6px; }
