/* cloud-autofriend.css —— A站自动加好友任务中心独立样式（隔离覆写 cloud.css 全局 dialog/input 规则） */
dialog.af-dialog {
  width: min(1140px, calc(100vw - 32px));
  max-width: none;
  height: min(88vh, 840px);
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
}
dialog.af-dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog.af-dialog input[type="checkbox"],
dialog.af-dialog input[type="radio"] {
  width: auto;
  margin: 0;
  flex: none;
}
dialog.af-dialog .af-inline-num {
  width: 92px;
  display: inline-block;
}
dialog.af-dialog .af-inline-sm {
  width: auto;
  min-width: 110px;
}

.af-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: none;
}
.af-head h3 {
  margin: 0;
  font-size: 16px;
}
.af-head .af-sub {
  font-size: 12px;
  color: var(--muted);
}
.af-head .grow {
  flex: 1;
}

.af-body {
  display: grid;
  grid-template-columns: 296px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.af-side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fafbfc;
  min-height: 0;
  overflow: hidden;
}
.af-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.af-side-top strong {
  font-size: 13px;
}
.af-camp-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow: auto;
  flex: 1;
  min-height: 120px;
}
.af-camp-item {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--panel);
  margin-bottom: 6px;
  cursor: pointer;
}
.af-camp-item:hover {
  border-color: #cbd5e1;
}
.af-camp-item.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.af-camp-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}
.af-camp-title .af-cname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-camp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.af-prog {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.af-prog > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

.af-acc-box {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  max-height: 36%;
  overflow: auto;
  background: var(--panel);
}
.af-acc-box h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.af-acc-row {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.af-acc-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.af-acc-row-top .af-acc-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-acc-row-sub {
  margin-top: 4px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.af-acc-alert {
  color: var(--bad);
  font-weight: 600;
}
.af-acc-warn {
  color: var(--warn);
}
.af-mini-btn {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.af-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.af-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: none;
}
.af-tab {
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.af-tab:hover {
  border-color: transparent;
  color: var(--text);
}
.af-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: var(--brand-soft);
}
.af-tabs .grow {
  flex: 1;
}

.af-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 20px;
}

.af-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.af-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel);
}
.af-card-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.af-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.af-preset-btn {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.af-preset-btn.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

.af-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.af-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}
.af-field label {
  margin: 0 0 4px;
  font-size: 12px;
}
.af-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 8px 0;
}
.af-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.af-acc-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  max-height: 112px;
  overflow: auto;
}
.af-acc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--text);
  margin: 0;
  cursor: pointer;
}

details.af-adv {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #fafbfc;
}
details.af-adv summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}
.af-adv-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.af-adv-sub {
  margin: 6px 0 0 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}

.af-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex: none;
}
.af-foot .grow {
  flex: 1;
}
.af-status-msg {
  font-size: 13px;
  margin: 0;
}
.af-status-msg.ok { color: var(--ok); }
.af-status-msg.err { color: var(--bad); }

.af-preview-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  font-size: 12px;
}
.af-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.af-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.af-toolbar select,
.af-toolbar input[type="search"] {
  width: auto;
  min-width: 150px;
}
.af-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 440px;
}
table.af-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.af-table th,
table.af-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.af-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
}
.af-st {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}
.af-st.pending { background: var(--idle-soft); color: var(--idle); }
.af-st.adding, .af-st.added_wait_greet, .af-st.greeting { background: var(--brand-soft); color: var(--brand); }
.af-st.done { background: var(--ok-soft); color: var(--ok); }
.af-st.already_friend { background: var(--warn-soft); color: var(--warn); }
.af-st.not_found, .af-st.failed, .af-st.greet_failed { background: var(--bad-soft); color: var(--bad); }

/* 四端导入格式指引与 CSV 样板预览（2×2 对称排版） */
.af-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.af-spec-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
  min-width: 0;
}
.af-spec-card.current {
  border-color: var(--brand);
  background: #f5f7ff;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.14);
}
.af-spec-card.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.af-spec-card.clickable:hover {
  border-color: var(--brand);
  background: #f8faff;
}
.af-spec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.af-spec-head .af-spec-cur {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.af-spec-head .af-spec-switch-btn {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--panel);
  color: var(--brand);
  cursor: pointer;
  white-space: nowrap;
}
.af-spec-head .af-spec-switch-btn:hover {
  background: var(--brand);
  color: #fff;
}
.af-spec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.af-spec-list li {
  font-size: 12px;
  line-height: 1.45;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--line);
}
.af-spec-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.af-spec-fname {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}
.af-spec-mode {
  font-size: 10px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
}
.af-spec-ex {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: #1e293b;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.af-spec-note {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.af-spec-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.af-csv-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--panel);
}
.af-csv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.af-csv-head strong {
  font-size: 13px;
}
.af-csv-head .grow {
  flex: 1;
}
.af-csv-pre {
  margin: 6px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: #1e293b;
}

@media (max-width: 1020px) {
  .af-spec-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .af-body { grid-template-columns: 1fr; }
  .af-side { max-height: 34%; border-right: 0; border-bottom: 1px solid var(--line); }
  .af-grid-2, .af-grid-3 { grid-template-columns: 1fr; }
}
